1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

gg: image: return an optional instead of panic(); darwin: fix nsstring()

This commit is contained in:
Alexander Medvednikov
2020-08-22 17:09:22 +02:00
parent 0bdb096bfa
commit 9e12095111
9 changed files with 101 additions and 66 deletions

View File

@ -113,11 +113,27 @@ pub fn print(s string) {
const (
new_line_character = '\n'
)
//#include "@VROOT/vlib/darwin/darwin.m"
//fn C.nsstring2(s string) voidptr
//fn C.NSLog(x voidptr)
#include <asl.h>
fn C.asl_log(voidptr, voidptr, int, charptr)
pub fn println(s string) {
$if windows {
print(s)
print(new_line_character)
} $else {
// For debugging .app applications (no way to read stdout) so that it's printed to macOS Console
/*
$if macos {
C.asl_log(0, 0, C.ASL_LEVEL_ERR, s.str)
}
*/
// TODO: a syscall sys_write on linux works, except for the v repl.
// Probably it is a stdio buffering issue. Needs more testing...
// $if linux {