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

Remove println2

This commit is contained in:
Alexander Medvednikov 2019-06-23 10:01:55 +02:00
parent ee5d6f1e7f
commit 20b5c4b88b
10 changed files with 26 additions and 30 deletions

View File

@ -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)

View File

@ -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

View File

@ -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++ {

View File

@ -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

View File

@ -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]),

View File

@ -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
}

View File

@ -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;

View File

@ -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, '')

View File

@ -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

View File

@ -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)
}