OS library implementation

Former-commit-id: b4f7f283080ead5e92c273015bfe2559cbe99e47
Former-commit-id: adaa0af80068a916e534f677f6e5ffe1f3072241
This commit is contained in:
Song Minjae
2016-09-29 00:21:42 +09:00
parent db8e46e5c2
commit ae114c53e0
32 changed files with 551 additions and 507 deletions

View File

@@ -93,6 +93,8 @@ constructor() : BasicGameState() {
@Throws(SlickException::class)
override fun init(gameContainer: GameContainer, stateBasedGame: StateBasedGame) {
// state init code. Executed before the game goes into any "state" in states in StateBasedGame.java
Terrarum.gameStarted = true
}
override fun enter(gc: GameContainer, sbg: StateBasedGame) {

View File

@@ -21,7 +21,8 @@ class StateVTTest : BasicGameState() {
// HiRes: 100x64, LoRes: 80x25
val computerInside = BaseTerrarumComputer()
val vt = SimpleTextTerminal(SimpleTextTerminal.BLUE_NOVELTY, 80, 25, computerInside, colour = false, hires = false)
val vt = SimpleTextTerminal(SimpleTextTerminal.WHITE, 80, 25,
computerInside, colour = false, hires = false)
val vtUI = Image(vt.displayW, vt.displayH)

View File

@@ -140,6 +140,8 @@ constructor(gamename: String) : StateBasedGame(gamename) {
var VSYNC = true
val VSYNC_TRIGGER_THRESHOLD = 56
var gameStarted = false
lateinit var ingame: StateInGame
lateinit var gameConfig: GameConfig

View File

@@ -13,7 +13,7 @@ class SetTime : ConsoleCommand {
Terrarum.ingame.world.time.setTime(timeToSet)
Echo().execute("Set time to ${Terrarum.ingame.world.time.elapsedSeconds()} " +
Echo().execute("Set time to ${Terrarum.ingame.world.time.elapsedSeconds} " +
"(${Terrarum.ingame.world.time.hours}h${formatMin(Terrarum.ingame.world.time.minutes)})")
}
else {

View File

@@ -1,50 +1,93 @@
package net.torvald.terrarum.gameworld
/**
* The World Calendar implementation of Dwarven Calendar (we're talking about DF!)
*
* Please see:
* https://en.wikipedia.org/wiki/World_Calendar
* http://dwarffortresswiki.org/index.php/DF2014:Calendar
*
* Normal format for day is
* Tysdag 12th Granite
*
* And there is no AM/PM concept, 22-hour clock is forced.
*
* Created by minjaesong on 16-01-24.
*/
class WorldTime {
internal var seconds: Int
internal var minutes: Int
internal var hours: Int
internal var seconds: Int // 0 - 59
internal var minutes: Int // 0 - 59
internal var hours: Int // 0 - 21
// days on the year
internal var yearlyDays: Int //NOT a calendar day
internal var days: Int
internal var months: Int
internal var years: Int
internal var days: Int // 1 - 31
internal var months: Int // 1 - 12
internal var years: Int // 1+
internal var dayOfWeek: Int //0: Mondag-The first day of weekday
internal var dayOfWeek: Int //0: Mondag-The first day of weekday (0 - 7)
internal var timeDelta = 1
@Transient private var realMillisec: Int
val DAY_NAMES = arrayOf(//daynames are taken from Nynorsk (å -> o)
"Mondag", "Tysdag", "Midtedag" //From Islenska Miðvikudagur
"Mondag", "Tysdag", "Midvikdag" //From Islenska Miðvikudagur
, "Torsdag", "Fredag", "Laurdag", "Sundag", "Verdag" //From Norsk word 'verd'
)
val DAY_NAMES_SHORT = arrayOf("Mon", "Tys", "Mid", "Tor", "Fre", "Lau", "Sun", "Ver")
val MONTH_NAMES = arrayOf(
"Opal", "Obsidian", "Granite", "Slate", "Felsite", "Hematite",
"Malachite", "Galena", "Limestone", "Sandstone", "Timber", "Moonstone"
)
val MONTH_NAMES_SHORT = arrayOf("Opal", "Obsi", "Gran", "Slat", "Fels", "Hema",
"Mala", "Gale", "Lime", "Sand", "Timb", "Moon")
@Transient val REAL_SEC_IN_MILLI = 1000
companion object {
/** Each day is 22-hour long */
val DAY_LENGTH = 79200 //must be the multiple of 3600
val HOUR_SEC: Int = 3600
val MINUTE_SEC: Int = 60
val HOUR_MIN: Int = 60
val GAME_MIN_TO_REAL_SEC: Float = 60f
fun parseTime(s: String): Int =
if (s.length >= 4) {
s.toLowerCase().substringBefore('h').toInt() * WorldTime.HOUR_SEC +
s.toLowerCase().substringAfter('h').toInt() * WorldTime.MINUTE_SEC
}
else if (s.endsWith("h", true)) {
s.toLowerCase().substring(0, s.length - 1).toInt() * WorldTime.HOUR_SEC
}
else {
s.toInt()
}
}
init {
seconds = 0
minutes = 30
hours = 8
yearlyDays = 1
yearlyDays = 73
days = 12
months = 3
years = 125
dayOfWeek = 0
dayOfWeek = 1 // Tysdag
realMillisec = 0
}
fun update(delta: Int) {
val oldsec = seconds
//time
realMillisec += delta * timeDelta
seconds = Math.round(GAME_MIN_TO_REAL_SEC.toFloat() / REAL_SEC_IN_MILLI.toFloat() * realMillisec.toFloat())
val newsec = Math.round(GAME_MIN_TO_REAL_SEC.toFloat() / REAL_SEC_IN_MILLI.toFloat() * realMillisec.toFloat())
seconds = newsec
if (realMillisec >= REAL_SEC_IN_MILLI)
realMillisec -= REAL_SEC_IN_MILLI
@@ -57,22 +100,23 @@ class WorldTime {
* 0 == 6 AM
* @return
*/
fun elapsedSeconds(): Int {
return (HOUR_SEC * hours + MINUTE_SEC * minutes + seconds) % DAY_LENGTH
}
val elapsedSeconds: Int
get() = (HOUR_SEC * hours + MINUTE_SEC * minutes + seconds) % DAY_LENGTH
val isLeapYear: Boolean
get() = years % 4 == 0 && years % 100 != 0 || years % 400 == 0
/** Sets time of this day. */
fun setTime(t: Int) {
days += t / DAY_LENGTH
hours = t / HOUR_SEC
minutes = (t - HOUR_SEC * hours) / MINUTE_SEC
seconds = t - minutes * MINUTE_SEC
yearlyDays += t / DAY_LENGTH
}
fun addTime(t: Int) {
setTime(elapsedSeconds() + t)
setTime(elapsedSeconds + t)
}
fun setTimeDelta(d: Int) {
@@ -125,41 +169,14 @@ class WorldTime {
if (months > 12) {
months = 1
years++
yearlyDays = 1
}
}
fun getFormattedTime(): String {
fun formatMin(min: Int): String {
return if (min < 10) "0${min.toString()}" else min.toString()
}
fun getFormattedTime() = "${String.format("%02d", hours)}h${String.format("%02d", minutes)}"
return "${hours}h${formatMin(minutes)}"
}
fun getDayNameFull(): String = DAY_NAMES[dayOfWeek]
fun getDayNameShort(): String = DAY_NAMES_SHORT[dayOfWeek]
companion object {
/**
* 22h
*/
val DAY_LENGTH = 79200 //must be the multiple of 3600
val HOUR_SEC: Int = 3600
val MINUTE_SEC: Int = 60
val HOUR_MIN: Int = 60
val GAME_MIN_TO_REAL_SEC: Float = 60f
fun parseTime(s: String): Int =
if (s.length >= 4) {
s.toLowerCase().substringBefore('h').toInt() * WorldTime.HOUR_SEC +
s.toLowerCase().substringAfter('h').toInt() * WorldTime.MINUTE_SEC
}
else if (s.endsWith("h", true)) {
s.toLowerCase().substring(0, s.length - 1).toInt() * WorldTime.HOUR_SEC
}
else {
s.toInt()
}
}
fun getDayNameFull() = DAY_NAMES[dayOfWeek]
fun getDayNameShort() = DAY_NAMES_SHORT[dayOfWeek]
fun getMonthNameFull() = MONTH_NAMES[months - 1]
fun getMonthNameShort() = MONTH_NAMES_SHORT[months - 1]
}

View File

@@ -131,7 +131,7 @@ class BasicDebugInfoWindow : UICanvas {
printLineColumn(g, 2, 1, "VSync $ccG" + Terrarum.appgc.isVSyncRequested)
printLineColumn(g, 2, 2, "Env colour temp $ccG" + MapDrawer.colTemp)
printLineColumn(g, 2, 5, "Time $ccG${Terrarum.ingame.world.time.elapsedSeconds()}" +
printLineColumn(g, 2, 5, "Time $ccG${Terrarum.ingame.world.time.elapsedSeconds}" +
" (${Terrarum.ingame.world.time.getFormattedTime()})")
printLineColumn(g, 2, 6, "Mass $ccG${player.mass}")

View File

@@ -6,10 +6,32 @@
Some codes were taken from OpenComputers, which is distributed under MIT
--]]
-- global functions
_G.runscript = function(s, src, ...)
if s:byte(1) == 27 then error("Bytecode execution is prohibited.") end
local code, reason = load(s, src)
if code then
xpcall(code(...), eprint)
else
print(DLE..tostring(reason)) -- it catches syntax errors
end
end
fs.dofile = function(p, ...)
local f = fs.open(p, "r")
local s = f.readAll()
_G.runscript(s, "="..p, ...)
end
-- EFI is expected to locate in "boot/efi"
if fs.exists("boot/efi") then fs.dofile("boot/efi") end
computer.realTime = function() return 0 end
-- global variables
_G._VERSION = "Luaj-jse 3.0.1 (Lua 5.2.3)"
_G._VERSION = _VERSION.." (Lua 5.2.3)"
_G.EMDASH = string.char(0xC4)
_G.UNCHECKED = string.char(0x9C) -- box unchecked
_G.CHECKED = string.char(0x9D) -- box checked
@@ -969,18 +991,6 @@ sandbox._G = sandbox
-- path for any ingame libraries
package.path = "/net/torvald/terrarum/virtualcomputer/assets/lua/?.lua;" .. package.path
-- global functions
_G.runscript = function(s, src, ...)
if s:byte(1) == 27 then error("Bytecode execution is prohibited.") end
local code, reason = load(s, src)
if code then
xpcall(code(...), eprint)
else
print(DLE..tostring(reason)) -- it catches syntax errors
end
end
_G.__scanMode__ = "UNINIT" -- part of inputstream implementation
local screenbufferdim = term.width() * term.height()
@@ -989,14 +999,15 @@ if term.isCol() then screencolours = 8
elseif term.isTeletype() then screencolours = 1 end
local screenbuffersize = screenbufferdim * screencolours / 8
computer.prompt = DC3.."> "..DC4
computer.verbose = true -- print debug info
computer.loadedCLayer = {} -- list of loaded compatibility layers
computer.bootloader = "/boot/efi"
computer.OEM = ""
if not computer.prompt then computer.prompt = DC3.."> "..DC4 end
if not computer.verbose then computer.verbose = true end -- print debug info
if not computer.loadedCLayer then computer.loadedCLayer = {} end -- list of loaded compatibility layers
-- if no bootloader is pre-defined via EFI, use default one
if not computer.bootloader then computer.bootloader = "/boot/bootloader" end
if not computer.OEM then computer.OEM = "" end
computer.beep = emittone
computer.totalMemory = _G.totalMemory
computer.bellpitch = 1000
if not computer.bellpitch then computer.bellpitch = 1000 end
local getMemory = function()
collectgarbage()
return collectgarbage("count") * 1024 - 6.5*1048576 + screenbuffersize
@@ -1021,7 +1032,7 @@ print("Rom basic "..DC2.._VERSION..DC4)
print("Copyright (C) 1994-2013 Lua.org, PUC-Rio")
print("Ok")
while not native.isHalted() do
while not machine.isHalted() do
term.setCursorBlink(true)
io.write(computer.prompt)
local s = __scanforline__()
@@ -1039,5 +1050,5 @@ while not native.isHalted() do
end
::quit::
native.closeInputString()
machine.closeInputString()
return

View File

@@ -8,11 +8,11 @@
_G.io = {}
fs.dofile = function(p, ...)
--[[fs.dofile = function(p, ...)
local f = fs.open(p, "r")
local s = f.readAll()
_G.runscript(s, "="..p, ...)
end
end]] -- implementation moved to BOOT.lua
_G.loadstring = _G.load
@@ -46,12 +46,12 @@ override fun keyPressed(key: Int, c: Char) {
and THIS exact part will close the input for this function.
]]
_G.__scanforline__ = function(echo) -- pass '1' to not echo; pass nothing to echo
native.closeInputString()
native.openInput(echo or 0)
machine.closeInputString()
machine.openInput(echo or 0)
_G.__scanMode__ = "line"
local s
repeat -- we can do this ONLY IF lua execution process is SEPARATE THREAD
s = native.getLastStreamInput()
s = machine.getLastStreamInput()
until s
-- input is closed when RETURN is hit. See above comments.
return s
@@ -59,12 +59,12 @@ end
-- use Keys API to identify the keycode
--[[_G.__scanforkey__ = function(echo) -- pass '1' to not echo; pass nothing to echo
native.closeInputString()
native.openInput(echo or 0)
machine.closeInputString()
machine.openInput(echo or 0)
_G.__scanMode__ = "a_key"
local key
repeat -- we can do this ONLY IF lua execution process is SEPARATE THREAD
key = native.getLastKeyPress()
key = machine.getLastKeyPress()
until key
-- input is closed when any key is hit. See above comments.
return key

View File

@@ -1,20 +1,18 @@
package net.torvald.terrarum.virtualcomputer.computer
import com.jme3.math.FastMath
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.TwoArgFunction
import li.cil.repack.org.luaj.vm2.lib.ZeroArgFunction
import li.cil.repack.org.luaj.vm2.lib.jse.JsePlatform
import org.luaj.vm2.Globals
import org.luaj.vm2.LuaError
import org.luaj.vm2.LuaTable
import org.luaj.vm2.LuaValue
import org.luaj.vm2.lib.TwoArgFunction
import org.luaj.vm2.lib.ZeroArgFunction
import org.luaj.vm2.lib.jse.JsePlatform
import net.torvald.terrarum.KVHashMap
import net.torvald.terrarum.gameactors.ActorValue
import net.torvald.terrarum.gameactors.roundInt
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.lwjgl.BufferUtils
import org.lwjgl.openal.AL
import org.lwjgl.openal.AL10
@@ -73,6 +71,12 @@ class BaseTerrarumComputer() {
lateinit var term: Teletype
private set
// os-related functions. These are called "machine" library-wise.
private val startupTimestamp: Long = System.currentTimeMillis()
/** Time elapsed since the power is on. */
val milliTime: Int
get() = (System.currentTimeMillis() - startupTimestamp).toInt()
init {
computerValue["memslot0"] = 4864 // -1 indicates mem slot is empty
computerValue["memslot1"] = -1 // put index of item here
@@ -96,7 +100,6 @@ class BaseTerrarumComputer() {
// boot device
computerValue["boot"] = computerValue.getAsString("hda")!!
}
fun attachTerminal(term: Teletype) {
@@ -125,6 +128,7 @@ class BaseTerrarumComputer() {
Input(luaJ_globals, this)
Http(luaJ_globals, this)
PcSpeakerDriver(luaJ_globals, this)
WorldInformationProvider(luaJ_globals)
// secure the sandbox
@@ -141,6 +145,7 @@ class BaseTerrarumComputer() {
luaJ_globals["totalMemory"] = LuaFunGetTotalMem(this)
luaJ_globals["computer"] = LuaTable()
// rest of the "computer" APIs should be implemented in BOOT.lua
if (DEBUG) luaJ_globals["emittone"] = ComputerEmitTone(this)
}
@@ -167,8 +172,6 @@ class BaseTerrarumComputer() {
}
driveBeepQueueManager(delta)
}
fun keyPressed(key: Int, c: Char) {
@@ -267,19 +270,19 @@ class BaseTerrarumComputer() {
private var beepQueueFired = false
private fun driveBeepQueueManager(delta: Int) {
// start beep queue
// start emitTone queue
if (beepQueue.size > 0 && beepCursor == -1) {
beepCursor = 0
}
// continue beep queue
// continue emitTone queue
if (beepCursor >= 0 && beepQueueLineExecTimer >= beepQueueGetLenOfPtn(beepCursor)) {
beepQueueLineExecTimer -= beepQueueGetLenOfPtn(beepCursor)
beepCursor += 1
beepQueueFired = false
}
// complete beep queue
// complete emitTone queue
if (beepCursor >= beepQueue.size) {
clearBeepQueue()
if (DEBUG) println("!! Beep queue clear")

View File

@@ -1,9 +1,9 @@
package net.torvald.terrarum.virtualcomputer.luaapi
import li.cil.repack.org.luaj.vm2.*
import li.cil.repack.org.luaj.vm2.lib.OneArgFunction
import li.cil.repack.org.luaj.vm2.lib.TwoArgFunction
import li.cil.repack.org.luaj.vm2.lib.ZeroArgFunction
import org.luaj.vm2.*
import org.luaj.vm2.lib.OneArgFunction
import org.luaj.vm2.lib.TwoArgFunction
import org.luaj.vm2.lib.ZeroArgFunction
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.virtualcomputer.computer.BaseTerrarumComputer
import net.torvald.terrarum.virtualcomputer.luaapi.Term.Companion.checkIBM437

View File

@@ -1,36 +1,35 @@
package net.torvald.terrarum.virtualcomputer.luaapi
import li.cil.repack.org.luaj.vm2.Globals
import li.cil.repack.org.luaj.vm2.LuaFunction
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 li.cil.repack.org.luaj.vm2.lib.ZeroArgFunction
import org.luaj.vm2.lib.OneArgFunction
import org.luaj.vm2.lib.ZeroArgFunction
import net.torvald.terrarum.virtualcomputer.computer.BaseTerrarumComputer
import net.torvald.terrarum.virtualcomputer.luaapi.Term.Companion.checkIBM437
import net.torvald.terrarum.virtualcomputer.terminal.Teletype
import org.luaj.vm2.*
/**
* Provide Lua an access to computer object that is in Java
*
* The "machine" refers to the computer fixture itself in the game world.
*
* Created by minjaesong on 16-09-19.
*/
internal class HostAccessProvider(globals: Globals, computer: BaseTerrarumComputer) {
init {
globals["native"] = LuaTable()
globals["native"]["println"] = PrintLn()
globals["native"]["isHalted"] = IsHalted(computer)
globals["machine"] = LuaTable()
globals["machine"]["println"] = PrintLn()
globals["machine"]["isHalted"] = IsHalted(computer)
globals["native"]["closeInputString"] = NativeCloseInputString(computer.term)
globals["native"]["closeInputKey"] = NativeCloseInputKey(computer.term)
globals["native"]["openInput"] = NativeOpenInput(computer.term)
globals["native"]["getLastStreamInput"] = NativeGetLastStreamInput(computer.term)
globals["native"]["getLastKeyPress"] = NativeGetLastKeyPress(computer.term)
globals["machine"]["closeInputString"] = NativeCloseInputString(computer.term)
globals["machine"]["closeInputKey"] = NativeCloseInputKey(computer.term)
globals["machine"]["openInput"] = NativeOpenInput(computer.term)
globals["machine"]["getLastStreamInput"] = NativeGetLastStreamInput(computer.term)
globals["machine"]["getLastKeyPress"] = NativeGetLastKeyPress(computer.term)
// while lua's dofile/require is fixiated to fs, this command allows
// libraries in JAR to be loaded.
//globals["native"]["loadBuiltInLib"] = NativeLoadBuiltInLib()
globals["machine"]["milliTime"] = NativeGetMilliTime(computer)
globals["machine"]["sleep"] = NativeBusySleep(computer)
globals["__haltsystemexplicit__"] = HaltComputer(computer)
}
@@ -98,4 +97,21 @@ internal class HostAccessProvider(globals: Globals, computer: BaseTerrarumComput
return LuaValue.NONE
}
}
/** Time elapsed since the power is on. */
class NativeGetMilliTime(val computer: BaseTerrarumComputer) : ZeroArgFunction() {
override fun call(): LuaValue {
return LuaValue.valueOf(computer.milliTime)
}
}
class NativeBusySleep(val computer: BaseTerrarumComputer) : OneArgFunction() {
override fun call(mills: LuaValue): LuaValue {
val starttime = computer.milliTime
val sleeptime = mills.checkint()
if (sleeptime > 1000) throw LuaError("Cannot busy-sleep more than a second.")
while (computer.milliTime - starttime < sleeptime) { }
return LuaValue.NONE
}
}
}

View File

@@ -1,6 +1,6 @@
package net.torvald.terrarum.virtualcomputer.luaapi
import li.cil.repack.org.luaj.vm2.Globals
import org.luaj.vm2.Globals
import net.torvald.terrarum.virtualcomputer.computer.BaseTerrarumComputer
/**

View File

@@ -1,9 +1,9 @@
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 org.luaj.vm2.Globals
import org.luaj.vm2.LuaTable
import org.luaj.vm2.LuaValue
import org.luaj.vm2.lib.OneArgFunction
import net.torvald.terrarum.gamecontroller.Key
import net.torvald.terrarum.virtualcomputer.computer.BaseTerrarumComputer

View File

@@ -1,10 +1,10 @@
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.TwoArgFunction
import li.cil.repack.org.luaj.vm2.lib.ZeroArgFunction
import org.luaj.vm2.Globals
import org.luaj.vm2.LuaTable
import org.luaj.vm2.LuaValue
import org.luaj.vm2.lib.TwoArgFunction
import org.luaj.vm2.lib.ZeroArgFunction
import net.torvald.terrarum.virtualcomputer.computer.BaseTerrarumComputer
/**

View File

@@ -1,8 +1,8 @@
package net.torvald.terrarum.virtualcomputer.luaapi
import li.cil.repack.org.luaj.vm2.Globals
import li.cil.repack.org.luaj.vm2.LuaValue
import li.cil.repack.org.luaj.vm2.lib.OneArgFunction
import org.luaj.vm2.Globals
import org.luaj.vm2.LuaValue
import org.luaj.vm2.lib.OneArgFunction
import net.torvald.terrarum.gameworld.toUint
import org.apache.commons.codec.binary.Base64
import org.apache.commons.codec.digest.DigestUtils

View File

@@ -1,14 +1,14 @@
package net.torvald.terrarum.virtualcomputer.luaapi
import li.cil.repack.org.luaj.vm2.*
import li.cil.repack.org.luaj.vm2.lib.*
import org.luaj.vm2.*
import org.luaj.vm2.lib.*
import net.torvald.terrarum.virtualcomputer.terminal.Teletype
import net.torvald.terrarum.virtualcomputer.terminal.Terminal
import java.nio.charset.Charset
/**
* 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)
* (not sending control sequences but just drives it directly)
*
* Created by minjaesong on 16-09-12.
*/

View File

@@ -0,0 +1,131 @@
package net.torvald.terrarum.virtualcomputer.luaapi
import org.luaj.vm2.Globals
import org.luaj.vm2.LuaFunction
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.gameworld.WorldTime
import org.luaj.vm2.LuaTable
import org.luaj.vm2.LuaValue
import org.luaj.vm2.lib.ZeroArgFunction
import java.util.*
/**
* Implementation of lua's os.date, to return world info of the game world.
*
* Created by minjaesong on 16-09-28.
*/
class WorldInformationProvider(globals: Globals) {
init {
globals["os"]["time"] = LuaValue.NIL // history is LONG! Our 32-bit Lua's epoch is destined to break down...
globals["os"]["date"] = OsDateImpl()
}
companion object {
fun getWorldTimeInLuaFormat() : LuaTable {
val t = LuaTable()
if (Terrarum.gameStarted) {
val time = Terrarum.ingame.world.time
// int Terrarum World Time format
t["hour"] = time.hours
t["min"] = time.minutes
t["wday"] = time.dayOfWeek
t["year"] = time.years
t["yday"] = time.yearlyDays
t["month"] = time.months
t["sec"] = time.seconds
t["day"] = time.days
}
else {
t["hour"] = 0
t["min"] = 0
t["wday"] = 1
t["year"] = 0
t["yday"] = 1
t["month"] = 1
t["sec"] = 0
t["day"] = 1
}
return t
}
val defaultDateFormat = "%a %d %B %Y %X"
/** evaluate single C date format */
fun String.evalAsDate(): String {
if (Terrarum.gameStarted) {
val time = Terrarum.ingame.world.time
return when (this) {
"%a" -> time.getDayNameShort()
"%A" -> time.getDayNameFull()
"%b" -> time.getMonthNameShort()
"%B" -> time.getMonthNameFull()
"%c" -> "%x".evalAsDate() + " " + "%X".evalAsDate()
"%d" -> time.days.toString()
"%H" -> time.hours.toString()
"%I" -> throw IllegalArgumentException("%I: AM/PM concept does not exists.")
"%M" -> time.minutes.toString()
"%m" -> time.months.toString()
"%p" -> throw IllegalArgumentException("%p: AM/PM concept does not exists.")
"%S" -> time.seconds.toString()
"%w" -> time.dayOfWeek.toString()
"%x" -> "${String.format("%02d", time.years)}-${String.format("%02d", time.months)}-${String.format("%02d", time.days)}"
"%X" -> "${String.format("%02d", time.hours)}:${String.format("%02d", time.minutes)}:${String.format("%02d", time.seconds)}"
"%Y" -> time.years.toString()
"%y" -> time.years.mod(100).toString()
"%%" -> "%"
else -> throw IllegalArgumentException("Unknown format string: $this")
}
}
else {
return when (this) {
"%a" -> "---"
"%A" -> "------"
"%b" -> "----"
"%B" -> "--------"
"%c" -> "%x".evalAsDate() + " " + "%X".evalAsDate()
"%d" -> "0"
"%H" -> "0"
"%I" -> throw IllegalArgumentException("%I: AM/PM concept does not exists.")
"%M" -> "0"
"%m" -> "0"
"%p" -> throw IllegalArgumentException("%p: AM/PM concept does not exists.")
"%S" -> "0"
"%w" -> "0"
"%x" -> "00-00-00"
"%X" -> "00:00:00"
"%Y" -> "0"
"%y" -> "00"
"%%" -> "%"
else -> throw IllegalArgumentException("Unknown format string: $this")
}
}
}
val acceptedDateFormats = arrayOf("%a", "%A", "%b", "%B", "%c", "%d", "%H", "%I", "%M", "%m", "%p", "%S", "%w", "%x", "%X", "%Y", "%y", "%%" )
}
/**
* Changes: cannot get a representation of arbitrary time.
*/
class OsDateImpl() : LuaFunction() {
// no args
override fun call(): LuaValue {
return call(defaultDateFormat)
}
override fun call(format: LuaValue): LuaValue {
var arg = format.checkjstring()
acceptedDateFormats.forEach {
if (arg.contains(it))
arg = arg.replace(it, it.evalAsDate(), ignoreCase = false)
}
return LuaValue.valueOf(arg)
}
}
}

View File

@@ -1,194 +0,0 @@
/*
* $Id: LuaConsole.java 79 2012-01-08 11:08:32Z andre@naef.com $
* See LICENSE.txt for license terms.
*/
package net.torvald.terrarum.virtualcomputer.terminal;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import li.cil.repack.com.naef.jnlua.LuaException;
import li.cil.repack.com.naef.jnlua.LuaRuntimeException;
import li.cil.repack.com.naef.jnlua.LuaState;
/**
* A simple Lua console.
*
* <p>
* The console collects input until a line with the sole content of the word
* <i>go</i> is encountered. At that point, the collected input is run as a Lua
* chunk. If the Lua chunk loads and runs successfully, the console displays the
* returned values of the chunk as well as the execution time based on a
* <code>System.nanoTime()</code> measurement. Otherwise, the console shows the
* error that has occurred.
* </p>
*
* <p>
* Expressions can be printed by prepending <i>=</i> to the expression at the
* beginning of a chunk. The console translates <i>=</i> into
* <code>return</code> followed by a space and executes the chunk immediately.
* No separate <i>go</i> is required. Therefore, expressions printed this way
* must be entered on a single line.
* </p>
*/
public class LuaConsole {
// -- Static
private static final String[] EMPTY_ARGS = new String[0];
/**
* Main routine.
*
* @param args
* the command line arguments
*/
public static void main(String[] args) {
LuaConsole luaConsole = new LuaConsole(args);
luaConsole.run();
System.exit(0);
}
// -- State
private LuaState luaState;
// -- Construction
/**
* Creates a new instance.
*/
public LuaConsole() {
this(EMPTY_ARGS);
}
/**
* Creates a new instance with the specified command line arguments. The
* arguments are passed to Lua as the <code>argv</code> global variable.
*
* @param args
*/
public LuaConsole(String[] args) {
luaState = new LuaState();
// Process arguments
luaState.newTable(args.length, 0);
for (int i = 0; i < args.length; i++) {
luaState.pushString(args[i]);
luaState.rawSet(-2, i + 1);
}
luaState.setGlobal("argv");
// Open standard libraries
luaState.openLibs();
// Set buffer mode
luaState.load("io.stdout:setvbuf(\"no\")", "=consoleInitStdout");
luaState.call(0, 0);
luaState.load("io.stderr:setvbuf(\"no\")", "=consoleInitStderr");
luaState.call(0, 0);
}
// -- Properties
/**
* Returns the Lua state of this console.
*
* @return the Lua state
*/
public LuaState getLuaState() {
return luaState;
}
// -- Operations
/**
* Runs the console.
*/
public void run() {
// Banner
System.out.println(String.format("JNLua %s Console using Lua %s.",
LuaState.VERSION, LuaState.LUA_VERSION));
System.out.print("Type 'go' on an empty line to evaluate a chunk. ");
System.out.println("Type =<expression> to print an expression.");
// Prepare reader
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(System.in));
try {
// Process chunks
chunk: while (true) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
OutputStreamWriter outWriter = new OutputStreamWriter(out,
"UTF-8");
boolean firstLine = true;
// Process lines
while (true) {
String line = bufferedReader.readLine();
if (line == null) {
break chunk;
}
if (line.equals("go")) {
outWriter.flush();
InputStream in = new ByteArrayInputStream(out
.toByteArray());
runChunk(in);
continue chunk;
}
if (firstLine && line.startsWith("=")) {
outWriter.write("return " + line.substring(1));
outWriter.flush();
InputStream in = new ByteArrayInputStream(out
.toByteArray());
runChunk(in);
continue chunk;
}
outWriter.write(line);
outWriter.write('\n');
firstLine = false;
}
}
} catch (IOException e) {
System.out.print("IO error: ");
System.out.print(e.getMessage());
System.out.println();
}
}
/**
* Runs a chunk of Lua code from an input stream.
*/
protected void runChunk(InputStream in) throws IOException {
try {
long start = System.nanoTime();
luaState.setTop(0);
luaState.load(in, "=console", "t");
luaState.call(0, LuaState.MULTRET);
long stop = System.nanoTime();
for (int i = 1; i <= luaState.getTop(); i++) {
if (i > 1) {
System.out.print(", ");
}
switch (luaState.type(i)) {
case BOOLEAN:
System.out.print(Boolean.valueOf(luaState.toBoolean(i)));
break;
case NUMBER:
case STRING:
System.out.print(luaState.toString(i));
break;
default:
System.out.print(luaState.typeName(i));
}
}
System.out.print("\t#msec=");
System.out.print(String.format("%.3f", (stop - start) / 1000000.0));
System.out.println();
} catch (LuaRuntimeException e) {
e.printLuaStackTrace();
} catch (LuaException e) {
System.err.println(e.getMessage());
}
}
}

View File

@@ -223,7 +223,7 @@ open class SimpleTextTerminal(
}
else {
when (c) {
ASCII_BEL -> beep()
ASCII_BEL -> bell(".")
ASCII_BS -> { cursorX -= 1; wrap() }
ASCII_TAB -> { cursorX = (cursorX).div(TABSIZE).times(TABSIZE) + TABSIZE }
ASCII_LF -> newLine()
@@ -318,13 +318,13 @@ open class SimpleTextTerminal(
* @param duration: milliseconds
* @param freg: Frequency (float)
*/
override fun beep(duration: Int, freq: Float) {
override fun emitTone(duration: Int, freq: Float) {
// println("!! Beep playing row $beepCursor, d ${Math.min(duration, maxDuration)} f $freq")
host.clearBeepQueue()
host.enqueueBeep(duration, freq)
}
/** for "beep code" on modern BIOS. */
/** for "emitTone code" on modern BIOS. */
override fun bell(pattern: String) {
host.clearBeepQueue()
@@ -336,7 +336,7 @@ open class SimpleTextTerminal(
for (c in pattern) {
when (c) {
'.' -> { host.enqueueBeep(50, freq); host.enqueueBeep(50, 0f) }
'.' -> { host.enqueueBeep(80, freq); host.enqueueBeep(50, 0f) }
'-' -> { host.enqueueBeep(200, freq); host.enqueueBeep(50, 0f) }
'=' -> { host.enqueueBeep(500, freq); host.enqueueBeep(50, 0f) }
' ' -> { host.enqueueBeep(200, 0f) }

View File

@@ -61,13 +61,8 @@ interface Terminal : Teletype {
* @param duration: milliseconds
* @param freg: Frequency (float)
*/
fun beep(duration: Int = 80, freq: Float = 1000f)
/**
* Pattern: - .
* . 80 ms
* - 200 ms
* ( ) 80 ms
*/
fun emitTone(duration: Int, freq: Float)
override fun bell(pattern: String)
/** Requires keyPressed() event to be processed.
*

View File

@@ -76,7 +76,7 @@ object WeatherMixer {
fun render(g: Graphics) {
// we will not care for nextSkybox for now
val timeNow = Terrarum.ingame.world.time.elapsedSeconds()
val timeNow = Terrarum.ingame.world.time.elapsedSeconds
val skyboxColourMap = currentWeather.skyboxGradColourMap
val lightColourMap = currentWeather.globalLightColourMap

View File

@@ -0,0 +1,8 @@
The Machine API provides means to control the machine itself.
\begin{tabularx}{\textwidth}{l l X}
\textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description}
\\ \\
\endhead
machine.milliTime() & int & Returns how many time the machine is up, in milliseconds (one thousandth of seconds).
\end{tabularx}

View File

@@ -0,0 +1,33 @@
The OS library provides functions and constants for the system. Most of the functions in the standard Lua are faithfully reconstructed, but there are some functions that behaves differently.
\begin{tabularx}{\textwidth}{l l X}
\textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description}
\\ \\
\endhead
os.clock() & number & Returns time passed since the computer is on.
\\ \\
os.date(format: string) & string & Returns world's current time in desired format, or default if no arguments are provided. NOTE: displaying different time is not possible; Lua's TIME\_T is only 32 bit, world's history can be much longer.
\end{tabularx}
\subsection{Date Format String}
\begin{tabularx}{\textwidth}{c X c X}
\textbf{\large } & \textbf{\large Description} & \textbf{\large } & \textbf{\large Description}
\\ \\
\endhead
\textbf{\%a} & Short day name. (e.g. ``Tys'') & \textbf{\%A} & Full day name. (e.g. ``Tysdag'')
\\ \\
\textbf{\%b} & Short month name. (e.g. ``Gran'') & \textbf{\%B} & Full month name. (e.g. ``Granite'')
\\ \\
\textbf{\%c} & Date and time. (e.g. ``25-03-12 08:30:00'') & \textbf{\%d} & Current days.
\\ \\
\textbf{\%H} & Current hours. & \textbf{\%M} & Current minutes.
\\ \\
\textbf{\%m} & Current months. & \textbf{\%S} & Current seconds.
\\ \\
\textbf{\%w} & Current day of week in int. & \textbf{\%x} & Full date. (e.g. ``25-03-12'')
\\ \\
\textbf{\%X} & Full clock time. (e.g. ``08:30:00'') & \textbf{\%Y} & Current year. (e.g. ``125'')
\\ \\
\textbf{\%y} & Last two digits of current year. (e.g. ``25'') & \textbf{\%\%} & Per cent mark.
\end{tabularx}

View File

@@ -20,6 +20,8 @@ Note: cursor coordinates starts from one, not zero.
\\ \\
term.scroll(\textbf{n}: int) & nil & Make a new line \textbf{n} times.
\\ \\
term.bell(pattern: string) & nil & Strikes a bell. Go to section \emph{Lua Globals} > \emph{Bell Codes} for accepted patterns.
\\ \\
term.isTeletype() & bool & Returns \textbf{true} if the terminal is teletype.
\\ \\
\multicolumn{3}{c}{\textbf{Graphic terminals only}}
@@ -95,7 +97,7 @@ Character 0x9E (currency symbol) and 0xFA (middle dot) can be accessed with foll
\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.
7 & BEL. Emits short emitTone. & 8 & BS. Moves cursor to left 1 character.
\\ \\
9 & TAB. Inserts appropriate horizontal space. Tab size is variable. & 10 & LF. Prints a new line.
\\ \\

View File

@@ -8,7 +8,7 @@ ROMBASIC adds global functions and constants for operability.
\endhead
\unemph{\_G.}runScript(\textbf{fun}: str, \textbf{env}: str) & nil & Runs Lua script \textbf{fun} with the environment tag \textbf{env}.
\\ \\
\unemph{\_G.}bell(\textbf{pattern}: str) & nil & Strike bell (or beeper) with pattern. See section \emph{Bell Codes} for more information. Aliased to \unemph{\_G.}beep.
\unemph{\_G.}bell(\textbf{pattern}: str) & nil & Strike bell (or beeper) with pattern. See section \emph{Bell Codes} for more information. Aliased to \unemph{\_G.}emitTone.
\\ \\
computer.totalMemory() & int & Returns the total size of the memory installed in the computer, in bytes.
\\ \\
@@ -51,7 +51,7 @@ ROMBASIC adds global functions and constants for operability.
\\ \\
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.
\\ \\
computer.beep(\textbf{len}, \textbf{freq}) & nil & Generates square wave. \textbf{len} is integer, in milliseconds, \textbf{freq} is number, in Hertz.
computer.emitTone(\textbf{len}, \textbf{freq}) & nil & Generates square wave. \textbf{len} is integer, in milliseconds, \textbf{freq} is number, in Hertz.
\end{tabularx}
\subsection{Bell Codes}
@@ -59,9 +59,9 @@ ROMBASIC adds global functions and constants for operability.
Bell Codes are patterns for driving bell/beeper. Each code is followed by short break of 50 milliseconds.
\begin{tabularx}{\textwidth}{l X l X}
\textbf{.} (dot) & Short beep. 50 ms & \textbf{-} (dash) & Medium beep. 200 ms
\textbf{.} (dot) & Short emitTone. 80 ms & \textbf{-} (dash) & Medium emitTone. 200 ms
\\ \\
\textbf{=} (equal) & Long beep. 500 ms & \textbf{,} (comma) & Short break. 50 ms
\textbf{=} (equal) & Long emitTone. 500 ms & \textbf{,} (comma) & Short break. 50 ms
\\ \\
(space) & Break. 200 ms
\end{tabularx}

View File

@@ -49,28 +49,39 @@
\@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}{104.04007pt}\LT@entry
{2}{45.37001pt}\LT@entry
{1}{185.58992pt}}
\gdef \LT@vii {\LT@entry
{2}{29.40001pt}\LT@entry
{1}{138.0pt}\LT@entry
{2}{29.6pt}\LT@entry
{1}{138.0pt}}
\@writefile{toc}{\contentsline {section}{\numberline {1.5}OS}{12}{section.1.5}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.5.1}Date Format String}{12}{subsection.1.5.1}}
\gdef \LT@viii {\LT@entry
{2}{136.82pt}\LT@entry
{1}{45.25516pt}\LT@entry
{1}{152.92484pt}}
\@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
\@writefile{toc}{\contentsline {section}{\numberline {1.6}Security}{13}{section.1.6}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.6.1}Functions}{13}{subsection.1.6.1}}
\gdef \LT@ix {\LT@entry
{2}{102.18004pt}\LT@entry
{1}{45.25516pt}\LT@entry
{2}{180.42001pt}}
\@writefile{toc}{\contentsline {section}{\numberline {1.6}Shell}{13}{section.1.6}}
\gdef \LT@viii {\LT@entry
\@writefile{toc}{\contentsline {section}{\numberline {1.7}Shell}{14}{section.1.7}}
\gdef \LT@x {\LT@entry
{2}{161.65002pt}\LT@entry
{1}{45.25516pt}\LT@entry
{1}{128.09482pt}}
\@writefile{toc}{\contentsline {section}{\numberline {1.7}Speaker}{14}{section.1.7}}
\gdef \LT@ix {\LT@entry
\@writefile{toc}{\contentsline {section}{\numberline {1.8}Speaker}{15}{section.1.8}}
\gdef \LT@xi {\LT@entry
{2}{139.76003pt}\LT@entry
{1}{45.25516pt}\LT@entry
{1}{149.98482pt}}
\@writefile{toc}{\contentsline {section}{\numberline {1.8}Terminal}{15}{section.1.8}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.8.1}Functions}{15}{subsection.1.8.1}}
\gdef \LT@x {\LT@entry
\@writefile{toc}{\contentsline {section}{\numberline {1.9}Terminal}{16}{section.1.9}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.9.1}Functions}{16}{subsection.1.9.1}}
\gdef \LT@xii {\LT@entry
{1}{22.26001pt}\LT@entry
{1}{39.16003pt}\LT@entry
{1}{22.26001pt}\LT@entry
@@ -79,64 +90,69 @@
{1}{49.88002pt}\LT@entry
{1}{22.26001pt}\LT@entry
{1}{58.02002pt}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.8.2}Standard Colours}{17}{subsection.1.8.2}}
\gdef \LT@xi {\LT@entry
\@writefile{toc}{\contentsline {subsection}{\numberline {1.9.2}Standard Colours}{18}{subsection.1.9.2}}
\gdef \LT@xiii {\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.8.3}Codepage}{18}{subsection.1.8.3}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.8.4}Accepted Control Sequences}{18}{subsection.1.8.4}}
\gdef \LT@xii {\LT@entry
\@writefile{toc}{\contentsline {subsection}{\numberline {1.9.3}Codepage}{19}{subsection.1.9.3}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.9.4}Accepted Control Sequences}{19}{subsection.1.9.4}}
\gdef \LT@xiv {\LT@entry
{2}{134.13005pt}\LT@entry
{1}{45.25516pt}\LT@entry
{1}{155.61479pt}}
\gdef \LT@xiii {\LT@entry
{2}{118.04002pt}\LT@entry
\gdef \LT@xv {\LT@entry
{2}{135.95003pt}\LT@entry
{2}{36.06001pt}\LT@entry
{1}{180.89996pt}}
\@writefile{toc}{\contentsline {section}{\numberline {1.9}Lua Globals}{19}{section.1.9}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.9.1}Functions}{19}{subsection.1.9.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.9.2}Constants}{19}{subsection.1.9.2}}
\gdef \LT@xiv {\LT@entry
{1}{162.98996pt}}
\@writefile{toc}{\contentsline {section}{\numberline {1.10}Lua Globals}{20}{section.1.10}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.10.1}Functions}{20}{subsection.1.10.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.10.2}Constants}{20}{subsection.1.10.2}}
\gdef \LT@xvi {\LT@entry
{1}{49.09001pt}\LT@entry
{1}{90.49004pt}\LT@entry
{1}{108.52003pt}\LT@entry
{1}{53.81001pt}\LT@entry
{1}{104.22pt}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.9.3}Bell Codes}{20}{subsection.1.9.3}}
\@writefile{toc}{\contentsline {section}{\numberline {1.10}Changes from Generic Lua Environment}{22}{section.1.10}}
{1}{122.25pt}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.10.3}Bell Codes}{22}{subsection.1.10.3}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.10.4}Changes from Generic Lua Environment}{22}{subsection.1.10.4}}
\gdef \LT@xvii {\LT@entry
{2}{94.0pt}\LT@entry
{1}{45.25516pt}\LT@entry
{1}{195.74484pt}}
\@writefile{toc}{\contentsline {section}{\numberline {1.11}Machine}{23}{section.1.11}}
\@writefile{lof}{\addvspace {10pt}}
\@writefile{lot}{\addvspace {10pt}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {2}Compatibility Layers---ComputerCraft}{23}{chapter.2}}
\gdef \LT@xv {\LT@entry
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {2}Compatibility Layers---ComputerCraft}{25}{chapter.2}}
\gdef \LT@xviii {\LT@entry
{2}{108.45001pt}\LT@entry
{2}{125.76003pt}}
\@writefile{toc}{\contentsline {section}{\numberline {2.1}Bit}{24}{section.2.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.1.1}Functions}{24}{subsection.2.1.1}}
\gdef \LT@xvi {\LT@entry
\@writefile{toc}{\contentsline {section}{\numberline {2.1}Bit}{26}{section.2.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.1.1}Functions}{26}{subsection.2.1.1}}
\gdef \LT@xix {\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}{25}{section.2.2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2.1}Constants}{25}{subsection.2.2.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2.2}Functions}{25}{subsection.2.2.2}}
\@writefile{toc}{\contentsline {section}{\numberline {2.3}Term}{26}{section.2.3}}
\@writefile{toc}{\contentsline {section}{\numberline {2.4}Filesystem}{27}{section.2.4}}
\@writefile{toc}{\contentsline {section}{\numberline {2.2}Colors}{27}{section.2.2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2.1}Constants}{27}{subsection.2.2.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2.2}Functions}{27}{subsection.2.2.2}}
\@writefile{toc}{\contentsline {section}{\numberline {2.3}Term}{28}{section.2.3}}
\@writefile{toc}{\contentsline {section}{\numberline {2.4}Filesystem}{29}{section.2.4}}
\@writefile{lof}{\addvspace {10pt}}
\@writefile{lot}{\addvspace {10pt}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {3}Compatibility Layers---OpenComputers}{29}{chapter.3}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {3}Compatibility Layers---OpenComputers}{31}{chapter.3}}
\@writefile{lof}{\addvspace {10pt}}
\@writefile{lot}{\addvspace {10pt}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {4}Peripherals}{31}{chapter.4}}
\gdef \LT@xvii {\LT@entry
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {4}Peripherals}{33}{chapter.4}}
\gdef \LT@xx {\LT@entry
{2}{71.78003pt}\LT@entry
{1}{45.25516pt}\LT@entry
{2}{153.90001pt}}
\@writefile{toc}{\contentsline {section}{\numberline {4.1}Line Printer}{32}{section.4.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {4.1.1}Functions}{32}{subsection.4.1.1}}
\@writefile{toc}{\contentsline {section}{\numberline {4.1}Line Printer}{34}{section.4.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {4.1.1}Functions}{34}{subsection.4.1.1}}
\@writefile{lof}{\addvspace {10pt}}
\@writefile{lot}{\addvspace {10pt}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {5}References}{33}{chapter.5}}
\memsetcounter{lastsheet}{35}
\memsetcounter{lastpage}{35}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {5}References}{35}{chapter.5}}
\memsetcounter{lastsheet}{37}
\memsetcounter{lastpage}{37}

View File

@@ -1,4 +1,4 @@
This is LuaTeX, Version beta-0.80.0 (TeX Live 2015) (rev 5238) (format=lualatex 2015.10.5) 28 SEP 2016 00:42
This is LuaTeX, Version beta-0.80.0 (TeX Live 2015) (rev 5238) (format=lualatex 2015.10.5) 29 SEP 2016 00:19
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.032 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'
@@ -1515,6 +1515,13 @@ Overfull \hbox (15.58pt too wide) in paragraph at lines 72--72
) [11
] (./api_os.tex
Underfull \hbox (badness 10000) in paragraph at lines 33--33
[][]|\EU2/MyriadPro(0)/m/n/10 Short month name. (e.g.
[]
) [12
] (./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
@@ -1530,179 +1537,164 @@ Underfull \hbox (badness 2707) in paragraph at lines 20--20
[][]|\EU2/MyriadPro(0)/m/n/10 En-codes in-put string as Base64
[]
) [12
) [13
] (./api_shell.tex) [13
] (./api_shell.tex) [14
] (./api_speaker.tex
Underfull \hbox (badness 6961) in paragraph at lines 10--10
[][]|\EU2/MyriadPro(0)/m/n/10 En-queues speaker driv-ing
[]
) [14
) [15
] (./api_terminal.tex
Underfull \hbox (badness 2165) in paragraph at lines 66--66
Underfull \hbox (badness 2165) in paragraph at lines 68--68
\EU2/MyriadPro(0)/m/n/10 nal. Graphic ter-mi-nals also can
[]
Underfull \hbox (badness 2932) in paragraph at lines 66--66
Underfull \hbox (badness 2932) in paragraph at lines 68--68
[][]|\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 66--66
Underfull \hbox (badness 2772) in paragraph at lines 68--68
[][]|\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 66--66
Underfull \hbox (badness 3118) in paragraph at lines 68--68
\EU2/MyriadPro(0)/m/n/10 ing con-trol se-quences as sym-
[]
Underfull \hbox (badness 1365) in paragraph at lines 66--66
Underfull \hbox (badness 1365) in paragraph at lines 68--68
[][]|\EU2/MyriadPro(0)/m/n/10 Clears whole screen buffer and
[]
Underfull \hbox (badness 5022) in paragraph at lines 66--66
Underfull \hbox (badness 5022) in paragraph at lines 68--68
[][]|\EU2/MyriadPro(0)/m/n/10 Re-turns cur-rent co-or-di-nates of
[]
Underfull \hbox (badness 10000) in paragraph at lines 66--66
Underfull \hbox (badness 10000) in paragraph at lines 68--68
[][]|\EU2/MyriadPro(0)/m/n/10 Re-turns cur-rent fore-ground
[]
Underfull \hbox (badness 10000) in paragraph at lines 66--66
Underfull \hbox (badness 10000) in paragraph at lines 68--68
[][]|\EU2/MyriadPro(0)/m/n/10 Re-turns cur-rent back-ground
[]
[15
[16
] [16]
] [17]
\cpimagew=\skip279
<mda.png, id=194, 4625.28pt x 1798.72pt>
<mda.png, id=206, 4625.28pt x 1798.72pt>
File: mda.png Graphic file (type png)
<use mda.png>
Package pdftex.def Info: mda.png used on input line 88.
Package pdftex.def Info: mda.png used on input line 90.
(pdftex.def) Requested size: 295.0pt x 114.69775pt.
Underfull \vbox (badness 10000) has occurred while \output is active []
[17]
Underfull \hbox (badness 6658) in paragraph at lines 109--109
[18]
Underfull \hbox (badness 6658) in paragraph at lines 111--111
[][]|\EU2/MyriadPro(0)/m/n/10 DEL. Backspace and deletes
[]
) [18<./mda.png>] (./luaglobals.tex
) [19<./mda.png>] (./luaglobals.tex
Underfull \hbox (badness 1092) in paragraph at lines 16--16
\EU2/MyriadPro(0)/m/n/10 ory in-stalled in the com-puter, in
[]
Underfull \hbox (badness 3168) in paragraph at lines 55--55
[][]|\EU2/MyriadPro(0)/m/n/10 EM dash rep-re-sented by box-drawing
Underfull \hbox (badness 10000) in paragraph at lines 55--55
[][]|\EU2/MyriadPro(0)/m/n/10 EM dash rep-re-sented by box-
[]
Underfull \hbox (badness 2050) in paragraph at lines 55--55
[][]|\EU2/MyriadPro(0)/m/n/10 Mid-dle dot used in ty-pog-ra-phy. Code
Underfull \hbox (badness 1264) in paragraph at lines 55--55
\EU2/MyriadPro(0)/m/n/10 0xFA (note: 0xF9 is a Dot Prod-uct
[]
Underfull \hbox (badness 5245) in paragraph at lines 55--55
[][]|\EU2/MyriadPro(0)/m/n/10 Ascii con-trol se-quence DC1. Used to
Underfull \hbox (badness 2591) in paragraph at lines 55--55
\EU2/MyriadPro(0)/m/n/10 change fore-ground colour to dim
[]
Underfull \hbox (badness 5245) in paragraph at lines 55--55
[][]|\EU2/MyriadPro(0)/m/n/10 Ascii con-trol se-quence DC2. Used to
[]
Underfull \hbox (badness 5245) in paragraph at lines 55--55
[][]|\EU2/MyriadPro(0)/m/n/10 Ascii con-trol se-quence DC3. Used to
[]
Underfull \hbox (badness 5245) in paragraph at lines 55--55
[][]|\EU2/MyriadPro(0)/m/n/10 Ascii con-trol se-quence DC4. Used to
[]
Underfull \hbox (badness 6364) in paragraph at lines 55--55
[][]|\EU2/MyriadPro(0)/m/n/10 Ascii con-trol se-quence DLE. Used to
[]
[19
] [20]) [21] (./luadifferences.tex) [22
[20
]
luaotfload | load : Lookup/name: "MyriadPro" -> "MyriadPro-Bold.otf" [23
Underfull \vbox (badness 10000) has occurred while \output is active []
] (./cc_bit.tex) [24
[21])
(./luadifferences.tex) [22] (./api_machine.tex) [23
] [24
]
(./cc_colors.tex) [25
luaotfload | load : Lookup/name: "MyriadPro" -> "MyriadPro-Bold.otf" [25] (./cc
_bit.tex)
[26
] [26
] [27
] (./cc_colors.tex) [27
] [28
] [29] [30
] [29
] [30
] [31] [32
] [31] (./peri_lp.tex) [32
] [33] (./peri_lp.tex)
[34
]
[33
] [34
] [35
] [36
] [37
]
\tf@toc=\write5
\openout5 = romapidoc.toc
Package atveryend Info: Empty hook `BeforeClearDocument' on input line 168.
Package atveryend Info: Empty hook `AfterLastShipout' on input line 168.
Package atveryend Info: Empty hook `BeforeClearDocument' on input line 173.
Package atveryend Info: Empty hook `AfterLastShipout' on input line 173.
(./romapidoc.aux)
Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 168.
Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 168.
Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 173.
Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 173.
Package rerunfilecheck Info: File `romapidoc.out' has not changed.
(rerunfilecheck) Checksum: 08AA264EF0CA42804AF136BDE97F5E44;2293.
Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line 168.
(rerunfilecheck) Checksum: 36E048903F7D7E12751FBA89BBC694EF;2202.
Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line 173.
)
Here is how much of LuaTeX's memory you used:
27283 strings out of 494693
27311 strings out of 494693
125070,662416 words of node,token memory allocated
780 words of node memory still in use:
782 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:14449,3:272,4:3579,5:1301,6:6145,7:343,8:22,9:884,10:390
30205 multiletter control sequences out of 65536+600000
avail lists: 2:15165,3:285,4:3728,5:1382,6:6439,7:355,8:23,9:917,10:405
30213 multiletter control sequences out of 65536+600000
62 fonts using 5300671 bytes
67i,12n,59p,1189b,492s stack positions out of 5000i,500n,10000p,200000b,100000s
</Library/Fonts/MyriadPro-It.otf></Library/Fonts/MyriadPro-Regular.otf></Library
/Fonts/MyriadPro-Bold.otf>
Output written on romapidoc.pdf (35 pages, 97609 bytes).
Output written on romapidoc.pdf (37 pages, 100709 bytes).
PDF statistics: 320 PDF objects out of 1000 (max. 8388607)
269 compressed objects within 3 object streams
91 named destinations out of 1000 (max. 131072)
161 words of extra memory for PDF output out of 10000 (max. 10000000)
PDF statistics: 339 PDF objects out of 1000 (max. 8388607)
286 compressed objects within 3 object streams
99 named destinations out of 1000 (max. 131072)
169 words of extra memory for PDF output out of 10000 (max. 10000000)

View File

@@ -3,18 +3,19 @@
\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\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\000S\000p\000e\000a\000k\000e\000r}{chapter.1}% 8
\BOOKMARK [1][-]{section.1.8}{\376\377\000T\000e\000r\000m\000i\000n\000a\000l}{chapter.1}% 9
\BOOKMARK [1][-]{section.1.9}{\376\377\000L\000u\000a\000\040\000G\000l\000o\000b\000a\000l\000s}{chapter.1}% 10
\BOOKMARK [1][-]{section.1.10}{\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}% 11
\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}{}% 12
\BOOKMARK [1][-]{section.2.1}{\376\377\000B\000i\000t}{chapter.2}% 13
\BOOKMARK [1][-]{section.2.2}{\376\377\000C\000o\000l\000o\000r\000s}{chapter.2}% 14
\BOOKMARK [1][-]{section.2.3}{\376\377\000T\000e\000r\000m}{chapter.2}% 15
\BOOKMARK [1][-]{section.2.4}{\376\377\000F\000i\000l\000e\000s\000y\000s\000t\000e\000m}{chapter.2}% 16
\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}{}% 17
\BOOKMARK [0][-]{chapter.4}{\376\377\000P\000e\000r\000i\000p\000h\000e\000r\000a\000l\000s}{}% 18
\BOOKMARK [1][-]{section.4.1}{\376\377\000L\000i\000n\000e\000\040\000P\000r\000i\000n\000t\000e\000r}{chapter.4}% 19
\BOOKMARK [0][-]{chapter.5}{\376\377\000R\000e\000f\000e\000r\000e\000n\000c\000e\000s}{}% 20
\BOOKMARK [1][-]{section.1.5}{\376\377\000O\000S}{chapter.1}% 6
\BOOKMARK [1][-]{section.1.6}{\376\377\000S\000e\000c\000u\000r\000i\000t\000y}{chapter.1}% 7
\BOOKMARK [1][-]{section.1.7}{\376\377\000S\000h\000e\000l\000l}{chapter.1}% 8
\BOOKMARK [1][-]{section.1.8}{\376\377\000S\000p\000e\000a\000k\000e\000r}{chapter.1}% 9
\BOOKMARK [1][-]{section.1.9}{\376\377\000T\000e\000r\000m\000i\000n\000a\000l}{chapter.1}% 10
\BOOKMARK [1][-]{section.1.10}{\376\377\000L\000u\000a\000\040\000G\000l\000o\000b\000a\000l\000s}{chapter.1}% 11
\BOOKMARK [1][-]{section.1.11}{\376\377\000M\000a\000c\000h\000i\000n\000e}{chapter.1}% 12
\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}{}% 13
\BOOKMARK [1][-]{section.2.1}{\376\377\000B\000i\000t}{chapter.2}% 14
\BOOKMARK [1][-]{section.2.2}{\376\377\000C\000o\000l\000o\000r\000s}{chapter.2}% 15
\BOOKMARK [1][-]{section.2.3}{\376\377\000T\000e\000r\000m}{chapter.2}% 16
\BOOKMARK [1][-]{section.2.4}{\376\377\000F\000i\000l\000e\000s\000y\000s\000t\000e\000m}{chapter.2}% 17
\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}{}% 18
\BOOKMARK [0][-]{chapter.4}{\376\377\000P\000e\000r\000i\000p\000h\000e\000r\000a\000l\000s}{}% 19
\BOOKMARK [1][-]{section.4.1}{\376\377\000L\000i\000n\000e\000\040\000P\000r\000i\000n\000t\000e\000r}{chapter.4}% 20
\BOOKMARK [0][-]{chapter.5}{\376\377\000R\000e\000f\000e\000r\000e\000n\000c\000e\000s}{}% 21

Binary file not shown.

View File

@@ -109,6 +109,9 @@
\section{Keys}
\input{api_keys}
\section{OS}
\input{api_os}
\section{Security}
\input{api_security}
@@ -123,10 +126,12 @@
\section{Lua Globals}
\input{luaglobals}
\section{Changes from Generic Lua Environment}
\subsection{Changes from Generic Lua Environment}
\input{luadifferences}
\section{Machine}
\input{api_machine}
\chapter[Compatibility Layers---ComputerCraft]{{\LARGE Compatibility Layers} \\ ComputerCraft}

View File

@@ -8,30 +8,33 @@
\contentsline {subsection}{\numberline {1.3.1}Functions}{10}{subsection.1.3.1}
\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 {section}{\numberline {1.6}Shell}{13}{section.1.6}
\contentsline {section}{\numberline {1.7}Speaker}{14}{section.1.7}
\contentsline {section}{\numberline {1.8}Terminal}{15}{section.1.8}
\contentsline {subsection}{\numberline {1.8.1}Functions}{15}{subsection.1.8.1}
\contentsline {subsection}{\numberline {1.8.2}Standard Colours}{17}{subsection.1.8.2}
\contentsline {subsection}{\numberline {1.8.3}Codepage}{18}{subsection.1.8.3}
\contentsline {subsection}{\numberline {1.8.4}Accepted Control Sequences}{18}{subsection.1.8.4}
\contentsline {section}{\numberline {1.9}Lua Globals}{19}{section.1.9}
\contentsline {subsection}{\numberline {1.9.1}Functions}{19}{subsection.1.9.1}
\contentsline {subsection}{\numberline {1.9.2}Constants}{19}{subsection.1.9.2}
\contentsline {subsection}{\numberline {1.9.3}Bell Codes}{20}{subsection.1.9.3}
\contentsline {section}{\numberline {1.10}Changes from Generic Lua Environment}{22}{section.1.10}
\contentsline {chapter}{\chapternumberline {2}Compatibility Layers---ComputerCraft}{23}{chapter.2}
\contentsline {section}{\numberline {2.1}Bit}{24}{section.2.1}
\contentsline {subsection}{\numberline {2.1.1}Functions}{24}{subsection.2.1.1}
\contentsline {section}{\numberline {2.2}Colors}{25}{section.2.2}
\contentsline {subsection}{\numberline {2.2.1}Constants}{25}{subsection.2.2.1}
\contentsline {subsection}{\numberline {2.2.2}Functions}{25}{subsection.2.2.2}
\contentsline {section}{\numberline {2.3}Term}{26}{section.2.3}
\contentsline {section}{\numberline {2.4}Filesystem}{27}{section.2.4}
\contentsline {chapter}{\chapternumberline {3}Compatibility Layers---OpenComputers}{29}{chapter.3}
\contentsline {chapter}{\chapternumberline {4}Peripherals}{31}{chapter.4}
\contentsline {section}{\numberline {4.1}Line Printer}{32}{section.4.1}
\contentsline {subsection}{\numberline {4.1.1}Functions}{32}{subsection.4.1.1}
\contentsline {chapter}{\chapternumberline {5}References}{33}{chapter.5}
\contentsline {section}{\numberline {1.5}OS}{12}{section.1.5}
\contentsline {subsection}{\numberline {1.5.1}Date Format String}{12}{subsection.1.5.1}
\contentsline {section}{\numberline {1.6}Security}{13}{section.1.6}
\contentsline {subsection}{\numberline {1.6.1}Functions}{13}{subsection.1.6.1}
\contentsline {section}{\numberline {1.7}Shell}{14}{section.1.7}
\contentsline {section}{\numberline {1.8}Speaker}{15}{section.1.8}
\contentsline {section}{\numberline {1.9}Terminal}{16}{section.1.9}
\contentsline {subsection}{\numberline {1.9.1}Functions}{16}{subsection.1.9.1}
\contentsline {subsection}{\numberline {1.9.2}Standard Colours}{18}{subsection.1.9.2}
\contentsline {subsection}{\numberline {1.9.3}Codepage}{19}{subsection.1.9.3}
\contentsline {subsection}{\numberline {1.9.4}Accepted Control Sequences}{19}{subsection.1.9.4}
\contentsline {section}{\numberline {1.10}Lua Globals}{20}{section.1.10}
\contentsline {subsection}{\numberline {1.10.1}Functions}{20}{subsection.1.10.1}
\contentsline {subsection}{\numberline {1.10.2}Constants}{20}{subsection.1.10.2}
\contentsline {subsection}{\numberline {1.10.3}Bell Codes}{22}{subsection.1.10.3}
\contentsline {subsection}{\numberline {1.10.4}Changes from Generic Lua Environment}{22}{subsection.1.10.4}
\contentsline {section}{\numberline {1.11}Machine}{23}{section.1.11}
\contentsline {chapter}{\chapternumberline {2}Compatibility Layers---ComputerCraft}{25}{chapter.2}
\contentsline {section}{\numberline {2.1}Bit}{26}{section.2.1}
\contentsline {subsection}{\numberline {2.1.1}Functions}{26}{subsection.2.1.1}
\contentsline {section}{\numberline {2.2}Colors}{27}{section.2.2}
\contentsline {subsection}{\numberline {2.2.1}Constants}{27}{subsection.2.2.1}
\contentsline {subsection}{\numberline {2.2.2}Functions}{27}{subsection.2.2.2}
\contentsline {section}{\numberline {2.3}Term}{28}{section.2.3}
\contentsline {section}{\numberline {2.4}Filesystem}{29}{section.2.4}
\contentsline {chapter}{\chapternumberline {3}Compatibility Layers---OpenComputers}{31}{chapter.3}
\contentsline {chapter}{\chapternumberline {4}Peripherals}{33}{chapter.4}
\contentsline {section}{\numberline {4.1}Line Printer}{34}{section.4.1}
\contentsline {subsection}{\numberline {4.1.1}Functions}{34}{subsection.4.1.1}
\contentsline {chapter}{\chapternumberline {5}References}{35}{chapter.5}