mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
C fn definitions on Linux
This commit is contained in:
parent
e9e931fe4a
commit
f4fe90ea6d
@ -85,6 +85,8 @@ fn C.DEFAULT_LT() bool
|
|||||||
fn C.DEFAULT_GE() bool
|
fn C.DEFAULT_GE() bool
|
||||||
fn C.isatty() int
|
fn C.isatty() int
|
||||||
|
|
||||||
|
fn C.syscall() int
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ import (
|
|||||||
struct C.Display
|
struct C.Display
|
||||||
struct C.Atom
|
struct C.Atom
|
||||||
struct C.Window
|
struct C.Window
|
||||||
|
fn C.XFree()
|
||||||
fn C.XInitThreads() int
|
fn C.XInitThreads() int
|
||||||
fn C.XCloseDisplay(d &Display)
|
fn C.XCloseDisplay(d &Display)
|
||||||
fn C.XFlush(d &Display)
|
fn C.XFlush(d &Display)
|
||||||
|
@ -752,12 +752,15 @@ fn on_segfault(f voidptr) {
|
|||||||
|
|
||||||
fn C.getpid() int
|
fn C.getpid() int
|
||||||
fn C.proc_pidpath (int, byteptr, int) int
|
fn C.proc_pidpath (int, byteptr, int) int
|
||||||
|
fn C.readlink() int
|
||||||
|
|
||||||
// executable return the path name of the executable that started the current process.
|
|
||||||
|
// executable returns the path name of the executable that started the current
|
||||||
|
// process.
|
||||||
pub fn executable() string {
|
pub fn executable() string {
|
||||||
$if linux {
|
$if linux {
|
||||||
mut result := malloc(MAX_PATH)
|
mut result := malloc(MAX_PATH)
|
||||||
count := int(C.readlink('/proc/self/exe', result, MAX_PATH ))
|
count := C.readlink('/proc/self/exe', result, MAX_PATH)
|
||||||
if count < 0 {
|
if count < 0 {
|
||||||
panic('error reading /proc/self/exe to get exe path')
|
panic('error reading /proc/self/exe to get exe path')
|
||||||
}
|
}
|
||||||
|
@ -34,10 +34,15 @@ enum Action {
|
|||||||
suspend
|
suspend
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn C.tcgetattr() int
|
||||||
|
fn C.tcsetattr() int
|
||||||
|
fn C.ioctl() int
|
||||||
|
fn C.raise()
|
||||||
|
|
||||||
// Toggle raw mode of the terminal by changing its attributes
|
// Toggle raw mode of the terminal by changing its attributes
|
||||||
// Catches SIGUSER (CTRL+C) Signal to reset tty
|
// Catches SIGUSER (CTRL+C) Signal to reset tty
|
||||||
fn (r mut Readline) enable_raw_mode() {
|
fn (r mut Readline) enable_raw_mode() {
|
||||||
if ( C.tcgetattr(0, &r.orig_termios) == -1 ) {
|
if C.tcgetattr(0, &r.orig_termios) == -1 {
|
||||||
r.is_tty = false
|
r.is_tty = false
|
||||||
r.is_raw = false
|
r.is_raw = false
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user