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

@ -50,17 +50,17 @@ fn parse_sequential_args() !SequentialArgs {
fp.skip_executable()
// output parameters
width := fp.int('width', `w`, sim.default_width, 'width of the image output. Defaults to $sim.default_width')
height := fp.int('height', `h`, sim.default_height, 'height of the image output. Defaults to $sim.default_height')
width := fp.int('width', `w`, sim.default_width, 'width of the image output. Defaults to ${sim.default_width}')
height := fp.int('height', `h`, sim.default_height, 'height of the image output. Defaults to ${sim.default_height}')
filename := fp.string('output', `o`, 'out.ppm', 'name of the image output. Defaults to out.ppm')
// simulation parameters
rope_length := fp.float('rope-length', 0, sim.default_rope_length, 'rope length to use on simulation. Defaults to $sim.default_rope_length')
bearing_mass := fp.float('bearing-mass', 0, sim.default_bearing_mass, 'bearing mass to use on simulation. Defaults to $sim.default_bearing_mass')
magnet_spacing := fp.float('magnet-spacing', 0, sim.default_magnet_spacing, 'magnet spacing to use on simulation. Defaults to $sim.default_magnet_spacing')
magnet_height := fp.float('magnet-height', 0, sim.default_magnet_height, 'magnet height to use on simulation. Defaults to $sim.default_magnet_height')
magnet_strength := fp.float('magnet-strength', 0, sim.default_magnet_strength, 'magnet strength to use on simulation. Defaults to $sim.default_magnet_strength')
gravity := fp.float('gravity', 0, sim.default_gravity, 'gravity to use on simulation. Defaults to $sim.default_gravity')
rope_length := fp.float('rope-length', 0, sim.default_rope_length, 'rope length to use on simulation. Defaults to ${sim.default_rope_length}')
bearing_mass := fp.float('bearing-mass', 0, sim.default_bearing_mass, 'bearing mass to use on simulation. Defaults to ${sim.default_bearing_mass}')
magnet_spacing := fp.float('magnet-spacing', 0, sim.default_magnet_spacing, 'magnet spacing to use on simulation. Defaults to ${sim.default_magnet_spacing}')
magnet_height := fp.float('magnet-height', 0, sim.default_magnet_height, 'magnet height to use on simulation. Defaults to ${sim.default_magnet_height}')
magnet_strength := fp.float('magnet-strength', 0, sim.default_magnet_strength, 'magnet strength to use on simulation. Defaults to ${sim.default_magnet_strength}')
gravity := fp.float('gravity', 0, sim.default_gravity, 'gravity to use on simulation. Defaults to ${sim.default_gravity}')
fp.finalize() or {
println(fp.usage())
@ -87,7 +87,7 @@ fn parse_sequential_args() !SequentialArgs {
grid: grid
}
sim.log('$args')
sim.log('${args}')
return args
}
@ -100,20 +100,20 @@ fn parse_parallel_args(extra_workers int) !ParallelArgs {
fp.description('This is a pendulum simulation written in pure V')
fp.skip_executable()
workers := fp.int('workers', 0, args.max_parallel_workers, 'amount of workers to use on simulation. Defaults to $args.max_parallel_workers')
workers := fp.int('workers', 0, args.max_parallel_workers, 'amount of workers to use on simulation. Defaults to ${args.max_parallel_workers}')
// output parameters
width := fp.int('width', `w`, sim.default_width, 'width of the image output. Defaults to $sim.default_width')
height := fp.int('height', `h`, sim.default_height, 'height of the image output. Defaults to $sim.default_height')
width := fp.int('width', `w`, sim.default_width, 'width of the image output. Defaults to ${sim.default_width}')
height := fp.int('height', `h`, sim.default_height, 'height of the image output. Defaults to ${sim.default_height}')
filename := fp.string('output', `o`, 'out.ppm', 'name of the image output. Defaults to out.ppm')
// simulation parameters
rope_length := fp.float('rope-length', 0, sim.default_rope_length, 'rope length to use on simulation. Defaults to $sim.default_rope_length')
bearing_mass := fp.float('bearing-mass', 0, sim.default_bearing_mass, 'bearing mass to use on simulation. Defaults to $sim.default_bearing_mass')
magnet_spacing := fp.float('magnet-spacing', 0, sim.default_magnet_spacing, 'magnet spacing to use on simulation. Defaults to $sim.default_magnet_spacing')
magnet_height := fp.float('magnet-height', 0, sim.default_magnet_height, 'magnet height to use on simulation. Defaults to $sim.default_magnet_height')
magnet_strength := fp.float('magnet-strength', 0, sim.default_magnet_strength, 'magnet strength to use on simulation. Defaults to $sim.default_magnet_strength')
gravity := fp.float('gravity', 0, sim.default_gravity, 'gravity to use on simulation. Defaults to $sim.default_gravity')
rope_length := fp.float('rope-length', 0, sim.default_rope_length, 'rope length to use on simulation. Defaults to ${sim.default_rope_length}')
bearing_mass := fp.float('bearing-mass', 0, sim.default_bearing_mass, 'bearing mass to use on simulation. Defaults to ${sim.default_bearing_mass}')
magnet_spacing := fp.float('magnet-spacing', 0, sim.default_magnet_spacing, 'magnet spacing to use on simulation. Defaults to ${sim.default_magnet_spacing}')
magnet_height := fp.float('magnet-height', 0, sim.default_magnet_height, 'magnet height to use on simulation. Defaults to ${sim.default_magnet_height}')
magnet_strength := fp.float('magnet-strength', 0, sim.default_magnet_strength, 'magnet strength to use on simulation. Defaults to ${sim.default_magnet_strength}')
gravity := fp.float('gravity', 0, sim.default_gravity, 'gravity to use on simulation. Defaults to ${sim.default_gravity}')
fp.finalize() or {
println(fp.usage())
@ -141,7 +141,7 @@ fn parse_parallel_args(extra_workers int) !ParallelArgs {
workers: get_workers(workers, extra_workers)
}
sim.log('$args')
sim.log('${args}')
return args
}

View File

@ -50,7 +50,7 @@ pub fn ppm_writer_for_fname(fname string, settings ImageSettings) !&PPMWriter {
pub fn (mut writer PPMWriter) start_for_file(fname string, settings ImageSettings) ! {
writer.file = os.create(fname)!
writer.file.writeln('P6 $settings.width $settings.height 255')!
writer.file.writeln('P6 ${settings.width} ${settings.height} 255')!
}
pub fn (mut writer PPMWriter) handle_pixel(p gx.Color) ! {

View File

@ -26,7 +26,7 @@ pub fn image_worker(mut writer PPMWriter, result_chan chan &sim.SimResult, setti
bmark.step()
writer.handle_pixel(pixel_buf[current_index].Color) or {
bmark.fail()
sim.log(@MOD + '.' + @FN + ': pixel handler failed. Error $err')
sim.log(@MOD + '.' + @FN + ': pixel handler failed. Error ${err}')
break
}
bmark.ok()

View File

@ -38,7 +38,7 @@ pub fn (mut iw ImageWritter) handle(result sim.SimResult) !int {
for iw.current_index < total_pixels && iw.buffer[iw.current_index].valid {
iw.writer.handle_pixel(iw.buffer[iw.current_index].Color) or {
sim.log(@MOD + '.' + @FN + ': pixel handler failed. Error $err')
sim.log(@MOD + '.' + @FN + ': pixel handler failed. Error ${err}')
break
}
iw.current_index++

View File

@ -42,7 +42,7 @@ pub fn run(params SimParams, settings RunnerSettings) {
if !isnil(settings.on_start) {
settings.on_start() or {
log(@MOD + '.' + @FN + ': Simulation start handler failed. Error $err')
log(@MOD + '.' + @FN + ': Simulation start handler failed. Error ${err}')
}
}
@ -77,7 +77,7 @@ pub fn run(params SimParams, settings RunnerSettings) {
params: params
}
settings.on_request(request) or {
log(@MOD + '.' + @FN + ': request handler failed. Error $err')
log(@MOD + '.' + @FN + ': request handler failed. Error ${err}')
bmark.fail()
break
}
@ -90,7 +90,7 @@ pub fn run(params SimParams, settings RunnerSettings) {
if !isnil(settings.on_finish) {
settings.on_finish() or {
log(@MOD + '.' + @FN + ': Simulation stop handler failed. Error $err')
log(@MOD + '.' + @FN + ': Simulation stop handler failed. Error ${err}')
}
}
}

View File

@ -36,7 +36,7 @@ pub fn sim_worker(id int, request_chan chan &SimRequest, result_channels []chan
bmark.ok()
}
bmark.stop()
println(bmark.total_message(@FN + ': worker $id'))
println(bmark.total_message(@FN + ': worker ${id}'))
}
pub fn compute_result(request SimRequest) &SimResult {