mirror of
https://github.com/CCLeonOS/LeonOS.git
synced 2026-03-03 15:17:01 +00:00
feat: 初始提交 LeonOS 实现
添加 LeonOS 的基本实现,包括: - 核心 API 模块(colors, disk, gps, keys, multishell, parallel, rednet, redstone, settings, vector) - 命令行程序(about, alias, bg, clear, copy, delete, edit, fg, help, list, lua, mkdir, move, paint, peripherals, programs, reboot, set, shutdown, threads) - 系统启动脚本和包管理 - 文档(README.md, LICENSE) - 开发工具(devbin)和更新程序 实现功能: - 完整的线程管理系统 - 兼容 ComputerCraft 的 API 设计 - 改进的 shell 和命令补全系统 - 多标签终端支持 - 设置管理系统
This commit is contained in:
118
NEW_FEATURES.txt
Normal file
118
NEW_FEATURES.txt
Normal file
@@ -0,0 +1,118 @@
|
||||
NEW IN LeonOS
|
||||
|
||||
The following is a non-exhaustive list of new
|
||||
and/or changed features in LeonOS compared to
|
||||
LeonOS.
|
||||
|
||||
!!!! THIS FILE IS OUTDATED !!!!
|
||||
|
||||
See https://ocaweso.me/LeonOS for more
|
||||
up-to-date documentation.
|
||||
|
||||
Major Changes
|
||||
=============
|
||||
|
||||
- `os.loadAPI` has been completely omitted.
|
||||
- * All APIs except the standard Lua ones must be
|
||||
loaded using `require` before they can be used.
|
||||
- * Lua 5.1 builtins have been removed from `_G`,
|
||||
but can be accessed through `require("lua51")`.
|
||||
- Startup scripts from /startup are run in
|
||||
parallel as separate threads.
|
||||
- LeonOS has full native support for
|
||||
multithreading -- custom schedulers are no
|
||||
longer necessary!
|
||||
- Multishell can be used even on standard (non-
|
||||
advanced) computers, using Alt+Left and
|
||||
Alt+Right to switch tabs. There is no
|
||||
dedicated Multishell program - only the API. A
|
||||
Multishell instance may be started at any time
|
||||
using multishell.launch.
|
||||
|
||||
* These do not apply when compatibility mode is
|
||||
enabled - see "Compatibility Mode" below.
|
||||
|
||||
|
||||
New API Methods
|
||||
===============
|
||||
|
||||
LeonOS features a few extensions to the LeonOS
|
||||
APIs:
|
||||
|
||||
- textutils.coloredWrite(...):
|
||||
Similar to textutils.tabulate(), but takes
|
||||
strings instead of tables and doesn't tabulate
|
||||
its arguments. Useful for easy printing of
|
||||
colorized text. Returns the number of lines
|
||||
written.
|
||||
|
||||
- textutils.coloredPrint(...):
|
||||
Like textutils.coloredWrite(), but prints an
|
||||
extra newline at the end of the text, similar
|
||||
to print().
|
||||
|
||||
- Tables given to textutils.tabulate() may
|
||||
contain tables, along with strings and numbers;
|
||||
if a table is present, it must contain a set of
|
||||
arguments suitable for passing to
|
||||
textutils.coloredWrite().
|
||||
|
||||
- LeonOS's paintutils API uses the BIMG (Blit
|
||||
Image) format for its images. This format
|
||||
supports animations and lots of other useful
|
||||
metadata, plus combining text and images.
|
||||
See https://github.com/SkyTheCodeMaster/bimg
|
||||
for details on the format.
|
||||
|
||||
|
||||
The Multishell foreground thread management
|
||||
functions should only be used when absolutely
|
||||
necessary. If they ARE necessary, these should be
|
||||
used instead of the corresponding thread API
|
||||
functions regardless of whether multishell is
|
||||
actually enabled, to ensure proper behavior when it
|
||||
is enabled.
|
||||
|
||||
The foreground thread is the only thread that will
|
||||
respond to terminate events. Ensuring that it is
|
||||
set correctly is therefore quite important. Under
|
||||
most circumstances you should not need to use these
|
||||
functions, since shell.run() uses them behind the
|
||||
scenes.
|
||||
|
||||
These should not be confused with Multishell's
|
||||
getFocus() and setFocus() functions, which manage
|
||||
the focused tab.
|
||||
|
||||
- multishell.getForeground():
|
||||
Returns the foreground thread ID of the current
|
||||
tab.
|
||||
|
||||
- multishell.pushForeground(pid):
|
||||
Adds a thread to the current tab's foreground
|
||||
stack; the given thread will be removed when
|
||||
it exits.
|
||||
|
||||
- multishell.switchForeground(pid):
|
||||
Changes the top entry of the current tab's
|
||||
foreground stack; removes the old entry.
|
||||
|
||||
- multishell.launch()'s first argument, the
|
||||
environment, is optional and may be completely
|
||||
omitted.
|
||||
|
||||
|
||||
Compatibility Mode
|
||||
==================
|
||||
|
||||
When the bios.compat_mode setting is set, LeonOS
|
||||
will enter LeonOS compatibility mode. This
|
||||
disables strict global checking and places all
|
||||
relevant functions and APIs into _G. In
|
||||
compatibility mode, os.version() returns
|
||||
"LeonOS 1.8" rather than the current LeonOS
|
||||
version.
|
||||
|
||||
This mode should only be used when necessary. New
|
||||
programs should use proper Lua coding conventions
|
||||
and therefore work without it.
|
||||
Reference in New Issue
Block a user