From 251430f1c7f1bef5b782d3b8006781e72cca52dc Mon Sep 17 00:00:00 2001 From: "H.C. Chen" Date: Tue, 26 Sep 2017 12:09:33 +0800 Subject: [PATCH 01/20] improved pykb.f --- playground/pykb.f | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/playground/pykb.f b/playground/pykb.f index d02b8ec..74ddd20 100644 --- a/playground/pykb.f +++ b/playground/pykb.f @@ -6,15 +6,25 @@ s" pykb.f" source-code-header - 取得 command line of DOS BOX cmd - s" where processid = 4728" objEnumWin32_Process :> item().CommandLine .s - 來看,明明是 "C:\Windows\System32\cmd.exe" (string)。而且: - s" where CommandLine = CommandLine" objEnumWin32_Process :> atEnd() - 傳回 false 表示有東西,而以下這樣竟然不行! - s" where CommandLine = 'C:\\Windows\\System32\\cmd.exe'" - objEnumWin32_Process :> atEnd() \ ==> true (boolean) 表示沒找到! - 這還不只,若用 like 最後的 % 也不能省,真搞不懂。這麼一來想濾掉 Chrome 產生的 - cmd 眼前就沒好辦法了。通通列出來吧!試 hi 看看,不行就一個個試。 + 【問題】 + + 取得 command line of DOS BOX cmd + s" where processid = 4728" objEnumWin32_Process :> item().CommandLine .s + 來看,明明是 "C:\Windows\System32\cmd.exe" (string)。而且: + s" where CommandLine = CommandLine" objEnumWin32_Process :> atEnd() + 傳回 false 表示有東西,而以下這樣竟然不行! + s" where CommandLine = 'C:\\Windows\\System32\\cmd.exe'" + objEnumWin32_Process :> atEnd() \ ==> true (boolean) 表示沒找到! + 這還不只,若用 like 最後的 % 也不能省,真搞不懂。這麼一來想濾掉 Chrome 產生的 + cmd 眼前就沒好辦法了。通通列出來吧!試 hi 看看,不行就用 + + to processid hi + + 一個個試。 + + s" where CommandLine like '%cmd.exe%'" list-them tib. + s" where name like '%python%'" list-them tib. + . cr s" where CommandLine like '%cmd.exe%'" list-them tib. From 72b1d3fe69f0833bee45f65235ec822af133eda7 Mon Sep 17 00:00:00 2001 From: "H.C. Chen" Date: Fri, 13 Oct 2017 18:12:10 +0800 Subject: [PATCH 02/20] improved git.f (for 3hta only) --- 3hta/f/git.f | 1114 +++++++++++++++++++++++++++----------------------- 1 file changed, 601 insertions(+), 513 deletions(-) diff --git a/3hta/f/git.f b/3hta/f/git.f index e999f01..e9ff20c 100644 --- a/3hta/f/git.f +++ b/3hta/f/git.f @@ -1,15 +1,15 @@ \ -\ git.f 利用 forth 的自由語法,簡化 GitHub 使用上的困難。 +\ git.f ?? forth ?????,?? GitHub ??????? \ http://github.com/hcchengithub/jeforth.3we/wiki/jeforth.3hta-GitHub-helper----git.f \ Video on Camdemy.com http://www.camdemy.com/media/19404 \ -\ GitHub 功能強大,而且一邊用它還會一邊給你很多建議。已經仁盡義至了,但是根本記不住。 -\ 今利用 jeforth 來管理這些命令跟建議。平時也可以簡化指令、做筆記、為每組命令添加 help -\ message。不管 GitHub 再怎麼複雜難用,配合 jeforth 只要 study 一次就永遠不會再忘記了。 +\ GitHub ????,????????????????????????,???????? +\ ??? jeforth ???????????????????????????????? help +\ message??? GitHub ???????,?? jeforth ?? study ???????????? \ -\ 11:36 2017-09-11 參考本程式寫成的 python multiple line input tool pykb.f -\ 換台電腦跑就有點問題,一度以為 3hta 要 run as administrator 才可以,已證實不必。 +\ 11:36 2017-09-11 ???????? python multiple line input tool pykb.f +\ ??????????,???? 3hta ? run as administrator ???,?????? \ js> vm.appname char jeforth.3hta != [if] ?abort" Sorry! git.f is for jeforth.3hta only." \s [then] @@ -18,74 +18,74 @@ s" git.f" source-code-header - \ 簡介 + \ ?? \ ==== - \ Git 是一套分散式版本控管系統(DVCS; Distributed Version Control System)。 - \ 支援本地操作 [x] yeah sure it is. - \ 備份容易 [x] simply copy the entire folder. - \ 功能強大且彈性的分支與合併等等 [x] help branch - \ 完整的 Git 版控支援、 - \ 議題追蹤與管理 [x] The 'issues' on GitHub web. - \ 線上 Wiki 文件管理 [x] The 'wiki' on GitHub web. - \ 友善的原始碼審核(Code Review)介面。 [x] Click on the commit code on GitHub web to see the 'diff'. + \ Git ????????????(DVCS; Distributed Version Control System)? + \ ?????? [x] yeah sure it is. + \ ???? [x] simply copy the entire folder. + \ ??????????????? [x] help branch + \ ??? Git ????? + \ ??????? [x] The 'issues' on GitHub web. + \ ?? Wiki ???? [x] The 'wiki' on GitHub web. + \ ????????(Code Review)??? [x] Click on the commit code on GitHub web to see the 'diff'. \ How to run git shell \ -------------------- - \ use Github for Windows to open the git shell through the [setting] button + \ use Github for Windows to open the git shell through the [setting] button \ at the upper right corner. We can change default shell to dos, powershell, or linux. - \ 中英名詞 + \ ???? \ ======== - \ 「版本」= commit - \ 版本控管 = tracked - \ 【索引】或【快取】= index cache - \ Git 版本庫 = repository - \ cached = Staged (準備好 to commit) - \ - - \ 第 01 天:認識 Git 版本控管 + \ ????= commit + \ ???? = tracked + \ ?????????= index cache + \ Git ??? = repository + \ cached = Staged (??? to commit) + \ + + \ ? 01 ?:?? Git ???? \ =========================== - \ 「Git 的指令與參數非常多,完全超出大腦能記憶的範圍,除非每天使用,否則哪有可能一天到晚打指令進 - \ 行版控」── 哈哈!用 jeforth.3hta 可以輕鬆掌握。因為 word name 可以用中文,又有 help、comment 很方便。 - \ 「要合併多人的版本,你只要有存取共用儲存庫(shared repository)的權限或管道即可。 例如:在同一台伺服器上 - \ 可以透過資料夾權限進行共用,或透過 SSH 遠端存取另一台伺服器的 Git 儲存庫,也可以透過 Web 伺服器等方 - \ 式來共用 Git 儲存庫。」 - \ 「我覺得要寫「認識 Git 版本控管」比教大家怎麼用還難許多」。 - - \ 第 02 天:在 Windows 平台必裝的三套 Git 工具 + \ ?Git ?????????,????????????,??????,?????????????? + \ ???? ??!? jeforth.3hta ????????? word name ?????,?? help?comment ???? + \ ?????????,???????????(shared repository)????????? ??:???????? + \ ?????????????,??? SSH ??????????? Git ???,????? Web ????? + \ ???? Git ????? + \ ????????? Git ?????????????????? + + \ ? 02 ?:? Windows ??????? Git ?? \ ============================================ - \ 第 1 套:Git for Windows <---- the shell tools set - \ 第 2 套:GitHub for Windows <---- 很爛,常出問題 - \ 第 3 套:SourceTree - \ 第 4 套:TortoiseGit - - \ 第 03 天:建立儲存庫 https://github.com/hcchengithub/Learn-Git-in-30-days + \ ? 1 ?:Git for Windows <---- the shell tools set + \ ? 2 ?:GitHub for Windows <---- ??,???? + \ ? 3 ?:SourceTree + \ ? 4 ?:TortoiseGit + + \ ? 03 ?:????? https://github.com/hcchengithub/Learn-Git-in-30-days \ ==================== \ There are three kind of repo's - \ 1. 在本機建立本地的儲存庫 (local repository) [x] "git init" at the repo folder - \ 2. 在本機建立一個共用的儲存庫 (shared repository) [x] "git init --bare" at the shared repo - \ ==> For Linux , Windows users seem don't need this. - \ 3. 在 GitHub 或其他 Git 平台建立遠端的儲存庫 (remote repository) + \ 1. ??????????? (local repository) [x] "git init" at the repo folder + \ 2. ????????????? (shared repository) [x] "git init --bare" at the shared repo + \ ==> For Linux , Windows users seem don't need this. + \ 3. ? GitHub ??? Git ?????????? (remote repository) \ The best way is to create on GitHub.com then clone it back to local computer \ through the "GitHub for Windows" or "Git Shell" clone command. See 'clone' command. - - \ 手動建立 shared-repository + + \ ???? shared-repository \ ---------------------------- \ ~\git-demo [master]> md .\shared-repository \ cd shared-repository - \ 然後當場執行 git init --bare - \ 他會在當前目錄建立所有 Git 儲存庫的相關檔案與資料夾,你必須特別注意,這個資料夾不能直 - \ 接拿來做開發用途,只能用來儲存 Git 的相關資訊,大多數情況下,你都不應該手動編輯這個資 - \ 料夾的任何檔案,最好透過 git 指令進行操作 - \ 這是一個「沒有工作目錄的純儲存庫」 -- bare repository. - \ 再次強調,Git 屬於「分散式版本控管」,每個人都有一份完整的儲存庫(Repository)。也就是說, - \ 當你想要建立一個「工作目錄」時,必須先取得這個「裸儲存庫」的內容回來,這時你必須使用 - \ git clone [REPO_URI] 指令「複製」(clone)一份回來才行,而透過 git clone 的過程,不但會自動 - \ 建立工作目錄,還會直接把這個「裸儲存庫」完整的複製回來。這個複製的過程,就如同「完整備份」 - \ 一樣,是把所有 Git 儲存庫中的所有版本紀錄、所有版本的檔案、...等等,所有資料全部複製回來。 - \ 手動建立工作用的 workspace + \ ?????? git init --bare + \ ??????????? Git ????????????,???????,???????? + \ ????????,?????? Git ?????,??????,???????????? + \ ???????,???? git ?????? + \ ????????????????? -- bare repository. + \ ????,Git ???????????,?????????????(Repository)?????, + \ ???????????????,??????????????????,??????? + \ git clone [REPO_URI] ??????(clone)??????,??? git clone ???,????? + \ ??????,????????????????????????????,????????? + \ ??,???? Git ????????????????????...??,??????????? + \ ???????? workspace \ -------------------------- \ github\git-demo [master +1 ~0 -0 !]> md git-workspaces \ github\git-demo [master +1 ~0 -0 !]> cd .\git-workspaces - \ 然後把 "shared repository" clone 過來 + \ ??? "shared repository" clone ?? \ github\git-demo\git-workspaces [master +1 ~0 -0 !]> git clone ..\shared-repository \ Cloning into 'shared-repository'... \ warning: You appear to have cloned an empty repository. @@ -98,7 +98,7 @@ char DESKTOP-Q94AC8A char COMPUTERNAME proc-env@ = [if] s" C:\Users\hcche\AppData\Local\GitHub\GitHub.appref-ms --open-shell" [then] char WKS-4AEN0404 char COMPUTERNAME proc-env@ = [if] s" C:\Users\hcche\AppData\Local\GitHub\GitHub.appref-ms --open-shell" [then] char WKS-31ENA852 char COMPUTERNAME proc-env@ = [if] s" C:\Users\hcche\AppData\Local\GitHub\GitHub.appref-ms --open-shell" [then] - + value git-shell-path // ( -- str ) Command line to launch Git Shell. /// Something like this: /// C:\Users\hcchen\AppData\Local\GitHub\GitHub.appref-ms --open-shell @@ -120,13 +120,13 @@ r@ :> item().ProcessId swap ( processID count | obj ) r@ js: pop().moveNext() repeat ( ... count | obj ) r> drop 1 = if else 0 then ; - + : check-shell ( -- ) \ Abort if Shell is not running. shellId not ?abort" Error! Git Shell is not running. Try 'launch-git-shell' command again." ; - + : activate-shell ( -- ) \ Active Git Shell (Git Shell's powershell.exe) 500 nap shellId ?dup if ( processID ) - s' WshShell.AppActivate ' swap + + s' WshShell.AppActivate ' swap + then 500 nap ; /// assume it's powershell : activate-jeforth ( -- ) \ Come back to jeforth.3hta 1000 nap s" WshShell.AppActivate " vm.process :> processID + 500 nap ; @@ -137,80 +137,80 @@ : ( "command line" -- ) \ Send command line to the Git Shell - compiling if - compile check-shell - \ '^' and '~' 是 sendkey 的 special character 要改成 "{^}" and "{~}" - js: push(function(){push(pop().replace(/\^/g,"{^}").replace(/~/g,"{~}"))}) - , compile activate-shell - s' WshShell.SendKeys "' literal compile swap compile + s' {enter}"' literal + compiling if + compile check-shell + \ '^' and '~' ? sendkey ? special character ??? "{^}" and "{~}" + js: push(function(){push(pop().replace(/\^/g,"{^}").replace(/~/g,"{~}"))}) + , compile activate-shell + s' WshShell.SendKeys "' literal compile swap compile + s' {enter}"' literal compile + [compile] compile activate-jeforth - else + else check-shell js> pop().replace(/\^/m,"{^}").replace(/~/g,"{~}") activate-shell s' WshShell.SendKeys "' swap + s' {enter}"' + activate-jeforth then ; immediate - + : launch-git-shell ( -- ) \ Run or activate Git Shell shellId if activate-shell else git-shell-path (fork) then begin 500 nap shellId until 500 nap activate-shell ; - + : autoexec ( -- ) \ Mimic autoexec.bat - subst x: /d - subst x: . x: - s" cd " project-name + then ; + subst x: /d + subst x: . x: + s" cd " project-name + then ; : cd ( <...> -- ) \ The DOS command 'change directory'. s" cd " CR word + ; - + : (cd) ( "..." -- ) \ The DOS command 'change directory'. s" cd " swap + ; - + : CLS ( <...> -- ) \ The DOS command 'Clear screen', also clear jeforth output box. cls cls ; /// 'er' to erase only the jeforth output box. - /// 改大寫避免老是誤用 + /// ????????? : dir ( <...> -- ) \ The DOS command 'View directory'. s" dir " CR word + ; /// 'ls' to list repository. - + : init ( -- ) \ Create a new git repository at the current directory git init ; /// Don't worry about re-init a git again. It's idiot-proof, it responses something like: /// Reinitialized existing Git repository in D:/hcchen/Dropbox/learnings/github/... - + : status ( -- ) \ Git status of the repository git status ; - : 垃圾回收 ( -- ) \ Clean garbage 清理殘留在檔案系統中的無用檔案。 + : ???? ( -- ) \ Clean garbage ???????????????? git gc --prune ; - /// Git 的垃圾回收機制,其實就是那些殘留在檔案系統中的無用檔案,這 - /// 個垃圾回收機制只會在這些無用的物件累積一段時間後自動執行,或你 - /// 也可以自行下達指令清空它。例如: git gc --prune 或單 git gc 亦可。 + /// Git ???????,???????????????????,? + /// ????????????????????????????,?? + /// ???????????????: git gc --prune ?? git gc ??? - : 重新封裝 ( -- ) \ Archive 老舊的 objects (files) 封裝進一個封裝檔 packfile 中。 + : ???? ( -- ) \ Archive ??? objects (files) ???????? packfile ?? git gc ; - /// 當一個專案越來越大、版本越來越多時,這個物件(file)會越來越多,過多的 - /// 檔案還是會檔案存取變得越來越沒效率。因此 Git 的設計有個機制可以將一群 - /// 老舊的 "物件" 自動封裝進一個封裝檔(packfile)中,以改善檔案存取效率。 - /// 重新封裝(repacking) 照理說 Git 會自動執行重新封裝等動作,但你依然可以自 - /// 行下達指令執行。例如: git gc + /// ?????????????????,????(file)?????,??? + /// ???????????????????? Git ???????????? + /// ??? "??" ??????????(packfile)?,?????????? + /// ????(repacking) ??? Git ????????????,??????? + /// ??????????: git gc : clone ( <'URI'> -- ) \ New a repository, which is from URI, at the current folder s" git clone " CR word + ; - /// git clone 將遠端儲存庫複製到本地,並建立工作目錄與本地儲存庫, - /// 也就是 .git 資料夾。 + /// git clone ???????????,?????????????, + /// ??? .git ???? /// Example: clone https://github.com/figtaiwan/forthtranspiler - /// clone 下來是在 current directory 之下自動 md project folder 而非以 - /// current directory 當作 project folder。本地的就是一個 "branch"。 - /// 如果本地的 github/forthtranspiler 不是空的, 則: - /// fatal: destination path 'forthtranspiler' already exists and is - /// not an empty directory. Local 已經有東西的就要用 pull 的, 參「第8天」。 - /// 如果你用 git clone https://balbal.git 去複製的是一個 「沒有版本」的 - /// 空白 Git 儲存庫,將會得到一個 warning: You appear to have cloned - /// an empty repository. 警告訊息,不過這不影響你上傳本地的變更。 - /// The best way to create a new project is doing it on GitHub.com - /// then clone it back to local computer through the "GitHub for Windows" + /// clone ???? current directory ???? md project folder ??? + /// current directory ?? project folder???????? "branch"? + /// ????? github/forthtranspiler ????, ?: + /// fatal: destination path 'forthtranspiler' already exists and is + /// not an empty directory. Local ????????? pull ?, ???8??? + /// ???? git clone https://balbal.git ??????? ??????? + /// ?? Git ???,?????? warning: You appear to have cloned + /// an empty repository. ????,??????????????? + /// The best way to create a new project is doing it on GitHub.com + /// then clone it back to local computer through the "GitHub for Windows" /// or clone command. @@ -250,65 +250,65 @@ to read about a specific subcommand or concept. . ; - \ 第 04 天:常用的 Git 版本控管指令 - \ master 代表目前工作目錄是 master 分支,也是 Git 的預設分支名稱。 - \ 「紅色」的數字都代表 Untracked (未追蹤) 的檔案,也就是這些變更都不會進入版本控管(commit)。 - \ +10 代表有 10 個「新增」的檔案 - \ ~0 代表有 0 個「修改」的檔案 - \ -0 代表有 0 個「刪除」的檔案 - \ 「綠色」的數字都代表 Staged (準備好) 的檔案,也就是這些變更才會進入版本控管(commit)。 - \ +23 代表有 23 個「新增」的檔案將被建立一個版本 - \ ~0 代表有 0 個「修改」的檔案將被建立一個版本 - \ -0 代表有 0 個「刪除」的檔案將被建立一個版本 + \ ? 04 ?:??? Git ?????? + \ master ????????? master ??,?? Git ???????? + \ ?????????? Untracked (???) ???,????????????????(commit)? + \ +10 ??? 10 ???????? + \ ~0 ??? 0 ???????? + \ -0 ??? 0 ???????? + \ ?????????? Staged (???) ???,???????????????(commit)? + \ +23 ??? 23 ???????????????? + \ ~0 ??? 0 ???????????????? + \ -0 ??? 0 ???????????????? : add ( <...> -- ) \ Add file(s) into the cache of the repo (the project) s" git add " CR word + ; - /// 注意,pathname 有分大小寫,靠,弄錯了沒有 warning 等你自己慢慢發現! + /// ??,pathname ?????,?,????? warning ????????! /// Usage: add name1 name2 ... , wild card '*', '?' and '.' supported. - /// 'add' 把檔案加進 tracked 且進 cache 準備 commit。原本是 tracked 或 - /// untracked 都得經過 add 才會進 cache。別以為只有新檔才需要 add 因為 - /// 即使是已經 tracked 的檔案也不會自動進 cache 故也不會自動被 commit 到 - /// 但的確 add 過的檔案從此就變成 tracked 了。 - /// "git add ." 會將所有檔案(含子目錄)加入到 working directory 的索引中。 + /// 'add' ????? tracked ?? cache ?? commit???? tracked ? + /// untracked ???? add ??? cache??????????? add ?? + /// ????? tracked ????????? cache ??????? commit ? + /// ??? add ????????? tracked ?? + /// "git add ." ??????(????)??? working directory ????? - : commit ( <...> -- ) \ Save the cache into the repository. 把 tracked files 都 commit 進 repository. + : commit ( <...> -- ) \ Save the cache into the repository. ? tracked files ? commit ? repository. s" git commit " CR word + ; /// Usage: commit [-m "Descriptions"] - /// 先用 'add' 把檔案加進 cache 才 commit 得到它。原本是 tracked 或 - /// untracked 都得經過 add 才會進 cache。別以為只有新檔才需要 add 因 - /// 為即使是已經 tracked 的檔案也不會自動進 cache 故也不會自動被 - /// commit 到。以前 commit 好像叫做 checkin? - - \ 注意! pathname 有分大小寫,弄錯了不會有 warning, 靠。 - \ github\forthtranspiler [master +1 ~1 -0 !]> git add readme.md <------ 應該是 README.md 大小寫有分,但不會有任何警告! - \ github\forthtranspiler [master +1 ~1 -0 !]> git add readme.mdddd <--- 檔案真的不存在才會有 error + /// ?? 'add' ????? cache ? commit ??????? tracked ? + /// untracked ???? add ??? cache??????????? add ? + /// ?????? tracked ????????? cache ??????? + /// commit ???? commit ???? checkin? + + \ ??! pathname ?????,?????? warning, ?? + \ github\forthtranspiler [master +1 ~1 -0 !]> git add readme.md <------ ??? README.md ?????,????????! + \ github\forthtranspiler [master +1 ~1 -0 !]> git add readme.mdddd <--- ?????????? error \ fatal: pathspec 'readme.mdddd' did not match any files - \ github\forthtranspiler [master +1 ~1 -0 !]> git status <---- add 過之後用 status 查 + \ github\forthtranspiler [master +1 ~1 -0 !]> git status <---- add ???? status ? \ On branch master \ Your branch is up-to-date with 'origin/master'. \ \ Changes not staged for commit: \ (use "git add ..." to update what will be committed) - \ (use "git checkout -- ..." to discard changes in working directory) <------ 這個有用! + \ (use "git checkout -- ..." to discard changes in working directory) <------ ????! \ - \ modified: README.md <-------------- 只說是 modified 但仍是紅色,表示 unstaged + \ modified: README.md <-------------- ??? modified ?????,?? unstaged \ \ Untracked files: \ (use "git add ..." to include in what will be committed) \ - \ cfg.bat <------ 當然是紅色的 + \ cfg.bat <------ ?????? \ \ no changes added to commit (use "git add" and/or "git commit -a") - \ 我用 git add . 才終於把 readme.md 搞成 staged (綠色),從而發現大小寫有分,真的是困難重重。 - \ D:\hcchen\Dropbox\learnings\github\forthtranspiler [master +1 ~1 -0 !]> git add README.md <----- 大小寫對了 + \ ?? git add . ???? readme.md ?? staged (??),?????????,???????? + \ D:\hcchen\Dropbox\learnings\github\forthtranspiler [master +1 ~1 -0 !]> git add README.md <----- ????? \ D:\hcchen\Dropbox\learnings\github\forthtranspiler [master +0 ~1 -0 | +1 ~0 -0 !]> git status \ On branch master \ Your branch is up-to-date with 'origin/master'. \ \ Changes to be committed: - \ (use "git reset HEAD ..." to unstage) <--- 很貼心,但 HEAD 又是啥意思? + \ (use "git reset HEAD ..." to unstage) <--- ???,? HEAD ?????? \ - \ modified: README.md <------ 綠色 + \ modified: README.md <------ ?? \ \ Untracked files: \ (use "git add ..." to include in what will be committed) @@ -321,9 +321,9 @@ \ D:\hcchen\Dropbox\learnings\github\forthtranspiler [master +1 ~0 -0 !]> git status \ On branch master \ Your branch is ahead of 'origin/master' by 1 commit. - \ (use "git push" to publish your local commits) <------ 實在有夠貼心,被罵夠了。 - \ 揣摩,要先 commit 然後 push 才會上網。 - \ 上哪個網?自己的,還是原來的? See ^111 + \ (use "git push" to publish your local commits) <------ ??????,????? + \ ??,?? commit ?? push ????? + \ ????????,?????? See ^111 \ Untracked files: \ (use "git add ..." to include in what will be committed) \ @@ -331,27 +331,29 @@ \ \ nothing added to commit but untracked files present (use "git add" to track) \ D:\hcchen\Dropbox\learnings\github\forthtranspiler [master +1 ~0 -0 !]> - - \ git rm 相對於 add 但還會真的把檔案殺掉,別用。請用咱的 untrack 、 untrack-folder 讚! - \ git reset 就是把 tracking 全抹掉,要重新 add。 - \ git log 很有用! + \ git rm ??? add ??????????,??????? untrack ? untrack-folder ?! + \ git reset ??? tracking ???,??? add? - : log-verbose ( -- ) \ Read the commit log, 'q' to stop. - git log ; + \ git log ???! + + : log-verbose ( [options...] -- ) \ Read the commit log, 'q' to stop. + s" git log " CR word + ; + /// See also 'log' command. /// "git log -10" to see only the recent 10 commits + /// log-verbose origin \ to see also newer commits - : 還原檔案 ( -- ) \ 把檔案從「最後的 commit」裡恢復回來。 + : ???? ( -- ) \ ???????? commit??????? s" git checkout -- " CR word + ; - /// 若要把檔案退回到指定的版本則用另一種寫法: + /// ????????????????????: /// git checkout path/Gruntfile.js last alias retrieve last alias recall - - : 徹底還原 ( -- ) \ 把所有改過的都重新 checkout 回來,小心!連新加的檔案也都殺掉。 + + : ???? ( -- ) \ ????????? checkout ??,??!??????????? git reset --hard ; - /// 做錯了?沒關係,只要執行 git reset --hard ORIG_HEAD 就可 - /// 以回復到上一版,然後再重新合併一次引發相同的衝突。 + /// ???????,???? git reset --hard ORIG_HEAD ?? + /// ???????,????????????????? : ls ( <[-u or other options]> -- ) \ Like dir of DOS, list all files of the repository. s" git ls-files " CR word + ; @@ -359,142 +361,144 @@ : ls-remote ( -- ) \ 'ls' but regarding the remote repo. s" git ls-remote " CR word + ; - /// ls-remote 顯示特定 remote repo 的 reference 名稱。包含 - /// remote branchs 與 remote tags. - - - \ 第 05 天:了解儲存庫、工作目錄、物件與索引之間的關係。<----------- 應該先閱讀這一章! - \ 使用 Git 版本控管時,會遭遇到很多分支的狀況 - \ 使用 git checkout 切換到不同分支會將你工作目錄下的目錄與檔案都改成與要切換過去的分支 - \ 下的目錄與檔案一樣。所以,適時的保持工作目錄的乾淨,是版本控管過程中的一個基本原則。 - \ object 「物件」用來保存版本庫中所有檔案與版本紀錄 - \ index 「索引」則是用來保存當下要進版本庫之前的目錄狀態。 - - \ 第 06 天:解析 Git 資料結構 - 物件結構 - + /// ls-remote ???? remote repo ? reference ????? + /// remote branchs ? remote tags. + + + \ ? 05 ?:??????????????????????<----------- ????????! + \ ?? Git ?????,??????????? + \ ?? git checkout ????????????????????????????????? + \ ????????????,????????????,???????????????? + \ object ????????????????????? + \ index ????????????????????????? + + \ ? 06 ?:?? Git ???? - ???? + : file-system-check ( -- ) \ check repository file system integity git fsck ; - /// 檢查 Git 維護的檔案系統是否完整。我上回搞亂整個 repo 之後再 - /// clone 回來成功,但 git fsck 看到一些 dangling commit, 如下者數行: + /// ?? Git ??????????????????? repo ??? + /// clone ????,? git fsck ???? dangling commit, ?????: /// dangling commit 0b8054b68a13d6e3effad469070d9535583e248c - /// 可用 git gc 把它們清掉。 + /// ?? git gc ?????? - \ 第 07 天:解析 Git 資料結構 - 索引結構 - \ 了解 tracked/untracked, modified/unmodified, staged/unstaged 必讀。 - \ 那張重要的 State diagram 狀態圖 好像在這裡。 + \ ? 07 ?:?? Git ???? - ???? + \ ?? tracked/untracked, modified/unmodified, staged/unstaged ??? + \ ????? State diagram ??? ?????? - : add-modified ( -- ) \ 忽略 untracked 僅 cache "modified" and "deleted" files. + : add-modified ( -- ) \ ?? untracked ? cache "modified" and "deleted" files. git add -u ; - /// 'add' 把檔案加進 cache 準備 commit。原本是 tracked 或 untracked 都 - /// 得經過 add 才會進 cache。別以為只有新檔才需要 add 因為即使是已經 - /// tracked 的檔案也不會自動進 cache 故也不會自動被 commit 到。 + /// 'add' ????? cache ?? commit???? tracked ? untracked ? + /// ??? add ??? cache??????????? add ??????? + /// tracked ????????? cache ??????? commit ?? - \ 第 08 天:關於分支的基本觀念與使用方式 + \ ? 08 ?:?????????????? - : list-branches ( -- ) \ List local branches 顯示出所有「本地分支」。 + : list-branches ( -- ) \ List local branches ???????????? s" git branch " ; - /// Also : list-all-branch 含 remote server 上的也列出來。 - - : create-branch ( <...> -- ) \ Create a new branch e.g. 用來 commit 剛改的東西以供實驗。 + /// Also : list-all-branch ? remote server ??????? + + : create-branch ( <...> -- ) \ Create a new branch e.g. ?? commit ?????????? s" git branch " CR word + ; - /// * 不必先 commit,故可以 commit 到新 branch 去,新的所以可以。 + /// * ??? commit,??? commit ?? branch ?,??????? /// git branch ... - - : checkout-to-new-branch ( [<...>] -- ) \ checkout to a new branch e.g. 用來 commit 剛改的東西以供實驗。 + + : checkout-to-new-branch ( [<...>] -- ) \ checkout to a new branch e.g. ?? commit ?????????? s" git checkout -b " CR word + ; - /// * 不必先 commit,故可以 commit 到新 branch 去,新的所以可以。 + /// * ??? commit,??? commit ?? branch ?,??????? /// git checkout -b ... /// Example: - /// checkout-to-new-branch , 從當前 version 分支出來。 - /// checkout-to-new-branch master , 指定要從 master 分支出來。 + /// checkout-to-new-branch , ??? version ????? + /// checkout-to-new-branch master , ???? master ????? : delete-branch ( -- ) \ Delete an existing branch. s" git branch -d " BL word + ; - /// 你不能刪除目前工作的分支,必須先切換到其他分支後,再刪除之。 - /// 沒有執行過「合併」的分支,都不能用本指令進行刪除,必須改用 - /// git branch -D feature (大寫的 -D)才能刪除該分支。 + /// ????????????,???????????,????? + /// ????????????,???????????,???? + /// git branch -D feature (??? -D)???????? : list-all-branch ( -- ) \ List all local and remote branches. git branch -a ; - /// git branch -a 顯示出所有「本地分支」與「遠端追蹤分支」。 - /// 本地分支 : 在透過 git branch 指令執行時所顯示的分支,這 - /// 些分支存在於本地端,而這些分支又常被稱為 主題分支 (Topic - /// Branch) 或 開發分支 (Development Branch),就是因為這些分支 - /// 預設不會被推送到遠端儲存庫,主要用來做開發用途。 - /// 遠端分支:顧名思義,遠端分支就是在遠端儲存庫中的分支, - /// 如此而已。你用 GitHub 是無法存取遠端分支的。 + /// git branch -a ????????????????????? + /// ???? : ??? git branch ???????????,? + /// ?????????,?????????? ???? (Topic + /// Branch) ? ???? (Development Branch),???????? + /// ?????????????,?????????? + /// ????:????,????????????????, + /// ??????? GitHub ??????????? + - : switch-branch ( -- ) \ Switch to another branch which is existing. s" git checkout " CR word + ; /// "switch branch" and "switch commit" and "checkout" are the same. - /// [ ] 不必先 commit,故現有的 cache 可以 commit 到別的 branch 去。其實 - /// 就是 checkout 某個 commit。 - /// Switch commit 到舊版,即進入了所謂的 detached HEAD 狀態,這是一種 - /// 「目前工作目錄不在最新版」的提示,你可以隨時切換到 Git 儲存庫的任 - /// 意版本,但是由於這個版本已經有「下一版」,所以如果你在目前的「舊版」 - /// 執行 git commit 的話,就會導致這個新版本無法被追蹤變更,所以建議不 - /// 要這麼做。若你要在 detached HEAD 狀態建立一個可被追蹤的版本,那麼正 - /// 確的方法則是透過「建立分支」的方式。 + /// [ ] ??? commit,???? cache ?? commit ??? branch ???? + /// ?? checkout ?? commit? + /// Switch commit ???,??????? detached HEAD ??,???? + /// ????????????????,???????? Git ????? + /// ???,????????????????,????????????? + /// ?? git commit ??,????????????????,????? + /// ????????? detached HEAD ?????????????,??? + /// ?????????????????? /// Use "git log" to see commit ID's /// Use "checkout-to-new-branch" to switch to a new branch. - /// 不允許改過檔案後,馬上 switch-branch 故意不管改過的檔案, error message - /// 如下: - /// error: Your local changes to the following files would be overwritten + /// ????????,?? switch-branch ?????????, error message + /// ??: + /// error: Your local changes to the following files would be overwritten /// by checkout: bbt.html /// Please, commit your changes or stash them before you can switch branches. - /// [ ] 不知道 *stash* 啥意思? 好像把改過的檔案保存在 repository 之外的地方。 - + /// [ ] ??? *stash* ???? ??????????? repository ?????? + last alias switch-commit // ( -- ) Switch to another commit. last alias checkout // ( <...> -- ) "git checkout" general form /// Switch HEAD to another commit, recall a file, .. etc. - \ 第 09 天:比對檔案與版本差異 + \ ? 09 ?:????????? : diff ( <[id1] [--cached] [id2]> -- ) \ List differences between comments. s" git diff " CR word + ; - /// diff => 工作目錄 vs 索引 - /// diff HEAD => 工作目錄 vs HEAD (代表最新版本 or commit) - /// diff --cached HEAD => 索引 vs HEAD - /// diff --cached => 索引 vs HEAD + /// diff => ???? vs ?? + /// diff HEAD => ???? vs HEAD (?????? or commit) + /// diff --cached HEAD => ?? vs HEAD + /// diff --cached => ?? vs HEAD /// diff HEAD^ HEAD => HEAD^ vs HEAD /// diff commit1 commit2 => commit1 vs commit2 - /// 執行 git diff 自動比對出 merge 之後到底哪些檔案的哪幾行發生衝突了。 - /// 從 <<<<<<< HEAD 到 ======= 的內容,代表 HEAD (當前 master 分支的最 - /// 新版)裡發生衝突的內容。從 ======= 到 >>>>>>> hotfixes 的內容,代表 - /// hotfixes 分支裡發生衝突的內容 + /// ?? git diff ????? merge ?????????????????? + /// ? <<<<<<< HEAD ? ======= ???,?? HEAD (?? master ???? + /// ??)?????????? ======= ? >>>>>>> hotfixes ???,?? + /// hotfixes ?????????? - \ 第 10 天:認識 Git 物件的絕對名稱 + \ ? 10 ?:?? Git ??????? + + : log ( -- ) \ List all local commit log, 'q' to stop. + git log origin --pretty=oneline --abbrev-commit ; + /// HEAD may not be at top of the list when debugging older commit. + /// See also 'log-verbose' command + + \ ? 11 ?:?? Git ???????????? - : log ( -- ) \ Read the simplified commit log, 'q' to stop. Also 'log-verbose'. - git log --pretty=oneline --abbrev-commit ; - - \ 第 11 天:認識 Git 物件的一般參照與符號參照 - \ HEAD, branch name, --cached are all references - \ 在 Git 工具中,預設會維護一些特別的符號參照,方便我們快速取得常用的 commit - \ 物件,且這些物件預設都會儲存在 .git/ 目錄下。這些符號參考有以下四個: - \ + \ ? Git ???,??????????????,??????????? commit + \ ??,???????????? .git/ ???????????????: + \ \ HEAD - \ 永遠會指向「工作目錄」中所設定的「分支」當中的「最新版」。所以當你在這個分 - \ 支執行 git commit 後,這個 HEAD 符號參照也會更新成該分支最新版的那個 commit 物件。 + \ ????????????????????????????????????? + \ ??? git commit ?,?? HEAD ?????????????????? commit ??? \ ORIG_HEAD - \ 簡單來說就是 HEAD 這個 commit 物件的「前一版」,經常用來復原上一次的版本變更。 + \ ?????? HEAD ?? commit ????????,??????????????? \ FETCH_HEAD - \ 使用遠端儲存庫時,可能會使用 git fetch 指令取回所有遠端儲存庫的物件。這個 - \ FETCH_HEAD 符號參考則會記錄遠端儲存庫中每個分支的 HEAD (最新版) 的「絕對名稱」。 + \ ????????,????? git fetch ????????????????? + \ FETCH_HEAD ??????????????????? HEAD (???) ???????? \ MERGE_HEAD - \ 當你執行合併工作時 (關於合併的議題會在日後的文章中會提到),「合併來源」的 commit - \ 物件絕對名稱會被記錄在 MERGE_HEAD 這個符號參照中。 - \ 心得:常見的 'origin' 就是一個 reference, 指到 GitHub。這個 origin 名稱是在 Git 版 - \ 本控管中慣用的預設遠端分支的參照名稱,主要目的是用來代表一個遠端儲存庫的 URL 位址。 - - : reference ( "reference" -- ) \ Create or change a reference that points to a GitHub object. + \ ????????? (??????????????????),??????? commit + \ ??????????? MERGE_HEAD ???????? + \ ??:??? 'origin' ???? reference, ?? GitHub??? origin ???? Git ? + \ ??????????????????,????????????????? URL ??? + + : reference ( "reference" -- ) \ Create or change a reference that points to a GitHub object. BL word ( "reference" "ref-name" ) s" git update-ref " swap + s" " + swap + ; /// Example of a pathname : refs\refName - /// GitHub object is usually a commit. Can also be a tree + /// GitHub object is usually a commit. Can also be a tree /// or something else that you can find in the .git folder. : symbol ( "reference-pathname" -- ) \ Create (and change?) a symbolic reference. @@ -504,112 +508,112 @@ : show-ref ( -- ) \ List all references include symbols. git show-ref ; - \ 第 12 天:認識 Git 物件的相對名稱 - - \ 第 17 天:關於合併的基本觀念與使用方式 - \ 當你在工作目錄下建立分支時,可以讓你的系統依據不同的需求分別進行開發,又不互相影響。例如 - \ 你原本穩定的系統可以放在 master 分支中進行開發,而當要修正錯誤時則額外建立一個 bugfix 分支來改 - \ 正軟體錯誤,等 Bugs 修正後,在透過「合併」的方式將 bugfix 分支上的變更重新套用到 master 上面, - \ 這就是一種主要的使用情境。事實上,執行「合併」動作時,是將另一個分支合併回目前分支,然後再手動 - \ 將另一個分支給移除,這樣才符合「兩個分支合併成一個」的概念。 - \ 在 Git 使用合併時,有一個重要的觀念是【合併的動作必須發生在同一個儲存庫中】。請回想一下, - \ 在任何一個 Git 儲存庫中,都必須存在一個 Initial Commit 物件(初始版本),而所有其他版本都會跟這 - \ 個版本有關係,這個關係我們稱為「在分支線上的可追蹤物件」(the tracked object on the branch heads) - \ ,所以你不能將一個儲存庫的特定分支合併到另一個毫不相干的儲存庫的某個分支裡。 - \ 合併的時候,如果兩個分支當中有修改到相同的檔案,但只要修改的行數不一樣,Git 就會自動幫你套 - \ 用/合併這兩個變更。但如果就這麼剛好,你在兩個分支裡面改到「同一個檔案」的「同一行」,那麼在合 - \ 併的時候就會引發衝突事件。當合併衝突發生時,Git 並不會幫你決定任何事情,而是將「解決衝突」的工 - \ 作交給「你」來負責,且這些發生衝突的檔案也都會被標示為 unmerged 狀態,合併衝突後你可以用 git - \ status 指令看到這些狀態。 - \ Git 指令找出衝突的檔案:執行 git status 或執行 git ls-files -u - \ 找到之後再用 git diff [filepath] 就可以僅比對其中一個檔案了: + \ ? 12 ?:?? Git ??????? + + \ ? 17 ?:?????????????? + \ ?????????????,????????????????????,????????? + \ ???????????? master ???????,??????????????? bugfix ???? + \ ?????,? Bugs ???,??????????? bugfix ??????????? master ??, + \ ????????????????,?????????,??????????????,????? + \ ?????????,???????????????????? + \ ? Git ?????,??????????????????????????????????, + \ ????? Git ????,??????? Initial Commit ??(????),??????????? + \ ??????,?????????????????????(the tracked object on the branch heads) + \ ,????????????????????????????????????? + \ ?????,?????????????????,???????????,Git ??????? + \ ?/????????????????,???????????????????????,???? + \ ?????????????????????,Git ???????????,??????????? + \ ?????????,????????????????? unmerged ??,????????? git + \ status ????????? + \ Git ?????????:?? git status ??? git ls-files -u + \ ?????? git diff [filepath] ?????????????: : merge ( -- ) \ Merge the commit(s) into the recent HEAD s" git merge " CR word + ; - /// 新的 GitHub for Windows 有 tutorial https://guides.github.com/introduction/flow/ - /// 圖解說明 branch > pull request > merge 的流程。 - - - \ 第 24 天:使用 GitHub 遠端儲存庫 - 入門篇 - - \ Github 端一定要去建立一個 repo 才行,不能憑空就弄上去。用網頁上的功能取得 project URI。 - \ Case A. 在 GitHub 建立一個「沒有版本」的空白 Git 儲存庫, - \ 然後透過 git clone 取得遠端儲存庫, - \ 再建立版本後上傳 - \ Case C. 在 GitHub 建立一個「有初始化版本」的 Git 儲存庫, - \ 然後透過 git clone 取得遠端儲存庫, - \ 再建立版本後上傳 - \ 最簡單的方法就是利用 GitHub for Windows 工具。你只要點擊 Clone in Desktop 按鈕,(see + /// ?? GitHub for Windows ? tutorial https://guides.github.com/introduction/flow/ + /// ???? branch > pull request > merge ???? + + + \ ? 24 ?:?? GitHub ????? - ??? + + \ Github ????????? repo ??,?????????????????? project URI? + \ Case A. ? GitHub ????????????? Git ???, + \ ???? git clone ???????, + \ ???????? + \ Case C. ? GitHub ????????????? Git ???, + \ ???? git clone ???????, + \ ???????? + \ ?????????? GitHub for Windows ???????? Clone in Desktop ??,(see \ https://www.evernote.com/shard/s22/nl/2472143/371b041f-787f-4dad-9075-98ebc870ba8b) - \ 即可自動啟動 GitHub for Windows 工具幫你下載 Git 專案。clone 是在 local 建「新」repo. - \ 之後就要用 pull 的從 remote 下來。 + \ ?????? GitHub for Windows ?????? Git ???clone ?? local ????repo. + \ ????? pull ?? remote ??? - : push.default ( -- ) \ git push 會出現一段提示,告訴你要設定 push.default 這個選項. + : push.default ( -- ) \ git push ???????,?????? push.default ????. git config --global push.default simple ; - /// 要設定 push.default 這個選項,因為這種簡寫的 git push 方法的預設行為將會 - /// 在 Git 2.0 之後發生改變,建議你透過設定 push.default 選項的方式明確指定 - /// push 的方法。詳細說明請參見 git help config 的說明文件,搜尋 push.default - /// 即可找到相關說明。我建議各位設定成 simple,以利跟日後的 Git 指令列工具的預 - /// 設值相同。 - + /// ??? push.default ????,??????? git push ????????? + /// ? Git 2.0 ??????,??????? push.default ????????? + /// push ??????????? git help config ?????,?? push.default + /// ????????????????? simple,?????? Git ??????? + /// ????? + : push ( [] -- ) \ Upload local repo up to the remote repo s" git push " CR word + ; - /// 假設本地是 GitHub 上 clone 下來的,第一次 upload 所用的命令 - /// 是:git push origin master 。當你第二次建立版本時,直接執行 git push - /// 就會自動上傳成功。 - /// git push 將本地儲存庫中目前分支的所有相關物件推送到遠端儲存 - /// 庫中。這個 origin 名稱是在 Git 版本控管中慣用的預設遠端分支的參 - /// 照名稱,主要目的是用來代表一個遠端儲存庫的 URL 位址。 + /// ????? GitHub ? clone ???,??? upload ????? + /// ?:git push origin master ???????????,???? git push + /// ????????? + /// git push ????????????????????????? + /// ????? origin ???? Git ???????????????? + /// ???,????????????????? URL ??? X:\forthtranspiler [jeforth.3hta]> git push fatal: The current branch jeforth.3hta has no upstream branch. To push the current branch and set the remote as upstream, use - + git push --set-upstream origin jeforth.3hta - + X:\forthtranspiler [jeforth.3hta]> - : push到「空」遠端 ( -- ) \ 當 GitHub 上的 repo 是空的,upload 本地成果上去必須用這個。 + : push?????? ( -- ) \ ? GitHub ?? repo ???,upload ???????????? git push -u origin master ; - /// 在 GitHub 上新建的 repo 是空的,連預設的 master 分支都沒有。此時 - /// 下達 git push 指令時必須加上 -u 參數,才能成功地把本地儲存庫上傳 - /// 到 GitHub 上的遠端儲存庫,其指令是 git push -u origin master - - \ Github 端一定要去建立一個 repo 才行,不能憑空就弄上去。用網頁上的功能取得 project URI。 - \ Case B. 在 GitHub 建立一個「沒有版本」的空白 Git 儲存庫, - \ 然後直接將現有的本地 Git 儲存庫上傳到指定的 GitHub 專案 - \ Case D. 在 GitHub 建立一個「有初始化版本」的 Git 儲存庫, - \ 然後直接將現有的本地 Git 儲存庫上傳到指定的 GitHub 專案 - - : remote ( <...> -- ) \ 對 GitHub 操作 + /// ? GitHub ???? repo ???,???? master ???????? + /// ?? git push ??????? -u ??,????????????? + /// ? GitHub ???????,???? git push -u origin master + + \ Github ????????? repo ??,?????????????????? project URI? + \ Case B. ? GitHub ????????????? Git ???, + \ ?????????? Git ????????? GitHub ?? + \ Case D. ? GitHub ????????????? Git ???, + \ ?????????? Git ????????? GitHub ?? + + : remote ( <...> -- ) \ ? GitHub ?? s" git remote " CR word + ; - /// 本地若非 clone 下來的,就必須告訴本地 Git 遠端儲存庫在哪。而如 - /// 果 GitHub 上的 repo 又是空的,這時我們可以輸入: + /// ???? clone ???,??????? Git ?????????? + /// ? GitHub ?? repo ????,????????: /// git remote add origin https://bla/bla/bla.git - /// 建立一個名為 origin 的 reference 名稱,並指向 URI 位址,也就是我們 - /// 在 GitHub 上的遠端儲存庫位址。接著就可以 push origin master。 - /// 但如果 GitHub 上的 repo 不是空的,解決的方法很簡單,只要把遠端 - /// 儲存庫的 master 分支,成功合併回我本地的分支,即可建立兩個不同版本 - /// 庫之間的關聯,這樣你就可以把本地的 master 分支推送到 GitHub 上遠端 - /// 儲存庫的 master 分支了。「合併回我本地」用 pull or fetch + merge。 - /// [ ] 疑問:怎麼不直接 merge 下來? - /// 這個 origin 名稱是在 Git 版本控管中慣用的預設遠端分支的參照名稱, - /// 主要目的是用來代表一個遠端儲存庫的 URL 位址。 + /// ?????? origin ? reference ??,??? URI ??,????? + /// ? GitHub ??????????????? push origin master? + /// ??? GitHub ?? repo ????,????????,????? + /// ???? master ??,???????????,?????????? + /// ??????,?????????? master ????? GitHub ??? + /// ???? master ????????????? pull or fetch + merge? + /// [ ] ??:????? merge ??? + /// ?? origin ???? Git ???????????????????, + /// ????????????????? URL ??? : pull ( <...> -- ) \ Get repo from GitHub and merge to local. s" git pull " CR word + ; - /// 將遠端儲存庫的 master 分支取回,並合併到本地儲存庫的 master 分支: - /// 使用 git pull origin master 指令 - /// git pull 將遠端儲存庫的最新版下載回來,下載的內容包含完整的物件儲 - /// 存庫(object storage)。並且將遠端分支合併到本地分支。(將 origin/master - /// 遠端分支合併到 master 本地分支) 所以一個 git pull 動作,完全相等 - /// 於以下兩段指令: + /// ??????? master ????,?????????? master ??: + /// ?? git pull origin master ?? + /// git pull ??????????????,????????????? + /// ??(object storage)????????????????(? origin/master + /// ??????? master ????) ???? git pull ??,???? + /// ???????: /// git fetch /// git merge origin/master - \ 剛才成功地 merge 了遠端與本地的不同版本。 11:47 2015/8/22 - \ 在公司改了很多, 已經上了 github。回家在舊版上改了一些, commit,push 時 - \ 出現下列訊息: + \ ????? merge ???????????? 11:47 2015/8/22 + \ ???????, ???? github???????????, commit,push ? + \ ??????: \ C:\Users\hcche\Documents\GitHub\jeforth.3we [master]> git push \ To https://github.com/hcchengithub/jeforth.3we.git \ ! [rejected] master -> master (fetch first) @@ -618,8 +622,8 @@ \ hint: not have locally. This is usually caused by another repository pushing \ hint: to the same ref. You may want to first integrate the remote changes \ hint: (e.g., 'git pull ...') before pushing again. - \ hint: See the 'Note about fast-forwards' in 'git push --help' for details. - \ 我照他講得先 pull 然後: + \ hint: See the 'Note about fast-forwards' in 'git push --help' for details. + \ ?????? pull ??: \ C:\Users\hcche\Documents\GitHub\jeforth.3we [master]> git pull \ remote: Counting objects: 22, done. \ remote: Total 22 (delta 11), reused 11 (delta 11), pack-reused 11 @@ -639,26 +643,26 @@ \ 9 files changed, 1827 insertions(+), 274 deletions(-) \ create mode 100644 3hta/money.f \ create mode 100644 3hta/work.f - \ 查 status : + \ ? status : \ C:\Users\hcche\Documents\GitHub\jeforth.3we [master]> git status \ On branch master \ Your branch is ahead of 'origin/master' by 2 commits. \ (use "git push" to publish your local commits) - \ 照指示 push 上去就好了。以後最好記得先 pull 再開始工作,以免搞到衝突 - \ 收拾起來更費勁。 - + \ ??? push ????????????? pull ?????,?????? + \ ???????? + : fetch ( <...> -- ) \ Get repo from GitHub w/o merge. s" git fetch " CR word + ; - /// 將遠端儲存庫的 master 分支取回,並合併到本地儲存庫的 master 分支: - /// 使用 git fetch 指令後再執行 git merge origin/master 合併動作。 - /// git fetch 將遠端儲存庫的最新版下載回來,下載的內容包含完整的 - /// 物件儲存庫(object storage)。 這個命令不包含「合併」分支的動作。 + /// ??????? master ????,?????????? master ??: + /// ?? git fetch ?????? git merge origin/master ????? + /// git fetch ??????????????,?????????? + /// ?????(object storage)? ????????????????? + + \ ? 25 ?:?? GitHub ????? - ??? - \ 第 25 天:使用 GitHub 遠端儲存庫 - 觀念篇 - - Q: 依您附圖,紅色部分都是 remotes .... 怎麼會是「本地追蹤分支」? + Q: ????,?????? remotes .... ????????????? https://github.com/doggy8088/Learn-Git-in-30-days/issues/8#issuecomment-91797074 A: 2015-04-11 17:12 GMT+08:00 Yue Lin Ho : More note: it is on day 25. @@ -666,85 +670,85 @@ Pro Git 3.5 Remote Branches - Remote branches are references (pointers) to the state of branches in your remote repositories. - They’re local branches that ... - 中文版 Pro Git 3.5 - - 遠端分支 - 遠端分支(remote branch)是對遠端倉庫中的分支的索引。 - 它們是一些無法移動的本地分支... - 重點在於: 雖然是用 remotes 字眼做 prefix, 但它們存在於 本地(實際上是一種 local branches) - 它的特性是要標示遠端的版本庫有一個本地分支, 你可以這樣子想它: - remotes/origin/master -> 遠端(remotes)版本庫(給它取名叫origin)有一個master分支 - - 假設, 遠端版本庫有一個本地分支叫 abc - 你clone時, - 本地版本庫為了記錄遠端版本庫有個 abc 指到某個 commit 上, - 會在本地版本庫會產生一個 remotes/origin/abc, 並同時也指向那個 commit 上 - 當你在本地版本庫的這個 commit 上, 或者 remotes/origin/abc 上產生一個本地分支 abc 時, - 本地版本庫的本地分支 abc 和 remotes/origin/abc 之間會自動產生一個 "追蹤" 闗係 - - 更詳盡的 "跟蹤" 的概念, 請參考 這裡 - 當一個本地分支(master)與遠端分支(remotes/origin/master)之間有 "跟蹤" 關係時, 才會用這個詞 - — + Remote branches are references (pointers) to the state of branches in your remote repositories. + They're local branches that ... + ??? Pro Git 3.5 + + ???? + ????(remote branch)?????????????? + ??????????????... + ????: ???? remotes ??? prefix, ?????? ??(?????? local branches) + ?????????????????????, ????????: + remotes/origin/master -> ??(remotes)???(?????origin)???master?? + + ??, ????????????? abc + ?clone?, + ???????????????? abc ???? commit ?, + ???????????? remotes/origin/abc, ???????? commit ? + ??????????? commit ?, ?? remotes/origin/abc ????????? abc ?, + ?????????? abc ? remotes/origin/abc ????????? "??" ?? + + ???? "??" ???, ??? ?? + ???????(master)?????(remotes/origin/master)??? "??" ???, ?????? + - Reply to this email directly or view it on GitHub. - - : 手動加入一個「遠端儲存庫」 ( -- ) + + : ????????????? ( -- ) s" git remote add " CR word + ; - /// 事實上你可以在你的工作目錄中,建立多個遠端儲存庫的參照位址。 - /// 看不太懂。see 第 25 天:使用 GitHub 遠端儲存庫 - 觀念篇 - + /// ??????????????,??????????????? + /// ?????see ? 25 ?:?? GitHub ????? - ??? + : list-uri ( -- ) \ List associated URIs on GitHub.com git remote -v ; - - \ 第 26 天:多人在同一個遠端儲存庫中進行版控 + + \ ? 26 ?:???????????????? : ver ( -- ) \ Git version git --version ; - /// 請確定你的 git 版本是在 1.7.10以上。 + /// ????? git ???? 1.7.10??? /// http://jlord.us/git-it/challenges-zhtw/get_git.html : config ( <[...]> -- ) \ The 'git config' general s" git config " CR word + ; : list-config ( -- ) \ List the entire configuarations - git config -l ; - /// ( ^111 ) 從這裡面可以看出本 project 的 remote.origin.url - /// 以 jeforth.3we 為例 https://github.com/hcchengithub/jeforth.3we.git - /// 以 project-k 為例 https://github.com/hcchengithub/project-k - /// 還可以看到好多 alias 、 diff.tool 、 merge.tool 等可以進一步探討。 + git config -l ; + /// ( ^111 ) ????????? project ? remote.origin.url + /// ? jeforth.3we ?? https://github.com/hcchengithub/jeforth.3we.git + /// ? project-k ?? https://github.com/hcchengithub/project-k + /// ??????? alias ? diff.tool ? merge.tool ????????? - : 設定你的名字 ( "useer-name" -- ) \ Setup the user name + : ?????? ( "useer-name" -- ) \ Setup the user name s" git config --global user.name " BL word + ; - /// 讓 Git 知道這台電腦所做的修改該連結到什麼使用者 - /// 這個用不著,灌 "GitHub for Windows" 的過程已經搞定。 - - : 設定你的電子信箱 ( "email-address" -- ) \ Setup the user's email address + /// ? Git ???????????????????? + /// ?????,? "GitHub for Windows" ???????? + + : ???????? ( "email-address" -- ) \ Setup the user's email address s" git config --global user.email " BL word + ; - /// 讓 Git 知道這台電腦所做的修改該連結到什麼使用者 - /// 這個用不著,灌 "GitHub for Windows" 的過程已經搞定。 - + /// ? Git ???????????????????? + /// ?????,? "GitHub for Windows" ???????? + : untrack ( ... -- ) \ Untrack, remove a file from repo w/o deleting it s" git rm --cached " CR word + ; last alias unstage - /// 當初是 add 命令 track 進去的,用 git rm --cached filename 脫離。 - + /// ??? add ?? track ???,? git rm --cached filename ??? + : untrack-folder ( ... -- ) \ Untrack, remove a directory from repo w/o deleting it s" git rm --cached -r " CR word + ; last alias unstage-folder - /// 當初是 add 命令 track 進去的,用 git rm --cached -r pathname 脫離。 + /// ??? add ?? track ???,? git rm --cached -r pathname ??? - hcchen5600 2015/04/17 21:23:33 - 昨天家裡電腦又 GitHub repository 大亂。可能是 GFW 干擾 Dropbox 同步所造成。也可能是 GitHub - for Windows 上沒有先 commit 乾淨就按下 [Sync] button 的後果。一時心慌十分挫折。幸好公司電腦 - 的 Dropbox folder 還是先前的正常狀況,回公司 commit 上 GitHub 先修復 remote。 - 家裡的 .git 已經大亂,size 竟有 47M 正常的才 19M。修復過程: 先 md 一個暫時的 folder, 然後 - 從 GitHub 上 clone 下來。檢查 local jeforth.3we 裡 ignored 的檔案先 copy 到 temp folder,最 - 後 copy temp 過來蓋掉 local。結果 local size 變成 60M 只好這樣。裡面的垃圾以後再看怎麼清。 - ==> After「垃圾回收」command, only 27M now. + hcchen5600 2015/04/17 21:23:33 + ??????? GitHub repository ?????? GFW ?? Dropbox ?????????? GitHub + for Windows ???? commit ????? [Sync] button ??????????????????? + ? Dropbox folder ?????????,??? commit ? GitHub ??? remote? + ??? .git ????,size ?? 47M ???? 19M?????: ? md ????? folder, ?? + ? GitHub ? clone ????? local jeforth.3we ? ignored ???? copy ? temp folder,? + ? copy temp ???? local??? local size ?? 60M ?????????????????? + ==> After??????command, only 27M now. @@ -757,199 +761,199 @@ git rm --cached -r mydirectory ==> untrack-folder ( pathname -- ) \ Untrack, remove a directory from repo w/o deleting it -[ ] 新 project 在 github.com 上建立之後會出現下列指引: - - …or create a new repository on the command line +[ ] ? project ? github.com ????????????: + + .or create a new repository on the command line echo # wiki >> README.md git init git add README.md git commit -m "first commit" git remote add origin https://github.com/ForthHub/wiki.git git push -u origin master - - …or push an existing repository from the command line + + .or push an existing repository from the command line git remote add origin https://github.com/ForthHub/wiki.git git push -u origin master - - …or import code from another repository + + .or import code from another repository You can initialize this repository with code from a Subversion, Mercurial, or TFS project. Import code - + -: Digest:Git分支管理策略 ( -- ) \ Digest of the article《Git 分支管理策略》from 阮一峰的網絡日誌 - - /* .. 是寫東西進 HTML 的 裡 */ +: Digest:Git?????? ( -- ) \ Digest of the articleGit ??????from ???????? + + /* .. ????? HTML ? ? */ - drop \ /* 丟掉 .. 留下來的 - drop \ /* ?? .. ???? OK \\n\\n > js> $(\\\"style\\\")[1].outerHTML .\\n OK \\n\\n > js> $(\\\"style\\\")[2].outerHTML .\\n OK \\n\\n > js> $(\\\"style\\\")[3].outerHTML .\\n OK \\n\\n[ ] 蓋過去行不行?\\n js> $(\\\".console3we\\\").length .\\n\\n\\n\",\"mode\":true,\"readonly\":false}","Study XMLHttpRequest object 2016-07-06":"{\"doc\":\"[ ] Study how to *write* files to local disk on super-chrome jeforth.3htm\\n --> 先前有找到過一個例子, 可以把網頁上的 pictures drag-drop 一下就 save 成 local file\\n Ynote: \\\"jeforth 研究 Chrome extension 存檔到本地 disk 的方法\\\" the thing is \\\"XMLHttpRequest\\\" \\n --> Study XMLHttpRequest @ http://www.w3school.com.cn/xml/xml_http.asp\\n var x =new XMLHttpRequest(); x constant xmlhttp // ( -- obj ) XMLHttpRequest object\\nxmlhttp :: open(\\\"GET\\\",\\\"a.html\\\",true)\\nxmlhttp :: send(null)\\ntry on 3hta ... error : access denied\\ntry on jeforth.3nw --> it works! \\n\\n\\nStudy XMLHttpRequest object \\nhttp://www.w3school.com.cn/xml/xml_http.asp\\n\\n> var x =new XMLHttpRequest(); x constant xmlhttp // ( -- obj ) XMLHttpRequest object\\n> xmlhttp . ==> [object XMLHttpRequest] \\\\ this is how it looks like\\n> xmlhttp :: open(\\\"GET\\\",\\\"a.html\\\",true) \\\\ try to read something from the server, a.html is not existing.\\n> xmlhttp :: send(null) \\\\ arm the instruction.\\n> xmlhttp :> readyState . ==> 4 \\\\ 4 is \\\"loaded\\\" or \\\"complete\\\"\\n> xmlhttp :> status \\\\ ==> 0 (number) \\\\ 0 is \\\"uninitialized\\\", a.html is not existing remember?\\n\\n\\\\ Try again\\n> xmlhttp :: open(\\\"GET\\\",\\\"index.html\\\",true) \\\\ now index.html is jeforth.3htm's main page\\n \\\\ the 3'rd argument Async = True 表示脚本会在 send() 方法之后继续执行,而不等待来自服务器的响应。\\n> xmlhttp :: send(null)\\n\\n\\\\ 照理說這時候要等 event xmlhttp.onreadystatechange=state_Change_event_handler; \\\\ or false if event not used\\n\\n> xmlhttp :> readyState \\\\ ==> 4 OK \\n> xmlhttp :> status \\\\ ==> 200 (number) \\\\ Bingo!! 200 is OK\\n> xmlhttp :> statusText \\\\ ==> OK (string)\\n> xmlhttp :> responseText \\\\ ==> 真的把檔案讀進來了!! Bingo !! 3nw, 3htm (super_chrome and webserver).\\n \\n \\n \\n appname \\n \\n \\n \\n\\n\\\\ 3htm/f/readtextfile.f 裡面用的是 $.get 裡面可能就是用 XMLHttpRequest.\\n\\n> xmlhttp :: open(\\\"POST\\\",\\\"222\\\",false) \\\\ 沒有 error \\n> xmlhttp :: send(\\\"1234bsdfsd\\\") \\\\ 沒有 error 但也沒效果\\n\\n\\\\ 以上 post 無效是 3nw, 3htm(super_chrome) \\n\\\\ --> 改用 3htm + webserver.f 試試看 -- same result :-(\\n\\\\ 我不瞭解 POST command 的真正意義。Server 端應該要有人把收到的 data 存成檔案。\\n\\n[ ] Server 端應該要有人把收到的 data 存成檔案。這就有點麻煩了, 還不如直接用 3nw。\\n 我以前研究過 Web server 端的程式 on 3nd, it's time to review.\\n\",\"mode\":true,\"readonly\":false}","Style for 3nw":"{\"doc\":\"

Style for 3nw

drop\\n js: outputbox.style.fontSize=\\\"1.5em\\\"\\n js: inputbox.style.fontSize=\\\"1.5em\\\"\\n editbox-style \\n .eb .box { width:90%; font-size:1.1em; /* filename */ } \\n .eb .box, .eb .ebhtmlarea { border:1px solid black; }\\n .eb .ebtextarea { font-size:1.2em }\\n .eb input { font-size:0.7em /* buttons */ }\\n .eb p { display:inline; }\\n .eb .ebname { font-size: 1em; } /* field name */\\n js: $(\\\"#ebstyle\\\")[0].innerHTML=pop() \\\\ 直接修改 ebstyle \\ncr\\n\",\"mode\":true,\"readonly\":false}","ad":"{\"doc\":\"\\n\\\\ Remove all annoying floating ad boxes. 刪除所有惱人的廣告框。\\nactive-tab :> id tabid! \\nvar divs = document.getElementsByTagName(\\\"div\\\");\\nfor (var i=divs.length-1; i>=0; i--){\\n if(divs[i].style.position){\\n divs[i].parentNode.removeChild(divs[i]);\\n }\\n}\\nfor (var i=divs.length-1; i>=0; i--){\\n if(parseInt(divs[i].style.width)<600){ // <---- 任意修改\\n divs[i].parentNode.removeChild(divs[i]);\\n }\\n}\\n\\n\",\"readonly\":true,\"mode\":true}","autoexec":"{\"doc\":\"\\njs: outputbox.style.fontSize=\\\"1.5em\\\"\\njs: inputbox.style.fontSize=\\\"1.5em\\\"\\n\",\"mode\":true,\"readonly\":false}","log of 3nw":"{\"doc\":\"[x] file input 若被 user cancel 則 sleep 得不到 stopsleeping 在那裏苦等 <--- problem!\\n> constant ff\\n> ff :> value . \\\\ ==> OK it's null string by default\\n> ff :> value . \\\\ after picking a file, it becomes a pathname\\nC:\\\\Users\\\\hcche\\\\Documents\\\\GitHub\\\\chrome-app-samples\\\\tryitnowbutton_small.png OK \\n> ff :> value . \\\\ try again but click cancel, it becomes a null string as anticipated, good!\\n> \\\\ click [cancel] clears ff.value <--- good!!\\n> ff :: onchange=function(){alert(\\\"onchange\\\")} \\\\ Add event handler, it works!\\n> \\\\ click [cancel] does not fire onchange() event unless due to the above reason that has actually been changed.\\n> ff :: oncancel=function(){alert(\\\"onCancel\\\")} <--- click [cancel] does not fire this event at all. But onchange() event got fired sometimes.\\n> ff :: onchange=function(){alert(\\\"onBigChange\\\")} \\\\ Handler can be changed and it works fine.\\n> ff :> oncancel . \\\\ ==> function (){alert(\\\"onCancel\\\")} OK check, it's there\\n> ff :> onchange . \\\\ ==> function (){alert(\\\"onBigChange\\\")} check, it's there\\n> \\\\ ff :: onabort=function(){alert(\\\"onAbort\\\")} \\\\ ==> Click cancel does not fire this either.\\n> \\\\ ff :> onabort . \\\\ ==> ff :: onabort=function(){alert(\\\"onAbort\\\")}\\n> \\\\ No, click [cancel] does not fire onabort() \\n\\n\\\\ 企圖故意製造 onchange 100% 發生的努力, 失敗了:\\n> ff :> value=\\\"dummy\\\" <--- Not allowed, see err message:\\nJavaScript error : Failed to set the 'value' property on 'HTMLInputElement': \\nThis input element accepts a filename, which may only be programmatically set \\nto the empty string.\\n\\n\\\\ 機會 : 每個 file input 都是新的, 用完馬上 remove 掉, 有機會讓所有的 cancel 都 fire \\n\\\\ onchange() event? --> 一上來馬上 cancel 因為 file.value 都是 null string 沒有變故\\n\\\\ 不會 fire onchange() event. --> 試試為 file.value 給訂初值 --> No way, see:\\n\\\\ 为安全起见,file-upload 元素不允许 HTML 作者或 JavaScript 程序员指定一个默认的文件名。\\n\\nff :> defaultValue \\\\ ==> null string.\\n constant fff\\nff :: onbeforedeactivate=function(){alert(\\\"beforeDeActivate\\\")} \\\\ <== fire when blur, 不適合.\\n\\nff :: onblur=function(){alert(\\\"onblur\\\")} <-- fired when both clicking [瀏覽] and \\nclick desk top but not clicking [cancel], shit!!!\\n\\n[x] 解決了! 3nw 會 fire oncancel() when [cancel] clicked!! Bingo!!\\nff :: onemptied=function(){type(\\\"onemptied\\\")}\\nff :: onended=function(){type(\\\"onended\\\")}\\nff :: onerror=function(){type(\\\"onerror\\\")}\\nff :: onerrorupdate=function(){type(\\\"onerrorupdate\\\")}\\nff :: onfilterchange=function(){type(\\\"onfilterchange\\\")}\\nff :: onfocus=function(){type(\\\"onfocus\\\")}\\nff :: onfocusin=function(){type(\\\"onfocusin\\\")}\\nff :: onfocusout=function(){type(\\\"onfocusout\\\")}\\nff :: onhelp=function(){type(\\\"onhelp\\\")}\\nff :: oninput=function(){type(\\\"oninput\\\")}\\nff :: onchange=function(){type(\\\"onChange\\\")}\\nff :: oncancel=function(){type(\\\"oncancel\\\")}\\n\\n3hta\\nonfocusin onfocus onfocusout \\nonfocusin onfocus onfocusout\\n\\n3nw\\nonfocus \\nonfocus oncancel\\nonfocus \\nonfocus oncancel\\n\\n[x] Answer to stackoverflow with my finding of oncancel() works!\\n http://stackoverflow.com/questions/10127492/capturing-cancel-event-on-input-type-file\\n\\n I have the same question, the solution is surprisingly very \\n easy ... at least in my case NW.js (Node-Webkit) fires oncancel \\n event if user click the [cancel] button in the file chooser \\n dialogue. You use this simple and native way if you're also on \\n NW.js (process.version is v5.11.0).\\n\\n I also tried Microsoft HTA on Windows 10, it does not fire the \\n oncancel event.\\n\\n' --- [if] --- [then] marker --- \\n\\n \\n \\n\\n\\n\\nThe above sample code, modified for jeforth, from \\nhttp://stackoverflow.com/questions/29705135/node-webkit-read-full-path-of-files-from-directory\\nworks fine, very well. No problem at all getting the full pathname on 3nw, but not on 3ce. So, \\nNW.js is really provides super power.\\n\\n\\\\ Works fine on 3nw,\\n> js> $(\\\"#fileDialog\\\").length \\\\ ==> 1 OK \\n> js> $(\\\"#fileDialog\\\")[0].value . \\\\ ==> C:\\\\Users\\\\hcche\\\\Downloads\\\\download OK \\n> js> document.getElementById(\\\"fileDialog\\\") . \\\\ ==> [object HTMLInputElement] OK \\n> js> document.getElementById(\\\"fileDialog\\\").value . \\\\ ==> C:\\\\Users\\\\hcche\\\\Downloads\\\\download OK \\n> pickFile \\n> .s\\n 0: (string) \\\\ <--- My original pickFile does not work on 3nw. Needs debug.\\n\\n\\\\ On jeforth.3ce, failed as anticipated\\n\\n > js> document.getElementById(\\\"fileDialog\\\").value .\\n C:\\\\fakepath\\\\__865.jpg OK <---- \\\"fakepath\\\" as anticipated.\\n\\n\\\\ Works fine on 3HTA.\\n\\n > js> document.getElementById(\\\"fileDialog\\\").value .\\n C:\\\\Users\\\\hcche\\\\Downloads\\\\魏月梅 全民健保核退申請書.PDF OK \\n\\n\\\\ So, pickFile can be improved by this solution from Stackoverflow.\\n\\n: pickFile ( -- \\\"pathname\\\" ) \\\\ Pick a file through web browser's GUI\\nchar input createElement ( element )\\ndup char type char file setAttribute ( element )\\ndup char id char pickfile setAttribute ( element )\\neleBody over appendChild \\\\ 要 append 才有作用。\\n( element ) js> tos().click();tos().value ( element pathname ) ;\\n\\n\\\\ 照上面這個 pickFile 實驗, 還是不行。確定傳回的 pathname 是個 \\\"\\\". 然而手動觀察 element.value 卻是\\n\\\\ 正確的 pathname. [x] 猜想, 最後一行手動看應該會是 expected pathname 無誤。\\n\\n> .s \\n 0: [object HTMLInputElement] (object) \\\\ backup\\n 1: C:\\\\Users\\\\hcche\\\\Downloads\\\\jeforth.3ce.p4.jpg (string)\\n 2: [object HTMLInputElement] (object) \\\\ to be removed\\n> removeElement\\n> js> tos(1).value . \\\\ 查看 element 的 value \\nC:\\\\Users\\\\hcche\\\\Downloads\\\\jeforth.3ce.p4.jpg OK \\\\ 竟然是對的。此時 element id 確定已經不存在了。\\n\\n\\n[x] 嘗試手動作最後一行\\n: pickFile ( -- \\\"pathname\\\" ) \\\\ Pick a file through web browser's GUI\\nchar input createElement ( element )\\ndup char type char file setAttribute ( element )\\ndup char id char pickfile setAttribute ( element )\\neleBody over appendChild \\\\ 要 append 才有作用。\\n; \\n\\n\\\\ 果然, 這行一起做, 傳回 \\\"\\\"\\n( element ) js> tos().click();tos().value ( element pathname ) ;\\n\\n\\\\ 手動分開做, 就 OK 了!!\\n( element ) js: tos().click()\\njs> tos().value ( element pathname ) ;\\n\\n[x] click() 之後, 加上一點 nap 看看, --> \\n\\n: pickFile ( -- \\\"pathname\\\" ) \\\\ Pick a file through web browser's GUI\\nchar input createElement ( element )\\ndup char type char file setAttribute ( element )\\ndup char class char pick_file setAttribute ( element )\\njs> body over appendChild \\\\ 要 append 才有作用。\\njs: tos().click() ( element ) \\\\ 回來就表示 user 已經完成操作\\n( seconds * 1000 / nap ) js> 60*1000/200 for ( element ) \\n\\tjs> tos().value if \\n\\t\\tr> drop 0 >r \\\\ break the loop\\n\\telse \\n\\t\\t200 nap .\\\" .\\\" \\\\ wait a while\\n\\tthen \\nnext ( element ) \\njs> tos().value \\\\ 即使 timeout 也不管了 ( element path ) \\nswap removeElement ; ( path ) \\n\\n\\\\ Ultimate version\\n\\n: pickFile ( -- \\\"pathname\\\" ) \\\\ Pick a file through web browser's GUI\\n\\tchar input createElement ( element )\\n\\tdup char type char file setAttribute ( element )\\n\\tdup char class char pick_file setAttribute ( element ) \\\\ for debug, clue of the element\\n\\tjs: tos().onchange=function(){execute('stopSleeping')} ( element )\\n\\tjs> body over appendChild \\\\ 要 append 才有作用。 ( element )\\n js: tos().click() ( element ) \\\\ @ HTA 回來就表示 user 已經完成操作, @ NW.js 則馬上回來。\\n\\t( minutes*60*1000 ) js> 5*60*1000 sleep ( element )\\n\\tjs> tos().value \\\\ 即使 timeout 也不管了 ( element path ) \\n\\tswap removeElement ; ( path ) \\n\\n: pickFile \\t\\t( -- \\\"pathname\\\" ) \\\\ Pick a file through web browser's GUI\\nchar input createElement ( element )\\ndup char type char file setAttribute ( element )\\ndup char class char pick_file setAttribute ( element ) \\\\ for debug, clue of the element\\n\\\\ For none 3hta only, setup the event handler\\njs> vm.appname!=\\\"jeforth.3hta\\\" if\\n\\tjs: tos().onchange=function(){execute('stopSleeping')} ( element ) then\\njs> body over appendChild \\\\ 要 append 才有作用。 ( element )\\njs: tos().click() ( element ) \\\\ @ HTA 回來就表示 user 已經完成操作, @ NW.js 則馬上回來。\\n\\\\ For none 3hta only, wait for the onchange event\\njs> vm.appname!=\\\"jeforth.3hta\\\" if\\n\\t( minutes*60*1000 ) js> 5*60*1000 sleep ( element ) then\\njs> tos().value \\\\ 即使 timeout 也不管了 ( element path ) \\nswap removeElement ; ( path ) \\n/// Works fine on 3hta and 3nw. The dialog works but returns Null string on 3htm \\n/// or C:\\\\fakepath\\\\__865.jpg on 3ce.\\n/// Through excel app's GetOpenFilename method can do the same thing:\\n/// excel.app js> pop().GETopenFILENAME <== with or w/o () both fine\\n/// Excel's GetSaveAsFilename method too.\\n\\n\\n\\n\\n[x] 3nw's js: storage.save(pathname) and js: storage.restore(pathname) work fine now.\\n[/] How about 3hta? <--- 3hta works fine already, forget it.\\n[x] 3nw should auto save and restore local storage. restore when start up, save when\\n any field is saved. So I don't need corresponding words for them.\\n\",\"mode\":true,\"readonly\":false}","node.js HTTP server":"{\"doc\":\"\\n\\\\ ~@~@~@~@~@~@~@~@~ Build Your First HTTP Server in Node.js ~@~@~@~@~@~@~@~@~\\n\\\\\\n\\\\ https://www.diigo.com/user/hcchen/b/373115646\\n\\\\ jeforth.3nw localsotrage field \\\"node.js HTTP server\\\"\\n\\\\ ~\\\\jeforth.3we\\\\3nd\\\\build_your_http_server.f \\n\\\\\\n\\n\\\\ Lets require/import the HTTP module and choose a port to listen\\n js> require('http') constant http // ( -- HTTP-object ) Get node.js http module\\n\\n\\\\ Lets define a port we want to listen to\\n 8080 constant PORT // ( -- port# ) Port number HTTP server listen to\\n\\n\\\\ We need a function which handles requests and send response\\n \\n \\n var f = function handleRequest(request, response){\\n response.end('It Works!! Path Hit: ' + request.url);\\n };f\\n constant handleRequest // ( -- func ) Request handler\\n \\n\\n\\\\ Callback triggered when server is successfully listening. Hurray!\\n \\n var f = function callback(){\\n type(\\\"Server listening on: http://localhost:\\\"+vm[context].PORT);\\n }; f\\n constant server-callback // ( -- func ) Call back function of the HTTP server\\n\\n\\\\ Create a server\\n http :> createServer(vm[context].handleRequest)\\n constant server // ( -- obj ) HTTP server object\\n\\n\\\\ Lets start our server\\n server :> listen(vm[context].PORT,vm[context][\\\"server-callback\\\"])\\n\\n\\\\ Your server should respond differently to different URL \\n\\\\ paths. This means we need a dispatcher. Dispatcher is kind \\n\\\\ of router which helps in calling the desired request handler \\n\\\\ code for each particular URL path. Now lets add a dispatcher \\n\\\\ to our program. First we will install a dispatcher module, \\n\\\\ in our case httpdispatcher. There are many modules available \\n\\\\ but lets install a basic one for demo purposes\\n\\n js> require('httpdispatcher') constant dispatcher // ( -- obj ) HTTP dispatcher\\n\\n\\n//Lets use our dispatcher\\nfunction handleRequest(request, response){\\n try {\\n //log the request on console\\n console.log(request.url);\\n //Disptach\\n dispatcher.dispatch(request, response);\\n } catch(err) {\\n console.log(err);\\n }\\n}\",\"mode\":true,\"readonly\":false}","pruning":"{\"doc\":\"\\n\\\\ Make the target page editable for pruning. 把 target page 搞成 editable 以便修剪。\\nactive-tab :> id tabid! document.getElementsByTagName(\\\"body\\\")[0].contentEditable=true \\n\",\"readonly\":true,\"mode\":true}","smde_MyUniqueID":"j e f o r t h . 3 w e\n==============\n**Forth** is the simplest programming language ever. The jeforth.**3we** project is an implementation based on a **3 Words Engine** from [project-k](http://github.com/hcchengithub/project-k) for many applications: *HTA (jeforth.3hta)*, *HTML (jeforth.3htm)*, *Chrome Extension (jeforth.3ca)*, *Node.js (jeforth.3nd)*, *Node-webkit or NW.js (jeforth.3nw)*, and probably more in the future. All of them have been tested on Windows 8 or Windows 10.\n\nPlay now\n===========\nAmong the many applications, jeforth for web page (jeforth.3htm) can run on your web browser right now thus is good for demonstration. \n\n#### [Solar system](http://rawgit.com/hcchengithub/jeforth.3we/master/index.html?cls_include_solar-system.f)\n[簡介](http://note.youdao.com/yws/public/redirect/share?id=94764cf57ba4365e2997f4a268ff7716&type=false)
\n![enter image description here](https://github.com/hcchengithub/jeforth.3we/wiki/pictures/solar-system.png)\n\n#### [H2O](http://rawgit.com/hcchengithub/jeforth.3we/master/index.html?cls_include_h2o.f)\n![enter image description here](https://github.com/hcchengithub/jeforth.3we/wiki/pictures/h2o.png)\n\n#### [Alarm clock](http://rawgit.com/hcchengithub/jeforth.3we/master/index.html?cls_include_alarm.f_er)\n ![enter image description here](https://github.com/hcchengithub/jeforth.3we/wiki/pictures/demo-alarm.png)\n \n#### [Box2Dweb Physics Engine demo - Arrows](http://rawgit.com/hcchengithub/jeforth.3we/master/index.html?cls_include_box2dweb-arrow.f)\n![enter image description here](https://github.com/hcchengithub/jeforth.3we/wiki/pictures/demo-arrow.png)\n\n#### [Chipmunk Physics Engine demo - Pyramid Stack](http://rawgit.com/hcchengithub/jeforth.3we/master/index.html?cls_include_chipmunk-js-pyramidstack.f)\n![enter image description here](https://github.com/hcchengithub/jeforth.3we/wiki/pictures/demo-pyramidstack.png)\n\n\nWhat else can you do with jeforth.3we?\n=============\n\n#### [Markdown editor](http://note.youdao.com/yws/public/redirect/share?id=1a8a342f3a9c1e0622a6050480af28b7&type=false)\n\nNW.js can access files in your local computer and also have all abilities like the Chrome browser, that allows jeforth.3nw to include JavaScript modules from the Internet. For example, [SimpleMDE](https://simplemde.com) is a Markdown Editor that works fine on jeofrth.3nw. \n\n![enter image description here](https://github.com/hcchengithub/jeforth.3we/wiki/pictures/demo 3nw mde editor.JPG)\n\n\nGet source code, unzip, and start running\n=============\n\n| Item | Address |\n----------------|----------------------------------------------\n| jeforth.3we high level source code | *http://github.com/hcchengithub/jeforth.3we* |\n| Kernel, projectk.js 3-words-engine| *http://github.com/hcchengithub/project-k* |\n\n
\nClick the [Download ZIP] button of both projects [jeforth.3we](https://github.com/hcchengithub/jeforth.3we) and [project-k](https://github.com/hcchengithub/project-k) on their GitHub web page to get them. Unzip jeforth.3we first and then unzip project-k to under the jeforth.3we directory, as shown in the below directory listing. Then you can run 3hta.bat without installing anything else if your computer is Windows 8 or Windows 10; or run 3nd.bat and 3nw.bat, if you have installed node.js and nw.js.\n\nMy jeforth.3we/ directory listing for example,\n\n![jeforth3we-dir.png](https://github.com/hcchengithub/jeforth.3we/wiki/pictures/jeforth3we-dir.png)\n\n\n**Note:** Only for jeforth.3hta and only when you were **Download Zip** jeforth.3we from GitHub, It's necessary to use GNU tool [unix2dos](http://waterlan.home.xs4all.nl/dos2unix.html) to convert the new line characters of all text files [from Unix's LF to Windows' CRLF](https://en.wikipedia.org/wiki/Unix2dos). This is an example command line of the usage:\n\n d:\\jeforth.3we>for /R %G in (*.*) do d:\\bin\\unix2dos.exe \"%G\"\n\n
\n\nIf you were **git clone https://github.com/hcchengithub/jeforth.3we** instead of **Download Zip** then forget this step, GitHub shell for Windows already converts new line characters to CRLF correctly. \n\nPresentation videos\n======\n\n| No. | Mandarin | English |\n--------|----------|---------\n| 1 | [Opening](http://www.camdemy.com/media/19253)| n/a |\n| 2 | [Run the HTML version online](http://www.camdemy.com/media/19254)| n/a |\n| 3 | [Run the HTML version on local computer](http://www.camdemy.com/media/19255)| n/a |\n| 4 | [Run the HTA version](http://www.camdemy.com/media/19256)| n/a |\n| 5 | [Run Node.js and Node-Webkit version](http://www.camdemy.com/media/19257)| n/a |\n| 6 | [F2 inputbox edit mode](http://www.camdemy.com/media/19258)| n/a |\n| 7 | [F4 Copy marked string to inputbox](http://www.camdemy.com/media/19259)| n/a |\n| 8 | [F5 Restart](http://www.camdemy.com/media/19260)| n/a |\n| 9 | [Bigger/Smaller input box](http://www.camdemy.com/media/19261)| n/a |\n| 10 | [Esc clear input box](http://www.camdemy.com/media/19262)| n/a |\n| 11 | [Tab auto-complete](http://www.camdemy.com/media/19263)| n/a |\n| 12 | [Enter jump into the input box](http://www.camdemy.com/media/19264)| n/a |\n| 13 | [Up/Down recall command history](http://www.camdemy.com/media/19265)| n/a |\n| 14 | [Alt-Up Reuse used commands](http://www.camdemy.com/media/19266)| n/a |\n| 15 | [Crtl- / Ctrl+ Zoom in/ Zoom out](http://www.camdemy.com/media/19267)| n/a |\n| 16 | [Ctrl-Break stop all tasks](http://www.camdemy.com/media/19268)| n/a |\n| 17 | [BackSpace trims the output box](http://www.camdemy.com/media/19269)| n/a |\n| 18 | [Help is helpful](http://www.camdemy.com/media/19270)| n/a |\n| 19 | [jsc JavaScript Console](http://www.camdemy.com/media/19271)| n/a |\n\nWhat to play in further depth\n========================\nDownload and setup the jeforth.3we directory and project-k directory as mentioned above.\n\n#### **HTA** / jeforth.3hta\nDouble click the **jeforth.3we/jeforth.hta** or execute the below DOS command line in a DOS box,\n```\njeforth.hta cls .' Hello world' cr 3000 sleep bye\n```\n![3htahello-world.png](https://github.com/hcchengithub/jeforth.3we/wiki/pictures/3htahello-world.png)\n\nThe prior method runs self-test because there's no given task to do. The 2'nd method is expected to print 'Hello world' (as shown above) and return to DOS box after 3 seconds.\n\n\nNote! If you see the Windows error message : [\"Safety Settings on this computer prohibit accessing a data source on another domain\"](https://social.msdn.microsoft.com/Forums/en-US/becc982a-b693-49bb-8fb0-95847a3e96c7/hta-safety-settings-on-this-computer-prohibit-accessing-a-data-source-on-another-domain?forum=scripting) that I heard may happen on some Windows 7 computers. Sorry, [I have no solution yet](http://stackoverflow.com/questions/32177060/hta-safety-settings-on-this-computer-prohibit-accessing-a-data-source-on-anot), It didn't happen on those Windows 7 computers that I could reach. Please upgrade to Windows 8 or 10 to avoid from the problem.\n\n#### **Node.js** / jeforth.3nd\nMake sure you can run node.exe in a DOS box so you have setup the path. Make the jeforth.3we/ folder be your working directory. Execute one of the below demo command lines:\n```\nnode jeforth.3nd.js\nnode jeforth.3nd.js cls .' Hello world' cr bye\n```\nAgain, like the above HTA case, the prior command line does the self-test, and the 2'nd is expected to print 'Hello world'.\n\nWe have a local Web server written by jeforth.3nd itself. See jeforth.3we/Webserver.bat. Having a local Web server is necessary to run jeforth.3htm. \n\n#### **HTML** / jeforth.3htm\nSetup your local Web server by running jeforth.3we/Webserver.bat, \n\n![webserver.png](https://github.com/hcchengithub/jeforth.3we/wiki/pictures/webserver.png)\n\nthen try to visit below URLs:\n```\nhttp://localhost:8888\nhttp://localhost:8888/index.html\nhttp://localhost:8888/index.html? cr .\" hello world\" cr cr \nhttp://localhost:8888/index.html?_cr_.\"_hello_world\"_cr_cr \nhttp://localhost:8888/index.html? .\" 8-) \" 100 nap rewind\nhttp://localhost:8888/index.html?_.\"_8-)_\"_100_nap_rewind\n```\nI have tested IE10 , IE11 and Chrome. Firefox or other web browsers are not tested yet. As shown above, we can put any forth words in the URL. That will be the task jeforth.3htm will do after start up and the self-test will be skipped when having a task to do.\n\n#### **Node-webkit** / jeforth.3nw\nSetup your Node.js and Node-Webkit path in prior. Refer to 3nw.bat as an example. Make jeforth.3we/ be your working directory, run either one of below command lines:\n```\nnw ../jeforth.3we\nnw ../jeforth.3we cls .' Hello World' 3000 sleep bye\n```\nThe prior runs self-test because there's no given task to do. The 2'nd is expected to print 'Hello world' and return to DOS box after 3 seconds.\n\t\nCompile eforth.com\n--------------------------\n\nJeforth.3nd for Node.js can be a handy x86 CPU assembler (any other CPU too). We have an example to compile the legendary eforth.com executable for 16 bits PC under MS-DOS by Bill Muench and C. H. Ting, 1990.\n\n 1. Install node.js correctly so you can run node.exe in a DOX box. Working directory at jeforth.3we/. \n 2. Run: node.exe jeforth.3nd.js include 86ef202.f bye\n 3. You got jeforth.3we/eforth.com\n 4. I have a 32bits windows 8, so I can run eforth.com directly. If your Windows system is 64 bits, you'll need a DOS virtual machine like vmware, virtual box, or I recommend DOSBox, to run the created eforth.com.\n\nExcel automation\n---------------------\nUse jeforth.3hta to manipulate excel spread sheets. This example gets a column from a reference excel file to your target excel file.\n\n 1. Double click on jeforth.3we/jeforth.hta to start it. After the self-test type the command line \"include merge2.f\" into the input box.\n 2. Or run the below command line directory for the same thing:\n```\njeforth.hta include merge2.f\n```\n\n#### The End\n\n - FigTaiwan [http://figtaiwan.org](http://figtaiwan.org) \n - H.C. Chen [hcchen5600@gmail.com](hcchen5600@gmail.com) \n - Written with [StackEdit](https://stackedit.io/)\n\n\n "} \ No newline at end of file +{"3nw working on simpleMDE":"{\"doc\":\"\\n[x] Now ^2016-05-06 14:29:46 developing SimpleMDE on 3nw \\n[x] pickFile can work on 3htm, 3nw, 3hta but only 3hta gets the pathname string, \\n others are \\\"\\\" due to security restrictions I believe. Is there a workaround?\\n [x] try answers on Stackoverflow.com \\n 1. http://jsfiddle.net/dwebexperts/4FGg8/1/\\n http://stackoverflow.com/questions/15201071/how-to-get-full-path-of-selected-file-on-change-of-input-type-file-using-jav\\n Introduces a temp_path , which is interesting but not good enough for my MDE because\\n [Save] button needs the real pathname.\\n\\n-----------------\\n\\n\\\\ Word does not work, mde-include not ok yet, but interpret mode works fine\\n\\n\\n.( Include SimpleMDE.js )\\n\\n\\tjs> typeof(SimpleMDE)!=\\\"function\\\" [if]\\n\\t\\t\\n\\t\\t \\n\\t\\t\\n\\t\\t drop \\n\\t[then]\\n\\tfalse ( assume include failed ) \\n\\t30 ( seconds ) [for] \\n\\t\\tjs> typeof(SimpleMDE)==\\\"function\\\" [if] \\n\\t\\t\\tr> drop 0 >r \\\\ break the loop\\n\\t\\t\\tdrop true ( include OK )\\n\\t\\t[else] \\n\\t\\t\\t20 nap .\\\" .\\\" \\\\ wait a while\\n\\t\\t[then] \\n\\t[next] \\n\\t[if] .\\\" Done. \\\" [else] .\\\" Error! Failed to include SimpleMDE! [then] cr\\n\\n.( Create the required textarea for SimpleMDE ) cr\\n\\n \\n js> $(\\\".console3we\\\")[0] insertBefore\\n\\n.( Launch SimpleMDE on the above textarea ) cr\\n\\n \\n var simplemde = new SimpleMDE({element: document.getElementById(\\\"simplemde\\\")}); \\n simplemde \\n \\n constant simplemde\\n\\n.( Load README.md ) cr\\n\\n char README.md readTextFile\\n simplemde :: value(pop())\\n\\t\\n\\\\ Above interpret procedure works fine.\\n\\n\\n\\\\ [x] mde ( -- ) \\\\ open Markdown editor \\n\\n: mde-include ( -- ok? ) \\\\ Inclde MDE editor \\n\\tjs> typeof(SimpleMDE)!=\\\"function\\\" if\\n\\t\\t\\n\\t\\t \\n\\t\\t\\n\\t\\t drop \\n\\tthen\\n\\tfalse ( assume include failed ) \\n\\t30 ( seconds ) for \\n\\t\\tjs> typeof(SimpleMDE)==\\\"function\\\" if \\n\\t\\t\\tr> drop 0 >r \\\\ break the loop\\n\\t\\t\\tdrop true ( include OK )\\n\\t\\telse \\n\\t\\t\\t1000 nap \\\\ wait a while\\n\\t\\tthen \\n\\tnext ;\\n\\n\\\\ execute the word does not work. But run on interpret mode always ok. Why?\\n\\\\ Even when it's not work, check the elements of link and script, they are existing:\\n\\tjs> $(\\\"head\\\")[0] ce! ce 09 ce@ :> outerHTML .\\n\\tjs> $(\\\"head\\\")[0] ce! ce 10 ce@ :> outerHTML .\\n\\nstop \\n---------------\\n[x] 所有在 .console3we 範圍內的 textarea 都會在 F2 edit mode focused 時變成粉紅色。 ed 的亦然。\\n 把 ed 移出 .console3we 之外 (而非光 outputbox 之外) 就會失去所有的 .console3we style. 如下,\\n > js> $(\\\".eb\\\")[0] js> $(\\\".console3we\\\")[0] insertBefore\\n ==> 所以, SimpleMDE init textarea 要移出 .console3we 之上才行. \\n[x] Go on use the knowledge to fine tune 3we's style settings.\\n --> study common.css first \\n --> but I already use .console3we to constraint the range!\\n ==> 所以, SimpleMDE init textarea 要移出 .console3we 之上才行. \\n\\n\\\\ ^^2016-05-04 11:57:32^^ \\n\\\\ (@ 3nw) 改照抄 official demo page 上的 resource 也行, 但是問題還是一樣。\\n\\\\ 可見是 jeforth 的 style 造成的問題。 \\n\\\\ [x] 下一步, 3nw 的 style 反璞歸真, 或限制範圍。 ==> Bingo!! See Ynote \\n\\\\ \\\"SimpleMDE works fine on jeforth.3nw now\\\" \\n\\n\\n\\\\ Include SimpleMDE\\n\\n \\n < link rel=\\\"stylesheet\\\" href=\\\"https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css\\\"> \\n < script src=\\\"https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js\\\">\\n drop\\n js> typeof(SimpleMDE) tib. \\\\ ==> function (string) so it has been installed\\n\\n\\\\ Create a textarea\\n\\n \\n js> $(\\\".console3we\\\")[0] insertBefore\\n\\n\\\\ Launch SimpleMDE on the above textarea\\n\\n \\n var simplemde = new SimpleMDE({element: document.getElementById(\\\"simplemde\\\")}); \\n simplemde \\n \\n constant simplemde\\n\\n\\\\ Test, set the content\\n\\n simplemde pop().value(\\\"This text will appear in the editor\\\"); \\n\\n\\\\ Test, get the content\\n\\n simplemde :> value() \\\\ ==> # This text will appear in the editor (string)\\n\\n-----------------------------\\nStudy https://simplemde.com/ so as to copy the usage\\n\\n\\\\ 瞧瞧 body\\n > js> $(\\\"body\\\")[0] ce! ce\\n [object HTMLBodyElement] innerHTML=

SimpleMDE ...\\n 0 : [object HTMLElement] class='page-header'; innerHTML=

SimpleMDE Markdown Edi...\\n 1 : [object HTMLElement] class='main-content'; innerHTML=

.console3we { color:black; word-wrap:...\\n\\n\\\\ 瞧瞧 header\\n > js> $(\\\"body\\\")[0] ce! ce\\n [object HTMLHeadElement] innerHTML=JavaScript Markdown Editor - SimpleM...\\n 0 : [object HTMLMetaElement] \\n 1 : [object HTMLTitleElement] innerHTML=JavaScript Markdown Editor - SimpleMDE...\\n 2 : [object HTMLMetaElement] name='viewport'; \\n 3 : [object HTMLLinkElement] \\n 4 : [object HTMLLinkElement] \\n 5 : [object HTMLLinkElement] \\n 6 : [object HTMLLinkElement] \\n 7 : [object HTMLLinkElement] \\n 8 : [object HTMLScriptElement] <=========== 這裡面是空的\\n 9 : [object HTMLScriptElement] innerHTML= if(window.location.href.indexOf(\\\"nextstepwebs.github.io\\\") !== ...\\n 10 : [object HTMLStyleElement] innerHTML= .editor-preview h1, .editor-preview h2, .editor-preview h3, .ed...\\n 11 : [object HTMLStyleElement] id='style-1-cropbar-clipper'; innerHTML=/* Copyright 2014 Evernote Corpora...\\n 12 : [object HTMLStyleElement] innerHTML= .tr table, .tr td { border:0.075em solid gray; } ...\\n\\n \\\\ ce 8 ce@ :> outerHTML 看來好像在修整網址, 總之 SimpleMDE 不是在 header 裡 include 的。\\n <script>\\n if(window.location.href.indexOf(\\\"nextstepwebs.github.io\\\") !== -1) {\\n window.location.href = \\\"https://simplemde.com/\\\";\\n }\\n \\n if(window.location.protocol != \\\"https:\\\")\\n window.location.href = \\\"https:\\\"+window.location.href.substring(window.location.protocol.length);\\n </script> OK \\n\\n\\\\ Now look into the source code of the demo page\\n\\n\\n> cr cr cr js> $(\\\"body\\\")[0] ce! ce 2 ce@ :> outerHTML .\\n[object HTMLLinkElement] \\n<link rel=\\\"stylesheet\\\" href=\\\"https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css\\\"> OK \\n\\n> cr cr cr js> $(\\\"body\\\")[0] ce! ce 3 ce@ :> outerHTML .\\n[object HTMLLinkElement] \\n<link rel=\\\"stylesheet\\\" href=\\\"https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css\\\"> OK \\n\\n> cr cr cr js> $(\\\"body\\\")[0] ce! ce 4 ce@ :> outerHTML .\\n[object HTMLScriptElement] \\n<script src=\\\"https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js\\\"></script> OK \\n\\n> cls js> $(\\\"body\\\")[0] ce! ce 5 ce@ :> outerHTML .\\n[object HTMLScriptElement] innerHTML= new SimpleMDE({ element: document.getElementById(\\\"demo1\\\"), spe...\\n 0 : [object Text] new SimpleMDE({ element: document.getElementById(\\\"demo1\\\"), spellChecker: false, }); n...\\n<script>\\n new SimpleMDE({\\n element: document.getElementById(\\\"demo1\\\"),\\n spellChecker: false,\\n });\\n \\n new SimpleMDE({\\n element: document.getElementById(\\\"demo2\\\"),\\n spellChecker: false,\\n autosave: {\\n enabled: true,\\n unique_id: \\\"demo2\\\",\\n },\\n });\\n \\n new SimpleMDE({\\n element: document.getElementById(\\\"demo3\\\"),\\n status: false,\\n toolbar: false,\\n });\\n </script> OK \\n\\n> cr cr cr js> $(\\\"body\\\")[0] ce! ce 6 ce@ :> outerHTML .\\n[object HTMLScriptElement] innerHTML= (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r...\\n 0 : [object Text] (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=...\\n<script>\\n (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\\n (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\\n m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\\n })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\\n \\n ga('create', 'UA-5808021-18', 'auto');\\n ga('send', 'pageview');\\n \\n </script> OK \\n\\n\\n-----------------------\\n[!] Try 3htm with localhost , the Error is : \\\"require is not defined\\\"\\n (1) Run local host : webserver.bat\\n (2) Run jeforth.3htm through http://localhost:8888 or http://localhost:8888/index.html \\n (3) Run \\n <h>\\n <link rel=\\\"stylesheet\\\" href=\\\"http://localhost:8888/src/css/simplemde.css\\\">\\n <script src=\\\"http://localhost:8888/src/js/simplemde.js\\\"></script>\\n </h>\\n ---> JavaScript error on word \\\"doElement\\\" : require is not defined\\n[!] jeforth.3ce can not do this: (Due to Content Security Policy violation)\\n <h>\\n < link rel=\\\"stylesheet\\\" href=\\\"http://localhost:8888/src/css/simplemde.css\\\">\\n < script src=\\\"http://localhost:8888/src/js/simplemde.js\\\"></script>\\n </h>\\n \\\\s\\n jquery-1.11.2.js:9831 Refused to load the script \\n 'http://localhost:8888/src/js/simplemde.js?_=1462251960943' \\n because it violates the following Content Security Policy directive: \\n \\\"script-src 'self' 'unsafe-eval'\\\".\\n \\\\s\\n \\\\ webserver.bat cd root at c:\\\\program files\\\\nodejs\\\\node_modules\\\\simplemde\\n char http://localhost:8888/src/js/simplemde.js readTextFile . \\\\ ==> works fine\\n[!] Try super chrome \\n --> worse then jeforth.3htm through http://localhost:8888 \\n[x] Trying to include but failed.\\n char ../simplemde-markdown-editor/src/css/simplemde.css readTextFile .\\n char ../simplemde-markdown-editor/src/js/simplemde.js readTextFile .\\n <h>\\n < link rel=\\\"stylesheet\\\" href=\\\"../simplemde-markdown-editor/src/css/simplemde.css\\\">\\n < script src=\\\"../simplemde-markdown-editor/src/js/simplemde.js\\\"></script>\\n </h>\\n --> (on 3HTA) 'require' not defined ==> So, try 3nw !!\\n --> and JavaScript error on word \\\"doElement\\\" : 發生錯誤,無法完成操作 80020101。\\n --> try 3nw, but: JavaScript error on word \\\"doElement\\\" : Cannot find module 'codemirror'\\n --> So, let's, as homepage said, use npm install. I am using 3nw anyway.\\n --> See ^> 2016-05-03 00:07:17 error message\\n C:\\\\Users\\\\hcche\\\\Documents\\\\GitHub> npm install simplemde --save\\n Failed again, npm install wants to use 'git' but which is unknown unless in a \\n gitShell that I can open through GitHub I guess.\\n --> Yes! GitShell is better, on installating now, stop at load codemirror\\n seems working ... I thought it's dead but now continoued. Wow, what a huge\\n installation. ok!\\n [x] I run the install from C:\\\\Users\\\\hcche\\\\Documents\\\\GitHub> is not good.\\n The result is a 10MByte size of mudules! at \\n c:\\\\Users\\\\hcche\\\\Documents\\\\GitHub\\\\node_modules <-- all dated 5/3'16 which is today\\n I should move it to : \\\"c:\\\\Program Files\\\\nodejs\\\\node_modules\\\" <--- all done.\\n * Should run npm install at c:\\\\Program Files\\\\nodejs> ... <== wrong! still failed.\\n [x] (@ Home) 10M of modules installed. What's next? Ah! all the modules are for server side.\\n See examples on http://simplemde.com and think.\\n [x] (@ T550) * Should run npm install at c:\\\\Program Files\\\\nodejs> ... <== wrong! still failed.\\n c:\\\\Program Files\\\\nodejs and sub-directories are not write-able, I guess. Because\\n tried to do the install at ~\\\\downloads\\\\simplemde then OK! See ^> 2016-05-03 09:28:01\\n [x] Holyshit! Totally different result from ^> 2016-05-03 09:28:01 !!!\\n 我想要把所有的 node_modules 都集中到 c:\\\\Program Files\\\\nodejs\\\\node_modules\\\\ 也是錯誤觀念。\\n SimpleMDE 的 node_modules 就放在自己個別的目錄下。\\n[x] I should reinstall Node.js and NW.js at home? Because installing SimpleMDE has totally\\n messed up the node_modules folder.\\n --> ok at home. \\n[x] @ T550 after installed SimpleMDE by npm, Also have made NODE_PATH env correctly points\\n to c:\\\\Program Files\\\\nodejs\\\\node_modules run 3nw.bat and try . . . \\n s\\\" c:\\\\Program Files\\\\nodejs\\\\node_modules\\\\simplemde\\\\src\\\\css\\\\simplemde.css\\\" readTextFile .\\n s\\\" c:\\\\Program Files\\\\nodejs\\\\node_modules\\\\simplemde\\\\src\\\\js\\\\simplemde.js\\\" readTextFile .\\n <h>\\n < link rel=\\\"stylesheet\\\" href=\\\"c:/Program Files/nodejs/node_modules/simplemde/src/css/simplemde.css\\\">\\n < script src=\\\"c:/Program Files/nodejs/node_modules/simplemde/src/js/simplemde.js\\\"></script>\\n </h>\\n --> Now I realized that dealing with npm is needed for Web Server side only\\n[x] (@ 3nw) require('codemirror') not found, add %NODEJSHOME%\\\\node_modules\\\\simplemde\\\\node_modules\\n to NODE_PATH as below can resolve this.\\n ---- 3nw.bat ----\\n if a%COMPUTERNAME%==aWKS-38EN3476 set NODEJSHOME=C:\\\\Program Files\\\\nodejs\\n if a%COMPUTERNAME%==aWKS-4AEN0404 set NODEJSHOME=C:\\\\Program Files\\\\nodejs\\n set NODE_PATH=%NODEJSHOME%\\\\node_modules;%NODEJSHOME%\\\\node_modules\\\\simplemde\\\\node_modules\\n start nw ../jeforth.3we %1 %2 %3 %4 %5 %6 %7 %8 %9\\n -----------------\\n[x] (@ 3nw) But after resolved require('codemirror') not found, new problem appear: \\n JavaScript error on word \\\"doElement\\\" : navigator is not defined\\n --> js> navigator \\\\ ==> [object Navigator] (object) 明明 3nw 有啊!\\n js> window.navigator \\\\ ==> [object Navigator] (object) \\n --> 從 simplemde.js 裡查出是 require(\\\"codemirror\\\") 出錯\\n console.log(111);debugger; // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\\n var CodeMirror = require(\\\"codemirror\\\");\\n console.log(222);debugger; // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\\n --> Only server side needs to deal with npm things.\\n[x] (@ 3htm localhost ) 算了, 直接用 BootCDN include 看看: <---- Yes, correct way!! I don't \\n need to deal with server side issues.\\n <h>\\n < link href=\\\"http://cdn.bootcss.com/simplemde/1.10.0/simplemde.min.css\\\" rel=\\\"stylesheet\\\">\\n < script src=\\\"http://cdn.bootcss.com/simplemde/1.10.0/simplemde.min.js\\\"></script>\\n </h>\\n --> cls <js> typeof SimpleMDE </jsV> \\\\ ==> function (string)\\n It works !! \\n --> So, how about 3hta 不成功. 3htm on localhost and 3nw works with the below method.\\n[x] 3htm on localhost installed ok, so go on using it . . . \\n See http://simplemde.com --> Bingo!! it works now. But appearance has something wrong\\n that needs fine tuning.\\n\\n\\\\ 以下 3htm 3nw OK, 3hta 有掛上 simplemde 但是沒有效果。\\n\\\\ Include SimpleMDE\\n\\n <h>\\n < link href=\\\"http://cdn.bootcss.com/simplemde/1.10.0/simplemde.min.css\\\" rel=\\\"stylesheet\\\">\\n < script src=\\\"http://cdn.bootcss.com/simplemde/1.10.0/simplemde.min.js\\\"></script>\\n </h> drop\\n js> typeof(SimpleMDE) tib. \\\\ ==> function (string) so it has been installed\\n\\n\\\\ Create a textarea\\n\\n cls <o> <textarea id=simplemde ></textarea></o> js> outputbox insertBefore\\n\\n\\\\ Launch SimpleMDE on the above textarea\\n\\n <js> \\n var simplemde = new SimpleMDE({element: document.getElementById(\\\"simplemde\\\")}); \\n simplemde \\n </jsV> \\n constant simplemde\\n\\n\\\\ Test, set the content\\n\\n simplemde <js> pop().value(\\\"This text will appear in the editor\\\"); </js>\\n\\n\\\\ Test, get the content\\n\\n simplemde :> value() \\\\ ==> # This text will appear in the editor (string)\\n\\n[x] 不要用 bootCDN 改用別家的試試看... Same problem, see <^2016-05-04 11:57:32\\n\\nstop\\njs> vm.appname==\\\"jeforth.3hta\\\" [if] char js/numeric-1.2.6.js\\n[else] char http://www.numericjs.com/lib/numeric-1.2.6.js [then]\\nreadTextFile \\\\ 先讀取 .js 檔, 但不能直接用\\n<text> \\nwindow.numeric = numeric; // 先對 source 做一點必要的加工, 把 numeric 掛上 global \\n</text> + </js> \\\\ 然後才執行\\t\\n-------------\\n2016-05-03 00:07:17 error message\\n\\t\\tc:\\\\Users\\\\hcche\\\\Documents\\\\GitHub\\\\jeforth.3we>npm install simplemde --save\\n\\t\\tnpm ERR! git clone --template=C:\\\\Users\\\\hcche\\\\AppData\\\\Roaming\\\\npm-cache\\\\_git-remotes\\\\_templates ...\\n\\t\\tc:\\\\Users\\\\hcche\\\\Documents\\\\GitHub\\\\jeforth.3we>git\\n\\t\\t'git' 不是內部或外部命令、可執行的程式或批次檔。\\n\\n^^^^^ 2016-05-03 09:28:01 ^^^^^^^^^^^\\nC:\\\\users\\\\hcche\\\\Downloads> cd .\\\\simplemde\\nC:\\\\users\\\\hcche\\\\Downloads\\\\simplemde> npm install simplemde --save\\nnpm WARN deprecated gulp-minify-css@1.2.4: Please use gulp-clean-css\\nnpm WARN deprecated graceful-fs@3.0.8: graceful-fs v3.0.0 and before will fail on node releases >= v6.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.\\nnpm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.\\nnpm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v6.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.\\nsimplemde@1.10.1 node_modules\\\\simplemde\\n├── marked@0.3.5\\n├── codemirror@5.14.3\\n└── codemirror-spell-checker@1.0.6 (gulp-minify-css@1.2.4, gulp-header@1.7.1, gulp-concat@2.6.0, gulp-uglify@1.5.3, gulp@3.9.1)\\nC:\\\\users\\\\hcche\\\\Downloads\\\\simplemde>\\n\\nNote! The result is totally different to what happened last night at home.\\nSee Ynote \\\"SimpleMDE Install\\\" for pictures of the correct results.\\n\\n-------------------\\n\\n \\n\\n \",\"mode\":true,\"readonly\":false}","8 different ways to beautifully style your lists":"{\"doc\":\"\\\\ http://www.marcofolio.net/css/8_different_ways_to_beautifully_style_your_lists.html\\ncls \\n\\n<o>\\n<div id=\\\"list1\\\">\\n<style>\\n \\n/* LIST #1 */\\n#list1 { }\\n#list1 ul { list-style:none; text-align:left; border-top:1px solid #eee; border-bottom:1px solid #eee; padding:10px 0; }\\n#list1 ul li { display:inline; text-transform:uppercase; padding:0 10px; letter-spacing:10px; }\\n#list1 ul li a { text-decoration:none; color:#eee; background-color:#333;}\\n#list1 ul li a:hover { text-decoration:underline; color:#ffffff;text-transform:lowercase;}\\n</style>\\nThe most common use currently for using a list on your web page, is because \\nfor navigation. In this HTML/CSS example, the code is shown that creates a \\nsimple, minimalistic yet beautiful navigation structure.\\n <ul>\\n <li><a href=\\\"#\\\">Home</a></li>\\n <li><a href=\\\"#\\\">Blog</a></li> \\n <li><a href=\\\"#\\\">About</a></li>\\n <li><a href=\\\"#\\\">Contact</a></li>\\n </ul>\\n</div>\\n</o>\\n\\n<o>\\n<div id=\\\"list2\\\">\\n<style>\\n/* LIST #2 */\\n#list2 { font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Lucida, Geneva, Helvetica, Arial, sans-serif; }\\n#list2 ol {width:320px; font-style:italic; font-family:Georgia, Times, serif; font-size:24px; color:#bfe1f1;background-color: #333; }\\n#list2 ol li { }\\n#list2 ol li p { padding:8px; font-style:normal; font-family:Arial; font-size:13px; color:#eee; border-left: 1px solid #999; }\\n#list2 ol li p em { display:block; }\\n</style>\\n\\nThe problem with lists, is that you can't make the looks of the list be \\ndifferent than from the text. The number of the list always must have the \\nsame color and font as the text.\\n<p>\\nBut, by adding an extra element in the list-item, you can work around these \\nlimitations and create a very slick list. Here's how to do it:\\n\\n <ol>\\n <li><p><em>The Netherlands</em> is a country in ...sfssd sdflsdj sdfjs djs <p>dfsdf sdf<p>jsdfs</p></li>\\n <li><p><em>The United States of America</em> is a federal constitutional ...</p></li>\\n <li><p><em>The Philippines</em> officially known as the Republic ...</p></li>\\n <li><p><em>The United Kingdom</em> of Great Britain and ...</p></li>\\n </ol>\\n</div>\\n</o>\\n\\n<o>\\n<div id=\\\"list3\\\">\\n<style>\\n \\n/* LIST #3 */\\n#list3 {font-family:Georgia, Times, serif;}\\n#list3 ul { list-style-image: url(\\\"../images/arrow.png\\\"); color:#eee; background-color:#333; font-size:18px; }\\n#list3 ul li { line-height:30px; }\\n</style>\\nYou can change the bullet style of an unorered list to some other build-in \\nvalues, but you can also change them into an image. This technique can make \\nyour list even prettier. Let's see how this is done.\\n <ul>\\n <li>Java</li>\\n <li>.NET</li>\\n <li>C++</li>\\n <li>PHP</li>\\n </ul>\\n</div>\\n</o>\\n\\n<o>\\nThis list is taken from the the iPhone Contacts App with CSS and jQuery. \\nIt shows the Contacts.app style list as you can see them on the iPhone. \\nJust a little bit more eye candy for your web site.\\n\\n<div id=\\\"list4\\\">\\n<style>\\n/* LIST #4 */\\n#list4 { width:320px; font-family:Georgia, Times, serif; font-size:15px; }\\n#list4 ul { list-style: none; }\\n#list4 ul li { }\\n#list4 ul li a { display:block; text-decoration:none; color:#000000; background-color:#FFFFFF; line-height:30px;\\n border-bottom-style:solid; border-bottom-width:1px; border-bottom-color:#CCCCCC; padding-left:10px; cursor:pointer; }\\n#list4 ul li a:hover { color:#FFFFFF; background-color:#333; /*background-image:url(../images/hover.png);*/ background-repeat:repeat-x; }\\n#list4 ul li a strong { margin-right:10px; }\\n</style>\\n <ul>\\n <li><a href=\\\"#\\\"><strong>Toronto</strong>2004</a></li>\\n <li><a href=\\\"#\\\"><strong>Beijing</strong>2008</a></li>\\n <li><a href=\\\"#\\\"><strong>London</strong>2012</a></li>\\n <li><a href=\\\"#\\\"><strong>Rio de Janeiro</strong>2016</a></li>\\n </ul>\\n</div>\\n</o>\\n\\n<o>\\n<div id=\\\"list5\\\">\\n<style>\\n/* LIST #5 */\\n#list5 { color:#eee; background-color:#333; font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Lucida, Geneva, Helvetica, Arial, sans-serif; }\\n#list5 ol { font-size:18px; }\\n#list5 ol li { }\\n\\n#list5 ol li ol { list-style-image: url(\\\"../images/nested.png\\\"); padding:5px 0 5px 18px; font-size:15px; }\\n#list5 ol li ol li { color:#bfe1f1; height:15px; margin-left:10px; }\\n</style>\\nNested lists (lists inside lists) can be extremely useful and beautiful to style. \\nBy combining the third technique (Image bullets), we can create a \\\"expanded list\\\". \\nOf course, with the help of jQuery, you can make this expanding even work (but we'll \\nstick to CSS techniques only).\\n <ol>\\n <li>Google\\n <ol>\\n <li>Picasa</li>\\n <li>Feedburner</li>\\n <li>Youtube</li>\\n </ol>\\n </li>\\n <li>Microsoft\\n <ol>\\n <li>Corel Corporation</li>\\n <li>Zignals</li>\\n <li>ByteTaxi</li>\\n </ol>\\n </li>\\n <li>Yahoo!\\n <ol>\\n <li>Xoopit</li>\\n <li>BuzzTracker</li>\\n <li>MyBlogLog</li>\\n </ol>\\n </li>\\n </ol>\\n</div>\\n</o>\\n\\n<o>\\n<div id=\\\"list6\\\">\\nBy default, an ordered list uses numbers (1, 2, 3, 4 etc.) as list style type. \\nBy changing this value in CSS, you can create other numbering systems, for \\nexample the roman numbering style.\\n<p>\\nAlso by default, a list displays it's bullets outside of the elements \\n(you can see this pretty good in example #2 - different font for numbering). \\nTo get around this, we'll need to change the list-style-position to make the \\nnumbering display inside.\\n<style> \\n/* LIST #6 */\\n#list6 { font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Lucida, Geneva, Helvetica, Arial, sans-serif; }\\n#list6 ol { list-style-type: upper-roman; color:#eee; background-color:#333; font-size:14px; list-style-position: inside; }\\n#list6 ol li { }\\n</style>\\n <ol>\\n <li>Lorem ipsum dolor sit amet, ...<br />Fusce sit amet ...</li>\\n <li>Aenean placerat lectus tristique...<br />Vivamus interdum ...</li>\\n <li>Mauris eget sapien arcu, vitae...<br />Phasellus neque risus...</li>\\n <li>Phasellus feugiat lacus ...<br />Duis rhoncus ...</li>\\n </ol>\\n</div>\\n</o>\\n\\n<o>\\n<div id=\\\"list7\\\">\\n<style type=\\\"text/css\\\">\\n/* LIST #7 */\\n#list7 { font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Lucida, Geneva, Helvetica, Arial, sans-serif; }\\n#list7 ul { color:#eee; background-color:#333; font-size:18px; font-family:Georgia, Times, serif; }\\n#list7 ul li { display: inline; }\\n#list7 ul li:after { content: \\\", \\\"; }\\n#list7 ul li.last:after { content: \\\". \\\"; } \\n</style>\\n<p>Lists are mostly used to display a number of items under each other,\\nin a totally new element. But what if you wanted an inline list? You \\ncan achieve this, by setting the display property to inline. But when \\nyou're in text, you can prefer to make it a comma seperated list. How \\nto achieve this? With the :after pseudo code.\\n <ul>\\n <li>First inline item</li>\\n <li>Second inline item</li>\\n <li>Third inline item</li>\\n <li class=\\\"last\\\">Fourth inline item</li>\\n </ul>\\n</div>\\n</o>\\n\\n<o>\\n<div id=\\\"list8\\\">\\n<p>Here's a last small technique that works with CSS3 \\n(Supported by the latest versions of Firefox, Safari, HTA and Chrome). \\nWhen hovering a block element, you'll get a rotated hover state. \\nMight not be that useful, but it can be beautiful to see.</p>\\n<style type=\\\"text/css\\\"> \\n/* LIST #8 */\\n#list8 { font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Lucida, Geneva, Helvetica, Arial, sans-serif; }\\n#list8 ul { list-style:none; }\\n#list8 ul li { font-family:Georgia,serif,Times; font-size:18px; }\\n#list8 ul li a { display:block; width:300px; height:28px; background-color:#333; border-left:5px solid #222; border-right:5px solid #222; padding-left:10px;\\n text-decoration:none; color:#bfe1f1; }\\n#list8 ul li a:hover { -moz-transform:rotate(10deg); -moz-box-shadow:10px 10px 20px #000000;\\n -webkit-transform:rotate(10deg); -webkit-box-shadow:10px 10px 20px #000000;\\n transform:rotate(10deg); box-shadow:10px 10px 20px #000000; }\\n</style> \\n <ul>\\n <li><a href=\\\"#\\\">Home</a></li>\\n <li><a href=\\\"#\\\">Blog</a></li>\\n <li><a href=\\\"#\\\">About</a></li>\\n <li><a href=\\\"#\\\">Contact</a></li>\\n </ul>\\n</div>\\n</o>\\n\\n\",\"mode\":true,\"readonly\":false}","Log 2016/4/8":"{\"doc\":\"[x] 3nw's js: storage.save(pathname) and js: storage.restore(pathname) work fine now.\\n[/] How about 3hta? <--- 3hta works fine already, forget it.\\n[x] 3nw should auto save and restore local storage. restore when start up, save when\\n any field is saved. So I don't need corresponding words for them.\\n\\n[x] How to change SimpleMDE font family and font size?\\n > js> $(\\\".mdbox\\\").css(\\\"font-size\\\") . \\\\ ==> 20px OK \\n > js> $(\\\".mdbox\\\").css(\\\"font-family\\\") . \\\\ ==> 'Microsoft Yahei' OK \\n \\\\ 改 font-size\\n js> $(\\\".mdbox\\\").css(\\\"font-size\\\",\\\"18px\\\");$(\\\".mdbox\\\").css(\\\"font-size\\\") tib.\\n \\\\ 改 font-family\\n <js> $(\\\".mdbox\\\").css(\\\"font-family\\\",\\\"courier\\\");$(\\\".mdbox\\\").css(\\\"font-family\\\")</jsV> tib.\\n <js> $(\\\".mdbox\\\").css(\\\"font-family\\\",\\\"Microsoft Yahei\\\");$(\\\".mdbox\\\").css(\\\"font-family\\\")</jsV> tib.\\n\\n[x] 控制 SimpleMDE -- height\\n js> $(\\\".CodeMirror\\\").css(\\\"height\\\",\\\"550px\\\");$(\\\".CodeMirror\\\").css(\\\"height\\\") tib. \\\\ <---- it works!\\n > js> $(\\\".CodeMirror\\\").css(\\\"width\\\",\\\"90%\\\") . \\\\ <---- it works\\n [object Object] OK \\n > js> $(\\\".CodeMirror\\\").css(\\\"width\\\") . \\\\ ==> 1013px OK \\\"90%\\\" expected but it's in pixel.\\n > js> $(\\\".CodeMirror\\\").css(\\\"height\\\") . \\\\ ==> 300px OK 表示有機會\\n [object Object] OK \\n > js> $(\\\".CodeMirror\\\").css(\\\"height\\\",\\\"250px\\\") . <---- it works! \\n [object Object] OK \\n > js> $(\\\".CodeMirror\\\").css(\\\"height\\\",\\\"200px\\\") . <---- 自動 變成 300px, 有防呆機制。\\n [object Object] OK \\n > js> $(\\\".CodeMirror\\\").css(\\\"height\\\") . \\\\ ==> 300px OK \\n\\n[x] SimpleMDE 有個問題, 讀入新檔時, 若原先在 Preview mode 因為不會自動切成\\n edit mode 看起來好像無反應。 --> 自動先切成 edit mode 然後才讀進檔案。\\n Full screen & side-by-side 根本碰不到 [Load] button 因此不用考慮。\\n [x] Check SimpleMDE current mode\\n > js> $(\\\".md\\\").length . \\\\ ==> 1 OK \\n > js> $(\\\".md\\\")[0].mde . \\\\ ==> [object Object] OK \\n > js> $(\\\".md\\\")[0].mde.isPreviewActive() . \\\\ ==> false OK \\n > js> $(\\\".md\\\")[0].mde.isSideBySideActive() . \\\\ ==> false OK \\n > js> $(\\\".md\\\")[0].mde.isFullscreenActive() . \\\\ ==> false OK \\n [x] Alert() when in preview mode.\\n\\n[x] to play flot, need to read markdown document in flot project, so \\n [x] try \\\"simplemde\\\" first <--- which is done now ^2016-05-10 09:02:53 \\n\\n[ ] index.html 這段舊方法應該可以糾正了, 用 element.style. something 取代原來的寫法\\n <!-- 分別定義 textarea:focus 才可以隨時修改,隨 editMode 改變顏色 -->\\n <style id=styleTextareaFocus type=\\\"text/css\\\"> \\n\\t/* .console3we */ textarea:focus {\\n\\t background:#E0E0E0;\\n\\t}\\n </style>\\n\\n[ ] stopSleeping 要更有彈性點\\n JavaScript error on word \\\"stopSleeping\\\" : \\n Object doesn't support property or method 'resume'\\n\\n\\n[x] design pickFile for 3nw\\n --> see Ynote: \\\"jeforth.3we fix pickFile problem on 3nw. Get full path of local file\\\"\\n\\n[x] on 3NW,\\n <js> var simplemde = new SimpleMDE();simplemde</jsV> constant simplemde\\n --> JavaScript error : SimpleMDE is not defined <-- Use BootCDN.cn can be better\\n The including process takes time too. \\n --> Check SimpleMDE where went? <--- window.SimpleMDE() is a function which\\n is the constructor.\\n\\nstop\\n[/] to play flot, need to read markdown document in flot project, so try \\\"simplemde\\\" first\\n\\nchar ../simplemde-markdown-editor/src/css/simplemde.css readTextFile .\\nchar ../simplemde-markdown-editor/src/js/simplemde.js readTextFile .\\n \\n[x] NW.js is buggy. textarea wrap=off does not work !! --> Upgrade to new version then ok.\\n nwjs-sdk-v0.14.3-win-x64.zip is OK. pickFile oncancel() event is also requiring the new\\n NW.js. \\n\\n[ ] (on 3HTA) ls.f ed issue: \\n Very strange bug\\n These two lines will be executed when click [Read] button\\n <h>\\n <li nk rel=\\\"stylesheet\\\" href=\\\"../simplemde-markdown-editor/src/css/simplemde.css\\\">\\n <sc ript src=\\\"../simplemde-markdown-editor/src/js/simplemde.js\\\"></script>\\n </h>\\n --> and JavaScript error on word \\\"doElement\\\" : 發生錯誤,無法完成操作 80020101。\\n --> The most strange is that, may because of the same reason, simpleMDE.js alredy\\n included in 3NW !!\\n js> $(\\\"script\\\").length . \\\\ ==> 4\\n js> $(\\\"script\\\")[3].src . \\\\ ==> file:///C:/Users/hcche/Documents/GitHub/simplemde-markdown-editor/src/js/simplemde.js\\n\\n\\nstop\\njs> vm.appname==\\\"jeforth.3hta\\\" [if] char js/numeric-1.2.6.js\\n[else] char http://www.numericjs.com/lib/numeric-1.2.6.js [then]\\nreadTextFile \\\\ 先讀取 .js 檔, 但不能直接用\\n<text> \\nwindow.numeric = numeric; // 先對 source 做一點必要的加工, 把 numeric 掛上 global \\n</text> + </js> \\\\ 然後才執行\\t\\n\\nstop\\n\\n[ ] 菴中自題 宋 釋顯萬 萬松嶺上一間屋 老僧半間雲半間 雲自三更去行雨 歸來方羨老僧閒\\n[ ] How to include numeric.js? It needs a workaround.\\n In example of jeforth.3we\\\\js\\\\numeric-1.2.6.js, it does not work to:\\n include.js http://rawgit.com/hcchengithub/jeforth.3we/develop/js/numeric-1.2.6.js \\n because the module assumes itself is included by HTML head while it's not in this case.\\n Note: It does not work due to that <js></js> is volatile in 3nw, 3htm, 3ce and 3hta, \\n while it's under global in Node.js.\\n --> Workaround is:\\n char http://www.numericjs.com/lib/numeric-1.2.6.js\\n \\\\ char http://rawgit.com/hcchengithub/jeforth.3we/develop/js/numeric-1.2.6.js \\n\\treadTextFile \\\\ 先讀取 .js 檔, 但不能直接用\\n\\t<text> \\n\\twindow.numeric = numeric; // 先對 source 做一點必要的加工, 把 numeric 掛上 global \\n\\t</text> + </js> \\\\ 然後才執行\\t\\n --> Youtube presentation\\n\\t\\n[ ]\\ttutor-cloth.f console3we strange. \\n\\t[ ] Improve the scrollto position. \\n\\t[ ] Font size not consistant either.\\n\\t\\n: snapshot ( -- ) \\\\ Save outputbox to a ed\\n (ed) ( eb ) now t.dateTime ( eb now ) js: $(\\\".ebname\\\",tos(1))[0].value=pop()\\n js: $(\\\".ebtextarea\\\",tos())[0].value=outputbox.innerHTML ( eb ) \\\\ load the content\\n dup eb.content.code dup eb.appearance.browse ( eb ) \\\\ correct appearance mode\\n js: $(\\\".ebsaveflag\\\",pop())[0].checked=false \\\\ Not saved yet, up to users decision\\n ;\\n\\nstop\\n dup eb.content.browse eb.appearance.browse ;\\n\\nstop\\n[ ] log.save goes to local storage. No more log.things will be added.\\n[x] check HTML li il or something else that support \\\"[ ]\\\" and indent.\\n --> play with this article http://www.marcofolio.net/css/8_different_ways_to_beautifully_style_your_lists.html\\n --> Use the old way, accept it.\\n[ ] let <e> support comments but be careful, ... no no problem.\\n[ ] GitHub read me should feature the published 3ce Chrome extension.\\n[ ] what if local storage usage become huge? An archive method is needed.\\n\\n\\n[x] optimize [x]platform.f ls.f and editor.f\\n --> forget it. Let things come out as it be.\\n[x] Ctrl-s 竟然會自動補上 HTML closing tag !! \\n --> it seems like editor.f's Ctrl-S. --> Yeah, seems be.\\n[x] HTA can open only one window, don't know why. Use that one anyway.\\n[/] improve (export) , it's ok now but ugly.\\n Use local-storage-field-editable? to improve it.\\n --> Let it be, we have better things to do.\\n\\nstop\\neb.open check it out, if ok, go on, if not, JSON.stringify() can make it a string and show.\\nand by the way make it a readonly.\\n[x] how about an array? field is array and stringify is ok.\\n ==> stringify() can handle anything if only not a recursing object.\\n\\nstop\\n--- marker --- dropall cls \\n: local-storage-field-editable? ( name -- field boolean ) \\\\ Check if the object is a local storage editable document\\n js> storage.get(pop()) >r \\n js> typeof(rtos())==\\\"object\\\" if\\n js> typeof(rtos().doc)==\\\"string\\\"\\n js> typeof(rtos().mode)==\\\"boolean\\\"\\n js> typeof(rtos().readonly)==\\\"boolean\\\"\\n and and ( boolean )\\n else \\n false ( boolean )\\n then r> swap ;\\nchar autoexec local-storage-field-editable? .s\\nstop\\n\\n--- marker --- dropall cls \\n: local-storage-field-editable? ( name -- field boolean ) \\\\ Check if the object is a local storage editable document\\n js> storage.get(pop()) ( field ) \\n js> typeof(tos())==\\\"object\\\" if\\n js> typeof(tos().doc)==\\\"string\\\" ( field boolean ) \\n js> typeof(tos(1).mode)==\\\"boolean\\\" ( field boolean boolean ) \\n js> typeof(tos(2).readonly)==\\\"boolean\\\" ( field boolean boolean boolean ) \\n and and ( field boolean )\\n else \\n false ( field boolean )\\n then ;\\nchar x local-storage-field-editable? .s\\nstop\\njs> storage.get(\\\"autoexec\\\") js> typeof(pop()==\\\"object\\\") . \\nstop \\n\\njs: storage.set(\\\"x\\\",{aa:11})\\njs: storage.set(\\\"y\\\",\\\"我的大好是天\\\")\\njs: storage.set(\\\"z\\\",[\\\"aa\\\",123,\\\"bb\\\"])\\n\\nstop\\njs> storage.get(\\\"autoexec\\\") js> typeof(tos().doc)==\\\"string\\\"&&typeof(tos().mode)==\\\"boolean\\\"&&typeof(tos().readonly)==\\\"boolean\\\" .\\n\\n\\nstop\\n\\n[x] I twisted the ls.f to bring in the older code into new eb format of \\n doc,readonly,mode and it works for autoexec but can't edit unless \\n after saved!!?? --> fixed, haha bug.\\n\\n[x] The problem of local storage edit box lose the focus to inputbox has fixed.\\n I already have a treatment in forthConsoleHandler() for Ctrl-Enter to NOT focus on \\n to inputbox after running a TIB. So, simply do inputbox.blur() has solved the \\n problem. -- 2016/4/29 13:51\\n\\n<br><br>\\n[x] Local storage fields may not edit box document. How to avoid them from being opened by\\n edit box? \\n An edit box document is a local storage field that has \\n {<strong>doc</strong>,<strong>readonly</strong>,<strong>mode</strong>} fields.\\n So this is enough to tell.\\n\\n<br><br>\\n[x] Move older log to local storage.\\n\\n[x] let ed command take the field name, makes list easier too. --> done.\\n\\n[x] Now I hope that I can use some script in tr.table. So I can click and run scripts.\\n That requires a Security Policy:\\n Refused to execute inline event handler because it violates the following Content \\n Security Policy directive: \\\"script-src 'self' 'unsafe-eval'\\\". Either the 'unsafe-inline' \\n keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline \\n execution.\\n But after added 'unsafe-inline' into \\\"content_security_policy\\\", reload manifest.json gets\\n this error :\\n\\t\\t嘗試安裝這項擴充功能時顯示警告訊息:\\n\\t\\tIgnored insecure CSP value \\\"'unsafe-inline'\\\" in directive 'script-src'.\\n\\tSo, the only way is to use a function directly.\\n\\t--> 奇怪了, 那 jeforth.3ce 已經在用的 script 是怎麼能跑的?\\n\\t\\t--> inputbox 是收 element.onkeydown , defined in jeforth.3htm.js and platform.f\\n\\t\\t\\t只要不是 inline 形式的 onclick=\\\"blabla\\\" 就可以了。(嗎)\\n\\t\\t--> 那對 jeforth 很簡單哪! 先取得 element 再幫他掛上 element.onxxxx=function 即可。\\n\\t\\t\\telement.onxxxx=debugger; <--- Failed, 'degugger' unknown.\\n\\t\\t\\telement.onxxxx=\\\"dictate('blabla')\\\" <--- no error, but element.onxxxx will be null.\\n\\t\\t\\telement.onxxxx=function(){debugger} <--- OK!! 'this' is the element.\\n\\t\\t\\th1 :: onclick=function(e){dictate('.s')} <--- OK!!! it works fine.\\n\\t==> 結論就是不要寫成 inline script 就行了, 那沒問題呀!\\n\\t--> See Ynote: jeforth.3ce let tr.table to have script, do-able!\\n\\n[x] is#text? paste-string erase-#text-anchorNode\\n ==> See Ynote: jeforth.3ce window.getSelection() 得到的 Selection object \\n 是揮發性的!不能留下來以後用。\\n\\n[x] project-k baby.html, sample.html 突然 run 起來之後 Ctrl-enter 沒有作用, F12 debugger 才看得見\\n 問題, 原來是 jQuery 掛不起來:\\n Failed to load resource: net::ERR_NAME_NOT_RESOLVED http://ajax.microsoft.com/ajax/jQuery/jquery-1.11.2.js\\n baby.html:48 Uncaught ReferenceError: jQuery is not defined\\n 這常有, 應該要有警告。\\n 這是 GFW 的問題, 透過 VPN 就好了。中國境內有沒有 jQuery 的 mirror?\\n --> Yes! Baidu, Sina, and UpYun. Search \\\"CDN Library\\\" or \\\"Hosted JavaScript Libraries in China\\\"\\n in my YNote. Project-K samples already modified to use Baidu CDN library. Better now.\\n\\n[x] 14:21 2016-04-12 jeforth.3ce startup page to advertise itself. Use YNote directly.\\n cls <o> <iframe src=\\\"http://note.youdao.com/share/?id=b76172957fccf6a35b31dd7936327c3f&type=note#/\\\" \\n\\tname=\\\"An introduction to jeforth.3ce\\\" align=\\\"center\\\" width=\\\"96%\\\" height=\\\"6800px\\\" \\n\\tmarginwidth=\\\"1\\\" marginheight=\\\"1\\\" frameborder=\\\"1\\\" scrolling=\\\"Yes\\\"> </iframe></o> er\\t\\n\\t\\n[x] Include .f or .js from GitHub is ok! Wonderful! \\n This line works fine on the published jeforth.3ce which was installed from Chrome Web Store,\\n include http://rawgit.com/hcchengithub/jeforth.3we/develop/3htm/f/ls.f \",\"mode\":true,\"readonly\":false}","Play Flot":"{\"doc\":\"\\n \\\\ Flot.js demo GitHub\\\\flot\\\\examples\\\\basic-usage\\\\index.html\\n\\n \\\\ Prepare the Flot ploting zone\\n\\n ' flotzone [if] [else] \\n <o> <div class=flotzone></div></o> constant flotzone // ( -- DIV ) Place for Flot plotings avoid CSS conflict.\\n \\\\ flotzone :: style.background=\\\"transparent\\\"\\n js: $(\\\"div\\\",\\\".console3we\\\").css(\\\"backgroundColor\\\",\\\"transparent\\\")\\n flotzone js> $(\\\".console3we\\\")[0] insertBefore\\n [then]\\n\\n \\\\ Include CSS and Flot.js\\n \\n js> typeof($.plot)!=\\\"function\\\" [if] \\n <h> \\n <--!link id=flotcss href=\\\"../flot/examples/examples.css\\\" rel=\\\"stylesheet\\\" type=\\\"text/css\\\"-->\\n <script id=flotjs language=\\\"javascript\\\" type=\\\"text/javascript\\\" src=\\\"../flot/jquery.flot.js\\\"></script>\\n </h> drop\\n\\n \\\\ Wait a while, make sure Flot.js is ready\\n .( $.plot readiness check .)\\n ( seconds * 1000 / nap ) js> 60*1000/200 [for] \\n js> typeof($.plot)==\\\"function\\\" [if] \\n r> drop 0 >r \\\\ break the loop\\n [else] \\n 200 nap .\\\" .\\\" \\\\ wait a while\\n [then] \\n [next] cr\\n [then]\\n \\n \\\\ Demo #1\\n \\\\ Create the placeholder\\n\\n flotzone\\n <o> <div id=\\\"placeholder1\\\" style=\\\"width:600px;height:300px\\\"></div></o> ( placeholer1 )\\n appendChild\\n\\n \\\\ Plot a line \\n \\n js: $.plot($(\\\"#placeholder1\\\"),[[[0,0],[1,1]]],{yaxis:{max:1}})\\n\\n \\\\ Demo #2\\n \\\\ Create the placeholder\\n\\n flotzone\\n <o> <div id=\\\"placeholder2\\\" style=\\\"width:600px;height:300px\\\"></div></o> ( placeholer2 )\\n appendChild\\n\\n \\\\ Plot some lines\\n \\n <js>\\n $(function() {\\n\\n var d1 = [];\\n for (var i = 0; i < 14; i += 0.5) {\\n d1.push([i, Math.sin(i)]);\\n }\\n\\n var d2 = [[0, 3], [4, 8], [8, 5], [9, 13]];\\n\\n // A null signifies separate line segments\\n\\n var d3 = [[0, 12], [7, 12], null, [7, 2.5], [12, 2.5]];\\n\\n $.plot(\\\"#placeholder2\\\", [ d1, d2, d3 ]);\\n\\n // Add the Flot version string to the footer\\n\\n $(\\\"#footer\\\").prepend(\\\"Flot \\\" + $.plot.version + \\\" – \\\");\\n });\\n </js>\\n<comment>\\n[ ] flotzone 目前必須放在 .console3we 之外才行, 希望能放在 outputbox 裡面, 做實驗方便。\\n[/] How to clear inherited CSS style for the flotzone element?\\n See 3hta local storage field \\\"Study remove CSS style for an element\\\"\\n --> 不成功, 用 Yahoo CSS reset 也不行。 甚至把 jeforth.3we 本身的 common.css 取消了也不行。\\n[x] 在 outputbox 裡一片白的 flotzone 經 insertBefore 到 .console3we 之上, 還是一片白。\\n[x] 那反過來呢? **在外成功之後** 搬進來如何? --> still failed. But then move out will be ok!\\n flotzone js> inputbox insertBefore \\\\ failed\\n flotzone js> header insertBefore \\\\ ok\\n js> body flotzone appendChild \\\\ ok 只要搬出 .console3we 都 ok\\n\\n[ ] 研究如何 dump 整個 style of an element 來查看\\n js> header.style obj>keys .\\n js> $(\\\".console3we\\\")[0].style obj>keys .\\n\\n[ ] 用 xjeforth.hta <--- 改過, 試試看到底為何 進 console3we 就不行\\n --> 上面說本來不行的搬出去也不行, 現在用 xjeforth.hta, 可能是因為經過簡化, 本來在 outputbox 裡不行的\\n 變成搬出去就可以了。\\n --> 繼續簡化...把 inputbox, outputbox 搬出 .console3we 之外, 終於可以成功地把 flot charts 放進\\n outputbox 了!\\n[ ] Flot.js 於 style.background 有細微的問題。我報了 bug on Flot.js GitHub Issue : \\n https://github.com/flot/flot/issues/1497\\n Or refer to YNote: \\\"Flot bug of graph disappear reproduced. How to fix it\\\"\\n 試圖研究在用到 flot.js 時把 .console3we 的 style 重新定義, 例如把 background 去掉, 就\\n 可以在 outputbox 裡正常運作了。\\n flotzone js> outputbox insertBefore \\\\ 搬到 outputbox 之前仍在 .console3we 裡複製出問題.\\n 查看 style tags 找到 console3we 的 background\\n 把它改成 transparent 試試看.\\n[x] > js> $(\\\"style\\\").length . \\\\ ==> 4 OK \\n 這 4 個裡面不含 common.css 的定義! 所以我以前就說 inputbox 要變粉紅色得分開弄一個 style 原因\\n 可能就是這個。 \\n\\n > js> $(\\\"style\\\")[0].outerHTML .\\n <style type=\\\"text/css\\\">canvas{border:solid 1px #CCC}</style> OK \\n\\n > js> $(\\\"style\\\")[1].outerHTML .\\n <style>\\n .tr table, .tr td { \\n border:0.075em solid gray; \\n }\\n </style> OK \\n\\n > js> $(\\\"style\\\")[2].outerHTML .\\n <style id=\\\"styleTextareaFocus\\\" type=\\\"text/css\\\"> \\n .console3we textarea:focus {\\n background:#E0E0E0;\\n }\\n </style> OK \\n\\n > js> $(\\\"style\\\")[3].outerHTML .\\n <style type=\\\"text/css\\\">\\n .eb .box { width:90%; }\\n .eb .box, .eb .ebhtmlarea { border:1px solid black; }\\n .eb p { display:inline; } \\n .eb .ebname { font-size: 1.1em; }\\n </style> OK \\n\\n[ ] 蓋過去行不行? --> 3hta 不行。似乎 common.css 用了 link tag 就不能改了,讀進來執行的方式才可以修改。\\n js> $(\\\".console3we\\\").length . \\\\ ==> 1 OK \\n js> $(\\\".console3we\\\")[0].style . \\\\ ==> [object MSStyleCSSProperties] OK \\n js> $(\\\".console3we\\\")[0].style.background . \\\\ ==> null string\\n js> $(\\\".console3we\\\")[0].style.backgroundddd . \\\\ ==> undefined OK \\n js: $(\\\".console3we\\\")[0].style.background=\\\"transparent\\\"\\n js> $(\\\".console3we\\\")[0].style.background . \\\\ ==> none OK \\n\\n\\n</comment>\",\"mode\":true,\"readonly\":false}","Play flot on 3nw":"{\"doc\":\"\\n \\\\ Flot.js demo GitHub\\\\flot\\\\examples\\\\basic-usage\\\\index.html\\n\\n \\\\ Prepare the Flot ploting zone\\n\\n ' flotzone [if] [else] \\n <o> <div class=flotzone></div></o> constant flotzone // ( -- DIV ) Place for Flot plotings avoid CSS conflict.\\n flotzone js> $(\\\".console3we\\\")[0] insertBefore\\n [then]\\n\\n \\\\ Include CSS and Flot.js\\n \\n js> typeof($.plot)!=\\\"function\\\" [if] \\n <h> \\n <--!link id=flotcss href=\\\"../flot/examples/examples.css\\\" rel=\\\"stylesheet\\\" type=\\\"text/css\\\"-->\\n <script id=flotjs language=\\\"javascript\\\" type=\\\"text/javascript\\\" src=\\\"../flot/jquery.flot.js\\\"></script>\\n </h> drop\\n\\n \\\\ Wait a while, make sure Flot.js is ready\\n .( $.plot readiness check .)\\n ( seconds * 1000 / nap ) js> 60*1000/200 [for] \\n js> typeof($.plot)==\\\"function\\\" [if] \\n r> drop 0 >r \\\\ break the loop\\n [else] \\n 200 nap .\\\" .\\\" \\\\ wait a while\\n [then] \\n [next] cr\\n [then]\\n \\n \\\\ Demo #1\\n \\\\ Create the placeholder\\n\\n flotzone\\n <o> <div id=\\\"placeholder1\\\" style=\\\"width:600px;height:300px\\\"></div></o> ( placeholer1 )\\n appendChild\\n\\n \\\\ Plot a line \\n \\n js: $.plot($(\\\"#placeholder1\\\"),[[[0,0],[1,1]]],{yaxis:{max:1}})\\n\\n \\\\ Demo #2\\n \\\\ Create the placeholder\\n\\n flotzone\\n <o> <div id=\\\"placeholder2\\\" style=\\\"width:600px;height:300px\\\"></div></o> ( placeholer2 )\\n appendChild\\n\\n \\\\ Plot some lines\\n \\n <js>\\n $(function() {\\n\\n var d1 = [];\\n for (var i = 0; i < 14; i += 0.5) {\\n d1.push([i, Math.sin(i)]);\\n }\\n\\n var d2 = [[0, 3], [4, 8], [8, 5], [9, 13]];\\n\\n // A null signifies separate line segments\\n\\n var d3 = [[0, 12], [7, 12], null, [7, 2.5], [12, 2.5]];\\n\\n $.plot(\\\"#placeholder2\\\", [ d1, d2, d3 ]);\\n\\n // Add the Flot version string to the footer\\n\\n $(\\\"#footer\\\").prepend(\\\"Flot \\\" + $.plot.version + \\\" – \\\");\\n });\\n </js>\\n<comment>\\n[ ] flotzone 目前必須放在 .console3we 之外才行, 希望能放在 outputbox 裡面, 做實驗方便。\\n[/] How to clear inherited CSS style for the flotzone element?\\n See 3hta local storage field \\\"Study remove CSS style for an element\\\"\\n --> 不成功, 用 Yahoo CSS reset 也不行。 甚至把 jeforth.3we 本身的 common.css 取消了也不行。\\n[x] 在 outputbox 裡一片白的 flotzone 經 insertBefore 到 .console3we 之上, 還是一片白。\\n[x] 那反過來呢? **在外成功之後** 搬進來如何? --> still failed. But then move out will be ok!\\n flotzone js> inputbox insertBefore \\\\ failed\\n flotzone js> header insertBefore \\\\ ok\\n js> body flotzone appendChild \\\\ ok 只要搬出 .console3we 都 ok\\n\\n[ ] 研究如何 dump 整個 style of an element 來查看\\n js> header.style obj>keys .\\n js> $(\\\".console3we\\\")[0].style obj>keys .\\n\\n[ ] 用 xjeforth.hta <--- 改過, 試試看到底為何 進 console3we 就不行\\n --> 上面說本來不行的搬出去也不行, 現在用 xjeforth.hta, 可能是因為經過簡化, 本來在 outputbox 裡不行的\\n 變成搬出去就可以了。\\n --> 繼續簡化...把 inputbox, outputbox 搬出 .console3we 之外, 終於可以成功地把 flot charts 放進\\n outputbox 了!\\n[ ] Flot.js 於 style.background 有細微的問題。我報了 bug on Flot.js GitHub Issue : \\n https://github.com/flot/flot/issues/1497\\n Or refer to YNote: \\\"Flot bug of graph disappear reproduced. How to fix it\\\"\\n 試圖研究在用到 flot.js 時把 .console3we 的 style 重新定義, 例如把 background 去掉, 就\\n 可以在 outputbox 裡正常運作了。\\n flotzone js> outputbox insertBefore \\\\ 搬到 outputbox 之前仍在 .console3we 裡複製出問題.\\n 查看 style tags 找到 console3we 的 background\\n 把它改成 transparent 試試看.\\n[x] > js> $(\\\"style\\\").length . \\\\ ==> 4 OK \\n 這 4 個裡面不含 common.css 的定義! 所以我以前就說 inputbox 要變粉紅色得分開弄一個 style 原因\\n 可能就是這個。 \\n\\n > js> $(\\\"style\\\")[0].outerHTML .\\n <style type=\\\"text/css\\\">canvas{border:solid 1px #CCC}</style> OK \\n\\n > js> $(\\\"style\\\")[1].outerHTML .\\n <style>\\n .tr table, .tr td { \\n border:0.075em solid gray; \\n }\\n </style> OK \\n\\n > js> $(\\\"style\\\")[2].outerHTML .\\n <style id=\\\"styleTextareaFocus\\\" type=\\\"text/css\\\"> \\n .console3we textarea:focus {\\n background:#E0E0E0;\\n }\\n </style> OK \\n\\n > js> $(\\\"style\\\")[3].outerHTML .\\n <style type=\\\"text/css\\\">\\n .eb .box { width:90%; }\\n .eb .box, .eb .ebhtmlarea { border:1px solid black; }\\n .eb p { display:inline; } \\n .eb .ebname { font-size: 1.1em; }\\n </style> OK \\n\\n[ ] 蓋過去行不行?\\n js> $(\\\".console3we\\\").length .\\n\\n\\n</comment>\",\"mode\":true,\"readonly\":false}","Play with numeric.js":"{\"doc\":\"\\n\\n\\ncls \\n\\\\ Linear algebra example. We start with a matrix.\\n<js>\\nvar A = [[1,2,3],\\n [4,5,6],\\n [7,3,9]]; A </jsV> value A\\n\\n\\\\ Let's also make a vector.\\n<js> var x = [3,1,2]; x </jsV> value x\\n\\n\\\\ Matrix-vector product. b = A (.) x\\n<js> var b = numeric.dot(vm.g.A,vm.g.x); b </jsV> value b b (see)\\n\\n\\\\ Matrix inverse. ~A \\n<js> var Ainv = numeric.inv(vm.g.A); Ainv </jsV> value Ainv \\nAinv (see)\\n\\n\\\\ Let's check it: ~A (.) b = x Bingo!!!!\\n<js> numeric.dot(vm.g.Ainv,vm.g.b); </jsV> (see)\\n\\n\\\\ Determinant\\n<js> numeric.det(vm.g.A); </jsV> cr tib. \\n\\n\\\\ Sin wave\\n<js> var x = numeric.linspace(0,6.3,25); x </jsV> to x x (see)\\n\\n<js> var y = numeric.sin(vm.g.x); y </jsV> value y y (see)\\n\\n\\n\\n\\nstop\\njs> numeric tib.\\n\\nstop\\njs> vm.appname==\\\"jeforth.3hta\\\" [if] char js/numeric-1.2.6.js\\n[else] char http://www.numericjs.com/lib/numeric-1.2.6.js [then]\\nreadTextFile \\\\ 先讀取 .js 檔, 但不能直接用\\n<text> \\nwindow.numeric = numeric; // 先對 source 做一點必要的加工, 把 numeric 掛上 global \\n</text> + </js> \\\\ 然後才執行\\t\\n\\nstop\\n\\\\ Also hosted on BootCDN.cn\\n\\\\ http://cdn.bootcss.com/numeric/1.2.6/numeric.js\\n\\n\\\\ These lines works fine! Test ok on 3ce, 3hta ADO reads only local files\\n\\\\ so the path should be only \\\"js/numeric-1.2.6.js\\\",\\n\\nchar http://localhost:8888/js/numeric-1.2.6.js readTextFile tib.\\nchar http://www.numericjs.com/lib/numeric-1.2.6.js readTextFile tib.\\nchar http://www.numericjs.com/lib/numeric-1.2.6.min.js readTextFile tib.\\n\\n\\n\",\"mode\":true,\"readonly\":false}","Study XMLHttpRequest object 2016-07-06":"{\"doc\":\"[ ] Study how to *write* files to local disk on super-chrome jeforth.3htm\\n --> 先前有找到過一個例子, 可以把網頁上的 pictures drag-drop 一下就 save 成 local file\\n Ynote: \\\"jeforth 研究 Chrome extension 存檔到本地 disk 的方法\\\" the thing is \\\"XMLHttpRequest\\\" \\n --> Study XMLHttpRequest @ http://www.w3school.com.cn/xml/xml_http.asp\\n<js> var x =new XMLHttpRequest(); x </jsV> constant xmlhttp // ( -- obj ) XMLHttpRequest object\\nxmlhttp :: open(\\\"GET\\\",\\\"a.html\\\",true)\\nxmlhttp :: send(null)\\ntry on 3hta ... error : access denied\\ntry on jeforth.3nw --> it works! \\n\\n\\nStudy XMLHttpRequest object \\nhttp://www.w3school.com.cn/xml/xml_http.asp\\n\\n> <js> var x =new XMLHttpRequest(); x </jsV> constant xmlhttp // ( -- obj ) XMLHttpRequest object\\n> xmlhttp . ==> [object XMLHttpRequest] \\\\ this is how it looks like\\n> xmlhttp :: open(\\\"GET\\\",\\\"a.html\\\",true) \\\\ try to read something from the server, a.html is not existing.\\n> xmlhttp :: send(null) \\\\ arm the instruction.\\n> xmlhttp :> readyState . ==> 4 \\\\ 4 is \\\"loaded\\\" or \\\"complete\\\"\\n> xmlhttp :> status \\\\ ==> 0 (number) \\\\ 0 is \\\"uninitialized\\\", a.html is not existing remember?\\n\\n\\\\ Try again\\n> xmlhttp :: open(\\\"GET\\\",\\\"index.html\\\",true) \\\\ now index.html is jeforth.3htm's main page\\n \\\\ the 3'rd argument Async = True 表示脚本会在 send() 方法之后继续执行,而不等待来自服务器的响应。\\n> xmlhttp :: send(null)\\n\\n\\\\ 照理說這時候要等 event xmlhttp.onreadystatechange=state_Change_event_handler; \\\\ or false if event not used\\n\\n> xmlhttp :> readyState \\\\ ==> 4 OK \\n> xmlhttp :> status \\\\ ==> 200 (number) \\\\ Bingo!! 200 is OK\\n> xmlhttp :> statusText \\\\ ==> OK (string)\\n> xmlhttp :> responseText \\\\ ==> 真的把檔案讀進來了!! Bingo !! 3nw, 3htm (super_chrome and webserver).\\n <!DOCTYPE html>\\n <html>\\n <head id=head>\\n <title class=appname>appname \\n \\n \\n \\n\\n\\\\ 3htm/f/readtextfile.f 裡面用的是 $.get 裡面可能就是用 XMLHttpRequest.\\n\\n> xmlhttp :: open(\\\"POST\\\",\\\"222\\\",false) \\\\ 沒有 error \\n> xmlhttp :: send(\\\"1234bsdfsd\\\") \\\\ 沒有 error 但也沒效果\\n\\n\\\\ 以上 post 無效是 3nw, 3htm(super_chrome) \\n\\\\ --> 改用 3htm + webserver.f 試試看 -- same result :-(\\n\\\\ 我不瞭解 POST command 的真正意義。Server 端應該要有人把收到的 data 存成檔案。\\n\\n[ ] Server 端應該要有人把收到的 data 存成檔案。這就有點麻煩了, 還不如直接用 3nw。\\n 我以前研究過 Web server 端的程式 on 3nd, it's time to review.\\n\",\"mode\":true,\"readonly\":false}","Style for 3nw":"{\"doc\":\"

Style for 3nw

drop\\n js: outputbox.style.fontSize=\\\"1.5em\\\"\\n js: inputbox.style.fontSize=\\\"1.5em\\\"\\n editbox-style \\n .eb .box { width:90%; font-size:1.1em; /* filename */ } \\n .eb .box, .eb .ebhtmlarea { border:1px solid black; }\\n .eb .ebtextarea { font-size:1.2em }\\n .eb input { font-size:0.7em /* buttons */ }\\n .eb p { display:inline; }\\n .eb .ebname { font-size: 1em; } /* field name */\\n js: $(\\\"#ebstyle\\\")[0].innerHTML=pop() \\\\ 直接修改 ebstyle \\ncr\\n\",\"mode\":true,\"readonly\":false}","[Closed] Study remove CSS style for an element":"{\"doc\":\"*** CSS is like 塗在牆上的油漆, 是一層層抹蓋上去的。新加的 style 蓋在原有的之上。 jeforth.3we 的確有能力\\n 可以把原有的 style tag 翻出來修改 style.innerHTML 即可。\\n\\n[x] common.css 不要用 link 引進, 改在 3htm/f/platform.f 裡用 定義。如此有希望。\\n Done, See 3hta \\\"Log 2016/05/17\\\".\\n\\n[x] No work, even Yahoo CSS reset. Try to remove 3hta's CSS styles. Try ultimate nothing first.\\n\\n\\\\ [x] Try Yahoo CSS reset. partially works on 3hta. Same partial result on 3htm on Chrome.\\n\\n〈link id=flotcss href=\\\"http://yui.yahooapis.com/3.18.1/build/cssreset-context/cssreset-context-min.css\\\" rel=\\\"stylesheet\\\" type=\\\"text/css\\\"〉\\n\\n\\n〈div class=\\\"yui3-cssreset\\\">\\n Anything here would be reset, 好像有效。\\n 雖然 background color 沒有如預期變成白色, 字體倒是變小了, \\n 不過 font-family 還是 courier new. 沒有恢復。 \\n 這可能是因為字體、大小、背景顏色等並不會造成 style 的問題。\\n〈/div>\\n drop\\n\\nstop\\nhttp://stackoverflow.com/questions/15901030/reset-remove-css-styles-for-element-only\\n\\n[x] js: $(vm.g.flotzone).removeAttr('style') <-- does not work in 3hta\\n js: $(\\\".console3we\\\").removeAttr('style') <-- not Chrome Version 50.0.2661.94 m either\\n\\n[x] No work in 3hta, nor 3htm\\n\\n\\n constant sstt\\n\\n\\nYahoo CSS reset \\n/*\\nYUI 3.18.1 (build f7e7bcb)\\nCopyright 2014 Yahoo! Inc. All rights reserved.\\nLicensed under the BSD License.\\nhttp://yuilibrary.com/license/\\n*/\\n.yui3-cssreset html{color:#000;background:#FFF}.yui3-cssreset body,.yui3-cssreset div,.yui3-cssreset dl,.yui3-cssreset dt,.yui3-cssreset dd,.yui3-cssreset ul,.yui3-cssreset ol,.yui3-cssreset li,.yui3-cssreset h1,.yui3-cssreset h2,.yui3-cssreset h3,.yui3-cssreset h4,.yui3-cssreset h5,.yui3-cssreset h6,.yui3-cssreset pre,.yui3-cssreset code,.yui3-cssreset form,.yui3-cssreset fieldset,.yui3-cssreset legend,.yui3-cssreset input,.yui3-cssreset textarea,.yui3-cssreset p,.yui3-cssreset blockquote,.yui3-cssreset th,.yui3-cssreset td{margin:0;padding:0}.yui3-cssreset table{border-collapse:collapse;border-spacing:0}.yui3-cssreset fieldset,.yui3-cssreset img{border:0}.yui3-cssreset address,.yui3-cssreset caption,.yui3-cssreset cite,.yui3-cssreset code,.yui3-cssreset dfn,.yui3-cssreset em,.yui3-cssreset strong,.yui3-cssreset th,.yui3-cssreset var{font-style:normal;font-weight:normal}.yui3-cssreset ol,.yui3-cssreset ul{list-style:none}.yui3-cssreset caption,.yui3-cssreset th{text-align:left}.yui3-cssreset h1,.yui3-cssreset h2,.yui3-cssreset h3,.yui3-cssreset h4,.yui3-cssreset h5,.yui3-cssreset h6{font-size:100%;font-weight:normal}.yui3-cssreset q:before,.yui3-cssreset q:after{content:''}.yui3-cssreset abbr,.yui3-cssreset acronym{border:0;font-variant:normal}.yui3-cssreset sup{vertical-align:text-top}.yui3-cssreset sub{vertical-align:text-bottom}.yui3-cssreset input,.yui3-cssreset textarea,.yui3-cssreset select{font-family:inherit;font-size:inherit;font-weight:inherit}.yui3-cssreset input,.yui3-cssreset textarea,.yui3-cssreset select{*font-size:100%}.yui3-cssreset legend{color:#000}#yui3-css-stamp.cssreset-context{display:none}\\n\\n\\n\\n[ ] \",\"mode\":true,\"readonly\":false}","[closed] Bug error click [open] of a ls.f ed log but OK on snapshot":"{\"doc\":\"

\\n Snapshot 2016-05-19 16:59:10 <======== Click Open ok
Log 2016/05/17 <========= Click Open causes the below error
[closed] stamp command
Study remove CSS style for an element
Play Flot
log of 3nw
3nw working on simpleMDE
Play with numeric.js
8 different ways to beautifully style your lists
autoexec

OK JavaScript error on word \\\"eb.settings\\\" : Unable to get property 'checked' of undefined or null reference
Panic jsc>
> reset

> .s
     0: [object HTMLDivElement] (object) <-------- this is the eb editbox
     1: [object Object] (object) <--------- this is suspected the problem, what is it?
OK
> snapshot



[x] Check eb.settings, what 'checked' ??
    RI: (eb.read) stack unbalance in a if case1 else case2 then

 

\",\"mode\":false,\"readonly\":false}","[closed] stamp command":"{\"doc\":\"[x] I need time stamp, a Stamp command that pastes t.dateTime at the cursor position.\\n: stamp ( -- ) \\\\ Paste date-time at cursor position\\n js> clipboardData.getData(\\\"text\\\") ( saved ) \\\\ SAVE-restore\\n now t.dateTime ( saved \\\"date time\\\" )\\n js: clipboardData.setData(\\\"text\\\",pop()) ( saved )\\n WshShell.SendKeys \\\"^v\\\" \\n 500 sleep js: clipboardData.setData(\\\"text\\\",pop()) ( empty ) \\\\ save-RESTORE\\n ;\\n /// It works now 2016-05-16 18:11:03. Leave 'stamp' in inputbox then put cursor\\n /// at target position, press Ctrl-Enter, then that's it! Date-time pasted to\\n /// the target position.\\n\",\"mode\":true,\"readonly\":false}","ad":"{\"doc\":\"\\n\\\\ Remove all annoying floating ad boxes. 刪除所有惱人的廣告框。\\nactive-tab :> id tabid! \\nvar divs = document.getElementsByTagName(\\\"div\\\");\\nfor (var i=divs.length-1; i>=0; i--){\\n if(divs[i].style.position){\\n divs[i].parentNode.removeChild(divs[i]);\\n }\\n}\\nfor (var i=divs.length-1; i>=0; i--){\\n if(parseInt(divs[i].style.width)<600){ // <---- 任意修改\\n divs[i].parentNode.removeChild(divs[i]);\\n }\\n}\\n\\n\",\"readonly\":true,\"mode\":true}","autoexec":"{\"doc\":\"\\njs: outputbox.style.fontSize=\\\"1.5em\\\"\\njs: inputbox.style.fontSize=\\\"1.5em\\\"\\n\",\"mode\":true,\"readonly\":false}","dividend for 3nw":"{\"doc\":\"[ ] Error! tabs.query unknown.\\n[ ] 3nw in trouble, extra errors after the first real error.\\n\\n\\\\ \\n\\\\ jeforth.3ce 讀取「臺灣銀行」的「除權除息表」並比對歷史,如果有新的就發出 alert。\\n\\\\ 應用 localStorage 貯存公司列表,所以關機重跑還是記得讀到過的公司。\\n\\\\\\n\\\\ 要手動先準備的部分\\n\\\\ 1. open the data page \\n\\\\ > js: window.open(\\\"http://fund.bot.com.tw/z/ze/zeb/zeba.djhtm\\\")\\n\\\\ 2. open 3ce page\\n\\\\ 3. Assign tabid\\n\\\\ > list-tabs \\\\ get tabid\\n\\\\ 228 除權除息表-依股號\\n\\\\ > 228 tabid! \\\\ setup tabid \\n\\ns\\\" http://fund.bot.com.tw/z/ze/zeb/zeba.djhtm\\\" constant 除權除息表網址 // ( -- \\\"url\\\" )\\n除權除息表網址 js: push({url:pop()}) tabs.query ( [tabs] )\\njs> tos().length>=1 [if] [else] \\n 除權除息表網址 js: window.open(pop()) \\\\ 想取得該 tab 的 window object? No way! 別想了。\\n cr .( 上網讀取【台灣銀行--除權除息表】網頁 ) cr \\n [begin] \\n 除權除息表網址 js: push({url:pop()}) tabs.query ( [tabs] ) \\n char . . 500 nap \\n js> tos().length>=1 [if] true [else] false [then]\\n [until] cr\\n[then]\\njs> pop()[0].id tabid! \\ncr .( 已成功讀取【台灣銀行--除權除息表】網頁 ) cr \\n\\n' Refresh_the_target_page ' check_updated and [if] \\n Refresh_the_target_page check_updated\\n[else]\\n : dump-all- ( -- ) \\\\ Dump all table cells of tabid target page\\n js> $(\\\"td\\\").length ( length )\\n ?dup if dup for dup r@ - ( COUNT i ) \\n >r\\n js> $(\\\"td\\\")[rtos()].innerText \\\\ cell value\\n js> $(\\\"td\\\")[rtos()].getAttribute(\\\"class\\\") dup if char _note_ + then\\n js> $(\\\"td\\\")[rtos()].id dup if char _note_ + then\\n r>\\n .\\\" index:\\\" . .\\\" ID: \\\" . .\\\" Class: \\\" . space . cr \\\\ the cr provides an important nap time \\n ( COUNT ) next drop then ; \\n /// Run on jeforth.3ce target page\\n\\n : dump-all- ( -- ) \\\\ Dump all table rows of tabid target page\\n js> $(\\\"tr\\\").length ( length )\\n ?dup if dup for dup r@ - ( COUNT i ) \\n >r\\n js> $(\\\"tr\\\")[rtos()].outerHTML remove-script-from-HTML remove-select-from-HTML \\\\ row HTML\\n js> $(\\\"tr\\\")[rtos()].getAttribute(\\\"class\\\") dup if char _note_ + then\\n js> $(\\\"tr\\\")[rtos()].id dup if char _note_ + then\\n r>\\n .\\\" index:\\\" . .\\\" ID: \\\" . .\\\" Class: \\\" . space drop cr \\\\ the cr provides an important nap time \\n ( COUNT ) next drop then ; \\n /// Run on jeforth.3ce target page\\n \\n : Refresh_the_target_page ( -- ) \\\\ Refresh the tabid target page.\\n tabid js: chrome.tabs.reload(pop())\\n 500 nap tabid tabs.get :> status!=\\\"complete\\\" if\\n 1500 nap \\\\ Do my best to allow the title to become available\\n .\\\" Still loading \\\" tabid tabs.get :> title . space\\n 0 begin\\n tabid tabs.get :> status==\\\"complete\\\" if 1+ then\\n dup 5 > if ( TOS 餵給 until ) else \\\\ 5 complete to make sure it's very ready.\\n char . . 300 nap false\\n then\\n until .\\\" done! \\\" cr\\n then ;\\n /// Improve this if the target page is unstable then we need to timeout and retry.\\n\\n : find-next-company ( i -- i' ) \\\\ Find next 已公布除權息日的公司 in 台銀除權除息表 return index or zero.\\n s\\\" var last_index = \\\" swap + [compile] \\\\ setup variable for the target page\\n \\n var next_index = 0;\\n var array_td = document.getElementsByTagName(\\\"td\\\");\\n for (var i=last_index+1; i :> [0] ;\\n\\n : company-name ( i -- name ) \\\\ Convert index of to company name\\n var array_td = document.getElementsByTagName(\\\"td\\\"); \\n char array_td[ swap + char ].innerText + \\n [compile] :> [0] ;\\n\\n : get-company-hash ( -- hash count ) \\\\ Get the company names of 台銀除權除息表。\\n var array_td = document.getElementsByTagName(\\\"td\\\");\\n {} ( hash ) 0 ( count ) 0 ( index ) begin \\n find-next-company dup ( hash count idx' idx' ) \\n while \\n ( hash count idx' ) swap 1+ swap ( hash count++ idx' )\\n dup company-name ( hash count++ idx' name )\\n js: tos(3)[pop()]=true ( hash count++ idx' )\\n repeat ( hash count++ 0 ) drop ;\\n\\n : save-company-hash ( hash -- ) \\\\ Save company hash to local storage key 'company-hash'.\\n js> JSON.stringify(pop()) ( json )\\n js: localStorage[\\\"company-hash\\\"]=pop() ;\\n /// localStorage[\\\"company-hash\\\"] is JSON\\n\\n : restore-company-hash ( -- hash ) \\\\ Read company hash from local storage key 'company-hash'.\\n js> localStorage[\\\"company-hash\\\"] \\n js> tos()==undefined if null else js> JSON.parse(pop()) then ;\\n /// localStorage[\\\"company-hash\\\"] is JSON\\n\\n : isSameHash ( h1 h2 -- boolean ) \\\\ Compare two hash table\\n \\n var flag = true;\\n for (var i in tos(1)){ // 兩頭各比一次\\n if (tos()[i]!==true) flag = false;\\n break;\\n }; \\n for (var i in tos()){ // 兩頭各比一次\\n if (tos(1)[i]!==true) flag = false;\\n break;\\n }; execute(\\\"2drop\\\"); flag ;\\n\\n : check_updated ( -- ) \\\\ Check if 台銀除權除息表 is updated\\n restore-company-hash ( hash0 ) obj>keys :> length if \\\\ Init check\\n now t.dateTime . .\\\" localStorage company hash = \\\" restore-company-hash dup (see)\\n get-company-hash drop dup -rot isSameHash if ( company-hash )\\n drop .\\\" , no update since the last check.\\\" cr\\n else ( company-hash )\\n s\\\" , something new updated. Check it out!\\\" \\n dup . cr js: alert(pop())\\n dup (see) save-company-hash\\n then\\n else \\n \\\\ initialize\\n get-company-hash drop save-company-hash\\n then ;\\n\\n \\\\ Check every hour\\n \\\\ run: begin Refresh_the_target_page check_updated 1000 60 * 60 * nap again\\n\\n Refresh_the_target_page check_updated \\n[then]\\n\\n\\n\\n \\\\ Obloleted words\\n \\n : count_oAddCheckbox ( -- n ) \\\\ Get the company count of 台銀除權除息表。\\n 0 ( count ) 0 ( index ) begin \\n find-next-company dup ( count idx' idx' ) \\n while \\n ( count idx' ) swap 1+ swap \\n repeat ( count 0 ) drop ;\\n /// Item count does not mean much, because the table cuts items \\n /// before yesterday.\\n\\n : check_oAddCheckbox_count ( -- ) \\\\ Check if 台銀除權除息表 is updated <== obsoleted\\n js> localStorage.oAddCheckbox_count ( init check ) if\\n now t.dateTime . .\\\" localStorage.oAddCheckbox_count = \\\" js> localStorage.oAddCheckbox_count .\\n count_oAddCheckbox js> localStorage.oAddCheckbox_count int = if\\n .\\\" , no update since the last check.\\\" cr\\n else\\n s\\\" , something new updated. Check it out!\\\" \\n dup . cr js: alert(pop())\\n count_oAddCheckbox js: localStorage.oAddCheckbox_count=pop()\\n then\\n else \\n \\\\ initialize\\n count_oAddCheckbox\\n js: localStorage.oAddCheckbox_count=tos()\\n js> localStorage.oAddCheckbox_count!=pop() if\\n s\\\" Error! Your browser does not support HTML5 localStorage.\\\" \\n dup . cr \\\"msg\\\"abort\\n then\\n then ;\\n\\n\",\"mode\":true,\"readonly\":false}","log of 3nw":"{\"doc\":\"[x] file input 若被 user cancel 則 sleep 得不到 stopsleeping 在那裏苦等 <--- problem!\\n> constant ff\\n> ff :> value . \\\\ ==> OK it's null string by default\\n> ff :> value . \\\\ after picking a file, it becomes a pathname\\nC:\\\\Users\\\\hcche\\\\Documents\\\\GitHub\\\\chrome-app-samples\\\\tryitnowbutton_small.png OK \\n> ff :> value . \\\\ try again but click cancel, it becomes a null string as anticipated, good!\\n> \\\\ click [cancel] clears ff.value <--- good!!\\n> ff :: onchange=function(){alert(\\\"onchange\\\")} \\\\ Add event handler, it works!\\n> \\\\ click [cancel] does not fire onchange() event unless due to the above reason that has actually been changed.\\n> ff :: oncancel=function(){alert(\\\"onCancel\\\")} <--- click [cancel] does not fire this event at all. But onchange() event got fired sometimes.\\n> ff :: onchange=function(){alert(\\\"onBigChange\\\")} \\\\ Handler can be changed and it works fine.\\n> ff :> oncancel . \\\\ ==> function (){alert(\\\"onCancel\\\")} OK check, it's there\\n> ff :> onchange . \\\\ ==> function (){alert(\\\"onBigChange\\\")} check, it's there\\n> \\\\ ff :: onabort=function(){alert(\\\"onAbort\\\")} \\\\ ==> Click cancel does not fire this either.\\n> \\\\ ff :> onabort . \\\\ ==> ff :: onabort=function(){alert(\\\"onAbort\\\")}\\n> \\\\ No, click [cancel] does not fire onabort() \\n\\n\\\\ 企圖故意製造 onchange 100% 發生的努力, 失敗了:\\n> ff :> value=\\\"dummy\\\" <--- Not allowed, see err message:\\nJavaScript error : Failed to set the 'value' property on 'HTMLInputElement': \\nThis input element accepts a filename, which may only be programmatically set \\nto the empty string.\\n\\n\\\\ 機會 : 每個 file input 都是新的, 用完馬上 remove 掉, 有機會讓所有的 cancel 都 fire \\n\\\\ onchange() event? --> 一上來馬上 cancel 因為 file.value 都是 null string 沒有變故\\n\\\\ 不會 fire onchange() event. --> 試試為 file.value 給訂初值 --> No way, see:\\n\\\\ 为安全起见,file-upload 元素不允许 HTML 作者或 JavaScript 程序员指定一个默认的文件名。\\n\\nff :> defaultValue \\\\ ==> null string.\\n constant fff\\nff :: onbeforedeactivate=function(){alert(\\\"beforeDeActivate\\\")} \\\\ <== fire when blur, 不適合.\\n\\nff :: onblur=function(){alert(\\\"onblur\\\")} <-- fired when both clicking [瀏覽] and \\nclick desk top but not clicking [cancel], shit!!!\\n\\n[x] 解決了! 3nw 會 fire oncancel() when [cancel] clicked!! Bingo!!\\nff :: onemptied=function(){type(\\\"onemptied\\\")}\\nff :: onended=function(){type(\\\"onended\\\")}\\nff :: onerror=function(){type(\\\"onerror\\\")}\\nff :: onerrorupdate=function(){type(\\\"onerrorupdate\\\")}\\nff :: onfilterchange=function(){type(\\\"onfilterchange\\\")}\\nff :: onfocus=function(){type(\\\"onfocus\\\")}\\nff :: onfocusin=function(){type(\\\"onfocusin\\\")}\\nff :: onfocusout=function(){type(\\\"onfocusout\\\")}\\nff :: onhelp=function(){type(\\\"onhelp\\\")}\\nff :: oninput=function(){type(\\\"oninput\\\")}\\nff :: onchange=function(){type(\\\"onChange\\\")}\\nff :: oncancel=function(){type(\\\"oncancel\\\")}\\n\\n3hta\\nonfocusin onfocus onfocusout \\nonfocusin onfocus onfocusout\\n\\n3nw\\nonfocus \\nonfocus oncancel\\nonfocus \\nonfocus oncancel\\n\\n[x] Answer to stackoverflow with my finding of oncancel() works!\\n http://stackoverflow.com/questions/10127492/capturing-cancel-event-on-input-type-file\\n\\n I have the same question, the solution is surprisingly very \\n easy ... at least in my case NW.js (Node-Webkit) fires oncancel \\n event if user click the [cancel] button in the file chooser \\n dialogue. You use this simple and native way if you're also on \\n NW.js (process.version is v5.11.0).\\n\\n I also tried Microsoft HTA on Windows 10, it does not fire the \\n oncancel event.\\n\\n' --- [if] --- [then] marker --- \\n\\n \\n \\n\\n\\n\\nThe above sample code, modified for jeforth, from \\nhttp://stackoverflow.com/questions/29705135/node-webkit-read-full-path-of-files-from-directory\\nworks fine, very well. No problem at all getting the full pathname on 3nw, but not on 3ce. So, \\nNW.js is really provides super power.\\n\\n\\\\ Works fine on 3nw,\\n> js> $(\\\"#fileDialog\\\").length \\\\ ==> 1 OK \\n> js> $(\\\"#fileDialog\\\")[0].value . \\\\ ==> C:\\\\Users\\\\hcche\\\\Downloads\\\\download OK \\n> js> document.getElementById(\\\"fileDialog\\\") . \\\\ ==> [object HTMLInputElement] OK \\n> js> document.getElementById(\\\"fileDialog\\\").value . \\\\ ==> C:\\\\Users\\\\hcche\\\\Downloads\\\\download OK \\n> pickFile \\n> .s\\n 0: (string) \\\\ <--- My original pickFile does not work on 3nw. Needs debug.\\n\\n\\\\ On jeforth.3ce, failed as anticipated\\n\\n > js> document.getElementById(\\\"fileDialog\\\").value .\\n C:\\\\fakepath\\\\__865.jpg OK <---- \\\"fakepath\\\" as anticipated.\\n\\n\\\\ Works fine on 3HTA.\\n\\n > js> document.getElementById(\\\"fileDialog\\\").value .\\n C:\\\\Users\\\\hcche\\\\Downloads\\\\魏月梅 全民健保核退申請書.PDF OK \\n\\n\\\\ So, pickFile can be improved by this solution from Stackoverflow.\\n\\n: pickFile ( -- \\\"pathname\\\" ) \\\\ Pick a file through web browser's GUI\\nchar input createElement ( element )\\ndup char type char file setAttribute ( element )\\ndup char id char pickfile setAttribute ( element )\\neleBody over appendChild \\\\ 要 append 才有作用。\\n( element ) js> tos().click();tos().value ( element pathname ) ;\\n\\n\\\\ 照上面這個 pickFile 實驗, 還是不行。確定傳回的 pathname 是個 \\\"\\\". 然而手動觀察 element.value 卻是\\n\\\\ 正確的 pathname. [x] 猜想, 最後一行手動看應該會是 expected pathname 無誤。\\n\\n> .s \\n 0: [object HTMLInputElement] (object) \\\\ backup\\n 1: C:\\\\Users\\\\hcche\\\\Downloads\\\\jeforth.3ce.p4.jpg (string)\\n 2: [object HTMLInputElement] (object) \\\\ to be removed\\n> removeElement\\n> js> tos(1).value . \\\\ 查看 element 的 value \\nC:\\\\Users\\\\hcche\\\\Downloads\\\\jeforth.3ce.p4.jpg OK \\\\ 竟然是對的。此時 element id 確定已經不存在了。\\n\\n\\n[x] 嘗試手動作最後一行\\n: pickFile ( -- \\\"pathname\\\" ) \\\\ Pick a file through web browser's GUI\\nchar input createElement ( element )\\ndup char type char file setAttribute ( element )\\ndup char id char pickfile setAttribute ( element )\\neleBody over appendChild \\\\ 要 append 才有作用。\\n; \\n\\n\\\\ 果然, 這行一起做, 傳回 \\\"\\\"\\n( element ) js> tos().click();tos().value ( element pathname ) ;\\n\\n\\\\ 手動分開做, 就 OK 了!!\\n( element ) js: tos().click()\\njs> tos().value ( element pathname ) ;\\n\\n[x] click() 之後, 加上一點 nap 看看, --> \\n\\n: pickFile ( -- \\\"pathname\\\" ) \\\\ Pick a file through web browser's GUI\\nchar input createElement ( element )\\ndup char type char file setAttribute ( element )\\ndup char class char pick_file setAttribute ( element )\\njs> body over appendChild \\\\ 要 append 才有作用。\\njs: tos().click() ( element ) \\\\ 回來就表示 user 已經完成操作\\n( seconds * 1000 / nap ) js> 60*1000/200 for ( element ) \\n\\tjs> tos().value if \\n\\t\\tr> drop 0 >r \\\\ break the loop\\n\\telse \\n\\t\\t200 nap .\\\" .\\\" \\\\ wait a while\\n\\tthen \\nnext ( element ) \\njs> tos().value \\\\ 即使 timeout 也不管了 ( element path ) \\nswap removeElement ; ( path ) \\n\\n\\\\ Ultimate version\\n\\n: pickFile ( -- \\\"pathname\\\" ) \\\\ Pick a file through web browser's GUI\\n\\tchar input createElement ( element )\\n\\tdup char type char file setAttribute ( element )\\n\\tdup char class char pick_file setAttribute ( element ) \\\\ for debug, clue of the element\\n\\tjs: tos().onchange=function(){execute('stopSleeping')} ( element )\\n\\tjs> body over appendChild \\\\ 要 append 才有作用。 ( element )\\n js: tos().click() ( element ) \\\\ @ HTA 回來就表示 user 已經完成操作, @ NW.js 則馬上回來。\\n\\t( minutes*60*1000 ) js> 5*60*1000 sleep ( element )\\n\\tjs> tos().value \\\\ 即使 timeout 也不管了 ( element path ) \\n\\tswap removeElement ; ( path ) \\n\\n: pickFile \\t\\t( -- \\\"pathname\\\" ) \\\\ Pick a file through web browser's GUI\\nchar input createElement ( element )\\ndup char type char file setAttribute ( element )\\ndup char class char pick_file setAttribute ( element ) \\\\ for debug, clue of the element\\n\\\\ For none 3hta only, setup the event handler\\njs> vm.appname!=\\\"jeforth.3hta\\\" if\\n\\tjs: tos().onchange=function(){execute('stopSleeping')} ( element ) then\\njs> body over appendChild \\\\ 要 append 才有作用。 ( element )\\njs: tos().click() ( element ) \\\\ @ HTA 回來就表示 user 已經完成操作, @ NW.js 則馬上回來。\\n\\\\ For none 3hta only, wait for the onchange event\\njs> vm.appname!=\\\"jeforth.3hta\\\" if\\n\\t( minutes*60*1000 ) js> 5*60*1000 sleep ( element ) then\\njs> tos().value \\\\ 即使 timeout 也不管了 ( element path ) \\nswap removeElement ; ( path ) \\n/// Works fine on 3hta and 3nw. The dialog works but returns Null string on 3htm \\n/// or C:\\\\fakepath\\\\__865.jpg on 3ce.\\n/// Through excel app's GetOpenFilename method can do the same thing:\\n/// excel.app js> pop().GETopenFILENAME <== with or w/o () both fine\\n/// Excel's GetSaveAsFilename method too.\\n\\n\\n\\n\\n[x] 3nw's js: storage.save(pathname) and js: storage.restore(pathname) work fine now.\\n[/] How about 3hta? <--- 3hta works fine already, forget it.\\n[x] 3nw should auto save and restore local storage. restore when start up, save when\\n any field is saved. So I don't need corresponding words for them.\\n\",\"mode\":true,\"readonly\":false}","node.js HTTP server":"{\"doc\":\"\\n\\\\ ~@~@~@~@~@~@~@~@~ Build Your First HTTP Server in Node.js ~@~@~@~@~@~@~@~@~\\n\\\\\\n\\\\ https://www.diigo.com/user/hcchen/b/373115646\\n\\\\ jeforth.3nw localsotrage field \\\"node.js HTTP server\\\"\\n\\\\ ~\\\\jeforth.3we\\\\3nd\\\\build_your_http_server.f \\n\\\\\\n\\n\\\\ Lets require/import the HTTP module and choose a port to listen\\n js> require('http') constant http // ( -- HTTP-object ) Get node.js http module\\n\\n\\\\ Lets define a port we want to listen to\\n 8080 constant PORT // ( -- port# ) Port number HTTP server listen to\\n\\n\\\\ We need a function which handles requests and send response\\n \\n \\n var f = function handleRequest(request, response){\\n response.end('It Works!! Path Hit: ' + request.url);\\n };f\\n constant handleRequest // ( -- func ) Request handler\\n \\n\\n\\\\ Callback triggered when server is successfully listening. Hurray!\\n \\n var f = function callback(){\\n type(\\\"Server listening on: http://localhost:\\\"+vm[context].PORT);\\n }; f\\n constant server-callback // ( -- func ) Call back function of the HTTP server\\n\\n\\\\ Create a server\\n http :> createServer(vm[context].handleRequest)\\n constant server // ( -- obj ) HTTP server object\\n\\n\\\\ Lets start our server\\n server :> listen(vm[context].PORT,vm[context][\\\"server-callback\\\"])\\n\\n\\\\ Your server should respond differently to different URL \\n\\\\ paths. This means we need a dispatcher. Dispatcher is kind \\n\\\\ of router which helps in calling the desired request handler \\n\\\\ code for each particular URL path. Now lets add a dispatcher \\n\\\\ to our program. First we will install a dispatcher module, \\n\\\\ in our case httpdispatcher. There are many modules available \\n\\\\ but lets install a basic one for demo purposes\\n\\n js> require('httpdispatcher') constant dispatcher // ( -- obj ) HTTP dispatcher\\n\\n\\n//Lets use our dispatcher\\nfunction handleRequest(request, response){\\n try {\\n //log the request on console\\n console.log(request.url);\\n //Disptach\\n dispatcher.dispatch(request, response);\\n } catch(err) {\\n console.log(err);\\n }\\n}\",\"mode\":true,\"readonly\":false}","pruning":"{\"doc\":\"\\n\\\\ Make the target page editable for pruning. 把 target page 搞成 editable 以便修剪。\\nactive-tab :> id tabid! document.getElementsByTagName(\\\"body\\\")[0].contentEditable=true \\n\",\"readonly\":true,\"mode\":true}","smde_MyUniqueID":"j e f o r t h . 3 w e\n==============\n**Forth** is the simplest programming language ever. The jeforth.**3we** project is an implementation based on a **3 Words Engine** from [project-k](http://github.com/hcchengithub/project-k) for many applications: *HTA (jeforth.3hta)*, *HTML (jeforth.3htm)*, *Chrome Extension (jeforth.3ca)*, *Node.js (jeforth.3nd)*, *Node-webkit or NW.js (jeforth.3nw)*, and probably more in the future. All of them have been tested on Windows 8 or Windows 10.\n\nPlay now\n===========\nAmong the many applications, jeforth for web page (jeforth.3htm) can run on your web browser right now thus is good for demonstration. \n\n#### [Solar system](http://rawgit.com/hcchengithub/jeforth.3we/master/index.html?cls_include_solar-system.f)\n[簡介](http://note.youdao.com/yws/public/redirect/share?id=94764cf57ba4365e2997f4a268ff7716&type=false)
\n![enter image description here](https://github.com/hcchengithub/jeforth.3we/wiki/pictures/solar-system.png)\n\n#### [H2O](http://rawgit.com/hcchengithub/jeforth.3we/master/index.html?cls_include_h2o.f)\n![enter image description here](https://github.com/hcchengithub/jeforth.3we/wiki/pictures/h2o.png)\n\n#### [Alarm clock](http://rawgit.com/hcchengithub/jeforth.3we/master/index.html?cls_include_alarm.f_er)\n ![enter image description here](https://github.com/hcchengithub/jeforth.3we/wiki/pictures/demo-alarm.png)\n \n#### [Box2Dweb Physics Engine demo - Arrows](http://rawgit.com/hcchengithub/jeforth.3we/master/index.html?cls_include_box2dweb-arrow.f)\n![enter image description here](https://github.com/hcchengithub/jeforth.3we/wiki/pictures/demo-arrow.png)\n\n#### [Chipmunk Physics Engine demo - Pyramid Stack](http://rawgit.com/hcchengithub/jeforth.3we/master/index.html?cls_include_chipmunk-js-pyramidstack.f)\n![enter image description here](https://github.com/hcchengithub/jeforth.3we/wiki/pictures/demo-pyramidstack.png)\n\n\nWhat else can you do with jeforth.3we?\n=============\n\n#### [Markdown editor](http://note.youdao.com/yws/public/redirect/share?id=1a8a342f3a9c1e0622a6050480af28b7&type=false)\n\nNW.js can access files in your local computer and also have all abilities like the Chrome browser, that allows jeforth.3nw to include JavaScript modules from the Internet. For example, [SimpleMDE](https://simplemde.com) is a Markdown Editor that works fine on jeofrth.3nw. \n\n![enter image description here](https://github.com/hcchengithub/jeforth.3we/wiki/pictures/demo 3nw mde editor.JPG)\n\n\nGet source code, unzip, and start running\n=============\n\n| Item | Address |\n----------------|----------------------------------------------\n| jeforth.3we high level source code | *http://github.com/hcchengithub/jeforth.3we* |\n| Kernel, projectk.js 3-words-engine| *http://github.com/hcchengithub/project-k* |\n\n
\nClick the [Download ZIP] button of both projects [jeforth.3we](https://github.com/hcchengithub/jeforth.3we) and [project-k](https://github.com/hcchengithub/project-k) on their GitHub web page to get them. Unzip jeforth.3we first and then unzip project-k to under the jeforth.3we directory, as shown in the below directory listing. Then you can run 3hta.bat without installing anything else if your computer is Windows 8 or Windows 10; or run 3nd.bat and 3nw.bat, if you have installed node.js and nw.js.\n\nMy jeforth.3we/ directory listing for example,\n\n![jeforth3we-dir.png](https://github.com/hcchengithub/jeforth.3we/wiki/pictures/jeforth3we-dir.png)\n\n\n**Note:** Only for jeforth.3hta and only when you were **Download Zip** jeforth.3we from GitHub, It's necessary to use GNU tool [unix2dos](http://waterlan.home.xs4all.nl/dos2unix.html) to convert the new line characters of all text files [from Unix's LF to Windows' CRLF](https://en.wikipedia.org/wiki/Unix2dos). This is an example command line of the usage:\n\n d:\\jeforth.3we>for /R %G in (*.*) do d:\\bin\\unix2dos.exe \"%G\"\n\n
\n\nIf you were **git clone https://github.com/hcchengithub/jeforth.3we** instead of **Download Zip** then forget this step, GitHub shell for Windows already converts new line characters to CRLF correctly. \n\nPresentation videos\n======\n\n| No. | Mandarin | English |\n--------|----------|---------\n| 1 | [Opening](http://www.camdemy.com/media/19253)| n/a |\n| 2 | [Run the HTML version online](http://www.camdemy.com/media/19254)| n/a |\n| 3 | [Run the HTML version on local computer](http://www.camdemy.com/media/19255)| n/a |\n| 4 | [Run the HTA version](http://www.camdemy.com/media/19256)| n/a |\n| 5 | [Run Node.js and Node-Webkit version](http://www.camdemy.com/media/19257)| n/a |\n| 6 | [F2 inputbox edit mode](http://www.camdemy.com/media/19258)| n/a |\n| 7 | [F4 Copy marked string to inputbox](http://www.camdemy.com/media/19259)| n/a |\n| 8 | [F5 Restart](http://www.camdemy.com/media/19260)| n/a |\n| 9 | [Bigger/Smaller input box](http://www.camdemy.com/media/19261)| n/a |\n| 10 | [Esc clear input box](http://www.camdemy.com/media/19262)| n/a |\n| 11 | [Tab auto-complete](http://www.camdemy.com/media/19263)| n/a |\n| 12 | [Enter jump into the input box](http://www.camdemy.com/media/19264)| n/a |\n| 13 | [Up/Down recall command history](http://www.camdemy.com/media/19265)| n/a |\n| 14 | [Alt-Up Reuse used commands](http://www.camdemy.com/media/19266)| n/a |\n| 15 | [Crtl- / Ctrl+ Zoom in/ Zoom out](http://www.camdemy.com/media/19267)| n/a |\n| 16 | [Ctrl-Break stop all tasks](http://www.camdemy.com/media/19268)| n/a |\n| 17 | [BackSpace trims the output box](http://www.camdemy.com/media/19269)| n/a |\n| 18 | [Help is helpful](http://www.camdemy.com/media/19270)| n/a |\n| 19 | [jsc JavaScript Console](http://www.camdemy.com/media/19271)| n/a |\n\nWhat to play in further depth\n========================\nDownload and setup the jeforth.3we directory and project-k directory as mentioned above.\n\n#### **HTA** / jeforth.3hta\nDouble click the **jeforth.3we/jeforth.hta** or execute the below DOS command line in a DOS box,\n```\njeforth.hta cls .' Hello world' cr 3000 sleep bye\n```\n![3htahello-world.png](https://github.com/hcchengithub/jeforth.3we/wiki/pictures/3htahello-world.png)\n\nThe prior method runs self-test because there's no given task to do. The 2'nd method is expected to print 'Hello world' (as shown above) and return to DOS box after 3 seconds.\n\n\nNote! If you see the Windows error message : [\"Safety Settings on this computer prohibit accessing a data source on another domain\"](https://social.msdn.microsoft.com/Forums/en-US/becc982a-b693-49bb-8fb0-95847a3e96c7/hta-safety-settings-on-this-computer-prohibit-accessing-a-data-source-on-another-domain?forum=scripting) that I heard may happen on some Windows 7 computers. Sorry, [I have no solution yet](http://stackoverflow.com/questions/32177060/hta-safety-settings-on-this-computer-prohibit-accessing-a-data-source-on-anot), It didn't happen on those Windows 7 computers that I could reach. Please upgrade to Windows 8 or 10 to avoid from the problem.\n\n#### **Node.js** / jeforth.3nd\nMake sure you can run node.exe in a DOS box so you have setup the path. Make the jeforth.3we/ folder be your working directory. Execute one of the below demo command lines:\n```\nnode jeforth.3nd.js\nnode jeforth.3nd.js cls .' Hello world' cr bye\n```\nAgain, like the above HTA case, the prior command line does the self-test, and the 2'nd is expected to print 'Hello world'.\n\nWe have a local Web server written by jeforth.3nd itself. See jeforth.3we/Webserver.bat. Having a local Web server is necessary to run jeforth.3htm. \n\n#### **HTML** / jeforth.3htm\nSetup your local Web server by running jeforth.3we/Webserver.bat, \n\n![webserver.png](https://github.com/hcchengithub/jeforth.3we/wiki/pictures/webserver.png)\n\nthen try to visit below URLs:\n```\nhttp://localhost:8888\nhttp://localhost:8888/index.html\nhttp://localhost:8888/index.html? cr .\" hello world\" cr cr \nhttp://localhost:8888/index.html?_cr_.\"_hello_world\"_cr_cr \nhttp://localhost:8888/index.html? .\" 8-) \" 100 nap rewind\nhttp://localhost:8888/index.html?_.\"_8-)_\"_100_nap_rewind\n```\nI have tested IE10 , IE11 and Chrome. Firefox or other web browsers are not tested yet. As shown above, we can put any forth words in the URL. That will be the task jeforth.3htm will do after start up and the self-test will be skipped when having a task to do.\n\n#### **Node-webkit** / jeforth.3nw\nSetup your Node.js and Node-Webkit path in prior. Refer to 3nw.bat as an example. Make jeforth.3we/ be your working directory, run either one of below command lines:\n```\nnw ../jeforth.3we\nnw ../jeforth.3we cls .' Hello World' 3000 sleep bye\n```\nThe prior runs self-test because there's no given task to do. The 2'nd is expected to print 'Hello world' and return to DOS box after 3 seconds.\n\t\nCompile eforth.com\n--------------------------\n\nJeforth.3nd for Node.js can be a handy x86 CPU assembler (any other CPU too). We have an example to compile the legendary eforth.com executable for 16 bits PC under MS-DOS by Bill Muench and C. H. Ting, 1990.\n\n 1. Install node.js correctly so you can run node.exe in a DOX box. Working directory at jeforth.3we/. \n 2. Run: node.exe jeforth.3nd.js include 86ef202.f bye\n 3. You got jeforth.3we/eforth.com\n 4. I have a 32bits windows 8, so I can run eforth.com directly. If your Windows system is 64 bits, you'll need a DOS virtual machine like vmware, virtual box, or I recommend DOSBox, to run the created eforth.com.\n\nExcel automation\n---------------------\nUse jeforth.3hta to manipulate excel spread sheets. This example gets a column from a reference excel file to your target excel file.\n\n 1. Double click on jeforth.3we/jeforth.hta to start it. After the self-test type the command line \"include merge2.f\" into the input box.\n 2. Or run the below command line directory for the same thing:\n```\njeforth.hta include merge2.f\n```\n\n#### The End\n\n - FigTaiwan [http://figtaiwan.org](http://figtaiwan.org) \n - H.C. Chen [hcchen5600@gmail.com](hcchen5600@gmail.com) \n - Written with [StackEdit](https://stackedit.io/)\n\n\n "} \ No newline at end of file From ff4e7e0c36b154660ed7dfaf01495a0d4f75869f Mon Sep 17 00:00:00 2001 From: "H.C. Chen" Date: Sun, 25 Mar 2018 11:37:31 +0800 Subject: [PATCH 10/20] little bug --- 3hta/excel/excel.f | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/3hta/excel/excel.f b/3hta/excel/excel.f index b260ed0..d4b7432 100644 --- a/3hta/excel/excel.f +++ b/3hta/excel/excel.f @@ -32,7 +32,7 @@ null value excel.app // ( -- obj ) The Excel.Application object or undefined if no excel exists. /// "Application Object (Excel)" http://msdn.microsoft.com/en-us/library/office/ff194565(v=office.15).aspx - s" where name = 'ExCeL.ExE'" count-process ( count ) + excel.app.count 1 > [if] cr cr ." W A R N I N G ! (from excel.f)" cr cr ." Multiple Excel.Application are running, I can only handle one of them." cr @@ -40,6 +40,7 @@ ." that one or you'll have to use the 'kill-excel' command to close all of them and" cr ." then '--excel.f-- include excel.f' to restart me, the excel.f module, again." cr cr [then] + excel.app.count [if] \ 用這行就錯了! On Error Resume Next:Set xl=GetObject("","excel.application"):vm.push(xl) 會開出新 Excel.Application。 On Error Resume Next:Set xl=GetObject(,"excel.application"):vm.push(xl) \ 這行才是沿用既有的 Excel.Application。 @@ -501,7 +502,7 @@ function lookup(index){ // return hash[index] or undefined [then] \ excel.app exists \ -- end of source code -- - + \ \ ================ How to open an Excel file ============================================ \ \ From d99c548c4acf1aa3d68cf3283197a7c7b2bb3417 Mon Sep 17 00:00:00 2001 From: "H.C. Chen" Date: Thu, 29 Mar 2018 18:37:01 +0800 Subject: [PATCH 11/20] better excel.f --- 3hta/excel/excel.f | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/3hta/excel/excel.f b/3hta/excel/excel.f index d4b7432..3cb0ccb 100644 --- a/3hta/excel/excel.f +++ b/3hta/excel/excel.f @@ -238,12 +238,20 @@ else selection :: item(tos()).activate() then ; /// 這組工具:上,下,左,右,當格,的【判斷】都依賴這些 cell 有 /// 值,若不然時就要用本命令 i?stop 透過 selection 來完成。 - /// \ Example, 選中的格子都去掉頭尾空白。 + /// \ Example-1, 選中的格子都去掉頭尾空白,做完 i 自動消失 /// manual 0 cut ( 前置準備 ) - /// i?stop ( 【判斷】兼【移位】,留下 i ) - /// cell@ trim cell! ( do 把當格前後空白都刪掉 ) + /// i?stop ( 【判斷】兼【移位】,留下 i,此 i 不能破壞 ) + /// cell@ trim cell! ( do 把當格前後空白都刪掉,i 沒用到就放著 ) /// 1 nap rewind ( 重複 ) - /// auto ( 收尾 ) + /// auto ( 收尾 ) + /// + /// \ Example-2: 檢查選中的格子是否都是數字,若非就印出 i 繼續,做完 i 自動消失 + /// cr manual 0 [begin] ( 前置準備 ) + /// i?stop ( 【判斷】兼【移位】,留下 i,此 i 不能破壞 ) + /// cell@ js> typeof(pop())=='number' ( i number? ) + /// [if] ( i 不能破壞 ) [else] dup ( i 不能破壞 ) . cr [then] ( 若非 number 印出 i ) + /// 1 nap [again] ( 重複 ) + /// auto ( 收尾 ) : @?stop ?cell@ if drop else stop then ; // ( -- ) Stop if the activeCell is not value /// Example, 一路往下只要【當格】有值就把它抄到右邊去: From cf39f12888e894b2c2870197f96f7dbbe6902d77 Mon Sep 17 00:00:00 2001 From: "H.C. Chen" Date: Thu, 12 Apr 2018 14:33:20 +0800 Subject: [PATCH 12/20] fix a bug in ls.f 3htm localStorage members are not editbox fields, fixed --- 3htm/f/ls.f | 26 +++++++++++++---------- LOG/log.txt | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 72 insertions(+), 13 deletions(-) diff --git a/3htm/f/ls.f b/3htm/f/ls.f index 7bc0bfb..61d761a 100644 --- a/3htm/f/ls.f +++ b/3htm/f/ls.f @@ -670,17 +670,21 @@ function Handler(w) {
swap ( DIV array ) \ 放整個 list 的 DIV, 非必要但可避免被 er 刪除。 begin js> tos().length while ( DIV array ) js> tos().pop() ( DIV array fieldname ) - ( DIV array fieldname INPUT ) - dup ( DIV array fieldname INPUT INPUT ) - char fieldname ( DIV array fieldname INPUT INPUT "fieldname" ) - js> tos(3) ( DIV array fieldname INPUT INPUT "fieldname" fieldname ) - setAttribute ( DIV array fieldname INPUT ) - js> tos(3) swap appendChild ( DIV array fieldname ) - ( DIV array fieldname INPUT ) - dup char fieldname js> tos(3) setAttribute ( DIV array fieldname INPUT ) - js> tos(3) swap appendChild ( DIV array fieldname ) - s" " swap + char
+ ( DIV array SPAN ) - js> tos(2) swap appendChild ( DIV array ) + js> typeof(storage.all()[tos()])=='string' if \ 過濾非 editbox fields 的東西 + ( DIV array fieldname INPUT ) + dup ( DIV array fieldname INPUT INPUT ) + char fieldname ( DIV array fieldname INPUT INPUT "fieldname" ) + js> tos(3) ( DIV array fieldname INPUT INPUT "fieldname" fieldname ) + setAttribute ( DIV array fieldname INPUT ) + js> tos(3) swap appendChild ( DIV array fieldname ) + ( DIV array fieldname INPUT ) + dup char fieldname js> tos(3) setAttribute ( DIV array fieldname INPUT ) + js> tos(3) swap appendChild ( DIV array fieldname ) + s" " swap + char
+ ( DIV array SPAN ) + js> tos(2) swap appendChild ( DIV array ) + else + drop ( DIV array ) + then repeat 2drop \ 給以上變出來的 buttons 畫龍點睛 ['] (export-one-field) ['] (ed) diff --git a/LOG/log.txt b/LOG/log.txt index 3aea007..5bb3c11 100644 --- a/LOG/log.txt +++ b/LOG/log.txt @@ -6052,5 +6052,60 @@ js> vm[context].x 要簡化成 vm.v('x') , vm.forth.y 簡化成 vm.r('y') 13:11 2018-03-20 完成 - - \ No newline at end of file +[ ] 請問 FORTH 的 select - case 結構怎麼實現? + H.C.Chen + 週三 2018/4/4, 下午 09:45 + 有網友問, 因為 if else then 多幾層之後,收尾就會有一大堆 then then then + then . . . . 不好看。我試著「畫」個樣子出來(如下),添加 start-case, case, + end-case 命令好像可以?有現成的設計嗎? + + start-case boolean1 if + do case1 \ 然後跳到 end-case 之後 + case boolean2 if + do case2 \ 然後跳到 end-case 之後 + case boolean3 if + do case3 \ 然後跳到 end-case 之後 + case boolean4 if + do case4 \ 然後跳到 end-case 之後 + end-case + + - start-case 於 compile state 初始一個暫時獨立的 array 記錄每個 case 的位置;run time 不做事。 + - if 若成立,往下執行到 else 或 case 或 then 為止,跳到 then 或 end-case 之後。 + - if 若不成立,往下跳到 else 或 then 或 case。 + - case , compile 跳往 end-case 的 jump 命令,向 start-case 登記自己的位置供 end-case 來回填它的位置; 。然後回填 here 給前一個 if , + - end-case , compile time 要回填 here 給之前所有的 case。 + + \ A1 + 吳政昌(亞斯) + 週三 2018/4/11, 上午 08:45 + 參考 https://github.com/phf/forth/blob/master/x86/jonesforth.f + + \ A2 + 吳政昌(亞斯) + 週三 2018/4/11, 上午 08:36 + 參考 https://www.complang.tuwien.ac.at/forth/gforth/Docs-html/Selection.html + Selection - Gforth Manual + 5.8.1 Selection. flag IF code ENDIF . If flag is non-zero (as far as IF etc. are concerned, a cell with any bit set represents truth) code is executed. flag IF code1 ELSE code2 ENDIF + www.complang.tuwien.ac.at + +[x] EditBox edit box 壞了,有些 fields 殺不掉,改不了。 + [x] 先複習 ls.f 有啥東西 --> eb.delete 裡最後是這樣: + ( eb name ) js: storage.del(pop()) ( eb ) removeElement ; + [x] storage <-- where from? ... from jeforth.3we\3htm\f\platform.f + js> storage.all() (see) + 看到只有三個 fields 'ad' 'autoexec' 'pruning' 所以其他東西不該出現的難怪 + 不能 delete! + [x] 查 list command 怎麼回事? + js> storage.all() obj>keys . + ad,autoexec,pruning,length,key,getItem,setItem,removeItem,clear OK + 除了前三個 field,其他都是 object members. <--------- RI! + 這些 members 可能是新的吧? 為何以前沒有發現? + --> 3hta 沒有 js> storage.all().length + [ ] 既然 chrome 有了新的 localStorage object members 咱就該考慮用上去,例 + 如用 storage.all().length storage.all().key(i) 等等,而非目前的解法 + 用 typeof(field)=='string' 來加一層分辨,有點簍。 + [x] js> storage.all() obj>keys . <--- 其中只有 editbox 的 fields 的 type 是 string + 可行的解法。 ----> 好了! 改了 ls.f 的 list 之定義,利用分辨是否 string + 過濾掉非 editbox fields. + FP @ 14:01 2018-04-12 + \ No newline at end of file From 6ad8762183acc42ab885bcc51c976d209fa477d5 Mon Sep 17 00:00:00 2001 From: "H.C. Chen" Date: Thu, 12 Apr 2018 16:21:49 +0800 Subject: [PATCH 13/20] case...endcase copied from joneforth works fine --- LOG/log.txt | 14 +++++++++++++- f/jeforth.f | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/LOG/log.txt b/LOG/log.txt index 5bb3c11..48c4c3a 100644 --- a/LOG/log.txt +++ b/LOG/log.txt @@ -6108,4 +6108,16 @@ 可行的解法。 ----> 好了! 改了 ls.f 的 list 之定義,利用分辨是否 string 過濾掉非 editbox fields. FP @ 14:01 2018-04-12 - \ No newline at end of file + +[x] select-case 參考 T550 Downloads\jonesforth.f + [x] 先查看 if else then 的寫法一不一樣 ... 差不多,所以照抄有機會 + : if ( -- a ) \ if..else..then, if..then + compile 0branch here 0 , ; immediate compile-only + : IF IMMEDIATE + ' 0BRANCH , \ compile 0BRANCH + HERE @ \ save location of the offset on the stack + 0 , \ compile a dummy offset + ; + [x] 直接抄 joneforth 立刻成功. + [x] 3htm, 3hta 直接就通過了 selftest + \ No newline at end of file diff --git a/f/jeforth.f b/f/jeforth.f index a1a26c4..eae8974 100644 --- a/f/jeforth.f +++ b/f/jeforth.f @@ -1173,6 +1173,54 @@ function test(x){ return x }; test() null = \ true true [d 1,0,2,2 d] [p "?dup" p] + \ case ... endcase definition is copied from + \ https://github.com/phf/forth/blob/master/x86/jonesforth.f + \ Also thanks to FigTaiwan 吳政昌(亞斯) for the hints. + +: case ( -- 0 ) \ ( key ) case of endof endcase + 0 ; immediate + /// Usage: + /// ( key ) case + /// char a of char AAAA endof + /// char b of char BBBB endof + /// char c of char CCCC endof + /// \ In default case, the key must be at TOS for being eaten by endcase + /// char ???? swap + /// endcase + +: of ( -- ) \ ( key ) case of endof endcase + ['] over , ['] = , [compile] if ['] drop , ; immediate + /// see help case + +: endof ( -- ) \ ( key ) case of endof endcase + [compile] else ; immediate + /// see help case + +: endcase ( -- ) \ ( key ) case of endof endcase + ['] drop , begin ?dup while [compile] then repeat ; immediate + /// see help case + + + *** case ... endcase + marker --- + : test + case + char a of char AAAA endof + char b of char BBBB endof + char c of char CCCC endof + \ In default case, the key must be at TOS for being eaten by endcase + char ???? swap + endcase ; + char a test \ ==> AAAA (string) + char b test \ ==> BBBB (string) + char c test \ ==> CCCC (string) + char d test \ ==> ???? (string) + + [d 'AAAA','BBBB','CCCC','????' d] + [p 'case', 'of', 'endof', 'endcase' p] + --- + + : variable ( -- ) \ Create a variable. create 0 , [ char push(function(){last().type='colon-variable'}) jsEvalNo , ] ; From 7d8e2a8241b3dbf1f1c7c56433a13e4297a9cf18 Mon Sep 17 00:00:00 2001 From: "H.C. Chen" Date: Mon, 16 Apr 2018 10:57:50 +0800 Subject: [PATCH 14/20] new command find-office-nic --- 3hta/f/misc.hta.f | 35 ++++++++++++++++++++++++++++------- 3hta/f/wmi.f | 14 +++++++++++--- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/3hta/f/misc.hta.f b/3hta/f/misc.hta.f index 859f0db..1926c6d 100644 --- a/3hta/f/misc.hta.f +++ b/3hta/f/misc.hta.f @@ -57,13 +57,34 @@ Math.sign = function sign(x) { return x > 0 ? 1 : x < 0 ? -1 : 0; }; \ ----- NIC on/off utility ----- - 19 value officeLAN // ( -- n ) DeviceID of the OA LAN NIC. Change this for your case. - /// "where deviceid = 19" is for my LRV2 OA only - /// Need administrator privilege, run 'dos' check title. - /// Run 3HTA.bat through right click to 'Run as administrator'. - /// Set NIC deviceID : "19 to officeLAN" misc.f - /// Get NIC deviceID : "activeNIC :> deviceid ." wmi.f - /// See all NIC devices : "list-all-nic" wmi.f + 0 value officeLAN // ( -- n ) DeviceID of the OA LAN NIC. Change this for your case. + /// Loaded by find-office-nic command automatically + /// Need administrator privilege, Run 3HTA.bat through right click to 'Run as administrator'. + /// Set NIC deviceID : 19 to officeLAN + /// Get NIC deviceID : activeNIC :> deviceid + /// See all NIC devices : list-all-nic + /// "where deviceid = 8" is for my LRV2 OA + + : is-office-nic? ( "caption" -- boolean ) \ 用 Caption 來辨認 OA 的 office LAN 是那個 nic + tos().indexOf("ThinkPad USB-C Dock Ethernet")!=-1 + pop(1).indexOf("Intel(R) Ethernet Connection (4) I219-LM")!=-1 + or ; + + : find-office-nic ( -- ) \ Load officeLAN with office NIC automatically + "" getNIC ( nic nic ... ) \ No where clause, get all of them + #nic ?dup if for + >r r@ :> caption is-office-nic? \ 找到了 + if + r@ :> NetConnectionStatus==2 \ must be connected + if + r@ :> DeviceID to officeLAN + then + then + r> drop + next then ; + + 0 to officeLAN find-office-nic officeLAN [if] [else] + alert("officeLAN not found! nicon nicoff will not work") [then] : (nicoff) ( -- ) \ Turn off the NIC (the certain where clause is for my LRV2 only) \ s" where deviceid = 19" getNIC :> disable() diff --git a/3hta/f/wmi.f b/3hta/f/wmi.f index afaacab..58ba4fc 100644 --- a/3hta/f/wmi.f +++ b/3hta/f/wmi.f @@ -117,9 +117,7 @@ /// activeNIC :> enable() \ return 5 is failed when not an administrator /// check #nic for the active NIC count if there are many. -: list-all-nic ( -- ) \ List all NIC devices - cr ." ---- List all NIC ----" cr - "" getNIC ( nic nic ... ) \ No where clause, get all of them +: nics-on-stack ( nic1 nic2 ... -- ) \ Print NIC objects on data stack, #nic is their count #nic ?dup if for >r r@ :> caption . cr ." / NetConnectionStatus: " r@ :> NetConnectionStatus . cr @@ -131,6 +129,16 @@ r> drop next then ; +: list-all-nic ( -- ) \ List all NIC devices + cr ." ---- List all NICs ----" cr + "" getNIC ( nic nic ... ) \ No where clause, get all of them + nics-on-stack ; + +: list-active-nic ( -- ) + cr ." ---- List Acive NICs ----" cr + "" activeNIC ( nic nic ... ) \ No where clause, get all of them + nics-on-stack ; + ." List all NIC" cr "" getNIC ( nic nic ... ) \ No where clause, get all of them From fb1283838826a792b7673992e45ba414bfd19c7d Mon Sep 17 00:00:00 2001 From: "H.C. Chen" Date: Mon, 16 Apr 2018 11:01:43 +0800 Subject: [PATCH 15/20] improve message --- 3hta/f/misc.hta.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3hta/f/misc.hta.f b/3hta/f/misc.hta.f index 1926c6d..53e2989 100644 --- a/3hta/f/misc.hta.f +++ b/3hta/f/misc.hta.f @@ -84,7 +84,7 @@ Math.sign = function sign(x) { return x > 0 ? 1 : x < 0 ? -1 : 0; }; next then ; 0 to officeLAN find-office-nic officeLAN [if] [else] - alert("officeLAN not found! nicon nicoff will not work") [then] + alert("officeLAN not found! Manually '8 to officeLAN' for nicon,nicoff") [then] : (nicoff) ( -- ) \ Turn off the NIC (the certain where clause is for my LRV2 only) \ s" where deviceid = 19" getNIC :> disable() From b33f6ecf7a3513a929824531aa284edffb787bc0 Mon Sep 17 00:00:00 2001 From: "H.C. Chen" Date: Fri, 27 Apr 2018 18:24:59 +0800 Subject: [PATCH 16/20] todo open --- LOG/log.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/LOG/log.txt b/LOG/log.txt index 48c4c3a..28984ce 100644 --- a/LOG/log.txt +++ b/LOG/log.txt @@ -6120,4 +6120,10 @@ ; [x] 直接抄 joneforth 立刻成功. [x] 3htm, 3hta 直接就通過了 selftest - \ No newline at end of file + +[ ] Yuan: 參考一下 Excel 增益集 JavaScript 程式設計概觀 + https://msdn.microsoft.com/zh-tw/library/office/mt616487.aspx + Office Resources + https://developer.microsoft.com/en-us/office/gallery/?filterBy=Samples + + From 88383cb7b6f5eca8c624276313da7bf3f0922e05 Mon Sep 17 00:00:00 2001 From: "H.C. Chen" Date: Wed, 30 May 2018 18:58:44 +0800 Subject: [PATCH 17/20] add discover command to 12choc.f --- demo/12choc.f | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/demo/12choc.f b/demo/12choc.f index eb4988a..482063e 100644 --- a/demo/12choc.f +++ b/demo/12choc.f @@ -325,11 +325,11 @@ sponge.setAngle(0); sponge.setVel(cp.v(0,0)); 1000 nap ; - : 6:6 ( 8 numbers -- ) \ Put 6 chocs on each side + : 6:6 ( 12 numbers -- ) \ Put 6 chocs on each side 6 left:right home hold< 6 for drop-choc-right drop-choc-left wait nap next >hold ; - : 5:5 ( 8 numbers -- ) \ Put 5 chocs on each side + : 5:5 ( 10 numbers -- ) \ Put 5 chocs on each side 5 left:right home hold< 5 for drop-choc-right drop-choc-left wait nap next >hold ; @@ -348,6 +348,11 @@ : 1:1 ( 2 numbers -- ) \ Put 1 choc on each side home hold< drop-choc-right drop-choc-left wait nap >hold ; + : discover ( -- ) \ Put all chocs into the liquid to see which one is defect + 12 [for] 12 t@ - drop-choc-left wait nap [next] ; + /// Move the sponge right side out of the tank but + /// left side in the liquid. + \ Auxiliary tools : view ( -- ) \ See all chocolates' weight From f18fb04a6eeccbcbfad0dcf515285b6ee0787356 Mon Sep 17 00:00:00 2001 From: "H.C. Chen" Date: Thu, 14 Jun 2018 16:26:47 +0800 Subject: [PATCH 18/20] =?UTF-8?q?=E7=A9=BA=E8=B0=B7=E5=85=88=E7=94=9F?= =?UTF-8?q?=E7=99=BC=E7=8F=BE=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit || 定義有誤, 存在了那麼久! --- LOG/log.txt | 13 +++++++++++++ f/jeforth.f | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/LOG/log.txt b/LOG/log.txt index 28984ce..14f62e6 100644 --- a/LOG/log.txt +++ b/LOG/log.txt @@ -6126,4 +6126,17 @@ Office Resources https://developer.microsoft.com/en-us/office/gallery/?filterBy=Samples +[ ] 13:00 2018/06/14 用 jupyter notebook 有兩種選擇: + 1. 用 ijavascript kernel, 缺點就是沒有 magic 無法與其他 jupyter notebook 功能 + 協作. + 2. 用 %%js 問題是跨 Cell 好像就斷了! + +[x] 空谷居士:在我这边,因为,比源系统多增加include了一个汉化的文件,会有这么个小状况。 + 以前也没有,不知道为什么,这两天发现冒出来了。 + yeap , include 1.f , 裡面只有一行 comment , 果真 stack 出現空 string + 有空看看 + RI: 本來的 || 定義有誤!!我當時知道,但是在 jeforth.3ca\3htm\f\quit.f 用上時忘了! + was: code || push(pop(1)||pop()) end-code // ( a b == a || b ) if a then swap else b endif + tobe: code || tos(1) ? pop() : pop(1) end-code // ( a b == a || b ) if a then a else b endif + 解決了! diff --git a/f/jeforth.f b/f/jeforth.f index eae8974..8cfaa58 100644 --- a/f/jeforth.f +++ b/f/jeforth.f @@ -671,7 +671,7 @@ function nextQuote(source) { code or var b=pop(),a=pop();push(Boolean(a)||Boolean(b)) end-code // ( a b == a or b ) Logical or. See also '||' and 'OR'. code not push(!Boolean(pop())) end-code // ( x == !x ) Logical not. Capital NOT is for bitwise. code && push(pop(1)&&pop()) end-code // ( a b == a && b ) if a then b else swap endif -code || push(pop(1)||pop()) end-code // ( a b == a || b ) if a then swap else b endif +code || tos(1) ? pop() : pop(1) end-code // ( a b == a || b ) if a then a else b endif code AND push(pop() & pop()) end-code // ( a b -- a & b ) Bitwise AND. See also 'and' and '&&'. code OR push(pop() | pop()) end-code // ( a b -- a | b ) Bitwise OR. See also 'or' and '||'. code NOT push(~pop()) end-code // ( a -- ~a ) Bitwise NOT. Small 'not' is for logical. From d7c38f9bfd871e5f602bb67105cf96e9a9b89890 Mon Sep 17 00:00:00 2001 From: "H.C. Chen" Date: Fri, 15 Jun 2018 10:06:35 +0800 Subject: [PATCH 19/20] sideeffects fixed --- LOG/log.txt | 4 ++++ f/jeforth.f | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/LOG/log.txt b/LOG/log.txt index 14f62e6..49921be 100644 --- a/LOG/log.txt +++ b/LOG/log.txt @@ -6139,4 +6139,8 @@ was: code || push(pop(1)||pop()) end-code // ( a b == a || b ) if a then swap else b endif tobe: code || tos(1) ? pop() : pop(1) end-code // ( a b == a || b ) if a then a else b endif 解決了! + 本來的寫法是直接套用 javascript 的 || 運算,當初想鐵定不會錯。 + 現在看,因為 pop(a) || pop(b) 的特性,如果 pop(a) 成立了,pop(b) 根本不會被執行, + 那就會把 b 留在 FORTH data stack 裡, 這個結果太奇怪,沒有用。所以要改寫。 + || 很少用,我用上了時不記得這種詭異的行為,結果出錯了,幸好被您發現!! diff --git a/f/jeforth.f b/f/jeforth.f index 8cfaa58..76e2cf9 100644 --- a/f/jeforth.f +++ b/f/jeforth.f @@ -696,9 +696,9 @@ function nextQuote(source) { true and \ true true or \ true false or \ true - {} [] || \ true [] {} - && \ true [] - || \ [] true + {} [] || \ true {} + [] && \ true [] + swap \ [] true && \ true "" && \ true "" not \ false From 93794a58d45162f07f588d15dc9000f5fc88ce09 Mon Sep 17 00:00:00 2001 From: "H.C. Chen" Date: Sun, 17 Jun 2018 12:27:49 +0800 Subject: [PATCH 20/20] about to make a release --- 3hta/f/misc.hta.f | 7 + 3htm/f/ls.f | 12 +- LOG/log.txt | 10045 ++++++++++++++++++++++---------------------- f/jeforth.f | 8 +- js/version.js | 2 +- 5 files changed, 5067 insertions(+), 5007 deletions(-) diff --git a/3hta/f/misc.hta.f b/3hta/f/misc.hta.f index 53e2989..7039b46 100644 --- a/3hta/f/misc.hta.f +++ b/3hta/f/misc.hta.f @@ -55,6 +55,8 @@ Math.sign = function sign(x) { return x > 0 ? 1 : x < 0 ? -1 : 0; }; ( Word array ) (aliases) ; /// Used in DOS box batch program for jeforth to ignore DOS words. +proc-env COMPUTERNAME char 31ENB667 = [if] + \ ----- NIC on/off utility ----- 0 value officeLAN // ( -- n ) DeviceID of the OA LAN NIC. Change this for your case. @@ -123,4 +125,9 @@ Math.sign = function sign(x) { return x > 0 ? 1 : x < 0 ? -1 : 0; }; \ nicoff 60 * 1000 * nap nicon ; \ last :: comment=tick('officeLAN').comment +[then] + + +\ --- The End --- + \ No newline at end of file diff --git a/3htm/f/ls.f b/3htm/f/ls.f index 61d761a..2a1f3ea 100644 --- a/3htm/f/ls.f +++ b/3htm/f/ls.f @@ -737,12 +737,12 @@ function Handler(w) { js> storage.get("autoexec") [if] [else] \ js: outputbox.style.fontSize="1.5em" - cr .( Launch the briefing ) cr - drop - cr cr - .( execute the 'list' command ) cr + \ cr .( Launch the briefing ) cr + \ drop + \ cr cr + \ .( execute the 'list' command ) cr list unindent {} js: tos().doc=pop(1) js: tos().readonly=true js: tos().mode=true diff --git a/LOG/log.txt b/LOG/log.txt index 49921be..780d6d1 100644 --- a/LOG/log.txt +++ b/LOG/log.txt @@ -1,544 +1,544 @@ - ~%~%~%~%~%~%~%~ j e f o r t h . 3 w e ~%~%~%~%~%~%~%~ - The jeforth with a three words engine - Same kernel - jeforth.js, jeforth.f, voc.f - for - all applications - HTA, HTM, Node.js - and more? - http://github.com/hcchengithub/jeforth.3we + ~%~%~%~%~%~%~%~ j e f o r t h . 3 w e ~%~%~%~%~%~%~%~ + The jeforth with a three words engine + Same kernel - jeforth.js, jeforth.f, voc.f - for + all applications - HTA, HTM, Node.js - and more? + http://github.com/hcchengithub/jeforth.3we ---------- developping log -------------------------------------------------------------- -[x] first line of jeforth.f is strange. I skip it now. Need to find out the reason someday. hcchen5600 2014/01/28 11:39:49 - ==> fso does not support utf-8, ado does. +[x] first line of jeforth.f is strange. I skip it now. Need to find out the reason someday. hcchen5600 2014/01/28 11:39:49 + ==> fso does not support utf-8, ado does. [x] why UTF-8 chinese characters are not shown correctly? ==> big5 is ok! - ==> fso does not support utf-8, ado does. + ==> fso does not support utf-8, ado does. [X] jquery.terminal-0.7.7.js ==> I give up jQuery-terminal when it comes to HTA. - > 552 var data = $.Storage.get(name + 'commands'); - > alert(name+"==>"+data); - > 553 data = data ? new Function('return ' + data + ';')() : []; - > 554 var pos = data.length-1; + > 552 var data = $.Storage.get(name + 'commands'); + > alert(name+"==>"+data); + > 553 data = data ? new Function('return ' + data + ';')() : []; + > 554 var pos = data.length-1; - How to make a Terminal (comamnd line, shell like) U/I on Web page? - See this answer ==> evernote:///view/2472143/s22/bf00c410-9727-401f-98a7-221c8fc00558/bf00c410-9727-401f-98a7-221c8fc00558/ + How to make a Terminal (comamnd line, shell like) U/I on Web page? + See this answer ==> evernote:///view/2472143/s22/bf00c410-9727-401f-98a7-221c8fc00558/bf00c410-9727-401f-98a7-221c8fc00558/ [x] the screen output is a little strange, messy. Find a SRP. - ==> print() probably is the root cause, it wrap around long lines. Looks like the jQuery-terminal - thinks of the right-edge with a wrong number. - ==> When use 'body' instead of a DIV component, the jQuery-terminal can not scroll up and the - bottom line can not see! - ==> So, give up using jQuery-terminal? Sure, ok this is it! - ==> [/] simplify the SRP and report to the jQuery-terminal author. - ==> [/] also consider to use termlib.js @ evernote:///view/2472143/s22/6df50a24-f3b8-4ae4-afc5-45d7e180b3dc/6df50a24-f3b8-4ae4-afc5-45d7e180b3dc/ - ==> [x] Try normal HTML terminal first - ------ http://jsfiddle.net/hcchen/9Kr5E/ hcchen/jsfiddle ------------------ - << HTML section >> - -
恭喜發財!
-
- root@host  - -
- - << JavaScript section >> - - $("#command").keyup(function (e) { - if (e.keyCode == 13) { - submit(); - } - }); - - var submit = function () { - var command = document.getElementById("command").value; - var outputel = document.getElementById("screenoutput"); - var div = document.createElement("div"); - div.innerHTML = "root@host " + command; - outputel.appendChild(div); - document.getElementById("command").value = ""; - }; - ==> I give up jQuery-terminal when it comes to HTA. + ==> print() probably is the root cause, it wrap around long lines. Looks like the jQuery-terminal + thinks of the right-edge with a wrong number. + ==> When use 'body' instead of a DIV component, the jQuery-terminal can not scroll up and the + bottom line can not see! + ==> So, give up using jQuery-terminal? Sure, ok this is it! + ==> [/] simplify the SRP and report to the jQuery-terminal author. + ==> [/] also consider to use termlib.js @ evernote:///view/2472143/s22/6df50a24-f3b8-4ae4-afc5-45d7e180b3dc/6df50a24-f3b8-4ae4-afc5-45d7e180b3dc/ + ==> [x] Try normal HTML terminal first + ------ http://jsfiddle.net/hcchen/9Kr5E/ hcchen/jsfiddle ------------------ + << HTML section >> + +
恭喜發財!
+
+ root@host  + +
+ + << JavaScript section >> + + $("#command").keyup(function (e) { + if (e.keyCode == 13) { + submit(); + } + }); + + var submit = function () { + var command = document.getElementById("command").value; + var outputel = document.getElementById("screenoutput"); + var div = document.createElement("div"); + div.innerHTML = "root@host " + command; + outputel.appendChild(div); + document.getElementById("command").value = ""; + }; + ==> I give up jQuery-terminal when it comes to HTA. [x] In .3nw jsEvalRaw's return value spec was quirky, it was ( data errormsg ), make it simpler - ( data, errormsg, flag) ? - jsEvalRaw is a very useful word. By using jsEvalRaw, we don't need to try{}catch{} every - system call. E.g. readTextFile() and writeTextFile() become much easier. + ( data, errormsg, flag) ? + jsEvalRaw is a very useful word. By using jsEvalRaw, we don't need to try{}catch{} every + system call. E.g. readTextFile() and writeTextFile() become much easier. [x] Now start to port wsh.f (wmi.f excel.f ... ) [x] Make .... <=== 研究 WSC 就是為了要 support 這組有趣的命令 - Study how to combine VBscipt and JScript - HTC http://msdn.microsoft.com/en-us/library/ms532146(v=vs.85).aspx - WSC or WSH gui interface with IE or HTA http://computer-programming-forum.com/61-wsh/9dad42d8c1e3a878.htm + Study how to combine VBscipt and JScript + HTC http://msdn.microsoft.com/en-us/library/ms532146(v=vs.85).aspx + WSC or WSH gui interface with IE or HTA http://computer-programming-forum.com/61-wsh/9dad42d8c1e3a878.htm - hcchen5600 2014/07/01 08:44:41 It's very easy. See below hcchen5600 2014/06/30 17:22:40 + hcchen5600 2014/07/01 08:44:41 It's very easy. See below hcchen5600 2014/06/30 17:22:40 [/] WSC can be used in VBScript even wthout registered. - Ask Michael Harris, if same thing can be done in JScript? ==> Now I realized, even if it - would turn out that only VBscript can GetObject(..wsc..) is good enough. jeforth.hta uses - that VBScript to launch jeforth.js would be fine. - [x] Put the jeforth.js into jeforth.wsc, Open jeforth.WSC in jeforth.hta - ==> use to include jeforth.js in WSC is ok. - [/] we can publicate properties and methods but how to publicate objects? - - - - - - ==> If you are thinking of a tag, see this http://msdn.microsoft.com/en-us/library/thwwf7y9(v=vs.84).aspx - But it's wrong anyway. An object is simply a property I guess. - [*] Note! Only define things in WSC, don't try to run anything in WSC. - [/] By the experiments of Dropbox\learnings\JavaScript\WSC , if run 2.vbs then - JS section in 2.wsc doesn't know about WScript.echo but MsgBox of VBS works fine. - why? WSC do not have any I/O? unless that are VBS built-in, right? This is great! - VBScript has many built-in U/I functions. + Ask Michael Harris, if same thing can be done in JScript? ==> Now I realized, even if it + would turn out that only VBscript can GetObject(..wsc..) is good enough. jeforth.hta uses + that VBScript to launch jeforth.js would be fine. + [x] Put the jeforth.js into jeforth.wsc, Open jeforth.WSC in jeforth.hta + ==> use to include jeforth.js in WSC is ok. + [/] we can publicate properties and methods but how to publicate objects? + + + + + + ==> If you are thinking of a tag, see this http://msdn.microsoft.com/en-us/library/thwwf7y9(v=vs.84).aspx + But it's wrong anyway. An object is simply a property I guess. + [*] Note! Only define things in WSC, don't try to run anything in WSC. + [/] By the experiments of Dropbox\learnings\JavaScript\WSC , if run 2.vbs then + JS section in 2.wsc doesn't know about WScript.echo but MsgBox of VBS works fine. + why? WSC do not have any I/O? unless that are VBS built-in, right? This is great! + VBScript has many built-in U/I functions. [x] Recent jeforth.3hta on Github is v1.00, it prints to a
immediately but they - do not appear on the web page immediately! <=== Note, because jeforth for-next loop is a blocking - process. Thus, "print" and "accept" need to refer to plateform.f in jeforth.3nw which is my best - practice dealing with none-blocking programming. + do not appear on the web page immediately! <=== Note, because jeforth for-next loop is a blocking + process. Thus, "print" and "accept" need to refer to plateform.f in jeforth.3nw which is my best + practice dealing with none-blocking programming. - \ By using 'sleep' command introduced since jeforth.3nw, I can make KVM none-blocking. See below - \ example, it works fine on jeforth.3hta v1.00 too. - : test for r@ . space 1 sleep next ; - cls 1000 last execute + \ By using 'sleep' command introduced since jeforth.3nw, I can make KVM none-blocking. See below + \ example, it works fine on jeforth.3hta v1.00 too. + : test for r@ . space 1 sleep next ; + cls 1000 last execute - \ But I find another way without using 'sleep' and it's much mush faster, - : test for r@ . space js> scrollToElement($('#endofpage')) next ; - cls 1000 last execute + \ But I find another way without using 'sleep' and it's much mush faster, + : test for r@ . space js> scrollToElement($('#endofpage')) next ; + cls 1000 last execute [/] 承上, I should designe a word to scroll to end of the display area. - Calling the scrolling system call gives the browser some time to breathe. - ==> scrollToElement() is good enough. If you are thinking about jeforth's example, it's, - - var o = document.getElementById('outputbox'); - o.scrollTop = o.scrollHeight; - + Calling the scrolling system call gives the browser some time to breathe. + ==> scrollToElement() is good enough. If you are thinking about jeforth's example, it's, + + var o = document.getElementById('outputbox'); + o.scrollTop = o.scrollHeight; + [x] Now by utilizing WSC, I think that I can combine jeforth.3wsh and jeforth.3hta or even jeforth.3wsf - Because they all based on the same jeforth.wsc. - HTA is really a sinking boat http://social.technet.microsoft.com/Forums/scriptcenter/en-US/c21b847c-35b4-46ab-a609-17e7fd47638e/how-to-open-the-f12-key-debugger-in-hta-like-ie?forum=ITCG#c21b847c-35b4-46ab-a609-17e7fd47638e - ==> No need to complicate wsc this way, see 2014/02/07 13:48:05 + Because they all based on the same jeforth.wsc. + HTA is really a sinking boat http://social.technet.microsoft.com/Forums/scriptcenter/en-US/c21b847c-35b4-46ab-a609-17e7fd47638e/how-to-open-the-f12-key-debugger-in-hta-like-ie?forum=ITCG#c21b847c-35b4-46ab-a609-17e7fd47638e + ==> No need to complicate wsc this way, see 2014/02/07 13:48:05 [x] hcchen5600 2014/02/07 13:48:05 - WSC's purpose is letting jeforth to support commands then we don't need to - bring entire jeforth.js into the wsc file!! - ==> Yeah! True. My .wsc has only a vbscript section that exports properties and methods. - then they can be accessed from jeforth by wsc.propertyname and wsc.methodname(). - - - ' Disk.vbs - ' Sample VBS WMI - ' Author Guy Thomas http://computerperformance.co.uk/ - ' http://www.computerperformance.co.uk/vbscript/wmi_basics.htm - ' Version 1.5 - November 2010 - ' -----------------------------------------------' - Option Explicit - Dim objWMIService, objItem, colItems, strComputer, intDrive - - ' On Error Resume Next - strComputer = "." - intDrive = 0 - - ' WMI connection to Root CIM - Set objWMIService = GetObject("winmgmts:\\" _ - & strComputer & "\root\cimv2") - Set colItems = objWMIService.ExecQuery(_ - "Select * from Win32_DiskDrive") - - ' Classic For Next Loop - For Each objItem in colItems - intDrive = intDrive + 1 - print "DiskDrive " & intDrive & vbCrLf & _ - "Caption: " & objItem.Caption & vbCrLf & _ - "Description: " & objItem.Description & vbCrLf & _ - "Manufacturer: " & objItem.Manufacturer & vbCrLf & _ - "Model: " & objItem.Model & vbCrLf & _ - "Name: " & objItem.Name & vbCrLf & _ - "Partitions: " & objItem.Partitions & vbCrLf & _ - "Size: " & objItem.Size & vbCrLf & _ - "Status: " & objItem.Status & vbCrLf & _ - "SystemName: " & objItem.SystemName & vbCrLf & _ - "TotalCylinders: " & objItem.TotalCylinders & vbCrLf & _ - "TotalHeads: " & objItem.TotalHeads & vbCrLf & _ - "TotalSectors: " & objItem.TotalSectors & vbCrLf & _ - "TotalTracks: " & objItem.TotalTracks & vbCrLf & _ - "TracksPerCylinder: " & objItem.TracksPerCylinder - Next - - ' End of Sample Disk VBScript - js> vbs.displayBuffer="";vbs.exec(pop());vbs.displayBuffer cls . - - ------------------------------------------------------------------------------- - W/O using WSC works fine too - ------------------------------------------------------------------------------- - - ' Disk.vbs - ' Sample VBS WMI - ' Author Guy Thomas http://computerperformance.co.uk/ - ' http://www.computerperformance.co.uk/vbscript/wmi_basics.htm - ' Version 1.5 - November 2010 - ' -----------------------------------------------' - Option Explicit - Dim objWMIService, objItem, colItems, strComputer, intDrive - - ' On Error Resume Next - strComputer = "." - intDrive = 0 - - ' WMI connection to Root CIM - Set objWMIService = GetObject("winmgmts:\\" _ - & strComputer & "\root\cimv2") - Set colItems = objWMIService.ExecQuery(_ - "Select * from Win32_DiskDrive") - - ' Classic For Next Loop - For Each objItem in colItems - intDrive = intDrive + 1 - print "DiskDrive " & intDrive & vbCrLf & _ - "Caption: " & objItem.Caption & vbCrLf & _ - "Description: " & objItem.Description & vbCrLf & _ - "Manufacturer: " & objItem.Manufacturer & vbCrLf & _ - "Model: " & objItem.Model & vbCrLf & _ - "Name: " & objItem.Name & vbCrLf & _ - "Partitions: " & objItem.Partitions & vbCrLf & _ - "Size: " & objItem.Size & vbCrLf & _ - "Status: " & objItem.Status & vbCrLf & _ - "SystemName: " & objItem.SystemName & vbCrLf & _ - "TotalCylinders: " & objItem.TotalCylinders & vbCrLf & _ - "TotalHeads: " & objItem.TotalHeads & vbCrLf & _ - "TotalSectors: " & objItem.TotalSectors & vbCrLf & _ - "TotalTracks: " & objItem.TotalTracks & vbCrLf & _ - "TracksPerCylinder: " & objItem.TracksPerCylinder - Next - - ' End of Sample Disk VBScript - js> vbExecute(pop()) + WSC's purpose is letting jeforth to support commands then we don't need to + bring entire jeforth.js into the wsc file!! + ==> Yeah! True. My .wsc has only a vbscript section that exports properties and methods. + then they can be accessed from jeforth by wsc.propertyname and wsc.methodname(). + + + ' Disk.vbs + ' Sample VBS WMI + ' Author Guy Thomas http://computerperformance.co.uk/ + ' http://www.computerperformance.co.uk/vbscript/wmi_basics.htm + ' Version 1.5 - November 2010 + ' -----------------------------------------------' + Option Explicit + Dim objWMIService, objItem, colItems, strComputer, intDrive + + ' On Error Resume Next + strComputer = "." + intDrive = 0 + + ' WMI connection to Root CIM + Set objWMIService = GetObject("winmgmts:\\" _ + & strComputer & "\root\cimv2") + Set colItems = objWMIService.ExecQuery(_ + "Select * from Win32_DiskDrive") + + ' Classic For Next Loop + For Each objItem in colItems + intDrive = intDrive + 1 + print "DiskDrive " & intDrive & vbCrLf & _ + "Caption: " & objItem.Caption & vbCrLf & _ + "Description: " & objItem.Description & vbCrLf & _ + "Manufacturer: " & objItem.Manufacturer & vbCrLf & _ + "Model: " & objItem.Model & vbCrLf & _ + "Name: " & objItem.Name & vbCrLf & _ + "Partitions: " & objItem.Partitions & vbCrLf & _ + "Size: " & objItem.Size & vbCrLf & _ + "Status: " & objItem.Status & vbCrLf & _ + "SystemName: " & objItem.SystemName & vbCrLf & _ + "TotalCylinders: " & objItem.TotalCylinders & vbCrLf & _ + "TotalHeads: " & objItem.TotalHeads & vbCrLf & _ + "TotalSectors: " & objItem.TotalSectors & vbCrLf & _ + "TotalTracks: " & objItem.TotalTracks & vbCrLf & _ + "TracksPerCylinder: " & objItem.TracksPerCylinder + Next + + ' End of Sample Disk VBScript + js> vbs.displayBuffer="";vbs.exec(pop());vbs.displayBuffer cls . + + ------------------------------------------------------------------------------- + W/O using WSC works fine too + ------------------------------------------------------------------------------- + + ' Disk.vbs + ' Sample VBS WMI + ' Author Guy Thomas http://computerperformance.co.uk/ + ' http://www.computerperformance.co.uk/vbscript/wmi_basics.htm + ' Version 1.5 - November 2010 + ' -----------------------------------------------' + Option Explicit + Dim objWMIService, objItem, colItems, strComputer, intDrive + + ' On Error Resume Next + strComputer = "." + intDrive = 0 + + ' WMI connection to Root CIM + Set objWMIService = GetObject("winmgmts:\\" _ + & strComputer & "\root\cimv2") + Set colItems = objWMIService.ExecQuery(_ + "Select * from Win32_DiskDrive") + + ' Classic For Next Loop + For Each objItem in colItems + intDrive = intDrive + 1 + print "DiskDrive " & intDrive & vbCrLf & _ + "Caption: " & objItem.Caption & vbCrLf & _ + "Description: " & objItem.Description & vbCrLf & _ + "Manufacturer: " & objItem.Manufacturer & vbCrLf & _ + "Model: " & objItem.Model & vbCrLf & _ + "Name: " & objItem.Name & vbCrLf & _ + "Partitions: " & objItem.Partitions & vbCrLf & _ + "Size: " & objItem.Size & vbCrLf & _ + "Status: " & objItem.Status & vbCrLf & _ + "SystemName: " & objItem.SystemName & vbCrLf & _ + "TotalCylinders: " & objItem.TotalCylinders & vbCrLf & _ + "TotalHeads: " & objItem.TotalHeads & vbCrLf & _ + "TotalSectors: " & objItem.TotalSectors & vbCrLf & _ + "TotalTracks: " & objItem.TotalTracks & vbCrLf & _ + "TracksPerCylinder: " & objItem.TracksPerCylinder + Next + + ' End of Sample Disk VBScript + js> vbExecute(pop()) [x] We totally don't need WSC if the purpose is letting jeforth to support commands. - HTA allows different language sections to reference each other! Shit, I didn't know. + HTA allows different language sections to reference each other! Shit, I didn't know. [x] wsh.f Try to support the 'include' command to auto-search the given file. - done! hcchen5600 2014/07/13 15:38:04 + done! hcchen5600 2014/07/13 15:38:04 [x] http://www.104case.com.tw/memberp/member_seek_qa.cfm?seekno=815367042306027563&mode=2 - 黃嘉祥 - 服務的金額這確實是令人頭痛的問題,有時候只是”江湖一點訣”根本沒什麼,要收費我也收的很不好意思,像 - 您104貼的那個問題,只要加上浮動設定就可以解決了 - <div id=”keyboardinput” style=”position:absolute; bottom:0;”> - 除非您有更進一步的需求再做調整。 我目前的配合方式:1.單件報價 - 次月或累積到一定的金額($5000)時 - 再付款。 2.月聘維護 - 依公司維護需求/等級定價(這部分可能要詳談)。 我通常都建議初期採用單件,除非 - 很確定需求和內容,不然採用月聘容易產生誤會(ex:錢付了,結果整個月只處理兩件小事,或一個月內超過20 - 件複雜案,超過維護門檻)如果是像104那個小問題,沒有時間壓力要馬上解決的話...我看我們就交個朋友,透 - 過mail處理掉就ok了 - 2014/02/12 04:49 + 黃嘉祥 + 服務的金額這確實是令人頭痛的問題,有時候只是”江湖一點訣”根本沒什麼,要收費我也收的很不好意思,像 + 您104貼的那個問題,只要加上浮動設定就可以解決了 + <div id=”keyboardinput” style=”position:absolute; bottom:0;”> + 除非您有更進一步的需求再做調整。 我目前的配合方式:1.單件報價 - 次月或累積到一定的金額($5000)時 + 再付款。 2.月聘維護 - 依公司維護需求/等級定價(這部分可能要詳談)。 我通常都建議初期採用單件,除非 + 很確定需求和內容,不然採用月聘容易產生誤會(ex:錢付了,結果整個月只處理兩件小事,或一個月內超過20 + 件複雜案,超過維護門檻)如果是像104那個小問題,沒有時間壓力要馬上解決的話...我看我們就交個朋友,透 + 過mail處理掉就ok了 + 2014/02/12 04:49 [x] Wrtie a debug console, 'jsc' command. - See jeforth.js function panic(msg,severity) when severity!=false. - Consider to use VBScript's MsgBox and InpubBox. - No need to use VB, JavaScript has similar built-in functions: - js: alert('msg') js> confirm('msg') js> prompt('msg') - [x] hcchen5600 2014/07/16 10:09:47 利用 eval() 會認得 local variable 的特性。 - ==> Bingo!! - kvm.jsc.prompt = "111";eval(kvm.jsc.xt); + See jeforth.js function panic(msg,severity) when severity!=false. + Consider to use VBScript's MsgBox and InpubBox. + No need to use VB, JavaScript has similar built-in functions: + js: alert('msg') js> confirm('msg') js> prompt('msg') + [x] hcchen5600 2014/07/16 10:09:47 利用 eval() 會認得 local variable 的特性。 + ==> Bingo!! + kvm.jsc.prompt = "111";eval(kvm.jsc.xt); [x] 目前 gitHub 上有一版基本版 voc.f ready -- hcchen5600 2014/02/28 15:25:14 [x] hcchen5600 2014/06/30 14:08:56 還在搞 ... 的準備。在 Github 上弄了個 Develop branch 方便 backup 用。 - jeforth.3hta\playground\vb.f 有些進展。 - 先把本來 jeforth.hta 裡的 vbs section 整個弄走,放進 vbs/basic.vbs ----> - vb.f 裡實驗用 vbExecute(pop()) 來定義 vbs function or subroutine 有成功!但只能在同一個 block 裡存在。如何把 - 它 assign 給一個 name ? - If not doable, then being able to include ~.vbs is good enough. - hcchen5600 2014/06/30 17:22:40 ... is ok now at playground/vb.f. + jeforth.3hta\playground\vb.f 有些進展。 + 先把本來 jeforth.hta 裡的 vbs section 整個弄走,放進 vbs/basic.vbs ----> + vb.f 裡實驗用 vbExecute(pop()) 來定義 vbs function or subroutine 有成功!但只能在同一個 block 裡存在。如何把 + 它 assign 給一個 name ? + If not doable, then being able to include ~.vbs is good enough. + hcchen5600 2014/06/30 17:22:40 ... is ok now at playground/vb.f. [x] hcchen5600 2014/06/30 17:23:43 - kvm.something can be accessed in section. - js> kvm obj>keys . - I got ===> init,reset,panic,*fortheval*,see,suspendForthVM,resumeForthVM,stack,words OK - many of kvm export functions are not used at all, and we need push() and pop(). ===> done! - All kvm memvers can be used in section happily. - Example: - kvm.push(kvm.tos()) <------- this works like 'DUP' command. - vb: vb> are done too. Commit it. + kvm.something can be accessed in section. + js> kvm obj>keys . + I got ===> init,reset,panic,*fortheval*,see,suspendForthVM,resumeForthVM,stack,words OK + many of kvm export functions are not used at all, and we need push() and pop(). ===> done! + All kvm memvers can be used in section happily. + Example: + kvm.push(kvm.tos()) <------- this works like 'DUP' command. + vb: vb> are done too. Commit it. [x] Many useful VBS examples are here - http://msdn.microsoft.com/en-us/library/aa394599(v=vs.85).aspx - http://technet.microsoft.com/en-us/library/ee692768.aspx + http://msdn.microsoft.com/en-us/library/aa394599(v=vs.85).aspx + http://technet.microsoft.com/en-us/library/ee692768.aspx [x] tos(),pop(),push() can be used in forth code directly but not VBS code. - Unless jeforth.hta introduces them to global. Let's do it ..... done! - Now we can use them directly in sections. + Unless jeforth.hta introduces them to global. Let's do it ..... done! + Now we can use them directly in sections. [x] 玩 self 或 window object 時,發現新大陸! window.prompt() 本來就有,可以用來 - 收 input line !! 所以 prompt = 'OK ' 要改名成 kvmPrompt. ==> 3hta, 3nw both done. hcchen5600 2014/07/03 10:41:56 - - 在 jeforth console 下,用 JavaScript 的 self 就可以看到這些東西。我覺得這時 - 的 self 應該是 kvm 但其實是 window。搞不懂! - - OK js> self obj>keys . \ ----- 3HTA ----- - Refer to MSDN @ http://msdn.microsoft.com/en-us/library/ie/ms535873(v=vs.85).aspx - - $, jQuery, kvm, WshShell, document, styleMedia, clientInformation, - clipboardData, closed, defaultStatus, event, external, - maxConnectionsPerServer, offscreenBuffering, onfocusin, onfocusout, - onhelp, onmouseenter, onmouseleave, screenLeft, screenTop, status, - innerHeight, innerWidth, outerHeight, outerWidth, pageXOf fset, - pageYOffset, screen, screenX, screenY, frameElement, frames, history, - leng th, location, name, navigator, onabort, onafterprint, - onbeforeprint, onbeforeun load, onblur, oncanplay, oncanplaythrough, - onchange, onclick, oncontextmenu, on dblclick, ondrag, ondragend, - ondragenter, ondragleave, ondragover, ondragstart , ondrop, - ondurationchange, onemptied, onended, onerror, onfocus, onhashchange, - oninput, onkeydown, onkeypress, onkeyup, onload, onloadeddata, - onloadedmetadat a, onloadstart, onmessage, onmousedown, onmousemove, - onmouseout, onmouseover, o nmouseup, onmousewheel, onoffline, ononline, - onpause, onplay, onplaying, onprog ress, onratechange, - onreadystatechange, onreset, onresize, onscroll, onseeked, onseeking, - onselect, onstalled, onstorage, onsubmit, onsuspend, ontimeupdate, o - nunload, onvolumechange, onwaiting, opener, parent, self, top, window, - localStor age, performance, sessionStorage, addEventListener, - dispatchEvent, removeEven tListener, attachEvent, detachEvent, - createPopup, execScript, item, moveBy, mov eTo, msWriteProfilerMark, - navigate, resizeBy, resizeTo, showHelp, showModeless Dialog, - toStaticHTML, scroll, scrollBy, scrollTo, getComputedStyle, alert, blur - , close, confirm, focus, getSelection, open, postMessage, print, prompt, - showModa lDialog, toString, clearInterval, clearTimeout, setInterval, - setTimeout OK - - OK js> self .s - 0: [object Window] (object) <------------ 果然是 window object ! - - 用 ~.3nw 也看看 . . . - - OK js> self . - [object Window] <------------ 確定是 window object ! - OK js> self js> window = . - true <------------ 再次確定是 window object ! ~.3hta 結果也一樣。 - - OK js> self obj>keys . \ ----- 3nw ----- - top, window, location, nwDispatcher, Intl, v8Intl, document, global, - process, Buffer, root, require, $, jQuery, kvm, gui, revision, debug, - ... snip ... - - js> document obj>keys . \ -------- 3HTA ---------------- - doctype, documentElement, implementation, inputEncoding, xmlEncoding, - xmlStandalone, xmlVersion, styleSheets, defaultView, URL, activeElement, - ... snip ... - - js: document.onmouseout=function(){alert(222)} \ 靠!真的會在 mouse 移開時打 alert() - js: document.onmouseout=null - js: document.onmouseout=function(){fortheval('hi')} \ It works!! - : test begin 80 for char * . 100 sleep next cr again ; \ 弄一個印 * 的 long run 程式。 - - 用 forth colon word 當 event handler, interrupt service routine 的要領: - o jeforth.hta inputbox 本身就是個最兇的 event 他會改 stack. 別的 event handler 都得 - balance data stack and return stack. - o 所有的 event handler 都要【接地】也就是直接回到 JavaScript host 也就是 idle state 去。 - 不能在 dictate() 或 execute() 之後放別的 JavaScript code 還以為是前面做好了才下來的, - 錯! dictate() 或 execute() 裡面很可能有 nap 或 sleep 那時候它就衝下來了! sleep 才可 - 以 stopSleeping 所以應該是它。 + 收 input line !! 所以 prompt = 'OK ' 要改名成 kvmPrompt. ==> 3hta, 3nw both done. hcchen5600 2014/07/03 10:41:56 + + 在 jeforth console 下,用 JavaScript 的 self 就可以看到這些東西。我覺得這時 + 的 self 應該是 kvm 但其實是 window。搞不懂! + + OK js> self obj>keys . \ ----- 3HTA ----- + Refer to MSDN @ http://msdn.microsoft.com/en-us/library/ie/ms535873(v=vs.85).aspx + + $, jQuery, kvm, WshShell, document, styleMedia, clientInformation, + clipboardData, closed, defaultStatus, event, external, + maxConnectionsPerServer, offscreenBuffering, onfocusin, onfocusout, + onhelp, onmouseenter, onmouseleave, screenLeft, screenTop, status, + innerHeight, innerWidth, outerHeight, outerWidth, pageXOf fset, + pageYOffset, screen, screenX, screenY, frameElement, frames, history, + leng th, location, name, navigator, onabort, onafterprint, + onbeforeprint, onbeforeun load, onblur, oncanplay, oncanplaythrough, + onchange, onclick, oncontextmenu, on dblclick, ondrag, ondragend, + ondragenter, ondragleave, ondragover, ondragstart , ondrop, + ondurationchange, onemptied, onended, onerror, onfocus, onhashchange, + oninput, onkeydown, onkeypress, onkeyup, onload, onloadeddata, + onloadedmetadat a, onloadstart, onmessage, onmousedown, onmousemove, + onmouseout, onmouseover, o nmouseup, onmousewheel, onoffline, ononline, + onpause, onplay, onplaying, onprog ress, onratechange, + onreadystatechange, onreset, onresize, onscroll, onseeked, onseeking, + onselect, onstalled, onstorage, onsubmit, onsuspend, ontimeupdate, o + nunload, onvolumechange, onwaiting, opener, parent, self, top, window, + localStor age, performance, sessionStorage, addEventListener, + dispatchEvent, removeEven tListener, attachEvent, detachEvent, + createPopup, execScript, item, moveBy, mov eTo, msWriteProfilerMark, + navigate, resizeBy, resizeTo, showHelp, showModeless Dialog, + toStaticHTML, scroll, scrollBy, scrollTo, getComputedStyle, alert, blur + , close, confirm, focus, getSelection, open, postMessage, print, prompt, + showModa lDialog, toString, clearInterval, clearTimeout, setInterval, + setTimeout OK + + OK js> self .s + 0: [object Window] (object) <------------ 果然是 window object ! + + 用 ~.3nw 也看看 . . . + + OK js> self . + [object Window] <------------ 確定是 window object ! + OK js> self js> window = . + true <------------ 再次確定是 window object ! ~.3hta 結果也一樣。 + + OK js> self obj>keys . \ ----- 3nw ----- + top, window, location, nwDispatcher, Intl, v8Intl, document, global, + process, Buffer, root, require, $, jQuery, kvm, gui, revision, debug, + ... snip ... + + js> document obj>keys . \ -------- 3HTA ---------------- + doctype, documentElement, implementation, inputEncoding, xmlEncoding, + xmlStandalone, xmlVersion, styleSheets, defaultView, URL, activeElement, + ... snip ... + + js: document.onmouseout=function(){alert(222)} \ 靠!真的會在 mouse 移開時打 alert() + js: document.onmouseout=null + js: document.onmouseout=function(){fortheval('hi')} \ It works!! + : test begin 80 for char * . 100 sleep next cr again ; \ 弄一個印 * 的 long run 程式。 + + 用 forth colon word 當 event handler, interrupt service routine 的要領: + o jeforth.hta inputbox 本身就是個最兇的 event 他會改 stack. 別的 event handler 都得 + balance data stack and return stack. + o 所有的 event handler 都要【接地】也就是直接回到 JavaScript host 也就是 idle state 去。 + 不能在 dictate() 或 execute() 之後放別的 JavaScript code 還以為是前面做好了才下來的, + 錯! dictate() 或 execute() 裡面很可能有 nap 或 sleep 那時候它就衝下來了! sleep 才可 + 以 stopSleeping 所以應該是它。 [/] Found a bug!! This bug is still in ~.3wsh and ~.3nw - wsh.f run command reads the whole line as a command line. The old definition + wsh.f run command reads the whole line as a command line. The old definition - 10 ASCII>char ( \n ) word (run) + 10 ASCII>char ( \n ) word (run) - was a mistake. It should be + was a mistake. It should be - char \n|\r word (run) ; interpret-only + char \n|\r word (run) ; interpret-only - The first match of either \r or \n terminates the command line. This is important - otherwise the extra \n may pollute the command line. + The first match of either \r or \n terminates the command line. This is important + otherwise the extra \n may pollute the command line. [x] To test 'run' command and siblings, I need to run command line therefore the parser is needed. - Copy from ~.3nw, it's easy but not so easy. Recent approach is not good. I need to impove it. - argv should neat at beginning. - ===> done! but there's a unexpected thing in stack [x] UI, tib.insert 吃到 empty stack 時會留下 - undefined at TOS. This is a mistake. 解法是在原來 pop() 處改成 (pop()||"") 就不會在 stack - empty 時 pop() 成 'undefined'. - ==> Ok now, include wsh.f then "run jeforth.hta 123 bye" you get 123 at TOS, bingo!!! + Copy from ~.3nw, it's easy but not so easy. Recent approach is not good. I need to impove it. + argv should neat at beginning. + ===> done! but there's a unexpected thing in stack [x] UI, tib.insert 吃到 empty stack 時會留下 + undefined at TOS. This is a mistake. 解法是在原來 pop() 處改成 (pop()||"") 就不會在 stack + empty 時 pop() 成 'undefined'. + ==> Ok now, include wsh.f then "run jeforth.hta 123 bye" you get 123 at TOS, bingo!!! [x] textarea cmd input has a problem. Press at middle of a string cuts the string <=== should not! - then pass the string to fortheval. I guess keydown/keyup needs fine tune <=== Yes! done. - Keycode 13 (Enter) handled in Keydown has fixed the problem. + then pass the string to fortheval. I guess keydown/keyup needs fine tune <=== Yes! done. + Keycode 13 (Enter) handled in Keydown has fixed the problem. [x] Now I am working on wsh.f and html5.f, the element can be drop on jeforth.display - so how about other HTML elements? - ==> Now I have or , Bingo!! + so how about other HTML elements? + ==> Now I have or , Bingo!! [x] wsh.f (dir) selftest's print outs should be redirected to selftest.log if printing is necessary. [x] docode() 裡面的 local variables 可以被 js> 看見!因為 JavaScript eval() 時,看得見。故 eval() 的 - 時機不能再 docode() 裡面。有機會嗎?==> done!! hcchen5600 2014/07/12 20:51:19 + 時機不能再 docode() 裡面。有機會嗎?==> done!! hcchen5600 2014/07/12 20:51:19 [x] 用 sendkey 時,不能是中文輸入法,如何禁用? 似乎有解 http://bbs.csdn.net/topics/80079918 - js> $('#cmd').hide() 1000 sleep js> $('#cmd').show() 果然是他 - document.myform.text1.style.imeMode="disabled"; 禁用輸入法的方法 - js> $('#cmd')[0].style.imeMode="disabled"; - js> $('#cmd')[0].style.imeMode="auto"; - js> $('#cmd')[0].style.imeMode="active"; - js> $('#cmd')[0].style.imeMode="inactive"; - - $('#cmd')[0].style.imeMode="disabled"; 成功!!! - 能不能連 keyboard 都禁掉? - ==> 改用 clipboard 已經成功,不怕中文輸入模式。 hcchen5600 2014/07/12 20:27:46 + js> $('#cmd').hide() 1000 sleep js> $('#cmd').show() 果然是他 + document.myform.text1.style.imeMode="disabled"; 禁用輸入法的方法 + js> $('#cmd')[0].style.imeMode="disabled"; + js> $('#cmd')[0].style.imeMode="auto"; + js> $('#cmd')[0].style.imeMode="active"; + js> $('#cmd')[0].style.imeMode="inactive"; + + $('#cmd')[0].style.imeMode="disabled"; 成功!!! + 能不能連 keyboard 都禁掉? + ==> 改用 clipboard 已經成功,不怕中文輸入模式。 hcchen5600 2014/07/12 20:27:46 [x] jeforth.3hta 因為 input textarea 本身就是 multiple line 的,word 就是跨行的了!故我把 3nw 具有的 - text command 拿掉了。然而,還是有些 word 具有原始 forth 的跨行特性,例如 : ... ; 定義就是。但 - code ... end-code 不跨行。相較之下, jeforth.3nw 的 code ... end-code 是可跨行的。 - ==> 就這樣吧!不管他了。 + text command 拿掉了。然而,還是有些 word 具有原始 forth 的跨行特性,例如 : ... ; 定義就是。但 + code ... end-code 不跨行。相較之下, jeforth.3nw 的 code ... end-code 是可跨行的。 + ==> 就這樣吧!不管他了。 [x] 又抓到一個 bug, jeforth.3nw still has the problem - // keyboard.waiting = false; // jeforth.3nw 的 jeforth.js 裡有這種 platform dependent 的東西!不應該啊 [] - // term.set_prompt(prompt); // restore default jQuery-terminal prompt constant - ==> jeforth.3we common kernel should have resolved these problems. But in jeforth.3nw stand - alone version, well ... forget it. hcchen5600 2014/10/29 08:35:43 + // keyboard.waiting = false; // jeforth.3nw 的 jeforth.js 裡有這種 platform dependent 的東西!不應該啊 [] + // term.set_prompt(prompt); // restore default jQuery-terminal prompt constant + ==> jeforth.3we common kernel should have resolved these problems. But in jeforth.3nw stand + alone version, well ... forget it. hcchen5600 2014/10/29 08:35:43 [/] Bug found: - keycode 13 時,keyup 清除 textarea 不對,當 EditMode=true 時就糗了。hcchen5600 2014/07/13 17:48:07 - 正在幫 vb.f 寫 selftest, 構想每個 word command 該怎麼測試。。。 + keycode 13 時,keyup 清除 textarea 不對,當 EditMode=true 時就糗了。hcchen5600 2014/07/13 17:48:07 + 正在幫 vb.f 寫 selftest, 構想每個 word command 該怎麼測試。。。 [x] Shift-keys seem to be locked at start up. Back-space doesn't work. Check it out ... - js> ShiftKeyDown . cr false - js> CtrlKeyDown . cr false - js> AltKeyDown . cr true <---------- I felt that too! Now why? - ==> 這是測 wsh.f selftest 用到 alt-F4 關 calc.exe 時留下來的。多 sendkeys 按一下 Alt key 即解。 + js> ShiftKeyDown . cr false + js> CtrlKeyDown . cr false + js> AltKeyDown . cr true <---------- I felt that too! Now why? + ==> 這是測 wsh.f selftest 用到 alt-F4 關 calc.exe 時留下來的。多 sendkeys 按一下 Alt key 即解。 [x] 玩一玩 HTA 下的 elements. 確定 name attribute 的用法,真的可以用點的,但很長。要攔腰命名以縮短之。 - js> document.body obj>keys . - bgColor, background, noWrap, onafterprint, onbeforeprint, onbeforeunload, onblur,onerror, ... snip ... - - js> document.body.children.jeforth obj>keys . - windowState,borderStyle,version,maximizeButton, ... snip ... - - js> $('outputbox') obj>keys . - length, prevObject, context, selector, jquery, ... snip ... - - js> $('#outputbox').parent() . \ 查看我寫的東西掛哪裡? - [object Object] OK - js> $('#outputbox').parent()[0] . \ 這個 element 是 jeforth - [object HTMLUnknownElement] OK - - js> $('#outputbox').parent()[0].id . \ 整個頁面都屬 jeforth element - jeforth OK - - char Hello!!! . - js> document.body.children.jeforth.children.outputbox.textContent . \ outputbox 是 name attribute - - : jeforth js> document.body.children.jeforth.children ; \ 攔腰給個名字,縮短 object chain. - jeforth js: pop().outputbox.textContent="1111" \ 真的可以! - - OK - js> $('#outputbox')[0] - js> document.body.children.jeforth.children.outputbox \ name attribute 可以這樣用,直接點。 - = . - true OK - - OK - js> $('outputbox')[0] \ 誤會了!此處的 name 不是 name='foo' 之類的 attribute 而是 tag name, like 'p' of

. - js> document.body.children.jeforth.children.outputbox - = . - false OK - - - js: $('textarea')[0].textContent=123 \ 真的在輸入區中置入了 '123' - - true OK js> $("#outputbox")[0].id . \ 這個參考法對 id 有效, id 要小寫。如下,對 name 無效。 - outputbox OK - js> $("#outputbox")[0].getAttribute("ID") . \ 這樣也可以。 - outputbox OK - - jeforth OK js> $('#outputbox').parent()[0].getAttribute("id") - js> $('#outputbox').parent()[0].id = . - true OK - - OK js> $("#outputbox")[0].name . \ name 不能用點的,只有 id 可以。 - undefined - OK js> $("#outputbox")[0].getAttribute("name") . \ 要用 getAttribute() - outputbox - OK js> $("#outputbox")[0].getAttribute("name") . - outputbox OK - js> $("#outputbox")[0].name . - undefined OK - - js> $("#outputbox")[0].name . cr \ undefined - js> $("#outputbox")[0].getAttribute("name") . cr \ outputbox - js> $("#outputbox")[0].class . cr \ undefined 看來只有 id 可以直接點 - js> $("#outputbox")[0].getAttribute("class") . cr \ outputbox - - 用 jeforth.3nw 的 F12 debugger 輕易就把這玩意兒搞懂了 - OK sdfsdfsd - OK js> document.body.children.outputbox.lastChild . ===> [object Text] - OK js> document.body.children.outputbox.lastChild.data . ===> sdfsdfsd - OK js> document.body.children.outputbox.lastChild.baseURI . ===> file:///D:/hcchen/Dropbox/learnings/github/jeforth.3nw/index.html - OK js> document.body.children.outputbox.lastChild.nodeName . ===> #text - OK js> document.body.children.outputbox.lastChild.nodeType . ===> 3 - OK js> document.body.children.outputbox.lastChild.nodeValue . ===> sdfsdfsd - - js: document.body.children.outputbox.lastChild.data="11223344" - js> document.body.children.outputbox.lastChild.data . ===> 11223344 - - 看來是 jeforth.3hta 的問題,~.3nw 下 lastChild 跟 lastElementChild 是一樣的 - OK - OK js> document.body.children.outputbox.lastChild.nodeName . ===> INPUT - OK js> document.body.children.outputbox.lastElementChild.nodeName . ===> INPUT - - js> document.body.children.jeforth.children.outputbox.lastChild.nodeName . - js> document.body.children.jeforth.children.outputbox.lastChild.nodeValue . - js> document.body.children.jeforth.children.outputbox.childNodes .s - js> document.body.children.jeforth.children.outputbox.childNodes[1].nodeName . - js> document.body.children.jeforth.children.outputbox.childNodes[1].nodeValue . - - 來看看 jeforth.3hta 的 outputbox element 有哪些 members ? - js> document.body.children.jeforth.children.outputbox obj>keys . - align, noWrap, dataFld, dataFormatAs, dataSrc, currentStyle, runtimeStyle, - ... snip ... - replaceNode, - http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_node_replacechild - swapNode, clientHeight, clientLeft, clientTop, clientWidth, scrollHeight, - ... snip ... - ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE OK + js> document.body obj>keys . + bgColor, background, noWrap, onafterprint, onbeforeprint, onbeforeunload, onblur,onerror, ... snip ... + + js> document.body.children.jeforth obj>keys . + windowState,borderStyle,version,maximizeButton, ... snip ... + + js> $('outputbox') obj>keys . + length, prevObject, context, selector, jquery, ... snip ... + + js> $('#outputbox').parent() . \ 查看我寫的東西掛哪裡? + [object Object] OK + js> $('#outputbox').parent()[0] . \ 這個 element 是 jeforth + [object HTMLUnknownElement] OK + + js> $('#outputbox').parent()[0].id . \ 整個頁面都屬 jeforth element + jeforth OK + + char Hello!!! . + js> document.body.children.jeforth.children.outputbox.textContent . \ outputbox 是 name attribute + + : jeforth js> document.body.children.jeforth.children ; \ 攔腰給個名字,縮短 object chain. + jeforth js: pop().outputbox.textContent="1111" \ 真的可以! + + OK + js> $('#outputbox')[0] + js> document.body.children.jeforth.children.outputbox \ name attribute 可以這樣用,直接點。 + = . + true OK + + OK + js> $('outputbox')[0] \ 誤會了!此處的 name 不是 name='foo' 之類的 attribute 而是 tag name, like 'p' of

. + js> document.body.children.jeforth.children.outputbox + = . + false OK + + + js: $('textarea')[0].textContent=123 \ 真的在輸入區中置入了 '123' + + true OK js> $("#outputbox")[0].id . \ 這個參考法對 id 有效, id 要小寫。如下,對 name 無效。 + outputbox OK + js> $("#outputbox")[0].getAttribute("ID") . \ 這樣也可以。 + outputbox OK + + jeforth OK js> $('#outputbox').parent()[0].getAttribute("id") + js> $('#outputbox').parent()[0].id = . + true OK + + OK js> $("#outputbox")[0].name . \ name 不能用點的,只有 id 可以。 + undefined + OK js> $("#outputbox")[0].getAttribute("name") . \ 要用 getAttribute() + outputbox + OK js> $("#outputbox")[0].getAttribute("name") . + outputbox OK + js> $("#outputbox")[0].name . + undefined OK + + js> $("#outputbox")[0].name . cr \ undefined + js> $("#outputbox")[0].getAttribute("name") . cr \ outputbox + js> $("#outputbox")[0].class . cr \ undefined 看來只有 id 可以直接點 + js> $("#outputbox")[0].getAttribute("class") . cr \ outputbox + + 用 jeforth.3nw 的 F12 debugger 輕易就把這玩意兒搞懂了 + OK sdfsdfsd + OK js> document.body.children.outputbox.lastChild . ===> [object Text] + OK js> document.body.children.outputbox.lastChild.data . ===> sdfsdfsd + OK js> document.body.children.outputbox.lastChild.baseURI . ===> file:///D:/hcchen/Dropbox/learnings/github/jeforth.3nw/index.html + OK js> document.body.children.outputbox.lastChild.nodeName . ===> #text + OK js> document.body.children.outputbox.lastChild.nodeType . ===> 3 + OK js> document.body.children.outputbox.lastChild.nodeValue . ===> sdfsdfsd + + js: document.body.children.outputbox.lastChild.data="11223344" + js> document.body.children.outputbox.lastChild.data . ===> 11223344 + + 看來是 jeforth.3hta 的問題,~.3nw 下 lastChild 跟 lastElementChild 是一樣的 + OK + OK js> document.body.children.outputbox.lastChild.nodeName . ===> INPUT + OK js> document.body.children.outputbox.lastElementChild.nodeName . ===> INPUT + + js> document.body.children.jeforth.children.outputbox.lastChild.nodeName . + js> document.body.children.jeforth.children.outputbox.lastChild.nodeValue . + js> document.body.children.jeforth.children.outputbox.childNodes .s + js> document.body.children.jeforth.children.outputbox.childNodes[1].nodeName . + js> document.body.children.jeforth.children.outputbox.childNodes[1].nodeValue . + + 來看看 jeforth.3hta 的 outputbox element 有哪些 members ? + js> document.body.children.jeforth.children.outputbox obj>keys . + align, noWrap, dataFld, dataFormatAs, dataSrc, currentStyle, runtimeStyle, + ... snip ... + replaceNode, + http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_node_replacechild + swapNode, clientHeight, clientLeft, clientTop, clientWidth, scrollHeight, + ... snip ... + ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE OK [x] 亂定一堆 global variable 很令人不安,例如 kernelfso 等。 乾脆全部掛給 kvm 好過掛給 window ? - jeforth.hta 裡就要做 closure 才對。 <=== 目前已經是 jeforth.3we 裡所有 application 的慣例。 - ( ^ hcchen5600 2014/10/22 11:23:57 ) - ==> 本來在 jeforth.hta 裡的東西都是 global, 加上 closure 之後都不是了!這樣對,但如何修改? - 在 index.htm (即 jeforth.hta) 中變個 global object 出來,把所有屬 global 的東西都往裡倒。 - kvm.init() 時把 global 傳進去即可。 ====> Done!!! commit 一版。 - - [17:18:26] h.c.chen: 請教問題。jeforth 最上層是 index.html , 裡頭 script include 進 jeforth.js . - 我想把 index.html 裡的程式都 closure,以避免 global。這麼一來,要讓 jeforth.js - 看得到 index.html 定義的東西有何建議? - 我現在想的是在 index.html 裡弄一個 global object 把要用到的東西全放裡面。 - kvm.init(global) 傳過去給 jeforth.js ,這樣 ok? - [17:23:24] yap @ Forth: 建議用 browersify.js 或component.js - [17:24:02] h.c.chen: 有幾分鐘可以接電話嗎? - [17:25:39] h.c.chen: 我先看看 browserify.js 或component.js 謝謝! + jeforth.hta 裡就要做 closure 才對。 <=== 目前已經是 jeforth.3we 裡所有 application 的慣例。 + ( ^ hcchen5600 2014/10/22 11:23:57 ) + ==> 本來在 jeforth.hta 裡的東西都是 global, 加上 closure 之後都不是了!這樣對,但如何修改? + 在 index.htm (即 jeforth.hta) 中變個 global object 出來,把所有屬 global 的東西都往裡倒。 + kvm.init() 時把 global 傳進去即可。 ====> Done!!! commit 一版。 + + [17:18:26] h.c.chen: 請教問題。jeforth 最上層是 index.html , 裡頭 script include 進 jeforth.js . + 我想把 index.html 裡的程式都 closure,以避免 global。這麼一來,要讓 jeforth.js + 看得到 index.html 定義的東西有何建議? + 我現在想的是在 index.html 裡弄一個 global object 把要用到的東西全放裡面。 + kvm.init(global) 傳過去給 jeforth.js ,這樣 ok? + [17:23:24] yap @ Forth: 建議用 browersify.js 或component.js + [17:24:02] h.c.chen: 有幾分鐘可以接電話嗎? + [17:25:39] h.c.chen: 我先看看 browserify.js 或component.js 謝謝! [x] js> window obj>keys . ==> kvm,tos,pop,push,base,stackwas,htaProcess,WshShell,f,document, ... - 應該只有 kvm 其他都不要! - [x] base ==> kvm.base 才對 - [x] stackwas 要仔細檢討 - [x] tos, pop, push 改 call kvm.tos(), 等. - [x] htaProcess 改放 kvm.process, WshShell 保留在 window 裡。 - [x] f 根本是個錯誤,哪來的? ==> 用到時忘了用 var f; 先定義成 local 所造成。 - 最終,只有 kvm 與 WshShell 兩個 window global. - ==> *** hcchen5600 2014/10/22 11:11:45 Now, after jeforth.3we released with HTA, HTML, Node.js - support. The kvm object is now the only root. Different application's index.html or the likes - are to define kvm.properties and kvm.methods for the specific environment of the special - application. kvm.things are always accessable which is good when you were in F12 debugger or - in the jsc traps. + 應該只有 kvm 其他都不要! + [x] base ==> kvm.base 才對 + [x] stackwas 要仔細檢討 + [x] tos, pop, push 改 call kvm.tos(), 等. + [x] htaProcess 改放 kvm.process, WshShell 保留在 window 裡。 + [x] f 根本是個錯誤,哪來的? ==> 用到時忘了用 var f; 先定義成 local 所造成。 + 最終,只有 kvm 與 WshShell 兩個 window global. + ==> *** hcchen5600 2014/10/22 11:11:45 Now, after jeforth.3we released with HTA, HTML, Node.js + support. The kvm object is now the only root. Different application's index.html or the likes + are to define kvm.properties and kvm.methods for the specific environment of the special + application. kvm.things are always accessable which is good when you were in F12 debugger or + in the jsc traps. [x] something wrong on voc.f .... yeah, it's kernel. Well I will clarify it out. - ==> 抓 \uedit-backup\ 舊版回來就好了。我想錯了, voc.f 不可能比照 vocabulary 慣例。 + ==> 抓 \uedit-backup\ 舊版回來就好了。我想錯了, voc.f 不可能比照 vocabulary 慣例。 [x] 要不要改良 selftest.f 裡的 **** ==>judge 讓 'pass', 'failed' 自動找到對的位置顯示? [x] ." 是 compile-only 有必要嗎? wmi.f 裡用了一堆 ==> 變成 dual mode 了 [x] 拿到的 element 是 [object Text] 好像不對。 - 拿到的

element 也是 [object Text],不能用。 - ==> 原因找到了!哈哈題。 之前如果有空格就會傳回這個空格的 element 也就是 [object Text] - 這沒錯,錯在
之間不該留空格。 或者該自動把 之前的空 - 格消除! ===> 123 456 --> 123456 Bingo!!! + 拿到的
element 也是 [object Text],不能用。 + ==> 原因找到了!哈哈題。 之前如果有空格就會傳回這個空格的 element 也就是 [object Text] + 這沒錯,錯在
之間不該留空格。 或者該自動把 之前的空 + 格消除! ===> 123 456 --> 123456 Bingo!!! [x] char excel.exe kill-them 殺不掉,大小寫? ==> input must be a leagal where clause. @@ -547,77 +547,77 @@ [x] selftest.log 也不全面,只有 jeforth.f 有在 save log 應該全面都 save log. [x] Selftest 很長很長,怎麼樣知道已經做完了?應該自動 jump 到 inputbox. - js: kvm.scrollToElement($('#header')); 3000 sleep \ this doesn't work - js: kvm.scrollToElement($('#header')); 3000 freeze \ this works + js: kvm.scrollToElement($('#header')); 3000 sleep \ this doesn't work + js: kvm.scrollToElement($('#header')); 3000 freeze \ this works [x] 輸出叫做 outputbox 吧!(was outputscreen) - 輸入叫做 inputbox 吧! (was cmd) + 輸入叫做 inputbox 吧! (was cmd) [x] ... are interpret-only [x] forth macro 可以用 tib.insert 來做 <==== Yes! source-code-header is an example. [x] include 可以自動幫 ~.f 檔加上 \ --EOF-- 結尾。 So ~.f file's header can be further simplified. - 看到 \s 或 \ --EOF-- 就自動把該處當成 EOF 切掉之後的部份。 - 定義 source-code-header 為 - - ?skip2 --EOF-- \ skip it if already included - dup .( Including ) . cr char -- over over + + - js: tick('').masterMarker=tos()+"selftest--"; - also forth definitions (marker) (vocabulary) - last execute definitions - - js> tick('').masterMarker (marker) - include kernel/selftest.f - - constant source-code-header - tib.insert - ==> 一次成功! - 尾巴要自動完成。由 header 去找第一個 \\\s+--EOF-- , 後面切除,加上以下 - - js> tick('').masterMarker tib.insert - js> kvm.screenbuffer char selftest.log writeTextFile \ save selftest log file - - js> tick('').enabled [if] js> tick('').buffer tib.insert [then] - js: tick('').buffer="" \ recycle the memory - \ --EOF-- - - 試驗: - tib.slice(ntib); ntib = 0; - start-here kvm.screenbuffer.indexOf("thernet",pop())!=-1 \ true Ethernet - ("aabbcc\tddeeff\n\\--EOF-- gg\\shhii").search(/\\\s*--EOF--|\\s/) . - - var ss = "aabbcc\tddee\nff\\--EOF-- gg\\shhii"; - ss = (ss+" ").slice(0,ss.search(/\\\s*--EOF--|\\s/)); // 一開始多加一個 space 讓 search 結果 -1 時吃掉。 - . - 試驗成功,以下動作要在 include 裡做。 ss 是讀進來的整個 ~.f source code. - - ss = (ss+'x').slice(0,ss.search(/\\\s*--EOF--|\s\\s\s/)); // 一開始多加一個 'x' 讓 search 結果 -1 時吃掉。 - ss += "\\ --EOF--\n"; - - debug 的技巧 - kvm.jsc.prompt="111";eval(kvm.jsc.xt); \ jsc breakpoint - js: clipboardData.setData("text",tib.slice(ntib)) \ 利用 clipboard+notepad 來查看常內容 - - if(tos().indexOf("wmi.f")!=-1) window.xx=true; - js> window.xx [if] *debug* jjj>>> [then] + 看到 \s 或 \ --EOF-- 就自動把該處當成 EOF 切掉之後的部份。 + 定義 source-code-header 為 + + ?skip2 --EOF-- \ skip it if already included + dup .( Including ) . cr char -- over over + + + js: tick('').masterMarker=tos()+"selftest--"; + also forth definitions (marker) (vocabulary) + last execute definitions + + js> tick('').masterMarker (marker) + include kernel/selftest.f + + constant source-code-header + tib.insert + ==> 一次成功! + 尾巴要自動完成。由 header 去找第一個 \\\s+--EOF-- , 後面切除,加上以下 + + js> tick('').masterMarker tib.insert + js> kvm.screenbuffer char selftest.log writeTextFile \ save selftest log file + + js> tick('').enabled [if] js> tick('').buffer tib.insert [then] + js: tick('').buffer="" \ recycle the memory + \ --EOF-- + + 試驗: + tib.slice(ntib); ntib = 0; + start-here kvm.screenbuffer.indexOf("thernet",pop())!=-1 \ true Ethernet + ("aabbcc\tddeeff\n\\--EOF-- gg\\shhii").search(/\\\s*--EOF--|\\s/) . + + var ss = "aabbcc\tddee\nff\\--EOF-- gg\\shhii"; + ss = (ss+" ").slice(0,ss.search(/\\\s*--EOF--|\\s/)); // 一開始多加一個 space 讓 search 結果 -1 時吃掉。 + . + 試驗成功,以下動作要在 include 裡做。 ss 是讀進來的整個 ~.f source code. + + ss = (ss+'x').slice(0,ss.search(/\\\s*--EOF--|\s\\s\s/)); // 一開始多加一個 'x' 讓 search 結果 -1 時吃掉。 + ss += "\\ --EOF--\n"; + + debug 的技巧 + kvm.jsc.prompt="111";eval(kvm.jsc.xt); \ jsc breakpoint + js: clipboardData.setData("text",tib.slice(ntib)) \ 利用 clipboard+notepad 來查看常內容 + + if(tos().indexOf("wmi.f")!=-1) window.xx=true; + js> window.xx [if] *debug* jjj>>> [then] [x] writeTextFile 用來 save selftest.log 有時候會有問題,改用 writeBinaryFile 看看。。。 - ==> modify ok, [x] test my desktop at home. + ==> modify ok, [x] test my desktop at home. [x] jsc has been used in panic(). I need jsc for experiments. So, make it a command word. [X] excle.f selftest not completed yet - Including excel.f - *** excel... pass - *** excel.visible excel.invisible ... pass - *** new... pass - *** excel... pass - *** excel... pass - reDef WORKBOOK - *** get-sheet gets worksheet object ... pass - *** get-sheet gets worksheet object ... pass - *** get-cell gets cell object ... pass - *** cell@ cell! ... pass + Including excel.f + *** excel... pass + *** excel.visible excel.invisible ... pass + *** new... pass + *** excel... pass + *** excel... pass + reDef WORKBOOK + *** get-sheet gets worksheet object ... pass + *** get-sheet gets worksheet object ... pass + *** get-cell gets cell object ... pass + *** cell@ cell! ... pass [X] Bug found! selftest ***** treats any . as the end of the description! should be \.$ [x] jeforth.3hta starting greeting 看久了有一點煩,太干擾。簡化之。。。 @@ -626,119 +626,119 @@ [x] beeps when moves cmdhistory over the top or under the bottom. [x] voc.f help is very poor. Improve it. Better not to show empty - vocabularies, pattern should accept white spaces. + vocabularies, pattern should accept white spaces. [x] help shows word.comment but very poor. Use RegEx to indent comments. - js> ("aaa\nbbb\nccc").replace(/^\s*/gm,"\t") . + js> ("aaa\nbbb\nccc").replace(/^\s*/gm,"\t") . [ ] 已經開著的 excel 如何控制? - Try open some excel, try to see them then control them.... - ==> int hwnd = (int)Process.GetProcessById(excelId).MainWindowHandle http://stackoverflow.com/questions/770173/how-to-get-excel-instance-or-excel-instance-clsid-using-the-process-id - This is for .NET not JavaScript. + Try open some excel, try to see them then control them.... + ==> int hwnd = (int)Process.GetProcessById(excelId).MainWindowHandle http://stackoverflow.com/questions/770173/how-to-get-excel-instance-or-excel-instance-clsid-using-the-process-id + This is for .NET not JavaScript. [x] Tab auto-complete [ ] Tab auto-complete don't be case sensitive -[X] F2 toggle EditMode - F9 shrink input box - F10 enlarge input box - F4 copy marked text into inputbox. - - study IE9 window.getSelection() - : test - ." Get 3 selections " cr - 1000 sleep 1 . 1000 sleep 2 . 1000 sleep 3 . 1000 sleep 4 . 1000 sleep 5 . js> getSelection().anchorNode cr - 1000 sleep 1 . 1000 sleep 2 . 1000 sleep 3 . 1000 sleep 4 . 1000 sleep 5 . js> getSelection().anchorNode cr - 1000 sleep 1 . 1000 sleep 2 . 1000 sleep 3 . 1000 sleep 4 . 1000 sleep 5 . js> getSelection().anchorNode cr - ." done !!" cr - ; last execute - 發現 getSelection() 取得的 object 只存在於 selection 還在時。 - - Property Description - anchorNode Returns the element or node that contains the start of the selection. - anchorOffset Retrieves the starting position of a selection that is relative to the anchorNode. - focusNode Retrieves the element or node that contains the end of a selection. - focusOffset Retrieves the end position of a selection that is relative to the focusNode. - isCollapsed Retrieves whether a selection is collapsed or empty. - It's null when "true". - rangeCount Returns the number of ranges in a selection - It's always 1. I don't understand. - - variable selection - 1000 sleep 1 . beep - 1000 sleep 2 . beep - 1000 sleep 3 . beep - 1000 sleep 4 . beep - 1000 sleep 5 . beep cr - js> getSelection() selection ! - selection @ js> pop().anchorNode constant anchorNode - selection @ js> pop().anchorOffset constant anchorOffset - selection @ js> pop().focusNode constant focusNode - selection @ js> pop().focusOffset constant focusOffset - selection @ js> pop().isCollapsed constant isCollapsed - selection @ js> pop().rangeCount constant rangeCount -

Done!!

drop beep - - Mark 區域是 - code {F4} ( -- ) \ Copy marked string into inputbox - var selection = getSelection(); - var start, end; - if (selection.isCollapsed) return; // Nothing selected - if (selection.anchorNode==selection.focusNode) { - start = Math.min(selection.anchorOffset,selection.focusOffset); - end = Math.max(selection.anchorOffset,selection.focusOffset); - } else { - start = selection.anchorOffset; - end = selection.anchorNode.data.length; - } - var ss = selection.anchorNode.data.slice(start,end); - document.getElementById("inputbox").value += ss; - $('#inputbox').focus(); - end-code +[X] F2 toggle EditMode + F9 shrink input box + F10 enlarge input box + F4 copy marked text into inputbox. + + study IE9 window.getSelection() + : test + ." Get 3 selections " cr + 1000 sleep 1 . 1000 sleep 2 . 1000 sleep 3 . 1000 sleep 4 . 1000 sleep 5 . js> getSelection().anchorNode cr + 1000 sleep 1 . 1000 sleep 2 . 1000 sleep 3 . 1000 sleep 4 . 1000 sleep 5 . js> getSelection().anchorNode cr + 1000 sleep 1 . 1000 sleep 2 . 1000 sleep 3 . 1000 sleep 4 . 1000 sleep 5 . js> getSelection().anchorNode cr + ." done !!" cr + ; last execute + 發現 getSelection() 取得的 object 只存在於 selection 還在時。 + + Property Description + anchorNode Returns the element or node that contains the start of the selection. + anchorOffset Retrieves the starting position of a selection that is relative to the anchorNode. + focusNode Retrieves the element or node that contains the end of a selection. + focusOffset Retrieves the end position of a selection that is relative to the focusNode. + isCollapsed Retrieves whether a selection is collapsed or empty. + It's null when "true". + rangeCount Returns the number of ranges in a selection + It's always 1. I don't understand. + + variable selection + 1000 sleep 1 . beep + 1000 sleep 2 . beep + 1000 sleep 3 . beep + 1000 sleep 4 . beep + 1000 sleep 5 . beep cr + js> getSelection() selection ! + selection @ js> pop().anchorNode constant anchorNode + selection @ js> pop().anchorOffset constant anchorOffset + selection @ js> pop().focusNode constant focusNode + selection @ js> pop().focusOffset constant focusOffset + selection @ js> pop().isCollapsed constant isCollapsed + selection @ js> pop().rangeCount constant rangeCount +

Done!!

drop beep + + Mark 區域是 + code {F4} ( -- ) \ Copy marked string into inputbox + var selection = getSelection(); + var start, end; + if (selection.isCollapsed) return; // Nothing selected + if (selection.anchorNode==selection.focusNode) { + start = Math.min(selection.anchorOffset,selection.focusOffset); + end = Math.max(selection.anchorOffset,selection.focusOffset); + } else { + start = selection.anchorOffset; + end = selection.anchorNode.data.length; + } + var ss = selection.anchorNode.data.slice(start,end); + document.getElementById("inputbox").value += ss; + $('#inputbox').focus(); + end-code [x] dot . prints things, some objects are not printable that triggers an error: - Error msg: JavaScript error on word "." : Object doesn't support this property or method - 從 dot . 下手有成功,但是不完整。應該要從 print() and see() 下手才會完整。 - ===> much better now! - try : s" where name like 'chrome%'" get-them .s + Error msg: JavaScript error on word "." : Object doesn't support this property or method + 從 dot . 下手有成功,但是不完整。應該要從 print() and see() 下手才會完整。 + ===> much better now! + try : s" where name like 'chrome%'" get-them .s [x] "save" command to save definitions to jeforth.JSON to speed up the starting up time. - ==> They may be objects in dictionary, so no way!! + ==> They may be objects in dictionary, so no way!! [x] remove ^\s* from cmdhistory. [x] include , sinclude redefined in wsh.f so as to auto-search the source code file. - if forth gets the higher priority over wsh.f in vocabulary order then older definitions - will be taking the effects. The correct solution is not bringing wsh.f into kernel but - simply to use the 'definition' vocabulary command to redefine special words into the 'forth' - vocabulary. Thus even the forth word-list has higher priority than wsh.f the older - include/sinclude commands won't be unexpectedly used. - ==> Test, what happen after forget to --wsh.f-- marker? .... new words will be forgotten. + if forth gets the higher priority over wsh.f in vocabulary order then older definitions + will be taking the effects. The correct solution is not bringing wsh.f into kernel but + simply to use the 'definition' vocabulary command to redefine special words into the 'forth' + vocabulary. Thus even the forth word-list has higher priority than wsh.f the older + include/sinclude commands won't be unexpectedly used. + ==> Test, what happen after forget to --wsh.f-- marker? .... new words will be forgotten. [x] Hotkey F10 needs two press to make one effect. Try to print 'F10' at beginning of the handler - sees the same thing <==== check again. - ==> Now I am sure, root cause is the focus has gone to HTA's menu bar due to F10. - Under a condition, F10 can disable by this way ==> (https://www.evernote.com/shard/s22/sh/205fe9d0-4c7f-41db-a33a-98aacbc91a01/39cc5075538a71b51d150c24af8b9663) - , must be document.onkeydown not .onkeypress. So as to take over the control. + sees the same thing <==== check again. + ==> Now I am sure, root cause is the focus has gone to HTA's menu bar due to F10. + Under a condition, F10 can disable by this way ==> (https://www.evernote.com/shard/s22/sh/205fe9d0-4c7f-41db-a33a-98aacbc91a01/39cc5075538a71b51d150c24af8b9663) + , must be document.onkeydown not .onkeypress. So as to take over the control. [x] Hotkey handler should not be in input box. Because input box will be hide when rows <= 0 therefore - no way to get focus and then no way to get it back. + no way to get focus and then no way to get it back. [x] Source code file should not use "UTF-8 file with BOM" format, - jsc>stack[0].charCodeAt(0) ==> 22172 (number) - jsc>stack[0].charCodeAt(1) ==> 29854 (number) - As shown above, leading bytes become problem. + jsc>stack[0].charCodeAt(0) ==> 22172 (number) + jsc>stack[0].charCodeAt(1) ==> 29854 (number) + As shown above, leading bytes become problem. [x] jsc support Esc as the 'q' command equivlant. [x] see kvm.fso ==> JavaScript error on word "(see)" : Object doesn't support this property or method - ==> RI: print(tab + dictionary[i] + ...) 時,某些 object 沒有 .toString() 無法做 + operation. - ==> 應該幫所有不具 toString() method 的 object 都加上 toString()。 <=== Not allowed! - e.g. kvm.fso.FolderExists() is a method in fso. 但用 jsc 去檢查 kvm.fso.FolderExists 結果是 undefined! - 所有未知的 object 真不知道該怎麼 see ??? [x] <=== Node.js 的 console.log() 很好! + ==> RI: print(tab + dictionary[i] + ...) 時,某些 object 沒有 .toString() 無法做 + operation. + ==> 應該幫所有不具 toString() method 的 object 都加上 toString()。 <=== Not allowed! + e.g. kvm.fso.FolderExists() is a method in fso. 但用 jsc 去檢查 kvm.fso.FolderExists 結果是 undefined! + 所有未知的 object 真不知道該怎麼 see ??? [x] <=== Node.js 的 console.log() 很好! [x] Constant() 能不能也屬於 Word()? 一致,且 see() 較簡單。 ==> 不 merge, 但一併考慮。 [x] dump, see, dot, print 功能重複,疊床架屋 ==> 慢慢適應吧! [x] subFolders helps redefine sinclude and include ... failed! - ha ha bug. + ha ha bug. [x] help without pattern prints hotkey helps. @@ -751,781 +751,781 @@ [ ] Output box 2 and input box 2, dual pannel like Norton commander. [x] List elements of outputbox. - []nodes ( ele n -- array ) Beginning n nodes of the element - nodes[] ( ele n -- array ) Ending n nodes of the element + []nodes ( ele n -- array ) Beginning n nodes of the element + nodes[] ( ele n -- array ) Ending n nodes of the element [x] mimic processing.js, setup an environment. Say canvas.f, setup{} and draw{} - So that we'll be familiar with canvas programming and go on completing the clock. - Study clock.f first... Done! see p5.f, clock3.f + So that we'll be familiar with canvas programming and go on completing the clock. + Study clock.f first... Done! see p5.f, clock3.f [x] 用了那麼多 kvm.var 能不能利用 eval() & arguments.callee 來隨時增加 vm 內部的 global variable? - ==> No way. + ==> No way. [ ] {backSpace} 的 bottom up 跟 top down 程式都類似,可以再簡化。 - [x] 用來清理 outputbox 畫面,在 Node-webkit jsc 裡無效。 - 記得在以前也碰過同樣問題,原因是判斷 inputbox 是否 empty 時它並非 empty 而是有個 0x0A 留在 - 裡面。<==== 不該多個 LF,處理 inputbox 的程式有問題。不要妥協! - --> 可能是 Node-webkit 的問題 $('#inputbox').focus(); 有嫌疑 <=== 捅不出來,可能不是。 - 進 jsc 一律把 inputbox.value="" 也是簡單的辦法。 <==== 就這麼用補的治好了。 + [x] 用來清理 outputbox 畫面,在 Node-webkit jsc 裡無效。 + 記得在以前也碰過同樣問題,原因是判斷 inputbox 是否 empty 時它並非 empty 而是有個 0x0A 留在 + 裡面。<==== 不該多個 LF,處理 inputbox 的程式有問題。不要妥協! + --> 可能是 Node-webkit 的問題 $('#inputbox').focus(); 有嫌疑 <=== 捅不出來,可能不是。 + 進 jsc 一律把 inputbox.value="" 也是簡單的辦法。 <==== 就這麼用補的治好了。 [x] Now jeforth.3hta default is float instead of integer. Try input 123.456 .s and 0x7fffff .s - This is for HTML5 canvas. + This is for HTML5 canvas. [x] words and help need options, - -n for matching only name pattern, case insensitive. - -N for exactly name only, case sensitive. - -v for matching vocabulary, case insensitive. - ===> jeforth.f (words) [x] debug version, Add one more input 'option' to (words) - ===> modify voc.f to distinguish options. + -n for matching only name pattern, case insensitive. + -N for exactly name only, case sensitive. + -v for matching vocabulary, case insensitive. + ===> jeforth.f (words) [x] debug version, Add one more input 'option' to (words) + ===> modify voc.f to distinguish options. [x] Other than we need a command to generate header element. - ==> for ouputbox, for head, element append to the element - ==> done! now go back to complete the clock.f improvement. + ==> for ouputbox, for head, element append to the element + ==> done! now go back to complete the clock.f improvement. [x] Stop F2 hotkey to change the textarea size [x] canvas.f better to put the canvas below the inputbox textarea, easier to see it all the time. [x] Re-write clock2.f with an strong arm of canvas.f [x] Different textarea background color for different EditModes. Modify the style in jeforth.hta - ==> review how do I modify canvas style in canvas.f --> simply modify ele.innerHTML - ==> try to view jeforth.hta style --> id=style ok --> js> style obj>keys . ok - ==> style element is just like other elements having all those object members. - The problem is all 3 sections (body, textarea:focus, and textarea) are in the same style element. - If I only want to modify one, how to do that? - [x] Create a new style in may work. ==> No. - [x] Try modify 'style' itself. --> Bingo!! - - body { - font-family: courier new; - font-size: 20px; - padding:20px; - word-wrap:break-word; - border: 1px ridge; - background:#F0F0F0; - } - textarea { - font-family: courier new; - color:black; - font-size: 20px; - width:100%; - border: 0px solid; - background:#BBBBBB; - } - textarea:focus { - border: 0px solid; - background:#FFE0E0; Pink or #F0E0E0; Gray - } - js> style.innerHTML=pop() - [x] Try to make a new style to modify only textarea:focus --> Failed - drop - - textarea:focus { - border: 0px solid; - background:#E0F0E0; - } - js> newStyle.innerHTML=pop() - [x] A separate style in jeforth.hta for textarea:focus --> ok! + ==> review how do I modify canvas style in canvas.f --> simply modify ele.innerHTML + ==> try to view jeforth.hta style --> id=style ok --> js> style obj>keys . ok + ==> style element is just like other elements having all those object members. + The problem is all 3 sections (body, textarea:focus, and textarea) are in the same style element. + If I only want to modify one, how to do that? + [x] Create a new style in may work. ==> No. + [x] Try modify 'style' itself. --> Bingo!! + + body { + font-family: courier new; + font-size: 20px; + padding:20px; + word-wrap:break-word; + border: 1px ridge; + background:#F0F0F0; + } + textarea { + font-family: courier new; + color:black; + font-size: 20px; + width:100%; + border: 0px solid; + background:#BBBBBB; + } + textarea:focus { + border: 0px solid; + background:#FFE0E0; Pink or #F0E0E0; Gray + } + js> style.innerHTML=pop() + [x] Try to make a new style to modify only textarea:focus --> Failed + drop + + textarea:focus { + border: 0px solid; + background:#E0F0E0; + } + js> newStyle.innerHTML=pop() + [x] A separate style in jeforth.hta for textarea:focus --> ok! [x] 應該把 jeforth.3wsh jeforth.3hta jeforth.3nd jeforth.3nw jeforth.3htm 五套融合成一套,共享所有的 .f 檔。 - ==> jeforth.3we + ==> jeforth.3we [x] canvas.f works on kvm.cv is good, so we can work on many CV's. - But it needs an assignment process, instead of being the default only one. - ==> 3htm/canvas/canvas.f done + But it needs an assignment process, instead of being the default only one. + ==> 3htm/canvas/canvas.f done [ ] Reviewed Processing.js, try to go through "~\Dropbox\learnings\processing\Pomax's guide to Processing.js.pdf" - practice on jeforth.hta --> working on playground\p5.f + practice on jeforth.hta --> working on playground\p5.f [ ] html5.f does not have self-test yet. was wrong when in compiling mode, now fixed. [x] To support multiple canvas, clock2.f timeout() needs fine tune. [x] see 把 canvas object 都鑽進去印出來,太多了當掉。 - ==> js> window (see) 即可複製該問題。 - ==> Simplify function see() in jeforth.js + ==> js> window (see) 即可複製該問題。 + ==> Simplify function see() in jeforth.js [x] clock3.f seems ok, but only the last clock can run. - By my debugging logic, make a simplified case to try. - : hi me ." Hello " js> setTimeout(pop().xt,1000) . space ; last execute - Hello 141 OK Hello 142 Hello 143 Hello 144 Hello 145 \ 這個OK - : wo me ." world!" js> setTimeout(pop().xt,1000) . space ; \ 才剛定義好新的 word 不論 colon word 或 code word - world!376 world!377 world!378 world!379 world!380 . . . \ 都會變成下一個 timeout 被執行的對象! - ' wo ' hi js> pop().xt=pop().xt \ 如果以為是 xt 的問題,錯! colon word 的 xt 即使是同一個一切依然 - 連新定義出來的 code word 也會被 timeout 到,這就是線索了! - 不要懷疑 timeout 收到的 function. 成功過就對了。 奇怪的是,為何總是執行最後一個 word 的 xt ? - 直接定義一個 ' hi timeout(pop().xt,1000) 來試呀! 果然複製出問題了。 - - 結論是 colon word 的 xt 如果這樣執行 ' hi js> pop().xt() 就沒問題,因為參考到的正是 colon word object 本身無誤。 - 如果 ' hi js> pop().xt execute 這樣執行就令人困惑了。困惑不如實測證實, - code tt11 print("he he he 112233") end-code \ 故意弄一個 code word 當成 last - js> inner(this.cfa) \ 直接執行 colon word 之 xt 裡的這行 - he he he 112233 OK \ 果然就是這樣! - - 結論是 colon word 的 xt 不能用來當 call back function 用。這下問題來了,colon word 有 recentcolonword - 可以取得本身的 object 那麼 code word 呢?抄 recentcolonword 的定義即可,這表示 code word 的自身 object - 就是 this. 實驗看看: - code ttestt push(this) end-code ttestt . ==> 果然無誤 Bingo! - 進一步弄成利用 timeout 重複執行的 code word, - code rr print(Date()); setTimeout(this.xt,1000) end-code 執行後,第一個 timeout 有印出 Date() 但是 - 隨後的 setTimeout() 造成 run time error 'invalid argument'. 我怕是其中的 this 到時候變成別的東西,沒 - 有 xt 造成 error 凸顯問題反而是好事。嘗試從 JavaScript 的 recursive 裡找答案 ==> arguments.callee - code rr print(Date()); setTimeout(arguments.callee,1000) end-code ==> 徹底成功了!!! - - [x] ==> 這下子,clock3.f 的 '時鐘' 產生的 colon word 要如何包裝成 function() 來當 call back function? - ==> colon words can be executed by inner(cfa), thus - code t inner(2730);setTimeout(arguments.callee,1000) end-code last execute - can launch the clock correctly. Where 2730 is Taipei's cfa. - ==> 取得 colon word 本身的 cfa 有兩法 - 1)colon word 裡一見面 me/recentcolonword js> pop().cfa 即是 - 2)colon word 裡一見面 js> ip 2- 也是 - 前者若是由 call-back-function 透過 inner() 發動的,就會出錯!!! - [x] 實驗看看。可能 recentcolonword 要另想更好的辦法。 - ==> -1 時鐘 tokyo - ' tokyo js> pop().cfa dump - 02739: 2693 (number) - 02740: -3600000 (number) - ... snip ... - code t2 inner(2739);setTimeout(arguments.callee,1000) end-code last execute - 成功地 run 出第二個時鐘了! + By my debugging logic, make a simplified case to try. + : hi me ." Hello " js> setTimeout(pop().xt,1000) . space ; last execute + Hello 141 OK Hello 142 Hello 143 Hello 144 Hello 145 \ 這個OK + : wo me ." world!" js> setTimeout(pop().xt,1000) . space ; \ 才剛定義好新的 word 不論 colon word 或 code word + world!376 world!377 world!378 world!379 world!380 . . . \ 都會變成下一個 timeout 被執行的對象! + ' wo ' hi js> pop().xt=pop().xt \ 如果以為是 xt 的問題,錯! colon word 的 xt 即使是同一個一切依然 + 連新定義出來的 code word 也會被 timeout 到,這就是線索了! + 不要懷疑 timeout 收到的 function. 成功過就對了。 奇怪的是,為何總是執行最後一個 word 的 xt ? + 直接定義一個 ' hi timeout(pop().xt,1000) 來試呀! 果然複製出問題了。 + + 結論是 colon word 的 xt 如果這樣執行 ' hi js> pop().xt() 就沒問題,因為參考到的正是 colon word object 本身無誤。 + 如果 ' hi js> pop().xt execute 這樣執行就令人困惑了。困惑不如實測證實, + code tt11 print("he he he 112233") end-code \ 故意弄一個 code word 當成 last + js> inner(this.cfa) \ 直接執行 colon word 之 xt 裡的這行 + he he he 112233 OK \ 果然就是這樣! + + 結論是 colon word 的 xt 不能用來當 call back function 用。這下問題來了,colon word 有 recentcolonword + 可以取得本身的 object 那麼 code word 呢?抄 recentcolonword 的定義即可,這表示 code word 的自身 object + 就是 this. 實驗看看: + code ttestt push(this) end-code ttestt . ==> 果然無誤 Bingo! + 進一步弄成利用 timeout 重複執行的 code word, + code rr print(Date()); setTimeout(this.xt,1000) end-code 執行後,第一個 timeout 有印出 Date() 但是 + 隨後的 setTimeout() 造成 run time error 'invalid argument'. 我怕是其中的 this 到時候變成別的東西,沒 + 有 xt 造成 error 凸顯問題反而是好事。嘗試從 JavaScript 的 recursive 裡找答案 ==> arguments.callee + code rr print(Date()); setTimeout(arguments.callee,1000) end-code ==> 徹底成功了!!! + + [x] ==> 這下子,clock3.f 的 '時鐘' 產生的 colon word 要如何包裝成 function() 來當 call back function? + ==> colon words can be executed by inner(cfa), thus + code t inner(2730);setTimeout(arguments.callee,1000) end-code last execute + can launch the clock correctly. Where 2730 is Taipei's cfa. + ==> 取得 colon word 本身的 cfa 有兩法 + 1)colon word 裡一見面 me/recentcolonword js> pop().cfa 即是 + 2)colon word 裡一見面 js> ip 2- 也是 + 前者若是由 call-back-function 透過 inner() 發動的,就會出錯!!! + [x] 實驗看看。可能 recentcolonword 要另想更好的辦法。 + ==> -1 時鐘 tokyo + ' tokyo js> pop().cfa dump + 02739: 2693 (number) + 02740: -3600000 (number) + ... snip ... + code t2 inner(2739);setTimeout(arguments.callee,1000) end-code last execute + 成功地 run 出第二個時鐘了! [ ] The jeforth.js global variable 'context' is useless. When no vocabulary, context is 'forth'. - When with vocabulary, forth get-context command replaces the old context command. So why do we - have the 'context' command? ===> ask FigTaiwan + When with vocabulary, forth get-context command replaces the old context command. So why do we + have the 'context' command? ===> ask FigTaiwan [ ] current_word_list() defined in jeforth.js 應該是為了嫌 words[current] 有點 proprietary 而設。 - 實際上 words[current] 還是有在用,那何必有 current_word_list()? 乾脆取消。 + 實際上 words[current] 還是有在用,那何必有 current_word_list()? 乾脆取消。 [x] new Word() 馬上會把 new word 加進 wordhash{},這無可厚非沒什麼不對。萬一 colon definition 失敗 - words[current].pop() 把 last 丟掉之後,只能 rescan-word-hash 才能恢復 reDef 被蓋掉的 original. + words[current].pop() 把 last 丟掉之後,只能 rescan-word-hash 才能恢復 reDef 被蓋掉的 original. [x] 取得 colon word 本身的 cfa 有兩法 - 1)colon word 裡一見面 me/recentcolonword js> pop().cfa 即是 - 2)colon word 裡一見面 js> ip 2- 也是 - 前者若是由 call-back-function 透過 inner() 發動的,就會出錯!!! - [x] 實驗看看。可能 recentcolonword 要另想更好的辦法。==> the two statements - push(newname); execute("(create)"); - in ';' definition should be moved to ':' , so we have last() in colon definition. - To drop the last use words[current].pop() when something wrong. words[current].pop() - 把 last 丟掉之後,只能 rescan-word-hash 才能恢復 reDef 被蓋掉的 original. - --> try :: and ;; - ==> 要用 last 取得 colon word 自身時,要注意 last 必須 immediate! - 正確寫法是 :: myself [ last ] literal ;; - ==> [x] 基本上 ok 但是過不了 selftest, selftest 好耶! - 問題出在 sinclude 的定義裡會用到原來的 sinclude, 此時新定義的 sinclude 已經在 wordhash - 裡取代了,故造成無窮迴路。 - ==> 所以,一直以來 new Word() 直接把 newword 加進 wordhash 的作法有問題。要讓 ; 來做此事。 - See ebook <> @ https://www.evernote.com/shard/s22/nl/2472143/e572d6b8-8e2c-44bf-8d9b-e916ac0f9a2c - 有提到此事,果然就是用舊版 word 定義新版時、或者 recurse 時會碰到的問題。傳統 forth 用 hide - reveal 這一對開關來解決。我的 jeforth 不直接從 words[] 裡找 word 而是用 wordhash hash table, - 故控制 new word 加進 wordhash 的時機也是一樣的效果。 - ==> 改掉 Word() 不要自動加 newname 進 wordhash, 增加新 command 'reveal' 用來把 newname 加進 - wordhash. ==> done! - ==> 原來用到 recentcolonword 的地方都找出來改掉 + 1)colon word 裡一見面 me/recentcolonword js> pop().cfa 即是 + 2)colon word 裡一見面 js> ip 2- 也是 + 前者若是由 call-back-function 透過 inner() 發動的,就會出錯!!! + [x] 實驗看看。可能 recentcolonword 要另想更好的辦法。==> the two statements + push(newname); execute("(create)"); + in ';' definition should be moved to ':' , so we have last() in colon definition. + To drop the last use words[current].pop() when something wrong. words[current].pop() + 把 last 丟掉之後,只能 rescan-word-hash 才能恢復 reDef 被蓋掉的 original. + --> try :: and ;; + ==> 要用 last 取得 colon word 自身時,要注意 last 必須 immediate! + 正確寫法是 :: myself [ last ] literal ;; + ==> [x] 基本上 ok 但是過不了 selftest, selftest 好耶! + 問題出在 sinclude 的定義裡會用到原來的 sinclude, 此時新定義的 sinclude 已經在 wordhash + 裡取代了,故造成無窮迴路。 + ==> 所以,一直以來 new Word() 直接把 newword 加進 wordhash 的作法有問題。要讓 ; 來做此事。 + See ebook <> @ https://www.evernote.com/shard/s22/nl/2472143/e572d6b8-8e2c-44bf-8d9b-e916ac0f9a2c + 有提到此事,果然就是用舊版 word 定義新版時、或者 recurse 時會碰到的問題。傳統 forth 用 hide + reveal 這一對開關來解決。我的 jeforth 不直接從 words[] 裡找 word 而是用 wordhash hash table, + 故控制 new word 加進 wordhash 的時機也是一樣的效果。 + ==> 改掉 Word() 不要自動加 newname 進 wordhash, 增加新 command 'reveal' 用來把 newname 加進 + wordhash. ==> done! + ==> 原來用到 recentcolonword 的地方都找出來改掉 [x] jeforth.f has a problem "如果不 writeBinaryFile [x] 好像 wmi.f 會有 error ????" - that made me to use writeBinaryFile command which is not defined yet in jeforth.f - ==> jeforth.hta used to use fso, but fso doesn't support utf-8, ANSI only. My souce code and - actual printed strings were having utf-8. bla bla bla, that's the problem. - Fixed by using ADO that supports utf-8. + that made me to use writeBinaryFile command which is not defined yet in jeforth.f + ==> jeforth.hta used to use fso, but fso doesn't support utf-8, ANSI only. My souce code and + actual printed strings were having utf-8. bla bla bla, that's the problem. + Fixed by using ADO that supports utf-8. [x] 大目標!改寫 jsEval jsEvalNo ([x] jsEvalRaw is useless) 讓他們在 compiling mode 時直接 compile 成 - function("jsEvalNo") 或 function(jsEval;push(lastStatement))。靈感來自 p5.f 裡的 call back function. - : processing ( -- ) \ Processing main loop - [ s" push(function(){inner(" js> last().cfa + s" )})" + jsEvalNo ] literal ( -- callBackFunction ) - frameInterval [ s" push(function(){setTimeout(pop(1),pop())})" jsEvalNo , ] - frameCount 1+ to frameCount draw - ; last execute - 其中有取得 call back function 放在 TOS 的範例,以及直接 compile 一個 function 的範例。 - ==> This regEx works fine : s" aaaaa;bbbb;ccc" js> pop().match(/^(.*;)(.*)$/) . - Returns [entire string,fore part,last statement] - Note 1. when there's no ';' the result is NULL. - 2. Nothing or only \s after the last ';' the result is [entire string,entire - string w/o ending \s,NULL] 此時用 - 3. normal "aaa;bbb;ccc" - 這樣狀況有種嫌太多了。 - ==> 先把尾部的 ";\s*$" 消除。統一狀況。 - s" aaaaa;bbbb;ccc;;; " js> "\n\t\r" + js> pop().replace(/;*(\s+)$/,'') . \ the end - ==> 整合起來,最後只剩兩種狀況 - s" aaa;bbb;ccc" js> "\n\t\r" + js> pop().replace(/;*(\s+)$/,'') js> pop().match(/^(.*;)(.*)$/) . - Note 1. when there's no previous ';' the result is NULL. ==> 整行抓去用 - 2. otherwise the result is [entire string,fore part,last statement] - 這樣簡單多了。 - - : jsFunc ( "statements" -- function ) \ Compile JavaScript to a function() that returns last statement - js> pop().replace(/^\s*/,'') - js> pop().replace(/;*\s*$/,'') dup - js> pop().match(/^(.*;)(.*)$/) ?dup \ statement [entire string,fore part,last statement]|NULL - if \ statement [entire string,fore part,last statement] - nip - s" push(function(){" js> tos(1)[1] + - s" push(" + js> pop(1)[2] + s" )" + - s" })" + - jsEvalNo - else \ statement - s" push(function(){push(" swap + s" )})" + - jsEvalNo - then ; - - : jsFuncNo ( "statements" -- function ) \ Compile JavaScript to a function() - s" push(function(){" swap + s" })" + jsEvalNo ; - - [x] jsEval jsEvalNo 保留不改,新增命令 jsFunc jsFuncNo。 先完成 jsFuncNo - ( "js statements" -- function ) + function("jsEvalNo") 或 function(jsEval;push(lastStatement))。靈感來自 p5.f 裡的 call back function. + : processing ( -- ) \ Processing main loop + [ s" push(function(){inner(" js> last().cfa + s" )})" + jsEvalNo ] literal ( -- callBackFunction ) + frameInterval [ s" push(function(){setTimeout(pop(1),pop())})" jsEvalNo , ] + frameCount 1+ to frameCount draw + ; last execute + 其中有取得 call back function 放在 TOS 的範例,以及直接 compile 一個 function 的範例。 + ==> This regEx works fine : s" aaaaa;bbbb;ccc" js> pop().match(/^(.*;)(.*)$/) . + Returns [entire string,fore part,last statement] + Note 1. when there's no ';' the result is NULL. + 2. Nothing or only \s after the last ';' the result is [entire string,entire + string w/o ending \s,NULL] 此時用 + 3. normal "aaa;bbb;ccc" + 這樣狀況有種嫌太多了。 + ==> 先把尾部的 ";\s*$" 消除。統一狀況。 + s" aaaaa;bbbb;ccc;;; " js> "\n\t\r" + js> pop().replace(/;*(\s+)$/,'') . \ the end + ==> 整合起來,最後只剩兩種狀況 + s" aaa;bbb;ccc" js> "\n\t\r" + js> pop().replace(/;*(\s+)$/,'') js> pop().match(/^(.*;)(.*)$/) . + Note 1. when there's no previous ';' the result is NULL. ==> 整行抓去用 + 2. otherwise the result is [entire string,fore part,last statement] + 這樣簡單多了。 + + : jsFunc ( "statements" -- function ) \ Compile JavaScript to a function() that returns last statement + js> pop().replace(/^\s*/,'') + js> pop().replace(/;*\s*$/,'') dup + js> pop().match(/^(.*;)(.*)$/) ?dup \ statement [entire string,fore part,last statement]|NULL + if \ statement [entire string,fore part,last statement] + nip + s" push(function(){" js> tos(1)[1] + + s" push(" + js> pop(1)[2] + s" )" + + s" })" + + jsEvalNo + else \ statement + s" push(function(){push(" swap + s" )})" + + jsEvalNo + then ; + + : jsFuncNo ( "statements" -- function ) \ Compile JavaScript to a function() + s" push(function(){" swap + s" })" + jsEvalNo ; + + [x] jsEval jsEvalNo 保留不改,新增命令 jsFunc jsFuncNo。 先完成 jsFuncNo + ( "js statements" -- function ) [x] objRet in jeforth.f 還有用嗎? ==> 有用。 [ ] 當 marker 是個 vocabulary 時,順便 previous 把多出來的 forth drop 掉。 - ==> 改 voc.f (marker) 應該很簡單。Selftest 的測法可能造成問題。 - ==> 改 --filename.f-- 的定義才對。只有 --filename.f-- 這類 marker 才可以做 previous。 + ==> 改 voc.f (marker) 應該很簡單。Selftest 的測法可能造成問題。 + ==> 改 --filename.f-- 的定義才對。只有 --filename.f-- 這類 marker 才可以做 previous。 [x] merge.f 的「對話表」可以一次全部印出來。HTML 可以回頭補任意位置的內容,只要在 - 資料不全時把 [Go!] 灰掉即可。 + 資料不全時把 [Go!] 灰掉即可。 [x] Working on playground/merge2.f ==> Done!! [x] Merge.f 很好用。其他 excel 的程式也該 port 到 jeforth.3hta 來! - ==> 拆分混合個部門的總表成多個 Excel 檔。===> split.f done!! + ==> 拆分混合個部門的總表成多個 Excel 檔。===> split.f done!! [ ] Very very strange thing: - jsc>kvm.dictionary - Oooops! Object doesn't support this property or method - jsc>kvm.stack - Oooops! Object doesn't support this property or method - ===> 又是 see 的問題,嘗試顯示出來時失敗的現象。 + jsc>kvm.dictionary + Oooops! Object doesn't support this property or method + jsc>kvm.stack + Oooops! Object doesn't support this property or method + ===> 又是 see 的問題,嘗試顯示出來時失敗的現象。 -------------- jeforth for node.js console mode ---------------------- [x] jeforth.3we 就是這樣來的! - 我計畫讓 Windows 下所有的 jeforth.3xxx 都共享同樣的 source code , 如 jeforth.js, jeforth.f 等。 - node.js 版的 jeforth.js 有這行, - exports.constructor = KsanaVm; - 到時候是用 require() 讀進去的,希望 require 接受 string。我就可以用加的把這行加進去。 - ==> 爽哥的 ~\multitaskjavascripteforth-master\jeForthVM.js 似乎有解, + 我計畫讓 Windows 下所有的 jeforth.3xxx 都共享同樣的 source code , 如 jeforth.js, jeforth.f 等。 + node.js 版的 jeforth.js 有這行, + exports.constructor = KsanaVm; + 到時候是用 require() 讀進去的,希望 require 接受 string。我就可以用加的把這行加進去。 + ==> 爽哥的 ~\multitaskjavascripteforth-master\jeForthVM.js 似乎有解, - if (typeof exports==='undefined') window .jeForthVM=jeForthVM // export for web cliend APP - else exports.jeForthVM=jeForthVM // export for node.js APP + if (typeof exports==='undefined') window .jeForthVM=jeForthVM // export for web cliend APP + else exports.jeForthVM=jeForthVM // export for node.js APP - As shown above, node.js 'exports' is a system object not a 宣告指令。 + As shown above, node.js 'exports' is a system object not a 宣告指令。 [x] readTextFile is from jeforth.hta, needs to be defined in index.js [x] bye is platform dependent. Needs kvm.bye() - code bye ( ERRORLEVEL -- ) \ Exit to shell with TOS as the ERRORLEVEL. - var errorlevel = pop(); - errorlevel = typeof(errorlevel)=='number' ? errorlevel : 0; - kvm.bye(errorlevel); - end-code - jeforth.hta can return ERRORLEVEL to its caller batch program, but not DOS box. - I repeat, TOS as errorlevel only works in batch program. - This is the experiment: - ~\jeforth.3we>echo %errorlevel% - 55 /* recent errorlevel is 55 */ - ~\jeforth.3we>jeforth.hta 77 bye /* leave 77 */ - ~\jeforth.3we>echo %errorlevel% - 55 /* the errorlevel is still 55 not 77, so the above line doesn't work */ - ~\jeforth.3we>echo jeforth.hta 77 bye > 77.bat - ~\jeforth.3we>77.bat /* but it works through batch */ - ~\jeforth.3we>echo %errorlevel% - 77 + code bye ( ERRORLEVEL -- ) \ Exit to shell with TOS as the ERRORLEVEL. + var errorlevel = pop(); + errorlevel = typeof(errorlevel)=='number' ? errorlevel : 0; + kvm.bye(errorlevel); + end-code + jeforth.hta can return ERRORLEVEL to its caller batch program, but not DOS box. + I repeat, TOS as errorlevel only works in batch program. + This is the experiment: + ~\jeforth.3we>echo %errorlevel% + 55 /* recent errorlevel is 55 */ + ~\jeforth.3we>jeforth.hta 77 bye /* leave 77 */ + ~\jeforth.3we>echo %errorlevel% + 55 /* the errorlevel is still 55 not 77, so the above line doesn't work */ + ~\jeforth.3we>echo jeforth.hta 77 bye > 77.bat + ~\jeforth.3we>77.bat /* but it works through batch */ + ~\jeforth.3we>echo %errorlevel% + 77 [x] 這個要想一想。定樣在 jeforth.hta 中的 kvm 是個 global 可以反過來在 jeforth.js 裡看得見。 - 但是定義在 node.js 的 index.js 裡的 kvm, fs 等則不然。既然 kvm 跟 KsanaVm() 裡面參考自己的 - vm 是同一個,何不在 jeforth.js 裡直接就稱為 kvm?如果還是照以前稱為 vm 就得像下面這般繁複地 - 補救。 - function KsanaVm() { - var vm = this; // "this" is very confusing to me. Now I am sure 'vm' is 'kvm'. - if(typeof(kvm)=="undefined"){var kvm=vm} // kvm defined in jeforth.hta is visible but not node.js index.js - ...snip.... - 稱為 vm 目的可能是想跑 multiple VM. 這點我看是不會發生了。但讓 global 的 kvm 跟 closure 裡的 kvm - 同名,也有點令人不安。繁複就繁複吧! + 但是定義在 node.js 的 index.js 裡的 kvm, fs 等則不然。既然 kvm 跟 KsanaVm() 裡面參考自己的 + vm 是同一個,何不在 jeforth.js 裡直接就稱為 kvm?如果還是照以前稱為 vm 就得像下面這般繁複地 + 補救。 + function KsanaVm() { + var vm = this; // "this" is very confusing to me. Now I am sure 'vm' is 'kvm'. + if(typeof(kvm)=="undefined"){var kvm=vm} // kvm defined in jeforth.hta is visible but not node.js index.js + ...snip.... + 稱為 vm 目的可能是想跑 multiple VM. 這點我看是不會發生了。但讓 global 的 kvm 跟 closure 裡的 kvm + 同名,也有點令人不安。繁複就繁複吧! [x] Word.help 尾巴都有個 \r\n 要拿掉。 - OK ' + js> pop().help - OK .s - 0: + ( a b -- a+b) Add two numbers or concatenate two strings. - (string) <=== This is the clue of that there's something like \r\n at the end - > dup binary-string>array <=== defined in 80286asm.f, useful here. - OK .s - 0: + ( a b -- a+b) Add two numbers or concatenate two strings. - (string) - 1: 43,32,40,32,97,32,98,32,45,45,32,97,43,98,41,32,65,100,100,32,116,119,111,32,110,117,109,98,101,114,115,32,111, - 114,32,99,111,110,99,97,116,101,110,97,116,101,32,116,119,111,32,115,116,114,105,110,103,115,46,13 (array) - OK - ==> The ending is a \r (13) , remove it ! jeforth.js I guess. + OK ' + js> pop().help + OK .s + 0: + ( a b -- a+b) Add two numbers or concatenate two strings. + (string) <=== This is the clue of that there's something like \r\n at the end + > dup binary-string>array <=== defined in 80286asm.f, useful here. + OK .s + 0: + ( a b -- a+b) Add two numbers or concatenate two strings. + (string) + 1: 43,32,40,32,97,32,98,32,45,45,32,97,43,98,41,32,65,100,100,32,116,119,111,32,110,117,109,98,101,114,115,32,111, + 114,32,99,111,110,99,97,116,101,110,97,116,101,32,116,119,111,32,115,116,114,105,110,103,115,46,13 (array) + OK + ==> The ending is a \r (13) , remove it ! jeforth.js I guess. [x] nexttoken('RegEx string') escape string and RegEd work together can be a little strange. - Sometimes simply JS escape string works fine like : nexttoken('\r|\n') - Sometimes we need to double the back slash like : nexttoken('\\)\\)') - Because what we want from the front one is '#13','|','#10' and it works fine. - Yet we want from the rear one is literally '\)\)' which can not be - nexttoken('))') nor nexttoken('\)\)'). + Sometimes simply JS escape string works fine like : nexttoken('\r|\n') + Sometimes we need to double the back slash like : nexttoken('\\)\\)') + Because what we want from the front one is '#13','|','#10' and it works fine. + Yet we want from the rear one is literally '\)\)' which can not be + nexttoken('))') nor nexttoken('\)\)'). [ ] vb.f 有了現在的 html5.f 可以改寫得更好。 [x] 讓 include 自動找目錄,不用等到 wsh.f ==> readTextFileAuto ( "pathname" -- file ) \ Search and read - ==> Use kvm.path=[...] to specify path space and the order. + ==> Use kvm.path=[...] to specify path space and the order. [ ] Ask FigTaiwan 請教先進。 jeforth 有這個問題。 - 發現一個 jeforth 的大大大問題。 exit 用來結束一個 colon word, 但是 exit 用在 for..next 裡面時 - 就不一樣了!要先 r> drop 才行吧?! ==> Yes!!! + 發現一個 jeforth 的大大大問題。 exit 用來結束一個 colon word, 但是 exit 用在 for..next 裡面時 + 就不一樣了!要先 r> drop 才行吧?! ==> Yes!!! [x] execute ( cmd -- ... ) command 針對 cmd==string 時,要順便把前後的 \s 去掉。 [x] ~\jeforth.3hta\playground\86ef202.f compile 出來,跑不起來。要重視原因! - ==> 懷疑是用 writeTextFile 有問題,checksum 其實一樣。 - d:\hcchen\Dropbox\learnings\github\jeforth.3hta>d:\Download\BATCH\SUM.EXE eforth.com - This program was written by Eddy Chuang 1991. - -- The checksum of file:eforth.com is '20633D' on base 16 -- - d:\hcchen\Dropbox\LEARNI~1\github\JEFORT~1.3HT> - - target-space 0x100 DICSIZE array-slice - var sum=0; for( var i=0; i<12032; i++) {sum+=tos()[i]}; sum - 1: 2122557 20633dh (number) - ==> 接下來用 symdeb.exe 檢查了。。。 --> COLD1: entry should be 1097h ( "see COLD1:" command ) - but symdeb traced it's 1200h - ==> 看到原因了!本來 (create) 現在要改成 (create) reveal !!! + ==> 懷疑是用 writeTextFile 有問題,checksum 其實一樣。 + d:\hcchen\Dropbox\learnings\github\jeforth.3hta>d:\Download\BATCH\SUM.EXE eforth.com + This program was written by Eddy Chuang 1991. + -- The checksum of file:eforth.com is '20633D' on base 16 -- + d:\hcchen\Dropbox\LEARNI~1\github\JEFORT~1.3HT> + + target-space 0x100 DICSIZE array-slice + var sum=0; for( var i=0; i<12032; i++) {sum+=tos()[i]}; sum + 1: 2122557 20633dh (number) + ==> 接下來用 symdeb.exe 檢查了。。。 --> COLD1: entry should be 1097h ( "see COLD1:" command ) + but symdeb traced it's 1200h + ==> 看到原因了!本來 (create) 現在要改成 (create) reveal !!! [x] include 80286asm.f 很奇怪,新舊版會夾雜的感覺。Source code 怎麼改都無效。總是 include 到舊版的! - ==> Run jeforth.hta new session then OK. + ==> Run jeforth.hta new session then OK. [x] The method 86ef202.f writes file to eforth.com needs think twice. - Node.js and nw can use writeTextFile, but I guess not on HTA. - ==> The reason why 3nd can use it is Node.js' global class Buffer(). It handles binary data. - So this project is 3nd and 3nw dependent! + Node.js and nw can use writeTextFile, but I guess not on HTA. + ==> The reason why 3nd can use it is Node.js' global class Buffer(). It handles binary data. + So this project is 3nd and 3nw dependent! [x] Many other .f files should be moved to hta/ They are all HTA dependent. - ==> Every platform has its own kvm.path space now. + ==> Every platform has its own kvm.path space now. [x] readTextFileAuto 自帶 platform dependent 的 path array, 不好。 - 應該有個 kvm.path 在 jeforth.3nd.js jeforth.html jeforth.hta 中定義好來,這樣才對。 - ==> 3hta, 3nw, 3nd, 3wsh, 3htm 意外的好處是這些 platform folder 都是 3 開頭,自然會聚在一起。 + 應該有個 kvm.path 在 jeforth.3nd.js jeforth.html jeforth.hta 中定義好來,這樣才對。 + ==> 3hta, 3nw, 3nd, 3wsh, 3htm 意外的好處是這些 platform folder 都是 3 開頭,自然會聚在一起。 [x] include 吃掉一整行,這樣並不好。 check the reason. - ==> RI, 因為 include test.f dsdf sfds 的 test.f 當中最後一行是 \ comment , 在 tib.insert - 之後,這個 comment 延續到之後去,造成這個結果。 - ==> 只要在 sinclude 裡,去掉 --EOF-- 之後,加一個 \n 到 file 最後即可。 + ==> RI, 因為 include test.f dsdf sfds 的 test.f 當中最後一行是 \ comment , 在 tib.insert + 之後,這個 comment 延續到之後去,造成這個結果。 + ==> 只要在 sinclude 裡,去掉 --EOF-- 之後,加一個 \n 到 file 最後即可。 [ ] The leading two lines in jeforth.3nd.js, FigTaiwan acadamic topic. - var z = require('./kernel/jeforth.js') - var kvm = z.kvm; - this means: the 'kvm' virtual machine object is and will be the only one. Older code was, - var z = require('./kernel/jeforth.js') - var kvm = new z.KsanaVm() // get the jeForth VM - which means KsanaVm() constructor can be used multiple times, I don't think so. + var z = require('./kernel/jeforth.js') + var kvm = z.kvm; + this means: the 'kvm' virtual machine object is and will be the only one. Older code was, + var z = require('./kernel/jeforth.js') + var kvm = new z.KsanaVm() // get the jeForth VM + which means KsanaVm() constructor can be used multiple times, I don't think so. [x] With selftest, 3nd can't show things after jeforth.f in the main .js - ==> Not "selftest-invisible" ---> try 1/2 sort.... Wow! strange. Post jeforth.f - instructions are executed when at the first *** command in selftest ! - ==> RI, because selftest '***' command uses 'sleep' command, that's why. Wow, jeforth - is amazing. The 'sleep' command really suspend the VM. - 當初 1 sleep 是為了要讓 selftest message 一行行地印出來,不要突然一下全倒出來。 - ==> 既然有 sleep, 表示我的 jeforth 裡 fortheval(jeforth.f) 這一行必須是最後一行。 - 很重要的大發現!否則,它後面的東西會被意外執行到。 - ==> So, the first OK prompt must be printed by jeforth.f not jeforth.3nd.js + ==> Not "selftest-invisible" ---> try 1/2 sort.... Wow! strange. Post jeforth.f + instructions are executed when at the first *** command in selftest ! + ==> RI, because selftest '***' command uses 'sleep' command, that's why. Wow, jeforth + is amazing. The 'sleep' command really suspend the VM. + 當初 1 sleep 是為了要讓 selftest message 一行行地印出來,不要突然一下全倒出來。 + ==> 既然有 sleep, 表示我的 jeforth 裡 fortheval(jeforth.f) 這一行必須是最後一行。 + 很重要的大發現!否則,它後面的東西會被意外執行到。 + ==> So, the first OK prompt must be printed by jeforth.f not jeforth.3nd.js [x] jsc for 3node. ( demo to FigTaiwan ) - How to switch Node.js readline.on() ? - ==> 應該可以,但非置入式地(也必定是 blocking 的)方式,光切換 forth / jsc 也沒啥用了。 - jeforth.hta has alert(), prompt(), confirm() that are blocking functions. - ==> 利用 kvm.stdio.question() 做成 macro kvm.jsc.xt 置入式地應用可以了。但 readline - is none-blocking, 結果還是沒有用。 - ==> 找到辦法了! http://stackoverflow.com/questions/3430939/node-js-readsync-from-stdin - So now I have kvm.gets() which is a blocking function. + How to switch Node.js readline.on() ? + ==> 應該可以,但非置入式地(也必定是 blocking 的)方式,光切換 forth / jsc 也沒啥用了。 + jeforth.hta has alert(), prompt(), confirm() that are blocking functions. + ==> 利用 kvm.stdio.question() 做成 macro kvm.jsc.xt 置入式地應用可以了。但 readline + is none-blocking, 結果還是沒有用。 + ==> 找到辦法了! http://stackoverflow.com/questions/3430939/node-js-readsync-from-stdin + So now I have kvm.gets() which is a blocking function. [/] jeforth.3nd can use kvm.gets() to support multiple line input! [x] These two files, - 2014/10/15 17:01 448 jsc.hlp - 2014/10/15 17:00 733 jsc.js - are not defined in jeforth.3nd.js directly because it's not convenient to define multiple - line string, as far as I know. jsc.js will go to kvm.jsc.xt in text form so it will be a - string too. + 2014/10/15 17:01 448 jsc.hlp + 2014/10/15 17:00 733 jsc.js + are not defined in jeforth.3nd.js directly because it's not convenient to define multiple + line string, as far as I know. jsc.js will go to kvm.jsc.xt in text form so it will be a + string too. - If use ... to define kvm.jsc.help and kvm.jsc.xt then sure it's easy but - then platform.f is supposed to do that. Then kvm.jsc life cycle will be delaied. I want - jsc to be available earlier before jeforth.f. + If use ... to define kvm.jsc.help and kvm.jsc.xt then sure it's easy but + then platform.f is supposed to do that. Then kvm.jsc life cycle will be delaied. I want + jsc to be available earlier before jeforth.f. [x] Node.js 本身的 REPL 可以 'see' object 效果超好,怎麼應用? - ==> 那是 console.log() 的效果。 考慮 3nd 的 print() 裡面應該就用 console.log() - ==> 找到了!用 util.inspect() or sys.inspect() for older Node.js systems. + ==> 那是 console.log() 的效果。 考慮 3nd 的 print() 裡面應該就用 console.log() + ==> 找到了!用 util.inspect() or sys.inspect() for older Node.js systems. [ ] FigTaiwan academic topic: - o jeforth can compile all function() into dictionary, instead of Word()'s. Hard to read the dictionary - tho'. - o jeforth can drop the inner() interpreter. Use functions unnest() next() like eforth.com - instead. + o jeforth can compile all function() into dictionary, instead of Word()'s. Hard to read the dictionary + tho'. + o jeforth can drop the inner() interpreter. Use functions unnest() next() like eforth.com + instead. [x] jeforth.3nd how to clear screen? - kvm.clearScreen = function(){console.log('\033c')} - '\033c' or '\033[2J' - http://stackoverflow.com/questions/9006988/node-js-on-windows-how-to-clear-console + kvm.clearScreen = function(){console.log('\033c')} + '\033c' or '\033[2J' + http://stackoverflow.com/questions/9006988/node-js-on-windows-how-to-clear-console [x] jeforth.hta (jeforth.commandLine + " ").split(/\s+/).slice(0,-1); // An array, 這麼麻煩是為了要自動把行尾的 white spaces 去掉。 - should use .replace() <=== No! the result is expected to be an array. The above method is smart. + should use .replace() <=== No! the result is expected to be an array. The above method is smart. --------------- jeforth for HTML ---------------------- hcchen5600 2014/10/16 10:45:41 +-------------- jeforth for HTML ---------------------- hcchen5600 2014/10/16 10:45:41 [x] 一開始寫 jeforth.3htm 馬上發現當初 jeforth.3hta 的網頁結構可以更合理。 - [x] kvm.platform = "3hta"; 直接改成 ==> kvm.appname = "jeforth.3hta" 因為本來就有用到。 - [x] HTA:APPLICATION 設定裡的 ID 稱為 jeforth 並不好用。應該成為 hta 更好懂。 + [x] kvm.platform = "3hta"; 直接改成 ==> kvm.appname = "jeforth.3hta" 因為本來就有用到。 + [x] HTA:APPLICATION 設定裡的 ID 稱為 jeforth 並不好用。應該成為 hta 更好懂。 [ ] jeforth.hta 執行時的 working directory 當成 root folder. 這限制了它的用法。 - c:\>node64 c:\Users\8304018.WKSCN\Dropbox\learnings\github\jeforth.3hta\jeforth.3nd.js - fs.js:427 - return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode); - ^ - Error: ENOENT, no such file or directory 'c:\3nd\jsc.hlp' <========== Problem! - at Object.fs.openSync (fs.js:427:18) - .... snip ..... + c:\>node64 c:\Users\8304018.WKSCN\Dropbox\learnings\github\jeforth.3hta\jeforth.3nd.js + fs.js:427 + return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode); + ^ + Error: ENOENT, no such file or directory 'c:\3nd\jsc.hlp' <========== Problem! + at Object.fs.openSync (fs.js:427:18) + .... snip ..... - 我的舊 jeforth.3nw 有解決過這個問題。 + 我的舊 jeforth.3nw 有解決過這個問題。 [ ] 有兩種 run jeforth.htm 的方法,透過 web server、從 local 直接 run. 看能不能兩種都 support? - 從 local 直接 run - 要解決 read data file 的問題,已經有解了。缺點是必須人工操作。 - https://www.evernote.com/shard/s22/nl/2472143/62b103ca-c162-48eb-99b3-eeecef88e2db + 從 local 直接 run + 要解決 read data file 的問題,已經有解了。缺點是必須人工操作。 + https://www.evernote.com/shard/s22/nl/2472143/62b103ca-c162-48eb-99b3-eeecef88e2db - 透過 web server 可能最合理。可用 Python one liner 當 server 很簡單。 - set path=c:\Program Files (x86)\OpenOffice 4\program; <== python.exe v2.7.5 is there - python -m SimpleHTTPServer 8888 - "Anonymous Person" provided the iframe solution, as URL below. I tried, it works fine. - http://stackoverflow.com/questions/12760852/how-to-access-plain-text-content-retrieved-via-script-type-text-plain-src - https://www.evernote.com/shard/s22/nl/2472143/f8a48817-933d-4681-a6bb-90eb10649fcd + 透過 web server 可能最合理。可用 Python one liner 當 server 很簡單。 + set path=c:\Program Files (x86)\OpenOffice 4\program; <== python.exe v2.7.5 is there + python -m SimpleHTTPServer 8888 + "Anonymous Person" provided the iframe solution, as URL below. I tried, it works fine. + http://stackoverflow.com/questions/12760852/how-to-access-plain-text-content-retrieved-via-script-type-text-plain-src + https://www.evernote.com/shard/s22/nl/2472143/f8a48817-933d-4681-a6bb-90eb10649fcd [x] 用 iframe 的方式 include text file, extended filename can not be .f or it will be saved to - local disk directly. 暫時改名 jeforth.f==>jeforth.txt, voc.f==>voc.txt - Study ... + local disk directly. 暫時改名 jeforth.f==>jeforth.txt, voc.f==>voc.txt + Study ... - The problem is similar to this page, - "Bug 235363 - When opening a .php file inside of an " + ( -- iframe ) - js: $(tos()).load(function(){execute('stopSleeping')}) 10000 sleep - js> tos().contentDocument.body.lastChild.innerText - swap removeElement ( -- string ) - js> tos().indexOf('404')!=-1 ( -- string 404? ) - tos(1).toLowerCase().indexOf('not found')!=-1 ( -- string 404? notFound? ) - js> tos(2).length<100 ( -- string 404? notFound? length<100 ) - and and if drop "" then - ; + : readTextFile ( "pathname" -- string ) \ "" if file not found + js> pop().replace(/^\s*|\s*$/g,'') \ remove white spaces + s" " + ( -- iframe ) + js: $(tos()).load(function(){execute('stopSleeping')}) 10000 sleep + js> tos().contentDocument.body.lastChild.innerText + swap removeElement ( -- string ) + js> tos().indexOf('404')!=-1 ( -- string 404? ) + tos(1).toLowerCase().indexOf('not found')!=-1 ( -- string 404? notFound? ) + js> tos(2).length<100 ( -- string 404? notFound? length<100 ) + and and if drop "" then + ; [x] char f/mytools.f readTextFile <=== failed, still run to the old one!! - cfa, creater, don't foget to replace xt too!! + cfa, creater, don't foget to replace xt too!! [x] improve the jeforth.htm iframe ready sequence. This is the recent working version, - // System initialization - jQuery(document).ready( - // jQuery convention, learned from W3School, make sure web page is ready. - function() { - jQuery('#readtextfilef').load( - // for iframes, use load() instead of ready(). http://stackoverflow.com/questions/205087/jquery-ready-in-a-dynamically-inserted-iframe - function() { - $('#rev').html(kvm.version); // also .commandLine, .applicationName, ... - $('#location').html(window.location.toString()); // it's built-in in DOM - $('.appname').html(kvm.appname); - document.onkeydown = hotKeyHandler; // Must be using onkeydown so as to grab the control. - kvm.init(); // setup platform related I/O - var kernel = jeforthf.contentDocument.body.lastChild.innerText; - jeforthf.parentElement.removeChild(jeforthf); // suicide - // jeforthf.contentDocument.body.lastChild.innerText=""; // 否則會不斷累積!不知是前後端哪一端的問題。 - kvm.fortheval(kernel); // Run jeforth.f once. - // fortheval() 之後不能再有任何東西,否則因為有 sleep/suspend/resume 之故,會被意外執行到。 - } - ) - } - ); - 下面這個方法 Chrome 下有時候會等不到! - // System initialization - jQuery(document).ready( - // jQuery convention, learned from W3School, make sure web page is ready. - function() { - $('#rev').html(kvm.version); // also .commandLine, .applicationName, ... - $('#location').html(window.location.toString()); // it's built-in in DOM - $('.appname').html(kvm.appname); - document.onkeydown = hotKeyHandler; // Must be using onkeydown so as to grab the control. - kvm.init(); - jQuery('#jeforthf').load( // for iframes, use load() instead of ready(). http://stackoverflow.com/questions/205087/jquery-ready-in-a-dynamically-inserted-iframe - function(){jQuery('#vocf').load(function(){jQuery('#selftestf').load( - function(){jQuery('#html5f').load(function(){jQuery('#readtextfilef').load( - function() { - var jef = jeforthf.contentDocument.body.lastChild.innerText; - var voc = vocf.contentDocument.body.lastChild.innerText; - var rea = readtextfilef.contentDocument.body.lastChild.innerText; - var htm = html5f.contentDocument.body.lastChild.innerText; - jeforthf.parentElement.removeChild(jeforthf); // suicide 否則會不斷累積! - vocf.parentElement.removeChild(vocf); // suicide - readtextfilef.parentElement.removeChild(readtextfilef); // suicide - html5f.parentElement.removeChild(html5f); // suicide - kvm.fortheval(jef+voc+rea+htm); // Run jeforth.f once. - // 之後不能再有任何東西,否則因為有 sleep/suspend/resume 之故,會被意外執行到。 - } - )})})})} - ) - } - ); - 改成這樣,還是會漏接: - // System initialization - var jef,voc,rea,htm,sel; jef=voc=rea=htm=sel=""; - jQuery('#jeforthf').load( - function() { - jef = jeforthf.contentDocument.body.lastChild.innerText; - jeforthf.parentElement.removeChild(jeforthf); // suicide 否則會不斷累積! - } - ); - jQuery('#vocf').load( - function() { - voc = vocf.contentDocument.body.lastChild.innerText; - vocf.parentElement.removeChild(vocf); // suicide 否則會不斷累積! - } - ); - jQuery('#selftestf').load( - function() { - sel = selftestf.contentDocument.body.lastChild.innerText; - selftestf.parentElement.removeChild(selftestf); // suicide 否則會不斷累積! - } - ); - jQuery('#html5f').load( - function() { - htm = html5f.contentDocument.body.lastChild.innerText; - html5f.parentElement.removeChild(html5f); // suicide 否則會不斷累積! - } - ); - jQuery('#readtextfilef').load( - function() { - rea = readtextfilef.contentDocument.body.lastChild.innerText; - readtextfilef.parentElement.removeChild(readtextfilef); // suicide 否則會不斷累積! - } - ); - jQuery(document).ready( - // jQuery convention, learned from W3School, make sure web page is ready. - function() { - $('#rev').html(kvm.version); // also .commandLine, .applicationName, ... - $('#location').html(window.location.toString()); // it's built-in in DOM - $('.appname').html(kvm.appname); - document.onkeydown = hotKeyHandler; // Must be using onkeydown so as to grab the control. - kvm.init(); - (function run(){ - if(sel&&jef&&voc&&htm&&rea){ - kvm.fortheval(jef+voc+htm+rea); - // 之後放東西要很小心,因為有 sleep 之故,會被意外執行到。 - } else setTimeout(run,100); - })(); - } - ); + // System initialization + jQuery(document).ready( + // jQuery convention, learned from W3School, make sure web page is ready. + function() { + jQuery('#readtextfilef').load( + // for iframes, use load() instead of ready(). http://stackoverflow.com/questions/205087/jquery-ready-in-a-dynamically-inserted-iframe + function() { + $('#rev').html(kvm.version); // also .commandLine, .applicationName, ... + $('#location').html(window.location.toString()); // it's built-in in DOM + $('.appname').html(kvm.appname); + document.onkeydown = hotKeyHandler; // Must be using onkeydown so as to grab the control. + kvm.init(); // setup platform related I/O + var kernel = jeforthf.contentDocument.body.lastChild.innerText; + jeforthf.parentElement.removeChild(jeforthf); // suicide + // jeforthf.contentDocument.body.lastChild.innerText=""; // 否則會不斷累積!不知是前後端哪一端的問題。 + kvm.fortheval(kernel); // Run jeforth.f once. + // fortheval() 之後不能再有任何東西,否則因為有 sleep/suspend/resume 之故,會被意外執行到。 + } + ) + } + ); + 下面這個方法 Chrome 下有時候會等不到! + // System initialization + jQuery(document).ready( + // jQuery convention, learned from W3School, make sure web page is ready. + function() { + $('#rev').html(kvm.version); // also .commandLine, .applicationName, ... + $('#location').html(window.location.toString()); // it's built-in in DOM + $('.appname').html(kvm.appname); + document.onkeydown = hotKeyHandler; // Must be using onkeydown so as to grab the control. + kvm.init(); + jQuery('#jeforthf').load( // for iframes, use load() instead of ready(). http://stackoverflow.com/questions/205087/jquery-ready-in-a-dynamically-inserted-iframe + function(){jQuery('#vocf').load(function(){jQuery('#selftestf').load( + function(){jQuery('#html5f').load(function(){jQuery('#readtextfilef').load( + function() { + var jef = jeforthf.contentDocument.body.lastChild.innerText; + var voc = vocf.contentDocument.body.lastChild.innerText; + var rea = readtextfilef.contentDocument.body.lastChild.innerText; + var htm = html5f.contentDocument.body.lastChild.innerText; + jeforthf.parentElement.removeChild(jeforthf); // suicide 否則會不斷累積! + vocf.parentElement.removeChild(vocf); // suicide + readtextfilef.parentElement.removeChild(readtextfilef); // suicide + html5f.parentElement.removeChild(html5f); // suicide + kvm.fortheval(jef+voc+rea+htm); // Run jeforth.f once. + // 之後不能再有任何東西,否則因為有 sleep/suspend/resume 之故,會被意外執行到。 + } + )})})})} + ) + } + ); + 改成這樣,還是會漏接: + // System initialization + var jef,voc,rea,htm,sel; jef=voc=rea=htm=sel=""; + jQuery('#jeforthf').load( + function() { + jef = jeforthf.contentDocument.body.lastChild.innerText; + jeforthf.parentElement.removeChild(jeforthf); // suicide 否則會不斷累積! + } + ); + jQuery('#vocf').load( + function() { + voc = vocf.contentDocument.body.lastChild.innerText; + vocf.parentElement.removeChild(vocf); // suicide 否則會不斷累積! + } + ); + jQuery('#selftestf').load( + function() { + sel = selftestf.contentDocument.body.lastChild.innerText; + selftestf.parentElement.removeChild(selftestf); // suicide 否則會不斷累積! + } + ); + jQuery('#html5f').load( + function() { + htm = html5f.contentDocument.body.lastChild.innerText; + html5f.parentElement.removeChild(html5f); // suicide 否則會不斷累積! + } + ); + jQuery('#readtextfilef').load( + function() { + rea = readtextfilef.contentDocument.body.lastChild.innerText; + readtextfilef.parentElement.removeChild(readtextfilef); // suicide 否則會不斷累積! + } + ); + jQuery(document).ready( + // jQuery convention, learned from W3School, make sure web page is ready. + function() { + $('#rev').html(kvm.version); // also .commandLine, .applicationName, ... + $('#location').html(window.location.toString()); // it's built-in in DOM + $('.appname').html(kvm.appname); + document.onkeydown = hotKeyHandler; // Must be using onkeydown so as to grab the control. + kvm.init(); + (function run(){ + if(sel&&jef&&voc&&htm&&rea){ + kvm.fortheval(jef+voc+htm+rea); + // 之後放東西要很小心,因為有 sleep 之故,會被意外執行到。 + } else setTimeout(run,100); + })(); + } + ); [x] 想到一個技巧。JavaScript 常常撞上 Cannot read property 'x' of undefined ( or null ) - 造成程式中斷。這可以用 && || 的特性來避免。 - : test js> kvm.a.b . space js> kvm.a.b . space ; - 執行 test ==> P A N I C ! JavaScript error on word "test" : Cannot read property 'b' of undefined - 改成以下寫法,run TSR 不會出錯終止程式, - : TSR 100 for js> kvm.a&&kvm.a.b . space 1000 sleep next ; - 隨後再根據失敗的線索,回頭去定義 kvm.a 而非一失敗就終止程式。 - jeforth.hta 裡,讀取 iframe 很容易失敗,造成程式中止, - jef = jeforthf.contentDocument.body.lastChild.innerText; - 改成 - jef = (jef=jeforthf.contentDocument.body.lastChild||"")&&jef.innerText; - 即可。 + 造成程式中斷。這可以用 && || 的特性來避免。 + : test js> kvm.a.b . space js> kvm.a.b . space ; + 執行 test ==> P A N I C ! JavaScript error on word "test" : Cannot read property 'b' of undefined + 改成以下寫法,run TSR 不會出錯終止程式, + : TSR 100 for js> kvm.a&&kvm.a.b . space 1000 sleep next ; + 隨後再根據失敗的線索,回頭去定義 kvm.a 而非一失敗就終止程式。 + jeforth.hta 裡,讀取 iframe 很容易失敗,造成程式中止, + jef = jeforthf.contentDocument.body.lastChild.innerText; + 改成 + jef = (jef=jeforthf.contentDocument.body.lastChild||"")&&jef.innerText; + 即可。 [x] iframe is a 旁門左道。好好的去讀 server 端的資料就好了呀!怎麼做? - $.get('1.htm',"text") ==> The result is an object {readyState,getResponseHeader,getAllResponseHeaders, - setRequestHeader,overrideMimeType,statusCode,abort,state,always,then,promise,pipe,done,fail,progress, - complete,success,error,responseText,status,statusText} - ==> tos().responseText is the data - ==> tos().status ==> 200(c8h) or 404(194h) number, HTML status code - Shit! so easy. - ==> It returns the object immediately. But the obj.status will be 'undefined' at first and become - 200 or 404 later. - ==> use $.get('1.htm',callback,"text") to get called back - ==> Shit! tos().status is not always there! - Try f js> pop().state() . "resolved" or "pending" - See this experiment, - - var f = $.get("1.htm",'text'); - f - constant ff - ff js> pop().state() . space 1 sleep - ff js> pop().state() . space 1 sleep - ff js> pop().state() . space 1 sleep - ff js> pop().state() . space 1 sleep - ff js> pop().state() . space 1 sleep - ff js> pop().state() . space 1 sleep - ==> pending OK pending resolved resolved resolved resolved - [x] $.get() 有 cache 的問題,在 IE 特別嚴重,根本不去讀新版! - http://stackoverflow.com/questions/367786/prevent-caching-of-ajax-call - http://stackoverflow.com/questions/10610034/jquery-get-caching-working-too-well - I choose the global setting as my solution : $.ajaxSetup({cache:false}) - This issue is jeforth.3htm 特有的問題。改 3htm/readTextFile.f。 + $.get('1.htm',"text") ==> The result is an object {readyState,getResponseHeader,getAllResponseHeaders, + setRequestHeader,overrideMimeType,statusCode,abort,state,always,then,promise,pipe,done,fail,progress, + complete,success,error,responseText,status,statusText} + ==> tos().responseText is the data + ==> tos().status ==> 200(c8h) or 404(194h) number, HTML status code + Shit! so easy. + ==> It returns the object immediately. But the obj.status will be 'undefined' at first and become + 200 or 404 later. + ==> use $.get('1.htm',callback,"text") to get called back + ==> Shit! tos().status is not always there! + Try f js> pop().state() . "resolved" or "pending" + See this experiment, + + var f = $.get("1.htm",'text'); + f + constant ff + ff js> pop().state() . space 1 sleep + ff js> pop().state() . space 1 sleep + ff js> pop().state() . space 1 sleep + ff js> pop().state() . space 1 sleep + ff js> pop().state() . space 1 sleep + ff js> pop().state() . space 1 sleep + ==> pending OK pending resolved resolved resolved resolved + [x] $.get() 有 cache 的問題,在 IE 特別嚴重,根本不去讀新版! + http://stackoverflow.com/questions/367786/prevent-caching-of-ajax-call + http://stackoverflow.com/questions/10610034/jquery-get-caching-working-too-well + I choose the global setting as my solution : $.ajaxSetup({cache:false}) + This issue is jeforth.3htm 特有的問題。改 3htm/readTextFile.f。 [ ] The whole project's name jeforth.3WE three words engine [x] ==> Root cause 出在用 fso 讀text不support utf-8, 所以 kernel jeforth.f 是用 ANSI Big5, IE 又出問題。 - 改用 utf-8, jeforth.hta 不用 fso 改用 ADO 即可讀 utf-8, 皆大歡喜。 - jeforth.3htm has bug on IE 10.0.9. I should also try FF and Linux. - ==> IE's debugger easily finds the growing words.forth stop at 'create'. Strange thing is - tick('create') => 0 ! The last 3 words have the same problem. - roll . space compile create - the . is dispeared, and tick later three gets 0. <=== problem. - ==> first colon word : space ... ; would replace the previous word . dot. - The bug is in ; colon or ; semi-colon or reveal. - ==> IE debugger F12 is as good as Chrome's. - if(kvm.debug&&(kvm.debug=333)) debugger; - But you need to enable by click the [Start Debugging] - button. Instruction 'debugger' is also supported. --> something wrong in (create) , after - (create) words.forth is still same <--- new word 'test' created by : test [ is expected. - so everything supposed to go to last() goes to '.' !! <=== Cause !! - ==> Why current_word_list().push(new Word([newname,function(){}])) does not work? - --> current_word_list().push(123) --> OK - --> current_word_list().push(new Word(['tteesstt'])) --> OK - --> single step trace : test 112233 ; ---> OK! strange??? - --> bp in ';' --> Proved the wrong last() happened before ';' <-- shoooo! good progress. - should have created words.forth[109] for the new word : tst 112233 ; but didn't <--- problem! - --> move bp earlier to where the new word is supposed to be created. - yeah, it has happened after (create) --> move bp earlier into (create) --> very very strange - finding! see below, the entire line before bp.11 is missing!!!!! because the previous comment - is ended with chinese characters and thus it *eat* the next line, as shown below, - - newxt=function(){ /* (create) */ - if(!(newname=pop())) panic("Create what?\n", tib.length-ntib>100); - if(isReDef(newname)) print("reDef "+newname+"\n"); // ?Y??tick(newname) ?N?? current_word_list().push(new Word([newname,function(){}])); - if(kvm.debug&&(kvm.debug=11)) debugger; - last().vid = current; // vocabulary ID - last().wid = current_word_list().length-1; // word ID - last().creater = ["code"]; - last().creater.push(this.name); // this.name is "(create)" - last().help = newname + " " + packhelp(); // help messages packed - - Add space after the ending chinese character '了' can fix the problem. But I don't like it. - - My jeforth.f is ANSI Big5. I use Big5 because jeforth.hta has problem with UTF-8. - Now I guess that was "utf-8 with BOM" (3 bytes: EF BB BF) leading marks that caused - the jeforth.hta problem. <== YES!! - If use 'utf-8 without BOM' then jeforth.hta become ok with utf-8, *AND* if IE were ok <== YES!! - with utf-8 even comment with chinese character at the end of line, <=== YES!! - then let's switch to use utf-8 without BOM encoding for source code. <==== YES! - - By the way, jeforth.f encoded in utf-8 with BOM works fine on 3htm+IE and 3nd. So, only - 3hta has problem. So, Microsoft's HTA does not work with utf-8 with BOM and IE does not work - with Big5, so Microsoft engineers only work on utf-8 without BOM. - - [x] 3HTA has big problem with utf-8! clock3.f does not work because it contains Chinese - named words! Those words become garbage and are not working correctly. <==== problem!! - ==> Root cause 出在用 fso 讀text不support utf-8, 改用 ADO 即可。 - - [x] I have this line, ==> Root cause 出在用 fso 讀text不support utf-8, 改用 ADO 即可。 - - in jeforth.hta. But it shows utf-8 chineses as garbage while Big5 good. Why? <=== HTA is wrong! - The funny thing is, in jeforth.htm the situation is reversed: Big5 garbage and utf-8 OK. <== Correct. - ==> Change to something else to reverse 3htm behavior. Make sure this line - is the key. --> Failed!! modify jeforth.htm to - ==> How to use codes instead of string? So as to control characters. - - [x] I found, under DOS box running jeforth.3nd. js> "\377" . prints HTML code ÿ, a y with - strange looking <==== Surprise, ASCII 255h is blank !!!!!! - 往下看!我後來發現在 Window 8 DOS box 下 jeforth.3nd 可以同時顯示正、簡體的中文!取決於 - print() 所用的 function。 - [x] Similar situaion in jeforth.hta, after OK prompt, type char ÿ - it shows char y <== strange y. But it's "ÿ" at TOS. - - [x] jsc is now in trouble under jeforth.htm !!! - OK jsc - - J a v a S c r i p t C o n s o l e - Usage: js: kvm.jsc.prompt='messsage';eval(kvm.jsc.xt) - - ------------------- P A N I C ! ------------------------- - JavaScript error on word "jsc" : Cannot set property 'prompt' of undefined - abortexec: false - compiling: false .... snip ...... - ===> 靠!忘了 jsc in jeforth.f is for 3hta only 啦! 有替 3nd 寫好了 jsc, 3htm 還沒有啦! - [x] 嘗試把 jeforth.f 裡的 jsc 定義拉出來,各個 application 放在前面一點的地方。 - - [x] jeforth.htm selftest failed so far on IE. (Chrome ok) - ==> 因為 voc.f 又是 Big5 coded !! - ==> 改成 utf-8 .... still failed. tick ' undefined! <==== - ==> cache 搞鬼 voc.f 怎麼改都無效。 - --> char kernel/voc.f readTextFile . <==== 改過了,還是讀到舊資料。 - 竟然又真的是 cache 的問題,voc.f 讀到 cache 版了。 - --> Ctrl-F5 無效,必須把 IE 整個關掉重開才行。 - ==> 確定 voc.f 本來是 Big5 改成 utf-8 encoding 就好了。 + 改用 utf-8, jeforth.hta 不用 fso 改用 ADO 即可讀 utf-8, 皆大歡喜。 + jeforth.3htm has bug on IE 10.0.9. I should also try FF and Linux. + ==> IE's debugger easily finds the growing words.forth stop at 'create'. Strange thing is + tick('create') => 0 ! The last 3 words have the same problem. + roll . space compile create + the . is dispeared, and tick later three gets 0. <=== problem. + ==> first colon word : space ... ; would replace the previous word . dot. + The bug is in ; colon or ; semi-colon or reveal. + ==> IE debugger F12 is as good as Chrome's. + if(kvm.debug&&(kvm.debug=333)) debugger; + But you need to enable by click the [Start Debugging] + button. Instruction 'debugger' is also supported. --> something wrong in (create) , after + (create) words.forth is still same <--- new word 'test' created by : test [ is expected. + so everything supposed to go to last() goes to '.' !! <=== Cause !! + ==> Why current_word_list().push(new Word([newname,function(){}])) does not work? + --> current_word_list().push(123) --> OK + --> current_word_list().push(new Word(['tteesstt'])) --> OK + --> single step trace : test 112233 ; ---> OK! strange??? + --> bp in ';' --> Proved the wrong last() happened before ';' <-- shoooo! good progress. + should have created words.forth[109] for the new word : tst 112233 ; but didn't <--- problem! + --> move bp earlier to where the new word is supposed to be created. + yeah, it has happened after (create) --> move bp earlier into (create) --> very very strange + finding! see below, the entire line before bp.11 is missing!!!!! because the previous comment + is ended with chinese characters and thus it *eat* the next line, as shown below, + + newxt=function(){ /* (create) */ + if(!(newname=pop())) panic("Create what?\n", tib.length-ntib>100); + if(isReDef(newname)) print("reDef "+newname+"\n"); // ?Y??tick(newname) ?N?? current_word_list().push(new Word([newname,function(){}])); + if(kvm.debug&&(kvm.debug=11)) debugger; + last().vid = current; // vocabulary ID + last().wid = current_word_list().length-1; // word ID + last().creater = ["code"]; + last().creater.push(this.name); // this.name is "(create)" + last().help = newname + " " + packhelp(); // help messages packed + + Add space after the ending chinese character '了' can fix the problem. But I don't like it. + + My jeforth.f is ANSI Big5. I use Big5 because jeforth.hta has problem with UTF-8. + Now I guess that was "utf-8 with BOM" (3 bytes: EF BB BF) leading marks that caused + the jeforth.hta problem. <== YES!! + If use 'utf-8 without BOM' then jeforth.hta become ok with utf-8, *AND* if IE were ok <== YES!! + with utf-8 even comment with chinese character at the end of line, <=== YES!! + then let's switch to use utf-8 without BOM encoding for source code. <==== YES! + + By the way, jeforth.f encoded in utf-8 with BOM works fine on 3htm+IE and 3nd. So, only + 3hta has problem. So, Microsoft's HTA does not work with utf-8 with BOM and IE does not work + with Big5, so Microsoft engineers only work on utf-8 without BOM. + + [x] 3HTA has big problem with utf-8! clock3.f does not work because it contains Chinese + named words! Those words become garbage and are not working correctly. <==== problem!! + ==> Root cause 出在用 fso 讀text不support utf-8, 改用 ADO 即可。 + + [x] I have this line, ==> Root cause 出在用 fso 讀text不support utf-8, 改用 ADO 即可。 + + in jeforth.hta. But it shows utf-8 chineses as garbage while Big5 good. Why? <=== HTA is wrong! + The funny thing is, in jeforth.htm the situation is reversed: Big5 garbage and utf-8 OK. <== Correct. + ==> Change to something else to reverse 3htm behavior. Make sure this line + is the key. --> Failed!! modify jeforth.htm to + ==> How to use codes instead of string? So as to control characters. + + [x] I found, under DOS box running jeforth.3nd. js> "\377" . prints HTML code ÿ, a y with + strange looking <==== Surprise, ASCII 255h is blank !!!!!! + 往下看!我後來發現在 Window 8 DOS box 下 jeforth.3nd 可以同時顯示正、簡體的中文!取決於 + print() 所用的 function。 + [x] Similar situaion in jeforth.hta, after OK prompt, type char ÿ + it shows char y <== strange y. But it's "ÿ" at TOS. + + [x] jsc is now in trouble under jeforth.htm !!! + OK jsc + + J a v a S c r i p t C o n s o l e + Usage: js: kvm.jsc.prompt='messsage';eval(kvm.jsc.xt) + + ------------------- P A N I C ! ------------------------- + JavaScript error on word "jsc" : Cannot set property 'prompt' of undefined + abortexec: false + compiling: false .... snip ...... + ===> 靠!忘了 jsc in jeforth.f is for 3hta only 啦! 有替 3nd 寫好了 jsc, 3htm 還沒有啦! + [x] 嘗試把 jeforth.f 裡的 jsc 定義拉出來,各個 application 放在前面一點的地方。 + + [x] jeforth.htm selftest failed so far on IE. (Chrome ok) + ==> 因為 voc.f 又是 Big5 coded !! + ==> 改成 utf-8 .... still failed. tick ' undefined! <==== + ==> cache 搞鬼 voc.f 怎麼改都無效。 + --> char kernel/voc.f readTextFile . <==== 改過了,還是讀到舊資料。 + 竟然又真的是 cache 的問題,voc.f 讀到 cache 版了。 + --> Ctrl-F5 無效,必須把 IE 整個關掉重開才行。 + ==> 確定 voc.f 本來是 Big5 改成 utf-8 encoding 就好了。 [x] HTA 其實可以顯示中文。手動輸入 - : test ; /// 中文注视 - /// 繁體也型 - ,即可見得。js> tick('test').comment binary-string>array 得 - 0: 9,20013,25991,27880,35270,10,9,32321,39636,20063,22411,10 (array) - --- chinese.f ----- - : chinese ; /// 中文注视 - /// 繁體也型 - ------------------- - include chinese.f 來看,help -n chinese 顯示亂碼! - js> tick('chinese').comment binary-string>array 得 - 1: 9,37533,21084,63,30236,21051,63,10,9,34652,61247,63,37515,60929,63,10 (array) - ==> 試 char chinese.f readTextFile . 印出來就是亂碼 - ==> 查 readTextFile 的寫法。。。var data = kvm.readTextFile(pop()); - var txtFile = kvm.fso.OpenTextFile( - pathname, - 1, // ForReading - false, - 0 // TristateFalse <==== 問題出在這裡, 只能放 0, -1 並不是 utf-8 ! - ); - TristateUseDefault –2 使用系统缺省打开文件。 - TristateTrue –1 以 Unicode 格式打开文件。 UCS-2 Big Endian 或 UCS-2 Little Endian 都不是 utf-8!! - TristateFalse 0 以 ASCII 格式打开文件。 - ==> This is the answer http://stackoverflow.com/questions/13851473/read-utf-8-text-file-in-vbscript - Dim objStream, strData - Set objStream = CreateObject("ADODB.Stream") - objStream.CharSet = "utf-8" - objStream.Open - objStream.LoadFromFile("C:\Users\admin\Desktop\ArtistCG\folder.txt") - strData = objStream.ReadText() - objStream.Close - - kvm.readTextFile = function(pathname) { - var strData, objStream = CreateObject("ADODB.Stream"); - objStream.CharSet = "utf-8"; - objStream.Open(); - objStream.LoadFromFile(pathname); - strData = objStream.ReadText(); - objStream.Close(); - return(strData); - } - Bingo!!! - ==> Try how to saveToFile - The below experiment works fine, Bingo!! - new ActiveXObject("ADODB.Stream") value objStream - objStream js: pop().CharSet="utf-8" - objStream js: pop().Open(); - objStream js: pop().LoadFromFile("readme.txt") - objStream js: pop().SaveToFile("3.txt",2) \ adSaveCreateOverWrite=2, adSaveCreateNotExist=1(can't overwite) - objStream js: pop().Close() - Try to write my string, it works fine, Bingo!! - new ActiveXObject("ADODB.Stream") value objStream - objStream js: pop().CharSet="utf-8" - objStream js: pop().Open(); - objStream js: pop().WriteText("11"); \ option: adWriteChar =0(default), adWriteLine =1(\r\n) - objStream js: pop().WriteText("22"); \ option: adWriteChar =0(default), adWriteLine =1(\r\n) - objStream js: pop().SaveToFile("3.txt",2) \ adSaveCreateOverWrite=2, adSaveCreateNotExist=1(can't overwite) - objStream js: pop().Close() - [x] 改寫 kvm.writeTextFile + : test ; /// 中文注视 + /// 繁體也型 + ,即可見得。js> tick('test').comment binary-string>array 得 + 0: 9,20013,25991,27880,35270,10,9,32321,39636,20063,22411,10 (array) + --- chinese.f ----- + : chinese ; /// 中文注视 + /// 繁體也型 + ------------------- + include chinese.f 來看,help -n chinese 顯示亂碼! + js> tick('chinese').comment binary-string>array 得 + 1: 9,37533,21084,63,30236,21051,63,10,9,34652,61247,63,37515,60929,63,10 (array) + ==> 試 char chinese.f readTextFile . 印出來就是亂碼 + ==> 查 readTextFile 的寫法。。。var data = kvm.readTextFile(pop()); + var txtFile = kvm.fso.OpenTextFile( + pathname, + 1, // ForReading + false, + 0 // TristateFalse <==== 問題出在這裡, 只能放 0, -1 並不是 utf-8 ! + ); + TristateUseDefault –2 使用系统缺省打开文件。 + TristateTrue –1 以 Unicode 格式打开文件。 UCS-2 Big Endian 或 UCS-2 Little Endian 都不是 utf-8!! + TristateFalse 0 以 ASCII 格式打开文件。 + ==> This is the answer http://stackoverflow.com/questions/13851473/read-utf-8-text-file-in-vbscript + Dim objStream, strData + Set objStream = CreateObject("ADODB.Stream") + objStream.CharSet = "utf-8" + objStream.Open + objStream.LoadFromFile("C:\Users\admin\Desktop\ArtistCG\folder.txt") + strData = objStream.ReadText() + objStream.Close + + kvm.readTextFile = function(pathname) { + var strData, objStream = CreateObject("ADODB.Stream"); + objStream.CharSet = "utf-8"; + objStream.Open(); + objStream.LoadFromFile(pathname); + strData = objStream.ReadText(); + objStream.Close(); + return(strData); + } + Bingo!!! + ==> Try how to saveToFile + The below experiment works fine, Bingo!! + new ActiveXObject("ADODB.Stream") value objStream + objStream js: pop().CharSet="utf-8" + objStream js: pop().Open(); + objStream js: pop().LoadFromFile("readme.txt") + objStream js: pop().SaveToFile("3.txt",2) \ adSaveCreateOverWrite=2, adSaveCreateNotExist=1(can't overwite) + objStream js: pop().Close() + Try to write my string, it works fine, Bingo!! + new ActiveXObject("ADODB.Stream") value objStream + objStream js: pop().CharSet="utf-8" + objStream js: pop().Open(); + objStream js: pop().WriteText("11"); \ option: adWriteChar =0(default), adWriteLine =1(\r\n) + objStream js: pop().WriteText("22"); \ option: adWriteChar =0(default), adWriteLine =1(\r\n) + objStream js: pop().SaveToFile("3.txt",2) \ adSaveCreateOverWrite=2, adSaveCreateNotExist=1(can't overwite) + objStream js: pop().Close() + [x] 改寫 kvm.writeTextFile [ ] binary.f does not need VB module, use new ActiveXObject("ADODB.Stream"); [x] Make utf-8 with BOM leading EF BB BF a nop word : EFBBBF ; - ==> No need I guess. 3HTA was a bug of using the incorrect fso module which does not support utf-8. + ==> No need I guess. 3HTA was a bug of using the incorrect fso module which does not support utf-8. [x] Node.js DOS box 顯示 utf-8 可能有妙用 <=== 確認可以! - 正體中文顯示在 DOS box 之下本來是得注意 chcp 950 Code Page 的設定。而且簡中系統也不好切 chcp 950. - 跑 jeforth.3nd source code 都是 utf-8 顯示中文倒是都正常。試試簡中系統。。。。 - 这几个自是简体中文,在正体 DOS 下显示正常否? - Ha! 兩種字體同時在 Window 8 DOS box 下正常顯示! + 正體中文顯示在 DOS box 之下本來是得注意 chcp 950 Code Page 的設定。而且簡中系統也不好切 chcp 950. + 跑 jeforth.3nd source code 都是 utf-8 顯示中文倒是都正常。試試簡中系統。。。。 + 这几个自是简体中文,在正体 DOS 下显示正常否? + Ha! 兩種字體同時在 Window 8 DOS box 下正常顯示! [ ] 所以,將來弄 jeforth.3dos 時,print() 的寫法要講究,有機會也能顯示 utf-8 中文正、簡通用! @@ -1535,211 +1535,211 @@ [ ] improve html5.f self-test, was too rough for such an important module. [x] 在 include source.f 裡面 skip 到 --EOF-- 的方法: - js> confirm("要執行 canvas.f self-test 嗎?") [if] [else] - push("--E"+"OF--");execute("word"); // 如果不用 JavaScript code, 到這裡檔尾的 "--EOF--" 將成為下一個指令! - pop();execute("BL");execute("word");pop(); - execute("--canvas.f--selftest--") - [then] + js> confirm("要執行 canvas.f self-test 嗎?") [if] [else] + push("--E"+"OF--");execute("word"); // 如果不用 JavaScript code, 到這裡檔尾的 "--EOF--" 將成為下一個指令! + pop();execute("BL");execute("word");pop(); + execute("--canvas.f--selftest--") + [then] [x] jeforth.3we has released to FigTaiwan google groups last night. hcchen5600 2014/10/22 11:06:14 - ==> start to port jeforth.3nw to under jeforth.3we + ==> start to port jeforth.3nw to under jeforth.3we [x] hcchen5600 2014/10/22 11:01:47 porting to jeforth.3we, modify jeforth.3we/3nw/index.html to - obey jeforth.3we conventions. - o first of all, jeforth.3we/3nw/index.html - js> window obj>keys . \ ==> 果然有 ... Box2D,Vector,Vector_a2j_Number, ... + c:\Users\8304018.WKSCN\Dropbox\learnings\github\jeforth.3we\js\box2dweb\Box2dWeb-2.1.a.3.min.js + + js> window obj>keys . \ ==> 果然有 ... Box2D,Vector,Vector_a2j_Number, ... [x] 在 jeforth.3we 中操作 object 以 solar-system.f 為典範,有了突破。 - 1、透過 istar 讓 property 既是 forth 的 global 又可以 access 各自的 object instance 不亂。 - 2、Function Overloading 在 to 命令上的嘗試,成功。 See solar-system.f + 1、透過 istar 讓 property 既是 forth 的 global 又可以 access 各自的 object instance 不亂。 + 2、Function Overloading 在 to 命令上的嘗試,成功。 See solar-system.f [x] jeforth.js 要再簡化,只留必要的東西。所以 help 相關的都要移除。 ( ) \ 可以改良,在 TIB 中回朔到 - 同一行中有 last().name 就知道自己是 stack diagram 以及 help message, 故不必放在 kernel 裡也可以 - 做得到。 - 錯!能移出來早就移出來了。為了 code word 也能有 help message 只好繼續保留。 + 同一行中有 last().name 就知道自己是 stack diagram 以及 help message, 故不必放在 kernel 裡也可以 + 做得到。 + 錯!能移出來早就移出來了。為了 code word 也能有 help message 只好繼續保留。 [x] I need a new js function : previoustoken() for 'rewind' to idiot-proof there's a nap in front of it. -[x] ("h" + " aa bb cc dd " + " ").split(/\s+/).slice(0,-1) // An array, 這麼麻煩是為了要自動把行尾的 white spaces 去掉。 - ("h" + " aa bb cc dd " + " t").split(/\s+/).slice(0,-1) - split the TIB at ntib , the previous is just used, the next is what 'word' will return. - so the previous returns an array of tokens - : -word ( -- token[] ) \ Get used tokens in the TIB. - var a=('h '+tib.substr(0,ntib)+' t').split(/\s+/); // 加上 dummy 頭尾再 split 以統一所有狀況。 - a.pop(); a.shift(); /* 丟掉 dummy 頭尾巴 */ a ; +[x] ("h" + " aa bb cc dd " + " ").split(/\s+/).slice(0,-1) // An array, 這麼麻煩是為了要自動把行尾的 white spaces 去掉。 + ("h" + " aa bb cc dd " + " t").split(/\s+/).slice(0,-1) + split the TIB at ntib , the previous is just used, the next is what 'word' will return. + so the previous returns an array of tokens + : -word ( -- token[] ) \ Get used tokens in the TIB. + var a=('h '+tib.substr(0,ntib)+' t').split(/\s+/); // 加上 dummy 頭尾再 split 以統一所有狀況。 + a.pop(); a.shift(); /* 丟掉 dummy 頭尾巴 */ a ; [x] need a jeforth new word to launch multiple TIB tasks - s' ." * " 100 nap rewind' js: fortheval(pop()) - s' ." $ " 150 nap rewind' js: fortheval(pop()) - ==> ." * " 100 nap rewind ." $ " 100 nap rewind + s' ." * " 100 nap rewind' js: fortheval(pop()) + s' ." $ " 150 nap rewind' js: fortheval(pop()) + ==> ." * " 100 nap rewind ." $ " 100 nap rewind [x] jeforth.3htm press {backSpace} become changing the web page to previous. Avoid that! - hcchen5600 2015/04/03 21:47:24 Done! + hcchen5600 2015/04/03 21:47:24 Done! [x] pull down menu for command history and words auto completion - See jQuery 'Popup selections - Tryit Editor v2.3' @ http://www.w3schools.com/jquerymobile/tryit.asp?filename=tryjqmob_forms_select_popup - - + See jQuery 'Popup selections - Tryit Editor v2.3' @ http://www.w3schools.com/jquerymobile/tryit.asp?filename=tryjqmob_forms_select_popup + + [x] 用 jeforth.hta 來管理 github - 先複習怎樣由 jeforth.hta 來下 dos box command . . . - 1. use Github for Windows to open the dos shell through the [setting] button at the upper right corner. - 2. title demo <-- change the dos box title - 3. WshShell.AppActivate "demo" \ activate the dos box - WshShell.SendKeys "dir{enter}" - - js> clipboardData.getData("text") ?dup not [if] "" [then] \ SAVE-restore. Clipboard can be null, so be careful. - js: clipboardData.setData("text","1+2=*3=") - WshShell.SendKeys "^c" 100 sleep \ Ctrl-c - WshShell.SendKeys "%{F4}" 100 sleep \ Alt-f4 - js> clipboardData.getData("text") - js: clipboardData.setData("text",pop(1)) \ save-RESTORE - 9 = ==>judge [if] ['ActiveXObject','WshShell'] all-pass [then] - WshShell.SendKeys "%" \ Release Alt key, some how other wise it got locked. - - \ 改用 clipboard 已經成功,不怕中文輸入模式。以下留作紀念。 - \ js: document.body.style.imeMode='disabled'; \ [x] 懸案,想要避免中文輸入法干擾,無效! - \ WshShell.SendKeys "1{+}" 100 sleep \ Pad plus - \ js: document.body.style.imeMode='auto'; - + 先複習怎樣由 jeforth.hta 來下 dos box command . . . + 1. use Github for Windows to open the dos shell through the [setting] button at the upper right corner. + 2. title demo <-- change the dos box title + 3. WshShell.AppActivate "demo" \ activate the dos box + WshShell.SendKeys "dir{enter}" + + js> clipboardData.getData("text") ?dup not [if] "" [then] \ SAVE-restore. Clipboard can be null, so be careful. + js: clipboardData.setData("text","1+2=*3=") + WshShell.SendKeys "^c" 100 sleep \ Ctrl-c + WshShell.SendKeys "%{F4}" 100 sleep \ Alt-f4 + js> clipboardData.getData("text") + js: clipboardData.setData("text",pop(1)) \ save-RESTORE + 9 = ==>judge [if] ['ActiveXObject','WshShell'] all-pass [then] + WshShell.SendKeys "%" \ Release Alt key, some how other wise it got locked. + + \ 改用 clipboard 已經成功,不怕中文輸入模式。以下留作紀念。 + \ js: document.body.style.imeMode='disabled'; \ [x] 懸案,想要避免中文輸入法干擾,無效! + \ WshShell.SendKeys "1{+}" 100 sleep \ Pad plus + \ js: document.body.style.imeMode='auto'; + [x] jsc interface changed, see hta's guit.f - 1. jump2endofinptbox.click() every time. - 2. remove the jsc> prompt in the confirm box. + 1. jump2endofinptbox.click() every time. + 2. remove the jsc> prompt in the confirm box. [x] words and help to support a new switch "-V vocabulary-name" to show only the specified vocabulary - words or help -V- to disable + words or help -V- to disable [x] 為了 forthtranspiler 自稱 vm 怕混淆 jeforth.3we 還是自稱 kvm 好了。 [x] 成功了, forthtranspiler 可以直接在 jeforth.3we 底下加掛! - - - ==> 把唯一的 console.log 改成 print 即可。 + + + ==> 把唯一的 console.log 改成 print 即可。 [/] HTML5 textarea (inputbox) 有 autocomplete, autofocus(對咱無效) 等功能! @@ -3198,48 +3198,48 @@ [ ] 現在有了 er 不妨在 outputbox 設定上限,超過就把最上面得 text br 刪掉一部分,免得太長 browser 受不了。 [ ] 爽哥遇到兩個問題 1)jeforth.3nd.bat 路徑沒改,run 不起來。 2)jeforth.3hta 因為 Same origin policy - run 不起來。為了降低 user 遇到挫折的機會,[ ] 要防呆。為了要幫助 user 抓出問題,或當場有事做可以幫忙抓 - 問題,[ ] 要提供 safe mode。 + run 不起來。為了降低 user 遇到挫折的機會,[ ] 要防呆。為了要幫助 user 抓出問題,或當場有事做可以幫忙抓 + 問題,[ ] 要提供 safe mode。 [ ] 最精簡的 jsforth.js 包含的 words 只有 - code end-code 如何使用 wordhash words dictionary ip stack - rstack tos pop push tip ntip overhauling protocal 共筆機制 版本週期 - jsforth.f - inner loop - outer loop - word + code end-code 如何使用 wordhash words dictionary ip stack + rstack tos pop push tip ntip overhauling protocal 共筆機制 版本週期 + jsforth.f + inner loop + outer loop + word [ ] 爽哥的 https://github.com/samsuanchen/multitaskjavascripteforth 應該盡量多引用。先看他的 inner loop [ ] 仿 jsForth 把 print() 改成 printLine() printChar() 或 sprint() 避開與 window.print() 相撞的機會。 [ ] function dictcompile(n), function compilecode(word) 這兩個在 jeforth.js 裡的 function 很累贅。改 - 成 comma() 一個就好了。原 compilecode(word) 用 comma(tick('wordName')) 就可以了,不必多一個 function() + 成 comma() 一個就好了。原 compilecode(word) 用 comma(tick('wordName')) 就可以了,不必多一個 function() [ ] 利用 solar-system.f 開發出來的方法來管理 canvas 也可以有多個 canvas。或者用個 icanvas 來指定某一個 - ,因此有修改到 icanvas 的人都得 save-restore icanvas。 - 如果規定 value cv 當做默認的 canvas 就不必用 kvm.cv 了,但這樣會使 canvas.f 經常因為 cv 是 undefined - 而出錯。 + ,因此有修改到 icanvas 的人都得 save-restore icanvas。 + 如果規定 value cv 當做默認的 canvas 就不必用 kvm.cv 了,但這樣會使 canvas.f 經常因為 cv 是 undefined + 而出錯。 [x] jeforth.3we README.md 改良 [ ] How to play with arrow.js - 1. add three lines only to arrow.js - push(world); // [ ] + 1. add three lines only to arrow.js + push(world); // [ ] [x] sync words -V vocabulary-name and help -V vocabulary-name also -V- - 改寫,合併、簡化 + 改寫,合併、簡化 [x] echo command line 要先 cr 一下,除非沒有東西。 - [x]index.htm [x]index.html [x]jeforth.hta [ ]jeforth.3nd.js + [x]index.htm [x]index.html [x]jeforth.hta [ ]jeforth.3nd.js [x] alias' help should show the correct word name [x] Tab change to 4 spaces - [x]jeforth.hta [x]index.html [x]jeforth.3nw.html + [x]jeforth.hta [x]index.html [x]jeforth.3nw.html [x] key doesn't work when in EditMode !!! Bug. - ==> EditMode 當中 enter 不適合用來跳進 inputbox, 會嚴重干擾 editing。 - 但是有 Esc, Tab, F4 等替代辦法。 + ==> EditMode 當中 enter 不適合用來跳進 inputbox, 會嚴重干擾 editing。 + 但是有 Esc, Tab, F4 等替代辦法。 [x] Tab-autocomplete don't let it return 'undefind' @@ -3248,2796 +3248,2794 @@ [ ] Separate git.f and shell.f [ ] inputbox 之前放個 prompt 很重要 - [ ]3hta, [ ]3htm, [ ]3nw + [ ]3hta, [ ]3htm, [ ]3nw [ ] 把文章都整理進 jeforth.3we/Wiki - o jeforth for WSH 也可以拿來玩 tiny forth / tiny assembly-disassembly + o jeforth for WSH 也可以拿來玩 tiny forth / tiny assembly-disassembly [x] 改成 up/down 不要直接 recall command line history ,只有 Ctrl-up/Ctrl-down do that。 [ ] Sam Suan Chen's definition is interesting. code function x() { .... } end-code defines - vm.x() function. I wish this is the way to add variables and functions into KVM. But, don't know - if it's a good idea. + vm.x() function. I wish this is the way to add variables and functions into KVM. But, don't know + if it's a good idea. [x] 比較 jeforth.3we 與 。。。 的速度 - : speed-test 0 swap for 1+ next ; - // ( count -- sount ) 1 + 1 + ... count times - code precise-time function(){dStk.push((new Date()).getTime())} end-code + : speed-test 0 swap for 1+ next ; + // ( count -- sount ) 1 + 1 + ... count times + code precise-time function(){dStk.push((new Date()).getTime())} end-code [ ] hcchen5600 2015/05/17 07:15:30 - 改用 project-k 的 jeforth.js 有幾個問題, - [ ] 原來的 forth vocabulary 改成 root 大地震! - [ ] kvm 不要動或也改名。 + 改用 project-k 的 jeforth.js 有幾個問題, + [ ] 原來的 forth vocabulary 改成 root 大地震! + [ ] kvm 不要動或也改名。 [ ] Branch project-k 來改吧! [ ] Working on Dropbox\Stock2015.xls need to automation - Excel data from Fubon e01 is already dynamic <-------- Bingo! everything rely on it. - [ ] Then I'd like to add stock to the excel file with formula that gets the data dynamically. - [ ] Then I'd like to read data from Web page directly http://www.yuanta.com.tw/pages/content/Frame.aspx?Node=47f739da-b7c5-4d16-accc-7175d8dcf583 - to update and check new info. - [/] I have opened many excel file, use "list-processes" or "see-process" can see - how many excel process are running. There can be many excel processes. - Use "list-workbooks" command can list all excel files under the application - object. 想要 study "how to get Application object using process id" and "How - To Get Excel Object From Process?", "how to get excel object through processID - through javascript", "Attaching to Running Instance of Office Application" - 還是放棄了。 - [x] 最簡單的方法是,透過 jeforth.3we 把 excel run 起來,然後用 excel 去 open 要 - 工作的 excel files。讓 jeforth.3we 透過選單來指定哪個 file 是哪個 file。 - [x] 用 notepad++ 把 "2062橋椿" --> "2062 橋椿": - Replace "(\d)(\D)" to "\1 \2" - ==> 用不著。 money.f 寫好了,自動轉換 formula 而已。搭配元大的除息表看,漏的、新的 - 很清楚。 - 這張表從 http://www.yuanta.com.tw/pages/content/Frame.aspx?Node=47f739da-b7c5-4d16-accc-7175d8dcf583 copy 來的 + Excel data from Fubon e01 is already dynamic <-------- Bingo! everything rely on it. + [ ] Then I'd like to add stock to the excel file with formula that gets the data dynamically. + [ ] Then I'd like to read data from Web page directly http://www.yuanta.com.tw/pages/content/Frame.aspx?Node=47f739da-b7c5-4d16-accc-7175d8dcf583 + to update and check new info. + [/] I have opened many excel file, use "list-processes" or "see-process" can see + how many excel process are running. There can be many excel processes. + Use "list-workbooks" command can list all excel files under the application + object. 想要 study "how to get Application object using process id" and "How + To Get Excel Object From Process?", "how to get excel object through processID + through javascript", "Attaching to Running Instance of Office Application" + 還是放棄了。 + [x] 最簡單的方法是,透過 jeforth.3we 把 excel run 起來,然後用 excel 去 open 要 + 工作的 excel files。讓 jeforth.3we 透過選單來指定哪個 file 是哪個 file。 + [x] 用 notepad++ 把 "2062橋椿" --> "2062 橋椿": + Replace "(\d)(\D)" to "\1 \2" + ==> 用不著。 money.f 寫好了,自動轉換 formula 而已。搭配元大的除息表看,漏的、新的 + 很清楚。 + 這張表從 http://www.yuanta.com.tw/pages/content/Frame.aspx?Node=47f739da-b7c5-4d16-accc-7175d8dcf583 copy 來的 [ ] 改用 project-k 的 kernel 有幾個問題要討論。 - 1. Virtual machine 的 instance 之命名 - 2. Virtual machine 裡的 with(){} default name space. - 3. global variable 要不要加 _ prefix? 避免撞名。或者用一個 function 來管理 新增、刪除? + 1. Virtual machine 的 instance 之命名 + 2. Virtual machine 裡的 with(){} default name space. + 3. global variable 要不要加 _ prefix? 避免撞名。或者用一個 function 來管理 新增、刪除? [ ] 研究 3hta 的 localStorage 看能不能用來存 excel 的 application object (或 workbook object 也可以) - ==> js> window.localStorage \ ==> undefined (undefined) - ==> HTA 只 support 到 IE7 幹! 沒有 localStorage。 - http://note.youdao.com/share/?id=a3be4afcc542a1f5d106528f1f3ae5ab&type=note - ==> 嘗試用 excel 的一格來存放 myWorkbook object 也不行。 - activeCell :: value=g.myWorkbook ==> -- P A N I C ! -- JavaScript error : Expected ';' + ==> js> window.localStorage \ ==> undefined (undefined) + ==> HTA 只 support 到 IE7 幹! 沒有 localStorage。 + http://note.youdao.com/share/?id=a3be4afcc542a1f5d106528f1f3ae5ab&type=note + ==> 嘗試用 excel 的一格來存放 myWorkbook object 也不行。 + activeCell :: value=g.myWorkbook ==> -- P A N I C ! -- JavaScript error : Expected ';' [ ] WSH 的 sendkeys 不太靈光,對 excel、有道云笔记,都無效。 - char 有道云笔记 activate - js: clipboardData.setData("text","abc") - char ^v{TAB} sendkeys - [ ] 有空用 excel 的 sendkeys 試試。 + char 有道云笔记 activate + js: clipboardData.setData("text","abc") + char ^v{TAB} sendkeys + [ ] 有空用 excel 的 sendkeys 試試。 [ ] 使用 jQuery 的結果在 Win7 之下跑不起來了。因為 jQuery + JScript + HTA 版本的關係。 - ==> 首先要把 jQuery(document).ready() 改成用 document.onload = function(){} 或者 - 用 更簡單。 - ==> 在舊的 jeforth.3hta 上改了一半,可以不靠 jQuery 跑起來了。--> 把現在的 3we commit 起來,開 - 始直接在上面修改。 - --> 靠!當前的 3we 是 [namespace-test +1 ~8 -1 !] branch,忘了本來是在幹嘛了! 還改了一堆 - excel 的東西。先用 GitHub for Windows 瞧瞧. . . . 可以合併回 marker so just do it . . . - --> git merge namespace-test ... 成功! 平生第一次做 merge。 - --> 現在回到 master 了, - [x] Microsoft JScript runtime error: 'keyCode' is null or not an object - --> Windows 7, Top on JScript v5.8.16385 而且是 IE8 結果他的 document.onkeydown 收到的不是 - handler(e) 而是 handler(void)! keyCode 要另外從 event.keyCode 取得. - --> 所以網友建議的 pattern 是: - function alertKeycode(e) { - e = (e) ? e : event; - var keycode = (e.keyCode) ? e.keyCode : (e.which) ? e.which : false; - alert(keycode) - } - => OK! - [ ] Win7 的 IE 是 IE8 而 HTA 裡的這的一行設定: - - 顯得令人擔憂。 - [x] 當初用 jquery 的原因是它的 .append("test string or HTML tag") 很好用,而我當時也搞不懂 - .appendChild(obj) 裡的 obj 怎麼來。其實很簡單: - outputbox.appendChild(document.createTextNode("string")) - 這樣就可以了: - var aa = (kvm.plain(ss)+'\n').split('\n').slice(0,-1); // [aaa,bbb,] - for(i=0; i 都靠 jQuery 才好做。所以還是在 html5.f 裡把 jquery 給抓進來了。 - [ ] 目前的 cr 好像不 work? - [ ] HTML 一類的 greeting 上有 Program path file:///C:/.../jeforth.3we/jeforth.hta#endofinputbox - 尾巴上的 #endofinputbox 應該想辦法把它拿掉。 - - [ ] 想通了 jQuery 還是要把它 include 進來。適當時機是 html5.f, Win7 經過 windows upgrade 之後 - JScript 也到了 v11 了, Winxp 放棄或晚點再看看。 - - [x] Try AutoItX3 - push(new ActiveXObject("AutoItX3.Control")) constant au3 // ( -- AutoItX3 ) Get AutoItX3 object - au3 :: run("notepad.exe") - ==> Bingo!! - [ ] So, let's go for the autoit.f - - [x] https://msdn.microsoft.com/en-us/library/office/gg251785(v=office.15).aspx - If the pathname argument is omitted, GetObject returns a currently active object of the specified type. - If no object of the specified type exists, an error occurs. <== 這就是 jeforth.3hta 裡 excel.f 該用的辦 - 法了! 先用 see-excel 查看有幾個 excel 在 running? 如果是一個就用它, 如果超過一個就警告, 如果沒有就開一個。 - Set xl=GetObject(,"excel.application"):kvm.push(xl) - it works!! - ==> 終於解決 multiple Excel.Application object 的問題了! - [ ] ?abort" error message " 能不能弄成 dual state 通用? - - [ ] 開始研究透過 AutoIt 抓網頁 data - 研究 ie.au3 很可能跟 excel 依樣發現又是 GetObject() 就能解決? - --> 果然發現 IE Window Object, _IEAttach()'s return value. - --> 原來他是透過 shell.application access windows object, 其實 windows 就是 IE 的 tab 頁面。 - [ ] shell.application 應改簡化成 shell.app 類似 excel.app - https://msdn.microsoft.com/en-us/library/windows/desktop/bb774063(v=vs.85).aspx - shell.application :> windows() constant ShellWindows // ( -- obj ) shell.application windows object - /// ShellWindows object https://msdn.microsoft.com/en-us/library/windows/desktop/bb773974(v=vs.85).aspx - ShellWindows :> count \ ==> 3 (number) 根本就是看 IE 開了幾個 tab 亦即 windows。 - ShellWindows :> item(0) \ ==> Windows Internet Explorer (object) https://msdn.microsoft.com/library/aa752084(v=vs.85).aspx - ShellWindows :> item(3) \ ==> null (null) 超過了就變成 null。 - ShellWindows :> item(0) :> LocationName \ ==> 星巴克华东 (string) Bingo!!! 真的碰到了! - ShellWindows :> item(0) :> LoCaTiOnUrL \ ==> http://www.president-starbucks.com.cn/index.html (string) - ShellWindows :> item(0) :> application \ ==> Windows Internet Explorer (object) 就是 item(0) 自己。 - [x] 其實 IE object 也可以這樣直接取得: - Set IE = CreateObject("InternetExplorer.Application"):kvm.push(IE) constant IE // ( -- obj ) Internet Explorer object - 然後透過 IE :> parent 應該也是回到 ShellWindows --> [ ] try try see .... 非也, 這個 IE.parent 還是它 - 自己。 - [x] 同上,改用 GetObject 看看, - Set ie = GetObject(,"InternetExplorer.Application"):kvm.push(ie) constant ie // ( -- obj ) Internet Explorer object - --> VBscript error : ActiveX component can't create object: 'GetObject' - --> 這是因為 IE 應該是個 single-instance object - [ ] 同上,改用 GetObject 的另一方式看看, - Set ie = GetObject("","InternetExplorer.Application"):kvm.push(ie) constant ie // ( -- obj ) Internet Explorer object - --> 成功了! 但它的 parent 還是自己。 - --> 每多開一個 tab 用 s" where name = 'iexplore.exe'" see-process . 來看就會多一個 process. - [x] 被 stop 停掉的 TIB 應該馬上 stop=false 以便只 stop 本 . - --> 改了 outer() 若無誤,記得連 project-k 也要修正。 - --> 錯! stop 必須 stop 全部工作。後續還有工作的情形用 ?rewind。 - [x] Need a ?rewind command - - [x] Have many bugs now. On excel.f and on ie.f/money.f. This bug happens on S7 when starting - ieforth.3we. First time said there are multiple excel and stoped including excel. So I close - visible excel workbooks. F5 reload and the below error happened. Retry can't fix it. Close - jeforth.3we and run again, still same problem. - ------------------- P A N I C ! ------------------------- - VBscript error : ActiveX component can't create object: 'GetObject' - stop: false - compiling: false - stack.length: 0 - rstack.length: 1 - ip: 1286 - ntib: 279 - tib.length: 65609 - tib: (,"excel.application"):kvm.push(xl)
- [else] char Excel.Application ActiveXObject [then] to (excel.app) - ==> I guess this is again the "single-instance object" issue ... - ==> Bingo!! 不要用 ActiveXObject(), 用 CreateObject() or GetObject()。 - 而且 IE and Excel 都是 "single-instance object" 只要看到有多個 application object - 就可以當作是問題。 - - [ ] ie.f ok now, money.f 需要改寫 with new knowledge of ie.f. - [x] 如何取得 the active IE window? ==> 讓 user 自己從 list-ie-winsows 裡選。 + ==> 首先要把 jQuery(document).ready() 改成用 document.onload = function(){} 或者 + 用 更簡單。 + ==> 在舊的 jeforth.3hta 上改了一半,可以不靠 jQuery 跑起來了。--> 把現在的 3we commit 起來,開 + 始直接在上面修改。 + --> 靠!當前的 3we 是 [namespace-test +1 ~8 -1 !] branch,忘了本來是在幹嘛了! 還改了一堆 + excel 的東西。先用 GitHub for Windows 瞧瞧. . . . 可以合併回 marker so just do it . . . + --> git merge namespace-test ... 成功! 平生第一次做 merge。 + --> 現在回到 master 了, + [x] Microsoft JScript runtime error: 'keyCode' is null or not an object + --> Windows 7, Top on JScript v5.8.16385 而且是 IE8 結果他的 document.onkeydown 收到的不是 + handler(e) 而是 handler(void)! keyCode 要另外從 event.keyCode 取得. + --> 所以網友建議的 pattern 是: + function alertKeycode(e) { + e = (e) ? e : event; + var keycode = (e.keyCode) ? e.keyCode : (e.which) ? e.which : false; + alert(keycode) + } + => OK! + [ ] Win7 的 IE 是 IE8 而 HTA 裡的這的一行設定: + + 顯得令人擔憂。 + [x] 當初用 jquery 的原因是它的 .append("test string or HTML tag") 很好用,而我當時也搞不懂 + .appendChild(obj) 裡的 obj 怎麼來。其實很簡單: + outputbox.appendChild(document.createTextNode("string")) + 這樣就可以了: + var aa = (kvm.plain(ss)+'\n').split('\n').slice(0,-1); // [aaa,bbb,] + for(i=0; i 都靠 jQuery 才好做。所以還是在 html5.f 裡把 jquery 給抓進來了。 + [ ] 目前的 cr 好像不 work? + [ ] HTML 一類的 greeting 上有 Program path file:///C:/.../jeforth.3we/jeforth.hta#endofinputbox + 尾巴上的 #endofinputbox 應該想辦法把它拿掉。 + + [ ] 想通了 jQuery 還是要把它 include 進來。適當時機是 html5.f, Win7 經過 windows upgrade 之後 + JScript 也到了 v11 了, Winxp 放棄或晚點再看看。 + + [x] Try AutoItX3 + push(new ActiveXObject("AutoItX3.Control")) constant au3 // ( -- AutoItX3 ) Get AutoItX3 object + au3 :: run("notepad.exe") + ==> Bingo!! + [ ] So, let's go for the autoit.f + + [x] https://msdn.microsoft.com/en-us/library/office/gg251785(v=office.15).aspx + If the pathname argument is omitted, GetObject returns a currently active object of the specified type. + If no object of the specified type exists, an error occurs. <== 這就是 jeforth.3hta 裡 excel.f 該用的辦 + 法了! 先用 see-excel 查看有幾個 excel 在 running? 如果是一個就用它, 如果超過一個就警告, 如果沒有就開一個。 + Set xl=GetObject(,"excel.application"):kvm.push(xl) + it works!! + ==> 終於解決 multiple Excel.Application object 的問題了! + [ ] ?abort" error message " 能不能弄成 dual state 通用? + + [ ] 開始研究透過 AutoIt 抓網頁 data + 研究 ie.au3 很可能跟 excel 依樣發現又是 GetObject() 就能解決? + --> 果然發現 IE Window Object, _IEAttach()'s return value. + --> 原來他是透過 shell.application access windows object, 其實 windows 就是 IE 的 tab 頁面。 + [ ] shell.application 應改簡化成 shell.app 類似 excel.app + https://msdn.microsoft.com/en-us/library/windows/desktop/bb774063(v=vs.85).aspx + shell.application :> windows() constant ShellWindows // ( -- obj ) shell.application windows object + /// ShellWindows object https://msdn.microsoft.com/en-us/library/windows/desktop/bb773974(v=vs.85).aspx + ShellWindows :> count \ ==> 3 (number) 根本就是看 IE 開了幾個 tab 亦即 windows。 + ShellWindows :> item(0) \ ==> Windows Internet Explorer (object) https://msdn.microsoft.com/library/aa752084(v=vs.85).aspx + ShellWindows :> item(3) \ ==> null (null) 超過了就變成 null。 + ShellWindows :> item(0) :> LocationName \ ==> 星巴克华东 (string) Bingo!!! 真的碰到了! + ShellWindows :> item(0) :> LoCaTiOnUrL \ ==> http://www.president-starbucks.com.cn/index.html (string) + ShellWindows :> item(0) :> application \ ==> Windows Internet Explorer (object) 就是 item(0) 自己。 + [x] 其實 IE object 也可以這樣直接取得: + Set IE = CreateObject("InternetExplorer.Application"):kvm.push(IE) constant IE // ( -- obj ) Internet Explorer object + 然後透過 IE :> parent 應該也是回到 ShellWindows --> [ ] try try see .... 非也, 這個 IE.parent 還是它 + 自己。 + [x] 同上,改用 GetObject 看看, + Set ie = GetObject(,"InternetExplorer.Application"):kvm.push(ie) constant ie // ( -- obj ) Internet Explorer object + --> VBscript error : ActiveX component can't create object: 'GetObject' + --> 這是因為 IE 應該是個 single-instance object + [ ] 同上,改用 GetObject 的另一方式看看, + Set ie = GetObject("","InternetExplorer.Application"):kvm.push(ie) constant ie // ( -- obj ) Internet Explorer object + --> 成功了! 但它的 parent 還是自己。 + --> 每多開一個 tab 用 s" where name = 'iexplore.exe'" see-process . 來看就會多一個 process. + [x] 被 stop 停掉的 TIB 應該馬上 stop=false 以便只 stop 本 . + --> 改了 outer() 若無誤,記得連 project-k 也要修正。 + --> 錯! stop 必須 stop 全部工作。後續還有工作的情形用 ?rewind。 + [x] Need a ?rewind command + + [x] Have many bugs now. On excel.f and on ie.f/money.f. This bug happens on S7 when starting + ieforth.3we. First time said there are multiple excel and stoped including excel. So I close + visible excel workbooks. F5 reload and the below error happened. Retry can't fix it. Close + jeforth.3we and run again, still same problem. + ------------------- P A N I C ! ------------------------- + VBscript error : ActiveX component can't create object: 'GetObject' + stop: false + compiling: false + stack.length: 0 + rstack.length: 1 + ip: 1286 + ntib: 279 + tib.length: 65609 + tib: (,"excel.application"):kvm.push(xl)
+ [else] char Excel.Application ActiveXObject [then] to (excel.app) + ==> I guess this is again the "single-instance object" issue ... + ==> Bingo!! 不要用 ActiveXObject(), 用 CreateObject() or GetObject()。 + 而且 IE and Excel 都是 "single-instance object" 只要看到有多個 application object + 就可以當作是問題。 + + [ ] ie.f ok now, money.f 需要改寫 with new knowledge of ie.f. + [x] 如何取得 the active IE window? ==> 讓 user 自己從 list-ie-winsows 裡選。 [ ] 如何 用 jquery 去 query 用 ie.f attach 到的 web pabe? [ ] 改 hotkey.au3, 增加功能每周三中午前把 router 切好位置。 [ ] ie(i) 的 alias ie 有問題, run 不起來。 - ieWindow 也一樣問題。 + ieWindow 也一樣問題。 [x] JavaScript "Table to JSON" http://lightswitch05.github.io/table-to-json/ - works fine. - See YNote "Js Tutorial - Table to JSON _table_to_JSON_" + works fine. + See YNote "Js Tutorial - Table to JSON _table_to_JSON_" [x] 希望能把整個網頁都抓進來 jquery 搜尋/控制 其中的東西 - http://stackoverflow.com/questions/18145273/how-to-load-an-external-webpage-into-a-div-of-a-html-page -
- - -
- 真的可以 open 小網頁! -
- - -
+ http://stackoverflow.com/questions/18145273/how-to-load-an-external-webpage-into-a-div-of-a-html-page +
+ + +
+ 真的可以 open 小網頁! +
+ + +
[x] My Asus desktop rolled back to IE8 意外發現 (er) was not defined well. - ==> fixed. 分辨 HTML Tag 要用 ce@ :> nodeName 不是用 '[object Text]' 不可靠。 - 其實當時我就覺得用 elementObject.toString()=='[object Text]' 有點太過神奇。 + ==> fixed. 分辨 HTML Tag 要用 ce@ :> nodeName 不是用 '[object Text]' 不可靠。 + 其實當時我就覺得用 elementObject.toString()=='[object Text]' 有點太過神奇。 [x] autoit.f 不必寫甚麼在包裝過一層的命令, 給 au3 的使用例子就好了。 - 直接查 autoitx.hlp 看其他命令。多半是 keyboard / mouse 的命令。 + 直接查 autoitx.hlp 看其他命令。多半是 keyboard / mouse 的命令。 [ ] ie.f 裡 ready not-busy 常常等很久, 有時 readyStatus 卡在 1 不變 4, 配合收 event 可能較好。 [x] hcchen5600 2015/06/29 14:08:57 - 想用 jQuery 去 access jeforth 去 attach 的 IE object 網頁, 成功! 太棒了! - Fortunately the $() function has a second argument, the context, that has to be used here, like: - $('p', $(ht).context) ==> 去 study 這個 2nd argument 的玄機。 - -- - jQuery 2nd argument, see http://api.jquery.com/jQuery/ Categories: Core - jQuery 有很多種形式, jQuery("selector") 形式是原型 jQuery( selector [, context ] ) - 的簡略式, jQuery(element) 也很常用。鑽進 IE 去控制網頁用的是有 2nd argument - context object 的形式。 其中 context 實例 ShellWindows.item(theIE).document 即是。 - jQuery 的各種形式, - 1, jQuery(selector [,context]) - 2, jQuery(element) - 3, jQuery(elementArray) - 4, jQuery(object) - 5, jQuery(selection) <--- 猜想是第一式的結果 - 6, jQuery() - 7, jQuery( html [, ownerDocument ] ) - 8, jQuery( html, attributes ) - 9, jQuery( callback ) - -- - document js> $('div',pop()) 在 S7 會跑出 : JavaScript error : Permission denied - 可能又是 same origin policy issue。靠,這要怎麼避免? 關鍵是, 拿得到 IE document 可 - 讀是應該的, 要可寫才有得談 Same origin policy 算不算是個問題。 - ==> Surprise! 可以修改 Yahoo.com 在本地 DOH7 網頁上的內容。然後又發 - 現 document js> $("div",pop()) 也可以! 只是換了一部電腦而已。 - > document :> links[0].outerHTML="

hiiiii!!

" - > document :> links[1].outerHTML="

Loooooo!!

" - > document js> $("div",pop()) - OK - > .s - 3:

hi!!

(string) - 4:

Loooooo!!

(string) - 5: [object Object] (object) - ==> 回頭查 S7 上失敗時的網頁是 WKS eform http://wkseform.wistron.com/P00/FM_MyPage.aspx - --> 看能不能改 local 網頁? --> 也可以。 - --> 再試一遍 document js> $("div",pop()) 還是一樣 JavaScript error : Permission denied - --> 試別的網頁 --> 果然就好了! 原來是需要登入的網頁, jQuery 進去亂鑽,當然要 Permission denied - shit! 虛驚一場。 + 想用 jQuery 去 access jeforth 去 attach 的 IE object 網頁, 成功! 太棒了! + Fortunately the $() function has a second argument, the context, that has to be used here, like: + $('p', $(ht).context) ==> 去 study 這個 2nd argument 的玄機。 + -- + jQuery 2nd argument, see http://api.jquery.com/jQuery/ Categories: Core + jQuery 有很多種形式, jQuery("selector") 形式是原型 jQuery( selector [, context ] ) + 的簡略式, jQuery(element) 也很常用。鑽進 IE 去控制網頁用的是有 2nd argument + context object 的形式。 其中 context 實例 ShellWindows.item(theIE).document 即是。 + jQuery 的各種形式, + 1, jQuery(selector [,context]) + 2, jQuery(element) + 3, jQuery(elementArray) + 4, jQuery(object) + 5, jQuery(selection) <--- 猜想是第一式的結果 + 6, jQuery() + 7, jQuery( html [, ownerDocument ] ) + 8, jQuery( html, attributes ) + 9, jQuery( callback ) + -- + document js> $('div',pop()) 在 S7 會跑出 : JavaScript error : Permission denied + 可能又是 same origin policy issue。靠,這要怎麼避免? 關鍵是, 拿得到 IE document 可 + 讀是應該的, 要可寫才有得談 Same origin policy 算不算是個問題。 + ==> Surprise! 可以修改 Yahoo.com 在本地 DOH7 網頁上的內容。然後又發 + 現 document js> $("div",pop()) 也可以! 只是換了一部電腦而已。 + > document :> links[0].outerHTML="

hiiiii!!

" + > document :> links[1].outerHTML="

Loooooo!!

" + > document js> $("div",pop()) + OK + > .s + 3:

hi!!

(string) + 4:

Loooooo!!

(string) + 5: [object Object] (object) + ==> 回頭查 S7 上失敗時的網頁是 WKS eform http://wkseform.wistron.com/P00/FM_MyPage.aspx + --> 看能不能改 local 網頁? --> 也可以。 + --> 再試一遍 document js> $("div",pop()) 還是一樣 JavaScript error : Permission denied + --> 試別的網頁 --> 果然就好了! 原來是需要登入的網頁, jQuery 進去亂鑽,當然要 Permission denied + shit! 虛驚一場。 [x] jQuery 鑽進去了, 我在期待甚麼? 如果是個 iframe 則手動用 element.f 的 ce 也甚麼都看不到。 - 希望 jQuery 能有所不同。因為 F12 debugger 可以看得進去。 - ==> 真的成功了! - fubon js> $("iframe",g.fubon).length \ ==> 1 - fubon js> $("iframe",g.fubon)[0] obj>keys . \ ==> 有 src - fubon js> $("iframe",g.fubon)[0].src . \ ==> http://fubon-ebrokerdj.fbs.com.tw/SmartNavi3.asp?A=$^$^B$^BA$^BA]DJHTM&B=1 OK ^1 - ==> id=SysJustIFRAMEDIV 是用 Chrome F12 進去查出來的, document :> getElementById() 找得到嗎? - --> document :> getElementById("SysJustIFRAMEDIV") \ ==> null (null) - ==> 用 jQuery 看看 js> $("#SysJustIFRAMEDIV",g.fubon).length . \ ==> 0 - 也是沒找到, 改找所有的 table 看看。 - --> js> $("table",g.fubon).length . \ ==> 0 - 我可能是給錯參數了, 絕對有 table 的, 但指定 fubon 之下, 沒有, 很自然。用 jQuery 也是這個邏輯。 - [x] iframe 只有一個, 又有 src, 直接 browse ==> 可以。 + 希望 jQuery 能有所不同。因為 F12 debugger 可以看得進去。 + ==> 真的成功了! + fubon js> $("iframe",g.fubon).length \ ==> 1 + fubon js> $("iframe",g.fubon)[0] obj>keys . \ ==> 有 src + fubon js> $("iframe",g.fubon)[0].src . \ ==> http://fubon-ebrokerdj.fbs.com.tw/SmartNavi3.asp?A=$^$^B$^BA$^BA]DJHTM&B=1 OK ^1 + ==> id=SysJustIFRAMEDIV 是用 Chrome F12 進去查出來的, document :> getElementById() 找得到嗎? + --> document :> getElementById("SysJustIFRAMEDIV") \ ==> null (null) + ==> 用 jQuery 看看 js> $("#SysJustIFRAMEDIV",g.fubon).length . \ ==> 0 + 也是沒找到, 改找所有的 table 看看。 + --> js> $("table",g.fubon).length . \ ==> 0 + 我可能是給錯參數了, 絕對有 table 的, 但指定 fubon 之下, 沒有, 很自然。用 jQuery 也是這個邏輯。 + [x] iframe 只有一個, 又有 src, 直接 browse ==> 可以。 [/] hcchen5600 2015/06/29 15:38:58 - 以上 Fubon 這個 iframe 頁面 ^1 沒有 倒有 竟然可用 .body 來 access: - > document :> body . \ ==> [object HTMLFrameSetElement] OK - ==> 這是常識! http://www.cnblogs.com/yinluhui0229/archive/2011/04/27/2030822.html - YoudaoNote "frame,iframe,frameset用法和区别" - 每個 frame 都有自己的 ... document。 + 以上 Fubon 這個 iframe 頁面 ^1 沒有 倒有 竟然可用 .body 來 access: + > document :> body . \ ==> [object HTMLFrameSetElement] OK + ==> 這是常識! http://www.cnblogs.com/yinluhui0229/archive/2011/04/27/2030822.html + YoudaoNote "frame,iframe,frameset用法和区别" + 每個 frame 都有自己的 ... document。 [/] frame (等於是另一個網頁) 要怎麼 access - --> document :> getElementsByTagName("frame").length . \ ==> 3 OK the ^1 fubon page - --> document :> getElementsByTagName("frame")[2] obj>keys . \ ==> 列出 members - 有 getElementsBy TagName,ClassName 但是沒有 ById 想想好像也有道理。 - --> 想把 frame 顯示在 jeforth.3we outputbox 可能做不到: - cls document :> getElementsByTagName("frame")[0].outerHTML . - \ ==> OK - --> 看進去的入口猜是 contentDocument - document :> getElementsByTagName("frame")[2].contentDocument . \ ==> [object Document] 對了! - --> 試幾下就發現輸入股號的 frame 是 1 號, - document :> getElementsByTagName("frame")[1].contentDocument.getElementsByTagName("input").length . \ ==> 2 - document :> getElementsByTagName("frame")[1].contentDocument.getElementsByTagName("input") value inputs - inputs :> [0].outerHTML \ ==> - inputs :> [1].outerHTML \ ==> - --> inputs :: [1].value=5490 --> 成功! - 對應的 button 是下一格 裡的 裏頭有 onclick。如何定位到這個 image 方法很多。 - 取 inputs :: [1] 的 siblings 找到 TagName = img 的就是了。 - --> inputs :> [1].nextElementSibling \ ==> null OK 此法不通,要看它的結構,隔一個 就不行了。 - --> 在該 table 裡找 TagName = img - inputs :> [1].parentElement . \ ==> [object HTMLTableDataCellElement] - inputs :> [1].parentElement.parentElement . \ ==> [object HTMLTableRowElement] - inputs :> [1].parentElement.parentElement.getElementsByTagName("img").length . \ ==> 2 OK 成功! - --> 改用該 frame 的 document 來找 TagName = img: - document :> getElementsByTagName("frame")[1].contentDocument constant theFrame or SysJustHead, name of the frame. - theFrame :> getElementsByTagName("img").length \ ==> 5 (number) - theFrame :> getElementsByTagName("img")[0].getAttribute("src") \ ==> /images/TransDot.gif (string) - theFrame :> getElementsByTagName("img")[1].getAttribute("src") \ ==> /images/TransDot.gif (string) - theFrame :> getElementsByTagName("img")[2].getAttribute("src") \ ==> /images/TransDot.gif (string) - theFrame :> getElementsByTagName("img")[3].getAttribute("src") \ ==> /images/btn_ok.gif (string) - theFrame :> getElementsByTagName("img")[4].getAttribute("src") \ ==> /images/TransDot.gif (string) - --> theFrame :> getElementsByTagName("img")[3].click() 成功! 網頁開始 load 5490 了。 - --> 其實這些 frame 都是有 name 的 - ==> 這個是輸入股號的 frame: - document :> getElementsByName("SysJustHead").length \ ==> 1 OK - document :> getElementsByName("SysJustHead")[0].getAttribute("name") \ ==> SysJustHead (string) OK - ==> 這個是 SysJustBody 左右兩半的部分. - document :> getElementsByName("SysJustBody").length \ ==> 1 (number) OK - document :> getElementsByName("SysJustBody")[0].getAttribute("name") \ ==> SysJustBody (string) OK - ==> 所有要 click 的 link 都在裡面 - document :> getElementsByName("SysJustBody")[0] constant SysJustBody - SysJustBody :> contentDocument list-links - 0 所屬產業 11 補充揭露事項 22 產銷組合 33 資產負債季表 - ... snip ... - --> SysJustBody :> contentDocument.links[17].click() 成功! - --> 17 經營績效 的 table id oMainTable 裏頭還有 select 在 tr id=oScrollHead 裡。 + --> document :> getElementsByTagName("frame").length . \ ==> 3 OK the ^1 fubon page + --> document :> getElementsByTagName("frame")[2] obj>keys . \ ==> 列出 members + 有 getElementsBy TagName,ClassName 但是沒有 ById 想想好像也有道理。 + --> 想把 frame 顯示在 jeforth.3we outputbox 可能做不到: + cls document :> getElementsByTagName("frame")[0].outerHTML . + \ ==> OK + --> 看進去的入口猜是 contentDocument + document :> getElementsByTagName("frame")[2].contentDocument . \ ==> [object Document] 對了! + --> 試幾下就發現輸入股號的 frame 是 1 號, + document :> getElementsByTagName("frame")[1].contentDocument.getElementsByTagName("input").length . \ ==> 2 + document :> getElementsByTagName("frame")[1].contentDocument.getElementsByTagName("input") value inputs + inputs :> [0].outerHTML \ ==> + inputs :> [1].outerHTML \ ==> + --> inputs :: [1].value=5490 --> 成功! + 對應的 button 是下一格 裡的 裏頭有 onclick。如何定位到這個 image 方法很多。 + 取 inputs :: [1] 的 siblings 找到 TagName = img 的就是了。 + --> inputs :> [1].nextElementSibling \ ==> null OK 此法不通,要看它的結構,隔一個 就不行了。 + --> 在該 table 裡找 TagName = img + inputs :> [1].parentElement . \ ==> [object HTMLTableDataCellElement] + inputs :> [1].parentElement.parentElement . \ ==> [object HTMLTableRowElement] + inputs :> [1].parentElement.parentElement.getElementsByTagName("img").length . \ ==> 2 OK 成功! + --> 改用該 frame 的 document 來找 TagName = img: + document :> getElementsByTagName("frame")[1].contentDocument constant theFrame or SysJustHead, name of the frame. + theFrame :> getElementsByTagName("img").length \ ==> 5 (number) + theFrame :> getElementsByTagName("img")[0].getAttribute("src") \ ==> /images/TransDot.gif (string) + theFrame :> getElementsByTagName("img")[1].getAttribute("src") \ ==> /images/TransDot.gif (string) + theFrame :> getElementsByTagName("img")[2].getAttribute("src") \ ==> /images/TransDot.gif (string) + theFrame :> getElementsByTagName("img")[3].getAttribute("src") \ ==> /images/btn_ok.gif (string) + theFrame :> getElementsByTagName("img")[4].getAttribute("src") \ ==> /images/TransDot.gif (string) + --> theFrame :> getElementsByTagName("img")[3].click() 成功! 網頁開始 load 5490 了。 + --> 其實這些 frame 都是有 name 的 + ==> 這個是輸入股號的 frame: + document :> getElementsByName("SysJustHead").length \ ==> 1 OK + document :> getElementsByName("SysJustHead")[0].getAttribute("name") \ ==> SysJustHead (string) OK + ==> 這個是 SysJustBody 左右兩半的部分. + document :> getElementsByName("SysJustBody").length \ ==> 1 (number) OK + document :> getElementsByName("SysJustBody")[0].getAttribute("name") \ ==> SysJustBody (string) OK + ==> 所有要 click 的 link 都在裡面 + document :> getElementsByName("SysJustBody")[0] constant SysJustBody + SysJustBody :> contentDocument list-links + 0 所屬產業 11 補充揭露事項 22 產銷組合 33 資產負債季表 + ... snip ... + --> SysJustBody :> contentDocument.links[17].click() 成功! + --> 17 經營績效 的 table id oMainTable 裏頭還有 select 在 tr id=oScrollHead 裡。 [/] Win7, jeforth.3we inputbox 怪怪的, back-space 倒不回去。 [/] Win7, jeforth.3we Alt-Up 之後, 上下鍵一跳兩行! - ==> We don't support Windows 7 now. + ==> We don't support Windows 7 now. [x] excel.f or work.f 寫個 query 命令來查部門詳情。 ==> see-departments 1s1k [x] Excel 的時間 相容於 vb> CDate("2015/1/1 1:23:45") 與 JavaScript 的時間不相容。 [x] 大驚奇! excel time 值屬 (Date) type 其 boolean 有可能是 false !! - See work.f hcchen5600 2015/07/15 15:49:42 + See work.f hcchen5600 2015/07/15 15:49:42 [x] jeforth.3we element.f or ie.f hover mouse cursor on the page turns objects with red frame - line. So I can copy its outer or inner HTML to jeforth.hta outputbox and then use element.f - to trim them up. - ===> moved to ie.f + line. So I can copy its outer or inner HTML to jeforth.hta outputbox and then use element.f + to trim them up. + ===> moved to ie.f [x] 用部門代碼查表 departmentcode.json - // key(i).value 就是本表的 key 或 index 值, 要查 hash 表, 得重複嘗試。 - // 如果失敗就從最後少一個字母再試,直到兩個字母也失敗為止才放棄。 - // 失敗時傳回 undefined 正好。這個 function 稱為 lookup 即可。 - code lookup ( hash key -- ) \ Lookup the hash table that has partial keys with the full key - (function(hash,index){ // 查表 return hash[index] or undefined - for(var i=index; i.length>=2; i=i.slice(0,-1)){ - var v = hash[i]; - if(typeof(v)!="undefined") break; - } - push(v); - })(pop(1),pop()); end-code - : query-dept ( hash dept -- ) \ See the department info - char BG dup . char : . space js> tos(2)[pop()] over lookup . cr - char BD dup . char : . space js> tos(2)[pop()] over lookup . cr - char DEPT dup . char : . space js> tos(2)[pop()] over lookup . cr - char DEPT2 dup . char : . space js> tos(2)[pop()] over lookup . cr - char JamesYu dup . char : . space js> tos(2)[pop()] over lookup . cr - char Payroll dup . char : . space js> tos(2)[pop()] over lookup . cr - char Site dup . char : . space js> tos(2)[pop()] over lookup . cr - char Boss dup . char : . space js> tos(2)[pop()] over lookup . cr - char Assistant dup . char : . space js> tos(2)[pop()] over lookup . cr - char WKSRD dup . char : . space js> tos(2)[pop()] over lookup . cr - 2drop ; + // key(i).value 就是本表的 key 或 index 值, 要查 hash 表, 得重複嘗試。 + // 如果失敗就從最後少一個字母再試,直到兩個字母也失敗為止才放棄。 + // 失敗時傳回 undefined 正好。這個 function 稱為 lookup 即可。 + code lookup ( hash key -- ) \ Lookup the hash table that has partial keys with the full key + (function(hash,index){ // 查表 return hash[index] or undefined + for(var i=index; i.length>=2; i=i.slice(0,-1)){ + var v = hash[i]; + if(typeof(v)!="undefined") break; + } + push(v); + })(pop(1),pop()); end-code + : query-dept ( hash dept -- ) \ See the department info + char BG dup . char : . space js> tos(2)[pop()] over lookup . cr + char BD dup . char : . space js> tos(2)[pop()] over lookup . cr + char DEPT dup . char : . space js> tos(2)[pop()] over lookup . cr + char DEPT2 dup . char : . space js> tos(2)[pop()] over lookup . cr + char JamesYu dup . char : . space js> tos(2)[pop()] over lookup . cr + char Payroll dup . char : . space js> tos(2)[pop()] over lookup . cr + char Site dup . char : . space js> tos(2)[pop()] over lookup . cr + char Boss dup . char : . space js> tos(2)[pop()] over lookup . cr + char Assistant dup . char : . space js> tos(2)[pop()] over lookup . cr + char WKSRD dup . char : . space js> tos(2)[pop()] over lookup . cr + 2drop ; [x] excel.f 在有 excel 的 S7 OA 上也被跳過了, 原因是下面這段 code 出乎意料地傳回 'undefined' , - - On Error Resume Next - Set xl=GetObject(,"excel.application") - kvm.push(xl) - - --> 去掉 "On Error Resume Next" 後即見原因: - VBscript error : ActiveX component can't create object: 'GetObject' - 我猜這個 excel process 是有問題了。把它 kill 掉看看 --> 果然好了。 - ==> 加上這種情形的警告。 + + On Error Resume Next + Set xl=GetObject(,"excel.application") + kvm.push(xl) + + --> 去掉 "On Error Resume Next" 後即見原因: + VBscript error : ActiveX component can't create object: 'GetObject' + 我猜這個 excel process 是有問題了。把它 kill 掉看看 --> 果然好了。 + ==> 加上這種情形的警告。 [x] Improve see-dept , list all possible departments - hash 的 key 有很多是部門代碼的開頭幾個字母, lookup 會自動把 i 縮短來嘗試。 - 原來的 lookup 是用 v = hash[i]; 查表, 所以 i 怎麼縮必須是 hash 有的 key。 - 如果 i 已經比 hash 的 key 短, 就查不到了。 - ==> 如果 input 很長, 沒有 hash 吻合。把 i 截短 重試, 直到有吻合的為止。--> 現有的 algorithm, 精確。 - ==> 如果以上失敗,就拿所有的 key 來跟 i 比。比 i 短的就不對了, - 比 i 長的 key 截短來比 --> 結果可以一 key 多 value 都列出來。 - ==> 做成另一組 lookup2 跟 see-dept2 吧 - ==> see-departments 1s1k + hash 的 key 有很多是部門代碼的開頭幾個字母, lookup 會自動把 i 縮短來嘗試。 + 原來的 lookup 是用 v = hash[i]; 查表, 所以 i 怎麼縮必須是 hash 有的 key。 + 如果 i 已經比 hash 的 key 短, 就查不到了。 + ==> 如果 input 很長, 沒有 hash 吻合。把 i 截短 重試, 直到有吻合的為止。--> 現有的 algorithm, 精確。 + ==> 如果以上失敗,就拿所有的 key 來跟 i 比。比 i 短的就不對了, + 比 i 長的 key 截短來比 --> 結果可以一 key 多 value 都列出來。 + ==> 做成另一組 lookup2 跟 see-dept2 吧 + ==> see-departments 1s1k [x] hcchen5600 2015/08/21 17:40:12 - 完成 [begin][again] [begin][until] [for][next] interpret mode 的重要 flow control 命令 - 以後不用 cut .. rewind 了。 + 完成 [begin][again] [begin][until] [for][next] interpret mode 的重要 flow control 命令 + 以後不用 cut .. rewind 了。 [x] Use this line to setup Fubon e01 association in excel - ==> [begin] DDE-formula down @?stop 10 nap [again] + ==> [begin] DDE-formula down @?stop 10 nap [again] [x] study meney.f against the recent decline. [x] work on project-k jeforth.f [x] 新增 private folder 放 work.f money.f departmentcode.json 等。 - --> 看怎麼把 project-k-kernel merge 回 master? + --> 看怎麼把 project-k-kernel merge 回 master? [x] 把 jeforth.3we 的 kernel 換成 project-k. project-k 的 cub.html 已經成功把 - pack-help 獨立出來, vm/kvm 的問題也搞懂了. 應該從 jeforth.f 改好就好了。 - jeforth.3we 還是可以自稱 kvm 噓~~~ ===> 不要直接改, 先用 cub.html debug。 - 或者用帶入新 vm 的手法直接在 jeforth.3we 裡 debug。 + pack-help 獨立出來, vm/kvm 的問題也搞懂了. 應該從 jeforth.f 改好就好了。 + jeforth.3we 還是可以自稱 kvm 噓~~~ ===> 不要直接改, 先用 cub.html debug。 + 或者用帶入新 vm 的手法直接在 jeforth.3we 裡 debug。 [x] cub.f 直接在 jeforth.3we 裡試驗 project-k-kernel 很成功。一下就把 cub.f - run 起來了。cub.f 沒有 selftest 所以不可靠, jeforth.3we 穩是基本要求。準備 - 改用 3we/kernel/jeforth.f + run 起來了。cub.f 沒有 selftest 所以不可靠, jeforth.3we 穩是基本要求。準備 + 改用 3we/kernel/jeforth.f [x] 用了很久的 packhelp() 傳回 "( foo ) bar" 或者 "( ?? ) No help message. Use // to add one." - 等於是從 tib 抽 help 出來。用新的 "parse-help" 取代,方法如下: - push(nexttoken('\n|\r')); // rest of the first line - execute("parse-help"); // ( "helpmsg" "rests" ) - tib = pop() + " " + tib.slice(ntib); ntib = 0; // "rests" + tib(ntib) - newhelp = pop(); + 等於是從 tib 抽 help 出來。用新的 "parse-help" 取代,方法如下: + push(nexttoken('\n|\r')); // rest of the first line + execute("parse-help"); // ( "helpmsg" "rests" ) + tib = pop() + " " + tib.slice(ntib); ntib = 0; // "rests" + tib(ntib) + newhelp = pop(); [x] project-k 的 panic 要表明身分,否則搞搞不清楚. [x] 從 jeforth.3we 下命令給 project-k VM 用 hotkey f8: - code {F8} ( "command line" -- ) \ Let project-k VM to run the inputbox - var cmd = inputbox.value; - inputbox.value=""; - g.k.dictate(cmd) ; - jump2endofinputbox.click(); - inputbox.focus(); - end-code + code {F8} ( "command line" -- ) \ Let project-k VM to run the inputbox + var cmd = inputbox.value; + inputbox.value=""; + g.k.dictate(cmd) ; + jump2endofinputbox.click(); + inputbox.focus(); + end-code [x] cub.f 好了,攻 selftest, 改良。 [x] Original (words) in jeforth.f is very powerful but without -v and -V. - While words and help was poor, because they were rely on voc.f unnecessarily. - So we need to improve words and help. --> 規定好 input 格式, 有助化簡程式。 - words/help [pattern [switch [argument]]] + While words and help was poor, because they were rely on voc.f unnecessarily. + So we need to improve words and help. --> 規定好 input 格式, 有助化簡程式。 + words/help [pattern [switch [argument]]] [x] 老經驗 - nexttoken('\n|\r'); // if use only '\n' then we get an unexpected ending '\r'. + nexttoken('\n|\r'); // if use only '\n' then we get an unexpected ending '\r'. [x] see ~(create)~ - JavaScript error on word ".0r" : Cannot read property 'length' of undefined - ==> RI,FP: 產生一個 colon word 方法很多,不一定已經有 cfa。 + JavaScript error on word ".0r" : Cannot read property 'length' of undefined + ==> RI,FP: 產生一個 colon word 方法很多,不一定已經有 cfa。 [x] 用 vm.init() 來設定 type() or print() function 多此一舉。已經有 vm.clearScreen 等 - 乾脆就不要 init() 了。projct-k 根本不知道也不用知道你需要 print() !! - ==> jeforth.js 有用到 type() 這樣一來 project-k 就認為自己在有 display 的地方執行?! - 雖然可以從 type() 的定義解決,總是不太理想。 - ==> 用到 type() 的地方 - 1. docode() 的 reDef warning ==> 改 call panic(state-object). - 2. panic() ==> 所有 error/warning 都 call panic() 如前。但 panic() 裡面先檢查有 - 沒有 vm.panic() 然後 call vm.panic(state)。 - 3. reset() 的 message 沒啥意義 - ==> 已經都用 k :: type=function..., k :: prompt=.. 的方式。 + 乾脆就不要 init() 了。projct-k 根本不知道也不用知道你需要 print() !! + ==> jeforth.js 有用到 type() 這樣一來 project-k 就認為自己在有 display 的地方執行?! + 雖然可以從 type() 的定義解決,總是不太理想。 + ==> 用到 type() 的地方 + 1. docode() 的 reDef warning ==> 改 call panic(state-object). + 2. panic() ==> 所有 error/warning 都 call panic() 如前。但 panic() 裡面先檢查有 + 沒有 vm.panic() 然後 call vm.panic(state)。 + 3. reset() 的 message 沒啥意義 + ==> 已經都用 k :: type=function..., k :: prompt=.. 的方式。 [x] Javascript 的 string 有 trim() method 可以去頭尾 white spaces, 從來不知。 - ==> 小心用! Windows XP 的 JScript v5.6 未 support. 故 project-k jeforth.f 裡都不能用。 + ==> 小心用! Windows XP 的 JScript v5.6 未 support. 故 project-k jeforth.f 裡都不能用。 [x] stackwas 放在 jeforth.js kernel 裏頭有必要嗎? --> 改成 tick(':').stackwas 了。 [x] 要參考 code word 自身,用 tick('name') 是可以考慮。有更好的辦法嗎? - ==> 現在 _me 直接就是該 word object 本身。 + ==> 現在 _me 直接就是該 word object 本身。 [x] working on db bp *debug* for cub.f - ==> resume function needs a static variable. - --> see processing.f, "JavaScript Module Pattern: In-Depth" in YouDao Notebook. - ==> I only want to get the code word object in its xt(), it's the argument! So, - simply call w.xt(w) passes w over, this simple! This is done in the inner(). - also "newxt=function(_me){..." in docode() of kernel jeforth.js. - ==> 經由 "newxt=function(_me){..." in docode() of kernel jeforth.js, and - simply call w.xt(w) in the inner() loop, we have _me in any code word - that indicates the code word itself. + ==> resume function needs a static variable. + --> see processing.f, "JavaScript Module Pattern: In-Depth" in YouDao Notebook. + ==> I only want to get the code word object in its xt(), it's the argument! So, + simply call w.xt(w) passes w over, this simple! This is done in the inner(). + also "newxt=function(_me){..." in docode() of kernel jeforth.js. + ==> 經由 "newxt=function(_me){..." in docode() of kernel jeforth.js, and + simply call w.xt(w) in the inner() loop, we have _me in any code word + that indicates the code word itself. [x] root word-list 還是叫 'forth' 好了, 當初想的是讓 project-k 盡量中性,先有 root 然 - 後再加上 forth voc 等。但因為 kernel jeforth.f 本身不 support vocabulary, 故以上 - 已經落空,根本分不出 root 跟 forth 不如就用 forth。還是可以在 voc.f 進來了以後再 - 拆分 root 跟 forth。但這麼做有何意義? 既無意義就表示都是 forth 即可。 - 所以 forth 變成永遠都在的部分,不想讓 words help 太雜亂時,盡量用 only work.f, - only git.f 等來讓輸出清爽。故 words 的 -v -V -V- option 都不必了,好耶。 + 後再加上 forth voc 等。但因為 kernel jeforth.f 本身不 support vocabulary, 故以上 + 已經落空,根本分不出 root 跟 forth 不如就用 forth。還是可以在 voc.f 進來了以後再 + 拆分 root 跟 forth。但這麼做有何意義? 既無意義就表示都是 forth 即可。 + 所以 forth 變成永遠都在的部分,不想讓 words help 太雜亂時,盡量用 only work.f, + only git.f 等來讓輸出清爽。故 words 的 -v -V -V- option 都不必了,好耶。 [x] should be moved to voc.f - : temp ( -- ) \ The source-code-file.f header macro - - ?skip2 --EOF-- \ skip it if already included - dup .( Including ) . cr char -- over over + + - js: tick('').masterMarker=tos()+"selftest--"; - also forth definitions (marker) (vocabulary) - last execute definitions - - js> tick('').masterMarker (marker) - include kernel/selftest.f - - tib.insert ; - js: last().name="source-code"+"-header" - /// skip including if the module has been included. - /// setup the self-test module - /// initiate vocabulary for the including module + : temp ( -- ) \ The source-code-file.f header macro + + ?skip2 --EOF-- \ skip it if already included + dup .( Including ) . cr char -- over over + + + js: tick('').masterMarker=tos()+"selftest--"; + also forth definitions (marker) (vocabulary) + last execute definitions + + js> tick('').masterMarker (marker) + include kernel/selftest.f + + tib.insert ; + js: last().name="source-code"+"-header" + /// skip including if the module has been included. + /// setup the self-test module + /// initiate vocabulary for the including module [x] cub.f 寫好了以後要併回 cub.html, project-k 保持單純。 [x] 大改寫, - [x] voc.f help calls (help) but origianl (help)/help 的 系統 help 要重新調配. - (help) 不該負責印系統 help --> (words) words , voc.f words help ok - o get jeForth() from jeforth.js > kvm = new jeForth() - o kernel/jeforth.f --> f/jeforth.f - o fortheval --> dictate - o print --> type - o 所有 g.sth 改成 vm.g.sth, 否則 g 本身要在哪裡定義? - --> 如果是在 init module (index.html, jeforth.hta, etc) 的 global - 可以考慮,但我不想跑出一個不是掛在 vm 下的例外來降低 porting project-k 的一致性。 - --> 如果在 kernel jeforth.js 裡,不好!多出個人色彩。 - --> 必須 HTA 下 .. vm.g.name .. 也能看得見。 - 本來看不見 vm 只看得見 kvm 但死認 kvm 當然不行,所以後來引進 - var jeforth_project_k_virtual_machine_object = new jeForth() - 把 vm 的本名弄到絕對不會有人來衝突,然後再介紹給 內部自己的 global vm。 - --> 所以 g hash 目前是掛在 vm.g 暫無他法。 - o internel kvm --> vm - o 去掉 kernel kvm.path = ["dummy", "f", "3nd/f", "3nd", "3nd/eforth.com", "playground"]; - o kvm.selftest_visible = true; - o kvm.minor_version = 1; // minor version specified by application, major version is from jeforth.js kernel. - var version = parseFloat(kvm.major_version+"."+kvm.minor_version); - kvm.greeting = function(){ - type("j e f o r t h . 3 h t m -- v"+version+'\n'); - type("source code http://github.com/hcchengithub/jeforth.3we\n"); - type("Program path " + window.location.toString()); - return(version); - } - o vm.base 改用 value -> vm.g.base [x]jeforth.f []3htm []3nd []3nw []3hta - o vm.editMode 改用 ({F2}).EditMode - o 改寫 vm.panic() + [x] voc.f help calls (help) but origianl (help)/help 的 系統 help 要重新調配. + (help) 不該負責印系統 help --> (words) words , voc.f words help ok + o get jeForth() from jeforth.js > kvm = new jeForth() + o kernel/jeforth.f --> f/jeforth.f + o fortheval --> dictate + o print --> type + o 所有 g.sth 改成 vm.g.sth, 否則 g 本身要在哪裡定義? + --> 如果是在 init module (index.html, jeforth.hta, etc) 的 global + 可以考慮,但我不想跑出一個不是掛在 vm 下的例外來降低 porting project-k 的一致性。 + --> 如果在 kernel jeforth.js 裡,不好!多出個人色彩。 + --> 必須 HTA 下 .. vm.g.name .. 也能看得見。 + 本來看不見 vm 只看得見 kvm 但死認 kvm 當然不行,所以後來引進 + var jeforth_project_k_virtual_machine_object = new jeForth() + 把 vm 的本名弄到絕對不會有人來衝突,然後再介紹給 內部自己的 global vm。 + --> 所以 g hash 目前是掛在 vm.g 暫無他法。 + o internel kvm --> vm + o 去掉 kernel kvm.path = ["dummy", "f", "3nd/f", "3nd", "3nd/eforth.com", "playground"]; + o kvm.selftest_visible = true; + o kvm.minor_version = 1; // minor version specified by application, major version is from jeforth.js kernel. + var version = parseFloat(kvm.major_version+"."+kvm.minor_version); + kvm.greeting = function(){ + type("j e f o r t h . 3 h t m -- v"+version+'\n'); + type("source code http://github.com/hcchengithub/jeforth.3we\n"); + type("Program path " + window.location.toString()); + return(version); + } + o vm.base 改用 value -> vm.g.base [x]jeforth.f []3htm []3nd []3nw []3hta + o vm.editMode 改用 ({F2}).EditMode + o 改寫 vm.panic() [ ] html5.f , element.f 的 selftest 都很欠缺,無聊寫寫。 [x] 3htm 的 platform.f 裡又有 (help) help 用來超漂亮的 help .... 也得改寫. - ---> keyboard events 有問題,回家繼續 debug + ---> keyboard events 有問題,回家繼續 debug [x] Error! source-code-header unknown. [x] jeforth.3we 的 'kernel' directory 直接就是 project-k 以免搞不清楚. - 本來認為是 kernel 的 jeforth.f 跟 voc.f 則搬到 f 裡去。不當作 kernel 了。 - [x] 這個要把 kernel 拿掉, 以 3htm 為例, - kvm.path = ["dummy","f", "3htm/f", "3htm/canvas", "3htm", "playground"]; + 本來認為是 kernel 的 jeforth.f 跟 voc.f 則搬到 f 裡去。不當作 kernel 了。 + [x] 這個要把 kernel 拿掉, 以 3htm 為例, + kvm.path = ["dummy","f", "3htm/f", "3htm/canvas", "3htm", "playground"]; [x] 這兩個不必佔用 vm.member , 應該直接放進 *debug* 的 members。 - 因為掛在 vm 下的 properties 都要有關聯 vm 內外的目的,如 vm.type(), vm.prompt, - 等. bp 跟 continue 或 resume 純粹是 jeforth.f 內部的東西, 應該屬於 value 放 - 在 vm.g 下才對. 宣告成 value 就對了。 - // debug - vm.bp = 0 // breakpoint <---- tick("*debug*").breakpoint=0 - vm.continue = 0 // *debug* resume point <---- tick("*debug*").resume=null - [x] index.html [x] cub.html [ ] 3nw [ ] 3nd + 因為掛在 vm 下的 properties 都要有關聯 vm 內外的目的,如 vm.type(), vm.prompt, + 等. bp 跟 continue 或 resume 純粹是 jeforth.f 內部的東西, 應該屬於 value 放 + 在 vm.g 下才對. 宣告成 value 就對了。 + // debug + vm.bp = 0 // breakpoint <---- tick("*debug*").breakpoint=0 + vm.continue = 0 // *debug* resume point <---- tick("*debug*").resume=null + [x] index.html [x] cub.html [ ] 3nw [ ] 3nd [x] some application didn't use this trick - e = (e) ? e : event; var keycode = (e.keyCode) ? e.keyCode : (e.which) ? e.which : false; - [x] index.html of 3HTML, [x] baby.html of project-k, [x] cub.html of project-k + e = (e) ? e : event; var keycode = (e.keyCode) ? e.keyCode : (e.which) ? e.which : false; + [x] index.html of 3HTML, [x] baby.html of project-k, [x] cub.html of project-k [x] chrome f12 跑出一個 message : - cub.html:6 Resource interpreted as Stylesheet but transferred with MIME type text/plain: "http://localhost:8888/common.css". - 我不喜歡這個解釋 http://stackoverflow.com/questions/12003107/resource-interpreted-as-script-but-transferred-with-mime-type-text-plain-for-l - 用 Win8 ie10 也一樣有問題 SEC7113: CSS was ignored due to mime type mismatch - --> utf-8 改成 ANSI 也沒用 - ==> 改直接執行 cub.html 就好了 (不透過 localhost:8888) --> 可能是 webserver.f 的問題. - ==> 果然是 webserver.f 的問題! https://msdn.microsoft.com/en-us/library/hh180764(v=vs.85).aspx - RI : An imported style sheet was not used due to the wrong MIME type in the HTTP header. - FP : Ensure style sheet file is delivered with the proper HTTP response header, which includes - a content type of text\css. See MIME-Handling Changes in Internet Explorer for more information. + cub.html:6 Resource interpreted as Stylesheet but transferred with MIME type text/plain: "http://localhost:8888/common.css". + 我不喜歡這個解釋 http://stackoverflow.com/questions/12003107/resource-interpreted-as-script-but-transferred-with-mime-type-text-plain-for-l + 用 Win8 ie10 也一樣有問題 SEC7113: CSS was ignored due to mime type mismatch + --> utf-8 改成 ANSI 也沒用 + ==> 改直接執行 cub.html 就好了 (不透過 localhost:8888) --> 可能是 webserver.f 的問題. + ==> 果然是 webserver.f 的問題! https://msdn.microsoft.com/en-us/library/hh180764(v=vs.85).aspx + RI : An imported style sheet was not used due to the wrong MIME type in the HTTP header. + FP : Ensure style sheet file is delivered with the proper HTTP response header, which includes + a content type of text\css. See MIME-Handling Changes in Internet Explorer for more information. [x] ie10 還抓到 cub.html 好多別的問題 - HTML1402: Character reference is missing an ending semicolon ";". - cub.html, line 243 character 22 - HTML1402: Character reference is missing an ending semicolon ";". - cub.html, line 707 character 62 - HTML1402: Character reference is missing an ending semicolon ";". - cub.html, line 707 character 124 - HTML1402: Character reference is missing an ending semicolon ";". - cub.html, line 710 character 34 - HTML1402: Character reference is missing an ending semicolon ";". - cub.html, line 712 character 103 - 在 chrome 都沒問題,而且所列之處根本就是 forth code ! 別管他。 + HTML1402: Character reference is missing an ending semicolon ";". + cub.html, line 243 character 22 + HTML1402: Character reference is missing an ending semicolon ";". + cub.html, line 707 character 62 + HTML1402: Character reference is missing an ending semicolon ";". + cub.html, line 707 character 124 + HTML1402: Character reference is missing an ending semicolon ";". + cub.html, line 710 character 34 + HTML1402: Character reference is missing an ending semicolon ";". + cub.html, line 712 character 103 + 在 chrome 都沒問題,而且所列之處根本就是 forth code ! 別管他。 [ ] review project-k GitHub wiki 的文件、linkage 等。 - 文章寫多了,動不動就有斷鏈、command 已經改名等問題。 + 文章寫多了,動不動就有斷鏈、command 已經改名等問題。 [/] 檢查 browser 是否 Chrome, alert 用 chrome 比較好。cub.html 在 Win 10 Edge 直接跑,慢得要命。 [x] 3htm jsc 裡 erase 無效 ... 感謝我自己! 以前已經發現在 jsc console 時 - inputbox.value 是 \10 因為 \r\n (Chrome & IE) 只吃掉 \r 故留下 \n 使得 inputbox 非 empty 因此 - {backspace} 不工作。修改判斷條件為 inputbox.value==""||inputbox.value=="\n" 即可 - * 3nw 也解過這個問題, 方法是在 jsc.xt 裡一見面就把 inputbox.value 清成 "" 也可以。 + inputbox.value 是 \10 因為 \r\n (Chrome & IE) 只吃掉 \r 故留下 \n 使得 inputbox 非 empty 因此 + {backspace} 不工作。修改判斷條件為 inputbox.value==""||inputbox.value=="\n" 即可 + * 3nw 也解過這個問題, 方法是在 jsc.xt 裡一見面就把 inputbox.value 清成 "" 也可以。 [x] tweak cub.html on going . . . so as to make a project-k release - rename to sample.html. project-k released. [ ] make it a release on github. + rename to sample.html. project-k released. [ ] make it a release on github. [x] webserver.f ok now. working on 3nd . . . - [x] no panic !!!! in jeforth.3nd.js <---- master kvm.panic() was missing. - in 3htm level doesn't work either <----- it works, it launchs F12 debugger. - [x] vm.gets() very poor, needs improvement. - --> e command tips ctrl-z at least - [x] fs.f has some self-test, they need to upgrade - [x] jsc.hlp, jsc.js - [ ] eforth.com + [x] no panic !!!! in jeforth.3nd.js <---- master kvm.panic() was missing. + in 3htm level doesn't work either <----- it works, it launchs F12 debugger. + [x] vm.gets() very poor, needs improvement. + --> e command tips ctrl-z at least + [x] fs.f has some self-test, they need to upgrade + [x] jsc.hlp, jsc.js + [ ] eforth.com [ ] jsc 能不能在 exit "", ret null 處停下來, 目前不會, 故看不到 ret / exit 就突然結束了。 [x] porting to project-k 大改寫 apply to 3HTA (3htm and 3nd are done) - [x] kernel/jeforth.js --> project-k/jeforth.js - [x] get jeForth() from jeforth.js > kvm = new jeForth() - [x] 去掉 kernel kvm.path = ["dummy", "f", "3nd/f", "3nd", "3nd/eforth.com", "playground"]; - [x] kernel/jeforth.f --> f/jeforth.f - [x] kvm.selftest_visible = true; // type() needs to check it - [x] kvm.minor_version = 1; // minor version specified by application, major version is from jeforth.js kernel. - var version = parseFloat(kvm.major_version+"."+kvm.minor_version); - kvm.greeting = function(){ - type("j e f o r t h . 3 h t m -- v"+version+'\n'); - type("source code http://github.com/hcchengithub/jeforth.3we\n"); - type("Program path " + window.location.toString()); - return(version); - } - [x] vm.base 改用 value -> vm.g.base [x]jeforth.f []3htm [x]3nd []3nw [x]3hta - [x] apply to all *.f files - [x] fortheval --> dictate [ ] apply to all *.f files - [x] print --> type [ ] apply to all *.f files - [x] 所有 g.sth 改成 vm.g.sth [ ] apply to all *.f files - [x] internel kvm --> vm - [x] js: vm.selftest_visible=true - [x] -->judge 改用 [d d] [p p] - [x] vm.editMode, in platform.f, 改用 {F2}.EditMode [x]3htm []3nd []3nw [x]3hta - [x]3htm [x]3nw [x]3hta all are in 3htm/f/platform.f - [x]3nd - [x] 改寫 vm.panic() - [x] 照理說 "kvm" 只應出現在 jeforth.hta 裡, 其他都用 "vm"。但是 vb.f 裡似乎免不了要用一次 "kvm" 讓 - VBscript 認得 "vm"。若 "kvm" 之名改了,vb.f 也得跟著改。<==== FP, use a very long VM name in global. + [x] kernel/jeforth.js --> project-k/jeforth.js + [x] get jeForth() from jeforth.js > kvm = new jeForth() + [x] 去掉 kernel kvm.path = ["dummy", "f", "3nd/f", "3nd", "3nd/eforth.com", "playground"]; + [x] kernel/jeforth.f --> f/jeforth.f + [x] kvm.selftest_visible = true; // type() needs to check it + [x] kvm.minor_version = 1; // minor version specified by application, major version is from jeforth.js kernel. + var version = parseFloat(kvm.major_version+"."+kvm.minor_version); + kvm.greeting = function(){ + type("j e f o r t h . 3 h t m -- v"+version+'\n'); + type("source code http://github.com/hcchengithub/jeforth.3we\n"); + type("Program path " + window.location.toString()); + return(version); + } + [x] vm.base 改用 value -> vm.g.base [x]jeforth.f []3htm [x]3nd []3nw [x]3hta + [x] apply to all *.f files + [x] fortheval --> dictate [ ] apply to all *.f files + [x] print --> type [ ] apply to all *.f files + [x] 所有 g.sth 改成 vm.g.sth [ ] apply to all *.f files + [x] internel kvm --> vm + [x] js: vm.selftest_visible=true + [x] -->judge 改用 [d d] [p p] + [x] vm.editMode, in platform.f, 改用 {F2}.EditMode [x]3htm []3nd []3nw [x]3hta + [x]3htm [x]3nw [x]3hta all are in 3htm/f/platform.f + [x]3nd + [x] 改寫 vm.panic() + [x] 照理說 "kvm" 只應出現在 jeforth.hta 裡, 其他都用 "vm"。但是 vb.f 裡似乎免不了要用一次 "kvm" 讓 + VBscript 認得 "vm"。若 "kvm" 之名改了,vb.f 也得跟著改。<==== FP, use a very long VM name in global. [x] working on improving 3nd jsc . . . done,it's very good now. - [x] 3htm [x] 3hta [ ] 3nw + [x] 3htm [x] 3hta [ ] 3nw [x] *debug* should print the prompt at entering *debug* mode. [x] include jQuery is done in html5.f , no good. Because html5.f is shared by 3hta, 3htm, and 3nw. - --> move include jQuery out of html5.f, jquery.f stand alone for 3hta. - --> type should be redefined in jquery.f but didn't --> fixed, but still pringing >>>
> js> - --> RI: multiple \t only first \t processed, because plain=function...; function vm.type=function... - something wrong. --> try newPlain() then ok. So which plain() is used? I know vm.plain() - --> 乾脆不要有 type() plain(), 都用 vm.type() vm.plain() 免生疑惑。 ==> Bingo! and shit 自找麻煩。 + --> move include jQuery out of html5.f, jquery.f stand alone for 3hta. + --> type should be redefined in jquery.f but didn't --> fixed, but still pringing >>>
> js> + --> RI: multiple \t only first \t processed, because plain=function...; function vm.type=function... + something wrong. --> try newPlain() then ok. So which plain() is used? I know vm.plain() + --> 乾脆不要有 type() plain(), 都用 vm.type() vm.plain() 免生疑惑。 ==> Bingo! and shit 自找麻煩。 [x] working on wsh.f selftest improvements [x] 半路發動 selftest 的方法,必須用 include 的才會自動幫 .f 檔加東西執行 selftest。 - ' :: enabled=true dropall cls --wmi.f-- include wmi.f - ' :: enabled=true dropall cls --excel.f-- include excel.f - ' :: enabled=true dropall cls --canvas.f-- include canvas.f - ' :: enabled=true dropall cls --ie.f-- include ie.f + ' :: enabled=true dropall cls --wmi.f-- include wmi.f + ' :: enabled=true dropall cls --excel.f-- include excel.f + ' :: enabled=true dropall cls --canvas.f-- include canvas.f + ' :: enabled=true dropall cls --ie.f-- include ie.f [x] ie.f 已知 ShellWindows 包括 fe ie . ie(i) ie 等不該以 ie 為名。 [x] fe/ie 其實是 sw 才對,ShellWindows.item(i) [x] ie.f 最嚴重的問題是這個, ShellWindows.item(index) 不能收 argument !!?? - \ [x] 不能直接用變數,很奇怪? <-- RI: 需 parseInt() cast 一下。 - \ theIE s" vm.g.ShellWindows.item(_i_)" :> replace(/_i_/,pop()) jsEval ; - > : sw var index=vm.g.theIE; var oo = vm.g.ShellWindows.item(index); oo; ; - > sw . - > JavaScript error on word "sw" : Invalid procedure call or argument - ==> 改用 code word - code sw2 - var index=vm.g.theIE; - var oo = vm.g.ShellWindows.item(index); - push(oo); - end-code - --> 結果一樣 - ==> 改用 .js 發現用 parseInt() cast 一下就好了 - var sa = new ActiveXObject("Shell.Application"); - var sw = sa.windows(); - var index = vm.g.theIE; - type(sw.item(index)); // 還是有問題 - --> - var sa = new ActiveXObject("Shell.Application"); - var sw = sa.windows(); - type(sw.item(parseInt(vm.g.theIE))); // parseInt() cast 一下就好了。 - - ==> : sw js> vm.g.ShellWindows.item(parseInt(vm.g.theIE)) ; <--- OK !! -[x] 在 wsh.f 裡會自動切中文? 如何避免? ---> 乾脆讓它 "Let me set a different input method for - each app window" @ Control Panel>Clock, Language, and Region > Language > Advanced settings. - 因為不讓它切它總是要切乾脆由它去吧! + \ [x] 不能直接用變數,很奇怪? <-- RI: 需 parseInt() cast 一下。 + \ theIE s" vm.g.ShellWindows.item(_i_)" :> replace(/_i_/,pop()) jsEval ; + > : sw var index=vm.g.theIE; var oo = vm.g.ShellWindows.item(index); oo; ; + > sw . + > JavaScript error on word "sw" : Invalid procedure call or argument + ==> 改用 code word + code sw2 + var index=vm.g.theIE; + var oo = vm.g.ShellWindows.item(index); + push(oo); + end-code + --> 結果一樣 + ==> 改用 .js 發現用 parseInt() cast 一下就好了 + var sa = new ActiveXObject("Shell.Application"); + var sw = sa.windows(); + var index = vm.g.theIE; + type(sw.item(index)); // 還是有問題 + --> + var sa = new ActiveXObject("Shell.Application"); + var sw = sa.windows(); + type(sw.item(parseInt(vm.g.theIE))); // parseInt() cast 一下就好了。 + + ==> : sw js> vm.g.ShellWindows.item(parseInt(vm.g.theIE)) ; <--- OK !! +[x] 在 wsh.f 裡會自動切中文? 如何避免? ---> 乾脆讓它 "Let me set a different input method for + each app window" @ Control Panel>Clock, Language, and Region > Language > Advanced settings. + 因為不讓它切它總是要切乾脆由它去吧! [x] Consider the proper .f for [stringify] and [parse] , according to 3hta's quit.f, - include voc.f \ voc.f is basic of forth language - ==> include html5.f \ HTML5 is HTA's plateform feature - include jquery.f \ Avoid Windows XP, Windows 7 HTA problems from happening immediately - include element.f \ HTML element manipulation - include platform.f \ Hotkey handlers and platform features - include vb.f \ Being able to run VBS is what HTA is for. - include wsh.f \ Windows Shell Host + include voc.f \ voc.f is basic of forth language + ==> include html5.f \ HTML5 is HTA's plateform feature + include jquery.f \ Avoid Windows XP, Windows 7 HTA problems from happening immediately + include element.f \ HTML element manipulation + include platform.f \ Hotkey handlers and platform features + include vb.f \ Being able to run VBS is what HTA is for. + include wsh.f \ Windows Shell Host [x] 在 panic() 裡面用 ' :> enabled 來判斷是否 free run mode。 - panic() 是 application dependent, 以 3hta 為例,如果是 free run mode ,碰到 severe panic - 通通要進 jsc 停下來; 如果是 interactive mode 則進 F12 debugger. - 看來 定義好之後要改寫 panic() 但是又不方便放進 jeforth.f 成為 common code, - 因此應該在 quit.f 裡面改寫。 - ------------- ^^^^ 以上不對 ^^^^ ------------------------------- - 實際上 panic() 要不要進 jsc 只跟 severity 有關, 沒機會管 .enabled. - [x] 3hta [x]3nd [x]3nw [x]3htm + panic() 是 application dependent, 以 3hta 為例,如果是 free run mode ,碰到 severe panic + 通通要進 jsc 停下來; 如果是 interactive mode 則進 F12 debugger. + 看來 定義好之後要改寫 panic() 但是又不方便放進 jeforth.f 成為 common code, + 因此應該在 quit.f 裡面改寫。 + ------------- ^^^^ 以上不對 ^^^^ ------------------------------- + 實際上 panic() 要不要進 jsc 只跟 severity 有關, 沒機會管 .enabled. + [x] 3hta [x]3nd [x]3nw [x]3htm [x] jsc.hlp , jsc.js 都該像 3nd 一樣獨立。 <--- jeforth.f 之後馬上就是 quit.f 不 - 能更早了! 所以放在 quit.f 裡面沒問題。===> ok, but 問題是重複寫了好幾份, 能不能在 quit.f - 裡面都參考同一份 jsc source code? - ==> done, 統一成只有兩分 jsc.f : 3hta,3htm,3nw and 3nd. - [x] 晚點把 3nd 裡的 jsc.hlp jsc.js delete 掉,已經沒有用了。 + 能更早了! 所以放在 quit.f 裡面沒問題。===> ok, but 問題是重複寫了好幾份, 能不能在 quit.f + 裡面都參考同一份 jsc source code? + ==> done, 統一成只有兩分 jsc.f : 3hta,3htm,3nw and 3nd. + [x] 晚點把 3nd 裡的 jsc.hlp jsc.js delete 掉,已經沒有用了。 [ ] T550 常常突然停下來, 造成 Multiplicity 斷線. 寫程式觀察這個情形。 [x] install nw.js 就是把 zip 解壓, 然後整個 folder copy 到 nodejs\ 的 path folder. - 因為 node.js 有 installer, nw.js 沒有. 正好目錄結構不衝突, 應該可以 ==> Yes, OK. + 因為 node.js 有 installer, nw.js 沒有. 正好目錄結構不衝突, 應該可以 ==> Yes, OK. - Unzip the nw.js package (v0.14 now use SDK version to gain F12 Debugger or DevTool) - and set path to it, that's all. Or simply copy the entire nw.js unzip'ed folder to - node.js folder. This is because node.js has Windows installer and nw.js has not but - it can leverage node.js. + Unzip the nw.js package (v0.14 now use SDK version to gain F12 Debugger or DevTool) + and set path to it, that's all. Or simply copy the entire nw.js unzip'ed folder to + node.js folder. This is because node.js has Windows installer and nw.js has not but + it can leverage node.js. [x] porting to project-k 大改寫 apply to 3nw (3htm 3nd 3hta are done) - ---- modify jeforth.3nw.html -------------------- - [x] kernel/jeforth.js --> project-k/jeforth.js - [x] get jeForth() from jeforth.js > kvm = new jeForth() - [x] 去掉 kernel kvm.path = ["dummy", "f", "3nd/f", "3nd", "3nd/eforth.com", "playground"]; - [x] kernel/jeforth.f --> f/jeforth.f - [x] kvm.selftest_visible = true; // type() needs to check it - [x] kvm.minor_version = 1; // minor version specified by application, major version is from jeforth.js kernel. - var version = parseFloat(kvm.major_version+"."+kvm.minor_version); - kvm.greeting = function(){ - type("j e f o r t h . 3 h t m -- v"+version+'\n'); - type("source code http://github.com/hcchengithub/jeforth.3we\n"); - type("Program path " + window.location.toString()); - return(version); - } - [x] vm.base 改用 value -> vm.g.base [x]jeforth.f [x]3htm [x]3nd [x]3nw [x]3hta - [x] drop kvm.init - [x] apply to all *.f files - [x] fortheval --> dictate [ ] apply to all *.f files - [x] print --> type [ ] apply to all *.f files - [x] 所有 g.sth 改成 vm.g.sth [ ] apply to all *.f files - [x] internel kvm --> vm - [x] js: vm.selftest_visible=true - [x] -->judge 改用 [d d] [p p] - [x] vm.editMode, in platform.f, 改用 {F2}.EditMode - [x]3htm [x]3nw [x]3hta - [x]3nd 另外 review <---- gets is different thing. - [x] 改寫 vm.panic() - [x] 照理說 "kvm" 只應出現在 jeforth.hta 裡, 其他都用 "vm"。但是 vb.f 裡似乎免不了要用一次 "kvm" 讓 - VBscript 認得 "vm"。若 "kvm" 之名改了,vb.f 也得跟著改。 - [x] jsc is now defined in quit.f - [x]3htm [x]3nw [x]3hta <---------- same 3htm/f/jsc.f - [x]3nd 另外 review <--------- 3nd/f/jsc.f + ---- modify jeforth.3nw.html -------------------- + [x] kernel/jeforth.js --> project-k/jeforth.js + [x] get jeForth() from jeforth.js > kvm = new jeForth() + [x] 去掉 kernel kvm.path = ["dummy", "f", "3nd/f", "3nd", "3nd/eforth.com", "playground"]; + [x] kernel/jeforth.f --> f/jeforth.f + [x] kvm.selftest_visible = true; // type() needs to check it + [x] kvm.minor_version = 1; // minor version specified by application, major version is from jeforth.js kernel. + var version = parseFloat(kvm.major_version+"."+kvm.minor_version); + kvm.greeting = function(){ + type("j e f o r t h . 3 h t m -- v"+version+'\n'); + type("source code http://github.com/hcchengithub/jeforth.3we\n"); + type("Program path " + window.location.toString()); + return(version); + } + [x] vm.base 改用 value -> vm.g.base [x]jeforth.f [x]3htm [x]3nd [x]3nw [x]3hta + [x] drop kvm.init + [x] apply to all *.f files + [x] fortheval --> dictate [ ] apply to all *.f files + [x] print --> type [ ] apply to all *.f files + [x] 所有 g.sth 改成 vm.g.sth [ ] apply to all *.f files + [x] internel kvm --> vm + [x] js: vm.selftest_visible=true + [x] -->judge 改用 [d d] [p p] + [x] vm.editMode, in platform.f, 改用 {F2}.EditMode + [x]3htm [x]3nw [x]3hta + [x]3nd 另外 review <---- gets is different thing. + [x] 改寫 vm.panic() + [x] 照理說 "kvm" 只應出現在 jeforth.hta 裡, 其他都用 "vm"。但是 vb.f 裡似乎免不了要用一次 "kvm" 讓 + VBscript 認得 "vm"。若 "kvm" 之名改了,vb.f 也得跟著改。 + [x] jsc is now defined in quit.f + [x]3htm [x]3nw [x]3hta <---------- same 3htm/f/jsc.f + [x]3nd 另外 review <--------- 3nd/f/jsc.f [x] 3nw 的 jsc 直接 copy 用 3hta 的是可以用的。有機會把 3hta 3htm 3nw 三個 jsc 統一起來。 - [x] 乾脆寫成一個 jsc.f 統一起來。 - [x] jsc.f 可以自給自足 vm.jsc 不需要 initial module 定義。 [x]3hta [x]3htm [x]3nw + [x] 乾脆寫成一個 jsc.f 統一起來。 + [x] jsc.f 可以自給自足 vm.jsc 不需要 initial module 定義。 [x]3hta [x]3htm [x]3nw [x] 3nw jsc 目前有下列問題: - [x] initializing of vm.jsc.cmd, vm.jsc.enable should be done in 3nw.html <=== 這兩個根本不用 init - jsc.cmd 用到前有給值的動作, vm.jsc.enable undefined 時正好是 fault。 - [x] Replace the arguments.callee.show by vm.jsc.statusToggle, that switches the status - prompt, by 't' command. - [x] exit/q/quit 光 return 好像不夠, 下 debugger; instruction 會卡在 jsc 裡出不來。--> restart 後消失了。 - [x] erase 有時無效,且 rstack 一直堆積同一個回返地址 - RI ==> 因為 single step 會 break 所有的動作, 連 {backSpace} 也被 break 到了!! - [x] 以後再想想辦法。jsc 裡面用到的 words 都會有這個問題 ==> jsc.enable is the solution. - [!] jsc help shows only a few lines <---- nw.js' problem + [x] initializing of vm.jsc.cmd, vm.jsc.enable should be done in 3nw.html <=== 這兩個根本不用 init + jsc.cmd 用到前有給值的動作, vm.jsc.enable undefined 時正好是 fault。 + [x] Replace the arguments.callee.show by vm.jsc.statusToggle, that switches the status + prompt, by 't' command. + [x] exit/q/quit 光 return 好像不夠, 下 debugger; instruction 會卡在 jsc 裡出不來。--> restart 後消失了。 + [x] erase 有時無效,且 rstack 一直堆積同一個回返地址 + RI ==> 因為 single step 會 break 所有的動作, 連 {backSpace} 也被 break 到了!! + [x] 以後再想想辦法。jsc 裡面用到的 words 都會有這個問題 ==> jsc.enable is the solution. + [!] jsc help shows only a few lines <---- nw.js' problem [x] vm.panic redefine was in 3hta/quit.f , move to 3htm/f/jsc.f - [x]3hta [x]3htm [x]3nw - [x]3nd + [x]3hta [x]3htm [x]3nw + [x]3nd [x] the --- save selftest.log --- thing in all quit.f can be removed - [x]3hta [x]3htm [x]3nw - [x]3nd + [x]3hta [x]3htm [x]3nw + [x]3nd [x] playground 裡面的 project-k things 可以清除了 [x] panic()'s state.level should be state.serious because it's used as a boolean. [x] needs a global name for the jeforthVM, so let it be - var jeforth_project_k_virtual_machine_object = new jeForth() - var kvm = jeforth_project_k_virtual_machine_object; - 裡要重新取得 vm through jeforth_project_k_virtual_machine_object - 全部都叫 vm 感覺也不好, init module 裡維持作 kvm, 因為 vm 聽起來是一個自稱, 事 - 實亦然。 - [x]3hta [x]3htm [x]3nw <----- 目前只 3hta 有用到。 - [x]3nd <-------- global.kvm = global.jeforth_project_k... = new jeForth(); + var jeforth_project_k_virtual_machine_object = new jeForth() + var kvm = jeforth_project_k_virtual_machine_object; + 裡要重新取得 vm through jeforth_project_k_virtual_machine_object + 全部都叫 vm 感覺也不好, init module 裡維持作 kvm, 因為 vm 聽起來是一個自稱, 事 + 實亦然。 + [x]3hta [x]3htm [x]3nw <----- 目前只 3hta 有用到。 + [x]3nd <-------- global.kvm = global.jeforth_project_k... = new jeForth(); [ ] vm 在 initial module (index.html) 裡只用來加掛 jeforth.f 需要的東西,主要是 I/O。 - 此外的東西都不該出現在 vm 下的第一層, 但在 vm.g 以下則 OK. [ ] 畫圖說明 - 這是為求整套系統 building blocks 之間的簡單明了。 - [ ] 手工 js> vm obj>keys . 列出所有 members 一一檢討。 - 3nw: > js> vm obj>keys . - major_version,execute,dictate,stack,rstack,words,dictionary,gui,appname, - selftest_visible,minor_version,host,path,screenbuffer,type,greeting,panic, - debug,fso,readTextFile,writeTextFile,prompt,argv,bye,clearScreen,plain,g, - [ ] --> inputbox - [ ] --> jsc - [ ] --> cmdhistory - [ ] --> forthConsoleHandler - 3hta: > js> vm obj>keys . - major_version,execute,dictate,stack,rstack,words,dictionary,appname,host,path, - selftest_visible,plain,type,greeting,debug,screenbuffer,prompt,ado,argv,bye, - clearScreen,panic,writeTextFile,readTextFile,g,process,fso,BinaryStream, - [ ] --> push,pop, - [ ] --> BinaryFile,objWMIService - [ ] --> vbscript, - [ ] --> jsc,cmdhistory, - [ ] --> forthConsoleHandler, - [ ] --> inputbox,EditMode, - 3nd: - major_version,execute,dictate,stack,rstack,words,dictionary,host,appname,path, - screenbuffer,selftest_visible,type,clearScreen,panic,greeting,fso,readTextFile, - writeTextFile,bye,gets,debug,prompt,argv,exec,stdio,g - [ ] --> jsc, - [ ] --> forthConsoleHandler, + 此外的東西都不該出現在 vm 下的第一層, 但在 vm.g 以下則 OK. [ ] 畫圖說明 + 這是為求整套系統 building blocks 之間的簡單明了。 + [ ] 手工 js> vm obj>keys . 列出所有 members 一一檢討。 + 3nw: > js> vm obj>keys . + major_version,execute,dictate,stack,rstack,words,dictionary,gui,appname, + selftest_visible,minor_version,host,path,screenbuffer,type,greeting,panic, + debug,fso,readTextFile,writeTextFile,prompt,argv,bye,clearScreen,plain,g, + [ ] --> inputbox + [ ] --> jsc + [ ] --> cmdhistory + [ ] --> forthConsoleHandler + 3hta: > js> vm obj>keys . + major_version,execute,dictate,stack,rstack,words,dictionary,appname,host,path, + selftest_visible,plain,type,greeting,debug,screenbuffer,prompt,ado,argv,bye, + clearScreen,panic,writeTextFile,readTextFile,g,process,fso,BinaryStream, + [ ] --> push,pop, + [ ] --> BinaryFile,objWMIService + [ ] --> vbscript, + [ ] --> jsc,cmdhistory, + [ ] --> forthConsoleHandler, + [ ] --> inputbox,EditMode, + 3nd: + major_version,execute,dictate,stack,rstack,words,dictionary,host,appname,path, + screenbuffer,selftest_visible,type,clearScreen,panic,greeting,fso,readTextFile, + writeTextFile,bye,gets,debug,prompt,argv,exec,stdio,g + [ ] --> jsc, + [ ] --> forthConsoleHandler, [x] jsc.prompt are "undefined" when it was from panic [x] project-k kernel porting done. Merge to jeforth.3we master. - --> Click "Pull" on "GitHub for Windows" --> "Pull request created" --> - 一頓亂搞解決 git merge 的問題 --> 好像是先切到 master, 然後 git merge the-working-branch。 - 會在 local 產生一個特別的版本, 其中如果有問題必須在 local 解決, 否則無法 push 上雲端。 + --> Click "Pull" on "GitHub for Windows" --> "Pull request created" --> + 一頓亂搞解決 git merge 的問題 --> 好像是先切到 master, 然後 git merge the-working-branch。 + 會在 local 產生一個特別的版本, 其中如果有問題必須在 local 解決, 否則無法 push 上雲端。 [x] 3nd 的 version 顯示沒有照新 style. - j e f o r t h . 3 n d -- r2 <============== should be major.minor - Node.js v0.12.4 ... snip .... - --> refer to 3htm's index.html + j e f o r t h . 3 n d -- r2 <============== should be major.minor + Node.js v0.12.4 ... snip .... + --> refer to 3htm's index.html [ ] ie.f shell.application.f 這種大題目要另外深入探討。 [x] inputbox arrow keys can be smarter. When it's empty, recall commands, otherwise - it moves cursor. <--- for [x]3hta, [x]3htm, [x]3nw they share the same platform.f - --> redefine 3htm/f/platform.f {up} {down} - --> 想錯了! 第一下可以 recall older command, 再一下因為 inputbox 已非 empty 就不行了。 - 故 up down 應該 launch alt-up history-selector 而非 ctrl-up ctrl-down recall。 - [x] ctrl-up,down 不會整理跨行的 textarea, alt-up history-selector 則會。兩者還是有一點 - 差別。故保留 ctrl-up ctrl-down 仍有效。 - [!] Chrome 3htm inputbox ^m 無效! 3hta ok,任其自然。 - [x] case 77: /* m */ ^m 在 HTA textarea 裡本來就有效。在 Chrome 無效也無法簒改 - e.keyCode。仿 excel 用 Alt-Enter 也不成功。難道只能切 EditMode? 但為什麼 EditMode - 有效? 因為 Alt-Enter 被 Chrome textarea 處裡掉了所以無效。 - --> 那就改用 shift-Enter 呀! ==> B i n g o ! ! - non-EditMode 想換行用 Shift-Enter 避免把命令發出去 - EditMode 用 Ctrl-Enter 發出命令 - [x] 下過命令自動取消 EditMode。 + it moves cursor. <--- for [x]3hta, [x]3htm, [x]3nw they share the same platform.f + --> redefine 3htm/f/platform.f {up} {down} + --> 想錯了! 第一下可以 recall older command, 再一下因為 inputbox 已非 empty 就不行了。 + 故 up down 應該 launch alt-up history-selector 而非 ctrl-up ctrl-down recall。 + [x] ctrl-up,down 不會整理跨行的 textarea, alt-up history-selector 則會。兩者還是有一點 + 差別。故保留 ctrl-up ctrl-down 仍有效。 + [!] Chrome 3htm inputbox ^m 無效! 3hta ok,任其自然。 + [x] case 77: /* m */ ^m 在 HTA textarea 裡本來就有效。在 Chrome 無效也無法簒改 + e.keyCode。仿 excel 用 Alt-Enter 也不成功。難道只能切 EditMode? 但為什麼 EditMode + 有效? 因為 Alt-Enter 被 Chrome textarea 處裡掉了所以無效。 + --> 那就改用 shift-Enter 呀! ==> B i n g o ! ! + non-EditMode 想換行用 Shift-Enter 避免把命令發出去 + EditMode 用 Ctrl-Enter 發出命令 + [x] 下過命令自動取消 EditMode。 [/] rename ntib to itib ok? think about it. --> forget it. [ ] 要不要突破第一行的限制? - --> In a code word definition, the ( foo ) \ baa must be at the first line with 'code' or - it's an error for JavaScript. + --> In a code word definition, the ( foo ) \ baa must be at the first line with 'code' or + it's an error for JavaScript. [x] HTA's vm.beep 本來在 platform.f 有用到, 改成 execute("beep") 把 vm.beep 取消。 - beep 也算是 I/O 定義成 vm.beep() 似乎有理。但既然可以用 execute("beep"), 還是不要的好。 - [x]3hta, [n/a]3htm, [ ]3nw, [ ]3nd + beep 也算是 I/O 定義成 vm.beep() 似乎有理。但既然可以用 execute("beep"), 還是不要的好。 + [x]3hta, [n/a]3htm, [ ]3nw, [ ]3nd [ ] Thinking of how to improve the user experience on http://www.figtaiwan.org/project/jeforth/jeforth.3we-master/, - I found a wonderful web page design helper called contentBuilder.js http://www.online-html-editor.org/. - It's beautiful and it can help us to convert a picture into base64 embeded HTML code. Good for jeforth - to have embeded pictures. - [ ] Use contentBuilder.js' online editor to design what I want to show on jeforth.3htm online. Then pay - some money to find a front end designer to translate into HTML. - http://www.online-html-editor.org/ + I found a wonderful web page design helper called contentBuilder.js http://www.online-html-editor.org/. + It's beautiful and it can help us to convert a picture into base64 embeded HTML code. Good for jeforth + to have embeded pictures. + [ ] Use contentBuilder.js' online editor to design what I want to show on jeforth.3htm online. Then pay + some money to find a front end designer to translate into HTML. + http://www.online-html-editor.org/ [x] 3hta to support both ado and fso switch - --> What happened if use fso? <--- see "HTA does not work with utf-8 with BOM" above - git.f 讀一半就會出錯, 因為有用到中文 word name。 - --> What happened if use ado? - "Safety Settings on this computer prohibit accessing a data source on another domain" - https://www.evernote.com/shard/s22/nl/2472143/db532ac2-04d1-4618-9fc9-e81dc3ed1d0a - [x] 2. HTA 版用 fso 開始, 看到 Windows 8 以上自動改用 ADO (file system) + --> What happened if use fso? <--- see "HTA does not work with utf-8 with BOM" above + git.f 讀一半就會出錯, 因為有用到中文 word name。 + --> What happened if use ado? + "Safety Settings on this computer prohibit accessing a data source on another domain" + https://www.evernote.com/shard/s22/nl/2472143/db532ac2-04d1-4618-9fc9-e81dc3ed1d0a + [x] 2. HTA 版用 fso 開始, 看到 Windows 8 以上自動改用 ADO (file system) [x] project-k can't use string.trim(), Windows XP JScript does not support that. - String.replace(/(^( |\t)*)|(( |\t)*$)/mg,''); // remove 頭尾 whitespaces. .trim() 舊 JScript v5.6 未 support + String.replace(/(^( |\t)*)|(( |\t)*$)/mg,''); // remove 頭尾 whitespaces. .trim() 舊 JScript v5.6 未 support [x] Windows XP can run jeforth.hta now. But can't readTextFile due to the error of : - "JavaScript error : Safety settings on this computer prohibit accessing a data - source on another domain." ===> 放棄 Windows XP. + "JavaScript error : Safety settings on this computer prohibit accessing a data + source on another domain." ===> 放棄 Windows XP. [/] Try Windows 7. ==> Windows 7 不一定可以順利執行, 乾脆偵測到發個警告。 - [/] 偵測 OS version needs objWMIService which is too late and is used, too late. - I wish HTA supports something to tell OS version? - --> jeforth.hta uses the below method to distinguish Windows version: - if(document.getElementsByClassName){ - document.getElementsByClassName('appname')[0].innerHTML=kvm.appname; - document.getElementsByClassName('appname')[1].innerHTML=kvm.appname; - } else{ - alert("Warning: Your system is old, IE10 or newer preferred. Try Windows upgrade."); - } - ==> Give up Windows 7 + [/] 偵測 OS version needs objWMIService which is too late and is used, too late. + I wish HTA supports something to tell OS version? + --> jeforth.hta uses the below method to distinguish Windows version: + if(document.getElementsByClassName){ + document.getElementsByClassName('appname')[0].innerHTML=kvm.appname; + document.getElementsByClassName('appname')[1].innerHTML=kvm.appname; + } else{ + alert("Warning: Your system is old, IE10 or newer preferred. Try Windows upgrade."); + } + ==> Give up Windows 7 [x] How to tell Windows version? - > objEnumWin32_OperatingSystem :> item().Version . - 6.2.9200 Win 8, 6.1.7601 Win 7, 10.0.10240 Win 10 + > objEnumWin32_OperatingSystem :> item().Version . + 6.2.9200 Win 8, 6.1.7601 Win 7, 10.0.10240 Win 10 [x] 自動判斷, Windows 8 以上就自動切 ado 否則續用 fso。 [x] Windows 7 compatibliity - [x] wmi.f Win32_OperatingSystem selftest memory 本來要求 > 2G 改成 > 128M - [x] skip html5.f appendChild selftest if IE/HTA too old. Check document.getElementsByClassName existance. - [x] html5.f selftest createElement aaa will become AAA on newer IE/HTA but Win7 older IE/HTA will not. + [x] wmi.f Win32_OperatingSystem selftest memory 本來要求 > 2G 改成 > 128M + [x] skip html5.f appendChild selftest if IE/HTA too old. Check document.getElementsByClassName existance. + [x] html5.f selftest createElement aaa will become AAA on newer IE/HTA but Win7 older IE/HTA will not. [x] ~.bat 的 path 設定使 jeforth.3we 對別人很難用。統一 install 方法,去個人化。 - 要求 node.js 先裝好, node.exe 入 path, nw.js 整個 copy 到 node.js home folder 因此 - nw.exe 也入了 path。 - [x] 修改文件, how to run 要改良說明。 + 要求 node.js 先裝好, node.exe 入 path, nw.js 整個 copy 到 node.js home folder 因此 + nw.exe 也入了 path。 + [x] 修改文件, how to run 要改良說明。 [x] 3nw's quit.f needs a jump focus at the end. [x] eforth.com selftest needs a rewrite --> Done. [x] bug - > help ShellWindows <--- also all other constants!! - JavaScript error on word "(words)" : Object doesn't support property or method 'toLowerCase' - JavaScript error on word "(help)" : Object doesn't support this property or method - JavaScript error on word "help" : Object doesn't support this property or method - --> check help calls (help) calls (words) <--- only one, see (help) shit!! - help and (help) are : Modified by platform.f for HTML table. - --> platform.f is common among 3htm too, so it's easy to debug --> try 3nw --> but 3nw is ok on help - --> include ie.f makes the problem? No. - --> not the experiment, - --> the problem has gone after restart jeforth.hta. + > help ShellWindows <--- also all other constants!! + JavaScript error on word "(words)" : Object doesn't support property or method 'toLowerCase' + JavaScript error on word "(help)" : Object doesn't support this property or method + JavaScript error on word "help" : Object doesn't support this property or method + --> check help calls (help) calls (words) <--- only one, see (help) shit!! + help and (help) are : Modified by platform.f for HTML table. + --> platform.f is common among 3htm too, so it's easy to debug --> try 3nw --> but 3nw is ok on help + --> include ie.f makes the problem? No. + --> not the experiment, + --> the problem has gone after restart jeforth.hta. [x] element.f 的 ce@ 有防呆,會自動剔除非 element objects 回復到前一個有效的 element。 - 但沒有警告, 今加上。 2015/10/5 14:14 + 但沒有警告, 今加上。 2015/10/5 14:14 [x] ie.f 裡寫出 - : remove-script-from-element ( element -- ) \ Through jQuery, the element will be modified. - js> $("script",pop()) ( jqObject ) - - for (var i=0; i - ( jqObject ) drop ; - /// The given element 可以是某個 IE 頁面不一定在本地。 - /// document js> $("*",pop())[0] ( the web page ) - /// remove-script-from-element \ document is trimed now - /// document :> body.innerHTML \ No script trouble + : remove-script-from-element ( element -- ) \ Through jQuery, the element will be modified. + js> $("script",pop()) ( jqObject ) + + for (var i=0; i + ( jqObject ) drop ; + /// The given element 可以是某個 IE 頁面不一定在本地。 + /// document js> $("*",pop())[0] ( the web page ) + /// remove-script-from-element \ document is trimed now + /// document :> body.innerHTML \ No script trouble [/] Strange, Windows 10 T550 makes an unknown JavaScript error by, - shell.application :> windows().item(0).document . - jsc: vm.g.ShellWindows.item(parseInt(vm.g.theIE)).document - --> try older version --> master is old, same problem on the T550. --> cold boot --> same problem. --> Windows update ... - --> try S7 Win8 --> OK no such problem. - --> !!! try other Windows 10 computer --> an UUD in the lab 10.0.10546 is ok!! so it's T550's problem. - --> but it appears like [object HTMLDocument] while S7 Win8 appears [object Document], different! - --> try Windows 10 at home --> it's ok. + shell.application :> windows().item(0).document . + jsc: vm.g.ShellWindows.item(parseInt(vm.g.theIE)).document + --> try older version --> master is old, same problem on the T550. --> cold boot --> same problem. --> Windows update ... + --> try S7 Win8 --> OK no such problem. + --> !!! try other Windows 10 computer --> an UUD in the lab 10.0.10546 is ok!! so it's T550's problem. + --> but it appears like [object HTMLDocument] while S7 Win8 appears [object Document], different! + --> try Windows 10 at home --> it's ok. [x] box2dweb-arrow.f 在 arrow.js 裡為了要把物理引擎的 world 傳出來給 jeforth 必須要 - 用到 vm.push 而vm 裡偏偏沒有 push, 從 kernel jeforth.js 裡把它們 export 出來吧! - --> 修改 project-k jeforth.js. - --> vb.f 也要簡化, 先前是它自己定義 vm.push vm.pop 可以拿掉了。 - [x] 同時, arrow.js 裡看不見 vm 因為 vm 是 project-k kernel jeforth.js 裡的自稱,外面 - 看不見. 而 kvm 是 jeforth.hta 給的 instance name 是個 global 所以 arrow.js 裡可 - 以看見。但是 arrow.js 不要用 kvm 而用 jeforth_project_k_virtual_machine_object - 來取得 vm。 + 用到 vm.push 而vm 裡偏偏沒有 push, 從 kernel jeforth.js 裡把它們 export 出來吧! + --> 修改 project-k jeforth.js. + --> vb.f 也要簡化, 先前是它自己定義 vm.push vm.pop 可以拿掉了。 + [x] 同時, arrow.js 裡看不見 vm 因為 vm 是 project-k kernel jeforth.js 裡的自稱,外面 + 看不見. 而 kvm 是 jeforth.hta 給的 instance name 是個 global 所以 arrow.js 裡可 + 以看見。但是 arrow.js 不要用 kvm 而用 jeforth_project_k_virtual_machine_object + 來取得 vm。 [x] 昨天忘了 push proejct-k, 在辦公室 vm.push vm.pop 還是沒有, 先用 quit.f 應急. 回家記得 push & 拿掉。 - working on branch release-3.1 <--- done + working on branch release-3.1 <--- done [x] release 3.1 之後 master == develop 如何複查? - --> S7 checkout to develop, T550 checkout to master - --> compare the two folders via Total Commander > menu : Commands > Synchronize Dirs... - 依內容 compare 只看 != 者, 忽略 .git folders. 證實無誤。 + --> S7 checkout to develop, T550 checkout to master + --> compare the two folders via Total Commander > menu : Commands > Synchronize Dirs... + 依內容 compare 只看 != 者, 忽略 .git folders. 證實無誤。 [x] User suffering problem, jeforth.3we and project-k are separated they don't know, release new README.md - immediately!!! ---> README.md improved - [x] but an even better arrangement is expected. --> Simply : git add -f project-k/jeforth.js + immediately!!! ---> README.md improved + [x] but an even better arrangement is expected. --> Simply : git add -f project-k/jeforth.js [x] Test downlaod jeforth.3we.zip from GitHub, run it, failed !!! <== unix2dos.exe is the solution - reDef code - JavaScript error on word "code" : Expected '}' - reDef code - JavaScript error on word "code" : Invalid character - Error! ; is compile-only. - Error! ; is compile-only. - Error! ; is compile-only. - Error! word is compile-only. - reDef \s - --> stop in quit.f no work. problem in jeforth.f - --> Stop right after reDef code, copy-paste the entire remaining jeforth.f ... PASS! - so what's the matter? - --> Strange, when defining init, the error message appears. But copy-pase ok. - JavaScript error on word "code" : Expected '}' - --> define init-debug which is mirror of init before init. stop before init, Binary search the problem. - --> gotcha ! vm.g.isSameArray = function (a,b) - --> RI! 竟然是中文 comment 的問題, 因為程式一開始是用 fso 而問題直接就發生在 jeforth.f 裡。 - ==> 中文 comment 之後加幾個 space 即可避免。<---- 誤導了!這是個已知的問題, 有 config setting 可以設定. - clone 下來的沒問題, 但是 [Download Zip] 下來的有問題因為 push 上去時 CRLF 被換成 LF, pull 下來時會自動 - 又把 LF 換回 CRLF, clone 下來時也無誤. 我猜 [Download Zip] 直接把雲端的 repo 打包下來時沒有做轉換, 所 - 以都是 LF 因而出問題。 - See http://www.cnblogs.com/flying_bat/archive/2013/09/16/3324769.html - --> 試過了, 只有 3hta 會這樣。3nw, 3nd, 3htm 都 ok. 所以要從 jeforth.hta 下手自己解決這個問題。 - --> 整個 project 已經 run 很久了, cloud 端都被轉換成 LF 了, 這至少對 project-k 是好事. 因為號稱它在所有 - 有 JavaScript 的地方都能用, 一見面就卡在 CRLF(MS), CR(Apple), LF(Linux) 的問題上不好。 - [x] 值得研究!! jeforth.hta should recover this problem in readTextFile and writeTextFile. - ==> jeforth.3we-develop.zip 就應該先處理好, 執行 jeforth.hta 時若未處裡已經太晚了, unix2dos.exe is the solution - [x] make sure Chinese text files HTA created, Big5, utf-8, and GB2312 are all 0D0A/CRLF conflict free - --> Write a Chinese or pure English string from HTA to a file, check the file, ---> it's utf-8/BOM that - has a EF BB BF at beginning. Always. Because my method is ado I guess --> Yes. New line is only LF 0A - --> switch to fso and try again --> Yes! switch to fso then there's no BOM so it's not utf-8 but a plain - text if it's English and Big5 for Chinese. New line is also only LF 0A. - --> '想' charCodeAt() is unicode 60-f3, Big5 is B7-51, utf-8 is E6-83-B3, GBK is CF-EB (saved from notepad++) - Online character code lookup http://bianma.supfree.net/sos.asp?id=12054 - --> GB2312 coded file readTextFile 結果 HTA 會把每個不認得的 code 逐 byte 用 65533 (0xfffd) 取代。 - 所以 '義' C1-78 讀進來變成 2 個 character [65533][120] (0x78 == 120)。讀進不認得的編碼沒救,因 - 為一堆都被 65533 替換掉了。 - --> 本來是 0A 或 0D 0A 皆保留 fso ado 都不會動他們。 <==== 錯! - [@] 解法就是, 先把所有的 charCodeAt(i) == 13 的都刪掉, 然後把所有的 charCodeAt(i) == 10 的都 - insert 13 改成 13 10. - binary-string>array - var aa=[11,22,33,44]; aa.splice(2,1); aa \ ==> 11,22,44 (array) - binary-array>string - ==> 無效, fso 一讀進 utf-8 就已經亂了。亂了再處理已經來不及。 - <無效取消> - [@] guaranteeCRLF (ss) // return a new string with new lines be CRLF - ok now, but read -> write file test still failed. --> device a way to see the actual file read by readTextFile - code remove-all-CR ( string -- string' ) \ Remove all CR 13 from the string - var aa = pop(), bb = ""; - for(var i=0; i write it to a file - code test - var ff = readTextFile_fso("f/jeforth.f"); - writeTextFile_fso ("ff.f", ff); - end-code - - --> 總之, 用 charCodeAt() 不用擔心會看錯, 0d 0a 看到了就是 CR LF 不會錯。 <=== 錯! - --> 錯了! - --> 看到問題了, 中文 comment 之後的 CRLF 真的有問題,把下行的 } 給吃上來了! - --> 因為 fso 不認得 utf-8 中文 - utf-8 中文行尾用 fso 讀進來會被搞亂, 行尾的 0A 不見了!!! <--- root cause - --> 隨便用個中文檔 fso 去讀應該可以複製現象... Bingo!! ... shit! 上面的實驗不夠周延。 - --> 實際上隨便一個 utf-8 中文檔, 用 fso 讀近來都會有 LF 或 CRLF 被吃掉的現象! - 解法曾考慮加強成 20 0D 0A 而非單 0D 0A, 但 fso 一讀進來就已經亂了!來不及做任何補救。 - --> 如果來源是 0D 0A 可能真的有助於避免 fso 把 0A 吃掉? ==> Bingo!! 完全正確。 - [x] 這下子 GitHub 的 CRLF 問題又陷入膠著了... 因為 fso 一讀進來單 LF 0A 的檔案就已經亂了。 - ( ) 看來 jeforth.f quit.f 等, 用 fso 讀進來的 module 都不能用 utf-8 而必須用 Big5 - (x) 主要檔案不要用中文。<---- 寫個程式來檢查 "string".charCodeAt(i) > 128 的就可能 - 是問題。 - code ansi? ( string -- T/F ) \ The string is all ANSI characters? (code < 128) - var ss = pop(), flag = true; - for (var i=0; i 128) { - flag = false; - type(ss.slice(i,i+20+'\n')); - i += 20; - } - } - push(flag); - end-code - ( ) 自動挑選正確編碼的 jeforth.js e.g. jeforth-big5.js, jeforth-utf8.js 跟相關檔案。 - ( ) 乾脆不 support Windows 7 以前的版本, 就可以不用 fso 直接都用 ado。 - [x] [Download Zip] extract 之後用轉碼程式先處理過, 很簡單: - ~\jeforth.3we>for /R %G in (*.*) do c:\your-path\bin\unix2dos.exe "%G" + reDef code + JavaScript error on word "code" : Expected '}' + reDef code + JavaScript error on word "code" : Invalid character + Error! ; is compile-only. + Error! ; is compile-only. + Error! ; is compile-only. + Error! word is compile-only. + reDef \s + --> stop in quit.f no work. problem in jeforth.f + --> Stop right after reDef code, copy-paste the entire remaining jeforth.f ... PASS! + so what's the matter? + --> Strange, when defining init, the error message appears. But copy-pase ok. + JavaScript error on word "code" : Expected '}' + --> define init-debug which is mirror of init before init. stop before init, Binary search the problem. + --> gotcha ! vm.g.isSameArray = function (a,b) + --> RI! 竟然是中文 comment 的問題, 因為程式一開始是用 fso 而問題直接就發生在 jeforth.f 裡。 + ==> 中文 comment 之後加幾個 space 即可避免。<---- 誤導了!這是個已知的問題, 有 config setting 可以設定. + clone 下來的沒問題, 但是 [Download Zip] 下來的有問題因為 push 上去時 CRLF 被換成 LF, pull 下來時會自動 + 又把 LF 換回 CRLF, clone 下來時也無誤. 我猜 [Download Zip] 直接把雲端的 repo 打包下來時沒有做轉換, 所 + 以都是 LF 因而出問題。 + See http://www.cnblogs.com/flying_bat/archive/2013/09/16/3324769.html + --> 試過了, 只有 3hta 會這樣。3nw, 3nd, 3htm 都 ok. 所以要從 jeforth.hta 下手自己解決這個問題。 + --> 整個 project 已經 run 很久了, cloud 端都被轉換成 LF 了, 這至少對 project-k 是好事. 因為號稱它在所有 + 有 JavaScript 的地方都能用, 一見面就卡在 CRLF(MS), CR(Apple), LF(Linux) 的問題上不好。 + [x] 值得研究!! jeforth.hta should recover this problem in readTextFile and writeTextFile. + ==> jeforth.3we-develop.zip 就應該先處理好, 執行 jeforth.hta 時若未處裡已經太晚了, unix2dos.exe is the solution + [x] make sure Chinese text files HTA created, Big5, utf-8, and GB2312 are all 0D0A/CRLF conflict free + --> Write a Chinese or pure English string from HTA to a file, check the file, ---> it's utf-8/BOM that + has a EF BB BF at beginning. Always. Because my method is ado I guess --> Yes. New line is only LF 0A + --> switch to fso and try again --> Yes! switch to fso then there's no BOM so it's not utf-8 but a plain + text if it's English and Big5 for Chinese. New line is also only LF 0A. + --> '想' charCodeAt() is unicode 60-f3, Big5 is B7-51, utf-8 is E6-83-B3, GBK is CF-EB (saved from notepad++) + Online character code lookup http://bianma.supfree.net/sos.asp?id=12054 + --> GB2312 coded file readTextFile 結果 HTA 會把每個不認得的 code 逐 byte 用 65533 (0xfffd) 取代。 + 所以 '義' C1-78 讀進來變成 2 個 character [65533][120] (0x78 == 120)。讀進不認得的編碼沒救,因 + 為一堆都被 65533 替換掉了。 + --> 本來是 0A 或 0D 0A 皆保留 fso ado 都不會動他們。 <==== 錯! + [@] 解法就是, 先把所有的 charCodeAt(i) == 13 的都刪掉, 然後把所有的 charCodeAt(i) == 10 的都 + insert 13 改成 13 10. + binary-string>array + var aa=[11,22,33,44]; aa.splice(2,1); aa \ ==> 11,22,44 (array) + binary-array>string + ==> 無效, fso 一讀進 utf-8 就已經亂了。亂了再處理已經來不及。 + <無效取消> + [@] guaranteeCRLF (ss) // return a new string with new lines be CRLF + ok now, but read -> write file test still failed. --> device a way to see the actual file read by readTextFile + code remove-all-CR ( string -- string' ) \ Remove all CR 13 from the string + var aa = pop(), bb = ""; + for(var i=0; i write it to a file + code test + var ff = readTextFile_fso("f/jeforth.f"); + writeTextFile_fso ("ff.f", ff); + end-code + + --> 總之, 用 charCodeAt() 不用擔心會看錯, 0d 0a 看到了就是 CR LF 不會錯。 <=== 錯! + --> 錯了! + --> 看到問題了, 中文 comment 之後的 CRLF 真的有問題,把下行的 } 給吃上來了! + --> 因為 fso 不認得 utf-8 中文 + utf-8 中文行尾用 fso 讀進來會被搞亂, 行尾的 0A 不見了!!! <--- root cause + --> 隨便用個中文檔 fso 去讀應該可以複製現象... Bingo!! ... shit! 上面的實驗不夠周延。 + --> 實際上隨便一個 utf-8 中文檔, 用 fso 讀近來都會有 LF 或 CRLF 被吃掉的現象! + 解法曾考慮加強成 20 0D 0A 而非單 0D 0A, 但 fso 一讀進來就已經亂了!來不及做任何補救。 + --> 如果來源是 0D 0A 可能真的有助於避免 fso 把 0A 吃掉? ==> Bingo!! 完全正確。 + [x] 這下子 GitHub 的 CRLF 問題又陷入膠著了... 因為 fso 一讀進來單 LF 0A 的檔案就已經亂了。 + ( ) 看來 jeforth.f quit.f 等, 用 fso 讀進來的 module 都不能用 utf-8 而必須用 Big5 + (x) 主要檔案不要用中文。<---- 寫個程式來檢查 "string".charCodeAt(i) > 128 的就可能 + 是問題。 + code ansi? ( string -- T/F ) \ The string is all ANSI characters? (code < 128) + var ss = pop(), flag = true; + for (var i=0; i 128) { + flag = false; + type(ss.slice(i,i+20+'\n')); + i += 20; + } + } + push(flag); + end-code + ( ) 自動挑選正確編碼的 jeforth.js e.g. jeforth-big5.js, jeforth-utf8.js 跟相關檔案。 + ( ) 乾脆不 support Windows 7 以前的版本, 就可以不用 fso 直接都用 ado。 + [x] [Download Zip] extract 之後用轉碼程式先處理過, 很簡單: + ~\jeforth.3we>for /R %G in (*.*) do c:\your-path\bin\unix2dos.exe "%G" [ ] jeforth.3hta 從 DOS box 下執行當然沒問題, 但是從 PowerShell 下執行就會有些 wsh.f 的 selftest 會過不了。 - 值得研究。 + 值得研究。 [ ] ie.f , Windows 10 , observed vm.g.ShellWindows.count==2 but both are null. [ ] Jump into jsc due to error then ESC is to go on the ongoing process, ok fine but - how to terminate the entire system? We need a jsc abort command? + how to terminate the entire system? We need a jsc abort command? [ ] A gh-pages branch which was created via GitHub .... don't know what it is for? - --> Ah! it's the project's web page!! I should use it. + --> Ah! it's the project's web page!! I should use it. [ ] project-k/jeforth.js >> vm.major_version = 2; // major version, jeforth.js kernel version. - --> 應該如實稱作 kernel_version 才對。 + --> 應該如實稱作 kernel_version 才對。 [ ] 'document' command 經常觸發 JavaScript 無名 error. 即使不用 ShellWindows 而直接取得 IE - object 如下, 經實驗證實這個 object 跟 sw.item(i) 是同一個,所以對這個無名 error 無助。 - var ie = new ActiveXObject('InternetExplorer.Application'); ie onstant InternetExplorer.Application - ==> 先嘗試 Chrome automation - ==> Try autoit - ==> Try jeforth.3wsh + object 如下, 經實驗證實這個 object 跟 sw.item(i) 是同一個,所以對這個無名 error 無助。 + var ie = new ActiveXObject('InternetExplorer.Application'); ie onstant InternetExplorer.Application + ==> 先嘗試 Chrome automation + ==> Try autoit + ==> Try jeforth.3wsh [x] 16:36 2015-11-09 Study how to publish jeforth.3htm directly from GitHub through rawgit.com. - 16:43 2015-11-09 It really works! Both baby.html and sample.html - http://rawgit.com/hcchengithub/project-k/master/baby.html - http://rawgit.com/hcchengithub/project-k/master/sample.html - [x] How to make a release, so as to try rawgit - Releases 有專門一群說明點 https://help.github.com/categories/releases/ - 原來 release 是從 GitHub.com 網頁上執行的,所以可以提供 binary 檔。 - ** rawgit 使用方法 ** - 到了 rawgit.com home page 它直接讓你輸入[Paste a GitHub file or Gist URL here]. - 如果輸入的位址是錯的,它不會有反應; 必須輸入對了,底下的測試版、production 版 URL - 才會自動反映出來。正確的輸入內容是從 GitHub.com 網址列抄過來的 - https://github.com/hcchengithub/project-k + '/master/' + 'filename' - 所組成。我把 project-k release 了一版 1.0 而 1.0 就是這版的 release_name 也就是 - branch name. - 輸入: - "https://github.com/hcchengithub/project-k/master/1.0/baby.html" - 得到: - "http://cdn.rawgit.com/hcchengithub/project-k/master/1.0/baby.html" - 但是這個不能用,要把 master 刪掉才可以, 變成: - "https://cdn.rawgit.com/hcchengithub/project-k/1.0/baby.html" - 就好了! + 16:43 2015-11-09 It really works! Both baby.html and sample.html + http://rawgit.com/hcchengithub/project-k/master/baby.html + http://rawgit.com/hcchengithub/project-k/master/sample.html + [x] How to make a release, so as to try rawgit + Releases 有專門一群說明點 https://help.github.com/categories/releases/ + 原來 release 是從 GitHub.com 網頁上執行的,所以可以提供 binary 檔。 + ** rawgit 使用方法 ** + 到了 rawgit.com home page 它直接讓你輸入[Paste a GitHub file or Gist URL here]. + 如果輸入的位址是錯的,它不會有反應; 必須輸入對了,底下的測試版、production 版 URL + 才會自動反映出來。正確的輸入內容是從 GitHub.com 網址列抄過來的 + https://github.com/hcchengithub/project-k + '/master/' + 'filename' + 所組成。我把 project-k release 了一版 1.0 而 1.0 就是這版的 release_name 也就是 + branch name. + 輸入: + "https://github.com/hcchengithub/project-k/master/1.0/baby.html" + 得到: + "http://cdn.rawgit.com/hcchengithub/project-k/master/1.0/baby.html" + 但是這個不能用,要把 master 刪掉才可以, 變成: + "https://cdn.rawgit.com/hcchengithub/project-k/1.0/baby.html" + 就好了! [ ] 問題是從 rawgit.com 或 cdn.rawgit.com 上執行都很容易出現 jquery loading 失敗。 - Ctrl-Enter 無效時,進 F12 debugger 即見該 error message。Refresh 幾次就會成功。 - [ ] 想讓 index.html 檢查看 jquery 有沒有 load 成功。 - [ ] 研究為何有這種情形? - ==> 寫一個簡單的 index.html 裡面就是 include jquery 跟檢查。看能不能複製問題出來。 - ==> https://rawgit.com/hcchengithub/jeforth.3we/develop/index.html?nop - run 得很好。 + Ctrl-Enter 無效時,進 F12 debugger 即見該 error message。Refresh 幾次就會成功。 + [ ] 想讓 index.html 檢查看 jquery 有沒有 load 成功。 + [ ] 研究為何有這種情形? + ==> 寫一個簡單的 index.html 裡面就是 include jquery 跟檢查。看能不能複製問題出來。 + ==> https://rawgit.com/hcchengithub/jeforth.3we/develop/index.html?nop + run 得很好。 [x] 試跑 solar-system.f 剪貼上去的 code 好像內碼有問題。 [x] only cloth.f 的時候, words, help 等只列出 cloth.f。但是 forth words 總是常駐在 - order 裡面。為了避免礙眼。 - [x] re-design rescan-word-hash, let it always read 'forth' first even when it's - not in the 'order' list. - [x] 執行 code 的時候觸發 js error, 這時候 compiling 的質居然是 "code" - reDef code - JavaScript error on word "code" : Unexpected token ] - reDef cr - *** Start self-test - ==> 我猜是 bb 裡面有問題。把 bb 拿掉部分看 error msg 還在不在? - ==> 果然就是這行的問題。 - wordhash[words[v][i].name] = words[v]][i]; - 靠! 多了個 ] ------------------------^ - 結論是, code word 裡面要是有 typo 會有 error on word "code" 症狀會變成 - 定義中的 word 的 xt 變成前一個 word 的,而且該 error 觸發 Chrome F12 debugger 時, - compiling 的值是個字串 "code"。 + order 裡面。為了避免礙眼。 + [x] re-design rescan-word-hash, let it always read 'forth' first even when it's + not in the 'order' list. + [x] 執行 code 的時候觸發 js error, 這時候 compiling 的質居然是 "code" + reDef code + JavaScript error on word "code" : Unexpected token ] + reDef cr + *** Start self-test + ==> 我猜是 bb 裡面有問題。把 bb 拿掉部分看 error msg 還在不在? + ==> 果然就是這行的問題。 + wordhash[words[v][i].name] = words[v]][i]; + 靠! 多了個 ] ------------------------^ + 結論是, code word 裡面要是有 typo 會有 error on word "code" 症狀會變成 + 定義中的 word 的 xt 變成前一個 word 的,而且該 error 觸發 Chrome F12 debugger 時, + compiling 的值是個字串 "code"。 [x] hcchen5600 2015/11/13 10:46:37 - [solar-system.f] cloth.f 改寫,變成教材。 + [solar-system.f] cloth.f 改寫,變成教材。 [x] backspace, Esc, Enter, arrow keys 等這些 hotkey 都應該只侷限在 inputbox 裡面, - 以避免干擾其他操作。 + 以避免干擾其他操作。 [x] 撰寫 cloth.md / cloth.html ==> tutor-cloth.f is better !! [x] up/down 直接 recall history 有點煩, 改成 default disabled。 [x] 合併 [if][else][then][begin][again][until][for][next] 成對應的 if else ... etc - 想想挺困難。不如設計一個 run: 來假裝它可以 run interpret mode 而其實 - 只是把 if else then begin .. etc 等改成對應的 [if][else][then][begin] 再 - 交給 interpreter 執行。 - ==> run: and (run:) + 想想挺困難。不如設計一個 run: 來假裝它可以 run interpret mode 而其實 + 只是把 if else then begin .. etc 等改成對應的 [if][else][then][begin] 再 + 交給 interpreter 執行。 + ==> run: and (run:) [x] recall all vocabulary after only - get-vocs js> tos().length [for] js> tos().shift() . cr [next] drop - get-vocs js> tos().length [for] js: order.push(tos().shift()) [next] drop rescan-word-hash - ==> "not-only" command recalls all loaded vocabularies. + get-vocs js> tos().length [for] js> tos().shift() . cr [next] drop + get-vocs js> tos().length [for] js: order.push(tos().shift()) [next] drop rescan-word-hash + ==> "not-only" command recalls all loaded vocabularies. [x] vm.cv <--- is an inappropriate thing, should be vm.g.cv if it has to be - a global, and it is. - So cv will be a value, a global too. - ==> this is a bigger effort to modify all existing .f files. Done. + a global, and it is. + So cv will be a value, a global too. + ==> this is a bigger effort to modify all existing .f files. Done. [ ] This info seems a better way for ie.f to modify a web page - https://msdn.microsoft.com/en-us/library/jj733572.aspx#Date + https://msdn.microsoft.com/en-us/library/jj733572.aspx#Date [x] 寫個 word 來 escape ... 裡的 HTML tag signs. - o 規定 ... 不能 nested, 而且要依序出現。 - o ... 是最裡面的, 即
..
要包在外面。 - ==> code escape ( "raw string" -- "cooked string" ) \ Escape '<','>' in tag. - ==> In unindent.f now + o 規定 ... 不能 nested, 而且要依序出現。 + o ... 是最裡面的, 即
..
要包在外面。 + ==> code escape ( "raw string" -- "cooked string" ) \ Escape '<','>' in tag. + ==> In unindent.f now [x] tutor-cloth.f source code 本身的美感略顯不足,因為
 區段不能 indent。
-	構想是:設計一個 ... tag 用來把其中的整段落往左 shift 到有某一行
-	撞到左邊了為止。Tab \t 要先換成 spaces 幾個? 可調。
-	==> unindent.f done
+    構想是:設計一個 ... tag 用來把其中的整段落往左 shift 到有某一行
+    撞到左邊了為止。Tab \t 要先換成 spaces 幾個? 可調。
+    ==> unindent.f done
 
 [x] 發現 HTA Regular Expression 一個問題 (Windows 10 !!)
-	:> replace(/\/\*(.|\r|\n)*?\*\//mg,"") \ 清除註解。這樣寫在 Chrom OK, 在 HTA 不行。
-	:> replace(/[/]\*(.|\r|\n)*?\*[/]/mg,"") \ 要改成 "[/]" 來表達 "/" 不能用 "\/"。
-	[x] Test tutor-cloth.f on Chrome and IE after modification --> [/] works fine.
+    :> replace(/\/\*(.|\r|\n)*?\*\//mg,"") \ 清除註解。這樣寫在 Chrom OK, 在 HTA 不行。
+    :> replace(/[/]\*(.|\r|\n)*?\*[/]/mg,"") \ 要改成 "[/]" 來表達 "/" 不能用 "\/"。
+    [x] Test tutor-cloth.f on Chrome and IE after modification --> [/] works fine.
 
 [x] contentEditable 這麼好用, 真希望 jeforth.3htm 可以在 local 直接跑,而不必再透過 local server。
-	複習一下,Chrome 卡在這裡:
-	XMLHttpRequest cannot load file:///C:/Users/hcche/Documents/GitHub/jeforth.3we/f/jeforth.f?text.
-	Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension,
-	https, chrome-extension-resource.
-	---
-	問 Yap ,
-	[17:14:05] h.c.chen 陳厚成: jeforth 不透過 local server 真的就不能跑嗎? 卡在 XMLHttpRequest cannot load file ... ; Cross origin requests are only supported for protocol schemes ... ,
-	[17:16:20] h.c.chen 陳厚成: 因為用 JQuery 的 $.get 讀檔案, 例如 jeforth.f 就不行了。
-	[17:18:16] h.c.chen 陳厚成: ( 在網頁上跑的 jeforth )
-	[17:36:12] h.c.chen 陳厚成: 可能找到答案了
-	http://stackoverflow.com/questions/8449716/cross-origin-requests-are-only-supported-for-http-but-its-not-cross-domain
-	http://chrome-allow-file-access-from-file.com/
-	http://joshuamcginnis.com/2011/02/28/how-to-disable-same-origin-policy-in-chrome/
-	我試試看. . . . .
-	[17:39:26] h.c.chen 陳厚成: 哈! 真的可以。 Chrome 有 command line switch :  --allow-file-access-from-files
-	--
-	Answered
-	[18:04:40] yap @ Forth: file:// protocol 只能讀  .js  html, 圖片及聲音
-	[18:05:07] yap @ Forth: 除非透過 html file api ,但多了一個開檔的動作
-	[18:05:21] yap @ Forth: 選檔必須使用者手動
-	--
-	先把 執行中的 chrome process 清乾淨,然後用
-		chrome.exe --allow-file-access-from-files
-	執行, 如此 $.get 可以讀 local files. 我試了讀 .js 檔可以。
-	Windows 10, Chrome 版本 46.0.2490.86 m
-	--
-	MS Edge seems has the same switch : https://social.technet.microsoft.com/Forums/en-US/8128064a-9bad-4cb3-aedc-b8a183e344f8/microsoft-edge-how-to-allowfileaccessfromfiles?forum=win10itprogeneral
-	But it doesn't work on my desk at home:
-	C:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe>MicrosoftEdge.exe --allow-file-access-from-files file:///c:/Users/hcche/Documents/GitHub/jeforth.3we/index.html
-	--
+    複習一下,Chrome 卡在這裡:
+    XMLHttpRequest cannot load file:///C:/Users/hcche/Documents/GitHub/jeforth.3we/f/jeforth.f?text.
+    Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension,
+    https, chrome-extension-resource.
+    ---
+    問 Yap ,
+    [17:14:05] h.c.chen 陳厚成: jeforth 不透過 local server 真的就不能跑嗎? 卡在 XMLHttpRequest cannot load file ... ; Cross origin requests are only supported for protocol schemes ... ,
+    [17:16:20] h.c.chen 陳厚成: 因為用 JQuery 的 $.get 讀檔案, 例如 jeforth.f 就不行了。
+    [17:18:16] h.c.chen 陳厚成: ( 在網頁上跑的 jeforth )
+    [17:36:12] h.c.chen 陳厚成: 可能找到答案了
+    http://stackoverflow.com/questions/8449716/cross-origin-requests-are-only-supported-for-http-but-its-not-cross-domain
+    http://chrome-allow-file-access-from-file.com/
+    http://joshuamcginnis.com/2011/02/28/how-to-disable-same-origin-policy-in-chrome/
+    我試試看. . . . .
+    [17:39:26] h.c.chen 陳厚成: 哈! 真的可以。 Chrome 有 command line switch :  --allow-file-access-from-files
+    --
+    Answered
+    [18:04:40] yap @ Forth: file:// protocol 只能讀  .js  html, 圖片及聲音
+    [18:05:07] yap @ Forth: 除非透過 html file api ,但多了一個開檔的動作
+    [18:05:21] yap @ Forth: 選檔必須使用者手動
+    --
+    先把 執行中的 chrome process 清乾淨,然後用
+        chrome.exe --allow-file-access-from-files
+    執行, 如此 $.get 可以讀 local files. 我試了讀 .js 檔可以。
+    Windows 10, Chrome 版本 46.0.2490.86 m
+    --
+    MS Edge seems has the same switch : https://social.technet.microsoft.com/Forums/en-US/8128064a-9bad-4cb3-aedc-b8a183e344f8/microsoft-edge-how-to-allowfileaccessfromfiles?forum=win10itprogeneral
+    But it doesn't work on my desk at home:
+    C:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe>MicrosoftEdge.exe --allow-file-access-from-files file:///c:/Users/hcche/Documents/GitHub/jeforth.3we/index.html
+    --
 [x] 爽哥 的 cloth_sam.f 革除原版不像 forth 的缺點。
 [x] shift-F2 in trouble on 3hta. --> fixed
 
 [x] Bug ! both HTA and Chrome, why I didn't find this before?
-	==> : test  /*aabbcc*/  ;
-		: test s" /*aabbcc*/" ;
-		JavaScript error on word "literal" : Invalid regular expression: missing /
-	==> 簡化到用 F12 debugger 即可複製:
-		ntib=0;tib=" /*aabbcc*/ ";nexttoken("") --> "/*aabbcc*/ " correct
-		ntib=0;tib=" /*aabbcc*/ ";nexttoken("") --> 也沒錯呀!
-	==> Strange, happened on 3htm Chrome.
-	==> 表示  在 compiling state 有問題, and it's nothing in  because s" also
-		has the problem.
-	-->
-		: s"  (  -- str ) \ Get string down to the next delimiter.
-			char " word js: debugger compiling if literal then BL word drop ; immediate
-		: test ( [ js: debugger ] ) s" /*aabbcc*/" ;
-	--> @ bp, stack=["/*aabbcc*/"]
-		tib = s" /*aabbcc*/" ; '
-		ntib ----------------^
-		compiling : true
-	--> 看到問題了! literal 會把常數用 /* */ 表達在該 function 裡,該常數
-		又是 /*...*/ 則結尾的 */ 就會被認走!! 結果出問題了!
-		> : test s" /*aabbcc*" ;
-		> see test
-		-------- Definition in dictionary --------
-		01529: function (){push(literal)/*(string)/*aabbcc* */} (function)
-		01530: RET (null)
-		---------- End of the definition -----------
-	--> 只有當含有 */ 的 string constant 被 literal compile 進 dictionary 時才有這個問題。
-	[x] 考慮 string constant 可能很長, literal 用 /*...*/ 顯示的方式還要再考慮周詳一點。
-		例如長字串要截斷,碰到 */ 要改成 *_/ 即可避免 .. Bingo!!
+    ==> : test  /*aabbcc*/  ;
+        : test s" /*aabbcc*/" ;
+        JavaScript error on word "literal" : Invalid regular expression: missing /
+    ==> 簡化到用 F12 debugger 即可複製:
+        ntib=0;tib=" /*aabbcc*/ ";nexttoken("") --> "/*aabbcc*/ " correct
+        ntib=0;tib=" /*aabbcc*/ ";nexttoken("") --> 也沒錯呀!
+    ==> Strange, happened on 3htm Chrome.
+    ==> 表示  在 compiling state 有問題, and it's nothing in  because s" also
+        has the problem.
+    -->
+        : s"  (  -- str ) \ Get string down to the next delimiter.
+            char " word js: debugger compiling if literal then BL word drop ; immediate
+        : test ( [ js: debugger ] ) s" /*aabbcc*/" ;
+    --> @ bp, stack=["/*aabbcc*/"]
+        tib = s" /*aabbcc*/" ; '
+        ntib ----------------^
+        compiling : true
+    --> 看到問題了! literal 會把常數用 /* */ 表達在該 function 裡,該常數
+        又是 /*...*/ 則結尾的 */ 就會被認走!! 結果出問題了!
+        > : test s" /*aabbcc*" ;
+        > see test
+        -------- Definition in dictionary --------
+        01529: function (){push(literal)/*(string)/*aabbcc* */} (function)
+        01530: RET (null)
+        ---------- End of the definition -----------
+    --> 只有當含有 */ 的 string constant 被 literal compile 進 dictionary 時才有這個問題。
+    [x] 考慮 string constant 可能很長, literal 用 /*...*/ 顯示的方式還要再考慮周詳一點。
+        例如長字串要截斷,碰到 */ 要改成 *_/ 即可避免 .. Bingo!!
 
 [x] I was working on git.f, trying to make the article section more sexy.
-	Now at the 5.5 section.
-	--> fix shift-F2 hang issue on 3HTA first.
-		js: document.designMode="on" <=== 3HTA 一下就出問題, 合理。
-		js: outputbox.contentEditable="true" <== 3HTA 真的只針對 outputbox, Chrome 全部都 editable!
-	--> 3hta 反而好!!
+    Now at the 5.5 section.
+    --> fix shift-F2 hang issue on 3HTA first.
+        js: document.designMode="on" <=== 3HTA 一下就出問題, 合理。
+        js: outputbox.contentEditable="true" <== 3HTA 真的只針對 outputbox, Chrome 全部都 editable!
+    --> 3hta 反而好!!
 
 [x] 照 爽哥 建議增加 tutor-cloth.f 畫線的例子。
-	hcchen5600 2015/12/03 17:09:31
+    hcchen5600 2015/12/03 17:09:31
 
 [x] This help message is wrong now?
-	execute ( Word|"name"|address|empty -- ... ) Execute the given word or the last() if stack is empty. (object)
-	==> 9/16'16 done
+    execute ( Word|"name"|address|empty -- ... ) Execute the given word or the last() if stack is empty. (object)
+    ==> 9/16'16 done
 
 [x] Many older forth basic words appear stupied after having pop() tos() ...etc.
 
 [x] 用 rawgit.com 直接跑 GitHub repo 只有 Chrome and Android built-in browser 能 run,
-	IE/Edge, and Firefox are facing the Access-Control-Allow-xxxxx 的問題。
-	可能是因為透過 rawgit.com 去跑 GitHub repo 觸動跨境 access 的安全機制之故。
-	==> study https://pages.github.com/
-	--> 9/16'16 tried https://rawgit.com/hcchengithub/jeforth.3we/develop/index.html on
-		IE 11/Windows 10, really failed, as shown below:
-		--- jeforth.3htm error message at beginning ---
-		Error! Failed to read f/jeforth.f
-		--- F12 error messages ---
-		Navigation Event Separator
-		DOM7011: The code on this page disabled back and forward caching. For more information, see: http://go.microsoft.com/fwlink/?LinkID=291337
-		index.html
-		HTML1300: Navigation occurred.
-		index.html
-		SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.
-		index.html
-		SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.
-		index.html
-		SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.
-		index.html
-	--> 13:35 2016-11-26 Firefox's error messages
-		Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://raw.githubusercontent.com/hcchengithub/jeforth.3we/develop/3htm/f/readtextfile.f?text. (Reason: CORS preflight channel did not succeed).(unknown)
-		Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://raw.githubusercontent.com/hcchengithub/jeforth.3we/develop/f/jeforth.f?text. (Reason: CORS preflight channel did not succeed).(unknown)
-		Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://raw.githubusercontent.com/hcchengithub/jeforth.3we/develop/3htm/f/quit.f?text. (Reason: CORS preflight channel did not succeed).(unknown)
-	==> use http://cdn.rawgit.com/...	is the solution. 13:11 2017-01-08
+    IE/Edge, and Firefox are facing the Access-Control-Allow-xxxxx 的問題。
+    可能是因為透過 rawgit.com 去跑 GitHub repo 觸動跨境 access 的安全機制之故。
+    ==> study https://pages.github.com/
+    --> 9/16'16 tried https://rawgit.com/hcchengithub/jeforth.3we/develop/index.html on
+        IE 11/Windows 10, really failed, as shown below:
+        --- jeforth.3htm error message at beginning ---
+        Error! Failed to read f/jeforth.f
+        --- F12 error messages ---
+        Navigation Event Separator
+        DOM7011: The code on this page disabled back and forward caching. For more information, see: http://go.microsoft.com/fwlink/?LinkID=291337
+        index.html
+        HTML1300: Navigation occurred.
+        index.html
+        SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.
+        index.html
+        SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.
+        index.html
+        SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.
+        index.html
+    --> 13:35 2016-11-26 Firefox's error messages
+        Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://raw.githubusercontent.com/hcchengithub/jeforth.3we/develop/3htm/f/readtextfile.f?text. (Reason: CORS preflight channel did not succeed).(unknown)
+        Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://raw.githubusercontent.com/hcchengithub/jeforth.3we/develop/f/jeforth.f?text. (Reason: CORS preflight channel did not succeed).(unknown)
+        Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://raw.githubusercontent.com/hcchengithub/jeforth.3we/develop/3htm/f/quit.f?text. (Reason: CORS preflight channel did not succeed).(unknown)
+    ==> use http://cdn.rawgit.com/...   is the solution. 13:11 2017-01-08
 
 [x] jeforth.3we 可以直接當成 editor 用, 寫筆記, 寫文章皆可。
-	--> See YNote: "在 Web browser 上直接編輯網頁內容"
-	--> Edit by Chrome, press Ctrl-S and save as "完整的網頁" is profect.
-		IE and Edge can only save the original content like Chrome's "僅限網頁的HTML部分"。
-	--> jeforth.3htm 下這一行即可單獨弄出一塊 editable 的 
區域。 - s" body"
--edit me--
- --> 更妙的是 - js> outputbox.contentEditable \ ==> inherit (string) - [x] js: outputbox.contentEditable=true <-- 不妨加入 shift + {F2} editMode ... Done! - --> 曾有過用 project-k 做成獨立的 template.html 實現此構想。直接執行: - chrome --allow-file-access-from-files - 應該更好。有充分的資源可用。 - ==> now, ls.f Edit Box + --> See YNote: "在 Web browser 上直接編輯網頁內容" + --> Edit by Chrome, press Ctrl-S and save as "完整的網頁" is profect. + IE and Edge can only save the original content like Chrome's "僅限網頁的HTML部分"。 + --> jeforth.3htm 下這一行即可單獨弄出一塊 editable 的
區域。 + s" body"
--edit me--
+ --> 更妙的是 + js> outputbox.contentEditable \ ==> inherit (string) + [x] js: outputbox.contentEditable=true <-- 不妨加入 shift + {F2} editMode ... Done! + --> 曾有過用 project-k 做成獨立的 template.html 實現此構想。直接執行: + chrome --allow-file-access-from-files + 應該更好。有充分的資源可用。 + ==> now, ls.f Edit Box [x] 應用 chrome --allow-file-access-from-files 之前要把所有執行中的 chrome.exe 都停掉。 - 不如來寫一個命令叫做 powoer-chrome (引用 power user 的用法) 來一口氣完成。 - : power-chrome ( -- ) \ Run chrome that + 不如來寫一個命令叫做 powoer-chrome (引用 power user 的用法) 來一口氣完成。 + : power-chrome ( -- ) \ Run chrome that [x] Alt-Up/Down should not recall multiple-line. - hcchen5600 2015/12/04 10:34:22 + hcchen5600 2015/12/04 10:34:22 [x] bug, constant name 若出現 " 就會出問題, 連帶使 value 也依樣。Variable 倒是 OK 的。 - 這個問題在 constant 的 help 裡早就提過了! 我一點印象也沒有。 - 解法應該是: replace(/"/g,"\\\"") ---> Bingo!! - to command 也有同樣的問題 --> Yes. + 這個問題在 constant 的 help 裡早就提過了! 我一點印象也沒有。 + 解法應該是: replace(/"/g,"\\\"") ---> Bingo!! + to command 也有同樣的問題 --> Yes. [/] vm.g.variable 應該是 vm.g.voc.variable 才對, - 或者各自掛到 vocabulary object 底下去才對。 - --> 這個問題跟 forth 本身把所有的 variable constant value 都當成 global 所造成的 - 隱憂差不多,頂多多一點。 - [/] 讓 value constant 檢查 the name 是否已經存在。 - [/] 當 selftest 時,把 ReDef 當作 big warning 看待,需要 user confirm。 - ==> automatically no longer a question after private supported. + 或者各自掛到 vocabulary object 底下去才對。 + --> 這個問題跟 forth 本身把所有的 variable constant value 都當成 global 所造成的 + 隱憂差不多,頂多多一點。 + [/] 讓 value constant 檢查 the name 是否已經存在。 + [/] 當 selftest 時,把 ReDef 當作 big warning 看待,需要 user confirm。 + ==> automatically no longer a question after private supported. [ ] The template.f project ==> modify.f [x] Bug found!! 這個難解的問題已經解了, 但留有較罕見的情況仍有問題,如下。 - > : test js> "123;" ; - JavaScript error on word "jsFunc" : Expected ';' - --> ok with js: "123;", only js> has the problem. - --> jsFunc is for js> that push the value of the last statement. - Problem is that the last statement can be a string literal that - includes ';' which is not an end of a statement! - So, how to isolate *the last statement* is the challange. My recent jsFunc is - not good enough for this case. -- hcchen5600 2015/12/04 20:40:13 - --> Not only in string but also in RegEx like this, - js> tos(1)[2].replace(/;/,"__SeMiCoLoN__") - the /;/ makes the same problem!! - [x] Idea of the solution - 研究如何把出現在 jeforth code word definition 裡面的 - JavaScript source code 當中的 "..;.." 分號都置換成 __SeMiCoLoN__ - 以避免干擾最後一條 statement 的判斷。 - --> Find all ['"/].;.;.['"/] literals, replace ';' to __semicolon__ - --> Do the existing process to isolate the last statement. - --> Replace __semicolon__ back to ';' for both portion. - ==> Bingo!! - [ ] Escape characters are still a problem. - "ab\"cd" is ab"cd - Also /...\/.../ or /...[/].../ too. + > : test js> "123;" ; + JavaScript error on word "jsFunc" : Expected ';' + --> ok with js: "123;", only js> has the problem. + --> jsFunc is for js> that push the value of the last statement. + Problem is that the last statement can be a string literal that + includes ';' which is not an end of a statement! + So, how to isolate *the last statement* is the challange. My recent jsFunc is + not good enough for this case. -- hcchen5600 2015/12/04 20:40:13 + --> Not only in string but also in RegEx like this, + js> tos(1)[2].replace(/;/,"__SeMiCoLoN__") + the /;/ makes the same problem!! + [x] Idea of the solution + 研究如何把出現在 jeforth code word definition 裡面的 + JavaScript source code 當中的 "..;.." 分號都置換成 __SeMiCoLoN__ + 以避免干擾最後一條 statement 的判斷。 + --> Find all ['"/].;.;.['"/] literals, replace ';' to __semicolon__ + --> Do the existing process to isolate the last statement. + --> Replace __semicolon__ back to ';' for both portion. + ==> Bingo!! + [ ] Escape characters are still a problem. + "ab\"cd" is ab"cd + Also /...\/.../ or /...[/].../ too. [x] 重新考慮要不要這個東西 js: jump2endofinputbox.click(); contentEditable 之後很煩。 - --> Done. + --> Done. [x] 立志要用 jeforth 來編輯 log.txt - js> vm.plain(vm.g["log.txt"]) js: article.innerHTML=pop() - [x] CSS tab-size IE/Edge 皆無效, 3hta either . . . - 證實: char log.html readTextFile js: article.innerHTML=pop() - ==> ls.f Edit Box is now good enough + js> vm.plain(vm.g["log.txt"]) js: article.innerHTML=pop() + [x] CSS tab-size IE/Edge 皆無效, 3hta either . . . + 證實: char log.html readTextFile js: article.innerHTML=pop() + ==> ls.f Edit Box is now good enough [x] Ctrl-F2 之後,把 caret cursor 所在的 element 改成 command-line style. - \ caret at the target position - \ press Ctrl-F2 - \ you get a #text node ce (current element) - - [object Text] bla bla bla... - - > The #text node's parentNode ==> char .. (ce) - > ce - [object HTMLParagraphElement] innerHTML=bla bla bla - 0 : [object Text] bla bla bla... - --> In this case, it's a P node. - - \ Now we have the target element. - \ Then let's create a table node. 我需要取得最內層之 的 ID 希望可以用 - \ 暫時的 mytemp 用完就把它取消掉,能這樣做就簡單了。應該用 removeAttribute() 可 - \ 以做到。 - - \ 試試看 element ID 可不可以拿掉? 答案是可以的。 - \ element :: removeAttribute("id") 即可。 - - >

xxx

constant xxx - > xxx :> outerHTML ==>

xxx

- > xxx :: removeAttribute("id") - > xxx :> outerHTML ==>

xxx

- - 動手了: - - -
- -
-
( from ) - ce@ :> nodeValue js: tempid.innerText=pop() - js: tempid.removeAttribute("id") - ce@ :> parentNode replaceNode - - : change-to-code-style ( -- ) \ Change the ce@ to code style -
- -
( from ) - ce@ :> nodeValue js: tempid.innerText=pop() - js: tempid.removeAttribute("id") - ce@ :> parentNode replaceNode ; + \ caret at the target position + \ press Ctrl-F2 + \ you get a #text node ce (current element) + + [object Text] bla bla bla... + + > The #text node's parentNode ==> char .. (ce) + > ce + [object HTMLParagraphElement] innerHTML=bla bla bla + 0 : [object Text] bla bla bla... + --> In this case, it's a P node. + + \ Now we have the target element. + \ Then let's create a table node. 我需要取得最內層之 的 ID 希望可以用 + \ 暫時的 mytemp 用完就把它取消掉,能這樣做就簡單了。應該用 removeAttribute() 可 + \ 以做到。 + + \ 試試看 element ID 可不可以拿掉? 答案是可以的。 + \ element :: removeAttribute("id") 即可。 + + >

xxx

constant xxx + > xxx :> outerHTML ==>

xxx

+ > xxx :: removeAttribute("id") + > xxx :> outerHTML ==>

xxx

+ + 動手了: + + +
+ +
+
( from ) + ce@ :> nodeValue js: tempid.innerText=pop() + js: tempid.removeAttribute("id") + ce@ :> parentNode replaceNode + + : change-to-code-style ( -- ) \ Change the ce@ to code style +
+ +
( from ) + ce@ :> nodeValue js: tempid.innerText=pop() + js: tempid.removeAttribute("id") + ce@ :> parentNode replaceNode ; [x] jeforth 分析 考勤 刷卡紀錄 上班時數 分析 [x] private folder is a new project - --> GitHub is not for private use unless pay the money. Use and Dropbox Yun.Baidu instead. + --> GitHub is not for private use unless pay the money. Use and Dropbox Yun.Baidu instead. [x] 昨天忘了 sync GitHub at home. Today, in my office, I don't edit log.json and 3ce folder - so as to remain easy-to-sync of the project. Like maintained by two different people on - different topics. - --> 照這樣安排只 click 一下 [Sync] 按鈕, 兩邊這樣都成功了。 + so as to remain easy-to-sync of the project. Like maintained by two different people on + different topics. + --> 照這樣安排只 click 一下 [Sync] 按鈕, 兩邊這樣都成功了。 [x] 如何把很大的檔案收一部分起來,以方便操作? --> log.json 需要擴充。log.json 不能被 edit-zone - 取代,因為 outputbox 只接 log 起來太正點了 (ls.f has "snapshot" command now)。保留現有 - log.json 的 stack 架構, 但是擴充 random access 的功能。讓它跟 outputbox 結合地更自然、更好用。 - ==> Done, ls.f Edit Box. + 取代,因為 outputbox 只接 log 起來太正點了 (ls.f has "snapshot" command now)。保留現有 + log.json 的 stack 架構, 但是擴充 random access 的功能。讓它跟 outputbox 結合地更自然、更好用。 + ==> Done, ls.f Edit Box. [x] words and help will list the exactly same word multiple times - depends on the order list. Try not. Simply check the recent i and the order - list if [i] appear earlier then skip it. + depends on the order list. Try not. Simply check the recent i and the order + list if [i] appear earlier then skip it. [x] words , help 取消 -N 把 -N 變成 default, 改用 -f 代表 fuzzy search 取代本來的 default。 - --> modify (words) in jeforth.f , 同時讓 -N (now default) 只列出最高 priority 的一個 word。 - --> Modified jeforth.f, easy. Try on 3ce host page ... fail at selftest. Skip it. - --> 連 comments 都改好了. (words), (help), help in jeforth.f, voc.f, and platform.f. + --> modify (words) in jeforth.f , 同時讓 -N (now default) 只列出最高 priority 的一個 word。 + --> Modified jeforth.f, easy. Try on 3ce host page ... fail at selftest. Skip it. + --> 連 comments 都改好了. (words), (help), help in jeforth.f, voc.f, and platform.f. [x] 寫 S7 方便改 keyboard registry 的命令。 - ==> registry.f , autoit.f 都可以 access registry, 但是要改 REG_BINARY for s7 keyboard - re-layout 還是用 reg.exe 配合 export -> edit -> import 的方法, 3hta dos command can help. - 因為 REG_BINARY 問題太多。 - [x] Review registry.f, notes of S7 keyboard remapping. If only I can read registry through - 3hta then it's convenient enough. - Conclusion is : run the 1 key and 5 key ~.reg files (attached below on this page) to remap - the Acer S7 keyboard. 1 key is the Caps Lock changed to be Mute toggle. 5 keys are Caps Lock - become 'delete', AltGr/Del become Home/End, Fn-Home/Fn-End become Pad-/Pad+ for Windows 10 - Zoom in and Zoom out. Refer to my Youdao YNote. + ==> registry.f , autoit.f 都可以 access registry, 但是要改 REG_BINARY for s7 keyboard + re-layout 還是用 reg.exe 配合 export -> edit -> import 的方法, 3hta dos command can help. + 因為 REG_BINARY 問題太多。 + [x] Review registry.f, notes of S7 keyboard remapping. If only I can read registry through + 3hta then it's convenient enough. + Conclusion is : run the 1 key and 5 key ~.reg files (attached below on this page) to remap + the Acer S7 keyboard. 1 key is the Caps Lock changed to be Mute toggle. 5 keys are Caps Lock + become 'delete', AltGr/Del become Home/End, Fn-Home/Fn-End become Pad-/Pad+ for Windows 10 + Zoom in and Zoom out. Refer to my Youdao YNote. [x] 3ce Improve readTextFile - : readTextFileAuto ( "pathname" -- "text" ) \ Read text file from jeforth.3ce host page. - s" s' " swap + s" ' readTextFileAuto " + \ command line 以下讓 Extention page (the host page) 執行 - s" {} js: tos().forth='stopSleeping' js: tos().tos=pop() " + \ host side packing the message object - s" " \ host commands after resume from file I/O - - chrome.runtime.sendMessage({isCommand:true,text:pop()}, - function(result){push(result);execute('stopSleeping')}) - 10000 sleep ; + : readTextFileAuto ( "pathname" -- "text" ) \ Read text file from jeforth.3ce host page. + s" s' " swap + s" ' readTextFileAuto " + \ command line 以下讓 Extention page (the host page) 執行 + s" {} js: tos().forth='stopSleeping' js: tos().tos=pop() " + \ host side packing the message object + s" " \ host commands after resume from file I/O + + chrome.runtime.sendMessage({isCommand:true,text:pop()}, + function(result){push(result);execute('stopSleeping')}) + 10000 sleep ; [x] 3nw.bat js> 1000*60*60*2 nap include hibernatin.f [x] Popup page can attach 3ce to target page now, so 3ce default tabid should be the 'active' tab. - js: push({active:true}) tabs.query js> tos().length \ ==> 1 (number) must be only one - js: push({active:true}) tabs.query :> [0] (see) - --> modiyf ce.f tabid command --> ok now! + js: push({active:true}) tabs.query js> tos().length \ ==> 1 (number) must be only one + js: push({active:true}) tabs.query :> [0] (see) + --> modiyf ce.f tabid command --> ok now! [x] 3ce attach works fine, but it has to check if the target page has been loaded! - Experiment: 0 [begin] active-tab :> status . space 500 nap 1+ dup 100 > [until] - --> Correct, get 3 complete in a row to make sure it's really completed. I saw a complete - among "loading" that's why. - --> works fine now. + Experiment: 0 [begin] active-tab :> status . space 500 nap 1+ dup 100 > [until] + --> Correct, get 3 complete in a row to make sure it's really completed. I saw a complete + among "loading" that's why. + --> works fine now. [x] This line does not print 50 stars, unless remove the 'cr' Bug!! - run: 50 for char * . cr next - This is ok --> 0 [begin] char * . cr 500 nap 1+ dup 10 > [until] - so [for] ... [next] in trouble? or run: for ... next in trouble? - --> try 50 [for] char * . cr 50 nap [next] ----> it works fine! - --> 50 for char * . cr next (run:) <--- works fine too! - --> So, run: for ... next in trouble! - ==> (run:) uses 'dictate()' to run the string, change to use 'tib.insert'. + run: 50 for char * . cr next + This is ok --> 0 [begin] char * . cr 500 nap 1+ dup 10 > [until] + so [for] ... [next] in trouble? or run: for ... next in trouble? + --> try 50 [for] char * . cr 50 nap [next] ----> it works fine! + --> 50 for char * . cr next (run:) <--- works fine too! + --> So, run: for ... next in trouble! + ==> (run:) uses 'dictate()' to run the string, change to use 'tib.insert'. - 利用別的軟體來畫表格, 例如 excel 可能是最好的辦法。可以 copy-paste 給 3hta - 然後用 js> $('table')[0].outerHTML . 取得 HTML 放到 Notepad++ 去整理。 + 利用別的軟體來畫表格, 例如 excel 可能是最好的辦法。可以 copy-paste 給 3hta + 然後用 js> $('table')[0].outerHTML . 取得 HTML 放到 Notepad++ 去整理。 [x] forget to sync, now I have to use log.txt -- 15:02 2016/02/20 [x] Try Ctrl-Enter application, I already know textarea does not return correct element for - anchorNode, how about other things? Try 3ce directly.... - 返回本站首页hao123网址之家www.hao123.com - To study - > js> getSelection() tib. <--------- Alt-F2 gets the same result. - js> getSelection() \ ==> (object) inputbox, null - OK - > js> getSelection() tib. - js> getSelection() \ ==> (object) textarea, null - OK + anchorNode, how about other things? Try 3ce directly.... + 返回本站首页hao123网址之家www.hao123.com + To study + > js> getSelection() tib. <--------- Alt-F2 gets the same result. + js> getSelection() \ ==> (object) inputbox, null + OK + > js> getSelection() tib. + js> getSelection() \ ==> (object) textarea, null + OK - textarea 內不管在哪裡 getSelection() 都是拿到最近的 div parent - js> getSelection() js> getSelection()==pop() \ ==> true (boolean) - js> getSelection().length . - js> getSelection().anchorNode.outerHTML \ ==>
... + textarea 內不管在哪裡 getSelection() 都是拿到最近的 div parent + js> getSelection() js> getSelection()==pop() \ ==> true (boolean) + js> getSelection().length . + js> getSelection().anchorNode.outerHTML \ ==>
... - Drag and drop a picture to 3ce outputbox ==> -
返回本站首页hao123网址之家www.hao123.com
+ Drag and drop a picture to 3ce outputbox ==> +
返回本站首页hao123网址之家www.hao123.com
[x] Now I hope that I can use some script in tr.table. So I can click and run scripts. - That requires a Security Policy: - Refused to execute inline event handler because it violates the following Content - Security Policy directive: "script-src 'self' 'unsafe-eval'". Either the 'unsafe-inline' - keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline - execution. - But after added 'unsafe-inline' into "content_security_policy", reload manifest.json gets - this error : - 嘗試安裝這項擴充功能時顯示警告訊息: - Ignored insecure CSP value "'unsafe-inline'" in directive 'script-src'. - So, the only way is to use a function directly. - --> 奇怪了, 那 jeforth.3ce 已經在用的 script 是怎麼能跑的? - --> inputbox 是收 element.onkeydown , defined in jeforth.3htm.js and platform.f - 只要不是 inline 形式的 onclick="blabla" 就可以了。(嗎) - --> 那對 jeforth 很簡單哪! 先取得 element 再幫他掛上 element.onxxxx=function 即可。 - element.onxxxx=debugger; <--- Failed, 'degugger' unknown. - element.onxxxx="dictate('blabla')" <--- no error, but element.onxxxx will be null. - element.onxxxx=function(){debugger} <--- OK!! 'this' is the element. - h1 :: onclick=function(e){dictate('.s')} <--- OK!!! it works fine. - ==> 結論就是不要寫成 inline script 就行了, 那沒問題呀! - --> See Ynote: jeforth.3ce let tr.table to have script, do-able! + That requires a Security Policy: + Refused to execute inline event handler because it violates the following Content + Security Policy directive: "script-src 'self' 'unsafe-eval'". Either the 'unsafe-inline' + keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline + execution. + But after added 'unsafe-inline' into "content_security_policy", reload manifest.json gets + this error : + 嘗試安裝這項擴充功能時顯示警告訊息: + Ignored insecure CSP value "'unsafe-inline'" in directive 'script-src'. + So, the only way is to use a function directly. + --> 奇怪了, 那 jeforth.3ce 已經在用的 script 是怎麼能跑的? + --> inputbox 是收 element.onkeydown , defined in jeforth.3htm.js and platform.f + 只要不是 inline 形式的 onclick="blabla" 就可以了。(嗎) + --> 那對 jeforth 很簡單哪! 先取得 element 再幫他掛上 element.onxxxx=function 即可。 + element.onxxxx=debugger; <--- Failed, 'degugger' unknown. + element.onxxxx="dictate('blabla')" <--- no error, but element.onxxxx will be null. + element.onxxxx=function(){debugger} <--- OK!! 'this' is the element. + h1 :: onclick=function(e){dictate('.s')} <--- OK!!! it works fine. + ==> 結論就是不要寫成 inline script 就行了, 那沒問題呀! + --> See Ynote: jeforth.3ce let tr.table to have script, do-able! [x] is#text? paste-string erase-#text-anchorNode - ==> See Ynote: jeforth.3ce window.getSelection() 得到的 Selection object 是揮發性 - 的!不能留下來以後用。 + ==> See Ynote: jeforth.3ce window.getSelection() 得到的 Selection object 是揮發性 + 的!不能留下來以後用。 [x] project-k baby.html, sample.html 突然 run 起來之後 Ctrl-enter 沒有作用, F12 debugger 才看得見 - 問題, 原來是 jQuery 掛不起來: - Failed to load resource: net::ERR_NAME_NOT_RESOLVED http://ajax.microsoft.com/ajax/jQuery/jquery-1.11.2.js - baby.html:48 Uncaught ReferenceError: jQuery is not defined - 這常有, 應該要有警告。 - 這是 GFW 的問題, 透過 VPN 就好了。中國境內有沒有 jQuery 的 mirror? + 問題, 原來是 jQuery 掛不起來: + Failed to load resource: net::ERR_NAME_NOT_RESOLVED http://ajax.microsoft.com/ajax/jQuery/jquery-1.11.2.js + baby.html:48 Uncaught ReferenceError: jQuery is not defined + 這常有, 應該要有警告。 + 這是 GFW 的問題, 透過 VPN 就好了。中國境內有沒有 jQuery 的 mirror? [x] 14:21 2016-04-12 jeforth.3ce startup page to advertise itself. Use YNote directly. - cls er + cls er [x] tutor-cloth.f console3we strange. - [x] Improve the scrollto position. - [x] Font size not consistant either. + [x] Improve the scrollto position. + [x] Font size not consistant either. [x] 'Edit box style' 這種東西實在太煩了, 到底為什麼 font size 怎麼都調不好。 - [x] RI: don't use absolute font-size like the 20px in common.css, it is exactly - the root cause of this problem. - --> js> $("style").length \ ==> 3 - --> js> $("style")[0].innerHTML - --> The below study shows me the idea that a stand along style setting for font-size - may be the solution. - - js> $("style")[0].outerHTML \ ==> (string) - - js> $("style")[1].outerHTML - \ ==> (string) - - js> $("style")[2].outerHTML - \ ==> (string) - - js> $("style")[3].outerHTML - \ ==> (string) - *** If want to modify existing style tag, I have done that before! - See flot.f "remove-backgroundColor-style" command that modifies common.css - background color due to that flot.js does not work well with background color. - - [x] 乾脆把 font-size remove from the above [0] style section. The question of "what - is the "1.1em" font size refer to - [x] remove font-size from jeforth.3we/common.css - [x] also change font-size in 3htm/ls.f, which is now refer to default font-size, - to 1.1em that works fine now. - --> it works!! - --> so the default font-size is good enough. <=== True !!! + [x] RI: don't use absolute font-size like the 20px in common.css, it is exactly + the root cause of this problem. + --> js> $("style").length \ ==> 3 + --> js> $("style")[0].innerHTML + --> The below study shows me the idea that a stand along style setting for font-size + may be the solution. + + js> $("style")[0].outerHTML \ ==> (string) + + js> $("style")[1].outerHTML + \ ==> (string) + + js> $("style")[2].outerHTML + \ ==> (string) + + js> $("style")[3].outerHTML + \ ==> (string) + *** If want to modify existing style tag, I have done that before! + See flot.f "remove-backgroundColor-style" command that modifies common.css + background color due to that flot.js does not work well with background color. + + [x] 乾脆把 font-size remove from the above [0] style section. The question of "what + is the "1.1em" font size refer to + [x] remove font-size from jeforth.3we/common.css + [x] also change font-size in 3htm/ls.f, which is now refer to default font-size, + to 1.1em that works fine now. + --> it works!! + --> so the default font-size is good enough. <=== True !!! [x] 3nw's Ctrl-{+}, Ctrl-{-} font size control does not work. - 1) the two colon words' logic were wrong!! --> fixed - 2) {pad +} and {pad -} and their normal equivlants are of different keycode, so - 3htm/platform.f needs to add two more keys to allow notebooks (w/o numeric pad) - to press Ctrl-plus and Ctrl-Minus. - Sh**t! this problem has been there for a long time !!! + 1) the two colon words' logic were wrong!! --> fixed + 2) {pad +} and {pad -} and their normal equivlants are of different keycode, so + 3htm/platform.f needs to add two more keys to allow notebooks (w/o numeric pad) + to press Ctrl-plus and Ctrl-Minus. + Sh**t! this problem has been there for a long time !!! [x] Working on jeforth.3we\3hta\1.bat to leverage jeforth.hta for install.bat automation - for all applications. - --> This is an example of the batch program : - : @rem ; - @rem ' \ dup alias echo dup alias @echo dup alias @echo. dup alias @goto dup alias :end alias jeforth.hta - @echo. - @echo Executing %~nx0 . . . - @goto batch - \ --------------- start jeforth code ---------------------- - cls

Hello world! from jeforth

-

---- wait 5 seconds ----

- 5000 nap - - bye \ TOS will be the errorlevel returned to DOS - \ ---------------- end jeforth code ----------------------- - - :batch - @rem ---------- start batch code --------------------------- - jeforth.hta include %~nx0 \ include the batch program itself - @if %errorlevel% GEQ 1 goto ERR - @rem ------------ end batch code --------------------------- - - @goto END - :ERR - @echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - @echo jeforth return an error code : %errorlevel% - @echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - pause - :END - --> done! jeforth.3we/setup.bat setup all applications. + for all applications. + --> This is an example of the batch program : + : @rem ; + @rem ' \ dup alias echo dup alias @echo dup alias @echo. dup alias @goto dup alias :end alias jeforth.hta + @echo. + @echo Executing %~nx0 . . . + @goto batch + \ --------------- start jeforth code ---------------------- + cls

Hello world! from jeforth

+

---- wait 5 seconds ----

+ 5000 nap + + bye \ TOS will be the errorlevel returned to DOS + \ ---------------- end jeforth code ----------------------- + + :batch + @rem ---------- start batch code --------------------------- + jeforth.hta include %~nx0 \ include the batch program itself + @if %errorlevel% GEQ 1 goto ERR + @rem ------------ end batch code --------------------------- + + @goto END + :ERR + @echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + @echo jeforth return an error code : %errorlevel% + @echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + pause + :END + --> done! jeforth.3we/setup.bat setup all applications. [x] setup.bat should include the private folder [x] include command may do nothing if the ~.f module was existing. This causes problem - if word reDef is expected. For example, many-clocks.f uses 'save' command which is - defined in canvas.f module. When include many-clocks.f the 'save' command has been - reDef by ls.f and therefore running many-clocks.f will be a mess of failures. The - solution is that 'include' command should move the target module to the top instead - of doing nothing when it's existing. - --> Not 'include' but 'source-code-header' who skip existing vocabulary. - ==> done, now include command will always prioritize the word-list even if it has - included already. It's not NOP anymore. 13:10 2017-01-08 + if word reDef is expected. For example, many-clocks.f uses 'save' command which is + defined in canvas.f module. When include many-clocks.f the 'save' command has been + reDef by ls.f and therefore running many-clocks.f will be a mess of failures. The + solution is that 'include' command should move the target module to the top instead + of doing nothing when it's existing. + --> Not 'include' but 'source-code-header' who skip existing vocabulary. + ==> done, now include command will always prioritize the word-list even if it has + included already. It's not NOP anymore. 13:10 2017-01-08 [x] ls.f autoexec has a problem. If it include ~.f which uses source-code-header - that will cause a self-test nested structre problem. Because autoexec is added to - the end of tib by tib.insert. But included ~.f's are spposed to be completed before - the ending self-test structure to balance the nested self-test structure. - To avoid the problem, ~.f inclded in autoexec should not use source-code-header. - How to debug this issue? Use this line: - "" value tib-at-the-point js: vm.g.tib=tib.slice(ntib) - and check tib-at-the-point + that will cause a self-test nested structre problem. Because autoexec is added to + the end of tib by tib.insert. But included ~.f's are spposed to be completed before + the ending self-test structure to balance the nested self-test structure. + To avoid the problem, ~.f inclded in autoexec should not use source-code-header. + How to debug this issue? Use this line: + "" value tib-at-the-point js: vm.g.tib=tib.slice(ntib) + and check tib-at-the-point [x] Change the self-test design of jeforth.3we. No command line do nothing. - --> Yuan-Yuan Teng's experience made me considered this modification. But actually - the problem was now RI, when a computer is off line then 3HTA selftest will fail - at printIPAddress. Simply remove the test item has temporary skipped the problem. - 13:07 2017-01-08 + --> Yuan-Yuan Teng's experience made me considered this modification. But actually + the problem was now RI, when a computer is off line then 3HTA selftest will fail + at printIPAddress. Simply remove the test item has temporary skipped the problem. + 13:07 2017-01-08 [x] support 'private' command to hide private words in the vocabulary - Forth 好用, 但是所有的 word 都是 global 令人想念有 local 的環境。應用 jeforth 用久了, 這 - 個念頭越來越鮮明。要定義一個新的 word 時總覺得有點沉重,怕與過去或未來的 word 撞名。 - - 希望 word 都是 private 只見於同一個 context 之內, 這樣寫起程式來就可以放心地重複定義新 word - 不怕撞名。偶而要用到某個 vocabulary 裡的 private word 時,切 context 即可,或把它 export 出來。 - - jeforth 的 word 都是 object, 屬 private 或 global 似乎加一個 property 標註一下即可。 - - jeforth 的 interpret state 以及 compiling 時搜尋參考到的 word 是透過一個 hash table 去找的。 - 要不要讓它進這個 hash table 應該就是這個 word 是否 global 了。每次重整 hash table 時看看 - 每個 word 的 exported property 以及當時的 context 兩點即可決定。就怕會不會捅出更難收拾 - 的複雜結果? - - 應該有人做過了? - - 請問像 Win32forth 這麼龐大,他對撞名有何對策? - - vocabulary 是目前習見的辦法。然而有了 vocabulary 還是很想念 private (或 local) 環境。 - 我會把 private 在 jeforth 上實現出來, private 是個 word, 動詞, 意思是把 last word 設 - 定成 private。實作上就是在這個 word object 的 private property 打成 true。那麼當它所 - 屬的 vocabulary 不是 context 時就看不見它。不是完全看不到, 而是要把它所屬的 vocabulary - 切成 context 才看得到,即使其 vocabulary 已經在 order 裡也還是看不到。相較於沒有 - private 觀念的 forth 系統—只要是名列 order 內的 vocabulary 他們所有的 word 都看得到— - 有所不同。private 是針對個別 word 的設定, 類似 immediate, compile-only 之類。我們還可 - 以加上個系統層面的 variable 用來當總開關—稱作 private-support 吧 — 當關掉不 support 時 - , 就等於是平常的 forth 系統—通通都是 global。如此就不怕引進 private 會引起甚麼想不到的 - 問題了。 - - code private ( -- ) \ Make the last new word invisible out of the vocabulary - last().private=true - end-code - - code rescan-word-hash ( -- ) \ Rescan all word-lists in the order[] to rebuild wordhash{} - wordhash = {}; - scan_vocabulary("forth"); // words in "forth" always available - for (var j=0; j tos().indexOf("-=e"+"Of=-")!=-1 if ( pathname file ) *debug* 111> - \ \ EOF is not allowed in ~.f module - \ s" Abort! EOF mark '-=eOf=-' is reserved but found in " + js> tos(2) + "msg"abort - \ then ( pathname file ) *debug* 222> - ("\n\\ -=pathname[" + pop(1) + "]pathname=-\n" + pop()) ( file' ) - \ - \ \ 跟 source_code_header 成對的尾部 - \ - \ js> tick('').masterMarker tib.insert - \ - \ js> tick('').enabled [if] js> tick('').buffer tib.insert [then] - \ js: tick('').buffer="" \ recycle the memory - \ s" \ --E" + s" OF--" + - \ swap ( -- code file ) - \ // 把 - - EOF - - 之後先切除再加回,為往後的 source code header, selftest 等準備。 - \ var ss = pop(); - \ ss = (ss+'x').slice(0,ss.search(/\\\s*-=eOf=-/)); // 一開始多加一個 'x' 讓 search 結果 -1 時吃掉。 - \ ss += pop(); // Now ss becomes the TOS - \ *debug* 444> - var ss=pop();(ss+'x').slice(0,ss.search(/-=eOf=-/))+'\n\\ -=eOf=-\n' \ The last \n 避免最後是 \ comment 時吃到後面來 - tib.insert ; - /// Add -=pathname[pathname]pathname=- and cut after -=eof=- - - \ developing new include and friends - - char -=EOF=- ( eof ) (new RegExp(tos())) ( eof /eof/ ) - js> ({regex:pop(),pattern:pop()}) constant EOF // ( -- {regex,pattern} ) End of file pattern and RegExp - - : sinclude ( "pathname" -- ... ) \ Lodad the given forth source file. - dup readTextFileAuto ( pathname file ) - ("\n\\ -=pathname[" + pop(1) + "]pathname=-\n" + pop()) ( file' ) - var ss=pop();(ss+'x').slice(0,ss.search(vm.g.EOF.regex))+'\n\\ '+vm.g.EOF.pattern+'\n' - \ The last \n 避免最後是 \ comment 時吃到後面來 - tib.insert ; - /// Add -=pathname[pathname]pathname=- and cut after -=EOF=- - - : include ( -- ... ) \ Load the source file if it's not included yet. - BL word sinclude ; interpret-only - - "" value TIB - 0 value nTIB - : source~ - js> tib.slice(ntib).indexOf(vm.g.EOF.pattern) ( ieof ) - dup -1 = ?abort" Error! EOF mark not found." ( ieof ) - js> ntib + ( ieof ) \ insert selftest section tail here - js> tib.slice(ntib,pop()) ( tib[ntib ~ before EOF] ) \ cut after EOF - - \ 跟 source_code_header 成對的尾部 - - js> tick('').masterMarker tib.insert - - js> tick('').enabled [if] js> tick('').buffer tib.insert [then] - js: tick('').buffer="" \ recycle the memory - ( tib[ntib ~ before EOF] code ) + ( tib[ntib ~ before EOF]+code ) - s" \ " EOF :> pattern + js> '\n' + + ( tib[ntib~beforeEof+code+EOF] ) \ EOF mark appended back - js> tib.slice(0,ntib)+'\n' swap + js: tib=pop() ; - - - ?skip2 -=EOF=- \ skip it if already included - dup .( Including ) . cr char -- over over + + - js: tick('').masterMarker=tos()+"selftest--"; - also forth definitions (marker) (vocabulary) - last execute definitions - - \ setup marker of this module, run this marker to forget everything back to here. - js> tick('').masterMarker (marker) - - swap + ( tib_a' ) - js> tib to TIB js> ntib to nTIB *debug* 11> - lastIndexOf() - - find the eof index, - 11 33 44 -=eOf=- 44 55 66 :> slice(3).indexOf("-=eOf=-") tib. - new RegExp(pattern, attributes); - (new RegExp("pattern","img")) \ ==> /pattern/gim (object) - - : source-code-header ( -- ) \ The source-code-file.f header macro - - ?skip2 -=EOF=- \ skip it if already included - dup .( Including ) . cr char -- over over + + - js: tick('').masterMarker=tos()+"selftest--"; - also forth definitions (marker) (vocabulary) - last execute definitions - - js> tick('').masterMarker (marker) - - tib.insert ; - /// skip including if the module has been included. - /// setup the self-test module - /// initiate vocabulary for the including module - - \ developing new include and friends - - char -=EOF=- ( eof ) (new RegExp(tos())) ( eof /eof/ ) - js> ({regex:pop(),pattern:pop()}) constant EOF // ( -- {regex,pattern} ) End of file pattern and RegExp - - : sinclude ( "pathname" -- ... ) \ Lodad the given forth source file. - dup readTextFileAuto ( pathname file ) - ("\n\\ -=pathname[" + pop(1) + "]pathname=-\n" + pop()) ( file' ) - var ss=pop();(ss+'x').slice(0,ss.search(vm.g.EOF.regex))+'\n\\ '+vm.g.EOF.pattern+'\n' - \ The last \n 避免最後是 \ comment 時吃到後面來 - tib.insert ; - /// Add -=pathname[pathname]pathname=- and cut after -=EOF=- - - : include ( -- ... ) \ Load the source file if it's not included yet. - BL word sinclude ; interpret-only - - : prioritize ( vid -- ) \ Make the vocabulary first priority - js> order.indexOf(tos()) ( vid i ) - js> tos()==-1 ?abort" Error! unknown vocabulary." ( vid i ) - js> order.splice(pop(),1);order.push(pop()) ; - /// works fine! - - \ Get .f module file name left by include command - : get-module-name ( -- "name" ) \ include command inserts it before ntib - char -=pathname[ js> tib.slice(0,ntib).lastIndexOf(tos()) ( pattern i ) - dup -1 = ?abort" Error! ~.f pathname start mark not found." ( pattern i ) - swap :> length + ( i0 ) char ]pathname=- ( i0 pattern ) - js> tib.slice(0,ntib).lastIndexOf(pop()) ( i0 i ) - dup -1 = ?abort" Error! ~.f pathname end mark not found." ( i0 i ) - js> tib.substring(pop(1),pop()) ; - - : header ( -- 'head' ) \ ~.f common header - EOF :> pattern - \ ~.f common header - ?skip2 _eof_ \ skip it if already included - dup .( Including ) . cr char -- over over + + - js: tick('').masterMarker=tos()+"selftest--"; - also forth definitions (marker) (vocabulary) - last execute definitions - - js> tick('').masterMarker (marker) - - :> replace("_eof_",pop()) ; private - - : tailer ( -- 'tailer' ) \ ~.f common tailer - - \ ~.f common tailer - - js> tick('').masterMarker tib.insert - - js> tick('').enabled [if] js> tick('').buffer tib.insert [then] - js: tick('').buffer="" \ recycle the memory - ; private - - : source~ - \ Check if the module is included already - get-module-name ( fname ) dup (') ( fname w ) - if \ already included ( fname ) - *debug* 456> prioritize - else - \ not included yet ( fname ) - drop - \ cut after EOF - js> tib.slice(ntib).indexOf(vm.g.EOF.pattern) ( ieof ) - dup -1 = ?abort" Error! EOF mark not found." ( ieof ) - js> ntib + ( ieof ) \ insert selftest section tail here - js> tib.slice(ntib,pop()) ( tib[ntib ~ before EOF] ) - \ append the tailer - tailer + ( tib[ntib ~ before EOF]+tailer ) - \ append the EOF - s" \ " EOF :> pattern + js> '\n' + + ( tib[ntib~beforeEof+tailer+EOF] ) - \ wrap up the tib - js> tib.slice(0,ntib) swap + js: tib=pop() - header tib.insert - then ; + : sinclude ( "pathname" -- ... ) \ Lodad the given forth source file. + dup readTextFileAuto ( pathname file ) + \ js> tos().indexOf("-=e"+"Of=-")!=-1 if ( pathname file ) *debug* 111> + \ \ EOF is not allowed in ~.f module + \ s" Abort! EOF mark '-=eOf=-' is reserved but found in " + js> tos(2) + "msg"abort + \ then ( pathname file ) *debug* 222> + ("\n\\ -=pathname[" + pop(1) + "]pathname=-\n" + pop()) ( file' ) + \ + \ \ 跟 source_code_header 成對的尾部 + \ + \ js> tick('').masterMarker tib.insert + \ + \ js> tick('').enabled [if] js> tick('').buffer tib.insert [then] + \ js: tick('').buffer="" \ recycle the memory + \ s" \ --E" + s" OF--" + + \ swap ( -- code file ) + \ // 把 - - EOF - - 之後先切除再加回,為往後的 source code header, selftest 等準備。 + \ var ss = pop(); + \ ss = (ss+'x').slice(0,ss.search(/\\\s*-=eOf=-/)); // 一開始多加一個 'x' 讓 search 結果 -1 時吃掉。 + \ ss += pop(); // Now ss becomes the TOS + \ *debug* 444> + var ss=pop();(ss+'x').slice(0,ss.search(/-=eOf=-/))+'\n\\ -=eOf=-\n' \ The last \n 避免最後是 \ comment 時吃到後面來 + tib.insert ; + /// Add -=pathname[pathname]pathname=- and cut after -=eof=- + + \ developing new include and friends + + char -=EOF=- ( eof ) (new RegExp(tos())) ( eof /eof/ ) + js> ({regex:pop(),pattern:pop()}) constant EOF // ( -- {regex,pattern} ) End of file pattern and RegExp + + : sinclude ( "pathname" -- ... ) \ Lodad the given forth source file. + dup readTextFileAuto ( pathname file ) + ("\n\\ -=pathname[" + pop(1) + "]pathname=-\n" + pop()) ( file' ) + var ss=pop();(ss+'x').slice(0,ss.search(vm.g.EOF.regex))+'\n\\ '+vm.g.EOF.pattern+'\n' + \ The last \n 避免最後是 \ comment 時吃到後面來 + tib.insert ; + /// Add -=pathname[pathname]pathname=- and cut after -=EOF=- + + : include ( -- ... ) \ Load the source file if it's not included yet. + BL word sinclude ; interpret-only + + "" value TIB + 0 value nTIB + : source~ + js> tib.slice(ntib).indexOf(vm.g.EOF.pattern) ( ieof ) + dup -1 = ?abort" Error! EOF mark not found." ( ieof ) + js> ntib + ( ieof ) \ insert selftest section tail here + js> tib.slice(ntib,pop()) ( tib[ntib ~ before EOF] ) \ cut after EOF + + \ 跟 source_code_header 成對的尾部 + + js> tick('').masterMarker tib.insert + + js> tick('').enabled [if] js> tick('').buffer tib.insert [then] + js: tick('').buffer="" \ recycle the memory + ( tib[ntib ~ before EOF] code ) + ( tib[ntib ~ before EOF]+code ) + s" \ " EOF :> pattern + js> '\n' + + ( tib[ntib~beforeEof+code+EOF] ) \ EOF mark appended back + js> tib.slice(0,ntib)+'\n' swap + js: tib=pop() ; + + + ?skip2 -=EOF=- \ skip it if already included + dup .( Including ) . cr char -- over over + + + js: tick('').masterMarker=tos()+"selftest--"; + also forth definitions (marker) (vocabulary) + last execute definitions + + \ setup marker of this module, run this marker to forget everything back to here. + js> tick('').masterMarker (marker) + + swap + ( tib_a' ) + js> tib to TIB js> ntib to nTIB *debug* 11> + lastIndexOf() + + find the eof index, + 11 33 44 -=eOf=- 44 55 66 :> slice(3).indexOf("-=eOf=-") tib. + new RegExp(pattern, attributes); + (new RegExp("pattern","img")) \ ==> /pattern/gim (object) + + : source-code-header ( -- ) \ The source-code-file.f header macro + + ?skip2 -=EOF=- \ skip it if already included + dup .( Including ) . cr char -- over over + + + js: tick('').masterMarker=tos()+"selftest--"; + also forth definitions (marker) (vocabulary) + last execute definitions + + js> tick('').masterMarker (marker) + + tib.insert ; + /// skip including if the module has been included. + /// setup the self-test module + /// initiate vocabulary for the including module + + \ developing new include and friends + + char -=EOF=- ( eof ) (new RegExp(tos())) ( eof /eof/ ) + js> ({regex:pop(),pattern:pop()}) constant EOF // ( -- {regex,pattern} ) End of file pattern and RegExp + + : sinclude ( "pathname" -- ... ) \ Lodad the given forth source file. + dup readTextFileAuto ( pathname file ) + ("\n\\ -=pathname[" + pop(1) + "]pathname=-\n" + pop()) ( file' ) + var ss=pop();(ss+'x').slice(0,ss.search(vm.g.EOF.regex))+'\n\\ '+vm.g.EOF.pattern+'\n' + \ The last \n 避免最後是 \ comment 時吃到後面來 + tib.insert ; + /// Add -=pathname[pathname]pathname=- and cut after -=EOF=- + + : include ( -- ... ) \ Load the source file if it's not included yet. + BL word sinclude ; interpret-only + + : prioritize ( vid -- ) \ Make the vocabulary first priority + js> order.indexOf(tos()) ( vid i ) + js> tos()==-1 ?abort" Error! unknown vocabulary." ( vid i ) + js> order.splice(pop(),1);order.push(pop()) ; + /// works fine! + + \ Get .f module file name left by include command + : get-module-name ( -- "name" ) \ include command inserts it before ntib + char -=pathname[ js> tib.slice(0,ntib).lastIndexOf(tos()) ( pattern i ) + dup -1 = ?abort" Error! ~.f pathname start mark not found." ( pattern i ) + swap :> length + ( i0 ) char ]pathname=- ( i0 pattern ) + js> tib.slice(0,ntib).lastIndexOf(pop()) ( i0 i ) + dup -1 = ?abort" Error! ~.f pathname end mark not found." ( i0 i ) + js> tib.substring(pop(1),pop()) ; + + : header ( -- 'head' ) \ ~.f common header + EOF :> pattern + \ ~.f common header + ?skip2 _eof_ \ skip it if already included + dup .( Including ) . cr char -- over over + + + js: tick('').masterMarker=tos()+"selftest--"; + also forth definitions (marker) (vocabulary) + last execute definitions + + js> tick('').masterMarker (marker) + + :> replace("_eof_",pop()) ; private + + : tailer ( -- 'tailer' ) \ ~.f common tailer + + \ ~.f common tailer + + js> tick('').masterMarker tib.insert + + js> tick('').enabled [if] js> tick('').buffer tib.insert [then] + js: tick('').buffer="" \ recycle the memory + ; private + + : source~ + \ Check if the module is included already + get-module-name ( fname ) dup (') ( fname w ) + if \ already included ( fname ) + *debug* 456> prioritize + else + \ not included yet ( fname ) + drop + \ cut after EOF + js> tib.slice(ntib).indexOf(vm.g.EOF.pattern) ( ieof ) + dup -1 = ?abort" Error! EOF mark not found." ( ieof ) + js> ntib + ( ieof ) \ insert selftest section tail here + js> tib.slice(ntib,pop()) ( tib[ntib ~ before EOF] ) + \ append the tailer + tailer + ( tib[ntib ~ before EOF]+tailer ) + \ append the EOF + s" \ " EOF :> pattern + js> '\n' + + ( tib[ntib~beforeEof+tailer+EOF] ) + \ wrap up the tib + js> tib.slice(0,ntib) swap + js: tib=pop() + header tib.insert + then ; [x] Used tib is not reliable, the -=pathname[name.f]pathname=- mark left by include - command is not reliable either. So, sinclude command should save the pathname - itself or use the old way like source-code-header does that requires the module - name.f given explicitly. + command is not reliable either. So, sinclude command should save the pathname + itself or use the old way like source-code-header does that requires the module + name.f given explicitly. [x] I am warrying about the nested ~.f modules. An included module is to be tib.inserted - to the position of ntib. The process should not hurt the original tib. - My sinclude command does it well. <--- OK. - [/] But source~ should insert the header and tailer into the right place or split tib - into 3 pices [used][ntib~EOF][after EOF] is also a method candidate. + to the position of ntib. The process should not hurt the original tib. + My sinclude command does it well. <--- OK. + [/] But source~ should insert the header and tailer into the right place or split tib + into 3 pices [used][ntib~EOF][after EOF] is also a method candidate. [x] My recent modifications on sinclude to support private words also caused this problem. - I am not so sure why the modification causes this problem, how ever, jquery defer is not - needed any more so I have fixed it by include jquery in jeforth.hta. The error message was: - '$' is undefined. So jQuery did not included correctly? --> jeforth.hta this line: - if ($(inputbox).is(":focus")) kvm.scroll2inputbox(); - in kvm.forthConsoleHandler() caused the problem. Because jquery was not included yet. - Defer jquery to jquery.f was for Windows 7. Now it's not necessary. --> do it now! include - jquery in jeforth.hta. --> done. Seems easy. Include jquery in jeforth.hta. Move back - vm.plain, vm.type, vm.forthConsoleHandler from jquery.f back to jeforth.hta. That's all. + I am not so sure why the modification causes this problem, how ever, jquery defer is not + needed any more so I have fixed it by include jquery in jeforth.hta. The error message was: + '$' is undefined. So jQuery did not included correctly? --> jeforth.hta this line: + if ($(inputbox).is(":focus")) kvm.scroll2inputbox(); + in kvm.forthConsoleHandler() caused the problem. Because jquery was not included yet. + Defer jquery to jquery.f was for Windows 7. Now it's not necessary. --> do it now! include + jquery in jeforth.hta. --> done. Seems easy. Include jquery in jeforth.hta. Move back + vm.plain, vm.type, vm.forthConsoleHandler from jquery.f back to jeforth.hta. That's all. [x] try 3nd ... failed too after the recent modification on rescan-word-hash to support private - that has caused the bug of accessing order[-1] which is of course undefined: - JavaScript error on word "rescan-word-hash" : Cannot read property 'length' of undefined - --> Try 3nw with f12 debugger ... 3nw and 3htm no problem <-- [x] strange, should have the same problem. - --> Root cause is: after the 'only' command, order array become 0 length but words in - forth vocabulary are still visible because the rescan-word-hash command always scan - forth word-list. 'only 'clears the order array may be a mistake, should preserve forth - word-list <-- Yes! according to ANSI : "Set the search order to the implementation-defined - minimum search order." which is to have 'forth' at least. - --> Modify the definition of 'only' then the rescan-word-hash command can be simplified. - --> ok now. + that has caused the bug of accessing order[-1] which is of course undefined: + JavaScript error on word "rescan-word-hash" : Cannot read property 'length' of undefined + --> Try 3nw with f12 debugger ... 3nw and 3htm no problem <-- [x] strange, should have the same problem. + --> Root cause is: after the 'only' command, order array become 0 length but words in + forth vocabulary are still visible because the rescan-word-hash command always scan + forth word-list. 'only 'clears the order array may be a mistake, should preserve forth + word-list <-- Yes! according to ANSI : "Set the search order to the implementation-defined + minimum search order." which is to have 'forth' at least. + --> Modify the definition of 'only' then the rescan-word-hash command can be simplified. + --> ok now. [x] project-k jeoforth.js has a variable 'context'. It is actually the order[order.length-1] - so why need 'context'? --> Because ANSI or eforth has it. --> let it be. + so why need 'context'? --> Because ANSI or eforth has it. --> let it be. [x] 3hta can run, 'including wmi.f' and stop. Caused by my recent modifications on sinclude? - --> use 123.f new sinclude, source-code-header then problem gone. But I found html5.f - is being included multiple times! --> vb.f too, so source~ is in trouble. --> include 123.f - before include html5.f see see --> shit, vb.f needs html5.f so it does! --> wsh.f includes vb.f - again too. --> ok now. + --> use 123.f new sinclude, source-code-header then problem gone. But I found html5.f + is being included multiple times! --> vb.f too, so source~ is in trouble. --> include 123.f + before include html5.f see see --> shit, vb.f needs html5.f so it does! --> wsh.f includes vb.f + again too. --> ok now. [x] Make sure new source-code-header can handle nested include ... ok now. [x] See code word don't show the toString method. [x] words and help do not list private words by default. [/] pattern '*' to show all. - \ List all private words in wordhash{} and count word quantity - > var count=0; for (var i in wordhash) { count++; - if(wordhash[i].private) type(wordhash[i]+"\n")}; count . - header ( -- 'head' ) ~.f common header - tailer ( -- 'tailer' ) ~.f common tailer - test ( ?? ) No help message. Use // to add one. - 493 OK + \ List all private words in wordhash{} and count word quantity + > var count=0; for (var i in wordhash) { count++; + if(wordhash[i].private) type(wordhash[i]+"\n")}; count . + header ( -- 'head' ) ~.f common header + tailer ( -- 'tailer' ) ~.f common tailer + test ( ?? ) No help message. Use // to add one. + 493 OK [x] private support has a problem. variable, constant, value are all global! under vm.g - now they should be under vm.g.vid.name if they are private word. This is difficult because - definiton doesn't know if it's a private word. So, all of them are to be hooked under their - definition vid not only private words. - --> This is easy, modify 'constant' would be enough. - --> ok now! Much much easier than I anticipated. 3hta and 3htm passed self-test already. - [x] context is a jeforth.js global variable. It should always be a copy of order[order.length-1]. - I guess rescan-word-hash is the right place to do this. - [x] Make vocabulary commands (also only previous) immediate words, due to private support - switching context become important. For example: - : test3 also hte.f one previous ; - although the above example looks verbose, but 'one' in hte.f is a private word and test3 - defined in a different context can use it. --> they work fine. - [x] See setup.bat (was vm.v[context]) vm[context] is not correct! Should be vm.[current]. - --> vm.v[current] was a mistake. context = current then still use vm[context] is correct. - [x] setup.bat uses value and vm.g.flag and vm.g._a thus is now not working because they should be - (was vm.v[]) vm.[context].flag and vm[context]._a - [x] Am I going to modify all vm.g to vm[context] ? very annoying and I am afraid it's a bad - idea and I'll have to modify again. - --> See Ynote: "jeforth.3we private support value vm.g.name become vm.vid.name" discussion. - 1. For code word, vm[_me.vid].name - 2. For ... in tib, vm[context].name or vid js> vm[pop()].name - 3. vid forth word is a private command, code vid push(_me.vid) end-code private - so vid command can be used in colon words for js: statements - 4. for in module applications , everything is in the ~.f module. Thus js> current and js> - context are the same vid. This is important and is done by source-code-header. Thus - vm[context].name is the easist way. - [x] check all vm.g.name and vm.g[name] values and constants - Total commander or Notepad++ RegEx : \s?vm\.g(\.|\[) - xx c:\Users\hcche\Documents\GitHub\jeforth.3we\demo\ball.f - xx c:\Users\hcche\Documents\GitHub\jeforth.3we\demo\blowing-in-the-wind.f - xx c:\Users\hcche\Documents\GitHub\jeforth.3we\3htm\canvas\canvas.f - xx c:\Users\hcche\Documents\GitHub\jeforth.3we\3htm\canvas\processing.f - xx c:\Users\hcche\Documents\GitHub\jeforth.3we\3nd\f\jsc.f - xx c:\Users\hcche\Documents\GitHub\jeforth.3we\3hta\registry.f - xx c:\Users\hcche\Documents\GitHub\jeforth.3we\3hta\ie.f - xx c:\Users\hcche\Documents\GitHub\jeforth.3we\private\work.f - xx c:\Users\hcche\Documents\GitHub\jeforth.3we\private\money.f - xx c:\Users\hcche\Documents\GitHub\jeforth.3we\doc\tutor-cloth.f - xx c:\Users\hcche\Documents\GitHub\jeforth.3we\demo\alarm.f - xx c:\Users\hcche\Documents\GitHub\jeforth.3we\3htm\cloth(processing).f - xx c:\Users\hcche\Documents\GitHub\jeforth.3we\3htm\naughty-balls.f - xx c:\Users\hcche\Documents\GitHub\jeforth.3we\3htm\naughty-balls2.f - xx c:\Users\hcche\Documents\GitHub\jeforth.3we\3htm\p5.f - xx c:\Users\hcche\Documents\GitHub\jeforth.3we\f\voc.f - xx c:\Users\hcche\Documents\GitHub\jeforth.3we\f\jeforth.f - xx c:\Users\hcche\Documents\GitHub\jeforth.3we\3htm\f\jsc.f - xx c:\Users\hcche\Documents\GitHub\jeforth.3we\3ce\ce.f - xx c:\Users\hcche\Documents\GitHub\jeforth.3we\3ce\target.f - [x] attach 3ce to target page does not work, yet the F7 command is fine. - > js> document.title . \ ==> hao123网址之家-在线繁体字转换 OK - [x] I guess the readTextFile on target page does not work , because include & - sinclude have been modified recently. --> actually readTextFile does not work - at all. it's good to have F7 enter so I know. - [x] Also, target.f no exist either. --> simply because not read - [x] Some older note recalled from jeforth.3we/log/Log of TR.html - o 當 host page 都不存在時, readTextFile 也不 work 了! 已證實。--> So we need background page (to readTextFile) - o Google 已經建議用 Event page 取代 background page 了 --> no much difference. - o 檢驗 background-page pop().vm.dictate("11 22 33 .s js: debugger") - o 由 3ce extenstion page 對 background page 下令的公式: - background-page tos().bvm.dictate("cr see readTextFile");pop().bvm.screenbuffer . - o 對 background page jeforth 下令的範本: - background-page pop().bvm.dictate(".s") - background-page :> bvm.screenbuffer . - o 若要重複 init background page 只要 - background-page :: jeforth_project_k_virtual_machine_object=null - 然後 refresh 3ce extension page 即可。 - --> er background-page :> document.head.outerHTML . - er background-page :> document.body.outerHTML . - both empty, so I guess the background page is not init'ed - --> use chrome://extensions/ > Inspect views: jeforth.3ce.background.html to check - background page --> no body, no head - --> incorrect! We have jeforth.3ce.background.html - --> do the same inspect on the 3ce from Google Play --> the background page is correct - body and head are all as jeforth.3ce.background.html - which is not empty, title is jeforth.3ce background page besides - [x] I guess jeforth.3ce.background.html is a symbolic link instead of a hard link - in setup.bat is the root cause! --> Yeah!! - [x] Now check the background page title - > background-page :> document.title . \ ==> jeforth.3ce background page OK - Bingo! so easy, run from 3ce page. - [x] Now, Bug fixed! Root cause is in setup.bat, jeforth.3ce.background.html should be hard link - should not be symbolic link. symbolic link jeforth.3ce.background.html causes no error - in manifest.json but it become an empty nothing like a null jeforth.3ce.background.html. - - xx c:\Users\hcche\Documents\GitHub\jeforth.3we\demo\solar-system.f - [x] 2016/12/27 15:48 - This command line : '[begin] ." *" 100 nap [again]' stops the solar system! - F12 debugger shows that tib.slice[ntib] is at near ending of solar-system.f <-- Problem! - that point has passed --> [begin] ..[again] in trouble but only sometimes, strange. - --> use the debug trik of saving tib to TIB and ntib to nTIB, the actual tib is really - at that place but ntib was correctly points at the point before [again] of the - solar-system.f main loop. - --> so the command line '[begin] ." *" 100 nap [again]' that was supposed to have its - own tib and ntib but it actually modifies the solar-system.f's tib and ntib <--- problem!! - --> - "" value TIB 0 value nTIB - [begin] - ." *" - js> tib to TIB js> ntib to nTIB - js: vm.debug=11;debugger - 100 nap \ <----------- restores wrong tib and ntib , suspected - js> tib to TIB js> ntib to nTIB - js: vm.debug=22;debugger - [again] - --> Test, if different nap2 shares the same tibwas? --> no, if use var - save={tibwas,ntibwas,ipwas} then different nap2's save{} are different. - --> interpret state test1 test2 in log/archive.json field "[closed] log 2016/05/30" - failed! --> try older version 3htm from rawgit.com - commit: 3rd release of 12choc.f (committed on Nov 27'16) - http://rawgit.com/hcchengithub/jeforth.3we/26541aae54882fad713be4c9a93d55d00cc7b9ef/index.html - include solar-system.f - [begin] ." *" 100 nap [again] - --> shit! same problem has been there for long!! - --> try master (Latest commit 77afb32 on Sep 11'16) on rawgit.com - --> same problme on solar-system.f and "[begin] ." *" 100 nap [again]" - --> the [begin]..[again] loop in the source code does not work either!! - --> earlier commit --> committed on Jun 12 master - http://rawgit.com/hcchengithub/jeforth.3we/7360c64e00643808fb465ea5667e727689b3a53d/index.html - \ 讓太陽左右來回移動 - js: e=d=0.5 - [begin] - js: h=vm.g.stars[0].x+=e - js> h>=(vm.g.cv.canvas.width-vm.g.cv.canvas.height/2) [if] js: e=-d [then] - js> h<=vm.g.cv.canvas.height/2 [if] js: e=d [then] 50 nap - [again] - --> failed! - --> commit 4c009ce7a1e5aec19513b1fc66e7d651ba404b20 - Author: H.C. Chen - Date: Sun Jun 12 00:08:57 2016 +0800 - - new nap sleep [begin][for] and [[for]] - - solar-system.f ok now - - \ 讓太陽左右來回移動 - js: e=d=0.5 - [begin] - js: h=vm.g.stars[0].x+=e - js> h>=(vm.g.cv.canvas.width-vm.g.cv.canvas.height/2) [if] js: e=-d [then] - js> h<=vm.g.cv.canvas.height/2 [if] js: e=d [then] 50 nap - [again] - - --> failed!! - > [begin] ." *" 100 nap [again] - *Error! ar unknown. <-------------------- exactly the same recent problem. - [x] According to the discussion on my Meta Moji Note, try to repro the problem through - interpret state test1 test2 and let's start over the debugging . . . - --> run 1111 then run 3333. They seems ok but after 3333 an extra 1111 will be shown. - [begin] 1111 dup . space nap [again] - [begin] 3333 dup . space nap [again] - - this exmpains why running the failed '[begin] ." *" 100 nap [again]' added extra - stars to the solar system. - - \ try again the previous experiment that saw after nap tib has been changed - \ test1 - js: vm.debug=false - [begin] 1111 dup . space - js: if(vm.debug){vm.debug=1111;debugger} - nap - js: if(vm.debug){vm.debug=1122;tib=tib+"";debugger} \ after this - [again] - - \ test2 - [begin] 3333 dup . space - js: vm.debug=2211;debugger - nap - js: vm.debug=2222;debugger - [again] - - [x] When F12 debug breakpoint at 1122, vm is undefined, tib either, only kvm is visible, isn't this strange? - If it's not F12 debugger's problem then it must be triggered by timeout() while timeout() event doesn't - know anything about the kvm internal!! --> check it out, can I access tib, compiling, or any other vm - internal variables? - \ test3 , - js: vm.debug=false - [begin] 1111 dup . space - js: if(vm.debug){alert(3311+tib);debugger} - nap - js: if(vm.debug){alert(3322+tib);debugger} - [again] - \ if only test3 then 3311 and 3322 are both shown correctly. So tib is there. - \ check by the debugger, compiling context and ntib are also all there. So try - \ to have test4 see see - \ test4 - js: vm.debug=false - [begin] 3333 dup . space - js: vm.debug=3333;alert(3333+tib);debugger - nap - js: vm.debug=3344;alert(3344+tib);debugger - [again] - \ after added with test4 to test3. test4 itself is ok. Test3 3322 is ok too. - \ but after test3's [again] problem happened. - [x] 1. 3ce run test3 w/ F12. no problem. 2. copy-paste run test4 --> alert@3333 ok. - --> debug@3333 ok rstack=[]40,0,37,0] --> alert@3322 --> debug@3322 same rstack - --> I know after the [again] something will happen, start single step trace. So - I break F12 debugger in outer() in jeforth.js --> got next token is [again] Yeah. - --> at this point context, rstack become unknown!! --> kvm.rstack() is [40,0,37] - --> according to F12 debugger 'Call Stack' this thread was started from resume() - and then outer() so I check tibwas and ntibwas when in the outer() they are - still carring the correct values! But F12 debugger is really has its own - limitation, at this time, only vm internal global variables that are also - appear in resume() function can be seen. So tib,ntib,tibwas,ipwas can be - seen on F12 debugger. But not delay,context,stack,rstack..etc because they - are not appearing in resume() therefore when down to outer() they are not - visible either. - !*! [x] This finding is very strange, how can outer() know it can't see stack - !*! and rstack sometimes? So this must be F12 debugger's limitation instead - !*! of a JavaScript normal behavior. --> True!! When in resume() > outer() - !*! compiling is not visible in F12 debugger, but further step to resume() > - !*! outer() > outerExecute() then compiling become visible! So, this is caused - !*! by JavaScript engin's optimization and thus become F12 debugger's limitation. - --> so, forget about the "foobar is not defined" debugger limitations, go on debugging - --> trace into [again] it restores rtos() to ntib which is the 37 as mentioned above. - when in the xt of [again] code word, again, ntib can be seen but tib can't. - --> gotcha! ntib restored with 37 but tib.slice[37] points to the wrong place!! <-- RI! - The tib is wrong, I guess at first. But it's correct. We are now at test3 is - right. So do this again. But check rstack before adding test4. --> ha ha ha!! - You know what? the rstack is [40, 0]. So, root cause is test3's [again] rewind - with test4's [begin] position!!! <------ real RI!!! - --> In the other word, test3 TSR sees test4's rstack when test3 resume from nap. - test3 expects its rstack will be remain unchanged when it resume from nap and - that's not true. When test3 resume from nap, test4 is in nap and thus rstack - is keeping test4's resuming information, at this moment test3 time out and resume - will actually uses test4's resuming information and certainly it's a disaster. - [x] Now, root cause identified. As mentioned before, root cause is stack/rstack must be balance - to my recent design of nap and sleep or actually [begin] ... [again] and friends because - they store their loop back ntib address in rstack and this is so fatal. However, nap/sleep - can't guarantee what will happen during their unconscious time. Test4 leaves further loop - back into rstack is an example. The workaround is : if allow only one loop in interpret - mode for each TSR command line. Then [begin] [for] , like cut, cut off all older tib - and thus the new ntib is always 0 then they don't need to save loop back address into - rstack, because they are always 0, and therefore there will be no rstack required to save - that loop back information and problem will be fixed. Just like using cut...rewind was ok. - --> No! I already have the solution, tib.push >t tib.pop t> tib.tos t@ - - code tib.push ( int -- ) \ Push the integer to end of TIB as a comment - tib += "\n\\ " + String.fromCharCode(pop()); - end-code - - code tib.tos ( -- int ) \ Get integer from end of the TIB - var value = tib.charCodeAt(tib.length-1); - push(value); - end-code - - : tib.pop ( -- int ) \ Pop integer from end of the TIB - tib.tos ( int ) js: tib=tib.slice(0,-4) ; - - --> actually t> >t and t@ for tib.pop tib.push and tib.tos and used them - on [for][next], [begin][again][until] --> solar-system.f sun moving ok now, Bingo! - [x] test by the below one-liner. The 3 new words, they work just fine, balance perfectly - cls ( ------------- ) js> tib dup . cr 111 >t js> tib . cr t@ . cr js> tib . cr t> . cr js> tib dup . cr - --> See Ynote "jeforth.3we improve nap sleep add (sleep) and [sleep]" - - xx c:\Users\hcche\Documents\GitHub\jeforth.3we\demo\h2o.f - xx c:\Users\hcche\Documents\GitHub\jeforth.3we\playground\12choc.f - [x] Math.sign was not in HTA, fixed by adding it in misc.hta.f. - xx c:\Users\hcche\Documents\GitHub\jeforth.3we\demo\many-clocks.f - xx c:\Users\hcche\Documents\GitHub\jeforth.3we\playground\balls.f - xx c:\Users\hcche\Documents\GitHub\jeforth.3we\playground\modify.f - c:\Users\hcche\Documents\GitHub\jeforth.3we\3htm\pile-it-up.f - c:\Users\hcche\Documents\GitHub\jeforth.3we\3htm\pile.f - c:\Users\hcche\Documents\GitHub\jeforth.3we\playground\123.f + now they should be under vm.g.vid.name if they are private word. This is difficult because + definiton doesn't know if it's a private word. So, all of them are to be hooked under their + definition vid not only private words. + --> This is easy, modify 'constant' would be enough. + --> ok now! Much much easier than I anticipated. 3hta and 3htm passed self-test already. + [x] context is a jeforth.js global variable. It should always be a copy of order[order.length-1]. + I guess rescan-word-hash is the right place to do this. + [x] Make vocabulary commands (also only previous) immediate words, due to private support + switching context become important. For example: + : test3 also hte.f one previous ; + although the above example looks verbose, but 'one' in hte.f is a private word and test3 + defined in a different context can use it. --> they work fine. + [x] See setup.bat (was vm.v[context]) vm[context] is not correct! Should be vm.[current]. + --> vm.v[current] was a mistake. context = current then still use vm[context] is correct. + [x] setup.bat uses value and vm.g.flag and vm.g._a thus is now not working because they should be + (was vm.v[]) vm.[context].flag and vm[context]._a + [x] Am I going to modify all vm.g to vm[context] ? very annoying and I am afraid it's a bad + idea and I'll have to modify again. + --> See Ynote: "jeforth.3we private support value vm.g.name become vm.vid.name" discussion. + 1. For code word, vm[_me.vid].name + 2. For ... in tib, vm[context].name or vid js> vm[pop()].name + 3. vid forth word is a private command, code vid push(_me.vid) end-code private + so vid command can be used in colon words for js: statements + 4. for in module applications , everything is in the ~.f module. Thus js> current and js> + context are the same vid. This is important and is done by source-code-header. Thus + vm[context].name is the easist way. + [x] check all vm.g.name and vm.g[name] values and constants + Total commander or Notepad++ RegEx : \s?vm\.g(\.|\[) + xx c:\Users\hcche\Documents\GitHub\jeforth.3we\demo\ball.f + xx c:\Users\hcche\Documents\GitHub\jeforth.3we\demo\blowing-in-the-wind.f + xx c:\Users\hcche\Documents\GitHub\jeforth.3we\3htm\canvas\canvas.f + xx c:\Users\hcche\Documents\GitHub\jeforth.3we\3htm\canvas\processing.f + xx c:\Users\hcche\Documents\GitHub\jeforth.3we\3nd\f\jsc.f + xx c:\Users\hcche\Documents\GitHub\jeforth.3we\3hta\registry.f + xx c:\Users\hcche\Documents\GitHub\jeforth.3we\3hta\ie.f + xx c:\Users\hcche\Documents\GitHub\jeforth.3we\private\work.f + xx c:\Users\hcche\Documents\GitHub\jeforth.3we\private\money.f + xx c:\Users\hcche\Documents\GitHub\jeforth.3we\doc\tutor-cloth.f + xx c:\Users\hcche\Documents\GitHub\jeforth.3we\demo\alarm.f + xx c:\Users\hcche\Documents\GitHub\jeforth.3we\3htm\cloth(processing).f + xx c:\Users\hcche\Documents\GitHub\jeforth.3we\3htm\naughty-balls.f + xx c:\Users\hcche\Documents\GitHub\jeforth.3we\3htm\naughty-balls2.f + xx c:\Users\hcche\Documents\GitHub\jeforth.3we\3htm\p5.f + xx c:\Users\hcche\Documents\GitHub\jeforth.3we\f\voc.f + xx c:\Users\hcche\Documents\GitHub\jeforth.3we\f\jeforth.f + xx c:\Users\hcche\Documents\GitHub\jeforth.3we\3htm\f\jsc.f + xx c:\Users\hcche\Documents\GitHub\jeforth.3we\3ce\ce.f + xx c:\Users\hcche\Documents\GitHub\jeforth.3we\3ce\target.f + [x] attach 3ce to target page does not work, yet the F7 command is fine. + > js> document.title . \ ==> hao123网址之家-在线繁体字转换 OK + [x] I guess the readTextFile on target page does not work , because include & + sinclude have been modified recently. --> actually readTextFile does not work + at all. it's good to have F7 enter so I know. + [x] Also, target.f no exist either. --> simply because not read + [x] Some older note recalled from jeforth.3we/log/Log of TR.html + o 當 host page 都不存在時, readTextFile 也不 work 了! 已證實。--> So we need background page (to readTextFile) + o Google 已經建議用 Event page 取代 background page 了 --> no much difference. + o 檢驗 background-page pop().vm.dictate("11 22 33 .s js: debugger") + o 由 3ce extenstion page 對 background page 下令的公式: + background-page tos().bvm.dictate("cr see readTextFile");pop().bvm.screenbuffer . + o 對 background page jeforth 下令的範本: + background-page pop().bvm.dictate(".s") + background-page :> bvm.screenbuffer . + o 若要重複 init background page 只要 + background-page :: jeforth_project_k_virtual_machine_object=null + 然後 refresh 3ce extension page 即可。 + --> er background-page :> document.head.outerHTML . + er background-page :> document.body.outerHTML . + both empty, so I guess the background page is not init'ed + --> use chrome://extensions/ > Inspect views: jeforth.3ce.background.html to check + background page --> no body, no head + --> incorrect! We have jeforth.3ce.background.html + --> do the same inspect on the 3ce from Google Play --> the background page is correct + body and head are all as jeforth.3ce.background.html + which is not empty, title is jeforth.3ce background page besides + [x] I guess jeforth.3ce.background.html is a symbolic link instead of a hard link + in setup.bat is the root cause! --> Yeah!! + [x] Now check the background page title + > background-page :> document.title . \ ==> jeforth.3ce background page OK + Bingo! so easy, run from 3ce page. + [x] Now, Bug fixed! Root cause is in setup.bat, jeforth.3ce.background.html should be hard link + should not be symbolic link. symbolic link jeforth.3ce.background.html causes no error + in manifest.json but it become an empty nothing like a null jeforth.3ce.background.html. + + xx c:\Users\hcche\Documents\GitHub\jeforth.3we\demo\solar-system.f + [x] 2016/12/27 15:48 + This command line : '[begin] ." *" 100 nap [again]' stops the solar system! + F12 debugger shows that tib.slice[ntib] is at near ending of solar-system.f <-- Problem! + that point has passed --> [begin] ..[again] in trouble but only sometimes, strange. + --> use the debug trik of saving tib to TIB and ntib to nTIB, the actual tib is really + at that place but ntib was correctly points at the point before [again] of the + solar-system.f main loop. + --> so the command line '[begin] ." *" 100 nap [again]' that was supposed to have its + own tib and ntib but it actually modifies the solar-system.f's tib and ntib <--- problem!! + --> + "" value TIB 0 value nTIB + [begin] + ." *" + js> tib to TIB js> ntib to nTIB + js: vm.debug=11;debugger + 100 nap \ <----------- restores wrong tib and ntib , suspected + js> tib to TIB js> ntib to nTIB + js: vm.debug=22;debugger + [again] + --> Test, if different nap2 shares the same tibwas? --> no, if use var + save={tibwas,ntibwas,ipwas} then different nap2's save{} are different. + --> interpret state test1 test2 in log/archive.json field "[closed] log 2016/05/30" + failed! --> try older version 3htm from rawgit.com + commit: 3rd release of 12choc.f (committed on Nov 27'16) + http://rawgit.com/hcchengithub/jeforth.3we/26541aae54882fad713be4c9a93d55d00cc7b9ef/index.html + include solar-system.f + [begin] ." *" 100 nap [again] + --> shit! same problem has been there for long!! + --> try master (Latest commit 77afb32 on Sep 11'16) on rawgit.com + --> same problme on solar-system.f and "[begin] ." *" 100 nap [again]" + --> the [begin]..[again] loop in the source code does not work either!! + --> earlier commit --> committed on Jun 12 master + http://rawgit.com/hcchengithub/jeforth.3we/7360c64e00643808fb465ea5667e727689b3a53d/index.html + \ 讓太陽左右來回移動 + js: e=d=0.5 + [begin] + js: h=vm.g.stars[0].x+=e + js> h>=(vm.g.cv.canvas.width-vm.g.cv.canvas.height/2) [if] js: e=-d [then] + js> h<=vm.g.cv.canvas.height/2 [if] js: e=d [then] 50 nap + [again] + --> failed! + --> commit 4c009ce7a1e5aec19513b1fc66e7d651ba404b20 + Author: H.C. Chen + Date: Sun Jun 12 00:08:57 2016 +0800 + + new nap sleep [begin][for] and [[for]] + + solar-system.f ok now + + \ 讓太陽左右來回移動 + js: e=d=0.5 + [begin] + js: h=vm.g.stars[0].x+=e + js> h>=(vm.g.cv.canvas.width-vm.g.cv.canvas.height/2) [if] js: e=-d [then] + js> h<=vm.g.cv.canvas.height/2 [if] js: e=d [then] 50 nap + [again] + + --> failed!! + > [begin] ." *" 100 nap [again] + *Error! ar unknown. <-------------------- exactly the same recent problem. + [x] According to the discussion on my Meta Moji Note, try to repro the problem through + interpret state test1 test2 and let's start over the debugging . . . + --> run 1111 then run 3333. They seems ok but after 3333 an extra 1111 will be shown. + [begin] 1111 dup . space nap [again] + [begin] 3333 dup . space nap [again] + + this exmpains why running the failed '[begin] ." *" 100 nap [again]' added extra + stars to the solar system. + + \ try again the previous experiment that saw after nap tib has been changed + \ test1 + js: vm.debug=false + [begin] 1111 dup . space + js: if(vm.debug){vm.debug=1111;debugger} + nap + js: if(vm.debug){vm.debug=1122;tib=tib+"";debugger} \ after this + [again] + + \ test2 + [begin] 3333 dup . space + js: vm.debug=2211;debugger + nap + js: vm.debug=2222;debugger + [again] + + [x] When F12 debug breakpoint at 1122, vm is undefined, tib either, only kvm is visible, isn't this strange? + If it's not F12 debugger's problem then it must be triggered by timeout() while timeout() event doesn't + know anything about the kvm internal!! --> check it out, can I access tib, compiling, or any other vm + internal variables? + \ test3 , + js: vm.debug=false + [begin] 1111 dup . space + js: if(vm.debug){alert(3311+tib);debugger} + nap + js: if(vm.debug){alert(3322+tib);debugger} + [again] + \ if only test3 then 3311 and 3322 are both shown correctly. So tib is there. + \ check by the debugger, compiling context and ntib are also all there. So try + \ to have test4 see see + \ test4 + js: vm.debug=false + [begin] 3333 dup . space + js: vm.debug=3333;alert(3333+tib);debugger + nap + js: vm.debug=3344;alert(3344+tib);debugger + [again] + \ after added with test4 to test3. test4 itself is ok. Test3 3322 is ok too. + \ but after test3's [again] problem happened. + [x] 1. 3ce run test3 w/ F12. no problem. 2. copy-paste run test4 --> alert@3333 ok. + --> debug@3333 ok rstack=[]40,0,37,0] --> alert@3322 --> debug@3322 same rstack + --> I know after the [again] something will happen, start single step trace. So + I break F12 debugger in outer() in jeforth.js --> got next token is [again] Yeah. + --> at this point context, rstack become unknown!! --> kvm.rstack() is [40,0,37] + --> according to F12 debugger 'Call Stack' this thread was started from resume() + and then outer() so I check tibwas and ntibwas when in the outer() they are + still carring the correct values! But F12 debugger is really has its own + limitation, at this time, only vm internal global variables that are also + appear in resume() function can be seen. So tib,ntib,tibwas,ipwas can be + seen on F12 debugger. But not delay,context,stack,rstack..etc because they + are not appearing in resume() therefore when down to outer() they are not + visible either. + !*! [x] This finding is very strange, how can outer() know it can't see stack + !*! and rstack sometimes? So this must be F12 debugger's limitation instead + !*! of a JavaScript normal behavior. --> True!! When in resume() > outer() + !*! compiling is not visible in F12 debugger, but further step to resume() > + !*! outer() > outerExecute() then compiling become visible! So, this is caused + !*! by JavaScript engin's optimization and thus become F12 debugger's limitation. + --> so, forget about the "foobar is not defined" debugger limitations, go on debugging + --> trace into [again] it restores rtos() to ntib which is the 37 as mentioned above. + when in the xt of [again] code word, again, ntib can be seen but tib can't. + --> gotcha! ntib restored with 37 but tib.slice[37] points to the wrong place!! <-- RI! + The tib is wrong, I guess at first. But it's correct. We are now at test3 is + right. So do this again. But check rstack before adding test4. --> ha ha ha!! + You know what? the rstack is [40, 0]. So, root cause is test3's [again] rewind + with test4's [begin] position!!! <------ real RI!!! + --> In the other word, test3 TSR sees test4's rstack when test3 resume from nap. + test3 expects its rstack will be remain unchanged when it resume from nap and + that's not true. When test3 resume from nap, test4 is in nap and thus rstack + is keeping test4's resuming information, at this moment test3 time out and resume + will actually uses test4's resuming information and certainly it's a disaster. + [x] Now, root cause identified. As mentioned before, root cause is stack/rstack must be balance + to my recent design of nap and sleep or actually [begin] ... [again] and friends because + they store their loop back ntib address in rstack and this is so fatal. However, nap/sleep + can't guarantee what will happen during their unconscious time. Test4 leaves further loop + back into rstack is an example. The workaround is : if allow only one loop in interpret + mode for each TSR command line. Then [begin] [for] , like cut, cut off all older tib + and thus the new ntib is always 0 then they don't need to save loop back address into + rstack, because they are always 0, and therefore there will be no rstack required to save + that loop back information and problem will be fixed. Just like using cut...rewind was ok. + --> No! I already have the solution, tib.push >t tib.pop t> tib.tos t@ + + code tib.push ( int -- ) \ Push the integer to end of TIB as a comment + tib += "\n\\ " + String.fromCharCode(pop()); + end-code + + code tib.tos ( -- int ) \ Get integer from end of the TIB + var value = tib.charCodeAt(tib.length-1); + push(value); + end-code + + : tib.pop ( -- int ) \ Pop integer from end of the TIB + tib.tos ( int ) js: tib=tib.slice(0,-4) ; + + --> actually t> >t and t@ for tib.pop tib.push and tib.tos and used them + on [for][next], [begin][again][until] --> solar-system.f sun moving ok now, Bingo! + [x] test by the below one-liner. The 3 new words, they work just fine, balance perfectly + cls ( ------------- ) js> tib dup . cr 111 >t js> tib . cr t@ . cr js> tib . cr t> . cr js> tib dup . cr + --> See Ynote "jeforth.3we improve nap sleep add (sleep) and [sleep]" + + xx c:\Users\hcche\Documents\GitHub\jeforth.3we\demo\h2o.f + xx c:\Users\hcche\Documents\GitHub\jeforth.3we\playground\12choc.f + [x] Math.sign was not in HTA, fixed by adding it in misc.hta.f. + xx c:\Users\hcche\Documents\GitHub\jeforth.3we\demo\many-clocks.f + xx c:\Users\hcche\Documents\GitHub\jeforth.3we\playground\balls.f + xx c:\Users\hcche\Documents\GitHub\jeforth.3we\playground\modify.f + c:\Users\hcche\Documents\GitHub\jeforth.3we\3htm\pile-it-up.f + c:\Users\hcche\Documents\GitHub\jeforth.3we\3htm\pile.f + c:\Users\hcche\Documents\GitHub\jeforth.3we\playground\123.f [x] recently, only foo will crash the system , previous rescan-wordhash is better. - Done, now: - only work.f help * - works fine. + Done, now: + only work.f help * + works fine. [x] 3hta, include work.f, all words are private but not lookup, why? It's the only code word - Ha, this line in definition of 'code' is a mistake: - execute("privacy");last().private = Boolean(pop()); - should be in 'end-code's definition because last() is not this word when in code. - re-define end-code like what I did to code does not work, although the experiment of - code end-code alert(1234) end-code - works fine. However, modify end-code.xt directly can be an solution --> Bingo! + Ha, this line in definition of 'code' is a mistake: + execute("privacy");last().private = Boolean(pop()); + should be in 'end-code's definition because last() is not this word when in code. + re-define end-code like what I did to code does not work, although the experiment of + code end-code alert(1234) end-code + works fine. However, modify end-code.xt directly can be an solution --> Bingo! [x] 3hta has a new problem. 1. include foo.f <-- file not found - then F5 and ctrl-up are all triggering jsc error! <== Problem! - --> 3ce is fine. Only 3HTA has this problem. So, 3hta's jsc is suspected. - debugging sinclude . . . --> no need to include foo.f, run jsc then the problem - begins --> run any command (cr, words) or trigger any event (single-click) - all cause the error : JavaScript error on word "cr" : Object expected - Panic jsc> - --> so, simplify jsc and see ... seem like executing reset() is the reason...Nope. - jsc's exit, q, reset commands can repro the problem. While r rr do not reprothe - problem. So what's the difference? --> Ha! root cause is the bd command. Run - 'bd' command after a restart has repro'ed the problem without jsc. - RI: the below vm.g.fastInner should be vm.forth.fastInner - function(_me){ /* bd */ - inner = vm.g.fastInner <--- should be vm.forth.fastInner now, because fastinner is a constant in jeforth.f - vm.jsc.enable = false; // 需要這個 flag 因為若已經進了 debugInner, 換掉 inner 也出不來。 - } - Bingo!! this bug is caused by the private support that changes vm.g to vm.vid. - So, review all constant --> - >words constant -t - -------- forth (5 words) -------- - [x]EOF [x]fastInner [x]jsc.xt.hta [x]jsc.xt.F12 [x]forth-wordlist - -------- vb.f (1 words) -------- - [x]vm.process - -------- wsh.f (1 words) -------- - [x]WshShell - -------- env.f (3 words) -------- - [x]WshProcEnv [x]WshUserEnv [x]BinaryStream - > words value -t - -------- forth (4 words) -------- - [x]base [x]breakPoint [x]args [x]up/down-recall-needs-alt-key? + then F5 and ctrl-up are all triggering jsc error! <== Problem! + --> 3ce is fine. Only 3HTA has this problem. So, 3hta's jsc is suspected. + debugging sinclude . . . --> no need to include foo.f, run jsc then the problem + begins --> run any command (cr, words) or trigger any event (single-click) + all cause the error : JavaScript error on word "cr" : Object expected + Panic jsc> + --> so, simplify jsc and see ... seem like executing reset() is the reason...Nope. + jsc's exit, q, reset commands can repro the problem. While r rr do not reprothe + problem. So what's the difference? --> Ha! root cause is the bd command. Run + 'bd' command after a restart has repro'ed the problem without jsc. + RI: the below vm.g.fastInner should be vm.forth.fastInner + function(_me){ /* bd */ + inner = vm.g.fastInner <--- should be vm.forth.fastInner now, because fastinner is a constant in jeforth.f + vm.jsc.enable = false; // 需要這個 flag 因為若已經進了 debugInner, 換掉 inner 也出不來。 + } + Bingo!! this bug is caused by the private support that changes vm.g to vm.vid. + So, review all constant --> + >words constant -t + -------- forth (5 words) -------- + [x]EOF [x]fastInner [x]jsc.xt.hta [x]jsc.xt.F12 [x]forth-wordlist + -------- vb.f (1 words) -------- + [x]vm.process + -------- wsh.f (1 words) -------- + [x]WshShell + -------- env.f (3 words) -------- + [x]WshProcEnv [x]WshUserEnv [x]BinaryStream + > words value -t + -------- forth (4 words) -------- + [x]base [x]breakPoint [x]args [x]up/down-recall-needs-alt-key? [x] 準備 release master 新版 release 新版 master - o search "kvm.minor_version" increase 版號。 - [x] jeforth.3nd.js --> version 203 - [x] 3nw, jeforth.3we/package.json version 223 - [x] jeforth.3htm.js --> to be version 203 - [x] jeforth.3ce.js(3ce extension pages)-> 203 - [x] jeforth.3ce, ce.f(Target page) -> vm.minor_version = 203 - [x] jeforth.3ce, background.js vm.minor_version = 203 - [x] jeforth.hta --> tag. VERSION="204" - [/] jeforth.3ca, also jeforth.3htm.js above - o selftest them all - [x] setup.bat - [x] 3hta - [x] 3nw use 3hta to fork cmd /c start nw ../jeforth.3we - [x] 3htm use 3nw or 3nd to include webserver.f and then localhost:8888 - [x] 3nd - [x] 3ce - [x] 3ca - [x] Testing all demo, calc.f does not work in 3ca due to the inline permission. Try to rewrite - event handlers of those buttons. Search "Refused to execute inline event handler" there's a - solution above (in log.txt). Solution is very viable. Avoid using onclick=anything - in HTML tags but using : - window.element的名字可以用中文!.onclick=function(){kvm.execute("wordname")} - that's very easy and doable. ==> Bingo!! new calc.f has done. - [x] setup.bat screen flashs badly, try not but beautiful progress info instead on the 3hta window. - [x] done with (run) (fork) and (dos) <--- they are now silently run. - [x] Simplify setup.bat to use (dos) instead of (run) - [x] commit develop -> 將 develop 分支發佈到 Master 分支的命令 : - 切換到Master分支 : git checkout master - 合併 develop 分支進 master 來 : git merge --no-ff develop - Merge branch 'develop' - # Conflicts: - # 3ca/fig.tw128x128.png - # 3ca/fig.tw16x16.png - # 3hta/localstorage.json - # 3nw/localstorage.json - # - # It looks like you may be committing a merge. - # If this is not correct, please remove the file - # .git/MERGE_HEAD - # and try again. - I plan to rm them all and copy them back from develop, and commit again. - 他說我有問題的,很多不知何故,連 .png 都說是 conflict!? 解法是乾脆把它們都殺掉,因為確信 develop - 版是沒問題的。先 git rm <所有 conflicts> 然後 commit 成功, 把這些檔案 copy 回來再 commit 一次 - 就可以解決。 - [x] Test the master all over again ... pass - [x] Master 到回 develop - 切換到Master分支 : git checkout develop - 合併 develop 分支進 master 來 : git merge --no-ff master - [x] release note + o search "kvm.minor_version" increase 版號。 + [x] jeforth.3nd.js --> version 203 + [x] 3nw, jeforth.3we/package.json version 223 + [x] jeforth.3htm.js --> to be version 203 + [x] jeforth.3ce.js(3ce extension pages)-> 203 + [x] jeforth.3ce, ce.f(Target page) -> vm.minor_version = 203 + [x] jeforth.3ce, background.js vm.minor_version = 203 + [x] jeforth.hta --> tag. VERSION="204" + [/] jeforth.3ca, also jeforth.3htm.js above + o selftest them all + [x] setup.bat + [x] 3hta + [x] 3nw use 3hta to fork cmd /c start nw ../jeforth.3we + [x] 3htm use 3nw or 3nd to include webserver.f and then localhost:8888 + [x] 3nd + [x] 3ce + [x] 3ca + [x] Testing all demo, calc.f does not work in 3ca due to the inline permission. Try to rewrite + event handlers of those buttons. Search "Refused to execute inline event handler" there's a + solution above (in log.txt). Solution is very viable. Avoid using onclick=anything + in HTML tags but using : + window.element的名字可以用中文!.onclick=function(){kvm.execute("wordname")} + that's very easy and doable. ==> Bingo!! new calc.f has done. + [x] setup.bat screen flashs badly, try not but beautiful progress info instead on the 3hta window. + [x] done with (run) (fork) and (dos) <--- they are now silently run. + [x] Simplify setup.bat to use (dos) instead of (run) + [x] commit develop -> 將 develop 分支發佈到 Master 分支的命令 : + 切換到Master分支 : git checkout master + 合併 develop 分支進 master 來 : git merge --no-ff develop + Merge branch 'develop' + # Conflicts: + # 3ca/fig.tw128x128.png + # 3ca/fig.tw16x16.png + # 3hta/localstorage.json + # 3nw/localstorage.json + # + # It looks like you may be committing a merge. + # If this is not correct, please remove the file + # .git/MERGE_HEAD + # and try again. + I plan to rm them all and copy them back from develop, and commit again. + 他說我有問題的,很多不知何故,連 .png 都說是 conflict!? 解法是乾脆把它們都殺掉,因為確信 develop + 版是沒問題的。先 git rm <所有 conflicts> 然後 commit 成功, 把這些檔案 copy 回來再 commit 一次 + 就可以解決。 + [x] Test the master all over again ... pass + [x] Master 到回 develop + 切換到Master分支 : git checkout develop + 合併 develop 分支進 master 來 : git merge --no-ff master + [x] release note [/] Change the startup rule: Selftest to be run by selftest command instead of an empty command line. - --> js: tick('').enabled=false in every quit.f - --> 算了麻煩 + --> js: tick('').enabled=false in every quit.f + --> 算了麻煩 [/] Do we need a command to inhibit any new tib commands during nap / sleep ? - --> to avoid stack/rstack or whatever system things to be changed during napping in waiting - I/O. Sounds necessary, but how? --> where to add this line? - if(kvm.tick("sleep").timeoutId) return; // sleep if for I/O, avoid - --> Add a 'sleeping' variable to project-k jeforth.js kernel to replace using - kvm.tick("sleep").timeoutId if outer() and dictate() are the right places to inhibit - executing during sleeping. - Let it be, abort, no actual reason so far. + --> to avoid stack/rstack or whatever system things to be changed during napping in waiting + I/O. Sounds necessary, but how? --> where to add this line? + if(kvm.tick("sleep").timeoutId) return; // sleep if for I/O, avoid + --> Add a 'sleeping' variable to project-k jeforth.js kernel to replace using + kvm.tick("sleep").timeoutId if outer() and dictate() are the right places to inhibit + executing during sleeping. + Let it be, abort, no actual reason so far. [ ] setup.bat to build simplest working directories, e.g. jeforth.3hta/, jeforth.3htm, .. etc - without log/ demo/ background/ doc/ ... etc. According to Degn,Yuan-Yuan's request. + without log/ demo/ background/ doc/ ... etc. According to Degn,Yuan-Yuan's request. [x] private support is good, but there are many event handlers like examples in ls.f - $(".ebreadonly",tos())[0].onclick =function(e){push(this);execute("eb.readonly");return(false)} - will be not working because "call by name" and the name will be invisible after being not - the context. My idea is to have a word, say 'word>handler' that output a handler function. So, - code word>handler ( word -- handler() ) \ Pack the word into an event handler - ... snip ... - end-code - and the line will become: - ['] eb.readonly word>handler js: $(".ebreadonly",tos(n))[0].onclick=pop() - [x] call by name must be reviewed especially utility vocabularies. - --> tick() and execute() have run-time-warning in selftest mode - [x] ls.f privacy is true now. + $(".ebreadonly",tos())[0].onclick =function(e){push(this);execute("eb.readonly");return(false)} + will be not working because "call by name" and the name will be invisible after being not + the context. My idea is to have a word, say 'word>handler' that output a handler function. So, + code word>handler ( word -- handler() ) \ Pack the word into an event handler + ... snip ... + end-code + and the line will become: + ['] eb.readonly word>handler js: $(".ebreadonly",tos(n))[0].onclick=pop() + [x] call by name must be reviewed especially utility vocabularies. + --> tick() and execute() have run-time-warning in selftest mode + [x] ls.f privacy is true now. [ ] ... does not work as expected. Remove them. - : ( -- "task" ) \ Invoke a dictate() to run the words. - char word ; immediate - /// 要一次發動好幾個 rewinding TIB task 才需要用這個命令。如果不是 - /// rewinding 的則同樣是循序做下去就不需要本命令了。如果只要發動一 - /// 個則用 cut ... rewind 即可。 - /// Ex. - /// 1 . space 100 nap rewind 2 . space 100 nap rewind - - : ( "task" -- ... ) \ Delimiter of - compiling if literal js: push(function(){dictate(pop())}) , - else js: dictate(pop()) then ; immediate - /// See alternative method for command line by 'cut' and 'rewind'. - --> are they do-able? Is it possible to run interpret state tasks by using them? + : ( -- "task" ) \ Invoke a dictate() to run the words. + char word ; immediate + /// 要一次發動好幾個 rewinding TIB task 才需要用這個命令。如果不是 + /// rewinding 的則同樣是循序做下去就不需要本命令了。如果只要發動一 + /// 個則用 cut ... rewind 即可。 + /// Ex. + /// 1 . space 100 nap rewind 2 . space 100 nap rewind + + : ( "task" -- ... ) \ Delimiter of + compiling if literal js: push(function(){dictate(pop())}) , + else js: dictate(pop()) then ; immediate + /// See alternative method for command line by 'cut' and 'rewind'. + --> are they do-able? Is it possible to run interpret state tasks by using them? [/] Let context be like AX register in eforth x86. Therefore order[order.length-1] is not context. - After previous command the recent order[order.length-1] become new context. Purpose is to - switch context faster. context. Consider a two-pass search of the target word, in context and - in wordhash if not found in context while context vocabulary word always has its own wordhash - ready. - [x] If use two-pass search, then all words need to be searched twice. Consider the cost! - ==> Yeah, two pass is a bad idea. + After previous command the recent order[order.length-1] become new context. Purpose is to + switch context faster. context. Consider a two-pass search of the target word, in context and + in wordhash if not found in context while context vocabulary word always has its own wordhash + ready. + [x] If use two-pass search, then all words need to be searched twice. Consider the cost! + ==> Yeah, two pass is a bad idea. [x] Switch context inevitably triggers a wordhash rescan, it's faster if rescan only the target - vocabulary into the current wordhash{} while the previous wordhash{} is not totally disappeared, - only overritten with the alternative definitions. Un-replaced words are still visible. - --> So if we want to use vocabulary 'assembly' words, we don't need to 'also assembly' but - simply 'assembly'. If the order was [forth,misc] then all words in 'misc' were visible - while after running 'assembly' only public words in 'misc' are visible because it's not - the context now. In contrast with traditional forth, all 'misc' words are invisible once - context switched to 'assembly'. That's actually an overkill of switching to 'assembly'! - So the new design is better. If I want to use vocabulary forth, misc, io, and math. I - simply execute "forth misc io math" instead of "also forth also misc also io also math". - However, the rear method is still workable as before. - --> The downside is that after 'previous' command too many words will be disappeared. - However, that is not a new problems caused by the new design of vocabulary words. - So, the idea is still attractive. - ==> Done !! 17:37 January 7, 2017 - [x] Problem found but not a problem!! - Selftest failed when selftest 3hta because 'bye' redefined by vb.f that returns errorlevel - has been replaced by the original 'bye' defined in forth. Because context switched to forth - somewhere before running the selftest although in order vb.f has higher priority due to the - new design the active 'bye' is the older one. This is NOT 100% a problem because the vb.f bye - can be inactive anytime unexpectedly like this case. The correct way to reDef 'forth bye' is - to put the new 'bye' defined in vb.f into the 'forth' vocabulary. ---> Done, and it works now. + vocabulary into the current wordhash{} while the previous wordhash{} is not totally disappeared, + only overritten with the alternative definitions. Un-replaced words are still visible. + --> So if we want to use vocabulary 'assembly' words, we don't need to 'also assembly' but + simply 'assembly'. If the order was [forth,misc] then all words in 'misc' were visible + while after running 'assembly' only public words in 'misc' are visible because it's not + the context now. In contrast with traditional forth, all 'misc' words are invisible once + context switched to 'assembly'. That's actually an overkill of switching to 'assembly'! + So the new design is better. If I want to use vocabulary forth, misc, io, and math. I + simply execute "forth misc io math" instead of "also forth also misc also io also math". + However, the rear method is still workable as before. + --> The downside is that after 'previous' command too many words will be disappeared. + However, that is not a new problems caused by the new design of vocabulary words. + So, the idea is still attractive. + ==> Done !! 17:37 January 7, 2017 + [x] Problem found but not a problem!! + Selftest failed when selftest 3hta because 'bye' redefined by vb.f that returns errorlevel + has been replaced by the original 'bye' defined in forth. Because context switched to forth + somewhere before running the selftest although in order vb.f has higher priority due to the + new design the active 'bye' is the older one. This is NOT 100% a problem because the vb.f bye + can be inactive anytime unexpectedly like this case. The correct way to reDef 'forth bye' is + to put the new 'bye' defined in vb.f into the 'forth' vocabulary. ---> Done, and it works now. [x] 3ce, list-tabs hang up !!! --> Chrome in trouble, restart then ok. [x] setup.bat should not include private folder. If want to include private folder separately do - it manually. ==> done. - [x] Need a command to make many tokens alias of \ comment, useful for batch program. - ==> aliases works fine, for 3HTA only. + it manually. ==> done. + [x] Need a command to make many tokens alias of \ comment, useful for batch program. + ==> aliases works fine, for 3HTA only. [x] \r|\n and \n|\r are different! char \r|\n word :> split(/\s+/) may having a ending - extra null string. ---> no, see log.txt beginning. The recent problem has been fixed - by using a dummy to the string. + extra null string. ---> no, see log.txt beginning. The recent problem has been fixed + by using a dummy to the string. [x] many words in jeforth.f and 3htm/f/platform.f are now private - [x] Big Problem!! I make doNext a private word, so tick("doNext") returns 0 then <--- problem!! - So not only execute("callByName") in trouble, tick("name") too!!! - --> let doNext be a public, it'll be carried too far to make it private. - [x] Let execute() and tick() to warn if the target word is a private word when - selftest is on. That warning only appear in selftest on mode so they are different - versions. Refer to fastInner() and debugInner(), jeforth.js functions - can be replaced very easily. - --> This idea works! tick = vm.g.selftest_tick = function tick(name) catches private words - Warning! private word description referenced by name in tick()! - Warning! private word expected_rstack referenced by name in tick()! - Warning! private word expected_stack referenced by name in tick()! - Warning! private word test-result referenced by name in tick()! - Warning! private word [all-pass] referenced by name in tick()! - [x] These private words are only used in the same module, make them be private - at the end of the module : - ' description :: private=true - ' expected_rstack :: private=true - ' expected_stack :: private=true - ' test-result :: private=true - ' [all-pass] :: private=true - --> this is annoying, because then we can't make the word private when define it. - Use this idea when in jeforth.f to avoid warnings is fine. - ==> Done, default only warning when in selftest mode. - warning-on to turn on the run-time warning any time. - [x] need a word 'all' to scan all words so they are all public temporarily. So 'all words' - lists all words. --> it works fine! - [x] what if to have executeAbs(vid,w) and tickAbs(vid,w) for refering to private words? - --> Make them public is easier and more natural. If a word is warned by execute() - and tick() then consider to make it public. + [x] Big Problem!! I make doNext a private word, so tick("doNext") returns 0 then <--- problem!! + So not only execute("callByName") in trouble, tick("name") too!!! + --> let doNext be a public, it'll be carried too far to make it private. + [x] Let execute() and tick() to warn if the target word is a private word when + selftest is on. That warning only appear in selftest on mode so they are different + versions. Refer to fastInner() and debugInner(), jeforth.js functions + can be replaced very easily. + --> This idea works! tick = vm.g.selftest_tick = function tick(name) catches private words + Warning! private word description referenced by name in tick()! + Warning! private word expected_rstack referenced by name in tick()! + Warning! private word expected_stack referenced by name in tick()! + Warning! private word test-result referenced by name in tick()! + Warning! private word [all-pass] referenced by name in tick()! + [x] These private words are only used in the same module, make them be private + at the end of the module : + ' description :: private=true + ' expected_rstack :: private=true + ' expected_stack :: private=true + ' test-result :: private=true + ' [all-pass] :: private=true + --> this is annoying, because then we can't make the word private when define it. + Use this idea when in jeforth.f to avoid warnings is fine. + ==> Done, default only warning when in selftest mode. + warning-on to turn on the run-time warning any time. + [x] need a word 'all' to scan all words so they are all public temporarily. So 'all words' + lists all words. --> it works fine! + [x] what if to have executeAbs(vid,w) and tickAbs(vid,w) for refering to private words? + --> Make them public is easier and more natural. If a word is warned by execute() + and tick() then consider to make it public. [x] 3nd selftest failed at - Including fs.f - Error! "msg"abort unknown. <---- can't be private. + Including fs.f + Error! "msg"abort unknown. <---- can't be private. [x] 3ce attach target tab in trouble again now!! - --> search "attach 3ce to target page does not work" above for how to debug. - --> F7 or (dictate) both need attach the target tab first, try them: --> both work!!! - --> readTextFile suspected again ... yes it is the criminal due to: - > char manifest.json readTextFileAuto . \ {F7} - dummy,doc,f,3htm/f,3htm/canvas,3htm,3ce,playground OK <--- problem! the file is not read correctly - --> trace back develop versions... all failed --> re-start Chrome then OK! Shit + --> search "attach 3ce to target page does not work" above for how to debug. + --> F7 or (dictate) both need attach the target tab first, try them: --> both work!!! + --> readTextFile suspected again ... yes it is the criminal due to: + > char manifest.json readTextFileAuto . \ {F7} + dummy,doc,f,3htm/f,3htm/canvas,3htm,3ce,playground OK <--- problem! the file is not read correctly + --> trace back develop versions... all failed --> re-start Chrome then OK! Shit [x] Redefine (words) to support 'all' command. Rename to word_select. - --> code wordhash>array ( "vid" -- array ) \ Retrive a VID list from the recent active words hash - \ it works now! see you tomorrow with my Metamoji note on X1 Yoga. - --> Test [x] 3htm (help) + --> code wordhash>array ( "vid" -- array ) \ Retrive a VID list from the recent active words hash + \ it works now! see you tomorrow with my Metamoji note on X1 Yoga. + --> Test [x] 3htm (help) [x] 準備 release master 新版 release 新版 master : af266a3f8c4fefafc04947e9ba0b89d9f3601eed - o search "kvm.minor_version" increase 版號。 - [x] jeforth.3nd.js --> kvm.minor_version = 203 -> 204 - [x] 3nw, jeforth.3we/package.json version 223 -> 224 - [x] jeforth.3htm.js --> kvm.minor_version = 203 -> 204 - [x] jeforth.3ce.js(3ce extension pages)-> 203 kvm.minor_version = 204 - [x] jeforth.3ce, ce.f(Target page) -> vm.minor_version = 203 -> vm.minor_version = 204 - [x] jeforth.3ce, background.js vm.minor_version = 203 -> vm.minor_version = 204 - [x] jeforth.hta --> tag. VERSION="204" -> VERSION="205" - [/] jeforth.3ca, also jeforth.3htm.js above - o selftest them all - [x] setup.bat - [x] 3nw use 3hta to fork cmd /c start nw ../jeforth.3we - [x] 3nd - [x] run webserver.f - [x] 3htm use 3nw or 3nd to include webserver.f and then localhost:8888 - [x] 3hta - [x] 3ce - [x] attach to target pages - [x] 3ca - [x] Testing all demo - [x] 12choc.f , [x] alarm.f , [x] ball.f(non-selftest mode) , [x] blowing-in-the-wind.f , - [x] box2dweb-arrow.f , [x] calc.f , [x] chipmunk-js-pyramidstack.f , - [x] flot-demo.f , [x] h2o.f , [x] many-clocks.f , [x] numeric-demo.f , - [x] solar-system.f - [x] alarm.f has this problem so it doesn't work in 3ce and 3ca - Refused to execute inline event handler because it violates the following Content - Security Policy ---> fixed. - [x] commit develop -> 將 develop 分支發佈到 Master 分支的命令 : - 切換到Master分支 : git checkout master - 合併 develop 分支進 master 來 : git merge --no-ff develop - [/] Test the master all over again ... ignored, lazy. - [x] Master 到回 develop - 切換到Master分支 : git checkout develop - 合併 develop 分支進 master 來 : git merge --no-ff master - [ ] release note + o search "kvm.minor_version" increase 版號。 + [x] jeforth.3nd.js --> kvm.minor_version = 203 -> 204 + [x] 3nw, jeforth.3we/package.json version 223 -> 224 + [x] jeforth.3htm.js --> kvm.minor_version = 203 -> 204 + [x] jeforth.3ce.js(3ce extension pages)-> 203 kvm.minor_version = 204 + [x] jeforth.3ce, ce.f(Target page) -> vm.minor_version = 203 -> vm.minor_version = 204 + [x] jeforth.3ce, background.js vm.minor_version = 203 -> vm.minor_version = 204 + [x] jeforth.hta --> tag. VERSION="204" -> VERSION="205" + [/] jeforth.3ca, also jeforth.3htm.js above + o selftest them all + [x] setup.bat + [x] 3nw use 3hta to fork cmd /c start nw ../jeforth.3we + [x] 3nd + [x] run webserver.f + [x] 3htm use 3nw or 3nd to include webserver.f and then localhost:8888 + [x] 3hta + [x] 3ce + [x] attach to target pages + [x] 3ca + [x] Testing all demo + [x] 12choc.f , [x] alarm.f , [x] ball.f(non-selftest mode) , [x] blowing-in-the-wind.f , + [x] box2dweb-arrow.f , [x] calc.f , [x] chipmunk-js-pyramidstack.f , + [x] flot-demo.f , [x] h2o.f , [x] many-clocks.f , [x] numeric-demo.f , + [x] solar-system.f + [x] alarm.f has this problem so it doesn't work in 3ce and 3ca + Refused to execute inline event handler because it violates the following Content + Security Policy ---> fixed. + [x] commit develop -> 將 develop 分支發佈到 Master 分支的命令 : + 切換到Master分支 : git checkout master + 合併 develop 分支進 master 來 : git merge --no-ff develop + [/] Test the master all over again ... ignored, lazy. + [x] Master 到回 develop + 切換到Master分支 : git checkout develop + 合併 develop 分支進 master 來 : git merge --no-ff master + [ ] release note [x] git.f in trouble now, due to (fork) definition changed, it's quiet now, is that the root cause? - > launch-git-shell - JavaScript error on word "(fork)" : Invalid procedure call or argument - ==> No! git.f doesn't know the Git Shell path. That needs manual setup by editing git.f - and I didn't do that for this computer yet. + > launch-git-shell + JavaScript error on word "(fork)" : Invalid procedure call or argument + ==> No! git.f doesn't know the Git Shell path. That needs manual setup by editing git.f + and I didn't do that for this computer yet. [x] setup.bat to create one more folder : jeforth.3htm [x] (.0r) Negative numbers become "0000-123", - --> use Math.sign to fix it. --> no such problem! Shit. True only for strings like: - > -123 :> toString() 8 .0r \ ==> 0000-123 OK - that's normal. + --> use Math.sign to fix it. --> no such problem! Shit. True only for strings like: + > -123 :> toString() 8 .0r \ ==> 0000-123 OK + that's normal. - ------ jeforth.3we release R1 ------- + ------ jeforth.3we release R1 ------- [x] The correct way to run a jeforth release through rawgit.com is : - https://cdn.rawgit.com/hcchengithub/jeforth.3we/R1/index.html - IE works fine too. Where, the leading 'cdn.' is still necessary for IE but not for - Chrome browser. + https://cdn.rawgit.com/hcchengithub/jeforth.3we/R1/index.html + IE works fine too. Where, the leading 'cdn.' is still necessary for IE but not for + Chrome browser. [ ] jeforth.3htm run through rawgit.com has some problems on Android cell phone - [ ] The outputbox background color covers only half screen when cell phone is - not vertical. - [ ] 12choc.f can not drag and drop objects on Andorid browser. + [ ] The outputbox background color covers only half screen when cell phone is + not vertical. + [ ] 12choc.f can not drag and drop objects on Andorid browser. [ ] webserver.bat 要避免重複跑,multiple instance 搶著當 localHost server 不可能。 [ ] hcchen5600 2015/11/13 10:46:32 - hash>column2 改寫成好用的介面。 + hash>column2 改寫成好用的介面。 [x] How to make a release on GitHub? Not only a master commit, but an official release. - ==> Ynote: GitHub Creating Releases.note + ==> Ynote: GitHub Creating Releases.note [x] Unify the version. See above log of a master release, it takes a lot of efforts to modify - the version code of each application. - --> ./js/version.js minor_version all 301 - [x] jeforth.3nd.js - [x] 3nw, jeforth.3we\jeforth.3nw.html - [x] 3htm, 3ca, jeforth.3we\3htm\js\jeforth.3htm.js - [x] 3ca, also jeforth.3htm.js above - [x] 3ce.js(3ce extension pages) - [x] 3ce, ce.f (Target page) - [x] 3ce, jeforth.3ce.background.html, background.js vm.minor_version=jeforth3we_minor_version - [x] 3hta, --> tag. VERSION="204" -> VERSION="205" + the version code of each application. + --> ./js/version.js minor_version all 301 + [x] jeforth.3nd.js + [x] 3nw, jeforth.3we\jeforth.3nw.html + [x] 3htm, 3ca, jeforth.3we\3htm\js\jeforth.3htm.js + [x] 3ca, also jeforth.3htm.js above + [x] 3ce.js(3ce extension pages) + [x] 3ce, ce.f (Target page) + [x] 3ce, jeforth.3ce.background.html, background.js vm.minor_version=jeforth3we_minor_version + [x] 3hta, --> tag. VERSION="204" -> VERSION="205" [x] Remove the : - js: outputbox.style.fontSize="1.5em" - from the default autoexec of ls.f. I have resolved the problem for a while, no need this now. + js: outputbox.style.fontSize="1.5em" + from the default autoexec of ls.f. I have resolved the problem for a while, no need this now. [ ] 3ce to support new command 'highlight' or 螢光筆 to modify active tab. Making Web browser to - note taking annotating tool directly. + note taking annotating tool directly. [x] After supporting private, word count shown in words command and help command are still correct? - --> 3htm v3.204 no problem. + --> 3htm v3.204 no problem. [x] 3htm v3.204 and all friends have a problem. After include 12choc.f, words still shows all - ls.f's 56 words. I thought include command is I/O bound and thus it should does rescan-word-hash - every time. Another symptom is after executing - also misc.f - rescan-word-hash is expected too, but no! So it's a bug. Actually, for speed, only vocabulary words - do not rescan all other vocabulary words (only [*]also previous include [x]set-context not-only forget - prioritize marker) should rescan-word-hash. + ls.f's 56 words. I thought include command is I/O bound and thus it should does rescan-word-hash + every time. Another symptom is after executing + also misc.f + rescan-word-hash is expected too, but no! So it's a bug. Actually, for speed, only vocabulary words + do not rescan all other vocabulary words (only [*]also previous include [x]set-context not-only forget + prioritize marker) should rescan-word-hash. [x] Bug, execute not-only several times, it repeats all word-lists in order [ ] Release test automation - [ ] Selftest of all applications - [ ] 3ce attach manual test - [ ] All demos + [ ] Selftest of all applications + [ ] 3ce attach manual test + [ ] All demos [/] run command still of ls.f after executed forth. - --> shit! my fault. Windows 'run' command is defined in wsh.f. + --> shit! my fault. Windows 'run' command is defined in wsh.f. [ ] 19:36 2017-02-18 The background story is that I want to transfer files from one computer to anohter - in my office. Possible ways are : USB HDD, Yun.Baidu.com, FTP server, and the likes. They all requires - two steps, copy to a media and then copy to the target computer. - Install HFS or FTP server on one computer can really make it better but HFS is a failure, + in my office. Possible ways are : USB HDD, Yun.Baidu.com, FTP server, and the likes. They all requires + two steps, copy to a media and then copy to the target computer. + Install HFS or FTP server on one computer can really make it better but HFS is a failure, - see Ynote: - "HFS ~ Http File Server , homepage and binary" + see Ynote: + "HFS ~ Http File Server , homepage and binary" - and sure FTP needs setup too. I actually don't remember - how to arrange a FTP server now. While, jeforth.3nd or 3nw webserver + wget is a solution I like. - Therefore, I am now interested to study webserver.f and try to improve it. + and sure FTP needs setup too. I actually don't remember + how to arrange a FTP server now. While, jeforth.3nd or 3nw webserver + wget is a solution I like. + Therefore, I am now interested to study webserver.f and try to improve it. - I was studying this : "Build Your First HTTP Server in Node.js" https://www.diigo.com/user/hcchen/b/373115646 - yesterday. See ~\jeforth.3we\playground\build_your_http_server.f + I was studying this : "Build Your First HTTP Server in Node.js" https://www.diigo.com/user/hcchen/b/373115646 + yesterday. See ~\jeforth.3we\playground\build_your_http_server.f - I studied how to use node.js to build a web site before, see Yun.baidu.com "ebook NODE.js" + I studied how to use node.js to build a web site before, see Yun.baidu.com "ebook NODE.js" [x] 3ca's vm.appname should be jeforth.3ca (it's now ~.3htm) - solution is to read the name field in manifest.json: - js> chrome :> app.getDetails().name \ ==> "jeforth.3ca" or "jeforth.3ce" - Example: - js> vm.appname=='jeforth.3htm'&&chrome.app.getDetails().name=="jeforth.3ca" [if] - s" Abort: jeforth.3ca restricted HTML input file tag." - "msg"abort cr - [then] + solution is to read the name field in manifest.json: + js> chrome :> app.getDetails().name \ ==> "jeforth.3ca" or "jeforth.3ce" + Example: + js> vm.appname=='jeforth.3htm'&&chrome.app.getDetails().name=="jeforth.3ca" [if] + s" Abort: jeforth.3ca restricted HTML input file tag." + "msg"abort cr + [then] [x] 18:18 2017-02-23 Studying how to use HTML post to upload files. - [x] Can't use 3ca to do this study due to its restrictions. - 誤會一場,只是 HTML event handler 不能 inline 指定而已。早已有解。 3ce & 3ca both ok - [x] Yes, we can use 3ca and 3ce to study input type=file tag - \ MSDN input type=file element | input type=file object - \ Example from this page https://msdn.microsoft.com/en-us/library/ms535263(v=vs.85).aspx - - var f = function getFiles() { - debugger; - // Get input element - myFileList = document.getElementById("myfiles"); - // loop through files property, using length to get number of files chosen - for (var i = 0; i < myFileList.files.length; i++) { - // display them in the div - document.getElementById("display").innerHTML += "
" + myFileList.files[i].name ; - } - };f - constant getFiles // ( -- func ) event handler - - -
-
drop - getFiles js: myfiles.onchange=pop() \ 3ce doesn't accept inline event handler - [ ] The upload form example from ipad "USB Disk Pro" http://192.168.0.196:8080/ HFS: -
- - <----------- add multiple see see - -
- --> It really works in 3ce attached console. So how to do the samething through - JavaScript for automation? - [x] Post是将表单中的数据放在form的数据体中,按照变量和值相对应的方式,传递到action所指向URL。 - --> So I don't need to attach to the real target page. Just letting above form's - action="192.168.0.196:8080" <--- no it doesn't work. The page must be connected. - [x] 強行添加 multiple to --> it doesn't work. - only one file transfered still. - [x] Try to assign pathname directly @ 3ce attached console - $("input")[1].value="c:\Users\hcche\Downloads\1.au3" - JavaScript error : Failed to set the 'value' property on 'HTMLInputElement': This input - element accepts a filename, which may only be programmatically set to the empty string. - --> is this to the "USB Disk Pro" page only? - --> all input type=file do not accept value to be set to non-empty. - [x] Get filename though my input type=file but submit them manually - --> all input type=file do not accept value to be set to non-empty. - [ ] I also tried to use FTP server on my computer hoping iPad can then download files from it. - But cesarFTP does not work now! and Filezilla needs to learn how to use. + [x] Can't use 3ca to do this study due to its restrictions. + 誤會一場,只是 HTML event handler 不能 inline 指定而已。早已有解。 3ce & 3ca both ok + [x] Yes, we can use 3ca and 3ce to study input type=file tag + \ MSDN input type=file element | input type=file object + \ Example from this page https://msdn.microsoft.com/en-us/library/ms535263(v=vs.85).aspx + + var f = function getFiles() { + debugger; + // Get input element + myFileList = document.getElementById("myfiles"); + // loop through files property, using length to get number of files chosen + for (var i = 0; i < myFileList.files.length; i++) { + // display them in the div + document.getElementById("display").innerHTML += "
" + myFileList.files[i].name ; + } + };f + constant getFiles // ( -- func ) event handler + + +
+
drop + getFiles js: myfiles.onchange=pop() \ 3ce doesn't accept inline event handler + [ ] The upload form example from ipad "USB Disk Pro" http://192.168.0.196:8080/ HFS: +
+ + <----------- add multiple see see + +
+ --> It really works in 3ce attached console. So how to do the samething through + JavaScript for automation? + [x] Post是将表单中的数据放在form的数据体中,按照变量和值相对应的方式,传递到action所指向URL。 + --> So I don't need to attach to the real target page. Just letting above form's + action="192.168.0.196:8080" <--- no it doesn't work. The page must be connected. + [x] 強行添加 multiple to --> it doesn't work. + only one file transfered still. + [x] Try to assign pathname directly @ 3ce attached console + $("input")[1].value="c:\Users\hcche\Downloads\1.au3" + JavaScript error : Failed to set the 'value' property on 'HTMLInputElement': This input + element accepts a filename, which may only be programmatically set to the empty string. + --> is this to the "USB Disk Pro" page only? + --> all input type=file do not accept value to be set to non-empty. + [x] Get filename though my input type=file but submit them manually + --> all input type=file do not accept value to be set to non-empty. + [ ] I also tried to use FTP server on my computer hoping iPad can then download files from it. + But cesarFTP does not work now! and Filezilla needs to learn how to use. [ ] 17:17 2017-03-01 RStudio Source box is a very good example to learn. ls.f ed [run] button - needs improvement. Running throught he entire field is not good for exercise. Run only - one line and a way to run multiple lines and also the entire field is an interesting - challenge. + needs improvement. Running throught he entire field is not good for exercise. Run only + one line and a way to run multiple lines and also the entire field is an interesting + challenge. [ ] Installer! - jeforth.3htm run from rawgit or anywhere to be an installer of other jeforth.3we applications. + jeforth.3htm run from rawgit or anywhere to be an installer of other jeforth.3we applications. [ ] alarm.f needs to support repeating. No interface, just a command would be good - enough. - [ ] when 00:00:00 click start or pause should stop the music and become Start. - if is not playing the music then do nothing. - [ ] when repeat is on then play the music for _given_ seconds the reset - and start again. + enough. + [ ] when 00:00:00 click start or pause should stop the music and become Start. + if is not playing the music then do nothing. + [ ] when repeat is on then play the music for _given_ seconds the reset + and start again. [ ] 15:20 2017-05-04 - debug why include alarm.f from http://cdn.rawgit.com/hcchengithub/jeforth.3we/develop/index.html - makes errors like: repeating undefined, execute warnings about private variables that are called - by name, etc. **Only** when running through rawgit.com. - [/] alarm.f does not play music when running through rawgit.com. <--- forget it. - Through localhost is fine. See below good news. - [x] Good news! alarm.f works fine on Android cell phone if running through : - 192.168.1.153:8888?include alarm.f ... etc - on Chrome browser. The repeating and the music are both ok. - The Web server side is my T550 notebook, webserver.bat of jeforth. - [ ] does it still work if walk away from wifi? - [x] How to make a ~.f file to have a music object? I wish the music object can resolve the mp3 - done! "include MP3-wait-a-while.f" and then "wait-a-while.mp3 :: play()", works fine on 3ca. - [x] But find problem when reading them from GitHub through cdn.rawgit.com - include on URL or command line both create problem : "Error! Usage: unknown." - but the "Usage:" is in !! --> try w/o cdn. ... "Error! Failed to read f/jeforth.f" known problem. - --> 3ce, 3hta works fine too. --> how about local webserver? .. OK on local --> remote : Ok too!! - http://192.168.1.158:8888 then include then play(), really ok. --> try to read .f instead of include it - on the rawgit.com case ... Strange! readTextFile then tib.insert creates the same problem!! --> check - self-test first, something wrong maybe. ... No! --> copy-paste MP3-wait-a-while.f through ... - Failed!! so it's easy now. Because copy-past .f still failed. Debug the then ... add a - "js: debugger" before the comment fixed the problem!! --> try a blank line instead of the js: debugger - ... ok too! --> So, a \ comment seems eats the next word if it's followed with a total blank line! - Simply a space after the \ fixes the problem. The \ alone on the a line actually eats the next line - entirely. so study \ command .... it has only one statement : nexttoken('\n'), while definition of // is: - last().help = nexttoken('\n|\r'); ... so // has the same problem!! <---- YES!! - ==> Root cause is nexttoken(), it always eats the next character so \ ignores the \n and the next line - becomes the comment line. When it's then the following comments are interpreted unexpectedly. - --> why happen only on rawgit.com? ... Ha! Not only happen on rawgit.com but also other cases! If - testd directly by using : - - \ - - ." Error" constant t t tib.insert - --> When the .f is read from readTextFile on 3ca, the \ line is actually "\\\r\n" - 177: :13 - 178: - :10 - 179:\:92 - 180: :13 - 181: - :10 - 182:<:60 - 183:c:99 - 184:o:111 - 185:m:109 - 186:m:109 - 187:e:101 - 188:n:110 - 189:t:116 - 190:>:62 - 191: :13 - , every end-of-line are \r\n actually. But when running through rawgit.com, end-of-line become \n only. - when the \n eaten by nexttoken() the next line become comment. <--- Problem!! Root Cause !!! - --> Try 'word' command, it probably has the same problem. - > : comment CR word drop ; - > comment - ." Hello" - OK <-------------- Indeed! the next line is eaten by 'comment' unexpectedly - > comment <--- add a space - ." Hello" - Hello OK <--------- then OK - [x] So, nexttoken() to always eat the next character is not very good. Should not when delimiter is : - case '\\n': case '\\r': case '\\n|\\r': case '\\r|\\n': - case '\n': case '\r': case '\n|\r': case '\r|\n': - Where '\n' and '\\n' are same or not depends on nextstring(RegEx), I think they are same. - Because a real '\n' and a symble '\\n' is same to String.search() I guess. The following experiment has proved this: - > - aa - bb cc - :> search("\\t") \ ==> 5 (number) - OK - > - aa - bb cc - :> search("\t") \ ==> 5 (number) 證明 '\t' '\\t' 效果一樣 - OK - > - aa - bb cc - :> search("cc") \ ==> 6 (number) - OK - But \s \w \d are RegEx symbole, they must be \\s \\w \\d if appear in a delimiter. - - aa 123 - bb cc - :> search("\\d") \ ==> 3 (number) , if "\d" instead then result will be -1. + debug why include alarm.f from http://cdn.rawgit.com/hcchengithub/jeforth.3we/develop/index.html + makes errors like: repeating undefined, execute warnings about private variables that are called + by name, etc. **Only** when running through rawgit.com. + [/] alarm.f does not play music when running through rawgit.com. <--- forget it. + Through localhost is fine. See below good news. + [x] Good news! alarm.f works fine on Android cell phone if running through : + 192.168.1.153:8888?include alarm.f ... etc + on Chrome browser. The repeating and the music are both ok. + The Web server side is my T550 notebook, webserver.bat of jeforth. + [ ] does it still work if walk away from wifi? + [x] How to make a ~.f file to have a music object? I wish the music object can resolve the mp3 + done! "include MP3-wait-a-while.f" and then "wait-a-while.mp3 :: play()", works fine on 3ca. + [x] But find problem when reading them from GitHub through cdn.rawgit.com + include on URL or command line both create problem : "Error! Usage: unknown." + but the "Usage:" is in !! --> try w/o cdn. ... "Error! Failed to read f/jeforth.f" known problem. + --> 3ce, 3hta works fine too. --> how about local webserver? .. OK on local --> remote : Ok too!! + http://192.168.1.158:8888 then include then play(), really ok. --> try to read .f instead of include it + on the rawgit.com case ... Strange! readTextFile then tib.insert creates the same problem!! --> check + self-test first, something wrong maybe. ... No! --> copy-paste MP3-wait-a-while.f through ... + Failed!! so it's easy now. Because copy-past .f still failed. Debug the then ... add a + "js: debugger" before the comment fixed the problem!! --> try a blank line instead of the js: debugger + ... ok too! --> So, a \ comment seems eats the next word if it's followed with a total blank line! + Simply a space after the \ fixes the problem. The \ alone on the a line actually eats the next line + entirely. so study \ command .... it has only one statement : nexttoken('\n'), while definition of // is: + last().help = nexttoken('\n|\r'); ... so // has the same problem!! <---- YES!! + ==> Root cause is nexttoken(), it always eats the next character so \ ignores the \n and the next line + becomes the comment line. When it's then the following comments are interpreted unexpectedly. + --> why happen only on rawgit.com? ... Ha! Not only happen on rawgit.com but also other cases! If + testd directly by using : + + \ + + ." Error" constant t t tib.insert + --> When the .f is read from readTextFile on 3ca, the \ line is actually "\\\r\n" + 177: :13 + 178: + :10 + 179:\:92 + 180: :13 + 181: + :10 + 182:<:60 + 183:c:99 + 184:o:111 + 185:m:109 + 186:m:109 + 187:e:101 + 188:n:110 + 189:t:116 + 190:>:62 + 191: :13 + , every end-of-line are \r\n actually. But when running through rawgit.com, end-of-line become \n only. + when the \n eaten by nexttoken() the next line become comment. <--- Problem!! Root Cause !!! + --> Try 'word' command, it probably has the same problem. + > : comment CR word drop ; + > comment + ." Hello" + OK <-------------- Indeed! the next line is eaten by 'comment' unexpectedly + > comment <--- add a space + ." Hello" + Hello OK <--------- then OK + [x] So, nexttoken() to always eat the next character is not very good. Should not when delimiter is : + case '\\n': case '\\r': case '\\n|\\r': case '\\r|\\n': + case '\n': case '\r': case '\n|\r': case '\r|\n': + Where '\n' and '\\n' are same or not depends on nextstring(RegEx), I think they are same. + Because a real '\n' and a symble '\\n' is same to String.search() I guess. The following experiment has proved this: + > + aa + bb cc + :> search("\\t") \ ==> 5 (number) + OK + > + aa + bb cc + :> search("\t") \ ==> 5 (number) 證明 '\t' '\\t' 效果一樣 + OK + > + aa + bb cc + :> search("cc") \ ==> 6 (number) + OK + But \s \w \d are RegEx symbole, they must be \\s \\w \\d if appear in a delimiter. + + aa 123 + bb cc + :> search("\\d") \ ==> 3 (number) , if "\d" instead then result will be -1. [x] 19:21 May 15, 2017 - How to maintain jeforth.3we wiki on Github? I make a record here. - [x] This is how to clone the wiki from GitHub to local computer. Use Git Shell. - ~\Documents\GitHub> git clone https://github.com/hcchengithub/jeforth.3we/wiki <------------ Wrong URL !!! - Cloning into 'wiki'... - fatal: https://github.com/hcchengithub/jeforth.3we/wiki/info/refs not valid: is this a git repository? - ~\Documents\GitHub> git clone https://github.com/hcchengithub/jeforth.3we.wiki <----------- Corect URL !!! - Cloning into 'jeforth.3we.wiki'... - remote: Counting objects: 199, done. - remote: Total 199 (delta 0), reused 0 (delta 0), pack-reused 199Receiving objects: 64% (129/199), 580.01 KiB | 63.00 Ki - - Receiving objects: 100% (199/199), 629.37 KiB | 68.00 KiB/s, done. - Resolving deltas: 100% (97/97), done. - ~\Documents\GitHub> - [x] I am now debugging why this hyperlink in README.md does not work?? - ![SimpleMDE markdown editor](doc/README.md/demo 3nw mde editor.JPG) - While this works - ![SimpleMDE markdown editor](doc/README.md/demo-pyramidstack.png) - 工作做一半的結果,又重新解了一次老問題。 README.md 或 wiki pages 裡 - ![SimpleMDE markdown editor](doc/README.md/demo_3nw_mde_editor.JPG) path 可能是「不能有空格」,也可 - 能是我自己把檔名改成用 under line 取代空格了。 + How to maintain jeforth.3we wiki on Github? I make a record here. + [x] This is how to clone the wiki from GitHub to local computer. Use Git Shell. + ~\Documents\GitHub> git clone https://github.com/hcchengithub/jeforth.3we/wiki <------------ Wrong URL !!! + Cloning into 'wiki'... + fatal: https://github.com/hcchengithub/jeforth.3we/wiki/info/refs not valid: is this a git repository? + ~\Documents\GitHub> git clone https://github.com/hcchengithub/jeforth.3we.wiki <----------- Corect URL !!! + Cloning into 'jeforth.3we.wiki'... + remote: Counting objects: 199, done. + remote: Total 199 (delta 0), reused 0 (delta 0), pack-reused 199Receiving objects: 64% (129/199), 580.01 KiB | 63.00 Ki + + Receiving objects: 100% (199/199), 629.37 KiB | 68.00 KiB/s, done. + Resolving deltas: 100% (97/97), done. + ~\Documents\GitHub> + [x] I am now debugging why this hyperlink in README.md does not work?? + ![SimpleMDE markdown editor](doc/README.md/demo 3nw mde editor.JPG) + While this works + ![SimpleMDE markdown editor](doc/README.md/demo-pyramidstack.png) + 工作做一半的結果,又重新解了一次老問題。 README.md 或 wiki pages 裡 + ![SimpleMDE markdown editor](doc/README.md/demo_3nw_mde_editor.JPG) path 可能是「不能有空格」,也可 + 能是我自己把檔名改成用 under line 取代空格了。 [x] README.md add the "12 choc" demo before update to master [ ] 錄製 12choc.f 的說明影片。 [ ] Make a master release and update the issue https://github.com/hcchengithub/jeforth.3we/issues/5 [x] 準備 release master 新版 release 新版 master - [x] jeforth.3we\js\version.js --> jeforth3we_minor_version = 303; - [ ] Check the date stamp at the bottom of README.md - o selftest them all - [x] setup.bat - [x] 3nw use 3hta to fork cmd /c start nw ../jeforth.3we - [x] 3nd - [x] run webserver.f - [x] 3htm use 3nw or 3nd to include webserver.f and then localhost:8888 - [x] 3hta - [x] 3ce - [x] attach to target pages - [x] 3ca - [x] Testing all demo - [x] 12choc.f , [x] alarm.f , [x] ball.f(non-selftest mode) , [x] blowing-in-the-wind.f , - [x] box2dweb-arrow.f , [x] calc.f , [x] chipmunk-js-pyramidstack.f , - [x] flot-demo.f , [x] h2o.f , [x] many-clocks.f , [x] numeric-demo.f , alarm.f - [x] solar-system.f, [ ] tutor-cloth.f - [x] commit develop -> 將 develop 分支發佈到 Master 分支的命令 : - 切換到Master分支 : git checkout master - 合併 develop 分支進 master 來 : git merge --no-ff develop - [/] Test the master all over again ... ignored, lazy. - [x] Upload master to GitHub : git push - [x] Master 到回 develop - 切換到Master分支 : git checkout develop - 合併 develop 分支進 master 來 : git merge --no-ff master - [x] Complete this log.txt - [ ] release note + [x] jeforth.3we\js\version.js --> jeforth3we_minor_version = 303; + [ ] Check the date stamp at the bottom of README.md + o selftest them all + [x] setup.bat + [x] 3nw use 3hta to fork cmd /c start nw ../jeforth.3we + [x] 3nd + [x] run webserver.f + [x] 3htm use 3nw or 3nd to include webserver.f and then localhost:8888 + [x] 3hta + [x] 3ce + [x] attach to target pages + [x] 3ca + [x] Testing all demo + [x] 12choc.f , [x] alarm.f , [x] ball.f(non-selftest mode) , [x] blowing-in-the-wind.f , + [x] box2dweb-arrow.f , [x] calc.f , [x] chipmunk-js-pyramidstack.f , + [x] flot-demo.f , [x] h2o.f , [x] many-clocks.f , [x] numeric-demo.f , alarm.f + [x] solar-system.f, [ ] tutor-cloth.f + [x] commit develop -> 將 develop 分支發佈到 Master 分支的命令 : + 切換到Master分支 : git checkout master + 合併 develop 分支進 master 來 : git merge --no-ff develop + [/] Test the master all over again ... ignored, lazy. + [x] Upload master to GitHub : git push + [x] Master 到回 develop + 切換到Master分支 : git checkout develop + 合併 develop 分支進 master 來 : git merge --no-ff master + [x] Complete this log.txt + [ ] release note [ ] README.md to include - http://cdn.rawgit.com/hcchengithub/jeforth.3we/r2/index.html?cls_include_tutor-cloth.f + http://cdn.rawgit.com/hcchengithub/jeforth.3we/r2/index.html?cls_include_tutor-cloth.f [ ] Try to use Ubuntu NW.js or Node.js to try jeforth.3nw, 3nd on Ubuntu. [ ] 10:34 2017/07/01 faceapi.f does not work on 3ha. The error object returned from $.ajax() is - { - "readyState": 0, - "status": 0, - "statusText": "No Transport" - } OK - --> Has $.ajax ever been working in 3hta? search ajax see see . . . No, not used - before. --> Check - HTA and ajax on the net ... - http://3fwork.com/b402/003425MYM028859/ - 我最先定位到的是ajax方法返回status=0,statusText=No Transport。然后开始了我的查 - 找问题之旅,我在网上所查出的资料都说这个是由于跨域 cross Domain 造成的。 - [x] 試試別的 ajax function --> Good! 成功複製出了問題!--> [ ] 趁現在問 Microsoft 的論壇 - js> $.ajax({url:"http://example.com/",async:false}).responseText tib. - --> 在 3ca 很成功地讀回該網頁的整個 HTML - --> 在 3hta 就失敗了 - - $.ajax({url:"http://example.com/",async:false}) - .done(function(response) { - alert("success"); - }) - .fail(function(error) { - alert("error"); - push(error); - execute('(see)'); // see the error message - }); - - { - "readyState": 0, - "status": 0, - "statusText": "No Transport" - } - --> But it fail in repro.htm too. So, jeforth.3htm has enabled - something. what's that? - [x] Try project-k file:///C:/Users/hcche/Documents/GitHub/jeforth.3we/project-k/sample.html - Yes, same problem reproduced - status : 0 - statusText : NetworkError: Failed to execute 'send' on 'XMLHttpRequest': - Failed to load 'http://example.com/' - [x] 果然, jeforth.3htm web 也不行 --> 所以 3ce 3ca 都是特權, 3hta 不行是對的! - "readyState": 0, - "status": 0, - "statusText": "NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://example.com/?_=1498901836169'." - --> 然而 faceapi.f 在 project-k sample.html and 3htm web are both working fine ! - So, Azure server side is ok with cross domain. HTA really has problem. - [ ] Try faceapi.htm rename to ~.hta . . . - [ ] 可以 trace 進 jquery 去查。 - [ ] 不用 ajax 能不能 POST ? - [ ] 別的 ajax POST 去處 - [?] 14:58 2017-09-23 忘了當初在解決什麼問題了?faceapi.f 當時已經做好了呀?好像 - 是從本地直接上傳照片的方式沒有成功。我的 kitchen 跟 face 都是用 url 給照片的。 + { + "readyState": 0, + "status": 0, + "statusText": "No Transport" + } OK + --> Has $.ajax ever been working in 3hta? search ajax see see . . . No, not used + before. --> Check + HTA and ajax on the net ... + http://3fwork.com/b402/003425MYM028859/ + 我最先定位到的是ajax方法返回status=0,statusText=No Transport。然后开始了我的查 + 找问题之旅,我在网上所查出的资料都说这个是由于跨域 cross Domain 造成的。 + [x] 試試別的 ajax function --> Good! 成功複製出了問題!--> [ ] 趁現在問 Microsoft 的論壇 + js> $.ajax({url:"http://example.com/",async:false}).responseText tib. + --> 在 3ca 很成功地讀回該網頁的整個 HTML + --> 在 3hta 就失敗了 + + $.ajax({url:"http://example.com/",async:false}) + .done(function(response) { + alert("success"); + }) + .fail(function(error) { + alert("error"); + push(error); + execute('(see)'); // see the error message + }); + + { + "readyState": 0, + "status": 0, + "statusText": "No Transport" + } + --> But it fail in repro.htm too. So, jeforth.3htm has enabled + something. what's that? + [x] Try project-k file:///C:/Users/hcche/Documents/GitHub/jeforth.3we/project-k/sample.html + Yes, same problem reproduced + status : 0 + statusText : NetworkError: Failed to execute 'send' on 'XMLHttpRequest': + Failed to load 'http://example.com/' + [x] 果然, jeforth.3htm web 也不行 --> 所以 3ce 3ca 都是特權, 3hta 不行是對的! + "readyState": 0, + "status": 0, + "statusText": "NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://example.com/?_=1498901836169'." + --> 然而 faceapi.f 在 project-k sample.html and 3htm web are both working fine ! + So, Azure server side is ok with cross domain. HTA really has problem. + [ ] Try faceapi.htm rename to ~.hta . . . + [ ] 可以 trace 進 jquery 去查。 + [ ] 不用 ajax 能不能 POST ? + [ ] 別的 ajax POST 去處 + [?] 14:58 2017-09-23 忘了當初在解決什麼問題了?faceapi.f 當時已經做好了呀?好像 + 是從本地直接上傳照片的方式沒有成功。我的 kitchen 跟 face 都是用 url 給照片的。 [x] rename project-k kernel from jeforth.js to projectk.js [ ] 整理 project-k 的 wiki. 特別是改名成 projectk.js 之後。 [ ] 準備 release master 新版 release 新版 master - [x] jeforth.3we\js\version.js --> jeforth3we_minor_version = 304; - [ ] Check the date stamp at the bottom of README.md <-- 可以從 GitHub 網頁上直接改。 + [x] jeforth.3we\js\version.js --> jeforth3we_minor_version = 304; + [ ] Check the date stamp at the bottom of README.md <-- 可以從 GitHub 網頁上直接改。 [ ] Check project-k/projectk.js is included even when project-k folder is ignored ~\jeforth.3we>git add -f project-k/projectk.js * git add or rm command is the final decision of what to add and what to remove. - o selftest them all - [x] Carefully delete all application and run setup.bat to rebuild them - [x] 3nw use 3hta to: fork cmd /c start nw ../jeforth.3we - [x] 3nd use 3hta to: fork cmd /c node jeforth.3nd.js - [x] include webserver.f - [x] 3htm use 3nw or 3nd to include webserver.f and then localhost:8888 - [x] check version - [x] 3hta, use 3hta to: fork jeforth.hta - [x] 3ce, click its icon to launch it. - [x] check version. - [x] attach to target pages - [x] 3ca, click Chrome App icon to launch it. - [x] check version - [x] Testing all demo, use 3ce or 3ca - [x] 12choc.f , - [x] solar-system.f, - [x] tutor-cloth.f - [x] alarm.f , - [x] ball.f(non-selftest mode) , - [x] blowing-in-the-wind.f , - [x] box2dweb-arrow.f , - [x] calc.f , - [x] chipmunk-js-pyramidstack.f , - [x] flot-demo.f , - [x] numeric-demo.f - [x] h2o.f , - [x] many-clocks.f , - [/] commit develop -> 將 develop 分支發佈到 Master 分支的命令 : - 切換到Master分支 : git checkout master - 合併 develop 分支進 master 來 : git merge --no-ff develop + o selftest them all + [x] Carefully delete all application and run setup.bat to rebuild them + [x] 3nw use 3hta to: fork cmd /c start nw ../jeforth.3we + [x] 3nd use 3hta to: fork cmd /c node jeforth.3nd.js + [x] include webserver.f + [x] 3htm use 3nw or 3nd to include webserver.f and then localhost:8888 + [x] check version + [x] 3hta, use 3hta to: fork jeforth.hta + [x] 3ce, click its icon to launch it. + [x] check version. + [x] attach to target pages + [x] 3ca, click Chrome App icon to launch it. + [x] check version + [x] Testing all demo, use 3ce or 3ca + [x] 12choc.f , + [x] solar-system.f, + [x] tutor-cloth.f + [x] alarm.f , + [x] ball.f(non-selftest mode) , + [x] blowing-in-the-wind.f , + [x] box2dweb-arrow.f , + [x] calc.f , + [x] chipmunk-js-pyramidstack.f , + [x] flot-demo.f , + [x] numeric-demo.f + [x] h2o.f , + [x] many-clocks.f , + [/] commit develop -> 將 develop 分支發佈到 Master 分支的命令 : + 切換到Master分支 : git checkout master + 合併 develop 分支進 master 來 : git merge --no-ff develop ==> 已經改用 GitHub Desktop 只要切到 master 然後 Menu > Branch > Merge into current branch 就行了。 - [/] Test the master all over again ... ignored, lazy. - [x] Upload master to GitHub : git push + [/] Test the master all over again ... ignored, lazy. + [x] Upload master to GitHub : git push [ ] GitHub 上的 README.md 範例都指向 r2 要改成 r3 - [ ] Complete this log.txt - [ ] release note - [ ] Master 到回 develop - 切換到Master分支 : git checkout develop - 合併 develop 分支進 master 來 : git merge --no-ff master -[ ] README.md to include - http://cdn.rawgit.com/hcchengithub/jeforth.3we/r2/index.html?cls_include_tutor-cloth.f + [ ] Complete this log.txt + [ ] release note + [ ] Master 到回 develop + 切換到Master分支 : git checkout develop + 合併 develop 分支進 master 來 : git merge --no-ff master [x] peforth 有新發現 ─ function cascading 讓 vm.push() vm.execute() vm.dictate() 都傳回 vm 以便 support function cascade. 從 projectk.js 裡面修改 @@ -6052,7 +6050,7 @@ js> vm[context].x 要簡化成 vm.v('x') , vm.forth.y 簡化成 vm.r('y') 13:11 2018-03-20 完成 -[ ] 請問 FORTH 的 select - case 結構怎麼實現? +[x] 請問 FORTH 的 select - case 結構怎麼實現? H.C.Chen 週三 2018/4/4, 下午 09:45 有網友問, 因為 if else then 多幾層之後,收尾就會有一大堆 then then then @@ -6114,9 +6112,9 @@ : if ( -- a ) \ if..else..then, if..then compile 0branch here 0 , ; immediate compile-only : IF IMMEDIATE - ' 0BRANCH , \ compile 0BRANCH - HERE @ \ save location of the offset on the stack - 0 , \ compile a dummy offset + ' 0BRANCH , \ compile 0BRANCH + HERE @ \ save location of the offset on the stack + 0 , \ compile a dummy offset ; [x] 直接抄 joneforth 立刻成功. [x] 3htm, 3hta 直接就通過了 selftest @@ -6144,3 +6142,58 @@ 那就會把 b 留在 FORTH data stack 裡, 這個結果太奇怪,沒有用。所以要改寫。 || 很少用,我用上了時不記得這種詭異的行為,結果出錯了,幸好被您發現!! +[ ] 準備 release master 新版 release 新版 master + - case ... endcase + - fix bug on || + - + [x] README.md to include + http://cdn.rawgit.com/hcchengithub/jeforth.3we/r2/index.html?cls_include_tutor-cloth.f + 因為是中文的關係,不放在 README.md 已經放進 wiki 的首頁了… + [x] jeforth.3we\js\version.js --> jeforth3we_minor_version = 305; 12:24 2018-06-17 + [x] 把 3ce 的啟始頁面改掉,不要用 Ynote 了,爛東西。 + [x] Check the date stamp at the bottom of README.md <-- 可以從 GitHub 網頁上直接改。 + [x] 示範如何 download 東西 from the python repo page + [x] Check project-k/projectk.js is included even when project-k folder is ignored + ~\jeforth.3we>git add -f project-k/projectk.js + * git add or rm command is the final decision of what to add and what to remove. + [x] officeLAN 的警告不適合發布出去 --> 只限 OA 這台電腦 + o selftest them all + [ ] Carefully delete all application and run setup.bat to rebuild them + [ ] 3nw use 3hta to: fork cmd /c start nw ../jeforth.3we + [ ] 3nd use 3hta to: fork cmd /c node jeforth.3nd.js + [ ] include webserver.f + [ ] 3htm use 3nw or 3nd to include webserver.f and then localhost:8888 + [ ] check version + [ ] 3hta, use 3hta to: fork jeforth.hta + [ ] 3ce, click its icon to launch it. + [ ] check version. + [ ] attach to target pages + [x] 3ca, click Chrome App icon to launch it. + [x] check version 3.305 now + [ ] Testing all demo, use 3ce or 3ca + [ ] 12choc.f , + [ ] solar-system.f, + [ ] tutor-cloth.f + [ ] alarm.f , + [ ] ball.f(non-selftest mode) , + [ ] blowing-in-the-wind.f , + [ ] box2dweb-arrow.f , + [ ] calc.f , + [ ] chipmunk-js-pyramidstack.f , + [ ] flot-demo.f , + [ ] numeric-demo.f + [ ] h2o.f , + [ ] many-clocks.f , + [ ] commit develop -> 將 develop 分支發佈到 Master 分支的命令 : + 切換到Master分支 : git checkout master + 合併 develop 分支進 master 來 : git merge --no-ff develop + ==> 已經改用 GitHub Desktop 只要切到 master 然後 Menu > + Branch > Merge into current branch 就行了。 + [/] Test the master all over again ... ignored, lazy. + [x] Upload master to GitHub : git push + [x] Complete this log.txt + [ ] release note + [/] GitHub 上的 README.md 範例都指向 r2 要改成 rn --> 懶得改 + [ ] Master 到回 develop + 切換到Master分支 : git checkout develop + 合併 develop 分支進 master 來 : git merge --no-ff master diff --git a/f/jeforth.f b/f/jeforth.f index 76e2cf9..2ab2423 100644 --- a/f/jeforth.f +++ b/f/jeforth.f @@ -1178,7 +1178,7 @@ function test(x){ return x }; test() null = \ true true \ Also thanks to FigTaiwan 吳政昌(亞斯) for the hints. : case ( -- 0 ) \ ( key ) case of endof endcase - 0 ; immediate + 0 ; immediate compile-only /// Usage: /// ( key ) case /// char a of char AAAA endof @@ -1189,15 +1189,15 @@ function test(x){ return x }; test() null = \ true true /// endcase : of ( -- ) \ ( key ) case of endof endcase - ['] over , ['] = , [compile] if ['] drop , ; immediate + ['] over , ['] = , [compile] if ['] drop , ; immediate compile-only /// see help case : endof ( -- ) \ ( key ) case of endof endcase - [compile] else ; immediate + [compile] else ; immediate compile-only /// see help case : endcase ( -- ) \ ( key ) case of endof endcase - ['] drop , begin ?dup while [compile] then repeat ; immediate + ['] drop , begin ?dup while [compile] then repeat ; immediate compile-only /// see help case diff --git a/js/version.js b/js/version.js index 46ca696..3e4a513 100644 --- a/js/version.js +++ b/js/version.js @@ -6,5 +6,5 @@ // "uses strict"; -var jeforth3we_minor_version = 304; // 301~, 401~, 501~, . . . +var jeforth3we_minor_version = 305; // 301~, 401~, 501~, . . . if (typeof exports!='undefined') exports.jeforth3we_minor_version = jeforth3we_minor_version; // export for node.js APP