update manual.md
This commit is contained in:
277
doc/manual.md
277
doc/manual.md
@@ -1,13 +1,22 @@
|
|||||||
# Manual
|
# 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
|
```lua
|
||||||
local syscalls = require("syscalls")
|
local syscalls = require("syscalls")
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Events
|
## Events
|
||||||
|
|
||||||
|
### `SetEventMask(newMask)`
|
||||||
|
|
||||||
|
### `CheckEvent()`
|
||||||
|
|
||||||
|
check event
|
||||||
|
|
||||||
### `WaitEvent()`
|
### `WaitEvent()`
|
||||||
|
|
||||||
Endless wait event
|
Endless wait event
|
||||||
@@ -16,9 +25,10 @@ Endless wait event
|
|||||||
|
|
||||||
Wait timeout 1/100 sec
|
Wait timeout 1/100 sec
|
||||||
|
|
||||||
return event or nil
|
return event or `nil`
|
||||||
|
|
||||||
### Events list
|
### Events list
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
syscalls.Event.<EventName>
|
syscalls.Event.<EventName>
|
||||||
```
|
```
|
||||||
@@ -32,6 +42,62 @@ syscalls.Event.<EventName>
|
|||||||
+ `IPC`
|
+ `IPC`
|
||||||
+ `Debug`
|
+ `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.<Value>
|
||||||
|
```
|
||||||
|
|
||||||
|
+ `FixSizes`
|
||||||
|
+ `NoDraw` (you must draw window manually)
|
||||||
|
+ `CanChangeSizes`
|
||||||
|
+ `WithSkin` (usually use it)
|
||||||
|
+ `WithSkinFixSizes` (with skin, but window size fixed)
|
||||||
|
|
||||||
## Graphic
|
## Graphic
|
||||||
|
|
||||||
### Text encoding
|
### Text encoding
|
||||||
@@ -92,7 +158,7 @@ return color
|
|||||||
|
|
||||||
### `GetButton()`
|
### `GetButton()`
|
||||||
|
|
||||||
return pressed button or nil
|
return pressed button or `nil`
|
||||||
|
|
||||||
### `SetButtonStyle(style)`
|
### `SetButtonStyle(style)`
|
||||||
|
|
||||||
@@ -106,7 +172,7 @@ syscalls.buttons.<Value>
|
|||||||
```
|
```
|
||||||
|
|
||||||
+ `close`
|
+ `close`
|
||||||
+ `minimize`
|
+ `minimization`
|
||||||
|
|
||||||
### ButtonStyles
|
### ButtonStyles
|
||||||
|
|
||||||
@@ -114,6 +180,94 @@ syscalls.buttons.<Value>
|
|||||||
syscalls.buttonStyle.<Value>
|
syscalls.buttonStyle.<Value>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 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.<Value>
|
||||||
|
```
|
||||||
|
|
||||||
|
+ `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
|
||||||
|
|
||||||
### SystemColors type
|
### SystemColors type
|
||||||
@@ -122,16 +276,21 @@ userdata
|
|||||||
|
|
||||||
#### Fields
|
#### Fields
|
||||||
|
|
||||||
+ frameArea
|
```lua
|
||||||
+ grabBar
|
{
|
||||||
+ grabBarButton
|
frameArea: number,
|
||||||
+ grabButtonText
|
grabBar: number,
|
||||||
+ grabText
|
grabBarButton: number,
|
||||||
+ workArea
|
grabButtonText: number
|
||||||
+ workButton
|
grabText: number,
|
||||||
+ workButton
|
workArea: number,
|
||||||
+ workButtonText + workGraph
|
workButton: number,
|
||||||
+ workText
|
workButton: number,
|
||||||
|
workButtonText: number,
|
||||||
|
workGraph: number,
|
||||||
|
workText: number
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
#### Constructor
|
#### Constructor
|
||||||
|
|
||||||
@@ -155,7 +314,7 @@ syscalls.SystemColors.new(
|
|||||||
|
|
||||||
return SystemColors
|
return SystemColors
|
||||||
|
|
||||||
### `SetSytemColors(SystemColors)`
|
### `SetSystemColors(SystemColors)`
|
||||||
|
|
||||||
## Threads
|
## Threads
|
||||||
|
|
||||||
@@ -173,10 +332,29 @@ return table:
|
|||||||
winXSize: number,
|
winXSize: number,
|
||||||
winYPos: number,
|
winYPos: number,
|
||||||
slotState: number,
|
slotState: number,
|
||||||
windowState: number
|
windowState: number,
|
||||||
|
slotNumWindowStack: number,
|
||||||
|
posInWindowStack: number,
|
||||||
|
keyInputMode: number
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### `KillBySlot(slot)`
|
||||||
|
|
||||||
|
### Slot states
|
||||||
|
|
||||||
|
```lua
|
||||||
|
syscalls.slotState.<Value>
|
||||||
|
```
|
||||||
|
|
||||||
|
+ `Running`
|
||||||
|
+ `Suspended`
|
||||||
|
+ `SuspendedWaitEvent`
|
||||||
|
+ `NormalTerm`
|
||||||
|
+ `ExceptTerm`
|
||||||
|
+ `WaitEvent`
|
||||||
|
+ `Free`
|
||||||
|
|
||||||
## Sockets
|
## Sockets
|
||||||
|
|
||||||
### `OpenSocket(domain, type, protocol)`
|
### `OpenSocket(domain, type, protocol)`
|
||||||
@@ -274,4 +452,69 @@ syscalls.SO.<Value>
|
|||||||
+ `BINDTODEVICE`
|
+ `BINDTODEVICE`
|
||||||
+ `NONBLOCK`
|
+ `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)`
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user