From 20b5c4b88b6d824161fb751e6f9ab61cc9751ad2 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sun, 23 Jun 2019 10:01:55 +0200 Subject: [PATCH] Remove println2 --- builtin/builtin.v | 12 ++++-------- builtin/string.v | 2 +- builtin/utf8.v | 4 ++-- compiler/main.v | 18 +++++++++--------- compiler/scanner.v | 8 ++++---- compiler/table.v | 2 +- gg/gg.v | 2 +- http/http.v | 2 +- http/http_mac.v | 2 +- os/os.v | 4 ++-- 10 files changed, 26 insertions(+), 30 deletions(-) diff --git a/builtin/builtin.v b/builtin/builtin.v index 3ce1d2d332..b6340e6e28 100644 --- a/builtin/builtin.v +++ b/builtin/builtin.v @@ -8,7 +8,7 @@ pub fn exit(reason string) { if reason == '' { panic('exit empty reason') } - println2('exit(): $reason') + println('exit(): $reason') C.exit(0) } @@ -31,7 +31,7 @@ pub fn print_backtrace() { } pub fn panic(s string) { - println2('V panic: $s') + println('V panic: $s') print_backtrace() C.exit(1) } @@ -53,7 +53,7 @@ pub fn eprintln(s string) { } // TODO issues with stderr and cross compiling for Linux $else { - println2(s) + println(s) } } @@ -61,10 +61,6 @@ pub fn print(s string) { C.printf('%.*s', s.len, s.str) } -fn println2(s string) { - C.printf('%.*s\n', s.len, s.str) -} - pub fn malloc(n int) byteptr { if n < 0 { panic('malloc(<0)') @@ -78,7 +74,7 @@ pub fn malloc(n int) byteptr { total := i64(0) # total_m += n; # total = total_m; - println2('\n\n\nmalloc($n) total=$total') + println('\n\n\nmalloc($n) total=$total') print_backtrace() #endif ptr := C.malloc(n) diff --git a/builtin/string.v b/builtin/string.v index c6f150a2ec..1c79ff4cac 100644 --- a/builtin/string.v +++ b/builtin/string.v @@ -228,7 +228,7 @@ pub fn (s string) split(delim string) []string { } if delim.len == 1 { return s.split_single(delim[0]) - // println2('split 1 only') + // println('split 1 only') // os.exit() } mut i := 0 diff --git a/builtin/utf8.v b/builtin/utf8.v index c1f9971c04..d6fc0dfd2c 100644 --- a/builtin/utf8.v +++ b/builtin/utf8.v @@ -201,7 +201,7 @@ fn (s string) is_utf8() int { return -1 } if !ok { - println2('utf is bad dalen=$len KEK $s sdf') + println('utf is bad dalen=$len KEK $s sdf') // s = s.left(i) } return i @@ -215,7 +215,7 @@ fn (s string) runes() []string { res := []string{} if !s.is_utf8() { mys := s - println2('string.me runes bad utf $mys HAHA') + println('string.me runes bad utf $mys HAHA') return res } for i := 0; i < s.len; i++ { diff --git a/compiler/main.v b/compiler/main.v index b541a9fb35..26dbfbf606 100644 --- a/compiler/main.v +++ b/compiler/main.v @@ -91,7 +91,7 @@ fn main() { args := os.args // Print the version and exit. if 'version' in args { - println2('V $Version') + println('V $Version') return } if '-h' in args || '--help' in args || 'help' in args { @@ -120,7 +120,7 @@ fn main() { if !file.ends_with('.v') { os.exit1('v fmt can only be used on .v files') } - println2('vfmt is temporarily disabled') + println('vfmt is temporarily disabled') return } // V with no args? REPL @@ -379,7 +379,7 @@ string _STR_TMP(const char *fmt, ...) { ret := os.system2(cmd) if ret != 0 { s := os.system(cmd) - println2(s) + println(s) os.exit1('ret not 0, exiting') } } @@ -413,7 +413,7 @@ fn (c mut V) cc() { else if c.build_mode == DEFAULT_MODE { libs = '$TmpPath/vlib/builtin.o' if !os.file_exists(libs) { - println2('`builtin.o` not found') + println('`builtin.o` not found') exit('') } for imp in c.table.imports { @@ -485,7 +485,7 @@ mut args := '' res := os.system(cmd) // println('C OUTPUT:') if res.contains('error: ') { - println2(res) + println(res) panic('clang error') } // Link it if we are cross compiling and need an executable @@ -791,9 +791,9 @@ fn new_v(args[]string) *V { } fn run_repl() []string { - println2('V $Version') - println2('Use Ctrl-D to exit') - println2('For now you have to use println() to print values, this will be fixed soon\n') + println('V $Version') + println('Use Ctrl-D to exit') + println('For now you have to use println() to print values, this will be fixed soon\n') file := TmpPath + '/vrepl.v' mut lines := []string for { @@ -812,7 +812,7 @@ fn run_repl() []string { mut v := new_v( ['v', '-repl', file]) v.compile() s := os.system(TmpPath + '/vrepl') - println2(s) + println(s) } else { lines << line diff --git a/compiler/scanner.v b/compiler/scanner.v index 4532b222d7..27a85d8489 100644 --- a/compiler/scanner.v +++ b/compiler/scanner.v @@ -450,7 +450,7 @@ fn (s mut Scanner) scan() ScanRes { } return scan_res(DIV, '') } - println2('(char code=$c) pos=$s.pos len=$s.text.len') + println('(char code=$c) pos=$s.pos len=$s.text.len') s.error('invalid character `${c.str()}`') return scan_res(EOF, '') } @@ -458,15 +458,15 @@ fn (s mut Scanner) scan() ScanRes { fn (s &Scanner) error(msg string) { // println('!! SCANNER ERROR: $msg') file := s.file_path.all_after('/') - println2('panic: $file:${s.line_nr + 1}') - println2(msg) + println('panic: $file:${s.line_nr + 1}') + println(msg) // os.print_backtrace() // println(file) // println(s.file_path) os.exit1(' ') } -// println2('array out of bounds $idx len=$a.len') +// println('array out of bounds $idx len=$a.len') // This is really bad. It needs a major clean up fn (s mut Scanner) ident_string() string { // println("\nidentString() at char=", string(s.text[s.pos]), diff --git a/compiler/table.v b/compiler/table.v index 7efcdb3aa5..e1deb52a16 100644 --- a/compiler/table.v +++ b/compiler/table.v @@ -615,7 +615,7 @@ fn (table mut Table) cgen_name(f &Fn) string { } old := name name = 'f_$idx' - println2('$old ==> $name') + println('$old ==> $name') } return name } diff --git a/gg/gg.v b/gg/gg.v index 3c909cf69f..a04fa800e9 100644 --- a/gg/gg.v +++ b/gg/gg.v @@ -344,7 +344,7 @@ fn new_context_text(cfg Cfg, scale int) *GG { font_path = '/var/tmp/RobotoMono-Regular.ttf' } if !os.file_exists(font_path) { - println2('failed to load RobotoMono-Regular.ttf') + println('failed to load RobotoMono-Regular.ttf') exit('') } # FT_Face face; diff --git a/http/http.v b/http/http.v index c6abc21521..c31f22137f 100644 --- a/http/http.v +++ b/http/http.v @@ -30,7 +30,7 @@ pub: // embed 'http' fn get(url string) string { if url == '' { - println2('http: empty get url') + println('http: empty get url') return '' } mut req := new_request('GET', url, '') diff --git a/http/http_mac.v b/http/http_mac.v index 7088b297e6..8b8c888dc4 100644 --- a/http/http_mac.v +++ b/http/http_mac.v @@ -98,7 +98,7 @@ fn (req &Request) do() Response { // init curl curl := C.curl_easy_init() if isnil(curl) { - println2('curl init failed') + println('curl init failed') return Response{} } // options diff --git a/os/os.v b/os/os.v index 883883270f..452d14a3d8 100644 --- a/os/os.v +++ b/os/os.v @@ -316,13 +316,13 @@ pub fn getenv(key string) string { } fn exit(reason string) { - println2('exit(): $reason') + println('exit(): $reason') log(reason) C.exit(0) } fn exit1(reason string) { - println2('exit(): $reason') + println('exit(): $reason') C.exit(1) }