4787 Commits

Author SHA1 Message Date
payonel
ae501a859d return true from thread method as per documented specification 2017-09-07 10:34:47 -07:00
payonel
fc486d4bd2 openos 1.6.8 update
Changes

* thread: fix coma state issue where thread would not resume
* thread: add thread.current(), returns current thread [ the init thread is still technically not a thread ]
* tty: simplify the api with read, and separate all stream methods from the library
* sleep: /bin/sleep will now show blinking cursor and can be interrupted
* echo: use io.write instead of print. print loads slightly more resources
2017-09-07 08:40:30 -07:00
payonel
a1512451fe support s and u vt100 codes
strangely, the real terminal appears to treat [su] the exact same as [78] even though the specification says [su] is position only
2017-08-23 12:24:05 -07:00
payonel
c4c3811376 revert removal of process.running -- some scripts still use it 2017-08-22 11:22:06 -07:00
payonel
2a178f6d41 fix quiet /bin/source
quiet mode in /bin/source was a mess -- making .shrc scripts not able to print. Also, a lot of the /bin/sh arg parsing code has traditionally been over complicated. cleaned that up as well thanks to old code that expected strings in the args having been removed some time ago
2017-08-08 18:45:36 -07:00
payonel
f00c2dd6a2 simplify tty check slightly and add comment that tty should not be used directly by user code
maybe i should just move tty to /lib/core
2017-08-08 18:45:36 -07:00
Florian "Sangar" Nücke
40ca104a75 Merge pull request #2402 from loveyanbei/master-MC1.7.10
Add zh_CN localization of manual .and tried to fix the infinite loop bug
2017-07-22 15:47:52 +02:00
Florian "Sangar" Nücke
fb77e0ed24 Merge branch 'master-MC1.7.10' into master-MC1.7.10 2017-07-22 15:47:17 +02:00
Florian "Sangar" Nücke
e045f7c3e0 Merge pull request #2460 from cyber01/RU_doc
Upgrading Russian translation to the current state
2017-07-22 15:12:35 +02:00
Florian "Sangar" Nücke
4023d3f4af Merge branch 'master-MC1.7.10' into RU_doc 2017-07-22 15:12:03 +02:00
Florian Nücke
cdc8b2d792 Fix for infinite loop in manual, closes #2395. 2017-07-22 14:50:56 +02:00
payonel
de080b28ef Add SHODAN to list of robot names
Adds a recognizable AI not on this list, SHODAN from the System Shock games.
2017-07-19 22:33:54 -07:00
payonel
e4c0df8bfa Add tree utility 2017-07-19 22:33:41 -07:00
cyber01
9fbef39829 Upgrading to the current state (compared to the original OS), translated the missing parts. Merged with @MoonlightOwl changes 2017-07-13 11:31:30 +03:00
payonel
3d6e77f879 fix gsub issue: lua 5.3 changed from lua 5.2 2017-07-08 00:47:19 -07:00
payonel
d753d83bb4 reverting read handler weirdness, it didn't work right
Users shouldn't use tty read nor write directly, they should always use io or term. But...it is messy to try to hide these methods as private methods in the io library, so I'll just have to check the io tty-ness just in case
2017-07-07 22:47:03 -07:00
gamax92
fabbb630d4 Make wtrunc count missing glyphs as 1
otherwise this function has odd behavior when compared with wlen
2017-07-07 21:22:47 -07:00
payonel
e1e2e3c800 ansi code LS_COLORS, blinking, cyan, and multicolor codes
LS_COLORS now respects linux style ansi code list, and /bin/ls has been updated to respect that
cursor blinking ws being reset too often that has been fixed
cyan ideally should be 0x00ffff, but that colors becomes green when switching bit depths. Thus, openos will use 0x00B6FF for ansi code for cyan
fixed some vt100 color list parsing
2017-07-07 10:11:59 -07:00
payonel
4b286e2479 fix /bin/install to not suggest source of only rw option 2017-07-04 15:35:21 -07:00
payonel
ed05bd11b7 fix cyan/magenta in vt100 color - thanks @LeshaInc 2017-07-04 12:01:51 -07:00
payonel
0527390466 vt100 support
* huge terminal performance boost
* echo -e option, interpret backslashes
* favor io.write instead of print on low level code as print is slightly more memory expensive
* use vt100 ansi color coding for PS1
* use tty as std io back end stream
* consolidate buffer delay code
* add ctrl+backspace and ctrl+w options in io.read
* delay load more
* term code cleanup
* add buffer:size(), returns size of pending data on the stream
* memory free 59k
* openos 1.6.7
2017-07-04 01:58:42 -07:00
payonel
0c595ddda7 remove needless not nots 2017-06-26 09:24:25 -07:00
payonel
e57d763f3a some install fixes 2017-06-26 00:03:40 -07:00
payonel
c988b44f66 openos 1.6.6
More memory savings, significant boot time savings

**Memory Savings**
The largest library in terms of cost in bytes in 1.6.5 was /lib/filesystem. Most of this library is not needed for boot, and in 1.6.6 the library is half loaded for boot with a delay load of the rest of the library when needed. There are also other minor memory improvements, see **Changes** for details

**Boot Time**
This update also introduces a newly written /bin/sh.lua that takes advantage of a common stdio system. This work was primary done to reduce memory needed to load the shell. However, during development of a simplified /bin/sh, I found that the /bin/source, /etc/profile, and /home/.shrc feature added to openos 1.6 had a significant boot time cost. I began optimizing /bin/source heavily and found that I could not make sufficient speed improvements due to the nature of how shell commands execute. Thus /etc/profile has been removed in favor of /etc/profile.lua, a script that sets up the environment the same but as a lua script. ~/.shrc is still honored if it exists on a system, and is sourced (/bin/source) as a set of shell commands. This change speeds up boot time from floppy by 3s, and on hdds by 1s.

**Possible Breaking Changes**
/etc/profile has been moved to /etc/profile.lua, but /home/.shrc is still sourced as shell script commands.

**Changes**
* /bin/sh.lua rewrite that takes advantage of standard io and uses the new /etc/profile.lua shaving 6s off boot time
* /bin/source.lua improve performance by reducing the number of processes created
* move /etc/profile to /etc/profile.lua and recode the actions in lua-form.
* move all ~/.shrc actions to /etc/profile.lua for performance reasons
* move motd to start of /etc/profile.lua to get the shell display as soon as possible
* update greetings that referenced /etc/profile to properly refer to /etc/profile.lua now
* update openos version to 1.6.6 to respect the impact of these changes
2017-06-26 00:03:40 -07:00
payonel
83a37af8cb woops - lua_shell using io.write doesn't need to pass true to wrap 2017-06-25 16:18:16 -07:00
payonel
5d81f51570 rename _ as self in tty cursor as it should be and move tty.write to term.write 2017-06-25 10:03:15 -07:00
payonel
dc7a194020 moving /opt/core to /lib/core 2017-06-25 09:31:58 -07:00
payonel
e3525d9a00 safer to try to load a library full before removing metatable in case of oom 2017-06-25 09:11:20 -07:00
payonel
6a2586b536 bisect filesystem lib for memory reduction to boot to shell 2017-06-24 23:43:19 -07:00
payonel
f40bad3fba protect env.load if defined, else use mt. simplify free by using io.write as print loads buffered_write 2017-06-24 20:25:45 -07:00
payonel
90fdcc19c5 keep env clean with intercepted loads
also remove unused vars and some light code clean up
moving some methods out of tty into delay loaded space for memory
fix print from overwriting vbuf settings on stdout
fix regression for expanding ${VAR}
closes #2434
2017-06-24 09:04:11 -07:00
SDPhantom
f9f3789729 Optimized sleep.lua interval parsing (#2436)
* Optimized sleep.lua interval parsing

Modified regex to use captures, consolidated invalid interval checks.
Note: tonumber(nil) safely returns nil

* Update sleep.lua

Updated pattern matching
2017-06-23 15:52:47 -07:00
payonel
cdfdb277f6 replacing yield_all with yield_past to control stack yielding
This change should allow popen, pipes, and threads to specify with exactness how many coroutines back they want to yield. This makes popen and threads immune to internal coroutine scenarios

Also using a code cleanup provided by @SDPhantom
2017-06-22 19:07:07 -07:00
SDPhantom
da059756b9 Optimized filesystem.name() / Fix filesystem.copy() (#2432)
* Fixed possible error reporting bug in filesystem.copy()

Made local data initialize to false. Previously was nil and if the function was unable to open either file, this would cause the function to return true as its first value. data becomes nil when copying is finished, so this sorts itself out.
Added arg checking to filesystem.name
2017-06-22 19:03:06 -07:00
payonel
ed99999119 tty needs to load full when loading term library due to meta-metatabling 2017-06-21 00:45:00 -07:00
payonel
e684e588ef support yield through pipes 2017-06-21 00:25:43 -07:00
payonel
5fdee17fcd openos 1.6.5 update fixes and optimizations, one api removed
process: process.running has been deprecated for over 2 years and is now obsolete, please use process.info
process: added process.internal.run designed to run a coroutine to completion
01_process: cleaner coroutine_handler intercept code
event: removed unnecessary local function and added an optional handlers param to register to simplify thread code
io: update popen to use new /lib/pipe.lua library
pipe: new /lib/pipe replace /lib/pipes
> superior coroutine stack code, can reparent stacks
> handles all pipe work, sh calls /lib/pipe now for pipes
sh: now uses /lib/pipe to build pipe chains, calls shell.run to run a pipe chain.
thread: greatly improved reliability of embedded and detached threads
boot: removed dead code
2017-06-21 00:25:43 -07:00
payonel
a61204aee8 Critical fix for threads, small fixes for /bin/edit, /lib/process, greetings, and term.read
thread fix:
Significant quality update for embedded threads (threads inside threads inside threads...) Also, added a "thread_exit" event. This is not yet official, I may add more meta data to the event later.

/bin/edit:
Found a case where text was being trimmed where it doesn't need to be

/lib/process
protect a .. operator from crashes with a tostring

greetings
updated the comment in a greeting, you can no longer just remove /etc/motd without a stderr error about the file missing on boot (without changing your /etc/profile)

/lib/term
term.read() was behaving as io.read() for tty, and as io.read("*l") for non-tty, now they both use *L
2017-06-21 00:25:43 -07:00
Love_Sara_Lee
b82f40a5bd remove accidental indent change 2017-06-15 14:26:12 +08:00
Vexatos
2ee3a1a119 Made tank controllers work better with blocks that provide multiple tanks. 2017-06-12 11:06:12 -07:00
payonel
1ce5e06df2 send drop even without drag 2017-06-12 10:53:50 -07:00
Nexarius
5383b641e7 Update robot.names 2017-06-11 09:20:29 -07:00
payonel
74d77b1fdf fix: dispatch interrupts to all handlers, pipe coroutine resume status, term.read(), and thread waitForAll() fixes 2017-06-10 19:00:11 -07:00
payonel
067f217813 openos 1.6.4
the "thread" update

**Threads**
OpenOS 1.6.4 brings the new thread library api. Documentation in our ocdoc wiki soon to come. An openos thread is an autonomous non-blocking detachable child process
 * Autonomous: Threads asynchronously begin execution immediately after creation without needing to call resume. The thread proc may call coroutine.yield, but will resume on its own
 * Non-Blocking: Threads can call computer.pullSignal (or any higher level wrapper such as event.pull, io.pull, etc) without blocking the main kernel process nor any other thread
 * Detachable: By default, threads are scoped to the process in which they are created, i.e. their parent process. Any thread will block the parent process from closing unless:
  A. The thread detaches from the parent process. In which case it does not block any process and runs independently, e.g. `t:detach()`
  or
  B. The parent process throws an exception or calls os.exit in which case all attached threads are killed, e.g. `os.exit()`
  or
  C. The thread is manually suspended, e.g. `t:suspend()`

**Command Redirection**
The other major improvement in this update is highly improved shell parsing for command substitution and io redirection. Some highlights include
 * Can place before the command now, e.g. `2>/dev/null ./run_my_scripts.lua`
 * Can properly use globbing or env vars as redirect targets, e.g. `./run_my_scripts.lua >$my_log_file`
 * Fixed various bugs related to redirect and argument evaluation

**Memory**
50k free! As I love to do, this update reduces memory allocation needed to reach the shell prompt. The majority of the recent memory improvements are not just delaying allocation, but actual code cleanup and optimizations. Many of the changes are minor but they are numerous. With 1 stick of tier 1 RAM, openos reaches shell with 50k bytes free.

Changelog:
Bump version from 1.6.3 to 1.6.4
Cause grep to yield when taking too long
Remove additional gpu.bind calls during boot, reduces the number of screen resize calls
Move SHELL env var creation to /boot/94_shell.lua - This is an important user workflow fix to allow users to specify a custom SHELL without openos ever needing to load /bin/sh and its libraries
Fix event dispatch to not double call event timers in some scenarios
new /lib/thread.lua
fixed /lib/process from hiding exceptions in some scenarios
significant memory optimizations and code cleanup for /bin/sh
refactoring of command redirection, variable evaluation, glob expansion, and argument lists in /bin/sh
fixed term.setCursorBlink so that it properly waits for inf time for the next event when not blinking, rather than pulling every .5 seconds
fixed /bin/sh shell from losing exit_code when using || and && with multiple commands
fix /bin/lua error message when using os.exit
cherry picking serialization fix from 62471f7d320758bebb280666ed98388ea61cb4c8
2017-06-10 19:00:11 -07:00
payonel
06a0861597 OpenOS 1.6.3 update (#2414)
Why a version change?
> This minor version change should not introduce breaking changes, but older code doing non standard things with process environments, `require` and the package library, shebang redirections, or direct calls to /bin/lua, may see some breakages. Also, `shell.resolve` has been fully reworked. This is a crucial and heavily used api. Thus, in case of any mistakes or bugs a version change will help pinpoint regressions. I've heavily tested the resolve code, but it is new code and deserves some bake time in the wild.

Changelog:
/bin/lua removes shebang line and calls load directly. Improves workflows that define custom environments, and loadfile no longer removes shebang lines

load: loaded code chunks now inherit the parent _ENV naturally, having a real-lua behavior

require: heavily optimized and made errors more natural and helpful, exposing more information about failure to require a library

/lib/pipes: commented out pipes.create which is a future feature to create event-boxed threads

process: more process crash text is dumped to the shell to help identify "out of memory" issues

shell.resolve: reworked and optimized! possibly breaking change: specifying an extension (ext) to `shell.resolve(name, ext)` will no longer return results to directories, but only files (if they exist). However, it was never the intent of this method to return results to directories when specifying an extension

various memory optimizations throughout. openos now allocates ~153k to boot to shell.
2017-06-02 13:33:45 -07:00
payonel
f297eefd7d fix typos and pwchar option in term.read 2017-05-28 01:16:32 -07:00
payonel
7f4c9c4ffa dos2unixify the source 2017-05-27 15:20:37 -07:00
payonel
aa932bc7bc minor: remove unused code in /lib/sh 2017-05-27 14:58:21 -07:00
payonel
d80c7a8436 update pastebin url to https 2017-05-26 23:31:07 -07:00
payonel
e3ab7fc868 Bubble bug (#2405)
* better ls failure check

* always yield from sh threads, do not call event.pull directly

* load env wrapping and some bug fixes
2017-05-26 07:22:45 -07:00