1
0
mirror of https://github.com/20kdc/OC-KittenOS.git synced 2024-12-24 09:58:06 +11:00

Fix braille event positioning (maybe), and add more documentation (Pushed, but not R2 yet)

This commit is contained in:
20kdc 2018-04-04 17:15:51 +01:00
parent e984f97ea9
commit 3e43cd3aaa
14 changed files with 210 additions and 11 deletions

View File

@ -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

View File

@ -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

View File

@ -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"
},
}
}

View File

@ -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.

12
repository/docs/gp-pedan Normal file
View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

57
repository/docs/ul-event Normal file
View File

@ -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.

View File

@ -1 +1,7 @@
Hello World.
-- This is released into
the public domain.
-- No warranty is provided,
implied or otherwise.

7
repository/docs/ul-seria Normal file
View File

@ -0,0 +1,7 @@
Hello World.
-- This is released into
the public domain.
-- No warranty is provided,
implied or otherwise.

View File

@ -1 +1,7 @@
Hello World.
-- This is released into
the public domain.
-- No warranty is provided,
implied or otherwise.