diff --git a/doc/manual.md b/doc/manual.md index ed49911..008b973 100644 --- a/doc/manual.md +++ b/doc/manual.md @@ -1,13 +1,22 @@ # Manual +This is KolibriOS lua syscalls library. Usually you shouldn't use this library + +Better if you read before [KolibriOS syscalls wiki](http://wiki.kolibrios.org/wiki/) + +include: ```lua local syscalls = require("syscalls") ``` - - ## Events +### `SetEventMask(newMask)` + +### `CheckEvent()` + +check event + ### `WaitEvent()` Endless wait event @@ -16,9 +25,10 @@ Endless wait event Wait timeout 1/100 sec -return event or nil +return event or `nil` ### Events list + ```lua syscalls.Event. ``` @@ -32,6 +42,62 @@ syscalls.Event. + `IPC` + `Debug` +## Window + +### `CreateWindow(x, y, width, height, workColor, style, borderColor, titleColor)` + +Define window + +`borderColor` and `borderColor` only for `FixSizes` and `CanChangeSizes` (without skin styles) style. + +### `StartRedraw()` + +Start window redraw. Just call it before `CreateWindow` + +### `EndRedraw()` + +End window redraw. Just call it after you done redraw window. + +### `ChangeWindow(newX, newY, newWidth, newHeight)` + +### `FocusWindow(slot)` + +### `UnfocusWindow(slot)` + +### `SetWindowTitle(newTitle)` + +### `GetSkinHeight()` + +return skin height. + +### `SetSkin(path)` + +return error code + +### `GetSkinTitleArea()` + +return table: +```lua +{ + Left: number, + Right: number, + Top: number, + Bottom: number +} +``` + +### Style + +```lua +syscalls.windowStyle. +``` + ++ `FixSizes` ++ `NoDraw` (you must draw window manually) ++ `CanChangeSizes` ++ `WithSkin` (usually use it) ++ `WithSkinFixSizes` (with skin, but window size fixed) + ## Graphic ### Text encoding @@ -92,7 +158,7 @@ return color ### `GetButton()` -return pressed button or nil +return pressed button or `nil` ### `SetButtonStyle(style)` @@ -106,7 +172,7 @@ syscalls.buttons. ``` + `close` -+ `minimize` ++ `minimization` ### ButtonStyles @@ -114,6 +180,94 @@ syscalls.buttons. syscalls.buttonStyle. ``` +## Keyboard + +### `GetKey()` + +return: ++ nil if buffer empty ++ if hotkey return second number ++ if key pressed and key input mode is ascii return string(1 char), else return scancode + +example: + +```lua +local key, hotkey = syscalls.GetKey() + +if key then + print("key pressed") +end + +if hotkey then + print(hotkey pressed) +end +``` + +### `SetKeyInputMode(mode)` + +by default is `ASCII` + +### `GetKeyInputMode()` + +return key input mode. + +isn't syscall + +### Scancodes + +```lua +syscalls.scancode. +``` + ++ `A` ++ `B` ++ `C` ++ `D` ++ `E` ++ `F` ++ `G` ++ `H` ++ `J` ++ `K` ++ `L` ++ `M` ++ `O` ++ `P` ++ `Q` ++ `S` ++ `T` ++ `U` ++ `W` ++ `X` ++ `Y` ++ `Z` ++ `1` ++ `2` ++ `3` ++ `4` ++ `5` ++ `6` ++ `7` ++ `8` ++ `9` ++ `F1` ++ `F2` ++ `F3` ++ `F4` ++ `F5` ++ `F6` ++ `F7` ++ `F8` ++ `F9` ++ `F10` ++ `F11` ++ `F12` ++ `LeftShift` ++ `RightShift` ++ `LeftAlt` ++ `RightAlt` ++ `Tab` + ## SystemColors ### SystemColors type @@ -122,16 +276,21 @@ userdata #### Fields -+ frameArea -+ grabBar -+ grabBarButton -+ grabButtonText -+ grabText -+ workArea -+ workButton -+ workButton -+ workButtonText + workGraph -+ workText +```lua +{ + frameArea: number, + grabBar: number, + grabBarButton: number, + grabButtonText: number + grabText: number, + workArea: number, + workButton: number, + workButton: number, + workButtonText: number, + workGraph: number, + workText: number +} +``` #### Constructor @@ -155,7 +314,7 @@ syscalls.SystemColors.new( return SystemColors -### `SetSytemColors(SystemColors)` +### `SetSystemColors(SystemColors)` ## Threads @@ -173,10 +332,29 @@ return table: winXSize: number, winYPos: number, slotState: number, - windowState: number + windowState: number, + slotNumWindowStack: number, + posInWindowStack: number, + keyInputMode: number } ``` +### `KillBySlot(slot)` + +### Slot states + +```lua +syscalls.slotState. +``` + ++ `Running` ++ `Suspended` ++ `SuspendedWaitEvent` ++ `NormalTerm` ++ `ExceptTerm` ++ `WaitEvent` ++ `Free` + ## Sockets ### `OpenSocket(domain, type, protocol)` @@ -274,4 +452,69 @@ syscalls.SO. + `BINDTODEVICE` + `NONBLOCK` +## Debug + +### Registers type + +```lua +{ + eax: number + ebx: number, + esp: number, + esi: number, + edi: number, + eip: number, + eflags: number +} +``` + +### `DebugPutc(char)` + +Put char to debug board + +### `DebugPuts(text)` + +Put string to debug board + +### `GetRegisters(pid)` + +The process must be loaded for debugging (as stated in the general description). + +return registers table + +### `SetRegisters(pid, registers)` + +The process must be loaded for debugging (as stated in the general description). + +### `Disconnect(pid)` + +The process must be loaded for debugging (as stated in the general description). + +If the process was suspended, it resumes execution. + +### `Stop(pid)` + +The process must be loaded for debugging (as stated in the general description). + +### `Continue(pid)` + +The process must be loaded for debugging (as stated in the general description). + +### `ReadFromMem(pid, bytes, pointer, buffer)` + +The process must be loaded for debugging (as stated in the general description). + +return or `nil` + +### `WriteToMem(pid, bytes, pointer, buffer)` + +The process must be loaded for debugging (as stated in the general description). + +return or `nil` + +### `Done(pid)` + +### `DefineBreakpoint(pid, index, condition, len)` + +### `UndefBreakpoint(pid, index, condition, len)`