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

vfmt: change all '$expr' to '${expr}' (#16428)

This commit is contained in:
yuyi
2022-11-15 21:53:13 +08:00
committed by GitHub
parent 56239b4a23
commit 017ace6ea7
859 changed files with 7156 additions and 7135 deletions

View File

@@ -3,22 +3,22 @@ import os
fn test_all_samples_can_be_compiled() {
vexe := @VEXE
vroot := os.dir(vexe)
samples := os.walk_ext('$vroot/vlib/gg/testdata', '.vv')
samples := os.walk_ext('${vroot}/vlib/gg/testdata', '.vv')
mut fails := []string{}
for program_source in samples {
compile_cmd := '${os.quoted_path(vexe)} ${os.quoted_path(program_source)}'
res := os.execute(compile_cmd)
if res.exit_code != 0 {
eprintln('>>> FAIL $compile_cmd')
eprintln('>>> FAIL ${compile_cmd}')
eprintln(res.output)
fails << compile_cmd
}
println('OK $compile_cmd')
println('OK ${compile_cmd}')
}
if fails.len > 0 {
eprintln('> Failed summary:')
for f in fails {
eprintln(' failed cmd: $f')
eprintln(' failed cmd: ${f}')
}
assert false
}

View File

@@ -240,7 +240,7 @@ fn gg_init_sokol_window(user_data voidptr) {
} else {
sfont := font.default()
if ctx.config.font_path != '' {
eprintln('font file "$ctx.config.font_path" does not exist, the system font ($sfont) was used instead.')
eprintln('font file "${ctx.config.font_path}" does not exist, the system font (${sfont}) was used instead.')
}
ctx.ft = new_ft(
@@ -441,7 +441,7 @@ fn gg_fail_fn(msg &char, user_data voidptr) {
if ctx.config.fail_fn != unsafe { nil } {
ctx.config.fail_fn(vmsg, ctx.config.user_data)
} else {
eprintln('gg error: $vmsg')
eprintln('gg error: ${vmsg}')
}
}

View File

@@ -98,7 +98,7 @@ pub fn (mut img Image) init_sokol_image() &Image {
pub fn (ctx &Context) draw_image(x f32, y f32, width f32, height f32, img_ &Image) {
$if macos {
if img_.id >= ctx.image_cache.len {
eprintln('gg: draw_image() bad img id $img_.id (img cache len = $ctx.image_cache.len)')
eprintln('gg: draw_image() bad img id ${img_.id} (img cache len = ${ctx.image_cache.len})')
return
}
if ctx.native_rendering {
@@ -203,7 +203,7 @@ pub fn (mut ctx Context) create_image_with_size(file string, width int, height i
// TODO remove this
fn create_image(file string) Image {
if !os.exists(file) {
println('gg.create_image(): file not found: $file')
println('gg.create_image(): file not found: ${file}')
return Image{} // none
}
stb_img := stbi.load(file) or { return Image{} }
@@ -262,7 +262,7 @@ pub struct StreamingImageConfig {
pub fn (ctx &Context) draw_image_with_config(config DrawImageConfig) {
id := if !isnil(config.img) { config.img.id } else { config.img_id }
if id >= ctx.image_cache.len {
eprintln('gg: draw_image() bad img id $id (img cache len = $ctx.image_cache.len)')
eprintln('gg: draw_image() bad img id ${id} (img cache len = ${ctx.image_cache.len})')
return
}

View File

@@ -8,16 +8,16 @@ import os
[if gg_record ?]
pub fn (mut ctx Context) record_frame() {
if ctx.frame in gg.recorder_settings.screenshot_frames {
screenshot_file_path := '$gg.recorder_settings.screenshot_prefix${ctx.frame}.png'
screenshot_file_path := '${gg.recorder_settings.screenshot_prefix}${ctx.frame}.png'
$if gg_record_trace ? {
eprintln('>>> screenshoting $screenshot_file_path')
eprintln('>>> screenshoting ${screenshot_file_path}')
}
sapp.screenshot_png(screenshot_file_path) or { panic(err) }
}
if ctx.frame == gg.recorder_settings.stop_at_frame {
$if gg_record_trace ? {
eprintln('>>> exiting at frame $ctx.frame')
eprintln('>>> exiting at frame ${ctx.frame}')
}
exit(0)
}

View File

@@ -58,7 +58,7 @@ fn new_ft(c FTConfig) ?&FT {
if c.font_path == '' || !os.exists(c.font_path) {
$if !android {
println('failed to load font "$c.font_path"')
println('failed to load font "${c.font_path}"')
return none
}
}
@@ -71,13 +71,13 @@ fn new_ft(c FTConfig) ?&FT {
if bytes.len == 0 {
// ... then try the APK asset path
bytes = os.read_apk_asset(c.font_path) or {
println('failed to load font "$c.font_path"')
println('failed to load font "${c.font_path}"')
return none
}
}
} $else {
bytes = os.read_bytes(c.font_path) or {
println('failed to load font "$c.font_path"')
println('failed to load font "${c.font_path}"')
return none
}
}
@@ -87,27 +87,27 @@ fn new_ft(c FTConfig) ?&FT {
font.get_path_variant(c.font_path, .bold)
}
bytes_bold := os.read_bytes(bold_path) or {
debug_font_println('failed to load font "$bold_path"')
debug_font_println('failed to load font "${bold_path}"')
bold_path = c.font_path
bytes
}
mut mono_path := font.get_path_variant(c.font_path, .mono)
bytes_mono := os.read_bytes(mono_path) or {
debug_font_println('failed to load font "$mono_path"')
debug_font_println('failed to load font "${mono_path}"')
mono_path = c.font_path
bytes
}
mut italic_path := font.get_path_variant(c.font_path, .italic)
bytes_italic := os.read_bytes(italic_path) or {
debug_font_println('failed to load font "$italic_path"')
debug_font_println('failed to load font "${italic_path}"')
italic_path = c.font_path
bytes
}
fons := sfons.create(512, 512, 1)
debug_font_println('Font used for font_normal : $normal_path')
debug_font_println('Font used for font_bold : $bold_path')
debug_font_println('Font used for font_mono : $mono_path')
debug_font_println('Font used for font_italic : $italic_path')
debug_font_println('Font used for font_normal : ${normal_path}')
debug_font_println('Font used for font_bold : ${bold_path}')
debug_font_println('Font used for font_mono : ${mono_path}')
debug_font_println('Font used for font_italic : ${italic_path}')
return &FT{
fons: fons
font_normal: fons.add_font_mem('sans', bytes, false)