rdstdin: remove cruft that shouldn't have been exported or added (#12014)
This commit is contained in:
parent
c3c5839329
commit
547fcd69c3
1 changed files with 0 additions and 40 deletions
|
|
@ -33,46 +33,6 @@ when defined(Windows):
|
||||||
stdout.write(prompt)
|
stdout.write(prompt)
|
||||||
result = readLine(stdin, line)
|
result = readLine(stdin, line)
|
||||||
|
|
||||||
import winlean
|
|
||||||
|
|
||||||
const
|
|
||||||
VK_SHIFT* = 16
|
|
||||||
VK_CONTROL* = 17
|
|
||||||
VK_MENU* = 18
|
|
||||||
KEY_EVENT* = 1
|
|
||||||
|
|
||||||
type
|
|
||||||
KEY_EVENT_RECORD = object
|
|
||||||
bKeyDown: WINBOOL
|
|
||||||
wRepeatCount: uint16
|
|
||||||
wVirtualKeyCode: uint16
|
|
||||||
wVirtualScanCode: uint16
|
|
||||||
unicodeChar: uint16
|
|
||||||
dwControlKeyState: uint32
|
|
||||||
INPUT_RECORD = object
|
|
||||||
eventType*: int16
|
|
||||||
reserved*: int16
|
|
||||||
event*: KEY_EVENT_RECORD
|
|
||||||
safetyBuffer: array[0..5, DWORD]
|
|
||||||
|
|
||||||
proc readConsoleInputW*(hConsoleInput: Handle, lpBuffer: var INPUT_RECORD,
|
|
||||||
nLength: uint32,
|
|
||||||
lpNumberOfEventsRead: var uint32): WINBOOL{.
|
|
||||||
stdcall, dynlib: "kernel32", importc: "ReadConsoleInputW".}
|
|
||||||
|
|
||||||
proc getch(): uint16 =
|
|
||||||
let hStdin = getStdHandle(STD_INPUT_HANDLE)
|
|
||||||
var
|
|
||||||
irInputRecord: INPUT_RECORD
|
|
||||||
dwEventsRead: uint32
|
|
||||||
|
|
||||||
while readConsoleInputW(hStdin, irInputRecord, 1, dwEventsRead) != 0:
|
|
||||||
if irInputRecord.eventType == KEY_EVENT and
|
|
||||||
irInputRecord.event.wVirtualKeyCode notin {VK_SHIFT, VK_MENU, VK_CONTROL}:
|
|
||||||
result = irInputRecord.event.unicodeChar
|
|
||||||
discard readConsoleInputW(hStdin, irInputRecord, 1, dwEventsRead)
|
|
||||||
return result
|
|
||||||
|
|
||||||
elif defined(genode):
|
elif defined(genode):
|
||||||
proc readLineFromStdin*(prompt: string): TaintedString {.
|
proc readLineFromStdin*(prompt: string): TaintedString {.
|
||||||
tags: [ReadIOEffect, WriteIOEffect].} =
|
tags: [ReadIOEffect, WriteIOEffect].} =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue