mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: define missing C fn args & check C & JS args (#8770)
This commit is contained in:
@@ -4,6 +4,7 @@ import os
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <termios.h> // TIOCGWINSZ
|
||||
|
||||
pub struct C.winsize {
|
||||
pub:
|
||||
ws_row u16
|
||||
@@ -20,7 +21,7 @@ pub fn get_terminal_size() (int, int) {
|
||||
return default_columns_size, default_rows_size
|
||||
}
|
||||
w := C.winsize{}
|
||||
C.ioctl(1, C.TIOCGWINSZ, &w)
|
||||
C.ioctl(1, u64(C.TIOCGWINSZ), &w)
|
||||
return int(w.ws_col), int(w.ws_row)
|
||||
}
|
||||
|
||||
@@ -52,7 +53,7 @@ pub fn get_cursor_position() Coord {
|
||||
i++
|
||||
if i >= 15 {
|
||||
panic('C.getchar() called too many times')
|
||||
}
|
||||
}
|
||||
// state management:
|
||||
if b == `R` {
|
||||
break
|
||||
|
@@ -44,16 +44,16 @@ mut:
|
||||
}
|
||||
|
||||
// ref - https://docs.microsoft.com/en-us/windows/console/getconsolescreenbufferinfo
|
||||
fn C.GetConsoleScreenBufferInfo(handle os.HANDLE, info &C.CONSOLE_SCREEN_BUFFER_INFO) bool
|
||||
fn C.GetConsoleScreenBufferInfo(handle C.HANDLE, info &C.CONSOLE_SCREEN_BUFFER_INFO) bool
|
||||
|
||||
// ref - https://docs.microsoft.com/en-us/windows/console/setconsoletitle
|
||||
fn C.SetConsoleTitle(title &u16) bool
|
||||
|
||||
// ref - https://docs.microsoft.com/en-us/windows/console/setconsolecursorposition
|
||||
fn C.SetConsoleCursorPosition(handle os.HANDLE, coord C.COORD) bool
|
||||
fn C.SetConsoleCursorPosition(handle C.HANDLE, coord C.COORD) bool
|
||||
|
||||
// ref - https://docs.microsoft.com/en-us/windows/console/scrollconsolescreenbuffer
|
||||
fn C.ScrollConsoleScreenBuffer(output os.HANDLE, scroll_rect &C.SMALL_RECT, clip_rect &C.SMALL_RECT, des C.COORD, fill C.CHAR_INFO) bool
|
||||
fn C.ScrollConsoleScreenBuffer(output C.HANDLE, scroll_rect &C.SMALL_RECT, clip_rect &C.SMALL_RECT, des C.COORD, fill &C.CHAR_INFO) bool
|
||||
|
||||
// get_terminal_size returns a number of colums and rows of terminal window.
|
||||
pub fn get_terminal_size() (int, int) {
|
||||
|
@@ -77,8 +77,8 @@ struct C.CONSOLE_SCREEN_BUFFER_INFO {
|
||||
dwMaximumWindowSize C.COORD
|
||||
}
|
||||
|
||||
fn C.ReadConsoleInput() bool
|
||||
fn C.ReadConsoleInput(hConsoleInput C.HANDLE, lpBuffer &C.INPUT_RECORD, nLength u32, lpNumberOfEventsRead &u32) bool
|
||||
|
||||
fn C.GetNumberOfConsoleInputEvents() bool
|
||||
fn C.GetNumberOfConsoleInputEvents(hConsoleInput C.HANDLE, lpcNumberOfEvents &u32) bool
|
||||
|
||||
fn C.GetConsoleScreenBufferInfo(handle os.HANDLE, info &C.CONSOLE_SCREEN_BUFFER_INFO) bool
|
||||
fn C.GetConsoleScreenBufferInfo(handle C.HANDLE, info &C.CONSOLE_SCREEN_BUFFER_INFO) bool
|
||||
|
@@ -10,9 +10,9 @@ import time
|
||||
#include <sys/ioctl.h>
|
||||
#include <signal.h>
|
||||
|
||||
fn C.tcgetattr()
|
||||
fn C.tcgetattr(fd int, termios_p &C.termios) int
|
||||
|
||||
fn C.tcsetattr()
|
||||
fn C.tcsetattr(fd int, optional_actions int, termios_p &C.termios) int
|
||||
|
||||
fn C.ioctl(fd int, request u64, arg voidptr) int
|
||||
|
||||
|
Reference in New Issue
Block a user