diff --git a/assets/graphics/fonts/MDA.png b/assets/graphics/fonts/MDA.png index aac6be82c..edb113e8b 100644 Binary files a/assets/graphics/fonts/MDA.png and b/assets/graphics/fonts/MDA.png differ diff --git a/assets/graphics/fonts/MDA.png.0.png b/assets/graphics/fonts/MDA.png.0.png index bd9fd65f7..9f10df7b5 100644 Binary files a/assets/graphics/fonts/MDA.png.0.png and b/assets/graphics/fonts/MDA.png.0.png differ diff --git a/assets/graphics/fonts/MDA.png.1.png b/assets/graphics/fonts/MDA.png.1.png index 27ba9630a..edb113e8b 100644 Binary files a/assets/graphics/fonts/MDA.png.1.png and b/assets/graphics/fonts/MDA.png.1.png differ diff --git a/assets/graphics/fonts/MDA.png.10.png b/assets/graphics/fonts/MDA.png.10.png index 168ff0f42..c79a78fab 100644 Binary files a/assets/graphics/fonts/MDA.png.10.png and b/assets/graphics/fonts/MDA.png.10.png differ diff --git a/assets/graphics/fonts/MDA.png.11.png b/assets/graphics/fonts/MDA.png.11.png index fb3812e7e..35b7096c8 100644 Binary files a/assets/graphics/fonts/MDA.png.11.png and b/assets/graphics/fonts/MDA.png.11.png differ diff --git a/assets/graphics/fonts/MDA.png.12.png b/assets/graphics/fonts/MDA.png.12.png index 7154448cb..38e8efb37 100644 Binary files a/assets/graphics/fonts/MDA.png.12.png and b/assets/graphics/fonts/MDA.png.12.png differ diff --git a/assets/graphics/fonts/MDA.png.13.png b/assets/graphics/fonts/MDA.png.13.png index d188b35de..22995f3d6 100644 Binary files a/assets/graphics/fonts/MDA.png.13.png and b/assets/graphics/fonts/MDA.png.13.png differ diff --git a/assets/graphics/fonts/MDA.png.14.png b/assets/graphics/fonts/MDA.png.14.png index 5490342f8..96efed0f1 100644 Binary files a/assets/graphics/fonts/MDA.png.14.png and b/assets/graphics/fonts/MDA.png.14.png differ diff --git a/assets/graphics/fonts/MDA.png.15.png b/assets/graphics/fonts/MDA.png.15.png index fc6e1792f..2ee9ab279 100644 Binary files a/assets/graphics/fonts/MDA.png.15.png and b/assets/graphics/fonts/MDA.png.15.png differ diff --git a/assets/graphics/fonts/MDA.png.2.png b/assets/graphics/fonts/MDA.png.2.png index 40448a6bd..c63823f3a 100644 Binary files a/assets/graphics/fonts/MDA.png.2.png and b/assets/graphics/fonts/MDA.png.2.png differ diff --git a/assets/graphics/fonts/MDA.png.3.png b/assets/graphics/fonts/MDA.png.3.png index 56429f9f0..db61de538 100644 Binary files a/assets/graphics/fonts/MDA.png.3.png and b/assets/graphics/fonts/MDA.png.3.png differ diff --git a/assets/graphics/fonts/MDA.png.4.png b/assets/graphics/fonts/MDA.png.4.png index eaf591782..919bc497b 100644 Binary files a/assets/graphics/fonts/MDA.png.4.png and b/assets/graphics/fonts/MDA.png.4.png differ diff --git a/assets/graphics/fonts/MDA.png.5.png b/assets/graphics/fonts/MDA.png.5.png index e6018e426..10198f9b2 100644 Binary files a/assets/graphics/fonts/MDA.png.5.png and b/assets/graphics/fonts/MDA.png.5.png differ diff --git a/assets/graphics/fonts/MDA.png.6.png b/assets/graphics/fonts/MDA.png.6.png index 1693a63d8..33cb46900 100644 Binary files a/assets/graphics/fonts/MDA.png.6.png and b/assets/graphics/fonts/MDA.png.6.png differ diff --git a/assets/graphics/fonts/MDA.png.7.png b/assets/graphics/fonts/MDA.png.7.png index 74691bcb9..a7bd2ddbe 100644 Binary files a/assets/graphics/fonts/MDA.png.7.png and b/assets/graphics/fonts/MDA.png.7.png differ diff --git a/assets/graphics/fonts/MDA.png.8.png b/assets/graphics/fonts/MDA.png.8.png index ff4606a71..8f21111f8 100644 Binary files a/assets/graphics/fonts/MDA.png.8.png and b/assets/graphics/fonts/MDA.png.8.png differ diff --git a/assets/graphics/fonts/MDA.png.9.png b/assets/graphics/fonts/MDA.png.9.png index e9662d308..83497ff83 100644 Binary files a/assets/graphics/fonts/MDA.png.9.png and b/assets/graphics/fonts/MDA.png.9.png differ diff --git a/assets/graphics/fonts/milky.png b/assets/graphics/fonts/milky.png index e2f92440e..783a14f77 100644 Binary files a/assets/graphics/fonts/milky.png and b/assets/graphics/fonts/milky.png differ diff --git a/assets/graphics/fonts/milky.png.0.png b/assets/graphics/fonts/milky.png.0.png index 0fced4be2..383a2168a 100644 Binary files a/assets/graphics/fonts/milky.png.0.png and b/assets/graphics/fonts/milky.png.0.png differ diff --git a/assets/graphics/fonts/milky.png.1.png b/assets/graphics/fonts/milky.png.1.png index 188d086b8..783a14f77 100644 Binary files a/assets/graphics/fonts/milky.png.1.png and b/assets/graphics/fonts/milky.png.1.png differ diff --git a/assets/graphics/fonts/milky.png.10.png b/assets/graphics/fonts/milky.png.10.png index 4edc106f9..f8e7daa95 100644 Binary files a/assets/graphics/fonts/milky.png.10.png and b/assets/graphics/fonts/milky.png.10.png differ diff --git a/assets/graphics/fonts/milky.png.11.png b/assets/graphics/fonts/milky.png.11.png index b801aefbf..aad7e0662 100644 Binary files a/assets/graphics/fonts/milky.png.11.png and b/assets/graphics/fonts/milky.png.11.png differ diff --git a/assets/graphics/fonts/milky.png.12.png b/assets/graphics/fonts/milky.png.12.png index 5c95dfc60..ba4761dad 100644 Binary files a/assets/graphics/fonts/milky.png.12.png and b/assets/graphics/fonts/milky.png.12.png differ diff --git a/assets/graphics/fonts/milky.png.13.png b/assets/graphics/fonts/milky.png.13.png index d5a874c2f..613ad5108 100644 Binary files a/assets/graphics/fonts/milky.png.13.png and b/assets/graphics/fonts/milky.png.13.png differ diff --git a/assets/graphics/fonts/milky.png.14.png b/assets/graphics/fonts/milky.png.14.png index 624dc8019..1d056acf2 100644 Binary files a/assets/graphics/fonts/milky.png.14.png and b/assets/graphics/fonts/milky.png.14.png differ diff --git a/assets/graphics/fonts/milky.png.15.png b/assets/graphics/fonts/milky.png.15.png index 4c563987a..6f0b33ab1 100644 Binary files a/assets/graphics/fonts/milky.png.15.png and b/assets/graphics/fonts/milky.png.15.png differ diff --git a/assets/graphics/fonts/milky.png.2.png b/assets/graphics/fonts/milky.png.2.png index fc39abdde..193cc6b55 100644 Binary files a/assets/graphics/fonts/milky.png.2.png and b/assets/graphics/fonts/milky.png.2.png differ diff --git a/assets/graphics/fonts/milky.png.3.png b/assets/graphics/fonts/milky.png.3.png index 2c4ff9619..34a2d8553 100644 Binary files a/assets/graphics/fonts/milky.png.3.png and b/assets/graphics/fonts/milky.png.3.png differ diff --git a/assets/graphics/fonts/milky.png.4.png b/assets/graphics/fonts/milky.png.4.png index 6fc19b1b1..d00fdfbb9 100644 Binary files a/assets/graphics/fonts/milky.png.4.png and b/assets/graphics/fonts/milky.png.4.png differ diff --git a/assets/graphics/fonts/milky.png.5.png b/assets/graphics/fonts/milky.png.5.png index 44d888c2f..96e271bec 100644 Binary files a/assets/graphics/fonts/milky.png.5.png and b/assets/graphics/fonts/milky.png.5.png differ diff --git a/assets/graphics/fonts/milky.png.6.png b/assets/graphics/fonts/milky.png.6.png index cd9306683..a7d385560 100644 Binary files a/assets/graphics/fonts/milky.png.6.png and b/assets/graphics/fonts/milky.png.6.png differ diff --git a/assets/graphics/fonts/milky.png.7.png b/assets/graphics/fonts/milky.png.7.png index 771338099..59ca7706e 100644 Binary files a/assets/graphics/fonts/milky.png.7.png and b/assets/graphics/fonts/milky.png.7.png differ diff --git a/assets/graphics/fonts/milky.png.8.png b/assets/graphics/fonts/milky.png.8.png index a5ddbced3..cbe3e7e56 100644 Binary files a/assets/graphics/fonts/milky.png.8.png and b/assets/graphics/fonts/milky.png.8.png differ diff --git a/assets/graphics/fonts/milky.png.9.png b/assets/graphics/fonts/milky.png.9.png index 54bb96ba0..05cb7aab7 100644 Binary files a/assets/graphics/fonts/milky.png.9.png and b/assets/graphics/fonts/milky.png.9.png differ diff --git a/lib/kotlin-reflect.jar b/lib/kotlin-reflect.jar index 62340e2da..f05f92a93 100755 Binary files a/lib/kotlin-reflect.jar and b/lib/kotlin-reflect.jar differ diff --git a/lib/kotlin-runtime-sources.jar b/lib/kotlin-runtime-sources.jar index e661b3003..3daabbaab 100755 Binary files a/lib/kotlin-runtime-sources.jar and b/lib/kotlin-runtime-sources.jar differ diff --git a/lib/kotlin-runtime.jar b/lib/kotlin-runtime.jar index 4d7a92703..a76245308 100755 Binary files a/lib/kotlin-runtime.jar and b/lib/kotlin-runtime.jar differ diff --git a/src/net/torvald/terrarum/StateFontTester.kt b/src/net/torvald/terrarum/StateFontTester.kt index 91a3b2f07..e11d65244 100644 --- a/src/net/torvald/terrarum/StateFontTester.kt +++ b/src/net/torvald/terrarum/StateFontTester.kt @@ -15,13 +15,10 @@ class StateFontTester : BasicGameState() { val textToPrint = "Font printer 서체 인쇄기" lateinit var canvas: Graphics - lateinit var gameFont: Font override fun init(gc: GameContainer, game: StateBasedGame) { canvas = Graphics(1024, 1024) - gameFont = GameFontWhite() - Terrarum.gameLocale = "fiFI" } @@ -30,7 +27,7 @@ class StateFontTester : BasicGameState() { } override fun render(gc: GameContainer, game: StateBasedGame, g: Graphics) { - g.font = gameFont + g.font = Terrarum.fontGame val text = arrayOf( Lang["APP_WARNING_HEALTH_AND_SAFETY"], @@ -46,6 +43,11 @@ class StateFontTester : BasicGameState() { for (i in 0..text.size - 1) { g.drawString(text[i], 10f, 10f + (g.font.lineHeight * i)) } + + g.font = Terrarum.fontSmallNumbers + + g.drawString("The true master needs but one channel", 0f, 64f) + g.drawString("Press a key to start", 0f, 64f + 16f) } override fun getID(): Int = Terrarum.STATE_ID_TEST_FONT diff --git a/src/net/torvald/terrarum/StateVTTest.kt b/src/net/torvald/terrarum/StateVTTest.kt index 83ed41576..f22394c21 100644 --- a/src/net/torvald/terrarum/StateVTTest.kt +++ b/src/net/torvald/terrarum/StateVTTest.kt @@ -19,8 +19,8 @@ import org.newdawn.slick.state.StateBasedGame */ class StateVTTest : BasicGameState() { - // HiRes: 100x62, LoRes: 80x25 - val vt = SimpleTextTerminal(SimpleTextTerminal.ELECTRIC_BLUE, 80, 25, colour = false, hires = false) + // HiRes: 100x64, LoRes: 80x25 + val vt = SimpleTextTerminal(SimpleTextTerminal.GREEN, 80, 25, colour = false, hires = false) val computerInside = BaseTerrarumComputer(vt) val vtUI = Image(vt.displayW, vt.displayH) diff --git a/src/net/torvald/terrarum/gamecontroller/Key.kt b/src/net/torvald/terrarum/gamecontroller/Key.kt index 6cb45bb44..9b8db8024 100644 --- a/src/net/torvald/terrarum/gamecontroller/Key.kt +++ b/src/net/torvald/terrarum/gamecontroller/Key.kt @@ -13,6 +13,9 @@ object Key { val SPACE = 57 val CAPS_LOCK = 58 val L_CONTROL = 29 + + // same position keys + val L_ALT = 56 val L_COMMAND = 219 // Mac val DELETE = 211 diff --git a/src/net/torvald/terrarum/virtualcomputer/assets/lua/BOOT.lua b/src/net/torvald/terrarum/virtualcomputer/assets/lua/BOOT.lua index e5e17fa9e..20e4136da 100644 --- a/src/net/torvald/terrarum/virtualcomputer/assets/lua/BOOT.lua +++ b/src/net/torvald/terrarum/virtualcomputer/assets/lua/BOOT.lua @@ -2,31 +2,967 @@ Must be loaded VERY FIRST! Created by minjaesong on 16-09-13. + + Some codes were taken from OpenComputers, which is distributed under MIT --]] +_G.computer = {} +computer.realTime = function() return 0 end + +if totalMemory() == 0 then print("no RAM installed") __haltsystemexplicit__() return end + + +local hookInterval = 100 +local deadline = math.huge +local hitDeadline = false +local function checkDeadline() + if computer.realTime() > deadline then + debug.sethook(coroutine.running(), checkDeadline, "", 1) + if not hitDeadline then + deadline = deadline + 0.5 + end + hitDeadline = true + error("too long without yielding", 0) + end +end + +local function checkArg(n, have, ...) + have = type(have) + local function check(want, ...) + if not want then + return false + else + return have == want or check(...) + end + end + if not check(...) then + local msg = string.format("bad argument #%d (%s expected, got %s)", + n, table.concat({...}, " or "), have) + error(msg, 3) + end +end + +------------------------------------------------------------------------------- + +--[[ This is pretty much a straight port of Lua's pattern matching code from + the standard PUC-Rio C implementation. We want to have this in plain Lua + for the sandbox, so that timeouts also apply while matching stuff, which + can take a looong time for certain "evil" patterns. + It passes the pattern matching unit tests from Lua 5.2's test suite, so + that should be good enough. ]] +do + local CAP_UNFINISHED = -1 + local CAP_POSITION = -2 + local L_ESC = '%' + local SPECIALS = "^$*+?.([%-" + local SHORT_STRING = 500 -- use native implementations for short strings + + local string_find, string_lower, string_match, string_gmatch, string_gsub = + string.find, string.lower, string.match, string.gmatch, string.gsub + + local match -- forward declaration + + local strptr + local strptr_mt = {__index={ + step = function(self, count) + self.pos = self.pos + (count or 1) + return self + end, + head = function(self, len) + return string.sub(self.data, self.pos, self.pos + (len or self:len()) - 1) + end, + len = function(self) + return #self.data - (self.pos - 1) + end, + char = function(self, offset) + local pos = self.pos + (offset or 0) + if pos == #self.data + 1 then + return "\0" + end + return string.sub(self.data, pos, pos) + end, + copy = function(self, offset) + return strptr(self.data, self.pos + (offset or 0)) + end + }, + __add = function(a, b) + if type(b) == "table" then + return a.pos + b.pos + else + return a:copy(b) + end + end, + __sub = function(a, b) + if type(b) == "table" then + return a.pos - b.pos + else + return a:copy(-b) + end + end, + __eq = function(a, b) + return a.data == b.data and a.pos == b.pos + end, + __lt = function(a, b) + assert(a.data == b.data) + return a.pos < b.pos + end, + __le = function(a, b) + assert(a.data == b.data) + return a.pos <= b.pos + end + } + function strptr(s, pos) + return setmetatable({ + data = s, + pos = pos or 1 + }, strptr_mt) + end + + local function islower(b) return b >= 'a' and b <= 'z' end + local function isupper(b) return b >= 'A' and b <= 'Z' end + local function isalpha(b) return islower(b) or isupper(b) end + local function iscntrl(b) return b <= '\007' or (b >= '\010' and b <= '\017') or (b >= '\020' and b <= '\027') or (b >= '\030' and b <= '\037' and b ~= ' ') or b == '\177' end + local function isdigit(b) return b >= '0' and b <= '9' end + local function ispunct(b) return (b >= '{' and b <= '~') or (b == '`') or (b >= '[' and b <= '_') or (b == '@') or (b >= ':' and b <= '?') or (b >= '(' and b <= '/') or (b >= '!' and b <= '\'') end + local function isspace(b) return b == '\t' or b == '\n' or b == '\v' or b == '\f' or b == '\r' or b == ' ' end + local function isalnum(b) return isalpha(b) or isdigit(b) end + local function isxdigit(b) return isdigit(b) or (b >= 'a' and b <= 'f') or (b >= 'A' and b <= 'F') end + local function isgraph(b) return not iscntrl(b) and not isspace(b) end + + -- translate a relative string position: negative means back from end + local function posrelat(pos, len) + if pos >= 0 then return pos + elseif -pos > len then return 0 + else return len + pos + 1 + end + end + + local function check_capture(ms, l) + l = l - '1' + if l < 0 or l >= ms.level or ms.capture[l].len == CAP_UNFINISHED then + error("invalid capture index %" .. (l + 1)) + end + return l + end + + local function capture_to_close(ms) + local level = ms.level + while level > 0 do + level = level - 1 + if ms.capture[level].len == CAP_UNFINISHED then + return level + end + end + return error("invalid pattern capture") + end + + local function classend(ms, p) + local p0 = p:char() p = p:copy(1) + if p0 == L_ESC then + if p == ms.p_end then + error("malformed pattern (ends with %)") + end + return p:step(1) + elseif p0 == '[' then + if p:char() == '^' then + p:step() + end + repeat -- look for a `]' + if p == ms.p_end then + error("malformed pattern (missing ])") + end + p:step() + if p:char(-1) == L_ESC then + if p < ms.p_end then + p:step() -- skip escapes (e.g. `%]') + end + end + until p:char() == ']' + return p:step() + else + return p + end + end + + local function match_class(c, cl) + local res + local cll = string_lower(cl) + if cll == 'a' then res = isalpha(c) + elseif cll == 'c' then res = iscntrl(c) + elseif cll == 'd' then res = isdigit(c) + elseif cll == 'g' then res = isgraph(c) + elseif cll == 'l' then res = islower(c) + elseif cll == 'p' then res = ispunct(c) + elseif cll == 's' then res = isspace(c) + elseif cll == 'u' then res = isupper(c) + elseif cll == 'w' then res = isalnum(c) + elseif cll == 'x' then res = isxdigit(c) + elseif cll == 'z' then res = c == '\0' -- deprecated option + else return cl == c + end + if islower(cl) then return res + else return not res + end + end + + local function matchbracketclass(c, p, ec) + local sig = true + p = p:copy(1) + if p:char() == '^' then + sig = false + p:step() -- skip the `^' + end + while p < ec do + if p:char() == L_ESC then + p:step() + if match_class(c, p:char()) then + return sig + end + elseif p:char(1) == '-' and p + 2 < ec then + p:step(2) + if p:char(-2) <= c and c <= p:char() then + return sig + end + elseif p:char() == c then + return sig + end + p:step() + end + return not sig + end + + local function singlematch(ms, s, p, ep) + if s >= ms.src_end then + return false + end + local p0 = p:char() + if p0 == '.' then return true -- matches any char + elseif p0 == L_ESC then return match_class(s:char(), p:char(1)) + elseif p0 == '[' then return matchbracketclass(s:char(), p, ep:copy(-1)) + else return p:char() == s:char() + end + end + + local function matchbalance(ms, s, p) + if p >= ms.p_end - 1 then + error("malformed pattern (missing arguments to %b)") + end + if s:char() ~= p:char() then return nil end + local b = p:char() + local e = p:char(1) + local cont = 1 + s = s:copy() + while s:step() < ms.src_end do + if s:char() == e then + cont = cont - 1 + if cont == 0 then return s:step() end + elseif s:char() == b then + cont = cont + 1 + end + end + return nil -- string ends out of balance + end + + local function max_expand(ms, s, p, ep) + local i = 0 -- counts maximum expand for item + while singlematch(ms, s:copy(i), p, ep) do + i = i + 1 + end + -- keeps trying to match with the maximum repetitions + while i >= 0 do + local res = match(ms, s:copy(i), ep:copy(1)) + if res then return res end + i = i - 1 -- else didn't match; reduce 1 repetition to try again + end + return nil + end + + local function min_expand(ms, s, p, ep) + s = s:copy() + while true do + local res = match(ms, s, ep:copy(1)) + if res ~= nil then + return res + elseif singlematch(ms, s, p, ep) then + s:step() -- try with one more repetition + else return nil + end + end + end + + local function start_capture(ms, s, p, what) + local level = ms.level + ms.capture[level] = ms.capture[level] or {} + ms.capture[level].init = s:copy() + ms.capture[level].len = what + ms.level = level + 1 + local res = match(ms, s, p) + if res == nil then -- match failed? + ms.level = ms.level - 1 -- undo capture + end + return res + end + + local function end_capture(ms, s, p) + local l = capture_to_close(ms) + ms.capture[l].len = s - ms.capture[l].init -- close capture + local res = match(ms, s, p) + if res == nil then -- match failed? + ms.capture[l].len = CAP_UNFINISHED -- undo capture + end + return res + end + + local function match_capture(ms, s, l) + l = check_capture(ms, l) + local len = ms.capture[l].len + if ms.src_end - s >= len and + ms.capture[l].init:head(len) == s:head(len) + then + return s:copy(len) + else return nil + end + end + + function match(ms, s, p) + s = s:copy() + p = p:copy() + ::init:: -- using goto's to optimize tail recursion + if p ~= ms.p_end then + local p0 = p:char() + if p0 == '(' then -- start capture + if p:char(1) == ')' then -- position capture? + s = start_capture(ms, s, p:copy(2), CAP_POSITION) + else + s = start_capture(ms, s, p:copy(1), CAP_UNFINISHED) + end + goto brk + elseif p0 == ')' then -- end capture + s = end_capture(ms, s, p:copy(1)) + goto brk + elseif p0 == '$' then + if p + 1 ~= ms.p_end then -- is the `$' the last char in pattern? + goto dflt -- no; go to default + end + s = (s == ms.src_end) and s or nil -- check end of string + goto brk + elseif p0 == L_ESC then -- escaped sequences not in the format class[*+?-]? + local p1 = p:char(1) + if p1 == 'b' then -- balanced string? + s = matchbalance(ms, s, p:copy(2)) + if s ~= nil then + p:step(4) + goto init -- return match(ms, s, p + 4) + end + -- else fail (s == nil) + elseif p1 == 'f' then -- frontier? + p:step(2) + if p:char() ~= '[' then + error("missing [ after %f in pattern") + end + local ep = classend(ms, p) -- points to what is next + local previous = (s == ms.src_init) and '\0' or s:char(-1) + if not matchbracketclass(previous, p, ep:copy(-1)) and + matchbracketclass(s:char(), p, ep:copy(-1)) + then + p = ep + goto init -- return match(ms, s, ep) + end + s = nil -- match failed + elseif isdigit(p:char(1)) then -- capture results (%0-%9)? + s = match_capture(ms, s, p:char(1)) + if s ~= nil then + p:step(2) + goto init -- return match(ms, s, p + 2) + end + else + goto dflt + end + goto brk + end + ::dflt:: do + local ep = classend(ms, p) -- points to what is next + local ep0 = ep:char() + if not singlematch(ms, s, p, ep) then + if ep0 == '*' or ep0 == '?' or ep0 == '-' then -- accept empty? + p = ep:copy(1) + goto init -- return match(ms, s, ep + 1) + else -- '+' or no suffix + s = nil -- fail + end + else -- matched once + if ep0 == '?' then -- optional + local res = match(ms, s:copy(1), ep:copy(1)) + if res ~= nil then + s = res + else + p = ep:copy(1) + goto init -- else return match(ms, s, ep + 1) + end + elseif ep0 == '+' then -- 1 or more repetitions + s = max_expand(ms, s:copy(1), p, ep) -- 1 match already done + elseif ep0 == '*' then -- 0 or more repetitions + s = max_expand(ms, s, p, ep) + elseif ep0 == '-' then -- 0 or more repetitions (minimum) + s = min_expand(ms, s, p, ep) + else + s:step() + p = ep + goto init -- else return match(ms, s+1, ep); + end + end + end + ::brk:: + end + return s +end + +local function push_onecapture(ms, i, s, e) + if i >= ms.level then + if i == 0 then -- ms->level == 0, too + return s:head(e - s) -- add whole match + else + error("invalid capture index") + end + else + local l = ms.capture[i].len; + if l == CAP_UNFINISHED then error("unfinished capture") end + if l == CAP_POSITION then + return ms.capture[i].init - ms.src_init + 1 + else + return ms.capture[i].init:head(l) + end + end +end + +local function push_captures(ms, s, e) + local nlevels = (ms.level == 0 and s) and 1 or ms.level + local captures = {} + for i = 0, nlevels - 1 do + table.insert(captures, push_onecapture(ms, i, s, e)) + end + return table.unpack(captures) +end + +-- check whether pattern has no special characters +local function nospecials(p) + for i = 1, #p do + for j = 1, #SPECIALS do + if p:sub(i, i) == SPECIALS:sub(j, j) then + return false + end + end + end + return true +end + +local function str_find_aux(str, pattern, init, plain, find) + checkArg(1, str, "string") + checkArg(2, pattern, "string") + checkArg(3, init, "number", "nil") + + if #str < SHORT_STRING then + return (find and string_find or string_match)(str, pattern, init, plain) + end + + local s = strptr(str) + local p = strptr(pattern) + local init = posrelat(init or 1, #str) + if init < 1 then init = 1 + elseif init > #str + 1 then -- start after string's end? + return nil -- cannot find anything + end + -- explicit request or no special characters? + if find and (plain or nospecials(pattern)) then + -- do a plain search + local s2 = string_find(str, pattern, init, true) + if s2 then + return s2-s.pos + 1, s2 - s.pos + p:len() + end + else + local s1 = s:copy(init - 1) + local anchor = p:char() == '^' + if anchor then p:step() end + local ms = { + src_init = s, + src_end = s:copy(s:len()), + p_end = p:copy(p:len()), + capture = {} + } + repeat + ms.level = 0 + local res = match(ms, s1, p) + if res ~= nil then + if find then + return s1.pos - s.pos + 1, res.pos - s.pos, push_captures(ms, nil, nil) + else + return push_captures(ms, s1, res) + end + end + until s1:step() > ms.src_end or anchor + end + return nil -- not found +end + +local function str_find(s, pattern, init, plain) + return str_find_aux(s, pattern, init, plain, true) +end + +local function str_match(s, pattern, init) + return str_find_aux(s, pattern, init, false, false) +end + +local function str_gmatch(s, pattern) + checkArg(1, s, "string") + checkArg(2, pattern, "string") + + if #s < SHORT_STRING then + return string_gmatch(s, pattern, repl, n) + end + + local s = strptr(s) + local p = strptr(pattern) + local start = 0 + return function() + ms = { + src_init = s, + src_end = s:copy(s:len()), + p_end = p:copy(p:len()), + capture = {} + } + for offset = start, ms.src_end.pos - 1 do + local src = s:copy(offset) + ms.level = 0 + local e = match(ms, src, p) + if e ~= nil then + local newstart = e - s + if e == src then newstart = newstart + 1 end -- empty match? go at least one position + start = newstart + return push_captures(ms, src, e) + end + end + return nil -- not found + end +end + +local function add_s(ms, b, s, e, r) + local news = tostring(r) + local i = 1 + while i <= #news do + if news:sub(i, i) ~= L_ESC then + b = b .. news:sub(i, i) + else + i = i + 1 -- skip ESC + if not isdigit(news:sub(i, i)) then + b = b .. news:sub(i, i) + elseif news:sub(i, i) == '0' then + b = b .. s:head(e - s) + else + b = b .. push_onecapture(ms, news:sub(i, i) - '1', s, e) -- add capture to accumulated result + end + end + i = i + 1 + end + return b +end + +local function add_value(ms, b, s, e, r, tr) + local res + if tr == "function" then + res = r(push_captures(ms, s, e)) + elseif tr == "table" then + res = r[push_onecapture(ms, 0, s, e)] + else -- LUA_TNUMBER or LUA_TSTRING + return add_s(ms, b, s, e, r) + end + if not res then -- nil or false? + res = s:head(e - s) -- keep original text + elseif type(res) ~= "string" and type(res) ~= "number" then + error("invalid replacement value (a "..type(res)..")") + end + return b .. res -- add result to accumulator +end + +local function str_gsub(s, pattern, repl, n) + checkArg(1, s, "string") + checkArg(2, pattern, "string") + checkArg(3, repl, "number", "string", "function", "table") + checkArg(4, n, "number", "nil") + + if #s < SHORT_STRING or type(repl) == "function" then + return string_gsub(s, pattern, repl, n) + end + + local src = strptr(s); + local p = strptr(pattern) + local tr = type(repl) + local max_s = n or (#s + 1) + local anchor = p:char() == '^' + if anchor then + p:step() -- skip anchor character + end + n = 0 + local b = "" + local ms = { + src_init = src:copy(), + src_end = src:copy(src:len()), + p_end = p:copy(p:len()), + capture = {} + } + while n < max_s do + ms.level = 0 + local e = match(ms, src, p) + if e then + n = n + 1 + b = add_value(ms, b, src, e, repl, tr) + end + if e and e > src then -- non empty match? + src = e -- skip it + elseif src < ms.src_end then + b = b .. src:char() + src:step() + else break + end + if anchor then break end + end + b = b .. src:head() + return b, n -- number of substitutions +end + +string.find = str_find +string.match = str_match +string.gmatch = str_gmatch +string.gsub = str_gsub +end + +------------------------------------------------------------------------------- + +local function spcall(...) +local result = table.pack(pcall(...)) +if not result[1] then +error(tostring(result[2]), 0) +else +return table.unpack(result, 2, result.n) +end +end + +local sgcco + +local function sgcf(self, gc) +while true do +self, gc = coroutine.yield(pcall(gc, self)) +end +end + +local function sgc(self) +local oldDeadline, oldHitDeadline = deadline, hitDeadline +local mt = debug.getmetatable(self) +mt = rawget(mt, "mt") +local gc = rawget(mt, "__gc") +if type(gc) ~= "function" then +return +end +if not sgcco then +sgcco = coroutine.create(sgcf) +end +debug.sethook(sgcco, checkDeadline, "", hookInterval) +deadline, hitDeadline = math.min(oldDeadline, computer.realTime() + 0.5), true +local _, result, reason = coroutine.resume(sgcco, self, gc) +debug.sethook(sgcco) +if coroutine.status(sgcco) == "dead" then +sgcco = nil +end +deadline, hitDeadline = oldDeadline, oldHitDeadline +if not result then +error(reason, 0) +end +end + +--[[ This is the global environment we make available to userland programs. ]] +-- You'll notice that we do a lot of wrapping of native functions and adding +-- parameter checks in those wrappers. This is to avoid errors from the host +-- side that would push error objects - which are userdata and cannot be +-- persisted. +local sandbox, libprocess +sandbox = { +assert = assert, +dofile = nil, -- in boot/*_base.lua +error = error, +_G = nil, -- see below +getmetatable = function(t) +if type(t) == "string" then -- don't allow messing with the string mt +return nil +end +local result = getmetatable(t) +-- check if we have a wrapped __gc using mt +if type(result) == "table" and system.allowGC() and rawget(result, "__gc") == sgc then +result = rawget(result, "mt") +end +return result +end, +ipairs = ipairs, +load = function(ld, source, mode, env) +if not system.allowBytecode() then +mode = "t" +end +return load(ld, source, mode, env or sandbox) +end, +loadfile = nil, -- in boot/*_base.lua +next = next, +pairs = pairs, +pcall = function(...) +local result = table.pack(pcall(...)) +checkDeadline() +return table.unpack(result, 1, result.n) +end, +print = nil, -- in boot/*_base.lua +rawequal = rawequal, +rawget = rawget, +rawlen = rawlen, +rawset = rawset, +select = select, +setmetatable = function(t, mt) +if type(mt) ~= "table" then +return setmetatable(t, mt) +end +if rawget(mt, "__gc") ~= nil then -- If __gc is set to ANYTHING not `nil`, we're gonna have issues +-- Garbage collector callbacks apparently can't be sandboxed after +-- all, because hooks are disabled while they're running. So we just +-- disable them altogether by default. +if system.allowGC() then +-- For all user __gc functions we enforce a much tighter deadline. +-- This is because these functions may be called from the main +-- thread under certain circumstanced (such as when saving the world), +-- which can lead to noticeable lag if the __gc function behaves badly. +local sbmt = {} -- sandboxed metatable. only for __gc stuff, so it's +-- kinda ok to have a shallow copy instead... meh. +for k, v in next, mt do +sbmt[k] = v +end +sbmt.__gc = sgc +sbmt.mt = mt +mt = sbmt +else +-- Don't allow marking for finalization, but use the raw metatable. +local gc = rawget(mt, "__gc") +rawset(mt, "__gc", nil) -- remove __gc +local ret = table.pack(pcall(setmetatable, t, mt)) +rawset(mt, "__gc", gc) -- restore __gc +if not ret[1] then error(ret[2], 0) end +return table.unpack(ret, 2, ret.n) +end +end +return setmetatable(t, mt) +end, +tonumber = tonumber, +tostring = tostring, +type = type, +_VERSION = _VERSION:match("5.3") and "Lua 5.3" or "Lua 5.2", +xpcall = function(f, msgh, ...) +local handled = false +local result = table.pack(xpcall(f, function(...) +if handled then +return ... +else +handled = true +return msgh(...) +end +end, ...)) +checkDeadline() +return table.unpack(result, 1, result.n) +end, + +coroutine = { +create = coroutine.create, +resume = function(co, ...) -- custom resume part for bubbling sysyields +checkArg(1, co, "thread") +local args = table.pack(...) +while true do -- for consecutive sysyields +debug.sethook(co, checkDeadline, "", hookInterval) +local result = table.pack( +coroutine.resume(co, table.unpack(args, 1, args.n))) +debug.sethook(co) -- avoid gc issues +checkDeadline() +if result[1] then -- success: (true, sysval?, ...?) +if coroutine.status(co) == "dead" then -- return: (true, ...) +return true, table.unpack(result, 2, result.n) +elseif result[2] ~= nil then -- yield: (true, sysval) +args = table.pack(coroutine.yield(result[2])) +else -- yield: (true, nil, ...) +return true, table.unpack(result, 3, result.n) +end +else -- error: result = (false, string) +return false, result[2] +end +end +end, +running = coroutine.running, +status = coroutine.status, +wrap = function(f) -- for bubbling coroutine.resume +local co = coroutine.create(f) +return function(...) +local result = table.pack(sandbox.coroutine.resume(co, ...)) +if result[1] then +return table.unpack(result, 2, result.n) +else +error(result[2], 0) +end +end +end, +yield = function(...) -- custom yield part for bubbling sysyields +return coroutine.yield(nil, ...) +end +}, + +string = { +byte = string.byte, +char = string.char, +dump = string.dump, +find = string.find, +format = string.format, +gmatch = string.gmatch, +gsub = string.gsub, +len = string.len, +lower = string.lower, +match = string.match, +rep = string.rep, +reverse = string.reverse, +sub = string.sub, +upper = string.upper +}, + +table = { +concat = table.concat, +insert = table.insert, +pack = table.pack, +remove = table.remove, +sort = table.sort, +unpack = table.unpack +}, + +math = { +abs = math.abs, +acos = math.acos, +asin = math.asin, +atan = math.atan, +atan2 = math.atan2, +ceil = math.ceil, +cos = math.cos, +cosh = math.cosh, +deg = math.deg, +exp = math.exp, +floor = math.floor, +fmod = math.fmod, +frexp = math.frexp, +huge = math.huge, +ldexp = math.ldexp, +log = math.log, +max = math.max, +min = math.min, +modf = math.modf, +pi = math.pi, +pow = math.pow or function(a, b) -- Deprecated in Lua 5.3 +return a^b +end, +rad = math.rad, +random = function(...) +return spcall(math.random, ...) +end, +randomseed = function(seed) +spcall(math.randomseed, seed) +end, +sin = math.sin, +sinh = math.sinh, +sqrt = math.sqrt, +tan = math.tan, +tanh = math.tanh +}, + +-- Deprecated in Lua 5.3. +bit32 = bit32 and { +arshift = bit32.arshift, +band = bit32.band, +bnot = bit32.bnot, +bor = bit32.bor, +btest = bit32.btest, +bxor = bit32.bxor, +extract = bit32.extract, +replace = bit32.replace, +lrotate = bit32.lrotate, +lshift = bit32.lshift, +rrotate = bit32.rrotate, +rshift = bit32.rshift +}, + +io = nil, -- in lib/io.lua + +os = { +clock = os.clock, +date = function(format, time) +return spcall(os.date, format, time) +end, +difftime = function(t2, t1) +return t2 - t1 +end, +execute = nil, -- in boot/*_os.lua +exit = nil, -- in boot/*_os.lua +remove = nil, -- in boot/*_os.lua +rename = nil, -- in boot/*_os.lua +time = function(table) +checkArg(1, table, "table", "nil") +return os.time(table) +end, +tmpname = nil, -- in boot/*_os.lua +}, + +debug = { +getinfo = function(...) +local result = debug.getinfo(...) +if result then +-- Only make primitive information available in the sandbox. +return { +source = result.source, +short_src = result.short_src, +linedefined = result.linedefined, +lastlinedefined = result.lastlinedefined, +what = result.what, +currentline = result.currentline, +nups = result.nups, +nparams = result.nparams, +isvararg = result.isvararg, +name = result.name, +namewhat = result.namewhat, +istailcall = result.istailcall +} +end +end, +traceback = debug.traceback +}, + + +checkArg = checkArg +} +sandbox._G = sandbox + +------------------------------------------------------------------------------- + -- path for any ingame libraries package.path = "/net/torvald/terrarum/virtualcomputer/assets/lua/?.lua;" .. package.path -- global variables -_G._VERSION = "Luaj-jse 5.2" -_G.MONEYSYM = string.char(0x9D) -- currency sign +_G._VERSION = "Luaj-jse 5.2.3" +_G.EMDASH = string.char(0xC4) +_G.UNCHECKED = string.char(0x9C) -- box unchecked +_G.CHECKED = string.char(0x9D) -- box checked +_G.MONEYSYM = string.char(0x9E) -- currency sign _G.MIDDOT = string.char(0xFA) -- middle dot sign _G.DC1 = string.char(17) -- black _G.DC2 = string.char(18) -- white _G.DC3 = string.char(19) -- dim grey _G.DC4 = string.char(20) -- light grey _G.DLE = string.char(16) -- default error colour -_G.getMem = function() collectgarbage() return collectgarbage("count") * 1024 end --- getTotalMem: implemented in Kotlin class -_G.getFreeMem = function() return getTotalMem() - getMem() end -_G.runscript = function(s, source, ...) - local code, reason = load(s, source) - - if _G.getFreeMem() <= 0 then - print("out of memory") - __haltsystemexplicit__() - return - end +_G.runscript = function(s, src, ...) + local code, reason = load(s, src) if code then xpcall(code(...), eprint) @@ -36,43 +972,57 @@ _G.runscript = function(s, source, ...) end _G.__scanMode__ = "UNINIT" -- part of inputstream implementation -_COMPUTER = {} -- standard console colours -_COMPUTER.prompt = DC3.."> "..DC4 -_COMPUTER.verbose = true -- print debug info -_COMPUTER.loadedCLayer = {} -- list of loaded compatibility layers -_COMPUTER.bootloader = "/boot/efi" -_COMPUTER.OEM = "" +local screenbufferdim = term.width() * term.height() +local screencolours = 4 +if term.isCol() then screencolours = 8 +elseif term.isTeletype() then screencolours = 1 end +local screenbuffersize = screenbufferdim * screencolours / 8 --- failsafe -if getTotalMem() == 0 then print("no RAM installed") __haltsystemexplicit__() return end -if _G.getFreeMem() <= 0 then print("out of memory") __haltsystemexplicit__() return end +--_G.computer = {} -- standard console colours +computer.prompt = DC3.."> "..DC4 +computer.verbose = true -- print debug info +computer.loadedCLayer = {} -- list of loaded compatibility layers +computer.bootloader = "/boot/efi" +computer.OEM = "" +computer.totalMemory = _G.totalMemory +local getMemory = function() + collectgarbage() + return collectgarbage("count") * 1024 - 6.5*1048576 + screenbuffersize +end -- that magic number: how much basic system takes +-- totalMemory: implemented in Kotlin class +computer.freeMemory = function() return totalMemory() - getMemory() end -- load libraries that coded in Lua require("ROMLIB") -- load bios, if any -if fs.exists(_COMPUTER.bootloader) then shell.run(_COMPUTER.bootloader) end +if fs.exists(computer.bootloader) then shell.run(computer.bootloader) end -- halt/run luaprompt upon the termination of bios. -- Valid BIOS should load OS and modify 'shell.status' to 'shell.halt' before terminating itself. -if shell.status == shell.halt then - __haltsystemexplicit__() -end +if shell.status == shell.halt then __haltsystemexplicit__() goto quit end -- load Lua prompt, if bios is not found print("Rom basic "..DC2.._VERSION..DC4) -print("Copyright (C) 1994-2015 Lua.org, PUC-Rio") -print(DC2..tostring(math.floor(getFreeMem()/1024+0.5))..DC4.." Kbytes free") +print("Copyright (C) 1994-2013 Lua.org, PUC-Rio") print("Ok") while not native.isHalted() do - io.write(_COMPUTER.prompt) - local s = io.read() + term.setCursorBlink(true) + io.write(computer.prompt) + local s = __scanforline__() xpcall( - function() _G.runscript(s, "=stdin") end, - function(s) print(DLE..s) end -- it catches logical errors + function() + if s:byte(1) == 61 then -- print out value + s1 = string.sub(s, 2) + _G.runscript("print(tostring("..s1.."))\n", "=stdin") + else + _G.runscript(s, "=stdin") + end + end, + function(err) print(DLE..err) end -- it catches logical errors ) end +::quit:: native.closeInputString() -__haltsystemexplicit__() return diff --git a/src/net/torvald/terrarum/virtualcomputer/assets/lua/CCAPI.lua b/src/net/torvald/terrarum/virtualcomputer/assets/lua/CCAPI.lua index 8ed708e46..e721cf1fa 100644 --- a/src/net/torvald/terrarum/virtualcomputer/assets/lua/CCAPI.lua +++ b/src/net/torvald/terrarum/virtualcomputer/assets/lua/CCAPI.lua @@ -12,7 +12,7 @@ if term.isTeletype() then error("This is a teletype; cannot use CCAPI layer") end -table.insert(_COMPUTER.loadedCLayer, "CCAPI") +table.insert(computer.loadedCLayer, "CCAPI") local function intLog2(i) @@ -34,7 +34,7 @@ _G.bit = {} -- CC's weird BIT API bit.blshift = function(n, bits) bit32.lshift(n, bits) end bit.brshift = function(n, bits) bit32.arshift(n, bits) end -bit.blogic_rshift = function(n, bits) bit32.brshift(n, bits) end +bit.blogic_rshift = function(n, bits) bit32.rshift(n, bits) end bit.bxor = function(m, n) bit32.bxor(m, n) end bit.bor = function(m, n) bit32.bor(m, n) end bit.band = function(m, n) bit32.band(m, n) end @@ -162,4 +162,4 @@ fs.run = function(p) fs.dofile(p) end -- DOWN AND OUT -- ------------------ -if _COMPUTER.verbose then print("ComputerCraft compatibility layer successfully loaded.") end +if computer.verbose then print("ComputerCraft compatibility layer successfully loaded.") end diff --git a/src/net/torvald/terrarum/virtualcomputer/assets/lua/ROMLIB.lua b/src/net/torvald/terrarum/virtualcomputer/assets/lua/ROMLIB.lua index 48361f8a5..ba4d7e9f7 100644 --- a/src/net/torvald/terrarum/virtualcomputer/assets/lua/ROMLIB.lua +++ b/src/net/torvald/terrarum/virtualcomputer/assets/lua/ROMLIB.lua @@ -6,6 +6,8 @@ -- ALIASES -- ------------- +_G.io = {} + fs.dofile = function(p, ...) local f = fs.open(p, "r") local s = f.readAll() @@ -14,12 +16,8 @@ end _G.loadstring = _G.load -_G.print = term.print - --_G.dofile = function(f) fs.dofile(f) end -_G.boot = function() fs.dofile("/boot/efi") end - fs.fetchText = function(p) local file = fs.open(p, "r") @@ -60,7 +58,7 @@ _G.__scanforline__ = function(echo) -- pass '1' to not echo; pass nothing to ech end -- use Keys API to identify the keycode -_G.__scanforkey__ = function(echo) -- pass '1' to not echo; pass nothing to echo +--[[_G.__scanforkey__ = function(echo) -- pass '1' to not echo; pass nothing to echo native.closeInputString() native.openInput(echo or 0) _G.__scanMode__ = "a_key" @@ -70,11 +68,12 @@ _G.__scanforkey__ = function(echo) -- pass '1' to not echo; pass nothing to echo until key -- input is closed when any key is hit. See above comments. return key -end +end]] -- DELETED: use _G.input.isKeyDown(keycode) + +input.readLine = _G.__scanforline__ io.read = _G.__scanforline__ - ----------------- -- PRINTSTREAM -- ----------------- @@ -82,7 +81,12 @@ io.read = _G.__scanforline__ io.write = function(...) local args = {...} for _, v in ipairs(args) do - local s = tostring(v) + local s + if v == nil then + s = "nil" + else + s = tostring(v) + end term.write(s) end end @@ -111,7 +115,22 @@ end _G.shell = {} shell.status = shell.ok -shell.run = function(p) fs.dofile(p) end +shell.run = function(path) + -- check for interpreter key "#!" + local f = fs.open(path, "r") + local s = "" + repeat + s = f.readLine() + if (s == nil) then return end -- empty file + until #s > 0 + + if s:sub(1,2) == "#!" then + local interpreter = s:sub(3) + fs.dofile(interpreter..".lua", path) + else + fs.dofile(path) + end +end shell.ok = 0 @@ -167,123 +186,193 @@ end -- KEYS API -- -------------- -- ComputerCraft compliant -local keycodeDic = { -["30"] = "a", -["48"] = "b", -["46"] = "c", -["32"] = "d", -["18"] = "e", -["33"] = "f", -["34"] = "g", -["35"] = "h", -["23"] = "i", -["36"] = "j", -["37"] = "k", -["38"] = "l", -["50"] = "m", -["49"] = "n", -["24"] = "o", -["25"] = "p", -["16"] = "q", -["19"] = "r", -["31"] = "s", -["20"] = "t", -["22"] = "u", -["47"] = "v", -["17"] = "w", -["45"] = "x", -["21"] = "y", -["44"] = "z", -["2"] = "one", -["3"] = "two", -["4"] = "three", -["5"] = "four", -["6"] = "five", -["7"] = "six", -["8"] = "seven", -["9"] = "eight", -["10"] = "nine", -["11"] = "zero", -["12"] = "minus", -["13"] = "equals", -["14"] = "backspace", -["15"] = "tab", -["26"] = "leftBracket", -["27"] = "rightBracket", -["28"] = "enter", -["29"] = "leftCtrl", -["39"] = "semiColon", -["40"] = "apostrophe", -["41"] = "grave", -["42"] = "leftShift", -["43"] = "backslash", -["51"] = "comma", -["52"] = "period", -["53"] = "slash", -["54"] = "rightShift", -["55"] = "multiply", -["56"] = "leftAlt", -["57"] = "space", -["58"] = "capsLock", -["59"] = "f1", -["60"] = "f2", -["61"] = "f3", -["62"] = "f4", -["63"] = "f5", -["64"] = "f6", -["65"] = "f7", -["66"] = "f8", -["67"] = "f9", -["68"] = "f10", -["69"] = "numLock", -["70"] = "scollLock", -["71"] = "numPad7", -["72"] = "numPad8", -["73"] = "numPad9", -["74"] = "numPadSubtract", -["75"] = "numPad4", -["76"] = "numPad5", -["77"] = "numPad6", -["78"] = "numPadAdd", -["79"] = "numPad1", -["80"] = "numPad2", -["81"] = "numPad3", -["82"] = "numPad0", -["83"] = "numPadDecimal", -["87"] = "f11", -["88"] = "f12", -["89"] = "f13", -["90"] = "f14", -["91"] = "f15", -["-1"] = "kana", -["-1"] = "convert", -["-1"] = "noconvert", -["-1"] = "yen", -["-1"] = "numPadEquals", -["144"] = "cimcumflex", -["145"] = "at", -["146"] = "colon", -["147"] = "underscore", -["-1"] = "kanji", -["-1"] = "stop", -["-1"] = "ax", -["156"] = "numPadEnter", -["157"] = "rightCtrl", -["-1"] = "numPadComma", -["181"] = "numPadDivide", -["184"] = "rightAlt", -["197"] = "pause", -["199"] = "home", -["200"] = "up", -["201"] = "pageUp", -["203"] = "left", -["208"] = "right", -["207"] = "end", -["205"] = "down", -["209"] = "pageDown", -["210"] = "insert", -["211"] = "delete", +local keycodeNumToName = { + ["30"] = "a", + ["48"] = "b", + ["46"] = "c", + ["32"] = "d", + ["18"] = "e", + ["33"] = "f", + ["34"] = "g", + ["35"] = "h", + ["23"] = "i", + ["36"] = "j", + ["37"] = "k", + ["38"] = "l", + ["50"] = "m", + ["49"] = "n", + ["24"] = "o", + ["25"] = "p", + ["16"] = "q", + ["19"] = "r", + ["31"] = "s", + ["20"] = "t", + ["22"] = "u", + ["47"] = "v", + ["17"] = "w", + ["45"] = "x", + ["21"] = "y", + ["44"] = "z", + ["2"] = "one", + ["3"] = "two", + ["4"] = "three", + ["5"] = "four", + ["6"] = "five", + ["7"] = "six", + ["8"] = "seven", + ["9"] = "eight", + ["10"] = "nine", + ["11"] = "zero", + ["12"] = "minus", + ["13"] = "equals", + ["14"] = "backspace", + ["15"] = "tab", + ["26"] = "leftBracket", + ["27"] = "rightBracket", + ["28"] = "enter", + ["29"] = "leftCtrl", + ["39"] = "semiColon", + ["40"] = "apostrophe", + ["41"] = "grave", + ["42"] = "leftShift", + ["43"] = "backslash", + ["51"] = "comma", + ["52"] = "period", + ["53"] = "slash", + ["54"] = "rightShift", + ["55"] = "multiply", + ["56"] = "leftAlt", + ["57"] = "space", + ["58"] = "capsLock", + ["59"] = "f1", + ["60"] = "f2", + ["61"] = "f3", + ["62"] = "f4", + ["63"] = "f5", + ["64"] = "f6", + ["65"] = "f7", + ["66"] = "f8", + ["67"] = "f9", + ["68"] = "f10", + ["69"] = "numLock", + ["70"] = "scollLock", + ["87"] = "f11", + ["88"] = "f12", + ["89"] = "f13", + ["90"] = "f14", + ["91"] = "f15", + ["144"] = "cimcumflex", + ["145"] = "at", + ["146"] = "colon", + ["147"] = "underscore", + ["157"] = "rightCtrl", + ["184"] = "rightAlt", + ["197"] = "pause", + ["199"] = "home", + ["200"] = "up", + ["201"] = "pageUp", + ["203"] = "left", + ["208"] = "right", + ["207"] = "end", + ["205"] = "down", + ["209"] = "pageDown", + ["210"] = "insert", + ["211"] = "delete", + ["219"] = "leftCommand" } -_G.keys = {} -_G.keys.getName = function(code) return keycodeDic[tostring(code)] end +_G.keys = { + ["a"] = 30, + ["b"] = 48, + ["c"] = 46, + ["d"] = 32, + ["e"] = 18, + ["f"] = 33, + ["g"] = 34, + ["h"] = 35, + ["i"] = 23, + ["j"] = 36, + ["k"] = 37, + ["l"] = 38, + ["m"] = 50, + ["n"] = 49, + ["o"] = 24, + ["p"] = 25, + ["q"] = 16, + ["r"] = 19, + ["s"] = 31, + ["t"] = 20, + ["u"] = 22, + ["v"] = 47, + ["w"] = 17, + ["x"] = 45, + ["y"] = 21, + ["z"] = 44, + ["one"] = 2, + ["two"] = 3, + ["three"] = 4, + ["four"] = 5, + ["five"] = 6, + ["six"] = 7, + ["seven"] = 8, + ["eight"] = 9, + ["nine"] = 10, + ["zero"] = 11, + ["minus"] = 12, + ["equals"] = 13, + ["backspace"] = 14, + ["tab"] = 15, + ["leftBracket"] = 26, + ["rightBracket"] = 27, + ["enter"] = 28, + ["leftCtrl"] = 29, + ["semiColon"] = 39, + ["apostrophe"] = 40, + ["grave"] = 41, + ["leftShift"] = 42, + ["backslash"] = 43, + ["comma"] = 51, + ["period"] = 52, + ["slash"] = 53, + ["rightShift"] = 54, + ["multiply"] = 55, + ["leftAlt"] = 56, + ["space"] = 57, + ["capsLock"] = 58, + ["f1"] = 59, + ["f2"] = 60, + ["f3"] = 61, + ["f4"] = 62, + ["f5"] = 63, + ["f6"] = 64, + ["f7"] = 65, + ["f8"] = 66, + ["f9"] = 67, + ["f10"] = 68, + ["numLock"] = 69, + ["scollLock"] = 70, + ["f11"] = 87, + ["f12"] = 88, + ["f13"] = 89, + ["f14"] = 90, + ["f15"] = 91, + ["cimcumflex"] = 144, + ["at"] = 145, + ["colon"] = 146, + ["underscore"] = 147, + ["rightCtrl"] = 157, + ["rightAlt"] = 184, + ["pause"] = 197, + ["home"] = 199, + ["up"] = 200, + ["pageUp"] = 201, + ["left"] = 203, + ["right"] = 208, + ["end"] = 207, + ["down"] = 205, + ["pageDown"] = 209, + ["insert"] = 210, + ["delete"] = 211, + ["leftCommand"] = 219 +} +_G.keys.getName = function(code) return keycodeNumToName[tostring(code)] end diff --git a/src/net/torvald/terrarum/virtualcomputer/computer/BaseTerrarumComputer.kt b/src/net/torvald/terrarum/virtualcomputer/computer/BaseTerrarumComputer.kt index 9c880c2ce..4252fd46d 100644 --- a/src/net/torvald/terrarum/virtualcomputer/computer/BaseTerrarumComputer.kt +++ b/src/net/torvald/terrarum/virtualcomputer/computer/BaseTerrarumComputer.kt @@ -2,19 +2,18 @@ package net.torvald.terrarum.virtualcomputer.computer import li.cil.repack.org.luaj.vm2.Globals import li.cil.repack.org.luaj.vm2.LuaError +import li.cil.repack.org.luaj.vm2.LuaTable import li.cil.repack.org.luaj.vm2.LuaValue import li.cil.repack.org.luaj.vm2.lib.ZeroArgFunction import li.cil.repack.org.luaj.vm2.lib.jse.JsePlatform import net.torvald.terrarum.KVHashMap import net.torvald.terrarum.gameactors.ActorValue -import net.torvald.terrarum.virtualcomputer.luaapi.Filesystem -import net.torvald.terrarum.virtualcomputer.luaapi.HostAccessProvider -import net.torvald.terrarum.virtualcomputer.luaapi.Security -import net.torvald.terrarum.virtualcomputer.luaapi.Term +import net.torvald.terrarum.virtualcomputer.luaapi.* import net.torvald.terrarum.virtualcomputer.terminal.* import net.torvald.terrarum.virtualcomputer.worldobject.ComputerPartsCodex import net.torvald.terrarum.virtualcomputer.worldobject.FixtureComputerBase import org.newdawn.slick.GameContainer +import org.newdawn.slick.Input import java.io.* /** @@ -40,15 +39,14 @@ class BaseTerrarumComputer(val term: Teletype? = null) { val processorCycle: Int // number of Lua statement to process per tick (1/100 s) get() = ComputerPartsCodex.getProcessorCycles(computerValue.getAsInt("processor") ?: 0) - val memSize: Int // max: 8 GB + val memSize: Int // in bytes; max: 8 GB get() { - if (DEBUG_UNLIMITED_MEM) return 1.shl(30)// 1 GB + if (DEBUG_UNLIMITED_MEM) return 16.shl(20)// 16 MB var size = 0 for (i in 0..3) - size += ComputerPartsCodex.getRamSize(computerValue.getAsInt("memSlot$i") ?: 0) + size += ComputerPartsCodex.getRamSize(computerValue.getAsInt("memSlot$i")!!) - return 16.shl(20) return size } @@ -58,6 +56,9 @@ class BaseTerrarumComputer(val term: Teletype? = null) { var isHalted = false + lateinit var input: Input + private set + init { computerValue["memslot0"] = 4864 // -1 indicates mem slot is empty computerValue["memslot1"] = -1 // put index of item here @@ -83,34 +84,46 @@ class BaseTerrarumComputer(val term: Teletype? = null) { computerValue["boot"] = computerValue.getAsString("hda")!! - if (term != null) { - termOut = TerminalPrintStream(term) - termErr = TerminalPrintStream(term) - termIn = TerminalInputStream(term) + if (term != null) initSandbox(term) + } - luaJ_globals.STDOUT = termOut - luaJ_globals.STDERR = termErr - luaJ_globals.STDIN = termIn + fun initSandbox(term: Teletype) { + termOut = TerminalPrintStream(term) + termErr = TerminalPrintStream(term) + termIn = TerminalInputStream(term) - // load libraries - Term(luaJ_globals, term) - Security(luaJ_globals) - Filesystem(luaJ_globals, this) - HostAccessProvider(luaJ_globals, this) - } + luaJ_globals.STDOUT = termOut + luaJ_globals.STDERR = termErr + luaJ_globals.STDIN = termIn + + // load libraries + Term(luaJ_globals, term) + Security(luaJ_globals) + Filesystem(luaJ_globals, this) + HostAccessProvider(luaJ_globals, this) + Input(luaJ_globals, this) + Http(luaJ_globals, this) + + // secure the sandbox + luaJ_globals["io"] = LuaValue.NIL + val sethook = luaJ_globals["debug"]["sethook"] + luaJ_globals["debug"] = LuaValue.NIL // ROM BASIC val inputStream = javaClass.getResourceAsStream("/net/torvald/terrarum/virtualcomputer/assets/lua/BOOT.lua") runCommand(InputStreamReader(inputStream), "=boot") // computer-related global functions - luaJ_globals["getTotalMem"] = LuaFunGetTotalMem(this) + luaJ_globals["totalMemory"] = LuaFunGetTotalMem(this) } var threadTimer = 0 val threadMaxTime = 2000 fun update(gc: GameContainer, delta: Int) { + input = gc.input + + if (currentExecutionThread.state == Thread.State.TERMINATED) unsetThreadRun() diff --git a/src/net/torvald/terrarum/virtualcomputer/luaapi/Filesystem.kt b/src/net/torvald/terrarum/virtualcomputer/luaapi/Filesystem.kt index 54d93b43a..8148f41c0 100644 --- a/src/net/torvald/terrarum/virtualcomputer/luaapi/Filesystem.kt +++ b/src/net/torvald/terrarum/virtualcomputer/luaapi/Filesystem.kt @@ -456,6 +456,7 @@ internal class Filesystem(globals: Globals, computer: BaseTerrarumComputer) { } } + /** returns NO line separator! */ private class FileClassReadLine(val fr: FileReader) : ZeroArgFunction() { val scanner = Scanner(fr.readText()) // no closing; keep the scanner status persistent diff --git a/src/net/torvald/terrarum/virtualcomputer/luaapi/HostAccessProvider.kt b/src/net/torvald/terrarum/virtualcomputer/luaapi/HostAccessProvider.kt index 016c955b1..a67be1e0f 100644 --- a/src/net/torvald/terrarum/virtualcomputer/luaapi/HostAccessProvider.kt +++ b/src/net/torvald/terrarum/virtualcomputer/luaapi/HostAccessProvider.kt @@ -37,7 +37,10 @@ internal class HostAccessProvider(globals: Globals, computer: BaseTerrarumComput class PrintLn(): OneArgFunction() { override fun call(p0: LuaValue): LuaValue { - println(p0.checkIBM437()) + if (p0.isnumber()) + println(p0.checkdouble()) + else + println(p0.checkIBM437()) return LuaValue.NONE } } @@ -91,7 +94,7 @@ internal class HostAccessProvider(globals: Globals, computer: BaseTerrarumComput class HaltComputer(val computer: BaseTerrarumComputer) : ZeroArgFunction() { override fun call() : LuaValue { computer.isHalted = true - computer.luaJ_globals.load("""print("system halted")""").call() + computer.luaJ_globals.load("""print(DC4.."system halted")""").call() return LuaValue.NONE } } diff --git a/src/net/torvald/terrarum/virtualcomputer/luaapi/Http.kt b/src/net/torvald/terrarum/virtualcomputer/luaapi/Http.kt new file mode 100644 index 000000000..f662c80c3 --- /dev/null +++ b/src/net/torvald/terrarum/virtualcomputer/luaapi/Http.kt @@ -0,0 +1,12 @@ +package net.torvald.terrarum.virtualcomputer.luaapi + +import li.cil.repack.org.luaj.vm2.Globals +import net.torvald.terrarum.virtualcomputer.computer.BaseTerrarumComputer + +/** + * Provides internet access, if @param computer has internet card(s). + * + * Created by minjaesong on 16-09-24. + */ +internal class Http(globals: Globals, computer: BaseTerrarumComputer) { +} \ No newline at end of file diff --git a/src/net/torvald/terrarum/virtualcomputer/luaapi/Input.kt b/src/net/torvald/terrarum/virtualcomputer/luaapi/Input.kt new file mode 100644 index 000000000..e7443c849 --- /dev/null +++ b/src/net/torvald/terrarum/virtualcomputer/luaapi/Input.kt @@ -0,0 +1,48 @@ +package net.torvald.terrarum.virtualcomputer.luaapi + +import li.cil.repack.org.luaj.vm2.Globals +import li.cil.repack.org.luaj.vm2.LuaTable +import li.cil.repack.org.luaj.vm2.LuaValue +import li.cil.repack.org.luaj.vm2.lib.OneArgFunction +import net.torvald.terrarum.gamecontroller.Key +import net.torvald.terrarum.virtualcomputer.computer.BaseTerrarumComputer + +/** + * Created by minjaesong on 16-09-25. + */ +class Input(globals: Globals, computer: BaseTerrarumComputer) { + + init { + globals["input"] = LuaTable() + globals["input"]["isKeyDown"] = IsKeyDown(computer) + } + + companion object { + val keys_alt = intArrayOf(Key.L_ALT, Key.L_COMMAND) + val keys_caps = intArrayOf(Key.CAPS_LOCK, Key.BACKSPACE, Key.L_CONTROL) + } + + class IsKeyDown(val computer: BaseTerrarumComputer) : OneArgFunction() { + override fun call(keyCode: LuaValue): LuaValue { + val key = keyCode.checkint() + + // L_Alt and L_COMMAND are homogeneous + if (keys_alt.contains(key)) { + for (k in keys_alt) { + val down = computer.input.isKeyDown(k) + if (down) return LuaValue.valueOf(true) + } + } + + // Caps, Backspace, L_Control, for Colemak and HHKB + if (keys_caps.contains(key)) { + for (k in keys_caps) { + val down = computer.input.isKeyDown(k) + if (down) return LuaValue.valueOf(true) + } + } + + return LuaValue.valueOf(computer.input.isKeyDown(keyCode.checkint())) + } + } +} \ No newline at end of file diff --git a/src/net/torvald/terrarum/virtualcomputer/luaapi/Security.kt b/src/net/torvald/terrarum/virtualcomputer/luaapi/Security.kt index b70bb6f62..ec1b3b931 100644 --- a/src/net/torvald/terrarum/virtualcomputer/luaapi/Security.kt +++ b/src/net/torvald/terrarum/virtualcomputer/luaapi/Security.kt @@ -9,6 +9,8 @@ import org.apache.commons.codec.digest.DigestUtils import java.security.SecureRandom /** + * Hashes, CSPRNG, Base64 + * * Created by minjaesong on 16-09-15. */ internal class Security(globals: Globals) { diff --git a/src/net/torvald/terrarum/virtualcomputer/luaapi/Term.kt b/src/net/torvald/terrarum/virtualcomputer/luaapi/Term.kt index 39f993a93..94990e3f5 100644 --- a/src/net/torvald/terrarum/virtualcomputer/luaapi/Term.kt +++ b/src/net/torvald/terrarum/virtualcomputer/luaapi/Term.kt @@ -7,7 +7,8 @@ import net.torvald.terrarum.virtualcomputer.terminal.Terminal import java.nio.charset.Charset /** - * APIs must have some extent of compatibility with ComputerCraft by dan200 + * Controls terminal as if it was a monitor + * (not sending control sequences but just drives it, as if it was not a terminal @ 9600 baud) * * Created by minjaesong on 16-09-12. */ diff --git a/src/net/torvald/terrarum/virtualcomputer/terminal/SimpleTextTerminal.kt b/src/net/torvald/terrarum/virtualcomputer/terminal/SimpleTextTerminal.kt index f2fbbbad0..e361617b2 100644 --- a/src/net/torvald/terrarum/virtualcomputer/terminal/SimpleTextTerminal.kt +++ b/src/net/torvald/terrarum/virtualcomputer/terminal/SimpleTextTerminal.kt @@ -91,8 +91,8 @@ open class SimpleTextTerminal( private val cursorBlinkLen = 250 private var cursorBlinkOn = true - val phosphor = if (colour) WHITE else phosphorColour - open protected val colourScreen = if (colour) Color(4, 4, 4) else Color(19, 19, 19) + val phosphor = if (colour) WHITE7500 else phosphorColour + open protected val colourScreen = if (colour) Color(8, 8, 8) else Color(19, 19, 19) @@ -447,10 +447,11 @@ open class SimpleTextTerminal( companion object { val AMBER = Color(255, 183, 0) // P3, 602 nm - val IBM_GREEN = Color(74, 255, 0) // P39, 525 nm - val WHITE = Color(228, 234, 255) // P4, 7 500 K + val GREEN = Color(74, 255, 0) // P39, 525 nm + val WHITE = Color(204, 223, 255) // approximation of white CRT I own + val WHITE7500 = Color(0xe4eaff) val ELECTRIC_BLUE = Color(0, 226, 255) // imaginary, 483 nm - val RED = Color(250, 0, 0) // <= 645 nm + val RED = Color(250, 51, 0) // 632 nm val ASCII_NUL = 0.toChar() val ASCII_BEL = 7.toChar() // *BEEP!* diff --git a/src/net/torvald/terrarum/virtualcomputer/worldobject/ComputerPartsCodex.kt b/src/net/torvald/terrarum/virtualcomputer/worldobject/ComputerPartsCodex.kt index f51b791e0..e2b0080ab 100644 --- a/src/net/torvald/terrarum/virtualcomputer/worldobject/ComputerPartsCodex.kt +++ b/src/net/torvald/terrarum/virtualcomputer/worldobject/ComputerPartsCodex.kt @@ -14,14 +14,14 @@ object ComputerPartsCodex { init { // in kilobytes - rams.put(4864, 16.MiB()) - rams.put(4865, 24.MiB()) - rams.put(4866, 32.MiB()) - rams.put(4867, 64.MiB()) - rams.put(4868, 96.MiB()) - rams.put(4869, 128.MiB()) - rams.put(4870, 160.MiB()) - rams.put(4871, 256.MiB()) + rams.put(4864, 128.KiB()) + rams.put(4865, 192.KiB()) + rams.put(4866, 256.KiB()) + rams.put(4867, 384.KiB()) + rams.put(4868, 512.KiB()) + rams.put(4869, 768.KiB()) + rams.put(4870, 1024.KiB()) + rams.put(4871, 2048.KiB()) processors.put(4872, 1000) processors.put(4873, 2000) @@ -51,6 +51,6 @@ object ComputerPartsCodex { private fun Int.MB() = this * 1000000 // 1 MB == 1 000 000 bytes, bitches! private fun Int.kB() = this * 1000 - private fun Int.KiB() = this.shr(10) - private fun Int.MiB() = this.shr(20) + private fun Int.KiB() = this.shl(10) + private fun Int.MiB() = this.shl(20) } \ No newline at end of file diff --git a/work_files/2016-09-25T01:00:58.241.png b/work_files/2016-09-25T01:00:58.241.png new file mode 100644 index 000000000..a11f64bea Binary files /dev/null and b/work_files/2016-09-25T01:00:58.241.png differ diff --git a/work_files/monotone.ans b/work_files/monotone.ans new file mode 100644 index 000000000..f808ff9a8 --- /dev/null +++ b/work_files/monotone.ans @@ -0,0 +1,69 @@ +Order 00C-4 C-5 C-5 C-4 F20Octave F1 F2 F3 F4 F5 F6 F7 F8 F9 +  01     + 00 02  02     +0100 03      SPACE Stop/Rec. mode SHIFT Assign patn to order +0201 04 D-5 F#5  F08 Move cursorSHIFT Prev/Next pattern +0303 05 F#5   \ Note offTAB Next channel +0404 06 A-5    +0505 07 G-5 G-5   +0606 08 C-6    ALT Select blockPAGE Move by 16 rows +0707  09   E-6       ALT C Copy selectionHM/ED Move to top/bottom +0808 0A C-5 ===   ALT V Paste selection +0909 0B     +0A0A 0C    F20 ENTER Play from beggining +0B0B 0D     INS Insert a patn  ENTER Play this pattern +0C0C 0E     DEL Del. sel. patn +0D0D 0F     INS Insert order +0E0E 10 C-6 G#5  F04 DEL Delete orderCTRL S Save +0F0F 11 D#6 C-6  CTRL O Load (discard this) +1010 12 G#6 D#6  CTRL N New (discard this) +1111 13 F#6 D-6   +1212 14 A-6 F#6   +1313 15 D-7 A-6   +1414 16     +1515 17 C-5 ===   +1616 18     +1717 19     +1818 1A     +1919 1B    F20 +1A1A 1C     +1B1B 1D     +1C1C 1E  G-3  F03 Effects +1D1D 1F  A-3   +1E1E 20  B-3  0xy Arpeggio +1F1E 21  C-4   +201E 22  D-4  1xx Portamento up +211F 23  E-4   + 24  F-4  2xx Portamento down + 25  G-4   + 26  A-4  3xx Portamento to note + 27  B-4   + 28  C-5  4xy Vibrato + 29  D-5   + 2A  E-5  Bxx Jump to order + 2B  F-5   + 2C  G-5  Dxx Pattern break + 2D  A-5   + 2E  B-5  Fxx Set tick speed + 2F  C-6   + 30  D-6   + 31  E-6    + 32  F-6        + 33  G-6   2356790= + 34  A-6        + 35  B-6 D00    + 36     QWERTYUIOP{} + 37       + 38      + 39         + 3A     SDGHJL; +  3B         +3C       +RecPlay 3D     ZXCVBNM,./Oct +Trcks 4 3E       -1 +Tick 08 3F      + +RecPlay RecPlay +Trcks 4 Trcks 4  Editable +Tick 08 Tick 08  Fxx eff +SAUCE00 20160924~dEIBM VGA50 \ No newline at end of file diff --git a/work_files/monotone.png b/work_files/monotone.png new file mode 100644 index 000000000..e2d366d79 Binary files /dev/null and b/work_files/monotone.png differ diff --git a/work_files/monotone_splash.png b/work_files/monotone_splash.png new file mode 100644 index 000000000..f955b5f38 Binary files /dev/null and b/work_files/monotone_splash.png differ diff --git a/work_files/romapidoc/api_filesystem.tex b/work_files/romapidoc/api_filesystem.tex new file mode 100644 index 000000000..bb9470d6b --- /dev/null +++ b/work_files/romapidoc/api_filesystem.tex @@ -0,0 +1,77 @@ +The Filesystem API provides functions for manipulating files and the filesystem. + +The path for the argument of functions blocks `\,.\,.\,' to be entered, preventing users from access outside of the computer and eliminating the potential of harming the real computer of the innocent players. + +\subsection{Functions} + +\begin{tabularx}{\textwidth}{l l X} + \textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description} + \\ \\ + \endhead + fs.list(\textbf{path}: string) & table & Returns list of files in \textbf{path}, in lua table. + \\ \\ + fs.exists(\textbf{path}: string) & bool & Checks if \textbf{path} exists on the filesystem. + \\ \\ + fs.isDir(\textbf{path}: string) & bool & Checks if \textbf{path} is a directory. + \\ \\ + fs.isFile(\textbf{path}: string) & bool & Checks if \textbf{path} is a file. + \\ \\ + fs.isReadOnly(\textbf{path}: string) & bool & Checks if \textbf{path} is read only. + \\ \\ + fs.getSize(\textbf{path}: string) & int & Returns a size of the file/directory, in bytes. + \\ \\ + fs.mkdir(\textbf{path}: string) & bool & Create a directory to \textbf{path}. Returns \textbf{true} upon success. + \\ \\ + fs.mv(\textbf{from}: string, \textbf{dest}: string) & bool & Moves the directory to the destination. Subdirectories / files will also be moved. Returns \textbf{true} upon success. + \\ \\ + fs.cp(\textbf{from}: string, \textbf{dest}: string) & bool & Copies the directory to the destination. Subdirectories / files will also be copied. Returns \textbf{true} upon success. + \\ \\ + fs.rm(\textbf{path}: string) & bool & Deletes the \textbf{path}. If \textbf{path} is a directory, all its members will also be deleted. Returns \textbf{true} upon success. + \\ \\ + fs.concat(\textbf{p1}: string, \textbf{p2}: string) & string & Concatenates two paths and return new path as string. + \\ \\ + fs.open(\textbf{path}: string, \textbf{mode}: string) & file & Opens file and returns its handle. See section \emph{File Handler} for details. + \\ \\ + fs.parent(\textbf{path}: string) & string & Returs parent directory to the \textbf{path}. + \\ \\ + fs.dofile(\textbf{path}: string) & nil & Loads the script on \textbf{path} and executes it. + \\ \\ + fs.fetchText(\textbf{path}: string) & string & Opens the file on \textbf{path} and returns its contents as a plain text. +\end{tabularx} + +\subsection{File Handler} + +When it comes to opening a file, there are six modes available---r, w, a, rb, wb, ab, each represents \textbf{r}ead, \textbf{w}rite, \textbf{a}ppend and \textbf{b}yte. + +\begin{tabularx}{\textwidth}{l X} + \textbf{\large Function} & \textbf{\large Description} + \\ \\ + \endhead + file.close() & Closes the file. Any data wrote will be actually wrote to disk when this function is called. + \\ \\ + file.flush() & (in write/append mode) Flushes the data to the file, keeps the handle available afterwards + \\ \\ + \multicolumn{2}{c}{\textbf{Read mode}} + \\ \\ + file.readLine() & Reads text from the file line by line. Returns string of line, or \emph{nil} if there is no next line. + \\ \\ + file.readAll() & Reads and returns whole text in the file as string. + \\ \\ + \multicolumn{2}{c}{\textbf{Read binary mode}} + \\ \\ + file.read() & Reads single byte in the file as int, or \emph{-1} if end-of-file is reached. + \\ \\ + file.readAll() & Reads and returns whole byte in the file as string. + \\ \\ + \multicolumn{2}{c}{\textbf{Write/append mode}} + \\ \\ + file.write(string) & Writes \textbf{string} to the file. + \\ \\ + file.writeLine(string) & Writes \textbf{string} to the file and append line feed. + \\ \\ + \multicolumn{2}{c}{\textbf{Write/append binary mode}} + \\ \\ + file.write(int) & Writes \textbf{int} to the file. + \\ \\ + file.writeBytes(string) & Writes \textbf{string} to the file and append line feed. +\end{tabularx} \ No newline at end of file diff --git a/work_files/romapidoc/api_hexutils.tex b/work_files/romapidoc/api_hexutils.tex new file mode 100644 index 000000000..f83e6a711 --- /dev/null +++ b/work_files/romapidoc/api_hexutils.tex @@ -0,0 +1,10 @@ +The Hexutils library provides utility to convert byte value to hexadecimal string. + +\subsection{Functions} + +\begin{tabularx}{\textwidth}{l l X} + \textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description} + \\ \\ + \endhead + hexutils.toHexString(\textbf{bytes}: string) & string & Converts byte array to the string of its hexadecimal representations. +\end{tabularx} \ No newline at end of file diff --git a/work_files/romapidoc/api_input.tex b/work_files/romapidoc/api_input.tex new file mode 100644 index 000000000..db8880b9c --- /dev/null +++ b/work_files/romapidoc/api_input.tex @@ -0,0 +1,18 @@ +The Input API provides access to game's Input API to get input-related informations. + +\subsection{Functions} + +\begin{tabularx}{\textwidth}{l l X} + \textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description} + \\ \\ + \endhead + input.isKeyDown(keycode: int) & bool & Checks whether the key is down. By combining with `and' or `or' statement, you can inquire for multiple keys being down simultaneously. + \\ \\ + input.readLine() & string & Reads a line of string and returns it. +\end{tabularx} + +You can use \emph{Keys} Library with this API. Examples: + +\begin{itemize} +\item input.isKeyDown(keys.q) +\end{itemize} \ No newline at end of file diff --git a/work_files/romapidoc/api_keys.tex b/work_files/romapidoc/api_keys.tex new file mode 100644 index 000000000..51383c119 --- /dev/null +++ b/work_files/romapidoc/api_keys.tex @@ -0,0 +1,72 @@ +The Keys library helps you with Input API to get key code by key's names, or identify a key code. + +Notes on compatibility with ComputerCraft: although this library is ComputerCraft-compliant, but Numpads are \emph{not} supported whatsoever. \textit{Come on, it's not like everyone has or likes numpad on their keyboard.} + +\begin{tabularx}{\textwidth}{l l X} + \textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description} + \\ \\ + \endhead + keys. & int & Returns key code corresponds to the key name. + \\ \\ + keys.getName(keycode: int) & string & Returns key name corresponds to the keycode. +\end{tabularx} + +\subsection{Accepted Key Names} + +\emph{NOTE: following sets are considered as the same keys.} + +\begin{itemize} +\item leftAlt --- leftCommand + +(leftAlt is often recognised as leftCommand on macOS) + +\item leftControl --- capsLock --- backspace + +(colemak key layout puts secondary backspace on capsLock, Happy Hacking Keyboard puts Control on the location of Caps Lock) +\end{itemize} + +\begin{tasks}[counter-format=\-](5) + \task (\emph{a} to \emph{z}) + \task (\emph{zero} to \emph{nine}) + \task minus + \task equals + \task backspace + \task tab + \task leftBracket + \task rightBracket + \task enter + \task leftCtrl + \task semiColon + \task apostrophe + \task grave + \task leftShift + \task backslash + \task comma + \task period + \task slash + \task rightShift + \task multiply + \task leftAlt + \task space + \task capsLock + \task scollLock + \task (\emph{f1} to \emph{f15}) + \task cimcumflex + \task at + \task colon + \task underscore + \task rightCtrl + \task rightAlt + \task pause + \task home + \task up + \task pageUp + \task left + \task right + \task end + \task down + \task pageDown + \task insert + \task delete + \task leftCommand +\end{tasks} \ No newline at end of file diff --git a/work_files/romapidoc/api_security.tex b/work_files/romapidoc/api_security.tex new file mode 100644 index 000000000..6f3a0a3a8 --- /dev/null +++ b/work_files/romapidoc/api_security.tex @@ -0,0 +1,20 @@ +The Serurity API provides functions for security purposes, such as hashing and CSPRNG\footnote{Cryptographically secure psuedo-random number generator}. + +\subsection{Functions} + +\begin{tabularx}{\textwidth}{l l X} + \textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description} + \\ \\ + \endhead + security.toSHA1(string) & string & Returns SHA-256 hash of input string in array of bytes (as a string) + \\ \\ + security.toSHA256(string) & string & Returns SHA-1 hash of input string in array of bytes + \\ \\ + security.toMD5(string) & string & Returns MD-5 hash of input string in array of bytes + \\ \\ + security.randomBytes(\textbf{len}: int) & string & Returns byte array of random values in desired \textbf{len}gth. + \\ \\ + security.decodeBase64(string) & string & Decodes Base64 string and returns the result as string. + \\ \\ + security.encodeBase64(string) & string & Encodes input string as Base64 format and returns the result as array of bytes. +\end{tabularx} \ No newline at end of file diff --git a/work_files/romapidoc/api_shell.tex b/work_files/romapidoc/api_shell.tex new file mode 100644 index 000000000..90a8c6f41 --- /dev/null +++ b/work_files/romapidoc/api_shell.tex @@ -0,0 +1,6 @@ +\begin{tabularx}{\textwidth}{l l X} + \textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description} + \\ \\ + \endhead + shell.run(\textbf{path}: string) & nil & Loads the script on \textbf{path} and executes it. +\end{tabularx} \ No newline at end of file diff --git a/work_files/romapidoc/api_terminal.tex b/work_files/romapidoc/api_terminal.tex new file mode 100644 index 000000000..081a7c86c --- /dev/null +++ b/work_files/romapidoc/api_terminal.tex @@ -0,0 +1,109 @@ +The Terminal API provides functions for sending text to the terminals, and drawing text-mode graphics. The API expects connected terminal to use Codepage 437. See section \emph{Codepage} for details. + +\subsection{Functions} + +Note: cursor coordinates starts from one, not zero. + +\begin{tabularx}{\textwidth}{l l X} + \textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description} + \\ \\ + \endhead + term.write(string) & nil & Writes string to the current cursor position. Line feed is not appended. + \\ \\ + term.print(string) & nil & Writes string to the current cursor position and make a new line. + \\ \\ + term.newLine() & nil & Make a new line. + \\ \\ + term.moveCursor(\textbf{x}: int) & nil & Moves cursor horizontally, starting from 1. + \\ \\ + term.width() & int & Returns the width of the terminal. Graphic terminals also can use this. + \\ \\ + term.scroll(\textbf{n}: int) & nil & Make a new line \textbf{n} times. + \\ \\ + term.isTeletype() & bool & Returns \textbf{true} if the terminal is teletype. + \\ \\ + \multicolumn{3}{c}{\textbf{Graphic terminals only}} + \\ \\ + term.emit(\textbf{c}: int, \textbf{x}: int, \textbf{y}: int) & nil & Emits \textbf{c} into (\textbf{x}, \textbf{y}), control sequence will not be processed and printed as symbols instead. Cursor will not be moved. + \\ \\ + term.emitRaw(\textbf{bufferChar}: int) & nil & Emits \textbf{bufferChar} into into (\textbf{x}, \textbf{y}). Buffer char means a single character actually stored into the screen buffer, has four bits for back- and foreground colours respectively, and eight bits for a letter. + \\ \\ + term.emitString(\textbf{s}, \textbf{x}: int, \textbf{y}: int) & nil & Emits \textbf{s} (a string) into (\textbf{x}, \textbf{y}), printing control sequences as symbols. Cursor will not be moved. + \\ \\ + \begin{tabular}[t]{@{}l@{}}term.resetColour()\\term.resetColor()\end{tabular} & nil & Resets any colour changes to the defaults. + \\ \\ + term.clear() & nil & Clears whole screen buffer and move cursor to (1, 1) + \\ \\ + term.clearLine() & nil & Clears current line on the screen buffer, does not moves cursor. + \\ \\ + term.setCursor(\textbf{x}: int, \textbf{y}: int) & nil & Moves cursor to (\textbf{x}, \textbf{y}) + \\ \\ + term.getCursor() & int, int & Returns current coordinates of the cursor. + \\ \\ + term.getX() & int & Returns X coordinate of the cursor. + \\ \\ + term.getY() & int & Returns Y coordinate of the cursor. + \\ \\ + term.setX(int) & nil & Sets X coordinate of the cursor. + \\ \\ + term.setY(int) & nil & Sets Y coordinate of the cursor. + \\ \\ + term.setCursorBlink(bool) & nil & Sets cursor blinking. \textbf{true} makes the cursor blink. + \\ \\ + term.size() & int, int & Returns width and height of the terminal. + \\ \\ + term.height() & int & Returns height of the terminal. + \\ \\ + term.isCol() & bool & Returns if the terminal supports colour. + \\ \\ + term.setForeCol(\textbf{col}: int) & nil & Sets foreground colour to \textbf{col} + \\ \\ + term.setBackCol(\textbf{col}: int) & nil & Sets background colour to \textbf{col}. + \\ \\ + term.foreCol() & int & Returns current foreground colour. + \\ \\ + term.backCol() & int & Returns current background colour. +\end{tabularx} + +\subsection{Standard Colours} + +\begin{tabularx}{\textwidth}{c l c l c l c l} + 0 & \textcolor{black}{Black} & 1 & White & 2 & \textcolor{dimgrey}{Dim grey} & 3 & \textcolor{brightgrey}{Bright grey} + \\ \\ + 4 & \textcolor{yellow}{Yellow} & 5 & \textcolor{orange}{Orange} & 6 & \textcolor{red}{Red} & 7 & \textcolor{magenta}{Magenta} + \\ \\ + 8 & \textcolor{purple}{Purple} & 9 & \textcolor{blue}{Blue} & 10 & \textcolor{cyan}{Cyan} & 11 & \textcolor{lime}{Lime} + \\ \\ + 12 & \textcolor{green}{Green} & 13 & \textcolor{darkgreen}{Dark green} & 14 & \textcolor{brown}{Brown} & 15 & \textcolor{tan}{Tan} +\end{tabularx} + +Non-colour terminals support colour index of 0--3. + +\subsection{Codepage} + +\newlength{\cpimagew} +\setlength{\cpimagew}{\linewidth} +\addtolength{\cpimagew}{-4em} + +\begin{center}\includegraphics[width=\cpimagew]{mda.png}\end{center} + +Character 0x9E (currency symbol) and 0xFA (middle dot) can be accessed with following Lua constants: \emph{MONEYSYM} and \emph{MIDDOT}. See \emph{Lua Globals} > \emph{Constants} section. + +\subsection{Accepted Control Sequences} + +\begin{tabularx}{\textwidth}{c X c X} + \textbf{\large No.} & \textbf{\large Description} & \textbf{\large No.} & \textbf{\large Description} + \\ \\ + \endhead + 7 & BEL. Emits short beep. & 8 & BS. Moves cursor to left 1 character. + \\ \\ + 9 & TAB. Inserts appropriate horizontal space. Tab size is variable. & 10 & LF. Prints a new line. + \\ \\ + 12 & FF. Clears everything in screen buffer and moves cursor to (1, 1) & 13 & CR. Moves x coordinate of cursor to 1. + \\ \\ + 16 & DLE. Sets foreground colour to the default STDERR colour. & 127 & DEL. Backspace and deletes one character. + \\ \\ + 17 & DC1. Sets foreground colour to 0. (black) & 18 & DC2. Sets foreground colour to 1. (white) + \\ \\ + 19 & DC3. Sets foreground colour to 2. (dim grey) & 20 & DC4. Sets foreground colour to 3. (bright grey) +\end{tabularx} \ No newline at end of file diff --git a/work_files/romapidoc/cc_bit.tex b/work_files/romapidoc/cc_bit.tex new file mode 100644 index 000000000..6f221dcca --- /dev/null +++ b/work_files/romapidoc/cc_bit.tex @@ -0,0 +1,22 @@ +The Bit API is for manipulating numbers using bitwise binary operations. The ROMBASIC already comes with Lua's bit32 library so make sure to use that for your casual usage. + +\subsection{Functions} + +\begin{tabularx}{\textwidth}{l X} + \textbf{\large Function} & \textbf{\large Notes} + \\ \\ + \endhead + bit.blshift(n, bits) & Alias of bit32.lshift(n, bits) + \\ \\ + bit.brshift(n, bits) & Alias of bit32.arshift(n, bits) + \\ \\ + bit.blogic\_rshift(n, bits) & Alias of bit32.brshift(n, bits) + \\ \\ + bit.bxor(m, n) & Alias of bit32.bxor(m, n) + \\ \\ + bit.bor(m, n) & Alias of bit32.bor(m, n) + \\ \\ + bit.band(m, n) & Alias of bit32.band(m, n) + \\ \\ + bit.bnot(n) & Alias of bit32.bnot(n) +\end{tabularx} \ No newline at end of file diff --git a/work_files/romapidoc/cc_colors.tex b/work_files/romapidoc/cc_colors.tex new file mode 100644 index 000000000..67ed6e627 --- /dev/null +++ b/work_files/romapidoc/cc_colors.tex @@ -0,0 +1,21 @@ +The Colors API allows you to manipulate sets of colors. This is useful in colors on Advanced Computers and Advanced Monitors. British spellings are also supported. + +\subsection{Constants} + +When the colours are used in ComputerCraft's Term API, nearest console colours will be used. Below is the table of colours coded with their substitutions. + +\begin{tabularx}{\textwidth}{l l l l} + colors.white & colors.\textcolor{orange}{orange} & colors.\textcolor{magenta}{magenta} & colors.\textcolor{cyan}{lightBlue} + \\ \\ + colors.\textcolor{yellow}{yellow} & colors.\textcolor{lime}{lime} & colors.\textcolor{tan}{pink} & colors.\textcolor{dimgrey}{gray} + \\ \\ + colors.\textcolor{brightgrey}{lightGray} & colors.\textcolor{cyan}{cyan} & colors.\textcolor{purple}{purple} & colors.\textcolor{blue}{blue} + \\ \\ + colors.\textcolor{brown}{brown} & colors.\textcolor{green}{green} & colors.\textcolor{red}{red} & colors.\textcolor{black}{black} +\end{tabularx} + +Note that pink is understood as \textcolor{tan}{tan} when it is used, lightBlue and cyan are merged to \textcolor{cyan}{cyan}. + +\subsection{Functions} + +All three functions are not supported, as there is no bundled cable thus there is no use of them. \ No newline at end of file diff --git a/work_files/romapidoc/luadifferences.tex b/work_files/romapidoc/luadifferences.tex new file mode 100644 index 000000000..fb998ff66 --- /dev/null +++ b/work_files/romapidoc/luadifferences.tex @@ -0,0 +1,3 @@ +\begin{itemize} +\item io library is limited to io.read (read a line from keyboard) and io.write (print without new line) +\end{itemize} \ No newline at end of file diff --git a/work_files/romapidoc/luaglobals.tex b/work_files/romapidoc/luaglobals.tex new file mode 100644 index 000000000..ddc56af53 --- /dev/null +++ b/work_files/romapidoc/luaglobals.tex @@ -0,0 +1,51 @@ +ROMBASIC adds global functions and constants for operability. + +\subsection{Functions} + +\begin{tabularx}{\textwidth}{l l X} + \textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description} + \\ \\ + \endhead + \unemph{\_G.}runScript(\textbf{fun}: str, \textbf{env}: str) & nil & Runs Lua script \textbf{fun} with the environment tag \textbf{env}. + \\ \\ + computer.totalMemory() & int & Returns the total size of the memory installed in the computer, in bytes. + \\ \\ + computer.freeMemory() & int & Returns the amount of free memory on the computer. +\end{tabularx} + +\subsection{Constants} + +\begin{tabularx}{\textwidth}{l l X} + \textbf{\large Name} & \textbf{\large Type} & \textbf{\large Description} + \\ \\ + \endhead + \unemph{\_G.}EMDASH & string & EM dash represented by box-drawing character. Code 0xC4 + \\ \\ + \unemph{\_G.}UNCHECKED & string & Unchecked checkbox. Code 0x9C + \\ \\ + \unemph{\_G.}CHECKED & string & Checked checkbox. Code 0x9D + \\ \\ + \unemph{\_G.}MONEYSYM & string & Currency symbol used in the world. Code 0x9E + \\ \\ + \unemph{\_G.}MIDDOT & string & Middle dot used in typography. Code 0xFA (note: 0xF9 is a Dot Product used in Mathematics) + \\ \\ + \unemph{\_G.}DC1 & string & Ascii control sequence DC1. Used to change foreground colour to black. + \\ \\ + \unemph{\_G.}DC2 & string & Ascii control sequence DC2. Used to change foreground colour to white. + \\ \\ + \unemph{\_G.}DC3 & string & Ascii control sequence DC3. Used to change foreground colour to dim grey. + \\ \\ + \unemph{\_G.}DC4 & string & Ascii control sequence DC4. Used to change foreground colour to bright grey. + \\ \\ + \unemph{\_G.}DLE & string & Ascii control sequence DLE. Used to change foreground colour to terminal's default error text colour. + \\ \\ + computer.prompt & string & Default text for prompt input indicator. + \\ \\ + computer.verbose & bool & Sets whether print debug information to the console. + \\ \\ + computer.loadedCLayer & table & List of names of compatibility layers has been loaded. + \\ \\ + computer.bootloader & string & Path to the boot file. Should point to the EFI (/boot/efi). + \\ \\ + computer.OEM & string & Manufacturer of the computer. If you \emph{are} a manufacturer, you may want to fill in this variable with your own company's name. +\end{tabularx} \ No newline at end of file diff --git a/work_files/romapidoc/mda.png b/work_files/romapidoc/mda.png new file mode 100644 index 000000000..712613a53 Binary files /dev/null and b/work_files/romapidoc/mda.png differ diff --git a/work_files/romapidoc/peri_lp.tex b/work_files/romapidoc/peri_lp.tex new file mode 100644 index 000000000..53c164e8d --- /dev/null +++ b/work_files/romapidoc/peri_lp.tex @@ -0,0 +1,18 @@ +The line printer is a printer that operates on line basis. It only prints text in line-by-line, hence the name, on almost endlessly long roll of papers; it has no notion of page, it just prints. If you want some pages to keep, you must tear them out yourself. + +Line printers do not work indefinitely; ignoring the obvious depletion of ink, belt for loading paper will be out of service on about 50 000 lines of printing, give or take a few, or paper will jam if the printer had struck with the unluckiness. + +\subsection{Functions} + +\begin{tabularx}{\textwidth}{l l X} + \textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description} + \\ \\ + \endhead + lp.print(string) & nil & Prints a line of string. + \\ \\ + lp.scroll(\textbf{n}: int) & nil & Scrolls the paper by \textbf{n} lines. + \\ \\ + lp.status() & int & Returns a status of the line printer. + \\ \\ + lp.reset() & nil & Resets the line printer. +\end{tabularx} \ No newline at end of file diff --git a/work_files/romapidoc/romapidoc.aux b/work_files/romapidoc/romapidoc.aux index bd9e6da04..0f10373cc 100644 --- a/work_files/romapidoc/romapidoc.aux +++ b/work_files/romapidoc/romapidoc.aux @@ -37,23 +37,35 @@ \@writefile{toc}{\contentsline {section}{\numberline {1.2}Hexutils}{9}{section.1.2}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.2.1}Functions}{9}{subsection.1.2.1}} \gdef \LT@iv {\LT@entry + {2}{138.81004pt}\LT@entry + {1}{45.25516pt}\LT@entry + {1}{150.9348pt}} +\@writefile{toc}{\contentsline {section}{\numberline {1.3}Input}{10}{section.1.3}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.3.1}Functions}{10}{subsection.1.3.1}} +\gdef \LT@v {\LT@entry + {2}{126.83005pt}\LT@entry + {1}{45.25516pt}\LT@entry + {1}{162.9148pt}} +\@writefile{toc}{\contentsline {section}{\numberline {1.4}Keys}{11}{section.1.4}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.4.1}Accepted Key Names}{11}{subsection.1.4.1}} +\gdef \LT@vi {\LT@entry {2}{136.82pt}\LT@entry {1}{45.25516pt}\LT@entry {1}{152.92484pt}} -\@writefile{toc}{\contentsline {section}{\numberline {1.3}Security}{10}{section.1.3}} -\@writefile{toc}{\contentsline {subsection}{\numberline {1.3.1}Functions}{10}{subsection.1.3.1}} -\gdef \LT@v {\LT@entry +\@writefile{toc}{\contentsline {section}{\numberline {1.5}Security}{12}{section.1.5}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.5.1}Functions}{12}{subsection.1.5.1}} +\gdef \LT@vii {\LT@entry {2}{102.18004pt}\LT@entry {1}{45.25516pt}\LT@entry {2}{180.42001pt}} -\@writefile{toc}{\contentsline {section}{\numberline {1.4}Shell}{11}{section.1.4}} -\gdef \LT@vi {\LT@entry +\@writefile{toc}{\contentsline {section}{\numberline {1.6}Shell}{13}{section.1.6}} +\gdef \LT@viii {\LT@entry {2}{139.76003pt}\LT@entry {1}{45.25516pt}\LT@entry {1}{149.98482pt}} -\@writefile{toc}{\contentsline {section}{\numberline {1.5}Terminal}{12}{section.1.5}} -\@writefile{toc}{\contentsline {subsection}{\numberline {1.5.1}Functions}{12}{subsection.1.5.1}} -\gdef \LT@vii {\LT@entry +\@writefile{toc}{\contentsline {section}{\numberline {1.7}Terminal}{14}{section.1.7}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.7.1}Functions}{14}{subsection.1.7.1}} +\gdef \LT@ix {\LT@entry {1}{22.26001pt}\LT@entry {1}{39.16003pt}\LT@entry {1}{22.26001pt}\LT@entry @@ -62,57 +74,58 @@ {1}{49.88002pt}\LT@entry {1}{22.26001pt}\LT@entry {1}{58.02002pt}} -\@writefile{toc}{\contentsline {subsection}{\numberline {1.5.2}Standard Colours}{14}{subsection.1.5.2}} -\gdef \LT@viii {\LT@entry +\@writefile{toc}{\contentsline {subsection}{\numberline {1.7.2}Standard Colours}{16}{subsection.1.7.2}} +\gdef \LT@x {\LT@entry {1}{28.3155pt}\LT@entry {1}{139.1845pt}\LT@entry {1}{28.3155pt}\LT@entry {1}{139.1845pt}} -\@writefile{toc}{\contentsline {subsection}{\numberline {1.5.3}Codepage}{15}{subsection.1.5.3}} -\@writefile{toc}{\contentsline {subsection}{\numberline {1.5.4}Accepted Control Sequences}{15}{subsection.1.5.4}} -\gdef \LT@ix {\LT@entry +\@writefile{toc}{\contentsline {subsection}{\numberline {1.7.3}Codepage}{17}{subsection.1.7.3}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.7.4}Accepted Control Sequences}{17}{subsection.1.7.4}} +\gdef \LT@xi {\LT@entry {2}{134.13005pt}\LT@entry {1}{45.25516pt}\LT@entry {1}{155.61479pt}} -\gdef \LT@x {\LT@entry - {2}{123.76009pt}\LT@entry +\gdef \LT@xii {\LT@entry + {2}{111.63007pt}\LT@entry {2}{36.06001pt}\LT@entry - {1}{175.1799pt}} -\@writefile{toc}{\contentsline {section}{\numberline {1.6}Lua Globals}{17}{section.1.6}} -\@writefile{toc}{\contentsline {subsection}{\numberline {1.6.1}Functions}{17}{subsection.1.6.1}} -\@writefile{toc}{\contentsline {subsection}{\numberline {1.6.2}Constants}{17}{subsection.1.6.2}} + {1}{187.30992pt}} +\@writefile{toc}{\contentsline {section}{\numberline {1.8}Lua Globals}{18}{section.1.8}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.8.1}Functions}{18}{subsection.1.8.1}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.8.2}Constants}{18}{subsection.1.8.2}} +\@writefile{toc}{\contentsline {section}{\numberline {1.9}Changes from Generic Lua Environment}{20}{section.1.9}} \@writefile{lof}{\addvspace {10pt}} \@writefile{lot}{\addvspace {10pt}} -\@writefile{toc}{\contentsline {chapter}{\chapternumberline {2}Compatibility Layers---ComputerCraft}{19}{chapter.2}} -\gdef \LT@xi {\LT@entry +\@writefile{toc}{\contentsline {chapter}{\chapternumberline {2}Compatibility Layers---ComputerCraft}{21}{chapter.2}} +\gdef \LT@xiii {\LT@entry {2}{108.45001pt}\LT@entry {2}{125.76003pt}} -\@writefile{toc}{\contentsline {section}{\numberline {2.1}Bit}{20}{section.2.1}} -\@writefile{toc}{\contentsline {subsection}{\numberline {2.1.1}Functions}{20}{subsection.2.1.1}} -\gdef \LT@xii {\LT@entry +\@writefile{toc}{\contentsline {section}{\numberline {2.1}Bit}{22}{section.2.1}} +\@writefile{toc}{\contentsline {subsection}{\numberline {2.1.1}Functions}{22}{subsection.2.1.1}} +\gdef \LT@xiv {\LT@entry {1}{77.19011pt}\LT@entry {1}{68.63008pt}\LT@entry {1}{76.35007pt}\LT@entry {1}{76.36005pt}} -\@writefile{toc}{\contentsline {section}{\numberline {2.2}Colors}{21}{section.2.2}} -\@writefile{toc}{\contentsline {subsection}{\numberline {2.2.1}Constants}{21}{subsection.2.2.1}} -\@writefile{toc}{\contentsline {subsection}{\numberline {2.2.2}Functions}{21}{subsection.2.2.2}} -\@writefile{toc}{\contentsline {section}{\numberline {2.3}Term}{22}{section.2.3}} -\@writefile{toc}{\contentsline {section}{\numberline {2.4}Filesystem}{23}{section.2.4}} +\@writefile{toc}{\contentsline {section}{\numberline {2.2}Colors}{23}{section.2.2}} +\@writefile{toc}{\contentsline {subsection}{\numberline {2.2.1}Constants}{23}{subsection.2.2.1}} +\@writefile{toc}{\contentsline {subsection}{\numberline {2.2.2}Functions}{23}{subsection.2.2.2}} +\@writefile{toc}{\contentsline {section}{\numberline {2.3}Term}{24}{section.2.3}} +\@writefile{toc}{\contentsline {section}{\numberline {2.4}Filesystem}{25}{section.2.4}} \@writefile{lof}{\addvspace {10pt}} \@writefile{lot}{\addvspace {10pt}} -\@writefile{toc}{\contentsline {chapter}{\chapternumberline {3}Compatibility Layers---OpenComputers}{25}{chapter.3}} +\@writefile{toc}{\contentsline {chapter}{\chapternumberline {3}Compatibility Layers---OpenComputers}{27}{chapter.3}} \@writefile{lof}{\addvspace {10pt}} \@writefile{lot}{\addvspace {10pt}} -\@writefile{toc}{\contentsline {chapter}{\chapternumberline {4}Peripherals}{27}{chapter.4}} -\gdef \LT@xiii {\LT@entry +\@writefile{toc}{\contentsline {chapter}{\chapternumberline {4}Peripherals}{29}{chapter.4}} +\gdef \LT@xv {\LT@entry {2}{71.78003pt}\LT@entry {1}{45.25516pt}\LT@entry {2}{153.90001pt}} -\@writefile{toc}{\contentsline {section}{\numberline {4.1}Line Printer}{28}{section.4.1}} -\@writefile{toc}{\contentsline {subsection}{\numberline {4.1.1}Functions}{28}{subsection.4.1.1}} +\@writefile{toc}{\contentsline {section}{\numberline {4.1}Line Printer}{30}{section.4.1}} +\@writefile{toc}{\contentsline {subsection}{\numberline {4.1.1}Functions}{30}{subsection.4.1.1}} \@writefile{lof}{\addvspace {10pt}} \@writefile{lot}{\addvspace {10pt}} -\@writefile{toc}{\contentsline {chapter}{\chapternumberline {5}References}{29}{chapter.5}} -\memsetcounter{lastsheet}{31} -\memsetcounter{lastpage}{31} +\@writefile{toc}{\contentsline {chapter}{\chapternumberline {5}References}{31}{chapter.5}} +\memsetcounter{lastsheet}{33} +\memsetcounter{lastpage}{33} diff --git a/work_files/romapidoc/romapidoc.log b/work_files/romapidoc/romapidoc.log index 11bdf2641..d3c7620fa 100644 --- a/work_files/romapidoc/romapidoc.log +++ b/work_files/romapidoc/romapidoc.log @@ -1,4 +1,4 @@ -This is LuaTeX, Version beta-0.80.0 (TeX Live 2015) (rev 5238) (format=lualatex 2015.10.5) 22 SEP 2016 18:24 +This is LuaTeX, Version beta-0.80.0 (TeX Live 2015) (rev 5238) (format=lualatex 2015.10.5) 26 SEP 2016 12:12 restricted \write18 enabled. file:line:error style messages enabled. **romapidoc.tex @@ -552,7 +552,7 @@ luatexbase-attr: luatexbase.attributes["luaotfload@cursbase"] = 6 luatexbase-attr: luatexbase.attributes["luaotfload@curscurs"] = 7 luatexbase-attr: luatexbase.attributes["luaotfload@cursdone"] = 8 luatexbase-attr: luatexbase.attributes["luaotfload@state"] = 9 -luaotfload | main : fontloader loaded in 0.033 seconds +luaotfload | main : fontloader loaded in 0.031 seconds luatexbase-mcb: inserting 'luaotfload.node_processor' at position 1 in 'pre_linebreak_filter' luatexbase-mcb: inserting 'luaotfload.node_processor' @@ -1084,7 +1084,147 @@ Package: longtable 2014/10/28 v4.11 Multi-page Table package (DPC) \c@LT@chunks=\count306 \LT@p@ftn=\toks27 )) -Package hyperref Info: Option `unicode' set `true' on input line 80. +(/usr/local/texlive/2015/texmf-dist/tex/latex/tasks/tasks.sty +(/usr/local/texlive/2015/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty +Package: l3keys2e 2014/11/25 v5471 LaTeX2e option processing using LaTeX3 keys +) +Package: tasks 2014/07/29 v0.10a Horizontal columned lists. + +(/usr/local/texlive/2015/texmf-dist/tex/latex/eepic/epic.sty +Enhancements to Picture Environment. Version 1.2 - Released June 1, 1986 +\@@multicnt=\count307 +\d@lta=\count308 +\@delta=\dimen267 +\@@delta=\dimen268 +\@gridcnt=\count309 +\@joinkind=\count310 +\@dotgap=\dimen269 +\@ddotgap=\dimen270 +\@x@diff=\count311 +\@y@diff=\count312 +\x@diff=\dimen271 +\y@diff=\dimen272 +\@dotbox=\box262 +\num@segments=\count313 +\num@segmentsi=\count314 +\@datafile=\read3 +) (/usr/local/texlive/2015/texmf-dist/tex/latex/cntformats/cntformats.sty +Package: cntformats 2014/07/20 v0.7 A different way to read counters. (CN) + +(/usr/local/texlive/2015/texmf-dist/tex/latex/etoolbox/etoolbox.sty +Package: etoolbox 2015/05/04 v2.2 e-TeX tools for LaTeX (JAW) +\etb@tempcnta=\count315 +) +(/usr/local/texlive/2015/texmf-dist/tex/latex/cnltx/cnltx-base.sty +Package: cnltx-base 2015/01/11 v0.12 LaTeX tools and documenting facilities (CN) + + +(/usr/local/texlive/2015/texmf-dist/tex/latex/pgfopts/pgfopts.sty +Package: pgfopts 2014/07/10 v2.1a LaTeX package options with pgfkeys + +(/usr/local/texlive/2015/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty +(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex +\pgfkeys@pathtoks=\toks28 +\pgfkeys@temptoks=\toks29 + +(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.c +ode.tex +\pgfkeys@tmptoks=\toks30 +))) +\pgfopts@list@add@a@toks=\toks31 +\pgfopts@list@add@b@toks=\toks32 +) +\c@cnltx@tmpa=\count316 +\c@cnltx@tmpb=\count317 +\c@cnltx@tmpc=\count318 +\cnltx@tmpa@length=\skip271 +\cnltx@tmpb@length=\skip272 +\cnltx@tmpc@length=\skip273 + +(/usr/local/texlive/2015/texmf-dist/tex/latex/trimspaces/trimspaces.sty +Package: trimspaces 2009/09/17 v1.1 Trim spaces around a token list +))) +(/usr/local/texlive/2015/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.st +y +Package: xtemplate 2014/11/25 v5471 L3 Experimental prototype document functions + +\l__xtemplate_tmp_dim=\dimen273 +\l__xtemplate_tmp_int=\count319 +\l__xtemplate_tmp_muskip=\muskip17 +\l__xtemplate_tmp_skip=\skip274 +Variant \prop_get:NoNTF already defined; not changing it on line 106 +Variant \prop_get:NoNT already defined; not changing it on line 107 +Variant \prop_get:NoNF already defined; not changing it on line 108 +) (/usr/local/texlive/2015/texmf-dist/tex/latex/environ/environ.sty +Package: environ 2014/05/04 v0.3 A new way to define environments +\@envbody=\toks33 +) +\l__tasks_depth_int=\count320 +\g__tasks_int=\count321 +\g__tasks_total_items_int=\count322 +\l__tasks_columns_int=\count323 +\l__tasks_rows_int=\count324 +\g__tasks_current_col_num_int=\count325 +\g__tasks_current_row_num_int=\count326 +\l__tasks_item_columns_int=\count327 +\l__tasks_item_indent_dim=\dimen274 +\l__tasks_item_default_indent_dim=\dimen275 +\l__tasks_item_width_dim=\dimen276 +\l__tasks_label_width_dim=\dimen277 +\l__tasks_label_default_width_dim=\dimen278 +\l__tasks_label_offset_dim=\dimen279 +\l__tasks_label_default_offset_dim=\dimen280 +\l__tasks_column_sep_dim=\dimen281 +\l__tasks_after_item_skip=\skip275 +\l__tasks_custom_after_item_skip=\skip276 +\l__tasks_before_list_skip=\skip277 +\l__tasks_after_list_skip=\skip278 +\l__tasks_item_coffin=\box263 +\l__tasks_label_coffin=\box264 +\c@task=\count328 +\l__tasks_tmpa_int=\count329 +\l__tasks_tmpb_int=\count330 +\l__tasks_tmpa_coffin=\box265 +................................................. +. xtemplate info: "declare-object-type" +. +. Declaring object type 'tasks' taking 3 argument(s) on line 377. +................................................. +\l__tasks_choice_width_dim=\dimen282 +\l__tasks_choice_linewidth_dim=\dimen283 +\l__tasks_choice_checkwidth_dim=\dimen284 +\l__tasks_choice_raise_dim=\dimen285 +................................................. +. LaTeX info: "xparse/define-command" +. +. Defining command \startnewitemline with sig. '' on line 670. +................................................. +................................................. +. LaTeX info: "xparse/define-command" +. +. Defining command \NewTasks with sig. 'O{}mO{\task }D(){1}' on line 679. +................................................. +................................................. +. LaTeX info: "xparse/define-command" +. +. Defining command \RenewTasks with sig. 'O{}mO{\task }D(){1}' on line 686. +................................................. +................................................. +. LaTeX info: "xparse/define-environment" +. +. Defining environment 'tasks' with sig. 'O{}D(){1}' on line 694. +................................................. + +(/usr/local/texlive/2015/texmf-dist/tex/latex/tasks/tasks.cfg +File: tasks.cfg 2014/07/29 v0.10a tasks instances +) +................................................. +. LaTeX info: "xparse/define-command" +. +. Defining command \settasks with sig. 'm' on line 710. +................................................. +) +Package hyperref Info: Option `unicode' set `true' on input line 83. (/usr/local/texlive/2015/texmf-dist/tex/latex/hyperref/puenc.def File: puenc.def 2012/11/06 v6.83m Hyperref: PDF Unicode definition (HO) @@ -1092,44 +1232,44 @@ File: puenc.def 2012/11/06 v6.83m Hyperref: PDF Unicode definition (HO) (./romapidoc.aux) \openout1 = romapidoc.aux -LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 84. -LaTeX Font Info: ... okay on input line 84. -LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 84. -LaTeX Font Info: ... okay on input line 84. -LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 84. -LaTeX Font Info: ... okay on input line 84. -LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 84. -LaTeX Font Info: ... okay on input line 84. -LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 84. -LaTeX Font Info: ... okay on input line 84. -LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 84. -LaTeX Font Info: ... okay on input line 84. -LaTeX Font Info: Checking defaults for EU2/lmr/m/n on input line 84. -LaTeX Font Info: ... okay on input line 84. -LaTeX Font Info: Checking defaults for T3/cmr/m/n on input line 84. -LaTeX Font Info: Try loading font information for T3+cmr on input line 84. +LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 87. +LaTeX Font Info: ... okay on input line 87. +LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 87. +LaTeX Font Info: ... okay on input line 87. +LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 87. +LaTeX Font Info: ... okay on input line 87. +LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 87. +LaTeX Font Info: ... okay on input line 87. +LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 87. +LaTeX Font Info: ... okay on input line 87. +LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 87. +LaTeX Font Info: ... okay on input line 87. +LaTeX Font Info: Checking defaults for EU2/lmr/m/n on input line 87. +LaTeX Font Info: ... okay on input line 87. +LaTeX Font Info: Checking defaults for T3/cmr/m/n on input line 87. +LaTeX Font Info: Try loading font information for T3+cmr on input line 87. (/usr/local/texlive/2015/texmf-dist/tex/latex/tipa/t3cmr.fd File: t3cmr.fd 2001/12/31 TIPA font definitions ) -LaTeX Font Info: ... okay on input line 84. -LaTeX Font Info: Checking defaults for PD1/pdf/m/n on input line 84. -LaTeX Font Info: ... okay on input line 84. -LaTeX Font Info: Checking defaults for PU/pdf/m/n on input line 84. -LaTeX Font Info: ... okay on input line 84. +LaTeX Font Info: ... okay on input line 87. +LaTeX Font Info: Checking defaults for PD1/pdf/m/n on input line 87. +LaTeX Font Info: ... okay on input line 87. +LaTeX Font Info: Checking defaults for PU/pdf/m/n on input line 87. +LaTeX Font Info: ... okay on input line 87. (/usr/local/texlive/2015/texmf-dist/tex/context/base/supp-pdf.mkii [Loading MPS to PDF converter (version 2006.09.02).] -\scratchcounter=\count307 -\scratchdimen=\dimen267 -\scratchbox=\box262 -\nofMPsegments=\count308 -\nofMParguments=\count309 -\everyMPshowfont=\toks28 -\MPscratchCnt=\count310 -\MPscratchDim=\dimen268 -\MPnumerator=\count311 -\makeMPintoPDFobject=\count312 -\everyMPtoPDFconversion=\toks29 +\scratchcounter=\count331 +\scratchdimen=\dimen286 +\scratchbox=\box266 +\nofMPsegments=\count332 +\nofMParguments=\count333 +\everyMPshowfont=\toks34 +\MPscratchCnt=\count334 +\MPscratchDim=\dimen287 +\MPnumerator=\count335 +\makeMPintoPDFobject=\count336 +\everyMPtoPDFconversion=\toks35 ) (/usr/local/texlive/2015/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf @@ -1151,64 +1291,64 @@ File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live ................................................. \symlegacymaths=\mathgroup4 LaTeX Font Info: Overwriting symbol font `legacymaths' in version `bold' -(Font) OT1/cmr/m/n --> OT1/cmr/bx/n on input line 84. -LaTeX Font Info: Redeclaring math accent \acute on input line 84. -LaTeX Font Info: Redeclaring math accent \grave on input line 84. -LaTeX Font Info: Redeclaring math accent \ddot on input line 84. -LaTeX Font Info: Redeclaring math accent \tilde on input line 84. -LaTeX Font Info: Redeclaring math accent \bar on input line 84. -LaTeX Font Info: Redeclaring math accent \breve on input line 84. -LaTeX Font Info: Redeclaring math accent \check on input line 84. -LaTeX Font Info: Redeclaring math accent \hat on input line 84. -LaTeX Font Info: Redeclaring math accent \dot on input line 84. -LaTeX Font Info: Redeclaring math accent \mathring on input line 84. -LaTeX Font Info: Redeclaring math symbol \colon on input line 84. -LaTeX Font Info: Redeclaring math symbol \Gamma on input line 84. -LaTeX Font Info: Redeclaring math symbol \Delta on input line 84. -LaTeX Font Info: Redeclaring math symbol \Theta on input line 84. -LaTeX Font Info: Redeclaring math symbol \Lambda on input line 84. -LaTeX Font Info: Redeclaring math symbol \Xi on input line 84. -LaTeX Font Info: Redeclaring math symbol \Pi on input line 84. -LaTeX Font Info: Redeclaring math symbol \Sigma on input line 84. -LaTeX Font Info: Redeclaring math symbol \Upsilon on input line 84. -LaTeX Font Info: Redeclaring math symbol \Phi on input line 84. -LaTeX Font Info: Redeclaring math symbol \Psi on input line 84. -LaTeX Font Info: Redeclaring math symbol \Omega on input line 84. -LaTeX Font Info: Redeclaring math symbol \mathdollar on input line 84. -LaTeX Font Info: Redeclaring symbol font `operators' on input line 84. +(Font) OT1/cmr/m/n --> OT1/cmr/bx/n on input line 87. +LaTeX Font Info: Redeclaring math accent \acute on input line 87. +LaTeX Font Info: Redeclaring math accent \grave on input line 87. +LaTeX Font Info: Redeclaring math accent \ddot on input line 87. +LaTeX Font Info: Redeclaring math accent \tilde on input line 87. +LaTeX Font Info: Redeclaring math accent \bar on input line 87. +LaTeX Font Info: Redeclaring math accent \breve on input line 87. +LaTeX Font Info: Redeclaring math accent \check on input line 87. +LaTeX Font Info: Redeclaring math accent \hat on input line 87. +LaTeX Font Info: Redeclaring math accent \dot on input line 87. +LaTeX Font Info: Redeclaring math accent \mathring on input line 87. +LaTeX Font Info: Redeclaring math symbol \colon on input line 87. +LaTeX Font Info: Redeclaring math symbol \Gamma on input line 87. +LaTeX Font Info: Redeclaring math symbol \Delta on input line 87. +LaTeX Font Info: Redeclaring math symbol \Theta on input line 87. +LaTeX Font Info: Redeclaring math symbol \Lambda on input line 87. +LaTeX Font Info: Redeclaring math symbol \Xi on input line 87. +LaTeX Font Info: Redeclaring math symbol \Pi on input line 87. +LaTeX Font Info: Redeclaring math symbol \Sigma on input line 87. +LaTeX Font Info: Redeclaring math symbol \Upsilon on input line 87. +LaTeX Font Info: Redeclaring math symbol \Phi on input line 87. +LaTeX Font Info: Redeclaring math symbol \Psi on input line 87. +LaTeX Font Info: Redeclaring math symbol \Omega on input line 87. +LaTeX Font Info: Redeclaring math symbol \mathdollar on input line 87. +LaTeX Font Info: Redeclaring symbol font `operators' on input line 87. LaTeX Font Info: Encoding `OT1' has changed to `EU2' for symbol font -(Font) `operators' in the math version `normal' on input line 84. +(Font) `operators' in the math version `normal' on input line 87. LaTeX Font Info: Overwriting symbol font `operators' in version `normal' -(Font) OT1/cmr/m/n --> EU2/MyriadPro(0)/m/n on input line 84. +(Font) OT1/cmr/m/n --> EU2/MyriadPro(0)/m/n on input line 87. LaTeX Font Info: Encoding `OT1' has changed to `EU2' for symbol font -(Font) `operators' in the math version `bold' on input line 84. +(Font) `operators' in the math version `bold' on input line 87. LaTeX Font Info: Overwriting symbol font `operators' in version `bold' -(Font) OT1/cmr/bx/n --> EU2/MyriadPro(0)/m/n on input line 84. +(Font) OT1/cmr/bx/n --> EU2/MyriadPro(0)/m/n on input line 87. LaTeX Font Info: Overwriting symbol font `operators' in version `normal' (Font) EU2/MyriadPro(0)/m/n --> EU2/MyriadPro(0)/m/n on input l -ine 84. +ine 87. LaTeX Font Info: Overwriting math alphabet `\mathit' in version `normal' -(Font) OT1/cmr/m/it --> EU2/MyriadPro(0)/m/it on input line 84. +(Font) OT1/cmr/m/it --> EU2/MyriadPro(0)/m/it on input line 87. LaTeX Font Info: Overwriting math alphabet `\mathbf' in version `normal' -(Font) OT1/cmr/bx/n --> EU2/MyriadPro(0)/bx/n on input line 84. +(Font) OT1/cmr/bx/n --> EU2/MyriadPro(0)/bx/n on input line 87. LaTeX Font Info: Overwriting math alphabet `\mathsf' in version `normal' -(Font) OT1/cmss/m/n --> EU2/lmss/m/n on input line 84. +(Font) OT1/cmss/m/n --> EU2/lmss/m/n on input line 87. LaTeX Font Info: Overwriting math alphabet `\mathtt' in version `normal' -(Font) OT1/cmtt/m/n --> EU2/lmtt/m/n on input line 84. +(Font) OT1/cmtt/m/n --> EU2/lmtt/m/n on input line 87. LaTeX Font Info: Overwriting symbol font `operators' in version `bold' (Font) EU2/MyriadPro(0)/m/n --> EU2/MyriadPro(0)/bx/n on input -line 84. +line 87. LaTeX Font Info: Overwriting math alphabet `\mathit' in version `bold' (Font) OT1/cmr/bx/it --> EU2/MyriadPro(0)/bx/it on input line 8 -4. +7. LaTeX Font Info: Overwriting math alphabet `\mathsf' in version `bold' -(Font) OT1/cmss/bx/n --> EU2/lmss/bx/n on input line 84. +(Font) OT1/cmss/bx/n --> EU2/lmss/bx/n on input line 87. LaTeX Font Info: Overwriting math alphabet `\mathtt' in version `bold' -(Font) OT1/cmtt/m/n --> EU2/lmtt/bx/n on input line 84. -\AtBeginShipoutBox=\box263 -Package hyperref Info: Link coloring OFF on input line 84. +(Font) OT1/cmtt/m/n --> EU2/lmtt/bx/n on input line 87. +\AtBeginShipoutBox=\box267 +Package hyperref Info: Link coloring OFF on input line 87. (/usr/local/texlive/2015/texmf-dist/tex/latex/hyperref/nameref.sty Package: nameref 2012/10/27 v2.43 Cross-referencing by name of section @@ -1216,14 +1356,14 @@ Package: nameref 2012/10/27 v2.43 Cross-referencing by name of section (/usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/gettitlestring.sty Package: gettitlestring 2010/12/03 v1.4 Cleanup title references (HO) ) -\c@section@level=\count313 +\c@section@level=\count337 ) Redoing nameref's sectioning Redoing nameref's label -LaTeX Info: Redefining \nameref on input line 84. -LaTeX Info: Redefining \ref on input line 84. -LaTeX Info: Redefining \pageref on input line 84. -LaTeX Info: Redefining \nameref on input line 84. +LaTeX Info: Redefining \nameref on input line 87. +LaTeX Info: Redefining \ref on input line 87. +LaTeX Info: Redefining \pageref on input line 87. +LaTeX Info: Redefining \nameref on input line 87. (./romapidoc.out) (./romapidoc.out) \@outlinefile=\write4 @@ -1235,11 +1375,11 @@ luaotfload | load : Lookup/name: "MyriadPro" -> "MyriadPro-It.otf" luaotfload | load : Lookup/name: "MyriadPro" -> "MyriadPro-Regular.otf" luaotfload | load : Lookup/name: "MyriadPro" -> "MyriadPro-Regular.otf" LaTeX Font Info: External font `cmex10' loaded for size -(Font) <10.95> on input line 86. +(Font) <10.95> on input line 89. LaTeX Font Info: External font `cmex10' loaded for size -(Font) <8> on input line 86. +(Font) <8> on input line 89. LaTeX Font Info: External font `cmex10' loaded for size -(Font) <6> on input line 86. +(Font) <6> on input line 89. [1 {/usr/local/texlive/2015/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] [2 @@ -1262,218 +1402,295 @@ luaotfload | load : Lookup/name: "MyriadPro" -> "MyriadPro-Regular.otf" luaotfload | load : Lookup/name: "MyriadPro" -> "MyriadPro-Bold.otf" [5] luaotfload | load : Lookup/name: "MyriadPro" -> "MyriadPro-Regular.otf" luaotfload | load : Lookup/name: "MyriadPro" -> "MyriadPro-Bold.otf" +(./api_filesystem.tex luaotfload | load : Lookup/name: "MyriadPro" -> "MyriadPro-Bold.otf" luaotfload | load : Lookup/name: "MyriadPro" -> "MyriadPro-It.otf" -Underfull \hbox (badness 2735) in paragraph at lines 138--138 +Underfull \hbox (badness 2735) in paragraph at lines 40--40 [][]|\EU2/MyriadPro(0)/m/n/10 Moves the di-rec-tory to the [] -Underfull \hbox (badness 1655) in paragraph at lines 138--138 +Underfull \hbox (badness 1655) in paragraph at lines 40--40 \EU2/MyriadPro(0)/m/n/10 des-ti-na-tion. Sub-di-rec-to-ries / [] -Underfull \hbox (badness 2150) in paragraph at lines 138--138 +Underfull \hbox (badness 2150) in paragraph at lines 40--40 [][]|\EU2/MyriadPro(0)/m/n/10 Copies the di-rec-tory to the [] -Underfull \hbox (badness 1655) in paragraph at lines 138--138 +Underfull \hbox (badness 1655) in paragraph at lines 40--40 \EU2/MyriadPro(0)/m/n/10 des-ti-na-tion. Sub-di-rec-to-ries / [] LaTeX Font Info: Font shape `EU2/MyriadPro(0)/m/sl' in size <10> not availabl e (Font) Font shape `EU2/MyriadPro(0)/m/it' tried instead on input li -ne 138. +ne 40. luaotfload | load : Lookup/name: "MyriadPro" -> "MyriadPro-It.otf" luaotfload | load : Lookup/name: "MyriadPro" -> "MyriadPro-It.otf" [6 -] [7] [8] -Underfull \hbox (badness 4792) in paragraph at lines 188--188 +] [7]) [8] (./api_hexutils.tex +Underfull \hbox (badness 4792) in paragraph at lines 10--10 [][]|\EU2/MyriadPro(0)/m/n/10 Con-verts byte ar-ray to the [] -[9 +) [9 -] -Underfull \hbox (badness 3354) in paragraph at lines 212--212 +] (./api_input.tex +Underfull \hbox (badness 1515) in paragraph at lines 12--12 +\EU2/MyriadPro(0)/m/n/10 By com-bin-ing with ‘and’ or ‘or’ + [] + + +Underfull \hbox (badness 3884) in paragraph at lines 12--12 +\EU2/MyriadPro(0)/m/n/10 state-ment, you can in-quire for + [] + +) [10 + +] (./api_keys.tex +Overfull \hbox (3.01012pt too wide) in paragraph at lines 3--4 +[][]\EU2/MyriadPro(0)/m/n/10 Notes on com-pat-i-bil-ity with Com-put-er-Craft: +al-though this li-brary is ComputerCraft- + [] + + +Underfull \hbox (badness 2150) in paragraph at lines 12--12 +[][]|\EU2/MyriadPro(0)/m/n/10 Re-turns key name cor-re-sponds to + [] + + +Overfull \hbox (9.77664pt too wide) in paragraph at lines 72--72 +[]|\EU2/MyriadPro(0)/m/n/10 (\EU2/MyriadPro(0)/m/it/10 zero \EU2/MyriadPro(0)/m +/n/10 to \EU2/MyriadPro(0)/m/it/10 nine\EU2/MyriadPro(0)/m/n/10 )| + [] + + +Overfull \hbox (1.58002pt too wide) in paragraph at lines 72--72 +[]|\EU2/MyriadPro(0)/m/n/10 backspace| + [] + + +Overfull \hbox (2.65999pt too wide) in paragraph at lines 72--72 +[]|\EU2/MyriadPro(0)/m/n/10 leftBracket| + [] + + +Overfull \hbox (9.01001pt too wide) in paragraph at lines 72--72 +[]|\EU2/MyriadPro(0)/m/n/10 rightBracket| + [] + + +Overfull \hbox (2.23003pt too wide) in paragraph at lines 72--72 +[]|\EU2/MyriadPro(0)/m/n/10 semiColon| + [] + + +Overfull \hbox (6.18004pt too wide) in paragraph at lines 72--72 +[]|\EU2/MyriadPro(0)/m/n/10 apostrophe| + [] + + +Overfull \hbox (6.32997pt too wide) in paragraph at lines 72--72 +[]|\EU2/MyriadPro(0)/m/n/10 cimcumflex| + [] + + +Overfull \hbox (5.03001pt too wide) in paragraph at lines 72--72 +[]|\EU2/MyriadPro(0)/m/n/10 underscore| + [] + + +Overfull \hbox (4.14001pt too wide) in paragraph at lines 72--72 +[]|\EU2/MyriadPro(0)/m/n/10 pageDown| + [] + + +Overfull \hbox (15.58pt too wide) in paragraph at lines 72--72 +[]|\EU2/MyriadPro(0)/m/n/10 leftCommand| + [] + +) [11 + +] (./api_security.tex +Underfull \hbox (badness 3354) in paragraph at lines 20--20 [][]|\EU2/MyriadPro(0)/m/n/10 Re-turns SHA-256 hash of in-put [] -Underfull \hbox (badness 4805) in paragraph at lines 212--212 +Underfull \hbox (badness 4805) in paragraph at lines 20--20 [][]|\EU2/MyriadPro(0)/m/n/10 De-codes Base64 string and re- [] -Underfull \hbox (badness 2707) in paragraph at lines 212--212 +Underfull \hbox (badness 2707) in paragraph at lines 20--20 [][]|\EU2/MyriadPro(0)/m/n/10 En-codes in-put string as Base64 [] -[10 +) [12 -] [11 +] (./api_shell.tex) [13 -] -Underfull \hbox (badness 2165) in paragraph at lines 292--292 +] (./api_terminal.tex +Underfull \hbox (badness 2165) in paragraph at lines 66--66 \EU2/MyriadPro(0)/m/n/10 nal. Graphic ter-mi-nals also can [] -Underfull \hbox (badness 2932) in paragraph at lines 292--292 +Underfull \hbox (badness 2932) in paragraph at lines 66--66 [][]|\EU2/MyriadPro(0)/m/n/10 Re-turns \EU2/MyriadPro(0)/bx/n/10 true \EU2/Myri adPro(0)/m/n/10 if the ter-mi-nal is [] -Underfull \hbox (badness 2772) in paragraph at lines 292--292 +Underfull \hbox (badness 2772) in paragraph at lines 66--66 [][]|\EU2/MyriadPro(0)/m/n/10 Emits \EU2/MyriadPro(0)/bx/n/10 c \EU2/MyriadPro( 0)/m/n/10 into (\EU2/MyriadPro(0)/bx/n/10 x\EU2/MyriadPro(0)/m/n/10 , \EU2/Myri adPro(0)/bx/n/10 y\EU2/MyriadPro(0)/m/n/10 ), con-trol se- [] -Underfull \hbox (badness 3118) in paragraph at lines 292--292 +Underfull \hbox (badness 3118) in paragraph at lines 66--66 \EU2/MyriadPro(0)/m/n/10 ing con-trol se-quences as sym- [] -Underfull \hbox (badness 1365) in paragraph at lines 292--292 +Underfull \hbox (badness 1365) in paragraph at lines 66--66 [][]|\EU2/MyriadPro(0)/m/n/10 Clears whole screen buffer and [] -Underfull \hbox (badness 5022) in paragraph at lines 292--292 +Underfull \hbox (badness 5022) in paragraph at lines 66--66 [][]|\EU2/MyriadPro(0)/m/n/10 Re-turns cur-rent co-or-di-nates of [] -Underfull \hbox (badness 10000) in paragraph at lines 292--292 +Underfull \hbox (badness 10000) in paragraph at lines 66--66 [][]|\EU2/MyriadPro(0)/m/n/10 Re-turns cur-rent fore-ground [] -Underfull \hbox (badness 10000) in paragraph at lines 292--292 +Underfull \hbox (badness 10000) in paragraph at lines 66--66 [][]|\EU2/MyriadPro(0)/m/n/10 Re-turns cur-rent back-ground [] -[12 +[14 -] [13] -File: mda.pdf Graphic file (type pdf) - -Package pdftex.def Info: mda.pdf used on input line 310. -(pdftex.def) Requested size: 148.4842pt x 210.0pt. +] [15] +\cpimagew=\skip279 + +File: mda.png Graphic file (type png) + +Package pdftex.def Info: mda.png used on input line 88. +(pdftex.def) Requested size: 295.0pt x 114.69775pt. Underfull \vbox (badness 10000) has occurred while \output is active [] - [14] -Underfull \hbox (badness 6658) in paragraph at lines 331--331 + [16] +Underfull \hbox (badness 6658) in paragraph at lines 109--109 [][]|\EU2/MyriadPro(0)/m/n/10 DEL. Backspace and deletes [] -[15<./mda.pdf>] [16] -Underfull \hbox (badness 1092) in paragraph at lines 352--352 +) [17<./mda.png>] (./luaglobals.tex +Underfull \hbox (badness 1092) in paragraph at lines 14--14 \EU2/MyriadPro(0)/m/n/10 ory in-stalled in the com-puter, in [] -Underfull \hbox (badness 3019) in paragraph at lines 383--383 -[][]|\EU2/MyriadPro(0)/m/n/10 Cur-rency sym-bol used in the world. - [] - - -Underfull \hbox (badness 1888) in paragraph at lines 383--383 +Underfull \hbox (badness 10000) in paragraph at lines 51--51 [][]|\EU2/MyriadPro(0)/m/n/10 Ascii con-trol se-quence DC1. Used to [] -Underfull \hbox (badness 1888) in paragraph at lines 383--383 +Underfull \hbox (badness 10000) in paragraph at lines 51--51 [][]|\EU2/MyriadPro(0)/m/n/10 Ascii con-trol se-quence DC2. Used to [] -Underfull \hbox (badness 1888) in paragraph at lines 383--383 +Underfull \hbox (badness 10000) in paragraph at lines 51--51 [][]|\EU2/MyriadPro(0)/m/n/10 Ascii con-trol se-quence DC3. Used to [] -Underfull \hbox (badness 1888) in paragraph at lines 383--383 +Underfull \hbox (badness 10000) in paragraph at lines 51--51 [][]|\EU2/MyriadPro(0)/m/n/10 Ascii con-trol se-quence DC4. Used to [] -Underfull \hbox (badness 4713) in paragraph at lines 383--383 -\EU2/MyriadPro(0)/m/n/10 change fore-ground colour to bright - [] - - -Underfull \hbox (badness 2478) in paragraph at lines 383--383 +Underfull \hbox (badness 10000) in paragraph at lines 51--51 [][]|\EU2/MyriadPro(0)/m/n/10 Ascii con-trol se-quence DLE. Used to [] -[17 -] [18] -luaotfload | load : Lookup/name: "MyriadPro" -> "MyriadPro-Bold.otf" [19 +Underfull \hbox (badness 2781) in paragraph at lines 51--51 +\EU2/MyriadPro(0)/m/n/10 change fore-ground colour to ter-mi-nal’s + [] -] [20 +[18 + +]) [19] (./luadifferences.tex) [20 + +] +luaotfload | load : Lookup/name: "MyriadPro" -> "MyriadPro-Bold.otf" [21 + +] (./cc_bit.tex) [22 -] [21 - -] [22 - -] [23 +] +(./cc_colors.tex) [23 ] [24 -] [25] [26 +] [25 +] [26 ] [27] [28 -] [29 +] [29] (./peri_lp.tex) [30 -] [30 -] [31 +] +[31 + +] [32 + +] [33 ] \tf@toc=\write5 \openout5 = romapidoc.toc -Package atveryend Info: Empty hook `BeforeClearDocument' on input line 480. -Package atveryend Info: Empty hook `AfterLastShipout' on input line 480. - -(./romapidoc.aux) -Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 480. -Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 480. +Package atveryend Info: Empty hook `BeforeClearDocument' on input line 165. +Package atveryend Info: Empty hook `AfterLastShipout' on input line 165. + (./romapidoc.aux) +Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 165. +Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 165. Package rerunfilecheck Info: File `romapidoc.out' has not changed. -(rerunfilecheck) Checksum: 03D8004877E474961620BACB7D2C8DE2;1800. -Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line 480. +(rerunfilecheck) Checksum: A4B98F6CE220B3C970CC4D5ECA7A4CF8;2202. +Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line 165. ) Here is how much of LuaTeX's memory you used: - 25439 strings out of 494693 - 125006,552014 words of node,token memory allocated - 724 words of node memory still in use: - 3 hlist, 1 vlist, 1 rule, 2 glue, 1 kern, 5 attribute, 140 glue_spec, 5 attri + 27266 strings out of 494693 + 125070,662416 words of node,token memory allocated + 778 words of node memory still in use: + 3 hlist, 1 vlist, 1 rule, 2 glue, 1 kern, 5 attribute, 141 glue_spec, 5 attri bute_list, 2 write nodes - avail lists: 2:14425,3:272,4:3580,5:1297,6:6112,7:343,8:18,9:884,10:384 - 28550 multiletter control sequences out of 65536+600000 + avail lists: 2:14493,3:271,4:3580,5:1301,6:6145,7:343,8:21,9:884,10:390 + 30200 multiletter control sequences out of 65536+600000 62 fonts using 5300671 bytes - 55i,12n,59p,1189b,492s stack positions out of 5000i,500n,10000p,200000b,100000s + 67i,12n,59p,1189b,492s stack positions out of 5000i,500n,10000p,200000b,100000s -Output written on romapidoc.pdf (31 pages, 201848 bytes). +Output written on romapidoc.pdf (33 pages, 95180 bytes). -PDF statistics: 281 PDF objects out of 1000 (max. 8388607) - 235 compressed objects within 3 object streams - 76 named destinations out of 1000 (max. 131072) - 129 words of extra memory for PDF output out of 10000 (max. 10000000) +PDF statistics: 304 PDF objects out of 1000 (max. 8388607) + 255 compressed objects within 3 object streams + 85 named destinations out of 1000 (max. 131072) + 153 words of extra memory for PDF output out of 10000 (max. 10000000) diff --git a/work_files/romapidoc/romapidoc.out b/work_files/romapidoc/romapidoc.out index ec6448c43..250544f30 100644 --- a/work_files/romapidoc/romapidoc.out +++ b/work_files/romapidoc/romapidoc.out @@ -1,16 +1,19 @@ \BOOKMARK [0][-]{chapter.1}{\376\377\000A\000P\000I\000s\000\040\000a\000n\000d\000\040\000L\000i\000b\000r\000a\000r\000i\000e\000s}{}% 1 \BOOKMARK [1][-]{section.1.1}{\376\377\000F\000i\000l\000e\000s\000y\000s\000t\000e\000m}{chapter.1}% 2 \BOOKMARK [1][-]{section.1.2}{\376\377\000H\000e\000x\000u\000t\000i\000l\000s}{chapter.1}% 3 -\BOOKMARK [1][-]{section.1.3}{\376\377\000S\000e\000c\000u\000r\000i\000t\000y}{chapter.1}% 4 -\BOOKMARK [1][-]{section.1.4}{\376\377\000S\000h\000e\000l\000l}{chapter.1}% 5 -\BOOKMARK [1][-]{section.1.5}{\376\377\000T\000e\000r\000m\000i\000n\000a\000l}{chapter.1}% 6 -\BOOKMARK [1][-]{section.1.6}{\376\377\000L\000u\000a\000\040\000G\000l\000o\000b\000a\000l\000s}{chapter.1}% 7 -\BOOKMARK [0][-]{chapter.2}{\376\377\000C\000o\000m\000p\000a\000t\000i\000b\000i\000l\000i\000t\000y\000\040\000L\000a\000y\000e\000r\000s\040\024\000C\000o\000m\000p\000u\000t\000e\000r\000C\000r\000a\000f\000t}{}% 8 -\BOOKMARK [1][-]{section.2.1}{\376\377\000B\000i\000t}{chapter.2}% 9 -\BOOKMARK [1][-]{section.2.2}{\376\377\000C\000o\000l\000o\000r\000s}{chapter.2}% 10 -\BOOKMARK [1][-]{section.2.3}{\376\377\000T\000e\000r\000m}{chapter.2}% 11 -\BOOKMARK [1][-]{section.2.4}{\376\377\000F\000i\000l\000e\000s\000y\000s\000t\000e\000m}{chapter.2}% 12 -\BOOKMARK [0][-]{chapter.3}{\376\377\000C\000o\000m\000p\000a\000t\000i\000b\000i\000l\000i\000t\000y\000\040\000L\000a\000y\000e\000r\000s\040\024\000O\000p\000e\000n\000C\000o\000m\000p\000u\000t\000e\000r\000s}{}% 13 -\BOOKMARK [0][-]{chapter.4}{\376\377\000P\000e\000r\000i\000p\000h\000e\000r\000a\000l\000s}{}% 14 -\BOOKMARK [1][-]{section.4.1}{\376\377\000L\000i\000n\000e\000\040\000P\000r\000i\000n\000t\000e\000r}{chapter.4}% 15 -\BOOKMARK [0][-]{chapter.5}{\376\377\000R\000e\000f\000e\000r\000e\000n\000c\000e\000s}{}% 16 +\BOOKMARK [1][-]{section.1.3}{\376\377\000I\000n\000p\000u\000t}{chapter.1}% 4 +\BOOKMARK [1][-]{section.1.4}{\376\377\000K\000e\000y\000s}{chapter.1}% 5 +\BOOKMARK [1][-]{section.1.5}{\376\377\000S\000e\000c\000u\000r\000i\000t\000y}{chapter.1}% 6 +\BOOKMARK [1][-]{section.1.6}{\376\377\000S\000h\000e\000l\000l}{chapter.1}% 7 +\BOOKMARK [1][-]{section.1.7}{\376\377\000T\000e\000r\000m\000i\000n\000a\000l}{chapter.1}% 8 +\BOOKMARK [1][-]{section.1.8}{\376\377\000L\000u\000a\000\040\000G\000l\000o\000b\000a\000l\000s}{chapter.1}% 9 +\BOOKMARK [1][-]{section.1.9}{\376\377\000C\000h\000a\000n\000g\000e\000s\000\040\000f\000r\000o\000m\000\040\000G\000e\000n\000e\000r\000i\000c\000\040\000L\000u\000a\000\040\000E\000n\000v\000i\000r\000o\000n\000m\000e\000n\000t}{chapter.1}% 10 +\BOOKMARK [0][-]{chapter.2}{\376\377\000C\000o\000m\000p\000a\000t\000i\000b\000i\000l\000i\000t\000y\000\040\000L\000a\000y\000e\000r\000s\040\024\000C\000o\000m\000p\000u\000t\000e\000r\000C\000r\000a\000f\000t}{}% 11 +\BOOKMARK [1][-]{section.2.1}{\376\377\000B\000i\000t}{chapter.2}% 12 +\BOOKMARK [1][-]{section.2.2}{\376\377\000C\000o\000l\000o\000r\000s}{chapter.2}% 13 +\BOOKMARK [1][-]{section.2.3}{\376\377\000T\000e\000r\000m}{chapter.2}% 14 +\BOOKMARK [1][-]{section.2.4}{\376\377\000F\000i\000l\000e\000s\000y\000s\000t\000e\000m}{chapter.2}% 15 +\BOOKMARK [0][-]{chapter.3}{\376\377\000C\000o\000m\000p\000a\000t\000i\000b\000i\000l\000i\000t\000y\000\040\000L\000a\000y\000e\000r\000s\040\024\000O\000p\000e\000n\000C\000o\000m\000p\000u\000t\000e\000r\000s}{}% 16 +\BOOKMARK [0][-]{chapter.4}{\376\377\000P\000e\000r\000i\000p\000h\000e\000r\000a\000l\000s}{}% 17 +\BOOKMARK [1][-]{section.4.1}{\376\377\000L\000i\000n\000e\000\040\000P\000r\000i\000n\000t\000e\000r}{chapter.4}% 18 +\BOOKMARK [0][-]{chapter.5}{\376\377\000R\000e\000f\000e\000r\000e\000n\000c\000e\000s}{}% 19 diff --git a/work_files/romapidoc/romapidoc.pdf b/work_files/romapidoc/romapidoc.pdf index 65a31bb8e..1187dcc07 100644 Binary files a/work_files/romapidoc/romapidoc.pdf and b/work_files/romapidoc/romapidoc.pdf differ diff --git a/work_files/romapidoc/romapidoc.synctex.gz b/work_files/romapidoc/romapidoc.synctex.gz index 3621208d3..1c4b58d11 100644 Binary files a/work_files/romapidoc/romapidoc.synctex.gz and b/work_files/romapidoc/romapidoc.synctex.gz differ diff --git a/work_files/romapidoc/romapidoc.tex b/work_files/romapidoc/romapidoc.tex index dcff857cc..dc61f0964 100644 --- a/work_files/romapidoc/romapidoc.tex +++ b/work_files/romapidoc/romapidoc.tex @@ -15,6 +15,7 @@ \usepackage{ltablex} \usepackage{parskip} +\usepackage{tasks} \frenchspacing \setlength{\parindent}{0pt} @@ -22,7 +23,9 @@ \setsecnumdepth{subsection} - +%% Idioms %% +\hyphenation{Com-put-er-Craft} +\hyphenation{O-pen-Com-put-ers} @@ -95,349 +98,47 @@ \chapter{APIs and Libraries} \section{Filesystem} - -The Filesystem API provides functions for manipulating files and the filesystem. - -The path for the argument of functions blocks `\,.\,.\,' to be entered, preventing users from access outside of the computer and eliminating the potential of harming the real computer of the innocent players. - -\subsection{Functions} - -\begin{tabularx}{\textwidth}{l l X} - \textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description} - \\ \\ - \endhead - fs.list(\textbf{path}: string) & table & Returns list of files in \textbf{path}, in lua table. - \\ \\ - fs.exists(\textbf{path}: string) & bool & Checks if \textbf{path} exists on the filesystem. - \\ \\ - fs.isDir(\textbf{path}: string) & bool & Checks if \textbf{path} is a directory. - \\ \\ - fs.isFile(\textbf{path}: string) & bool & Checks if \textbf{path} is a file. - \\ \\ - fs.isReadOnly(\textbf{path}: string) & bool & Checks if \textbf{path} is read only. - \\ \\ - fs.getSize(\textbf{path}: string) & int & Returns a size of the file/directory, in bytes. - \\ \\ - fs.mkdir(\textbf{path}: string) & bool & Create a directory to \textbf{path}. Returns \textbf{true} upon success. - \\ \\ - fs.mv(\textbf{from}: string, \textbf{dest}: string) & bool & Moves the directory to the destination. Subdirectories / files will also be moved. Returns \textbf{true} upon success. - \\ \\ - fs.cp(\textbf{from}: string, \textbf{dest}: string) & bool & Copies the directory to the destination. Subdirectories / files will also be copied. Returns \textbf{true} upon success. - \\ \\ - fs.rm(\textbf{path}: string) & bool & Deletes the \textbf{path}. If \textbf{path} is a directory, all its members will also be deleted. Returns \textbf{true} upon success. - \\ \\ - fs.concat(\textbf{p1}: string, \textbf{p2}: string) & string & Concatenates two paths and return new path as string. - \\ \\ - fs.open(\textbf{path}: string, \textbf{mode}: string) & file & Opens file and returns its handle. See section \emph{File Handler} for details. - \\ \\ - fs.parent(\textbf{path}: string) & string & Returs parent directory to the \textbf{path}. - \\ \\ - fs.dofile(\textbf{path}: string) & nil & Loads the script on \textbf{path} and executes it. - \\ \\ - fs.fetchText(\textbf{path}: string) & string & Opens the file on \textbf{path} and returns its contents as a plain text. -\end{tabularx} - -\subsection{File Handler} - -When it comes to opening a file, there are six modes available---r, w, a, rb, wb, ab, each represents \textbf{r}ead, \textbf{w}rite, \textbf{a}ppend and \textbf{b}yte. - -\begin{tabularx}{\textwidth}{l X} - \textbf{\large Function} & \textbf{\large Description} - \\ \\ - \endhead - file.close() & Closes the file. Any data wrote will be actually wrote to disk when this function is called. - \\ \\ - file.flush() & (in write/append mode) Flushes the data to the file, keeps the handle available afterwards - \\ \\ - \multicolumn{2}{c}{\textbf{Read mode}} - \\ \\ - file.readLine() & Reads text from the file line by line. Returns string of line, or \emph{nil} if there is no next line. - \\ \\ - file.readAll() & Reads and returns whole text in the file as string. - \\ \\ - \multicolumn{2}{c}{\textbf{Read binary mode}} - \\ \\ - file.read() & Reads single byte in the file as int, or \emph{-1} if end-of-file is reached. - \\ \\ - file.readAll() & Reads and returns whole byte in the file as string. - \\ \\ - \multicolumn{2}{c}{\textbf{Write/append mode}} - \\ \\ - file.write(string) & Writes \textbf{string} to the file. - \\ \\ - file.writeLine(string) & Writes \textbf{string} to the file and append line feed. - \\ \\ - \multicolumn{2}{c}{\textbf{Write/append binary mode}} - \\ \\ - file.write(int) & Writes \textbf{int} to the file. - \\ \\ - file.writeBytes(string) & Writes \textbf{string} to the file and append line feed. -\end{tabularx} +\input{api_filesystem} \section{Hexutils} +\input{api_hexutils} -The Hexutils library provides utility to convert byte value to hexadecimal string. - -\subsection{Functions} - -\begin{tabularx}{\textwidth}{l l X} - \textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description} - \\ \\ - \endhead - hexutils.toHexString(\textbf{bytes}: string) & string & Converts byte array to the string of its hexadecimal representations. -\end{tabularx} +\section{Input} +\input{api_input} +\section{Keys} +\input{api_keys} \section{Security} - -The Serurity API provides functions for security purposes, such as hashing and CSPRNG\footnote{Cryptographically secure psuedo-random number generator}. - -\subsection{Functions} - -\begin{tabularx}{\textwidth}{l l X} - \textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description} - \\ \\ - \endhead - security.toSHA1(string) & string & Returns SHA-256 hash of input string in array of bytes (as a string) - \\ \\ - security.toSHA256(string) & string & Returns SHA-1 hash of input string in array of bytes - \\ \\ - security.toMD5(string) & string & Returns MD-5 hash of input string in array of bytes - \\ \\ - security.randomBytes(\textbf{len}: int) & string & Returns byte array of random values in desired \textbf{len}gth. - \\ \\ - security.decodeBase64(string) & string & Decodes Base64 string and returns the result as string. - \\ \\ - security.encodeBase64(string) & string & Encodes input string as Base64 format and returns the result as array of bytes. -\end{tabularx} +\input{api_security} \section{Shell} - - - -\begin{tabularx}{\textwidth}{l l X} - \textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description} - \\ \\ - \endhead - shell.run(\textbf{path}: string) & nil & Loads the script on \textbf{path} and executes it. -\end{tabularx} +\input{api_shell} \section{Terminal} - -The Terminal API provides functions for sending text to the terminals, and drawing text-mode graphics. The API expects connected terminal to use Codepage 437. See section \emph{Codepage} for details. - -\subsection{Functions} - -Note: cursor coordinates starts from one, not zero. - -\begin{tabularx}{\textwidth}{l l X} - \textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description} - \\ \\ - \endhead - term.write(string) & nil & Writes string to the current cursor position. Line feed is not appended. - \\ \\ - term.print(string) & nil & Writes string to the current cursor position and make a new line. - \\ \\ - term.newLine() & nil & Make a new line. - \\ \\ - term.moveCursor(\textbf{x}: int) & nil & Moves cursor horizontally, starting from 1. - \\ \\ - term.width() & int & Returns the width of the terminal. Graphic terminals also can use this. - \\ \\ - term.scroll(\textbf{n}: int) & nil & Make a new line \textbf{n} times. - \\ \\ - term.isTeletype() & bool & Returns \textbf{true} if the terminal is teletype. - \\ \\ - \multicolumn{3}{c}{\textbf{Graphic terminals only}} - \\ \\ - term.emit(\textbf{c}: int, \textbf{x}: int, \textbf{y}: int) & nil & Emits \textbf{c} into (\textbf{x}, \textbf{y}), control sequence will not be processed and printed as symbols instead. Cursor will not be moved. - \\ \\ - term.emitRaw(\textbf{bufferChar}: int) & nil & Emits \textbf{bufferChar} into into (\textbf{x}, \textbf{y}). Buffer char means a single character actually stored into the screen buffer, has four bits for back- and foreground colours respectively, and eight bits for a letter. - \\ \\ - term.emitString(\textbf{s}, \textbf{x}: int, \textbf{y}: int) & nil & Emits \textbf{s} (a string) into (\textbf{x}, \textbf{y}), printing control sequences as symbols. Cursor will not be moved. - \\ \\ - \begin{tabular}[t]{@{}l@{}}term.resetColour()\\term.resetColor()\end{tabular} & nil & Resets any colour changes to the defaults. - \\ \\ - term.clear() & nil & Clears whole screen buffer and move cursor to (1, 1) - \\ \\ - term.clearLine() & nil & Clears current line on the screen buffer, does not moves cursor. - \\ \\ - term.setCursor(\textbf{x}: int, \textbf{y}: int) & nil & Moves cursor to (\textbf{x}, \textbf{y}) - \\ \\ - term.getCursor() & int, int & Returns current coordinates of the cursor. - \\ \\ - term.getX() & int & Returns X coordinate of the cursor. - \\ \\ - term.getY() & int & Returns Y coordinate of the cursor. - \\ \\ - term.setX(int) & nil & Sets X coordinate of the cursor. - \\ \\ - term.setY(int) & nil & Sets Y coordinate of the cursor. - \\ \\ - term.setCursorBlink(bool) & nil & Sets cursor blinking. \textbf{true} makes the cursor blink. - \\ \\ - term.size() & int, int & Returns width and height of the terminal. - \\ \\ - term.height() & int & Returns height of the terminal. - \\ \\ - term.isCol() & bool & Returns if the terminal supports colour. - \\ \\ - term.setForeCol(\textbf{col}: int) & nil & Sets foreground colour to \textbf{col} - \\ \\ - term.setBackCol(\textbf{col}: int) & nil & Sets background colour to \textbf{col}. - \\ \\ - term.foreCol() & int & Returns current foreground colour. - \\ \\ - term.backCol() & int & Returns current background colour. -\end{tabularx} - -\subsection{Standard Colours} - -\begin{tabularx}{\textwidth}{c l c l c l c l} - 0 & \textcolor{black}{Black} & 1 & White & 2 & \textcolor{dimgrey}{Dim grey} & 3 & \textcolor{brightgrey}{Bright grey} - \\ \\ - 4 & \textcolor{yellow}{Yellow} & 5 & \textcolor{orange}{Orange} & 6 & \textcolor{red}{Red} & 7 & \textcolor{magenta}{Magenta} - \\ \\ - 8 & \textcolor{purple}{Purple} & 9 & \textcolor{blue}{Blue} & 10 & \textcolor{cyan}{Cyan} & 11 & \textcolor{lime}{Lime} - \\ \\ - 12 & \textcolor{green}{Green} & 13 & \textcolor{darkgreen}{Dark green} & 14 & \textcolor{brown}{Brown} & 15 & \textcolor{tan}{Tan} -\end{tabularx} - -Non-colour terminals support colour index of 0--3. - -\subsection{Codepage} - -{\center\includegraphics[height=21em]{mda.pdf}} - -Character 0x9D (currency symbol) and 0xFA (middle dot) can be accessed with following Lua constants: \emph{MONEYSYM} and \emph{MIDDOT}. - -\subsection{Accepted Control Sequences} - -\begin{tabularx}{\textwidth}{c X c X} - \textbf{\large No.} & \textbf{\large Description} & \textbf{\large No.} & \textbf{\large Description} - \\ \\ - \endhead - 7 & BEL. Emits short beep. & 8 & BS. Moves cursor to left 1 character. - \\ \\ - 9 & TAB. Inserts appropriate horizontal space. Tab size is variable. & 10 & LF. Prints a new line. - \\ \\ - 12 & FF. Clears everything in screen buffer and moves cursor to (1, 1) & 13 & CR. Moves x coordinate of cursor to 1. - \\ \\ - 16 & DLE. Sets foreground colour to the default STDERR colour. & 127 & DEL. Backspace and deletes one character. - \\ \\ - 17 & DC1. Sets foreground colour to 0. (black) & 18 & DC2. Sets foreground colour to 1. (white) - \\ \\ - 19 & DC3. Sets foreground colour to 2. (dim grey) & 20 & DC4. Sets foreground colour to 3. (bright grey) -\end{tabularx} - - +\input{api_terminal} \section{Lua Globals} +\input{luaglobals} -ROMBASIC adds global functions and constants for operability. - -\subsection{Functions} - -\begin{tabularx}{\textwidth}{l l X} - \textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description} - \\ \\ - \endhead - \unemph{\_G.}runScript(\textbf{fun}: str, \textbf{env}: str) & nil & Runs Lua script \textbf{fun} with the environment tag \textbf{env}. - \\ \\ - \unemph{\_G.}getMem() & int & Returns the current memory usage in bytes. - \\ \\ - \unemph{\_G.}getTotalMem() & int & Returns the total size of the memory installed in the computer, in bytes. - \\ \\ - \unemph{\_G.}getFreeMem() & int & Returns the amount of free memory on the computer. -\end{tabularx} - -\subsection{Constants} - -\begin{tabularx}{\textwidth}{l l X} - \textbf{\large Name} & \textbf{\large Type} & \textbf{\large Description} - \\ \\ - \endhead - \unemph{\_G.}MONEYSYM & string & Currency symbol used in the world. Code 0x9D - \\ \\ - \unemph{\_G.}MIDDOT & string & Middle dot used in typography. Code 0xFA (note: 0xF9 is a Dot Product used in Mathematics) - \\ \\ - \unemph{\_G.}DC1 & string & Ascii control sequence DC1. Used to change foreground colour to black. - \\ \\ - \unemph{\_G.}DC2 & string & Ascii control sequence DC2. Used to change foreground colour to white. - \\ \\ - \unemph{\_G.}DC3 & string & Ascii control sequence DC3. Used to change foreground colour to dim grey. - \\ \\ - \unemph{\_G.}DC4 & string & Ascii control sequence DC4. Used to change foreground colour to bright grey. - \\ \\ - \unemph{\_G.}DLE & string & Ascii control sequence DLE. Used to change foreground colour to terminal's default error text colour. - \\ \\ - \_COMPUTER.prompt & string & Default text for prompt input indicator. - \\ \\ - \_COMPUTER.verbose & bool & Sets whether print debug information to the console. - \\ \\ - \_COMPUTER.loadedCLayer & table & List of names of compatibility layers has been loaded. - \\ \\ - \_COMPUTER.bootloader & string & Path to the boot file. Should point to the EFI (/boot/efi). - \\ \\ - \_COMPUTER.OEM & string & Manufacturer of the computer. If you \emph{are} a manufacturer, you may want to fill in this variable with your own company's name. -\end{tabularx} +\section{Changes from Generic Lua Environment} +\input{luadifferences} \chapter[Compatibility Layers---ComputerCraft]{{\LARGE Compatibility Layers} \\ ComputerCraft} \section{Bit} - -The Bit API is for manipulating numbers using bitwise binary operations. The ROMBASIC already comes with Lua's bit32 library so make sure to use that for your casual usage. - -\subsection{Functions} - -\begin{tabularx}{\textwidth}{l X} - \textbf{\large Function} & \textbf{\large Notes} - \\ \\ - \endhead - bit.blshift(n, bits) & Alias of bit32.lshift(n, bits) - \\ \\ - bit.brshift(n, bits) & Alias of bit32.arshift(n, bits) - \\ \\ - bit.blogic\_rshift(n, bits) & Alias of bit32.brshift(n, bits) - \\ \\ - bit.bxor(m, n) & Alias of bit32.bxor(m, n) - \\ \\ - bit.bor(m, n) & Alias of bit32.bor(m, n) - \\ \\ - bit.band(m, n) & Alias of bit32.band(m, n) - \\ \\ - bit.bnot(n) & Alias of bit32.bnot(n) -\end{tabularx} +\input{cc_bit} \section{Colors} - -The Colors API allows you to manipulate sets of colors. This is useful in colors on Advanced Computers and Advanced Monitors. British spellings are also supported. - -\subsection{Constants} - -When the colours are used in ComputerCraft's Term API, nearest console colours will be used. Below is the table of colours coded with their substitutions. - -\begin{tabularx}{\textwidth}{l l l l} - colors.white & colors.\textcolor{orange}{orange} & colors.\textcolor{magenta}{magenta} & colors.\textcolor{cyan}{lightBlue} - \\ \\ - colors.\textcolor{yellow}{yellow} & colors.\textcolor{lime}{lime} & colors.\textcolor{tan}{pink} & colors.\textcolor{dimgrey}{gray} - \\ \\ - colors.\textcolor{brightgrey}{lightGray} & colors.\textcolor{cyan}{cyan} & colors.\textcolor{purple}{purple} & colors.\textcolor{blue}{blue} - \\ \\ - colors.\textcolor{brown}{brown} & colors.\textcolor{green}{green} & colors.\textcolor{red}{red} & colors.\textcolor{black}{black} -\end{tabularx} - -Note that pink is understood as \textcolor{tan}{tan} when it is used, lightBlue and cyan are merged to \textcolor{cyan}{cyan}. - -\subsection{Functions} - -All three functions are not supported, as there is no bundled cable thus there is no use of them. +\input{cc_colors} \section{Term} \section{Filesystem} + + \chapter[Compatibility Layers---OpenComputers]{{\LARGE Compatibility Layers} \\ OpenComputers} @@ -445,25 +146,9 @@ All three functions are not supported, as there is no bundled cable thus there i \chapter{Peripherals} \section{Line Printer} +\input{peri_lp} -The line printer is a printer that operates on line basis. It only prints text in line-by-line, hence the name, on almost endlessly long roll of papers; it has no notion of page, it just prints. If you want some pages to keep, you must tear them out yourself. -Line printers do not work indefinitely; ignoring the obvious depletion of ink, belt for loading paper will be out of service on about 50 000 lines of printing, give or take a few, or paper will jam if the printer had struck with the unluckiness. - -\subsection{Functions} - -\begin{tabularx}{\textwidth}{l l X} - \textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description} - \\ \\ - \endhead - lp.print(string) & nil & Prints a line of string. - \\ \\ - lp.scroll(\textbf{n}: int) & nil & Scrolls the paper by \textbf{n} lines. - \\ \\ - lp.status() & int & Returns a status of the line printer. - \\ \\ - lp.reset() & nil & Resets the line printer. -\end{tabularx} \chapter{References} diff --git a/work_files/romapidoc/romapidoc.toc b/work_files/romapidoc/romapidoc.toc index 8a92154ac..97f21936c 100644 --- a/work_files/romapidoc/romapidoc.toc +++ b/work_files/romapidoc/romapidoc.toc @@ -4,27 +4,32 @@ \contentsline {subsection}{\numberline {1.1.2}File Handler}{7}{subsection.1.1.2} \contentsline {section}{\numberline {1.2}Hexutils}{9}{section.1.2} \contentsline {subsection}{\numberline {1.2.1}Functions}{9}{subsection.1.2.1} -\contentsline {section}{\numberline {1.3}Security}{10}{section.1.3} +\contentsline {section}{\numberline {1.3}Input}{10}{section.1.3} \contentsline {subsection}{\numberline {1.3.1}Functions}{10}{subsection.1.3.1} -\contentsline {section}{\numberline {1.4}Shell}{11}{section.1.4} -\contentsline {section}{\numberline {1.5}Terminal}{12}{section.1.5} +\contentsline {section}{\numberline {1.4}Keys}{11}{section.1.4} +\contentsline {subsection}{\numberline {1.4.1}Accepted Key Names}{11}{subsection.1.4.1} +\contentsline {section}{\numberline {1.5}Security}{12}{section.1.5} \contentsline {subsection}{\numberline {1.5.1}Functions}{12}{subsection.1.5.1} -\contentsline {subsection}{\numberline {1.5.2}Standard Colours}{14}{subsection.1.5.2} -\contentsline {subsection}{\numberline {1.5.3}Codepage}{15}{subsection.1.5.3} -\contentsline {subsection}{\numberline {1.5.4}Accepted Control Sequences}{15}{subsection.1.5.4} -\contentsline {section}{\numberline {1.6}Lua Globals}{17}{section.1.6} -\contentsline {subsection}{\numberline {1.6.1}Functions}{17}{subsection.1.6.1} -\contentsline {subsection}{\numberline {1.6.2}Constants}{17}{subsection.1.6.2} -\contentsline {chapter}{\chapternumberline {2}Compatibility Layers---ComputerCraft}{19}{chapter.2} -\contentsline {section}{\numberline {2.1}Bit}{20}{section.2.1} -\contentsline {subsection}{\numberline {2.1.1}Functions}{20}{subsection.2.1.1} -\contentsline {section}{\numberline {2.2}Colors}{21}{section.2.2} -\contentsline {subsection}{\numberline {2.2.1}Constants}{21}{subsection.2.2.1} -\contentsline {subsection}{\numberline {2.2.2}Functions}{21}{subsection.2.2.2} -\contentsline {section}{\numberline {2.3}Term}{22}{section.2.3} -\contentsline {section}{\numberline {2.4}Filesystem}{23}{section.2.4} -\contentsline {chapter}{\chapternumberline {3}Compatibility Layers---OpenComputers}{25}{chapter.3} -\contentsline {chapter}{\chapternumberline {4}Peripherals}{27}{chapter.4} -\contentsline {section}{\numberline {4.1}Line Printer}{28}{section.4.1} -\contentsline {subsection}{\numberline {4.1.1}Functions}{28}{subsection.4.1.1} -\contentsline {chapter}{\chapternumberline {5}References}{29}{chapter.5} +\contentsline {section}{\numberline {1.6}Shell}{13}{section.1.6} +\contentsline {section}{\numberline {1.7}Terminal}{14}{section.1.7} +\contentsline {subsection}{\numberline {1.7.1}Functions}{14}{subsection.1.7.1} +\contentsline {subsection}{\numberline {1.7.2}Standard Colours}{16}{subsection.1.7.2} +\contentsline {subsection}{\numberline {1.7.3}Codepage}{17}{subsection.1.7.3} +\contentsline {subsection}{\numberline {1.7.4}Accepted Control Sequences}{17}{subsection.1.7.4} +\contentsline {section}{\numberline {1.8}Lua Globals}{18}{section.1.8} +\contentsline {subsection}{\numberline {1.8.1}Functions}{18}{subsection.1.8.1} +\contentsline {subsection}{\numberline {1.8.2}Constants}{18}{subsection.1.8.2} +\contentsline {section}{\numberline {1.9}Changes from Generic Lua Environment}{20}{section.1.9} +\contentsline {chapter}{\chapternumberline {2}Compatibility Layers---ComputerCraft}{21}{chapter.2} +\contentsline {section}{\numberline {2.1}Bit}{22}{section.2.1} +\contentsline {subsection}{\numberline {2.1.1}Functions}{22}{subsection.2.1.1} +\contentsline {section}{\numberline {2.2}Colors}{23}{section.2.2} +\contentsline {subsection}{\numberline {2.2.1}Constants}{23}{subsection.2.2.1} +\contentsline {subsection}{\numberline {2.2.2}Functions}{23}{subsection.2.2.2} +\contentsline {section}{\numberline {2.3}Term}{24}{section.2.3} +\contentsline {section}{\numberline {2.4}Filesystem}{25}{section.2.4} +\contentsline {chapter}{\chapternumberline {3}Compatibility Layers---OpenComputers}{27}{chapter.3} +\contentsline {chapter}{\chapternumberline {4}Peripherals}{29}{chapter.4} +\contentsline {section}{\numberline {4.1}Line Printer}{30}{section.4.1} +\contentsline {subsection}{\numberline {4.1.1}Functions}{30}{subsection.4.1.1} +\contentsline {chapter}{\chapternumberline {5}References}{31}{chapter.5}