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

v2: parse builtin.v, cfns.v float.v

This commit is contained in:
Alexander Medvednikov
2020-02-04 09:54:15 +01:00
parent 432ee93916
commit 83f0c228e9
11 changed files with 122 additions and 44 deletions

View File

@@ -30,7 +30,7 @@ pub fn println(s string) {
// C.syscall(/* sys_write */ 1, /* stdout_value */ 1, snl.str, s.len+1)
// return
// }
// }
// }
C.printf('%.*s\n', s.len, s.str)
}
@@ -118,7 +118,7 @@ fn print_backtrace_skipping_top_frames_linux(skipframes int) bool {
if output in ['??:0:', '??:?:'] {
output = ''
}
println('${output:-46s} | ${addr:14s} | $beforeaddr')
//println('${output:-46s} | ${addr:14s} | $beforeaddr') // QTODO
}
// C.backtrace_symbols_fd(*voidptr(&buffer[skipframes]), nr_actual_frames, 1)
return true

View File

@@ -11,7 +11,7 @@ fn C.realloc(a byteptr, b int) byteptr
fn C.qsort(voidptr, int, int, voidptr)
fn C.sprintf(a ...voidptr) byteptr
fn C.sprintf(a ...voidptr) int
fn C.strlen(s byteptr) int
@@ -23,8 +23,7 @@ fn C.popen(c byteptr, t byteptr) voidptr
// <execinfo.h>
fn backtrace(a voidptr, b int) int
fn backtrace_symbols(voidptr, int) &byteptr
fn backtrace_symbols(voidptr, int) &byteptr
fn backtrace_symbols_fd(voidptr, int, int)

View File

@@ -155,14 +155,14 @@ pub fn (n int) hex() string {
pub fn (n i64) hex() string {
len := if n >= i64(0) { n.str().len + 3 } else { 19 }
hex := malloc(len)
count := int(C.sprintf(charptr(hex), '0x%'C.PRIx64, n))
count := C.sprintf(charptr(hex), '0x%'C.PRIx64, n)
return tos(hex, count)
}
pub fn (n u64) hex() string {
len := if n >= u64(0) { n.str().len + 3 } else { 19 }
hex := malloc(len)
count := int(C.sprintf(charptr(hex), '0x%'C.PRIx64, n))
count := C.sprintf(charptr(hex), '0x%'C.PRIx64, n)
return tos(hex, count)
}