files
syscalls/doc/manual.md
Егор e75ef3eb9e Update manual
Add more funcs
2025-04-18 12:44:18 +02:00

2.7 KiB

Manual

local syscalls = require("syscalls")

Events

WaitEvent()

Endless wait event

WaitEventTimeout(timeout)

Wait timeout 1/100 sec

return event or nil

Events list

syscalls.Event.<EventName>
  • Redraw
  • Button
  • Key
  • Desktop
  • Mouse
  • Network
  • IPC
  • Debug

Graphic

Text encoding

syscalls.Encoding.<value>
  • cp866
  • cp866_8x16
  • utf8
  • utf16

Text sizes

syscalls.textSize.<value>
  • 6x9 (cp866 only)
  • 8x16
  • 12x18 (cp866 only)
  • 16x32
  • 18x27 (cp866 only)
  • 24x36 (cp866 only)
  • 24x48
  • 30x45 (cp866 only)
  • 32x64
  • 36x54 (cp866 only)
  • 40x80
  • 42x63 (cp866 only)
  • 48x72 (cp866 only)
  • 48x96
  • 56x112
  • 64x128

DrawText(text, xPos, yPos, textColor, textScale, textLen, backgroundColor, encoding)

DrawTextFixSize(text, xPos, yPos, textColor, textSize, textLen, backgroundColor, encoding)

Draw text.

textSize, textLen, backgroundColor, encoding are optional.

DrawLine(x1, y1, x2, y2)

DrawRectangle(x, y, w, h color)

ReadPoint(x, y)

return color

Buttons

GetButton()

return pressed button or nil

buttons

button's ids that defined default by window with skin

syscalls.buttons.<Value>
  • close
  • minimize

SystemColors

SystemColors type

GetSystemColors()

return SystemColors

SetSytemColors(SystemColors)

Threads

ThreadInfo(pid)

return table:

{
	name: string,
	pid: number,
	cpu_usage: number,
	memused: number,
	winXPos: number,
	winYPos: number,
	winXSize: number,
	winYPos: number,
	slotState: number,
	windowState: number
}

Sockets

OpenSocket(domain, type, protocol)

local socket, err = syscalls.OpenSocket(
	syscalls.SOCK.STREAM, 
	syscalls.AF.INET,
	syscalls.IPPROTO.IP
)

if err then
	print("Error", err)
else
	print("Ok")
end

CloseSocket(socket)

PairSocket()

local first, second = PairSocket()

if first then
	print("OK")
else
	print("Error:", second)
end

Bind(socket, address)

Listen(socket, backlog)

Connect(socket, address)

Accept(socket, , flags)

Receive(socket, , flags)

SetSocketOption(socket, opt)

GetSocketOption(socket, opt)

Socket types

syscalls.SOCK.<Value>
  • STREAM
  • RAW
  • DGRAM

Address families

syscalls.AF.<Value>
  • UNSPEC
  • LOCAL
  • INET
  • INET4
  • INET6

IP options

syscalls.IP.<Value>
  • TTL

IP protocols

syscalls.IPPROTO.<Value>
  • IP
  • ICMP
  • TCP
  • UDP
  • RAW

Socket options

syscalls.SO.<Value>
  • BINDTODEVICE
  • NONBLOCK