$if mac => $if macos
parent
ff80e3a5fa
commit
f192429c8a
|
@ -16,7 +16,7 @@ fn print_backtrace_skipping_top_frames_mingw(skipframes int) bool {
|
||||||
|
|
||||||
fn print_backtrace_skipping_top_frames_nix(xskipframes int) bool {
|
fn print_backtrace_skipping_top_frames_nix(xskipframes int) bool {
|
||||||
skipframes := xskipframes + 2
|
skipframes := xskipframes + 2
|
||||||
$if mac { return print_backtrace_skipping_top_frames_mac(skipframes) }
|
$if macos { return print_backtrace_skipping_top_frames_mac(skipframes) }
|
||||||
$if linux { return print_backtrace_skipping_top_frames_linux(skipframes) }
|
$if linux { return print_backtrace_skipping_top_frames_linux(skipframes) }
|
||||||
$if freebsd { return print_backtrace_skipping_top_frames_freebsd(skipframes) }
|
$if freebsd { return print_backtrace_skipping_top_frames_freebsd(skipframes) }
|
||||||
return false
|
return false
|
||||||
|
@ -25,7 +25,7 @@ fn print_backtrace_skipping_top_frames_nix(xskipframes int) bool {
|
||||||
// the functions below are not called outside this file,
|
// the functions below are not called outside this file,
|
||||||
// so there is no need to have their twins in builtin_windows.v
|
// so there is no need to have their twins in builtin_windows.v
|
||||||
fn print_backtrace_skipping_top_frames_mac(skipframes int) bool {
|
fn print_backtrace_skipping_top_frames_mac(skipframes int) bool {
|
||||||
$if mac {
|
$if macos {
|
||||||
buffer := [100]byteptr
|
buffer := [100]byteptr
|
||||||
nr_ptrs := C.backtrace(*voidptr(buffer), 100)
|
nr_ptrs := C.backtrace(*voidptr(buffer), 100)
|
||||||
C.backtrace_symbols_fd(*voidptr(&buffer[skipframes]), nr_ptrs-skipframes, 1)
|
C.backtrace_symbols_fd(*voidptr(&buffer[skipframes]), nr_ptrs-skipframes, 1)
|
||||||
|
|
|
@ -396,7 +396,7 @@ start:
|
||||||
ret2 := os.system('upx --lzma -qqq $v.out_name')
|
ret2 := os.system('upx --lzma -qqq $v.out_name')
|
||||||
if ret2 != 0 {
|
if ret2 != 0 {
|
||||||
println('upx failed')
|
println('upx failed')
|
||||||
$if mac {
|
$if macos {
|
||||||
println('install upx with `brew install upx`')
|
println('install upx with `brew install upx`')
|
||||||
}
|
}
|
||||||
$if linux {
|
$if linux {
|
||||||
|
@ -539,7 +539,7 @@ fn missing_compiler_info() string {
|
||||||
$if linux {
|
$if linux {
|
||||||
return 'On Debian/Ubuntu, run `sudo apt install build-essential`'
|
return 'On Debian/Ubuntu, run `sudo apt install build-essential`'
|
||||||
}
|
}
|
||||||
$if mac {
|
$if macos {
|
||||||
return 'Install command line XCode tools with `xcode-select --install`'
|
return 'Install command line XCode tools with `xcode-select --install`'
|
||||||
}
|
}
|
||||||
return ''
|
return ''
|
||||||
|
|
|
@ -945,7 +945,7 @@ pub fn new_v(args[]string) &V {
|
||||||
$if linux {
|
$if linux {
|
||||||
_os = .linux
|
_os = .linux
|
||||||
}
|
}
|
||||||
$if mac {
|
$if macos {
|
||||||
_os = .mac
|
_os = .mac
|
||||||
}
|
}
|
||||||
$if windows {
|
$if windows {
|
||||||
|
|
|
@ -673,7 +673,7 @@ pub fn user_os() string {
|
||||||
$if linux {
|
$if linux {
|
||||||
return 'linux'
|
return 'linux'
|
||||||
}
|
}
|
||||||
$if mac {
|
$if macos {
|
||||||
return 'mac'
|
return 'mac'
|
||||||
}
|
}
|
||||||
$if windows {
|
$if windows {
|
||||||
|
@ -742,7 +742,7 @@ fn on_segfault(f voidptr) {
|
||||||
$if windows {
|
$if windows {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
$if mac {
|
$if macos {
|
||||||
mut sa := C.sigaction{}
|
mut sa := C.sigaction{}
|
||||||
C.memset(&sa, 0, sizeof(sigaction))
|
C.memset(&sa, 0, sizeof(sigaction))
|
||||||
C.sigemptyset(&sa.sa_mask)
|
C.sigemptyset(&sa.sa_mask)
|
||||||
|
@ -775,7 +775,7 @@ pub fn executable() string {
|
||||||
len := int(C.GetModuleFileName( 0, result, max ))
|
len := int(C.GetModuleFileName( 0, result, max ))
|
||||||
return string_from_wide2(result, len)
|
return string_from_wide2(result, len)
|
||||||
}
|
}
|
||||||
$if mac {
|
$if macos {
|
||||||
mut result := calloc(MAX_PATH)
|
mut result := calloc(MAX_PATH)
|
||||||
pid := C.getpid()
|
pid := C.getpid()
|
||||||
ret := proc_pidpath (pid, result, MAX_PATH)
|
ret := proc_pidpath (pid, result, MAX_PATH)
|
||||||
|
@ -1013,7 +1013,7 @@ pub fn tmpdir() string {
|
||||||
$if linux {
|
$if linux {
|
||||||
if path == '' { path = '/tmp' }
|
if path == '' { path = '/tmp' }
|
||||||
}
|
}
|
||||||
$if mac {
|
$if macos {
|
||||||
/*
|
/*
|
||||||
if path == '' {
|
if path == '' {
|
||||||
// TODO untested
|
// TODO untested
|
||||||
|
|
Loading…
Reference in New Issue