v1.6.0 - Removed low level libraries computer and component. They must now be imported.
This commit is contained in:
+2
-1
@@ -1,7 +1,7 @@
|
|||||||
local agcfg = {
|
local agcfg = {
|
||||||
["halyde"] = {
|
["halyde"] = {
|
||||||
["maindir"] = "",
|
["maindir"] = "",
|
||||||
["version"] = "1.5.0",
|
["version"] = "1.6.0",
|
||||||
["description"] = "A universal, customizable and feature-packed operating system for OpenComputers.",
|
["description"] = "A universal, customizable and feature-packed operating system for OpenComputers.",
|
||||||
["directories"] = {
|
["directories"] = {
|
||||||
"halyde/apps",
|
"halyde/apps",
|
||||||
@@ -48,6 +48,7 @@ local agcfg = {
|
|||||||
"halyde/core/shell.lua",
|
"halyde/core/shell.lua",
|
||||||
"halyde/core/termlib.lua",
|
"halyde/core/termlib.lua",
|
||||||
"halyde/lib/component.lua",
|
"halyde/lib/component.lua",
|
||||||
|
"halyde/lib/computer.lua",
|
||||||
"halyde/lib/event.lua",
|
"halyde/lib/event.lua",
|
||||||
"halyde/lib/filesystem.lua",
|
"halyde/lib/filesystem.lua",
|
||||||
"halyde/lib/raster.lua"
|
"halyde/lib/raster.lua"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Ahalyde/core/
|
|||||||
Ahalyde/config/
|
Ahalyde/config/
|
||||||
Ahalyde/apps/helpdb/
|
Ahalyde/apps/helpdb/
|
||||||
Ahalyde/apps/
|
Ahalyde/apps/
|
||||||
V1.5.0
|
V1.6.0
|
||||||
Ainit.lua
|
Ainit.lua
|
||||||
Ahalyde/apps/helpdb/cat.txt
|
Ahalyde/apps/helpdb/cat.txt
|
||||||
Ahalyde/apps/helpdb/cd.txt
|
Ahalyde/apps/helpdb/cd.txt
|
||||||
@@ -41,6 +41,7 @@ Ahalyde/core/fullkb.lua
|
|||||||
Ahalyde/core/shell.lua
|
Ahalyde/core/shell.lua
|
||||||
Ahalyde/core/termlib.lua
|
Ahalyde/core/termlib.lua
|
||||||
Ahalyde/lib/component.lua
|
Ahalyde/lib/component.lua
|
||||||
|
Ahalyde/lib/computer.lua
|
||||||
Ahalyde/lib/event.lua
|
Ahalyde/lib/event.lua
|
||||||
Ahalyde/lib/filesystem.lua
|
Ahalyde/lib/filesystem.lua
|
||||||
Ahalyde/lib/raster.lua
|
Ahalyde/lib/raster.lua
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ if not fs.exists(fromFile) then
|
|||||||
print("\27[91mSource file does not exist.")
|
print("\27[91mSource file does not exist.")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if fs.exists(toFile) and not (table.find(args, "-o") or table.find(args, "--overwrite")) then
|
if fs.exists(toFile) and not (table.find({...}, "-o") or table.find({...}, "--overwrite")) then
|
||||||
print("\27[91mDestination file already exists. Run this command again with -o to overwrite it.")
|
print("\27[91mDestination file already exists. Run this command again with -o to overwrite it.")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
local component = import("component")
|
||||||
|
local computer = import("computer")
|
||||||
|
|
||||||
local function printstat(text)
|
local function printstat(text)
|
||||||
termlib.cursorPosX = 35
|
termlib.cursorPosX = 35
|
||||||
print(text, true, false)
|
print(text, true, false)
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ end
|
|||||||
if not fs.exists(fromFile) then
|
if not fs.exists(fromFile) then
|
||||||
print("\27[91mSource file does not exist.")
|
print("\27[91mSource file does not exist.")
|
||||||
end
|
end
|
||||||
if fs.exists(toFile) and not (table.find(args, "-o") or table.find(args, "--overwrite")) then
|
if fs.exists(toFile) and not (table.find({...}, "-o") or table.find({...}, "--overwrite")) then
|
||||||
print("\27[91mDestination file already exists. Run this command again with -o to overwrite it.")
|
print("\27[91mDestination file already exists. Run this command again with -o to overwrite it.")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
/halyde/core/datatools.lua
|
|
||||||
/halyde/core/fullkb.lua
|
/halyde/core/fullkb.lua
|
||||||
/halyde/core/evmgr.lua
|
/halyde/core/evmgr.lua
|
||||||
/halyde/core/shell.lua
|
/halyde/core/shell.lua
|
||||||
|
|||||||
+22
-4
@@ -1,7 +1,7 @@
|
|||||||
local loadfile = ...
|
local loadfile = ...
|
||||||
local filesystem = loadfile("/halyde/lib/filesystem.lua")(loadfile)
|
local filesystem = loadfile("/halyde/lib/filesystem.lua")(loadfile)
|
||||||
|
|
||||||
_G._OSVERSION = "Halyde 1.5.0"
|
_G._OSVERSION = "Halyde 1.6.0"
|
||||||
_G._OSLOGO = ""
|
_G._OSLOGO = ""
|
||||||
local handle, tmpdata = filesystem.open("/halyde/config/oslogo.ans", "r"), nil
|
local handle, tmpdata = filesystem.open("/halyde/config/oslogo.ans", "r"), nil
|
||||||
repeat
|
repeat
|
||||||
@@ -40,8 +40,15 @@ gpu.bind(screenAddress)
|
|||||||
--gpu.setResolution(targetWidth, targetHeight)
|
--gpu.setResolution(targetWidth, targetHeight)
|
||||||
gpu.setResolution(gpu.maxResolution())
|
gpu.setResolution(gpu.maxResolution())
|
||||||
|
|
||||||
|
_G.package = {["preloaded"] = {}}
|
||||||
|
|
||||||
|
loadfile("/halyde/core/datatools.lua")()
|
||||||
|
|
||||||
function _G.import(module, ...)
|
function _G.import(module, ...)
|
||||||
local args = table.pack(...)
|
local args = table.pack(...)
|
||||||
|
if package.preloaded[module] then
|
||||||
|
return package.preloaded[module]
|
||||||
|
end
|
||||||
local modulepath
|
local modulepath
|
||||||
if module:find("^/") then
|
if module:find("^/") then
|
||||||
if filesystem.exists(module) then
|
if filesystem.exists(module) then
|
||||||
@@ -53,9 +60,7 @@ function _G.import(module, ...)
|
|||||||
modulepath = shell.workingDirectory..module
|
modulepath = shell.workingDirectory..module
|
||||||
end
|
end
|
||||||
assert(modulepath, "module not found\npossible locations:\n/halyde/lib/"..module..".lua")
|
assert(modulepath, "module not found\npossible locations:\n/halyde/lib/"..module..".lua")
|
||||||
local handle = filesystem.open(modulepath)
|
local handle, data, tmpdata = filesystem.open(modulepath), "", nil
|
||||||
local data = ""
|
|
||||||
local tmpdata = ""
|
|
||||||
repeat
|
repeat
|
||||||
tmpdata = handle:read(math.huge or math.maxinteger)
|
tmpdata = handle:read(math.huge or math.maxinteger)
|
||||||
data = data .. (tmpdata or "")
|
data = data .. (tmpdata or "")
|
||||||
@@ -63,6 +68,19 @@ function _G.import(module, ...)
|
|||||||
return(assert(load(data, "="..modulepath))(table.unpack(args)))
|
return(assert(load(data, "="..modulepath))(table.unpack(args)))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function preload(module)
|
||||||
|
local handle, data, tmpdata = assert(filesystem.open("/halyde/lib/" .. module .. ".lua", "r")), "", nil
|
||||||
|
repeat
|
||||||
|
tmpdata = handle:read(math.huge or math.maxinteger)
|
||||||
|
data = data .. (tmpdata or "")
|
||||||
|
until not tmpdata
|
||||||
|
package.preloaded[module] = assert(load(data, "="..module))()
|
||||||
|
_G[module] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
preload("component")
|
||||||
|
preload("computer")
|
||||||
|
|
||||||
--local handle = assert(filesystem.open("/bazinga.txt", "w"))
|
--local handle = assert(filesystem.open("/bazinga.txt", "w"))
|
||||||
--assert(handle:write("Bazinga!"))
|
--assert(handle:write("Bazinga!"))
|
||||||
--handle:close()
|
--handle:close()
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ _G.cormgr.corList = {}
|
|||||||
|
|
||||||
--local ocelot = component.proxy(component.list("ocelot")())
|
--local ocelot = component.proxy(component.list("ocelot")())
|
||||||
|
|
||||||
|
local component = import("component")
|
||||||
local filesystem = import("filesystem")
|
local filesystem = import("filesystem")
|
||||||
local gpu = component.proxy(component.list("gpu")())
|
local gpu = component.proxy(component.list("gpu")())
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ _G.evmgr = {}
|
|||||||
_G.evmgr.eventQueue = {}
|
_G.evmgr.eventQueue = {}
|
||||||
local maxEventQueueLength = 10 -- increase if events start getting dropped
|
local maxEventQueueLength = 10 -- increase if events start getting dropped
|
||||||
|
|
||||||
|
local computer = import("computer")
|
||||||
|
|
||||||
keyboard.ctrlDown = false
|
keyboard.ctrlDown = false
|
||||||
keyboard.altDown = false
|
keyboard.altDown = false
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ local shellcfg = import("/halyde/config/shell.cfg")
|
|||||||
import("/halyde/core/termlib.lua")
|
import("/halyde/core/termlib.lua")
|
||||||
local event = import("event")
|
local event = import("event")
|
||||||
local filesystem = import("filesystem")
|
local filesystem = import("filesystem")
|
||||||
|
local component = import("component")
|
||||||
local gpu = component.proxy(component.list("gpu")())
|
local gpu = component.proxy(component.list("gpu")())
|
||||||
|
|
||||||
_G.shell = {}
|
_G.shell = {}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ local event = import("event")
|
|||||||
--local keyboard = import("keyboard")
|
--local keyboard = import("keyboard")
|
||||||
|
|
||||||
--local ocelot = component.proxy(component.list("ocelot")())
|
--local ocelot = component.proxy(component.list("ocelot")())
|
||||||
|
local component = import("component")
|
||||||
local gpu = component.proxy(component.list("gpu")()) -- replace with component.gpu once implemented
|
local gpu = component.proxy(component.list("gpu")()) -- replace with component.gpu once implemented
|
||||||
_G.termlib = {}
|
_G.termlib = {}
|
||||||
termlib.cursorPosX = 1
|
termlib.cursorPosX = 1
|
||||||
|
|||||||
@@ -19,4 +19,4 @@ end
|
|||||||
|
|
||||||
componentlib.invoke = component.invoke
|
componentlib.invoke = component.invoke
|
||||||
|
|
||||||
return(componentlib)
|
return componentlib
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
local computerlib = table.copy(computer)
|
||||||
|
local LLcomputer = table.copy(computer)
|
||||||
|
|
||||||
|
function computerlib.pullSignal(timeout)
|
||||||
|
local startTime = LLcomputer.uptime()
|
||||||
|
local result
|
||||||
|
repeat
|
||||||
|
result = {LLcomputer.pullSignal(0)}
|
||||||
|
coroutine.yield()
|
||||||
|
until result or timeout and LLcomputer.uptime() >= startTime + timeout
|
||||||
|
return table.unpack(result)
|
||||||
|
end
|
||||||
|
|
||||||
|
return computerlib
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
local computer = import("computer")
|
||||||
local event = {}
|
local event = {}
|
||||||
|
|
||||||
--local ocelot = component.proxy(component.list("ocelot")())
|
--local ocelot = component.proxy(component.list("ocelot")())
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
local loadfile = ... -- raw loadfile from boot.lua
|
local loadfile = ... -- raw loadfile from boot.lua
|
||||||
local component
|
local component, computer
|
||||||
|
|
||||||
if loadfile then
|
if loadfile then
|
||||||
component = loadfile("/halyde/lib/component.lua")(loadfile)
|
component = loadfile("/halyde/lib/component.lua")(loadfile)
|
||||||
|
computer = _G.computer
|
||||||
elseif import then
|
elseif import then
|
||||||
component = import("component")
|
component = import("component")
|
||||||
|
computer = import("computer")
|
||||||
end
|
end
|
||||||
|
|
||||||
local filesystem = {}
|
local filesystem = {}
|
||||||
@@ -127,15 +129,6 @@ function filesystem.size(path)
|
|||||||
return component.invoke(address, "size", absPath)
|
return component.invoke(address, "size", absPath)
|
||||||
end
|
end
|
||||||
|
|
||||||
function filesystem.isDirectory(path)
|
|
||||||
checkArg(1, path, "string")
|
|
||||||
local address, absPath = filesystem.absolutePath(path)
|
|
||||||
if not address then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
return component.invoke(address, "isDirectory", absPath)
|
|
||||||
end
|
|
||||||
|
|
||||||
function filesystem.rename(fromPath, toPath)
|
function filesystem.rename(fromPath, toPath)
|
||||||
checkArg(1, fromPath, "string")
|
checkArg(1, fromPath, "string")
|
||||||
checkArg(2, toPath, "string")
|
checkArg(2, toPath, "string")
|
||||||
|
|||||||
@@ -21,26 +21,26 @@ function loadthething()
|
|||||||
loadfile("/halyde/core/boot.lua")(loadfile)
|
loadfile("/halyde/core/boot.lua")(loadfile)
|
||||||
end
|
end
|
||||||
|
|
||||||
while true do
|
gpu.setBackground(0x000000)
|
||||||
|
gpu.fill(1, 1, resx, resy, " ")
|
||||||
|
local result, reason = xpcall(loadthething, handleError)
|
||||||
|
if not result then
|
||||||
|
local computer = import("computer") or computer
|
||||||
gpu.setBackground(0x000000)
|
gpu.setBackground(0x000000)
|
||||||
gpu.fill(1, 1, resx, resy, " ")
|
gpu.fill(1, 1, resx, resy, " ")
|
||||||
local result, reason = xpcall(loadthething, handleError)
|
gpu.setBackground(0x800000)
|
||||||
if not result then
|
gpu.setForeground(0xFFFFFF)
|
||||||
gpu.setBackground(0x000000)
|
gpu.set(2,2,"A critical error has occurred.")
|
||||||
gpu.fill(1, 1, resx, resy, " ")
|
local i = 4
|
||||||
gpu.setBackground(0x800000)
|
reason = reason:gsub("\t", " ")
|
||||||
gpu.setForeground(0xFFFFFF)
|
for line in string.gmatch((reason ~= nil and tostring(reason)) or "unknown error", "([^\n]*)\n?") do
|
||||||
gpu.set(2,2,"A critical error has occurred.")
|
gpu.set(2,i,line)
|
||||||
local i = 4
|
i = i + 1
|
||||||
reason = reason:gsub("\t", " ")
|
|
||||||
for line in string.gmatch((reason ~= nil and tostring(reason)) or "unknown error", "([^\n]*)\n?") do
|
|
||||||
gpu.set(2,i,line)
|
|
||||||
i = i + 1
|
|
||||||
end
|
|
||||||
gpu.set(2,i+1, "Press any key to restart.")
|
|
||||||
local evname = ""
|
|
||||||
repeat
|
|
||||||
evname = computer.pullSignal()
|
|
||||||
until evname == "key_down"
|
|
||||||
end
|
end
|
||||||
|
gpu.set(2,i+1, "Press any key to restart.")
|
||||||
|
local evname
|
||||||
|
repeat
|
||||||
|
evname = computer.pullSignal()
|
||||||
|
until evname == "key_down"
|
||||||
|
computer.shutdown(true)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user