From 3e43cd3aaa9ec2ee7c3779a43029553825811b2b Mon Sep 17 00:00:00 2001 From: 20kdc Date: Wed, 4 Apr 2018 17:15:51 +0100 Subject: [PATCH] Fix braille event positioning (maybe), and add more documentation (Pushed, but not R2 yet) --- code/init.lua | 2 +- code/libs/braille.lua | 4 +- repository/data/app-claw/local.lua | 3 ++ repository/docs/an-intro | 12 +++--- repository/docs/gp-pedan | 12 ++++++ repository/docs/kn-intro | 8 +++- repository/docs/kn-perms | 24 +++++++++++ repository/docs/kn-refer | 6 +++ repository/docs/kn-sched | 6 +++ repository/docs/ul-broil | 68 +++++++++++++++++++++++++++++- repository/docs/ul-event | 57 +++++++++++++++++++++++++ repository/docs/ul-neoux | 6 +++ repository/docs/ul-seria | 7 +++ repository/docs/us-perms | 6 +++ 14 files changed, 210 insertions(+), 11 deletions(-) create mode 100644 repository/docs/gp-pedan create mode 100644 repository/docs/ul-event create mode 100644 repository/docs/ul-seria diff --git a/code/init.lua b/code/init.lua index 395eb13..736c93b 100644 --- a/code/init.lua +++ b/code/init.lua @@ -149,7 +149,7 @@ function ensureType(a, t) end function ensurePathComponent(s) - if not string.match(s, "^[a-zA-Z0-9_%-%+%,%#%~%@%'%;%[%]%(%)%&%%%$%! %=%{%}%^]+") then error("chars disallowed") end + if not string.match(s, "^[a-zA-Z0-9_%-%+%,%#%~%@%'%;%[%]%(%)%&%%%$%! %=%{%}%^]+$") then error("chars disallowed") end if s == "." then error("single dot disallowed") end if s == ".." then error("double dot disallowed") end end diff --git a/code/libs/braille.lua b/code/libs/braille.lua index f50ca6e..6aeb60b 100644 --- a/code/libs/braille.lua +++ b/code/libs/braille.lua @@ -44,8 +44,8 @@ local function dotGet(p, ra, ga, ba, rb, gb, bb, rc, gc, bc, pos, col) end local function cTransform(core) return function (window, update, x, y, xI, yI, blah) - x = x + math.ceil(xI - 0.5) - y = y + math.ceil((yI - 0.25) * 4) + x = (x * 2) + math.ceil(xI - 0.5) + y = (y * 4) + math.ceil((yI - 0.25) * 4) core(window, update, x, y, blah) end end diff --git a/repository/data/app-claw/local.lua b/repository/data/app-claw/local.lua index 27883ce..fa42d2a 100644 --- a/repository/data/app-claw/local.lua +++ b/repository/data/app-claw/local.lua @@ -33,8 +33,11 @@ return { "docs/kn-sched", "docs/kn-perms", "docs/us-perms", + "docs/ul-seria", + "docs/ul-event", "docs/ul-neoux", "docs/ul-broil", + "docs/gp-pedan" }, } } diff --git a/repository/docs/an-intro b/repository/docs/an-intro index 6775867..10409da 100644 --- a/repository/docs/an-intro +++ b/repository/docs/an-intro @@ -144,13 +144,13 @@ Inelegance here falls to the greater power of practicality, as a VFS is an unnecessary component here. -After moving it's many globals into +After moving its many globals into place, it then immediately loads and runs sys-init. sys-init's job is to firstly display the KittenOS NEO boot screen - - this is where it got it's original + this is where it got its original name from, s-bristol (see: Plymouth) It chooses the screen / GPU based on @@ -238,8 +238,8 @@ If it does, then sys-init finally This should summarize the system. Good luck. - 20kdc -All of the KittenOS NEO documentation - is released into the public domain. +-- This is released into + the public domain. +-- No warranty is provided, + implied or otherwise. -No warranty is provided, implied, - or otherwise. diff --git a/repository/docs/gp-pedan b/repository/docs/gp-pedan new file mode 100644 index 0000000..5fcde06 --- /dev/null +++ b/repository/docs/gp-pedan @@ -0,0 +1,12 @@ +Regarding "it's" vs. "its", everybody + is bugging me to use "its" in + some cases. While this doesn't make + sense with "the cat's pajamas", + who cares about consistency! +Apparently this is how it works. + +-- This is released into + the public domain. +-- No warranty is provided, + implied or otherwise. + diff --git a/repository/docs/kn-intro b/repository/docs/kn-intro index badd339..82be528 100644 --- a/repository/docs/kn-intro +++ b/repository/docs/kn-intro @@ -68,7 +68,7 @@ Secondly, here's what goes on in the accepts the use of that API. 8. The callback in the registration is called. - It's first return value is sent + Its first return value is sent back to the user-process. If it errors, then nil is given instead (the error is not sent). @@ -90,3 +90,9 @@ Given this operation is only ever Finally, the kernel prevents those processes that aren't "sys-" from calling "sys-" processes. + +-- This is released into + the public domain. +-- No warranty is provided, + implied or otherwise. + diff --git a/repository/docs/kn-perms b/repository/docs/kn-perms index 127949e..e64b4d5 100644 --- a/repository/docs/kn-perms +++ b/repository/docs/kn-perms @@ -33,6 +33,24 @@ Here, "*" means that everything after under normal circumstances. "k.root": The kernel's _ENV table. + Two things in particular + that are actually part of + the documented API for this: + + securityPolicy(pid, proc, perm, req) + Setting this sets the security + policy used. Since this is root-by- + proxy, it's in k.root (this also + saves the memory another mechanism + would require, and complexity) + runProgramPolicy(ipkg, ...) : + Setting this sets the run-program + policy used, which prevents a + program being run in certain cases. + The varargs are the same as those + that would go to the new process - + the 'ipkg' is the name of the + program to start up. "k.computer": The "computer" table, with wrapMeta applied, @@ -74,3 +92,9 @@ Here, "*" means that everything after intends to give you. Also gives you "s.x.*" automatically to receive the output of sendSig. + +-- This is released into + the public domain. +-- No warranty is provided, + implied or otherwise. + diff --git a/repository/docs/kn-refer b/repository/docs/kn-refer index 1eef50e..8e26d9b 100644 --- a/repository/docs/kn-refer +++ b/repository/docs/kn-refer @@ -280,3 +280,9 @@ The additional things available to With that, I hope I have documented the kernel's interface to programs. + +-- This is released into + the public domain. +-- No warranty is provided, + implied or otherwise. + diff --git a/repository/docs/kn-sched b/repository/docs/kn-sched index 4448c4f..95b4f9c 100644 --- a/repository/docs/kn-sched +++ b/repository/docs/kn-sched @@ -68,3 +68,9 @@ If there is any signal, distEvent is called to distribute it to those processes with the right accessses, with an "h." prefix. + +-- This is released into + the public domain. +-- No warranty is provided, + implied or otherwise. + diff --git a/repository/docs/ul-broil b/repository/docs/ul-broil index f534deb..5363030 100644 --- a/repository/docs/ul-broil +++ b/repository/docs/ul-broil @@ -1 +1,67 @@ -Hello World. +The "braille" library, contrary to + its name, in fact a library for the + drawing of graphics using the... + "repurposed" Braille characters in + OC's font. This library is meant to + be usable easily from applications, + including those that mix text and + graphics in a normal UI. + +Upon requiring, you get a wrapMeta'd + table, which consists of two + functions at this time: + +calcLine(x, y, w, span, get + [, colour]) -> calc: + Given an X/Y character position, + and a given width in characters, + along with the get function: + get(xp, yp) -> r, g, b + (NOTE: These coords are 0-based!) + and colour (a number, the amount of + difference required to cause an + FG/BG change - not giving this + disables colour output), + output spans to the span function: + span(x, y, str, bg, fg) + +new(x, y, w, h, cbs, colour) -> nux: + Creates a NeoUX component for an + embedded braille image. + X, Y, W and H are in characters, + each character offering 2x4 pixels. + cbs is a table that may have the + following fields: + + selectable : The selectable flag. + key/clipboard : + Identical to NeoUX's. + touch/drag/drop/scroll: See NeoUX + for full details, but the xI and + yI parameters are gone, and the + X/Y coordinates are in Braille + pixels. The button/direction value + if any remains unchanged, but in + an earlier position. + + and must have a "get" function: + get(window, x, y) -> r, g, b + Gets the R/G/B of a pixel on the + image, with a 1-based pixel X/Y. + Details of conversion are hidden + from the user of this library for + future improvement by the end-user + or another party, but in no-colour + mode, 255, 255, 255 will always + show white and 0, 0, 0 will always + show black. + colour enables colour (see above), + though if displayed on a screen + without colour, this option is + ignored for that time. + +-- This is released into + the public domain. +-- No warranty is provided, + implied or otherwise. + diff --git a/repository/docs/ul-event b/repository/docs/ul-event new file mode 100644 index 0000000..e22c5e0 --- /dev/null +++ b/repository/docs/ul-event @@ -0,0 +1,57 @@ +The "event" library is meant to + mirror that of OpenOS in some ways, + while being distinct in others, such + as its optional nature. + +The event library returns a function, + which you then call with the process + NEO table, which then actually gives + the event table, after wrapping + the neo.requestAccess function in + order to ensure that events are + caught during that loop (as the only + direct event-loop in the kernel + API, with requireAccess using the + requestAccess in your NEO table). + +This amounts to: + +local event = require("event")(neo) + +This is what's in the event table: + + listen([p1, ] cb): This has 2 forms. + It can be first-arg string, second + callback, or just a callback. + This is determined by the type of + the second argument. + If it's a function, then that - the + callback - is only called for + events of the type in the first + argument. + Otherwise, the callback is the 1st + argument, and the function is the + second argument. + + ignore(cb): Deletes a callback. Yes, + this works even if a filter was + added onto it. + + pull(...): Waits for an event whose + first parameters are. + Rather than using this for sleep, + you should use runAt or sleepTo. + + runAt(time, func): At a given uptime + in os.uptime() units, runs func. + + sleepTo(time[, earlyWake]): Runs + until either earlyWake() returns + true (if given), or os.uptime() >= + the time given, using a timer. + +-- This is released into + the public domain. +-- No warranty is provided, + implied or otherwise. + diff --git a/repository/docs/ul-neoux b/repository/docs/ul-neoux index f534deb..38350e2 100644 --- a/repository/docs/ul-neoux +++ b/repository/docs/ul-neoux @@ -1 +1,7 @@ Hello World. + +-- This is released into + the public domain. +-- No warranty is provided, + implied or otherwise. + diff --git a/repository/docs/ul-seria b/repository/docs/ul-seria new file mode 100644 index 0000000..38350e2 --- /dev/null +++ b/repository/docs/ul-seria @@ -0,0 +1,7 @@ +Hello World. + +-- This is released into + the public domain. +-- No warranty is provided, + implied or otherwise. + diff --git a/repository/docs/us-perms b/repository/docs/us-perms index f534deb..38350e2 100644 --- a/repository/docs/us-perms +++ b/repository/docs/us-perms @@ -1 +1,7 @@ Hello World. + +-- This is released into + the public domain. +-- No warranty is provided, + implied or otherwise. +