Skip to content

Commit

Permalink
all: replace "NB:" with "Note:" (docs/comments)
Browse files Browse the repository at this point in the history
  • Loading branch information
medvednikov committed Mar 6, 2022
1 parent f74b65b commit 36ec47c
Show file tree
Hide file tree
Showing 131 changed files with 209 additions and 209 deletions.
2 changes: 1 addition & 1 deletion cmd/tools/detect_tcc.v
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ fn main() {
}

println('
NB: `tcc` was not used, so unless you install it yourself, your backend
Note: `tcc` was not used, so unless you install it yourself, your backend
C compiler will be `cc`, which is usually either `clang`, `gcc` or `msvc`.
These C compilers, are several times slower at compiling C source code,
Expand Down
2 changes: 1 addition & 1 deletion cmd/tools/modules/testing/common.v
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ pub fn prepare_test_session(zargs string, folder string, oskipped []string, main
mut skipped := oskipped.clone()
next_file: for f in files {
fnormalised := f.replace('\\', '/')
// NB: a `testdata` folder, is the preferred name of a folder, containing V code,
// Note: a `testdata` folder, is the preferred name of a folder, containing V code,
// that you *do not want* the test framework to find incidentally for various reasons,
// for example module import tests, or subtests, that are compiled/run by other parent tests
// in specific configurations, etc.
Expand Down
2 changes: 1 addition & 1 deletion cmd/tools/modules/vgit/vgit.v
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub fn prepare_vc_source(vcdir string, cdir string, commit string) (string, stri
}

pub fn clone_or_pull(remote_git_url string, local_worktree_path string) {
// NB: after clone_or_pull, the current repo branch is === HEAD === master
// Note: after clone_or_pull, the current repo branch is === HEAD === master
if os.is_dir(local_worktree_path) && os.is_dir(os.join_path_single(local_worktree_path, '.git')) {
// Already existing ... Just pulling in this case is faster usually.
scripting.run('git -C "$local_worktree_path" checkout --quiet master')
Expand Down
2 changes: 1 addition & 1 deletion cmd/tools/oldv.v
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fn (mut c Context) compile_oldv_if_needed() {
c.vgcontext.compile_oldv_if_needed()
c.commit_v_hash = c.vgcontext.commit_v__hash
if !os.exists(c.vgcontext.vexepath) && c.cmd_to_run.len > 0 {
// NB: 125 is a special code, that git bisect understands as 'skip this commit'.
// Note: 125 is a special code, that git bisect understands as 'skip this commit'.
// it is used to inform git bisect that the current commit leads to a build failure.
exit(125)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/tools/repeat.v
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ fn (mut context Context) parse_options() ? {
mut fp := flag.new_flag_parser(os.args)
fp.application(os.file_name(os.executable()))
fp.version('0.0.1')
fp.description('Repeat command(s) and collect statistics. NB: you have to quote each command, if it contains spaces.')
fp.description('Repeat command(s) and collect statistics. Note: you have to quote each command, if it contains spaces.')
fp.arguments_description('CMD1 CMD2 ...')
fp.skip_executable()
fp.limit_free_args_to_at_least(1) ?
Expand All @@ -161,7 +161,7 @@ fn (mut context Context) parse_options() ? {
context.warmup = fp.int('warmup', `w`, 2, 'Warmup runs. These are done *only at the start*, and are ignored.')
context.show_help = fp.bool('help', `h`, false, 'Show this help screen.')
context.use_newline = fp.bool('newline', `n`, false, 'Use \\n, do not overwrite the last line. Produces more output, but easier to diagnose.')
context.show_output = fp.bool('output', `O`, false, 'Show command stdout/stderr in the progress indicator for each command. NB: slower, for verbose commands.')
context.show_output = fp.bool('output', `O`, false, 'Show command stdout/stderr in the progress indicator for each command. Note: slower, for verbose commands.')
context.verbose = fp.bool('verbose', `v`, false, 'Be more verbose.')
context.fail_on_maxtime = fp.int('max_time', `m`, max_time, 'Fail with exit code 2, when first cmd takes above M milliseconds (regression).')
context.fail_on_regress_percent = fp.int('fail_percent', `f`, max_fail_percent, 'Fail with exit code 3, when first cmd is X% slower than the rest (regression).')
Expand Down
2 changes: 1 addition & 1 deletion cmd/tools/vbuild-tools.v
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import os
import testing
import v.util

// NB: tools like vdoc are compiled in their own subfolder
// Note: tools like vdoc are compiled in their own subfolder
// => cmd/tools/vdoc/vdoc.exe
// Usually, they have several top level .v files in the subfolder,
// that cannot be compiled separately, but instead, the whole folder,
Expand Down
4 changes: 2 additions & 2 deletions cmd/tools/vfmt.v
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ import vhelp

struct FormatOptions {
is_l bool
is_c bool // NB: This refers to the '-c' fmt flag, NOT the C backend
is_c bool // Note: This refers to the '-c' fmt flag, NOT the C backend
is_w bool
is_diff bool
is_verbose bool
is_all bool
is_debug bool
is_noerror bool
is_verify bool // exit(1) if the file is not vfmt'ed
is_worker bool // true *only* in the worker processes. NB: workers can crash.
is_worker bool // true *only* in the worker processes. Note: workers can crash.
is_backup bool // make a `file.v.bak` copy *before* overwriting a `file.v` in place with `-w`
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/tools/vrepl.v
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ fn print_welcome_screen() {
]
help_text := [
'Welcome to the V REPL (for help with V itself, type $cmd_exit, then run $cmd_help).',
'NB: the REPL is highly experimental. For best V experience, use a text editor, ',
'Note: the REPL is highly experimental. For best V experience, use a text editor, ',
'save your code in a $file_main file and execute: $cmd_run',
version.full_v_version(false),
'Use Ctrl-C or ${term.highlight_command('exit')} to exit, or ${term.highlight_command('help')} to see other available commands',
Expand Down Expand Up @@ -387,7 +387,7 @@ fn run_repl(workdir string, vrepl_prefix string) {
}
}
}
// NB: starting a line with 2 spaces escapes the println heuristic
// Note: starting a line with 2 spaces escapes the println heuristic
if oline.starts_with(' ') {
is_statement = true
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/tools/vtest-all.v
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ fn get_all_commands() []Command {
}
res << Command{
line: '$vexe $vargs -progress test-fmt'
okmsg: 'All .v files can be processed with `v fmt`. NB: the result may not always be compilable, but `v fmt` should not crash.'
okmsg: 'All .v files can be processed with `v fmt`. Note: the result may not always be compilable, but `v fmt` should not crash.'
}
res << Command{
line: '$vexe $vargs -progress test-self'
Expand Down Expand Up @@ -201,7 +201,7 @@ fn get_all_commands() []Command {
okmsg: '`v -usecache -cg` works.'
rmfile: 'examples/hello_world'
}
// NB: test that a program that depends on thirdparty libraries with its
// Note: test that a program that depends on thirdparty libraries with its
// own #flags (tetris depends on gg, which uses sokol) can be compiled
// with -usecache:
res << Command{
Expand Down
2 changes: 1 addition & 1 deletion cmd/tools/vtest-parser.v
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ fn process_cli_args() &Context {
fp.description('Test the V parser, by parsing each .v file in each PATH,\n' +
'as if it was typed character by character by the user.\n' +
'A PATH can be either a folder, or a specific .v file.\n' +
'NB: you *have to quote* the PATH, if it contains spaces/punctuation.')
'Note: you *have to quote* the PATH, if it contains spaces/punctuation.')
fp.arguments_description('PATH1 PATH2 ...')
fp.skip_executable()
context.is_help = fp.bool('help', `h`, false, 'Show help/usage screen.')
Expand Down
4 changes: 2 additions & 2 deletions cmd/tools/vtest-self.v
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ const (
]
)

// NB: musl misses openssl, thus the http tests can not be done there
// NB: http_httpbin_test.v: fails with 'cgen error: json: map_string_string is not struct'
// Note: musl misses openssl, thus the http tests can not be done there
// Note: http_httpbin_test.v: fails with 'cgen error: json: map_string_string is not struct'
fn main() {
vexe := pref.vexe_path()
vroot := os.dir(vexe)
Expand Down
2 changes: 1 addition & 1 deletion cmd/tools/vtest.v
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ fn show_usage() {
println(' B)')
println(' v test file_test.v : run test functions in a given test file.')
println(' v -stats test file_test.v : as above, but with more stats.')
println(' NB: you can also give many and mixed folder/ file_test.v arguments after `v test` .')
println(' Note: you can also give many and mixed folder/ file_test.v arguments after `v test` .')
println('')
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/tools/vup.v
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fn (app App) update_from_master() {
}

fn (app App) recompile_v() {
// NB: app.vexe is more reliable than just v (which may be a symlink)
// Note: app.vexe is more reliable than just v (which may be a symlink)
opts := if app.is_prod { '-prod' } else { '' }
vself := '${os.quoted_path(app.vexe)} $opts self'
app.vprintln('> recompiling v itself with `$vself` ...')
Expand Down
2 changes: 1 addition & 1 deletion cmd/tools/vvet/vvet.v
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fn main() {
eprintln(vt.e2string(err))
}
if vfmt_err_count > 0 {
eprintln('NB: You can run `v fmt -w file.v` to fix these errors automatically')
eprintln('Note: You can run `v fmt -w file.v` to fix these errors automatically')
}
if vt.errors.len > 0 {
exit(1)
Expand Down
2 changes: 1 addition & 1 deletion cmd/tools/vwatch.v
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fn get_scan_timeout_seconds() int {
// workers, thus it does not leak much.
//
// b) A worker process, doing the actual monitoring/polling.
// NB: *workers are started with the --vwatchworker option*
// Note: *workers are started with the --vwatchworker option*
//
// Worker processes will run for a limited number of iterations, then
// they will do exit(255), and then the parent will start a new worker.
Expand Down
2 changes: 1 addition & 1 deletion examples/news_fetcher.v
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn main() {
mut fetcher_pool := pool.new_pool_processor(
callback: worker_fetch
)
// NB: if you do not call set_max_jobs, the pool will try to use an optimal
// Note: if you do not call set_max_jobs, the pool will try to use an optimal
// number of threads, one per each core in your system, which in most
// cases is what you want anyway... You can override the automatic choice
// by setting the VJOBS environment variable too.
Expand Down
2 changes: 1 addition & 1 deletion examples/sokol/sounds/wav_player.v
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ fn (mut p Player) free() {
// http://www.lightlink.com/tjweber/StripWav/WAVE.html
// http://www.lightlink.com/tjweber/StripWav/Canon.html
// https://tools.ietf.org/html/draft-ema-vpim-wav-00
// NB: > The chunks MAY appear in any order except that the Format chunk
// Note: > The chunks MAY appear in any order except that the Format chunk
// > MUST be placed before the Sound data chunk (but not necessarily
// > contiguous to the Sound data chunk).
struct RIFFHeader {
Expand Down
2 changes: 1 addition & 1 deletion examples/tree_of_nodes.v
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ struct Node {
right Tree
}

// NB: a match expression, infers the type of its result
// Note: a match expression, infers the type of its result
// from the type of the return value in the first branch,
// => it needs an explicit int(0) cast here:
fn size(tree Tree) int {
Expand Down
2 changes: 1 addition & 1 deletion examples/vweb/server_sent_events/server.v
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub fn (mut app App) index() vweb.Result {

fn (mut app App) sse() vweb.Result {
mut session := sse.new_connection(app.conn)
// NB: you can setup session.write_timeout and session.headers here
// Note: you can setup session.write_timeout and session.headers here
session.start() or { return app.server_error(501) }
session.send_message(data: 'ok') or { return app.server_error(501) }
for {
Expand Down
4 changes: 2 additions & 2 deletions vlib/builtin/array.v
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ pub fn (mut a array) delete_many(i int, size int) {
panic('array.delete: index out of range (i == $i$endidx, a.len == $a.len)')
}
}
// NB: if a is [12,34], a.len = 2, a.delete(0)
// Note: if a is [12,34], a.len = 2, a.delete(0)
// should move (2-0-1) elements = 1 element (the 34) forward
old_data := a.data
new_size := a.len - size
Expand Down Expand Up @@ -400,7 +400,7 @@ pub fn (mut a array) pop() voidptr {
new_len := a.len - 1
last_elem := unsafe { &byte(a.data) + new_len * a.element_size }
a.len = new_len
// NB: a.cap is not changed here *on purpose*, so that
// Note: a.cap is not changed here *on purpose*, so that
// further << ops on that array will be more efficient.
return unsafe { memdup(last_elem, a.element_size) }
}
Expand Down
2 changes: 1 addition & 1 deletion vlib/builtin/array_d_gcboehm_opt.v
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ fn (mut a array) pop_noscan() voidptr {
new_len := a.len - 1
last_elem := unsafe { &byte(a.data) + new_len * a.element_size }
a.len = new_len
// NB: a.cap is not changed here *on purpose*, so that
// Note: a.cap is not changed here *on purpose*, so that
// further << ops on that array will be more efficient.
return unsafe { memdup_noscan(last_elem, a.element_size) }
}
Expand Down
8 changes: 4 additions & 4 deletions vlib/builtin/builtin.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ fn vcommithash() string {

// panic_debug private function that V uses for panics, -cg/-g is passed
// recent versions of tcc print nicer backtraces automatically
// NB: the duplication here is because tcc_backtrace should be called directly
// Note: the duplication here is because tcc_backtrace should be called directly
// inside the panic functions.
[noreturn]
fn panic_debug(line_no int, file string, mod string, fn_name string, s string) {
// NB: the order here is important for a stabler test output
// Note: the order here is important for a stabler test output
// module is less likely to change than function, etc...
// During edits, the line number will change most frequently,
// so it is last
Expand Down Expand Up @@ -387,7 +387,7 @@ pub fn v_realloc(b &byte, n int) &byte {
// bytes. `old_data` must be a pointer to an existing memory block, previously
// allocated with `malloc`, `v_calloc` or `vcalloc`, of size `old_data`.
// realloc_data returns a pointer to the new location of the block.
// NB: if you know the old data size, it is preferable to call `realloc_data`,
// Note: if you know the old data size, it is preferable to call `realloc_data`,
// instead of `v_realloc`, at least during development, because `realloc_data`
// can make debugging easier, when you compile your program with
// `-d debug_realloc`.
Expand All @@ -400,7 +400,7 @@ pub fn realloc_data(old_data &byte, old_size int, new_size int) &byte {
return unsafe { prealloc_realloc(old_data, old_size, new_size) }
}
$if debug_realloc ? {
// NB: this is slower, but helps debugging memory problems.
// Note: this is slower, but helps debugging memory problems.
// The main idea is to always force reallocating:
// 1) allocate a new memory block
// 2) copy the old to the new
Expand Down
2 changes: 1 addition & 1 deletion vlib/builtin/builtin_nix.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ fn print_backtrace_skipping_top_frames_linux(skipframes int) bool {
output = ''
}
// See http://wiki.dwarfstd.org/index.php?title=Path_Discriminators
// NB: it is shortened here to just d. , just so that it fits, and so
// Note: it is shortened here to just d. , just so that it fits, and so
// that the common error file:lineno: line format is enforced.
output = output.replace(' (discriminator', ': (d.')
eprintln('${output:-55s} | ${addr:14s} | $beforeaddr')
Expand Down
2 changes: 1 addition & 1 deletion vlib/builtin/builtin_notd_gcboehm.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module builtin

// Just define the C functions, so that V does not error because of the missing definitions.

// NB: they will NOT be used, since calls to them are wrapped with `$if gcboehm ? { }`
// Note: they will NOT be used, since calls to them are wrapped with `$if gcboehm ? { }`

fn C.GC_MALLOC(n usize) voidptr

Expand Down
4 changes: 2 additions & 2 deletions vlib/builtin/float_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ fn test_float_point_formatting_rounding() {
assert '${239.5:0.0f}' == '240'
assert '${239.55:0.1f}' == '239.6'
assert '${239.555:0.2f}' == '239.56'
assert '${239.5555:0.3f}' == '239.555' // NB: 5 ?
assert '${239.5555:0.3f}' == '239.555' // Note: 5 ?
assert '${239.55555:0.4f}' == '239.5556'
assert '${239.555555:0.5f}' == '239.55555' // NB: 5 ?
assert '${239.555555:0.5f}' == '239.55555' // Note: 5 ?
assert '${239.5555555:0.6f}' == '239.555556' // after this, it is all ending in 6
assert '${239.55555555:0.7f}' == '239.5555556'
assert '${239.555555555:0.8f}' == '239.55555556'
Expand Down
2 changes: 1 addition & 1 deletion vlib/builtin/int.v
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ pub fn (b []byte) clone() []byte {
}

// bytestr produces a string from *all* the bytes in the array.
// NB: the returned string will have .len equal to the array.len,
// Note: the returned string will have .len equal to the array.len,
// even when some of the array bytes were `0`.
// If you want to get a V string, that contains only the bytes till
// the first `0` byte, use `tos_clone(&byte(array.data))` instead.
Expand Down
4 changes: 2 additions & 2 deletions vlib/builtin/prealloc.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module builtin
// The goal of all this is to amortize the cost of calling libc's malloc,
// trading higher memory usage for a compiler (or any single threaded batch
// mode program), for a ~8-10% speed increase.
// NB: `-prealloc` is NOT safe to be used for multithreaded programs!
// Note: `-prealloc` is NOT safe to be used for multithreaded programs!

// size of the preallocated chunk
const prealloc_block_size = 16 * 1024 * 1024
Expand Down Expand Up @@ -74,7 +74,7 @@ fn prealloc_vinit() {
[unsafe]
fn prealloc_vcleanup() {
$if prealloc_stats ? {
// NB: we do 2 loops here, because string interpolation
// Note: we do 2 loops here, because string interpolation
// in the first loop may still use g_memory_block
// The second loop however should *not* allocate at all.
mut nr_mallocs := i64(0)
Expand Down
Loading

0 comments on commit 36ec47c

Please sign in to comment.