diff --git a/bench/vectors/vectors.v b/bench/vectors/vectors.v index 9371986e4a..d9b7c5f55c 100644 --- a/bench/vectors/vectors.v +++ b/bench/vectors/vectors.v @@ -9,12 +9,10 @@ struct Vector { z f64 } -const ( - boids_count = 10000 - max_coordinate = 10000.0 - cohesion_distance = 10.0 - separation_distance = 5.0 -) +const boids_count = 10000 +const max_coordinate = 10000.0 +const cohesion_distance = 10.0 +const separation_distance = 5.0 @[direct_array_access] fn main() { diff --git a/cmd/tools/check_os_api_parity.v b/cmd/tools/check_os_api_parity.v index fd58749a6b..3945c5359f 100644 --- a/cmd/tools/check_os_api_parity.v +++ b/cmd/tools/check_os_api_parity.v @@ -10,24 +10,22 @@ import v.ast import rand import term -const ( - base_os = 'linux' - os_names = ['linux', 'macos', 'windows', 'freebsd', 'openbsd', 'solaris', 'termux'] - skip_modules = [ - 'builtin.bare', - 'builtin.linux_bare.old', - 'builtin.js', - 'strconv', - 'strconv.ftoa', - 'hash', - 'strings', - 'crypto.rand', - 'os.bare', - 'os2', - 'szip', - 'v.eval', - ] -) +const base_os = 'linux' +const os_names = ['linux', 'macos', 'windows', 'freebsd', 'openbsd', 'solaris', 'termux'] +const skip_modules = [ + 'builtin.bare', + 'builtin.linux_bare.old', + 'builtin.js', + 'strconv', + 'strconv.ftoa', + 'hash', + 'strings', + 'crypto.rand', + 'os.bare', + 'os2', + 'szip', + 'v.eval', +] struct App { diff_cmd string diff --git a/cmd/tools/gen_vc.v b/cmd/tools/gen_vc.v index dfc31e8dfc..a0ea67e81b 100644 --- a/cmd/tools/gen_vc.v +++ b/cmd/tools/gen_vc.v @@ -22,60 +22,50 @@ import net.urllib // --force force update even if already up to date // git credentials -const ( - git_username = os.getenv('GITUSER') - git_password = os.getenv('GITPASS') -) +const git_username = os.getenv('GITUSER') +const git_password = os.getenv('GITPASS') // repository -const ( - // git repo - git_repo_v = 'github.com/vlang/v' - git_repo_vc = 'github.com/vlang/vc' - // local repo directories - git_repo_dir_v = 'v' - git_repo_dir_vc = 'vc' -) +// git repo +const git_repo_v = 'github.com/vlang/v' +const git_repo_vc = 'github.com/vlang/vc' +// local repo directories +const git_repo_dir_v = 'v' +const git_repo_dir_vc = 'vc' // gen_vc -const ( - // name - app_name = 'gen_vc' - // version - app_version = '0.1.3' - // description - app_description = "This tool regenerates V's bootstrap .c files every time the V master branch is updated." - // assume something went wrong if file size less than this - too_short_file_limit = 5000 - // create a .c file for these os's - vc_build_oses = [ - 'nix', - // all nix based os - 'windows', - ] -) +// name +const app_name = 'gen_vc' +// version +const app_version = '0.1.3' +// description +const app_description = "This tool regenerates V's bootstrap .c files every time the V master branch is updated." +// assume something went wrong if file size less than this +const too_short_file_limit = 5000 +// create a .c file for these os's +const vc_build_oses = [ + 'nix', + // all nix based os + 'windows', +] // default options (overridden by flags) -const ( - // gen_vc working directory - work_dir = '/tmp/gen_vc' - // dont push anything to remote repo - dry_run = false - // server port - server_port = 7171 - // log file - log_file = '${work_dir}/log.txt' - // log_to is either 'file' or 'terminal' - log_to = 'terminal' -) +// gen_vc working directory +const work_dir = '/tmp/gen_vc' +// dont push anything to remote repo +const dry_run = false +// server port +const server_port = 7171 +// log file +const log_file = '${work_dir}/log.txt' +// log_to is either 'file' or 'terminal' +const log_to = 'terminal' // errors -const ( - err_msg_build = 'error building' - err_msg_make = 'make failed' - err_msg_gen_c = 'failed to generate .c file' - err_msg_cmd_x = 'error running cmd' -) +const err_msg_build = 'error building' +const err_msg_make = 'make failed' +const err_msg_gen_c = 'failed to generate .c file' +const err_msg_cmd_x = 'error running cmd' struct GenVC { // logger diff --git a/cmd/tools/modules/scripting/scripting.v b/cmd/tools/modules/scripting/scripting.v index 833c538311..fd1382b579 100644 --- a/cmd/tools/modules/scripting/scripting.v +++ b/cmd/tools/modules/scripting/scripting.v @@ -4,9 +4,7 @@ import os import term import time -const ( - term_colors = term.can_show_color_on_stdout() -) +const term_colors = term.can_show_color_on_stdout() pub fn set_verbose(on bool) { // setting a global here would be the obvious solution, diff --git a/cmd/tools/oldv.v b/cmd/tools/oldv.v index 50feae3fb8..fa064d5f65 100644 --- a/cmd/tools/oldv.v +++ b/cmd/tools/oldv.v @@ -3,9 +3,8 @@ import flag import scripting import vgit -const ( - tool_version = '0.0.4' - tool_description = ' Checkout an old V and compile it as it was on specific commit. +const tool_version = '0.0.4' +const tool_description = ' Checkout an old V and compile it as it was on specific commit. | This tool is useful, when you want to discover when something broke. | It is also useful, when you just want to experiment with an older historic V. | @@ -25,7 +24,6 @@ const ( | ## until you find the commit, where the problem first occurred. | ## When you finish, do not forget to do: | git bisect reset'.strip_margin() -) struct Context { mut: diff --git a/cmd/tools/performance_compare.v b/cmd/tools/performance_compare.v index 1552ef9f1a..e59758d35f 100644 --- a/cmd/tools/performance_compare.v +++ b/cmd/tools/performance_compare.v @@ -3,13 +3,11 @@ import flag import scripting import vgit -const ( - tool_version = '0.0.6' - tool_description = " Compares V executable size and performance, +const tool_version = '0.0.6' +const tool_description = " Compares V executable size and performance, | between 2 commits from V's local git history. | When only one commit is given, it is compared to master. | ".strip_margin() -) struct Context { cwd string // current working folder diff --git a/cmd/tools/repeat.v b/cmd/tools/repeat.v index ad0dcedcee..f5fa2d29d0 100644 --- a/cmd/tools/repeat.v +++ b/cmd/tools/repeat.v @@ -135,11 +135,10 @@ fn (a Aints) str() string { 'ms ± σ: ${a.stddev:4.1f}ms, min: ${a.imin:4}ms, max: ${a.imax:4}ms, runs:${a.values.len:3}, nmins:${a.nmins:2}, nmaxs:${a.nmaxs:2}' } -const ( - max_fail_percent = 100 * 1000 - max_time = 60 * 1000 // ms - performance_regression_label = 'Performance regression detected, failing since ' -) +const max_fail_percent = 100 * 1000 +const max_time = 60 * 1000 // ms + +const performance_regression_label = 'Performance regression detected, failing since ' fn main() { mut context := Context{} diff --git a/cmd/tools/test_if_v_test_system_works.v b/cmd/tools/test_if_v_test_system_works.v index b16afab0a4..61877ddf5c 100644 --- a/cmd/tools/test_if_v_test_system_works.v +++ b/cmd/tools/test_if_v_test_system_works.v @@ -5,11 +5,9 @@ module main import os import rand -const ( - vexe = os.quoted_path(get_vexe_path()) - vroot = os.dir(vexe) - tdir = new_tdir() -) +const vexe = os.quoted_path(get_vexe_path()) +const vroot = os.dir(vexe) +const tdir = new_tdir() fn get_vexe_path() string { env_vexe := os.getenv('VEXE') diff --git a/cmd/tools/vast/test/demo.v b/cmd/tools/vast/test/demo.v index 58a0690337..9166601c53 100644 --- a/cmd/tools/vast/test/demo.v +++ b/cmd/tools/vast/test/demo.v @@ -10,11 +10,9 @@ import math import time { Time, now } // const decl -const ( - a = 1 - b = 3 - c = 'c' -) +const a = 1 +const b = 3 +const c = 'c' // struct decl struct Point { diff --git a/cmd/tools/vbin2v.v b/cmd/tools/vbin2v.v index 7a05ca27b6..d44dbb107a 100644 --- a/cmd/tools/vbin2v.v +++ b/cmd/tools/vbin2v.v @@ -4,10 +4,8 @@ import os import flag import strings -const ( - tool_version = '0.0.4' - tool_description = 'Converts a list of arbitrary files into a single v module file.' -) +const tool_version = '0.0.4' +const tool_description = 'Converts a list of arbitrary files into a single v module file.' struct Context { mut: diff --git a/cmd/tools/vbump.v b/cmd/tools/vbump.v index 6d57683d7a..3a72287b6a 100644 --- a/cmd/tools/vbump.v +++ b/cmd/tools/vbump.v @@ -7,10 +7,9 @@ import os import regex import semver -const ( - tool_name = os.file_name(os.executable()) - tool_version = '0.1.0' - tool_description = '\n Bump the semantic version of the v.mod and/or specified files. +const tool_name = os.file_name(os.executable()) +const tool_version = '0.1.0' +const tool_description = '\n Bump the semantic version of the v.mod and/or specified files. The first instance of a version number is replaced with the new version. Additionally, the line affected must contain the word "version" in any @@ -34,8 +33,8 @@ Examples: Upgrade the minor version in sample.v only v bump --minor sample.v ' - semver_query = r'((0)|([1-9]\d*)\.){2}(0)|([1-9]\d*)(\-[\w\d\.\-_]+)?(\+[\w\d\.\-_]+)?' -) + +const semver_query = r'((0)|([1-9]\d*)\.){2}(0)|([1-9]\d*)(\-[\w\d\.\-_]+)?(\+[\w\d\.\-_]+)?' struct Options { show_help bool diff --git a/cmd/tools/vbump_test.v b/cmd/tools/vbump_test.v index 2b997da580..919c00a308 100644 --- a/cmd/tools/vbump_test.v +++ b/cmd/tools/vbump_test.v @@ -1,9 +1,7 @@ import os -const ( - vexe = @VEXE - tfolder = os.join_path(os.vtmp_dir(), 'vbump') -) +const vexe = @VEXE +const tfolder = os.join_path(os.vtmp_dir(), 'vbump') fn testsuite_begin() { os.mkdir_all(tfolder) or {} @@ -59,10 +57,9 @@ version = '1.5.1' import os import flag -const ( - tool_name = os.file_name(os.executable()) - tool_version = '0.1.33' -) +const tool_name = os.file_name(os.executable()) +const tool_version = '0.1.33' + fn main() { // stuff } diff --git a/cmd/tools/vcheck-md.v b/cmd/tools/vcheck-md.v index 0a4e6d5f11..2169d67bfb 100644 --- a/cmd/tools/vcheck-md.v +++ b/cmd/tools/vcheck-md.v @@ -10,21 +10,19 @@ import term import v.help import regex -const ( - too_long_line_length_example = 120 - too_long_line_length_codeblock = 120 - too_long_line_length_table = 120 - too_long_line_length_link = 150 - too_long_line_length_other = 100 - term_colors = term.can_show_color_on_stderr() - hide_warnings = '-hide-warnings' in os.args || '-w' in os.args - show_progress = os.getenv('GITHUB_JOB') == '' && '-silent' !in os.args - non_option_args = cmdline.only_non_options(os.args[2..]) - is_verbose = os.getenv('VERBOSE') != '' - vcheckfolder = os.join_path(os.vtmp_dir(), 'vcheck_${os.getuid()}') - should_autofix = os.getenv('VAUTOFIX') != '' - vexe = @VEXE -) +const too_long_line_length_example = 120 +const too_long_line_length_codeblock = 120 +const too_long_line_length_table = 120 +const too_long_line_length_link = 150 +const too_long_line_length_other = 100 +const term_colors = term.can_show_color_on_stderr() +const hide_warnings = '-hide-warnings' in os.args || '-w' in os.args +const show_progress = os.getenv('GITHUB_JOB') == '' && '-silent' !in os.args +const non_option_args = cmdline.only_non_options(os.args[2..]) +const is_verbose = os.getenv('VERBOSE') != '' +const vcheckfolder = os.join_path(os.vtmp_dir(), 'vcheck_${os.getuid()}') +const should_autofix = os.getenv('VAUTOFIX') != '' +const vexe = @VEXE struct CheckResult { pub mut: diff --git a/cmd/tools/vcomplete.v b/cmd/tools/vcomplete.v index 9aa7b43d1d..98491fe9be 100644 --- a/cmd/tools/vcomplete.v +++ b/cmd/tools/vcomplete.v @@ -41,10 +41,10 @@ module main import os -const ( - auto_complete_shells = ['bash', 'fish', 'zsh', 'powershell'] // list of supported shells - vexe = os.getenv('VEXE') - help_text = "Usage: +const auto_complete_shells = ['bash', 'fish', 'zsh', 'powershell'] // list of supported shells + +const vexe = os.getenv('VEXE') +const help_text = "Usage: v complete [options] [SUBCMD] QUERY... Description: @@ -72,217 +72,214 @@ SUBCMD: fish : [QUERY] - returns Fish compatible completion code with completions computed from QUERY zsh : [QUERY] - returns ZSH compatible completion code with completions computed from QUERY powershell: [QUERY] - returns PowerShell compatible completion code with completions computed from QUERY" -) // Snooped from cmd/v/v.v, vlib/v/pref/pref.c.v -const ( - auto_complete_commands = [ - // simple_cmd - 'ast', - 'doc', - 'vet', - // tools in one .v file - 'bin2v', - 'bug', - 'build-examples', - 'build-tools', - 'build-vbinaries', - 'bump', - 'check-md', - 'complete', - 'compress', - 'create', - 'doctor', - 'fmt', - 'gret', - 'ls', - 'repl', - 'self', - 'setup-freetype', - 'shader', - 'symlink', - 'test-all', - 'test-cleancode', - 'test-fmt', - 'test-parser', - 'test-self', - 'test', - 'tracev', - 'up', - 'watch', - 'wipe-cache', - // commands - 'help', - 'new', - 'init', - 'translate', - 'self', - 'search', - 'install', - 'update', - 'upgrade', - 'outdated', - 'list', - 'remove', - 'vlib-docs', - 'get', - 'version', - 'run', - 'build', - 'build-module', - 'missdoc', - ] - // Entries in the flag arrays below should be entered as is: - // * Short flags, e.g.: "-v", should be entered: '-v' - // * Long flags, e.g.: "--version", should be entered: '--version' - // * Single-dash flags, e.g.: "-version", should be entered: '-version' - auto_complete_flags = [ - '-apk', - '-show-timings', - '-check-syntax', - '-check', - '-v', - '-progress', - '-silent', - '-g', - '-cg', - '-repl', - '-live', - '-sharedlive', - '-shared', - '--enable-globals', - '-enable-globals', - '-autofree', - '-compress', - '-freestanding', - '-no-builtin', - '-no-parallel', - '-no-preludes', - '-prof', - '-profile', - '-profile-no-inline', - '-prod', - '-simulator', - '-stats', - '-obfuscate', - '-translated', - '-color', - '-nocolor', - '-showcc', - '-show-c-output', - '-experimental', - '-usecache', - '-prealloc', - '-parallel', - '-native', - '-W', - '-keepc', - '-w', - '-print-v-files', - '-error-limit', - '-message-limit', - '-os', - '-printfn', - '-cflags', - '-define', - '-d', - '-cc', - '-o', - '-b', - '-path', - '-custom-prelude', - '-name', - '-bundle', - '-V', - '-version', - '--version', - ] - auto_complete_flags_doc = [ - '-all', - '-f', - '-h', - '-help', - '-m', - '-o', - '-readme', - '-v', - '-filename', - '-pos', - '-no-timestamp', - '-inline-assets', - '-theme-dir', - '-open', - '-p', - '-s', - '-l', - ] - auto_complete_flags_fmt = [ - '-c', - '-diff', - '-l', - '-w', - '-debug', - '-verify', - ] - auto_complete_flags_bin2v = [ - '-h', - '--help', - '-m', - '--module', - '-p', - '--prefix', - '-w', - '--write', - ] - auto_complete_flags_shader = [ - '--help', - '-h', - '--force-update', - '-u', - '--verbose', - '-v', - '--slang', - '-l', - '--output', - '-o', - ] - auto_complete_flags_missdoc = [ - '--help', - '-h', - '--tags', - '-t', - '--deprecated', - '-d', - '--private', - '-p', - '--no-line-numbers', - '-n', - '--exclude', - '-e', - '--relative-paths', - '-r', - '--js', - '--verify', - '--diff', - ] - auto_complete_flags_bump = [ - '--patch', - '--minor', - '--major', - ] - auto_complete_flags_self = [ - '-prod', - ] - auto_complete_compilers = [ - 'cc', - 'gcc', - 'tcc', - 'tinyc', - 'clang', - 'mingw', - 'msvc', - ] -) +const auto_complete_commands = [ + // simple_cmd + 'ast', + 'doc', + 'vet', + // tools in one .v file + 'bin2v', + 'bug', + 'build-examples', + 'build-tools', + 'build-vbinaries', + 'bump', + 'check-md', + 'complete', + 'compress', + 'create', + 'doctor', + 'fmt', + 'gret', + 'ls', + 'repl', + 'self', + 'setup-freetype', + 'shader', + 'symlink', + 'test-all', + 'test-cleancode', + 'test-fmt', + 'test-parser', + 'test-self', + 'test', + 'tracev', + 'up', + 'watch', + 'wipe-cache', + // commands + 'help', + 'new', + 'init', + 'translate', + 'self', + 'search', + 'install', + 'update', + 'upgrade', + 'outdated', + 'list', + 'remove', + 'vlib-docs', + 'get', + 'version', + 'run', + 'build', + 'build-module', + 'missdoc', +] +// Entries in the flag arrays below should be entered as is: +// * Short flags, e.g.: "-v", should be entered: '-v' +// * Long flags, e.g.: "--version", should be entered: '--version' +// * Single-dash flags, e.g.: "-version", should be entered: '-version' +const auto_complete_flags = [ + '-apk', + '-show-timings', + '-check-syntax', + '-check', + '-v', + '-progress', + '-silent', + '-g', + '-cg', + '-repl', + '-live', + '-sharedlive', + '-shared', + '--enable-globals', + '-enable-globals', + '-autofree', + '-compress', + '-freestanding', + '-no-builtin', + '-no-parallel', + '-no-preludes', + '-prof', + '-profile', + '-profile-no-inline', + '-prod', + '-simulator', + '-stats', + '-obfuscate', + '-translated', + '-color', + '-nocolor', + '-showcc', + '-show-c-output', + '-experimental', + '-usecache', + '-prealloc', + '-parallel', + '-native', + '-W', + '-keepc', + '-w', + '-print-v-files', + '-error-limit', + '-message-limit', + '-os', + '-printfn', + '-cflags', + '-define', + '-d', + '-cc', + '-o', + '-b', + '-path', + '-custom-prelude', + '-name', + '-bundle', + '-V', + '-version', + '--version', +] +const auto_complete_flags_doc = [ + '-all', + '-f', + '-h', + '-help', + '-m', + '-o', + '-readme', + '-v', + '-filename', + '-pos', + '-no-timestamp', + '-inline-assets', + '-theme-dir', + '-open', + '-p', + '-s', + '-l', +] +const auto_complete_flags_fmt = [ + '-c', + '-diff', + '-l', + '-w', + '-debug', + '-verify', +] +const auto_complete_flags_bin2v = [ + '-h', + '--help', + '-m', + '--module', + '-p', + '--prefix', + '-w', + '--write', +] +const auto_complete_flags_shader = [ + '--help', + '-h', + '--force-update', + '-u', + '--verbose', + '-v', + '--slang', + '-l', + '--output', + '-o', +] +const auto_complete_flags_missdoc = [ + '--help', + '-h', + '--tags', + '-t', + '--deprecated', + '-d', + '--private', + '-p', + '--no-line-numbers', + '-n', + '--exclude', + '-e', + '--relative-paths', + '-r', + '--js', + '--verify', + '--diff', +] +const auto_complete_flags_bump = [ + '--patch', + '--minor', + '--major', +] +const auto_complete_flags_self = [ + '-prod', +] +const auto_complete_compilers = [ + 'cc', + 'gcc', + 'tcc', + 'tinyc', + 'clang', + 'mingw', + 'msvc', +] // auto_complete prints auto completion results back to the calling shell's completion system. // auto_complete acts as communication bridge between the calling shell and V's completions. diff --git a/cmd/tools/vcomplete_test.v b/cmd/tools/vcomplete_test.v index 0e3853b13f..d74037779f 100644 --- a/cmd/tools/vcomplete_test.v +++ b/cmd/tools/vcomplete_test.v @@ -1,9 +1,7 @@ import os -const ( - vexe = @VEXE - tfolder = os.join_path(os.vtmp_dir(), 'vcomplete_test') -) +const vexe = @VEXE +const tfolder = os.join_path(os.vtmp_dir(), 'vcomplete_test') enum Shell { bash diff --git a/cmd/tools/vcreate/vcreate_init_test.v b/cmd/tools/vcreate/vcreate_init_test.v index 8f109f21df..7e8a96eb17 100644 --- a/cmd/tools/vcreate/vcreate_init_test.v +++ b/cmd/tools/vcreate/vcreate_init_test.v @@ -1,21 +1,19 @@ import os import v.vmod -const ( - vroot = os.quoted_path(@VEXEROOT) - vexe = os.quoted_path(@VEXE) - // Expect has to be installed for the test. - expect_exe = os.quoted_path(os.find_abs_path_of_executable('expect') or { - eprintln('skipping test, since expect is missing') - exit(0) - }) - // Directory that contains the Expect scripts used in the test. - expect_tests_path = os.join_path(@VEXEROOT, 'cmd', 'tools', 'vcreate', 'tests') - test_project_dir_name = 'test_project' - // Running tests appends a tsession path to VTMP, which is automatically cleaned up after the test. - // The following will result in e.g. `$VTMP/tsession_7fe8e93bd740_1612958707536/test_project/`. - test_path = os.join_path(os.vtmp_dir(), test_project_dir_name) -) +const vroot = os.quoted_path(@VEXEROOT) +const vexe = os.quoted_path(@VEXE) +// Expect has to be installed for the test. +const expect_exe = os.quoted_path(os.find_abs_path_of_executable('expect') or { + eprintln('skipping test, since expect is missing') + exit(0) +}) +// Directory that contains the Expect scripts used in the test. +const expect_tests_path = os.join_path(@VEXEROOT, 'cmd', 'tools', 'vcreate', 'tests') +const test_project_dir_name = 'test_project' +// Running tests appends a tsession path to VTMP, which is automatically cleaned up after the test. +// The following will result in e.g. `$VTMP/tsession_7fe8e93bd740_1612958707536/test_project/`. +const test_path = os.join_path(os.vtmp_dir(), test_project_dir_name) fn testsuite_end() { os.rmdir_all(test_path) or {} diff --git a/cmd/tools/vcreate/vcreate_new_test.v b/cmd/tools/vcreate/vcreate_new_test.v index b31af1bfc3..a2fbc18e24 100644 --- a/cmd/tools/vcreate/vcreate_new_test.v +++ b/cmd/tools/vcreate/vcreate_new_test.v @@ -1,19 +1,17 @@ import os import v.vmod -const ( - vroot = @VEXEROOT - // Expect has to be installed for the test. - expect_exe = os.quoted_path(os.find_abs_path_of_executable('expect') or { - eprintln('skipping test, since expect is missing') - exit(0) - }) - // Directory that contains the Expect scripts used in the test. - expect_tests_path = os.join_path(@VEXEROOT, 'cmd', 'tools', 'vcreate', 'tests') - // Running tests appends a tsession path to VTMP, which is automatically cleaned up after the test. - // The following will result in e.g. `$VTMP/tsession_7fe8e93bd740_1612958707536/test_vcreate_input/`. - test_module_path = os.join_path(os.vtmp_dir(), 'test_vcreate_input') -) +const vroot = @VEXEROOT +// Expect has to be installed for the test. +const expect_exe = os.quoted_path(os.find_abs_path_of_executable('expect') or { + eprintln('skipping test, since expect is missing') + exit(0) +}) +// Directory that contains the Expect scripts used in the test. +const expect_tests_path = os.join_path(@VEXEROOT, 'cmd', 'tools', 'vcreate', 'tests') +// Running tests appends a tsession path to VTMP, which is automatically cleaned up after the test. +// The following will result in e.g. `$VTMP/tsession_7fe8e93bd740_1612958707536/test_vcreate_input/`. +const test_module_path = os.join_path(os.vtmp_dir(), 'test_vcreate_input') fn testsuite_begin() { dump(expect_exe) diff --git a/cmd/tools/vdoc/html.v b/cmd/tools/vdoc/html.v index 88f7b5e511..f98e5571ab 100644 --- a/cmd/tools/vdoc/html.v +++ b/cmd/tools/vdoc/html.v @@ -12,19 +12,17 @@ import v.doc import v.pref import v.util { tabs } -const ( - css_js_assets = ['doc.css', 'normalize.css', 'doc.js', 'dark-mode.js'] - default_theme = os.resource_abs_path('theme') - link_svg = '' +const css_js_assets = ['doc.css', 'normalize.css', 'doc.js', 'dark-mode.js'] +const default_theme = os.resource_abs_path('theme') +const link_svg = '' - single_quote = "'" - double_quote = '"' - no_quotes_replacement = [single_quote, '', double_quote, ''] +const single_quote = "'" +const double_quote = '"' +const no_quotes_replacement = [single_quote, '', double_quote, ''] - html_tag_escape_re = regex.regex_opt(r'`.+[(<)(>)].+`') or { panic(err) } - html_tag_escape_seq = ['<', '<', '>', '>'] - md_script_escape_seq = ['', '`'] -) +const html_tag_escape_re = regex.regex_opt(r'`.+[(<)(>)].+`') or { panic(err) } +const html_tag_escape_seq = ['<', '<', '>', '>'] +const md_script_escape_seq = ['', '`'] enum HighlightTokenTyp { unone diff --git a/cmd/tools/vdoc/tests/testdata/basic/main.v b/cmd/tools/vdoc/tests/testdata/basic/main.v index a274697653..49b04f2d6d 100644 --- a/cmd/tools/vdoc/tests/testdata/basic/main.v +++ b/cmd/tools/vdoc/tests/testdata/basic/main.v @@ -1,13 +1,11 @@ -pub const ( - source_root = 'temp' // some const - another = int(5) // -) +pub const source_root = 'temp' // some const + +pub const another = int(5) // Used to indicate that you don't care what the window position is. -pub const ( - windowpos_undefined_mask = C.SDL_WINDOWPOS_UNDEFINED_MASK // 0x1FFF0000u - windowpos_undefined = C.SDL_WINDOWPOS_UNDEFINED // -) +pub const windowpos_undefined_mask = C.SDL_WINDOWPOS_UNDEFINED_MASK // 0x1FFF0000u + +pub const windowpos_undefined = C.SDL_WINDOWPOS_UNDEFINED // funky - comment for function below pub fn funky() { diff --git a/cmd/tools/vfmt.v b/cmd/tools/vfmt.v index 0b19d05ce3..30b6b6daba 100644 --- a/cmd/tools/vfmt.v +++ b/cmd/tools/vfmt.v @@ -31,11 +31,9 @@ mut: diff_cmd string // filled in when -diff or -verify is passed } -const ( - formatted_file_token = '\@\@\@' + 'FORMATTED_FILE: ' - vtmp_folder = os.vtmp_dir() - term_colors = term.can_show_color_on_stderr() -) +const formatted_file_token = '\@\@\@' + 'FORMATTED_FILE: ' +const vtmp_folder = os.vtmp_dir() +const term_colors = term.can_show_color_on_stderr() fn main() { // if os.getenv('VFMT_ENABLE') == '' { diff --git a/cmd/tools/vgret.v b/cmd/tools/vgret.v index c5b00ed07a..fed0d79826 100644 --- a/cmd/tools/vgret.v +++ b/cmd/tools/vgret.v @@ -44,10 +44,9 @@ import flag import time import toml -const ( - tool_name = 'vgret' - tool_version = '0.0.2' - tool_description = '\n Dump and/or compare rendered frames of graphical apps +const tool_name = 'vgret' +const tool_version = '0.0.2' +const tool_description = '\n Dump and/or compare rendered frames of graphical apps both external and `gg` based apps is supported. Examples: @@ -58,25 +57,21 @@ Examples: Compare screenshots in `/tmp/src` to existing screenshots in `/tmp/dst` v gret --compare-only /tmp/src /tmp/dst ' - tmp_dir = os.join_path(os.vtmp_dir(), tool_name) - runtime_os = os.user_os() - v_root = os.real_path(@VMODROOT) -) -const ( - supported_hosts = ['linux'] - supported_capture_methods = ['gg_record', 'generic_screenshot'] - // External tool executables - v_exe = os.getenv('VEXE') - idiff_exe = os.find_abs_path_of_executable('idiff') or { '' } -) +const tmp_dir = os.join_path(os.vtmp_dir(), tool_name) +const runtime_os = os.user_os() +const v_root = os.real_path(@VMODROOT) -const ( - embedded_toml = $embed_file('vgret.defaults.toml', .zlib) - default_toml = embedded_toml.to_string() - empty_toml_array = []toml.Any{} - empty_toml_map = map[string]toml.Any{} -) +const supported_hosts = ['linux'] +const supported_capture_methods = ['gg_record', 'generic_screenshot'] +// External tool executables +const v_exe = os.getenv('VEXE') +const idiff_exe = os.find_abs_path_of_executable('idiff') or { '' } + +const embedded_toml = $embed_file('vgret.defaults.toml', .zlib) +const default_toml = embedded_toml.to_string() +const empty_toml_array = []toml.Any{} +const empty_toml_map = map[string]toml.Any{} struct Config { path string diff --git a/cmd/tools/vmissdoc.v b/cmd/tools/vmissdoc.v index 4a4c6a7623..13e23aad7c 100644 --- a/cmd/tools/vmissdoc.v +++ b/cmd/tools/vmissdoc.v @@ -4,12 +4,10 @@ import os import flag -const ( - tool_name = 'v missdoc' - tool_version = '0.1.0' - tool_description = 'Prints all V functions in .v files under PATH/, that do not yet have documentation comments.' - work_dir_prefix = normalise_path(os.real_path(os.wd_at_startup) + os.path_separator) -) +const tool_name = 'v missdoc' +const tool_version = '0.1.0' +const tool_description = 'Prints all V functions in .v files under PATH/, that do not yet have documentation comments.' +const work_dir_prefix = normalise_path(os.real_path(os.wd_at_startup) + os.path_separator) struct UndocumentedFN { file string diff --git a/cmd/tools/vpm/common.v b/cmd/tools/vpm/common.v index f8d521fc5d..d32a8312a4 100644 --- a/cmd/tools/vpm/common.v +++ b/cmd/tools/vpm/common.v @@ -30,10 +30,8 @@ struct ErrorOptions { verbose bool // is used to only output the error message if the verbose setting is enabled. } -const ( - vexe = os.quoted_path(os.getenv('VEXE')) - home_dir = os.home_dir() -) +const vexe = os.quoted_path(os.getenv('VEXE')) +const home_dir = os.home_dir() fn get_mod_date_info(mut pp pool.PoolProcessor, idx int, wid int) &ModuleDateInfo { mut result := &ModuleDateInfo{ diff --git a/cmd/tools/vpm/dependency_test.v b/cmd/tools/vpm/dependency_test.v index c7bbc70401..6daf90b0c7 100644 --- a/cmd/tools/vpm/dependency_test.v +++ b/cmd/tools/vpm/dependency_test.v @@ -3,10 +3,8 @@ import os import v.vmod -const ( - v = os.quoted_path(@VEXE) - test_path = os.join_path(os.vtmp_dir(), 'vpm_dependency_test') -) +const v = os.quoted_path(@VEXE) +const test_path = os.join_path(os.vtmp_dir(), 'vpm_dependency_test') fn testsuite_begin() { os.setenv('VMODULES', test_path, true) diff --git a/cmd/tools/vpm/update_test.v b/cmd/tools/vpm/update_test.v index 6e116f7e3b..f9ab3a701b 100644 --- a/cmd/tools/vpm/update_test.v +++ b/cmd/tools/vpm/update_test.v @@ -2,10 +2,8 @@ // vtest retry: 3 import os -const ( - v = os.quoted_path(@VEXE) - test_path = os.join_path(os.vtmp_dir(), 'vpm_update_test') -) +const v = os.quoted_path(@VEXE) +const test_path = os.join_path(os.vtmp_dir(), 'vpm_update_test') fn testsuite_begin() { os.setenv('VMODULES', test_path, true) diff --git a/cmd/tools/vpm/vpm.v b/cmd/tools/vpm/vpm.v index 0a8a76af52..3c3ad4b997 100644 --- a/cmd/tools/vpm/vpm.v +++ b/cmd/tools/vpm/vpm.v @@ -21,38 +21,36 @@ struct VCS { } } -const ( - settings = init_settings() - default_vpm_server_urls = ['https://vpm.vlang.io', 'https://vpm.url4e.com'] - vpm_server_urls = rand.shuffle_clone(default_vpm_server_urls) or { [] } // ensure that all queries are distributed fairly - valid_vpm_commands = ['help', 'search', 'install', 'update', 'upgrade', 'outdated', 'list', - 'remove', 'show'] - excluded_dirs = ['cache', 'vlib'] - supported_vcs = { - 'git': VCS{ - dir: '.git' - cmd: 'git' - args: struct { - install: 'clone --depth=1 --recursive --shallow-submodules' - version: '--single-branch -b' - update: 'pull --recurse-submodules' // pulling with `--depth=1` leads to conflicts when the upstream has more than 1 new commits. - path: '-C' - outdated: ['fetch', 'rev-parse @', 'rev-parse @{u}'] - } - } - 'hg': VCS{ - dir: '.hg' - cmd: 'hg' - args: struct { - install: 'clone' - version: '' // not supported yet. - update: 'pull --update' - path: '-R' - outdated: ['incoming'] - } +const settings = init_settings() +const default_vpm_server_urls = ['https://vpm.vlang.io', 'https://vpm.url4e.com'] +const vpm_server_urls = rand.shuffle_clone(default_vpm_server_urls) or { [] } // ensure that all queries are distributed fairly +const valid_vpm_commands = ['help', 'search', 'install', 'update', 'upgrade', 'outdated', 'list', + 'remove', 'show'] +const excluded_dirs = ['cache', 'vlib'] +const supported_vcs = { + 'git': VCS{ + dir: '.git' + cmd: 'git' + args: struct { + install: 'clone --depth=1 --recursive --shallow-submodules' + version: '--single-branch -b' + update: 'pull --recurse-submodules' // pulling with `--depth=1` leads to conflicts when the upstream has more than 1 new commits. + path: '-C' + outdated: ['fetch', 'rev-parse @', 'rev-parse @{u}'] } } -) + 'hg': VCS{ + dir: '.hg' + cmd: 'hg' + args: struct { + install: 'clone' + version: '' // not supported yet. + update: 'pull --update' + path: '-R' + outdated: ['incoming'] + } + } +} fn main() { // This tool is intended to be launched by the v frontend, diff --git a/cmd/tools/vrepl.v b/cmd/tools/vrepl.v index 4bc020839e..7c9d0ff879 100644 --- a/cmd/tools/vrepl.v +++ b/cmd/tools/vrepl.v @@ -31,12 +31,10 @@ mut: eval_func_lines []string // same line of the `VSTARTUP` file, but used to test fn type } -const ( - is_stdin_a_pipe = os.is_atty(0) == 0 - vexe = os.getenv('VEXE') - vstartup = os.getenv('VSTARTUP') - repl_folder = os.join_path(os.vtmp_dir(), 'repl') -) +const is_stdin_a_pipe = os.is_atty(0) == 0 +const vexe = os.getenv('VEXE') +const vstartup = os.getenv('VSTARTUP') +const repl_folder = os.join_path(os.vtmp_dir(), 'repl') const possible_statement_patterns = [ '++', diff --git a/cmd/tools/vshader.v b/cmd/tools/vshader.v index 59a8cda491..7226056e3f 100644 --- a/cmd/tools/vshader.v +++ b/cmd/tools/vshader.v @@ -18,51 +18,47 @@ import io.util import flag import net.http -const ( - shdc_full_hash = '6b84ea387a323db9e8e17f5abed2b254a6e409fe' - tool_version = '0.0.3' - tool_description = "Compile shaders in sokol's annotated GLSL format to C headers for use with sokol based apps" - tool_name = os.file_name(os.executable()) - cache_dir = os.join_path(os.cache_dir(), 'v', tool_name) - runtime_os = os.user_os() -) +const shdc_full_hash = '6b84ea387a323db9e8e17f5abed2b254a6e409fe' +const tool_version = '0.0.3' +const tool_description = "Compile shaders in sokol's annotated GLSL format to C headers for use with sokol based apps" +const tool_name = os.file_name(os.executable()) +const cache_dir = os.join_path(os.cache_dir(), 'v', tool_name) +const runtime_os = os.user_os() -const ( - supported_hosts = ['linux', 'macos', 'windows'] - supported_slangs = [ - 'glsl330', // desktop OpenGL backend (SOKOL_GLCORE33) - 'glsl100', // OpenGLES2 and WebGL (SOKOL_GLES3) - 'glsl300es', // OpenGLES3 and WebGL2 (SOKOL_GLES3) - 'hlsl4', // Direct3D11 with HLSL4 (SOKOL_D3D11) - 'hlsl5', // Direct3D11 with HLSL5 (SOKOL_D3D11) - 'metal_macos', // Metal on macOS (SOKOL_METAL) - 'metal_ios', // Metal on iOS devices (SOKOL_METAL) - 'metal_sim', // Metal on iOS simulator (SOKOL_METAL) - 'wgsl', // WebGPU (SOKOL_WGPU) - ] - default_slangs = [ - 'glsl330', - 'glsl100', - 'glsl300es', - // 'hlsl4', and hlsl5 can't be used at the same time - 'hlsl5', - 'metal_macos', - 'metal_ios', - 'metal_sim', - 'wgsl', - ] +const supported_hosts = ['linux', 'macos', 'windows'] +const supported_slangs = [ + 'glsl330', // desktop OpenGL backend (SOKOL_GLCORE33) + 'glsl100', // OpenGLES2 and WebGL (SOKOL_GLES3) + 'glsl300es', // OpenGLES3 and WebGL2 (SOKOL_GLES3) + 'hlsl4', // Direct3D11 with HLSL4 (SOKOL_D3D11) + 'hlsl5', // Direct3D11 with HLSL5 (SOKOL_D3D11) + 'metal_macos', // Metal on macOS (SOKOL_METAL) + 'metal_ios', // Metal on iOS devices (SOKOL_METAL) + 'metal_sim', // Metal on iOS simulator (SOKOL_METAL) + 'wgsl', // WebGPU (SOKOL_WGPU) +] +const default_slangs = [ + 'glsl330', + 'glsl100', + 'glsl300es', + // 'hlsl4', and hlsl5 can't be used at the same time + 'hlsl5', + 'metal_macos', + 'metal_ios', + 'metal_sim', + 'wgsl', +] - shdc_version = shdc_full_hash[0..8] - shdc_urls = { - 'windows': 'https://github.com/floooh/sokol-tools-bin/raw/${shdc_full_hash}/bin/win32/sokol-shdc.exe' - 'macos': 'https://github.com/floooh/sokol-tools-bin/raw/${shdc_full_hash}/bin/osx/sokol-shdc' - 'linux': 'https://github.com/floooh/sokol-tools-bin/raw/${shdc_full_hash}/bin/linux/sokol-shdc' - 'osx_a64': 'https://github.com/floooh/sokol-tools-bin/raw/${shdc_full_hash}/bin/osx_arm64/sokol-shdc' - } - shdc_version_file = os.join_path(cache_dir, 'sokol-shdc.version') - shdc = shdc_exe() - shdc_exe_name = 'sokol-shdc.exe' -) +const shdc_version = shdc_full_hash[0..8] +const shdc_urls = { + 'windows': 'https://github.com/floooh/sokol-tools-bin/raw/${shdc_full_hash}/bin/win32/sokol-shdc.exe' + 'macos': 'https://github.com/floooh/sokol-tools-bin/raw/${shdc_full_hash}/bin/osx/sokol-shdc' + 'linux': 'https://github.com/floooh/sokol-tools-bin/raw/${shdc_full_hash}/bin/linux/sokol-shdc' + 'osx_a64': 'https://github.com/floooh/sokol-tools-bin/raw/${shdc_full_hash}/bin/osx_arm64/sokol-shdc' +} +const shdc_version_file = os.join_path(cache_dir, 'sokol-shdc.version') +const shdc = shdc_exe() +const shdc_exe_name = 'sokol-shdc.exe' struct Options { show_help bool diff --git a/cmd/tools/vtest-fmt.v b/cmd/tools/vtest-fmt.v index 350b321a43..e671d17c45 100644 --- a/cmd/tools/vtest-fmt.v +++ b/cmd/tools/vtest-fmt.v @@ -4,11 +4,9 @@ import os import testing import v.util -const ( - known_failing_exceptions = [ - 'vlib/crypto/aes/const.v', // const array wrapped in too many lines - ] -) +const known_failing_exceptions = [ + 'vlib/crypto/aes/const.v', // const array wrapped in too many lines +] fn main() { args_string := os.args[1..].join(' ') diff --git a/cmd/tools/vtest-parser.v b/cmd/tools/vtest-parser.v index daf0088200..79e7112777 100644 --- a/cmd/tools/vtest-parser.v +++ b/cmd/tools/vtest-parser.v @@ -6,18 +6,16 @@ import v.parser import v.ast import v.pref -const ( - vexe = os.real_path(os.getenv_opt('VEXE') or { @VEXE }) - vroot = os.dir(vexe) - support_color = term.can_show_color_on_stderr() && term.can_show_color_on_stdout() - ecode_timeout = 101 - ecode_memout = 102 - ecode_details = { - -1: 'worker executable not found' - 101: 'too slow' - 102: 'too memory hungry' - } -) +const vexe = os.real_path(os.getenv_opt('VEXE') or { @VEXE }) +const vroot = os.dir(vexe) +const support_color = term.can_show_color_on_stderr() && term.can_show_color_on_stdout() +const ecode_timeout = 101 +const ecode_memout = 102 +const ecode_details = { + -1: 'worker executable not found' + 101: 'too slow' + 102: 'too memory hungry' +} struct Context { mut: diff --git a/cmd/tools/vtest-self.v b/cmd/tools/vtest-self.v index 2e97a54c03..73429811fc 100644 --- a/cmd/tools/vtest-self.v +++ b/cmd/tools/vtest-self.v @@ -7,310 +7,308 @@ const github_job = os.getenv('GITHUB_JOB') const just_essential = os.getenv('VTEST_JUST_ESSENTIAL') != '' -const ( - essential_list = [ - 'cmd/tools/vvet/vet_test.v', - 'vlib/arrays/arrays_test.v', - 'vlib/bitfield/bitfield_test.v', - // - 'vlib/builtin/int_test.v', - 'vlib/builtin/array_test.v', - 'vlib/builtin/array_sorted_test.v', - 'vlib/builtin/float_test.v', - 'vlib/builtin/byte_test.v', - 'vlib/builtin/rune_test.v', - 'vlib/builtin/builtin_test.c.v', - 'vlib/builtin/map_of_floats_test.v', - 'vlib/builtin/string_int_test.v', - 'vlib/builtin/utf8_test.v', - 'vlib/builtin/map_test.v', - 'vlib/builtin/string_test.v', - 'vlib/builtin/sorting_test.v', - 'vlib/builtin/gated_array_string_test.v', - 'vlib/builtin/array_shrinkage_test.v', - 'vlib/builtin/isnil_test.v', - 'vlib/builtin/string_match_glob_test.v', - 'vlib/builtin/string_strip_margin_test.v', - // - 'vlib/cli/command_test.v', - 'vlib/crypto/md5/md5_test.v', - 'vlib/dl/dl_test.v', - 'vlib/encoding/base64/base64_test.v', - 'vlib/encoding/utf8/encoding_utf8_test.v', - 'vlib/encoding/utf8/utf8_util_test.v', - 'vlib/flag/flag_test.v', - 'vlib/json/json_decode_test.v', - 'vlib/math/math_test.v', - 'vlib/net/tcp_test.v', - 'vlib/net/http/http_test.v', - 'vlib/net/http/server_test.v', - 'vlib/net/http/request_test.v', - 'vlib/io/io_test.v', - 'vlib/io/os_file_reader_test.v', - 'vlib/os/process_test.v', - 'vlib/os/file_test.v', - 'vlib/os/notify/notify_test.c.v', - 'vlib/os/filepath_test.v', - 'vlib/os/environment_test.v', - 'vlib/os/glob_test.v', - 'vlib/os/os_test.c.v', - 'vlib/rand/random_numbers_test.v', - 'vlib/rand/wyrand/wyrand_test.v', - 'vlib/runtime/runtime_test.v', - 'vlib/semver/semver_test.v', - 'vlib/sync/stdatomic/atomic_test.v', - 'vlib/sync/thread_test.v', - 'vlib/sync/waitgroup_test.v', - 'vlib/sync/pool/pool_test.v', - 'vlib/strings/builder_test.v', - 'vlib/strconv/atof_test.c.v', - 'vlib/strconv/atoi_test.v', - 'vlib/strconv/f32_f64_to_string_test.v', - 'vlib/strconv/format_test.v', - 'vlib/strconv/number_to_base_test.v', - 'vlib/time/time_test.v', - 'vlib/toml/tests/toml_test.v', - 'vlib/v/compiler_errors_test.v', - 'vlib/v/doc/doc_test.v', - 'vlib/v/eval/interpret_test.v', - 'vlib/v/fmt/fmt_keep_test.v', - 'vlib/v/fmt/fmt_test.v', - 'vlib/v/gen/c/coutput_test.v', - 'vlib/v/gen/js/program_test.v', - 'vlib/v/gen/native/macho_test.v', - 'vlib/v/gen/native/tests/native_test.v', - 'vlib/v/pkgconfig/pkgconfig_test.v', - 'vlib/v/slow_tests/inout/compiler_test.v', - 'vlib/x/json2/json2_test.v', - ] - skip_test_files = [ - 'do_not_remove', - 'cmd/tools/vdoc/html_tag_escape_test.v', // can't locate local module: markdown - 'cmd/tools/vdoc/tests/vdoc_file_test.v', // fails on Windows; order of output is not as expected - 'vlib/context/deadline_test.v', // sometimes blocks - 'vlib/context/onecontext/onecontext_test.v', // backtrace_symbols is missing - 'vlib/db/mysql/mysql_orm_test.v', // mysql not installed - 'vlib/db/mysql/mysql_test.v', // mysql not installed - 'vlib/db/pg/pg_orm_test.v', // pg not installed - ] - // These tests are too slow to be run in the CI on each PR/commit - // in the sanitized modes: - skip_fsanitize_too_slow = [ - 'do_not_remove', - 'vlib/v/compiler_errors_test.v', - 'vlib/v/doc/doc_test.v', - 'vlib/v/fmt/fmt_test.v', - 'vlib/v/fmt/fmt_keep_test.v', - 'vlib/v/fmt/fmt_vlib_test.v', - 'vlib/v/live/live_test.v', - 'vlib/v/parser/v_parser_test.v', - 'vlib/v/scanner/scanner_test.v', - 'vlib/v/slow_tests/inout/compiler_test.v', - 'vlib/v/slow_tests/prod_test.v', - 'vlib/v/slow_tests/profile/profile_test.v', - 'vlib/v/slow_tests/repl/repl_test.v', - 'vlib/v/slow_tests/valgrind/valgrind_test.v', - ] - skip_with_fsanitize_memory = [ - 'do_not_remove', - 'vlib/net/tcp_simple_client_server_test.v', - 'vlib/net/http/cookie_test.v', - 'vlib/net/http/http_test.v', - 'vlib/net/http/status_test.v', - 'vlib/net/http/http_httpbin_test.v', - 'vlib/net/http/header_test.v', - 'vlib/net/http/server_test.v', - 'vlib/net/udp_test.v', - 'vlib/net/tcp_test.v', - 'vlib/orm/orm_test.v', - 'vlib/orm/orm_sql_or_blocks_test.v', - 'vlib/orm/orm_create_and_drop_test.v', - 'vlib/orm/orm_insert_test.v', - 'vlib/orm/orm_insert_reserved_name_test.v', - 'vlib/orm/orm_fn_calls_test.v', - 'vlib/orm/orm_last_id_test.v', - 'vlib/orm/orm_string_interpolation_in_where_test.v', - 'vlib/orm/orm_interface_test.v', - 'vlib/orm/orm_mut_db_test.v', - 'vlib/orm/orm_null_test.v', - 'vlib/orm/orm_result_test.v', - 'vlib/orm/orm_custom_operators_test.v', - 'vlib/orm/orm_fk_test.v', - 'vlib/orm/orm_references_test.v', - 'vlib/db/sqlite/sqlite_test.v', - 'vlib/db/sqlite/sqlite_orm_test.v', - 'vlib/db/sqlite/sqlite_vfs_lowlevel_test.v', - 'vlib/v/tests/orm_enum_test.v', - 'vlib/v/tests/orm_sub_struct_test.v', - 'vlib/v/tests/orm_sub_array_struct_test.v', - 'vlib/v/tests/orm_joined_tables_select_test.v', - 'vlib/v/tests/sql_statement_inside_fn_call_test.v', - 'vlib/v/tests/orm_stmt_wrong_return_checking_test.v', - 'vlib/v/tests/orm_handle_error_for_select_from_not_created_table_test.v', - 'vlib/vweb/tests/vweb_test.v', - 'vlib/vweb/csrf/csrf_test.v', - 'vlib/vweb/request_test.v', - 'vlib/net/http/request_test.v', - 'vlib/net/http/response_test.v', - 'vlib/vweb/route_test.v', - 'vlib/net/websocket/websocket_test.v', - 'vlib/crypto/rand/crypto_rand_read_test.v', - 'vlib/net/smtp/smtp_test.v', - 'vlib/v/tests/websocket_logger_interface_should_compile_test.v', - 'vlib/v/tests/fn_literal_type_test.v', - ] - skip_with_fsanitize_address = [ - 'do_not_remove', - 'vlib/net/websocket/websocket_test.v', - 'vlib/orm/orm_create_and_drop_test.v', - 'vlib/orm/orm_insert_test.v', - 'vlib/orm/orm_insert_reserved_name_test.v', - 'vlib/orm/orm_references_test.v', - 'vlib/v/tests/websocket_logger_interface_should_compile_test.v', - 'vlib/v/tests/orm_enum_test.v', - 'vlib/v/tests/orm_sub_array_struct_test.v', - 'vlib/v/tests/orm_handle_error_for_select_from_not_created_table_test.v', - ] - skip_with_fsanitize_undefined = [ - 'do_not_remove', - 'vlib/orm/orm_create_and_drop_test.v', - 'vlib/orm/orm_insert_test.v', - 'vlib/orm/orm_insert_reserved_name_test.v', - 'vlib/orm/orm_references_test.v', - 'vlib/v/tests/orm_enum_test.v', - 'vlib/v/tests/orm_sub_array_struct_test.v', - 'vlib/v/tests/orm_handle_error_for_select_from_not_created_table_test.v', - 'vlib/v/tests/project_with_cpp_code/compiling_cpp_files_with_a_cplusplus_compiler_test.c.v', // fails compilation with: undefined reference to vtable for __cxxabiv1::__function_type_info' - ] - skip_with_werror = [ - 'do_not_remove', - 'vlib/v/embed_file/tests/embed_file_test.v', - ] - skip_with_asan_compiler = [ - 'do_not_remove', - ] - skip_with_msan_compiler = [ - 'do_not_remove', - ] - skip_on_musl = [ - 'do_not_remove', - 'vlib/v/slow_tests/profile/profile_test.v', - 'vlib/gg/draw_fns_api_test.v', - 'vlib/v/tests/skip_unused/gg_code.vv', - 'vlib/v/tests/c_struct_with_reserved_field_name_test.v', - ] - skip_on_ubuntu_musl = [ - 'do_not_remove', - //'vlib/v/gen/js/jsgen_test.v', - 'vlib/net/http/cookie_test.v', - 'vlib/net/http/http_test.v', - 'vlib/net/http/status_test.v', - 'vlib/net/websocket/ws_test.v', - 'vlib/db/sqlite/sqlite_test.v', - 'vlib/db/sqlite/sqlite_orm_test.v', - 'vlib/db/sqlite/sqlite_vfs_lowlevel_test.v', - 'vlib/orm/orm_test.v', - 'vlib/orm/orm_sql_or_blocks_test.v', - 'vlib/orm/orm_create_and_drop_test.v', - 'vlib/orm/orm_insert_test.v', - 'vlib/orm/orm_insert_reserved_name_test.v', - 'vlib/orm/orm_fn_calls_test.v', - 'vlib/orm/orm_null_test.v', - 'vlib/orm/orm_last_id_test.v', - 'vlib/orm/orm_string_interpolation_in_where_test.v', - 'vlib/orm/orm_interface_test.v', - 'vlib/orm/orm_mut_db_test.v', - 'vlib/orm/orm_result_test.v', - 'vlib/orm/orm_custom_operators_test.v', - 'vlib/orm/orm_fk_test.v', - 'vlib/orm/orm_references_test.v', - 'vlib/v/tests/orm_enum_test.v', - 'vlib/v/tests/orm_sub_struct_test.v', - 'vlib/v/tests/orm_sub_array_struct_test.v', - 'vlib/v/tests/orm_joined_tables_select_test.v', - 'vlib/v/tests/orm_stmt_wrong_return_checking_test.v', - 'vlib/v/tests/orm_handle_error_for_select_from_not_created_table_test.v', - 'vlib/v/tests/sql_statement_inside_fn_call_test.v', - 'vlib/clipboard/clipboard_test.v', - 'vlib/vweb/tests/vweb_test.v', - 'vlib/vweb/request_test.v', - 'vlib/vweb/csrf/csrf_test.v', - 'vlib/net/http/request_test.v', - 'vlib/vweb/route_test.v', - 'vlib/net/websocket/websocket_test.v', - 'vlib/net/http/http_httpbin_test.v', - 'vlib/net/http/header_test.v', - 'vlib/net/http/server_test.v', - 'vlib/net/http/response_test.v', - 'vlib/builtin/js/array_test.js.v', - 'vlib/net/smtp/smtp_test.v', - 'vlib/v/tests/websocket_logger_interface_should_compile_test.v', - 'vlib/v/tests/fn_literal_type_test.v', - ] - skip_on_linux = [ - 'do_not_remove', - ] - skip_on_non_linux = [ - 'do_not_remove', - ] - skip_on_windows_msvc = [ - 'do_not_remove', - 'vlib/v/tests/const_fixed_array_containing_references_to_itself_test.v', // error C2099: initializer is not a constant - 'vlib/v/tests/const_and_global_with_same_name_test.v', // error C2099: initializer is not a constant - 'vlib/v/tests/sumtype_as_cast_1_test.v', // error: cannot support compound statement expression ({expr; expr; expr;}) - 'vlib/v/tests/sumtype_as_cast_2_test.v', // error: cannot support compound statement expression ({expr; expr; expr;}) - 'vlib/v/tests/project_with_cpp_code/compiling_cpp_files_with_a_cplusplus_compiler_test.c.v', // TODO - ] - skip_on_windows = [ - 'do_not_remove', - 'vlib/orm/orm_test.v', - 'vlib/v/tests/orm_sub_struct_test.v', - 'vlib/v/tests/orm_joined_tables_select_test.v', - 'vlib/v/tests/orm_handle_error_for_select_from_not_created_table_test.v', - 'vlib/net/websocket/ws_test.v', - 'vlib/net/websocket/websocket_test.v', - 'vlib/net/openssl/openssl_compiles_test.c.v', - 'vlib/net/http/request_test.v', - 'vlib/net/smtp/smtp_test.v', - 'vlib/net/ssl/ssl_compiles_test.v', - 'vlib/net/mbedtls/mbedtls_compiles_test.v', - 'vlib/vweb/tests/vweb_test.v', - 'vlib/vweb/request_test.v', - 'vlib/vweb/route_test.v', - 'vlib/sync/many_times_test.v', - 'vlib/sync/once_test.v', - 'vlib/v/tests/websocket_logger_interface_should_compile_test.v', - 'vlib/v/tests/fn_literal_type_test.v', - ] - skip_on_non_windows = [ - 'do_not_remove', - ] - skip_on_macos = [ - 'do_not_remove', - ] - skip_on_non_macos = [ - 'do_not_remove', - ] - skip_on_amd64 = [ - 'do_not_remove', - ] - skip_on_arm64 = [ - 'do_not_remove', - ] - skip_on_non_amd64_or_arm64 = [ - 'do_not_remove', - // closures aren't implemented yet: - 'vlib/v/tests/closure_test.v', - 'vlib/context/cancel_test.v', - 'vlib/context/deadline_test.v', - 'vlib/context/empty_test.v', - 'vlib/context/value_test.v', - 'vlib/context/onecontext/onecontext_test.v', - 'vlib/sync/once_test.v', - 'vlib/sync/many_times_test.v', - 'do_not_remove', - ] -) +const essential_list = [ + 'cmd/tools/vvet/vet_test.v', + 'vlib/arrays/arrays_test.v', + 'vlib/bitfield/bitfield_test.v', + // + 'vlib/builtin/int_test.v', + 'vlib/builtin/array_test.v', + 'vlib/builtin/array_sorted_test.v', + 'vlib/builtin/float_test.v', + 'vlib/builtin/byte_test.v', + 'vlib/builtin/rune_test.v', + 'vlib/builtin/builtin_test.c.v', + 'vlib/builtin/map_of_floats_test.v', + 'vlib/builtin/string_int_test.v', + 'vlib/builtin/utf8_test.v', + 'vlib/builtin/map_test.v', + 'vlib/builtin/string_test.v', + 'vlib/builtin/sorting_test.v', + 'vlib/builtin/gated_array_string_test.v', + 'vlib/builtin/array_shrinkage_test.v', + 'vlib/builtin/isnil_test.v', + 'vlib/builtin/string_match_glob_test.v', + 'vlib/builtin/string_strip_margin_test.v', + // + 'vlib/cli/command_test.v', + 'vlib/crypto/md5/md5_test.v', + 'vlib/dl/dl_test.v', + 'vlib/encoding/base64/base64_test.v', + 'vlib/encoding/utf8/encoding_utf8_test.v', + 'vlib/encoding/utf8/utf8_util_test.v', + 'vlib/flag/flag_test.v', + 'vlib/json/json_decode_test.v', + 'vlib/math/math_test.v', + 'vlib/net/tcp_test.v', + 'vlib/net/http/http_test.v', + 'vlib/net/http/server_test.v', + 'vlib/net/http/request_test.v', + 'vlib/io/io_test.v', + 'vlib/io/os_file_reader_test.v', + 'vlib/os/process_test.v', + 'vlib/os/file_test.v', + 'vlib/os/notify/notify_test.c.v', + 'vlib/os/filepath_test.v', + 'vlib/os/environment_test.v', + 'vlib/os/glob_test.v', + 'vlib/os/os_test.c.v', + 'vlib/rand/random_numbers_test.v', + 'vlib/rand/wyrand/wyrand_test.v', + 'vlib/runtime/runtime_test.v', + 'vlib/semver/semver_test.v', + 'vlib/sync/stdatomic/atomic_test.v', + 'vlib/sync/thread_test.v', + 'vlib/sync/waitgroup_test.v', + 'vlib/sync/pool/pool_test.v', + 'vlib/strings/builder_test.v', + 'vlib/strconv/atof_test.c.v', + 'vlib/strconv/atoi_test.v', + 'vlib/strconv/f32_f64_to_string_test.v', + 'vlib/strconv/format_test.v', + 'vlib/strconv/number_to_base_test.v', + 'vlib/time/time_test.v', + 'vlib/toml/tests/toml_test.v', + 'vlib/v/compiler_errors_test.v', + 'vlib/v/doc/doc_test.v', + 'vlib/v/eval/interpret_test.v', + 'vlib/v/fmt/fmt_keep_test.v', + 'vlib/v/fmt/fmt_test.v', + 'vlib/v/gen/c/coutput_test.v', + 'vlib/v/gen/js/program_test.v', + 'vlib/v/gen/native/macho_test.v', + 'vlib/v/gen/native/tests/native_test.v', + 'vlib/v/pkgconfig/pkgconfig_test.v', + 'vlib/v/slow_tests/inout/compiler_test.v', + 'vlib/x/json2/json2_test.v', +] +const skip_test_files = [ + 'do_not_remove', + 'cmd/tools/vdoc/html_tag_escape_test.v', // can't locate local module: markdown + 'cmd/tools/vdoc/tests/vdoc_file_test.v', // fails on Windows; order of output is not as expected + 'vlib/context/deadline_test.v', // sometimes blocks + 'vlib/context/onecontext/onecontext_test.v', // backtrace_symbols is missing + 'vlib/db/mysql/mysql_orm_test.v', // mysql not installed + 'vlib/db/mysql/mysql_test.v', // mysql not installed + 'vlib/db/pg/pg_orm_test.v', // pg not installed +] +// These tests are too slow to be run in the CI on each PR/commit +// in the sanitized modes: +const skip_fsanitize_too_slow = [ + 'do_not_remove', + 'vlib/v/compiler_errors_test.v', + 'vlib/v/doc/doc_test.v', + 'vlib/v/fmt/fmt_test.v', + 'vlib/v/fmt/fmt_keep_test.v', + 'vlib/v/fmt/fmt_vlib_test.v', + 'vlib/v/live/live_test.v', + 'vlib/v/parser/v_parser_test.v', + 'vlib/v/scanner/scanner_test.v', + 'vlib/v/slow_tests/inout/compiler_test.v', + 'vlib/v/slow_tests/prod_test.v', + 'vlib/v/slow_tests/profile/profile_test.v', + 'vlib/v/slow_tests/repl/repl_test.v', + 'vlib/v/slow_tests/valgrind/valgrind_test.v', +] +const skip_with_fsanitize_memory = [ + 'do_not_remove', + 'vlib/net/tcp_simple_client_server_test.v', + 'vlib/net/http/cookie_test.v', + 'vlib/net/http/http_test.v', + 'vlib/net/http/status_test.v', + 'vlib/net/http/http_httpbin_test.v', + 'vlib/net/http/header_test.v', + 'vlib/net/http/server_test.v', + 'vlib/net/udp_test.v', + 'vlib/net/tcp_test.v', + 'vlib/orm/orm_test.v', + 'vlib/orm/orm_sql_or_blocks_test.v', + 'vlib/orm/orm_create_and_drop_test.v', + 'vlib/orm/orm_insert_test.v', + 'vlib/orm/orm_insert_reserved_name_test.v', + 'vlib/orm/orm_fn_calls_test.v', + 'vlib/orm/orm_last_id_test.v', + 'vlib/orm/orm_string_interpolation_in_where_test.v', + 'vlib/orm/orm_interface_test.v', + 'vlib/orm/orm_mut_db_test.v', + 'vlib/orm/orm_null_test.v', + 'vlib/orm/orm_result_test.v', + 'vlib/orm/orm_custom_operators_test.v', + 'vlib/orm/orm_fk_test.v', + 'vlib/orm/orm_references_test.v', + 'vlib/db/sqlite/sqlite_test.v', + 'vlib/db/sqlite/sqlite_orm_test.v', + 'vlib/db/sqlite/sqlite_vfs_lowlevel_test.v', + 'vlib/v/tests/orm_enum_test.v', + 'vlib/v/tests/orm_sub_struct_test.v', + 'vlib/v/tests/orm_sub_array_struct_test.v', + 'vlib/v/tests/orm_joined_tables_select_test.v', + 'vlib/v/tests/sql_statement_inside_fn_call_test.v', + 'vlib/v/tests/orm_stmt_wrong_return_checking_test.v', + 'vlib/v/tests/orm_handle_error_for_select_from_not_created_table_test.v', + 'vlib/vweb/tests/vweb_test.v', + 'vlib/vweb/csrf/csrf_test.v', + 'vlib/vweb/request_test.v', + 'vlib/net/http/request_test.v', + 'vlib/net/http/response_test.v', + 'vlib/vweb/route_test.v', + 'vlib/net/websocket/websocket_test.v', + 'vlib/crypto/rand/crypto_rand_read_test.v', + 'vlib/net/smtp/smtp_test.v', + 'vlib/v/tests/websocket_logger_interface_should_compile_test.v', + 'vlib/v/tests/fn_literal_type_test.v', +] +const skip_with_fsanitize_address = [ + 'do_not_remove', + 'vlib/net/websocket/websocket_test.v', + 'vlib/orm/orm_create_and_drop_test.v', + 'vlib/orm/orm_insert_test.v', + 'vlib/orm/orm_insert_reserved_name_test.v', + 'vlib/orm/orm_references_test.v', + 'vlib/v/tests/websocket_logger_interface_should_compile_test.v', + 'vlib/v/tests/orm_enum_test.v', + 'vlib/v/tests/orm_sub_array_struct_test.v', + 'vlib/v/tests/orm_handle_error_for_select_from_not_created_table_test.v', +] +const skip_with_fsanitize_undefined = [ + 'do_not_remove', + 'vlib/orm/orm_create_and_drop_test.v', + 'vlib/orm/orm_insert_test.v', + 'vlib/orm/orm_insert_reserved_name_test.v', + 'vlib/orm/orm_references_test.v', + 'vlib/v/tests/orm_enum_test.v', + 'vlib/v/tests/orm_sub_array_struct_test.v', + 'vlib/v/tests/orm_handle_error_for_select_from_not_created_table_test.v', + 'vlib/v/tests/project_with_cpp_code/compiling_cpp_files_with_a_cplusplus_compiler_test.c.v', // fails compilation with: undefined reference to vtable for __cxxabiv1::__function_type_info' +] +const skip_with_werror = [ + 'do_not_remove', + 'vlib/v/embed_file/tests/embed_file_test.v', +] +const skip_with_asan_compiler = [ + 'do_not_remove', +] +const skip_with_msan_compiler = [ + 'do_not_remove', +] +const skip_on_musl = [ + 'do_not_remove', + 'vlib/v/slow_tests/profile/profile_test.v', + 'vlib/gg/draw_fns_api_test.v', + 'vlib/v/tests/skip_unused/gg_code.vv', + 'vlib/v/tests/c_struct_with_reserved_field_name_test.v', +] +const skip_on_ubuntu_musl = [ + 'do_not_remove', + //'vlib/v/gen/js/jsgen_test.v', + 'vlib/net/http/cookie_test.v', + 'vlib/net/http/http_test.v', + 'vlib/net/http/status_test.v', + 'vlib/net/websocket/ws_test.v', + 'vlib/db/sqlite/sqlite_test.v', + 'vlib/db/sqlite/sqlite_orm_test.v', + 'vlib/db/sqlite/sqlite_vfs_lowlevel_test.v', + 'vlib/orm/orm_test.v', + 'vlib/orm/orm_sql_or_blocks_test.v', + 'vlib/orm/orm_create_and_drop_test.v', + 'vlib/orm/orm_insert_test.v', + 'vlib/orm/orm_insert_reserved_name_test.v', + 'vlib/orm/orm_fn_calls_test.v', + 'vlib/orm/orm_null_test.v', + 'vlib/orm/orm_last_id_test.v', + 'vlib/orm/orm_string_interpolation_in_where_test.v', + 'vlib/orm/orm_interface_test.v', + 'vlib/orm/orm_mut_db_test.v', + 'vlib/orm/orm_result_test.v', + 'vlib/orm/orm_custom_operators_test.v', + 'vlib/orm/orm_fk_test.v', + 'vlib/orm/orm_references_test.v', + 'vlib/v/tests/orm_enum_test.v', + 'vlib/v/tests/orm_sub_struct_test.v', + 'vlib/v/tests/orm_sub_array_struct_test.v', + 'vlib/v/tests/orm_joined_tables_select_test.v', + 'vlib/v/tests/orm_stmt_wrong_return_checking_test.v', + 'vlib/v/tests/orm_handle_error_for_select_from_not_created_table_test.v', + 'vlib/v/tests/sql_statement_inside_fn_call_test.v', + 'vlib/clipboard/clipboard_test.v', + 'vlib/vweb/tests/vweb_test.v', + 'vlib/vweb/request_test.v', + 'vlib/vweb/csrf/csrf_test.v', + 'vlib/net/http/request_test.v', + 'vlib/vweb/route_test.v', + 'vlib/net/websocket/websocket_test.v', + 'vlib/net/http/http_httpbin_test.v', + 'vlib/net/http/header_test.v', + 'vlib/net/http/server_test.v', + 'vlib/net/http/response_test.v', + 'vlib/builtin/js/array_test.js.v', + 'vlib/net/smtp/smtp_test.v', + 'vlib/v/tests/websocket_logger_interface_should_compile_test.v', + 'vlib/v/tests/fn_literal_type_test.v', +] +const skip_on_linux = [ + 'do_not_remove', +] +const skip_on_non_linux = [ + 'do_not_remove', +] +const skip_on_windows_msvc = [ + 'do_not_remove', + 'vlib/v/tests/const_fixed_array_containing_references_to_itself_test.v', // error C2099: initializer is not a constant + 'vlib/v/tests/const_and_global_with_same_name_test.v', // error C2099: initializer is not a constant + 'vlib/v/tests/sumtype_as_cast_1_test.v', // error: cannot support compound statement expression ({expr; expr; expr;}) + 'vlib/v/tests/sumtype_as_cast_2_test.v', // error: cannot support compound statement expression ({expr; expr; expr;}) + 'vlib/v/tests/project_with_cpp_code/compiling_cpp_files_with_a_cplusplus_compiler_test.c.v', // TODO +] +const skip_on_windows = [ + 'do_not_remove', + 'vlib/orm/orm_test.v', + 'vlib/v/tests/orm_sub_struct_test.v', + 'vlib/v/tests/orm_joined_tables_select_test.v', + 'vlib/v/tests/orm_handle_error_for_select_from_not_created_table_test.v', + 'vlib/net/websocket/ws_test.v', + 'vlib/net/websocket/websocket_test.v', + 'vlib/net/openssl/openssl_compiles_test.c.v', + 'vlib/net/http/request_test.v', + 'vlib/net/smtp/smtp_test.v', + 'vlib/net/ssl/ssl_compiles_test.v', + 'vlib/net/mbedtls/mbedtls_compiles_test.v', + 'vlib/vweb/tests/vweb_test.v', + 'vlib/vweb/request_test.v', + 'vlib/vweb/route_test.v', + 'vlib/sync/many_times_test.v', + 'vlib/sync/once_test.v', + 'vlib/v/tests/websocket_logger_interface_should_compile_test.v', + 'vlib/v/tests/fn_literal_type_test.v', +] +const skip_on_non_windows = [ + 'do_not_remove', +] +const skip_on_macos = [ + 'do_not_remove', +] +const skip_on_non_macos = [ + 'do_not_remove', +] +const skip_on_amd64 = [ + 'do_not_remove', +] +const skip_on_arm64 = [ + 'do_not_remove', +] +const skip_on_non_amd64_or_arm64 = [ + 'do_not_remove', + // closures aren't implemented yet: + 'vlib/v/tests/closure_test.v', + 'vlib/context/cancel_test.v', + 'vlib/context/deadline_test.v', + 'vlib/context/empty_test.v', + 'vlib/context/value_test.v', + 'vlib/context/onecontext/onecontext_test.v', + 'vlib/sync/once_test.v', + 'vlib/sync/many_times_test.v', + 'do_not_remove', +] // 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' diff --git a/cmd/tools/vvet/vvet.v b/cmd/tools/vvet/vvet.v index 9b6d1456f1..3a39c78c11 100644 --- a/cmd/tools/vvet/vvet.v +++ b/cmd/tools/vvet/vvet.v @@ -29,10 +29,8 @@ struct Options { doc_private_fns_too bool } -const ( - term_colors = term.can_show_color_on_stderr() - clean_seq = ['[', '', ']', '', ' ', ''] -) +const term_colors = term.can_show_color_on_stderr() +const clean_seq = ['[', '', ']', '', ' ', ''] fn main() { vet_options := cmdline.options_after(os.args, ['vet']) diff --git a/cmd/tools/vwhere/finder_utils.v b/cmd/tools/vwhere/finder_utils.v index 83ecc77644..a8c785a74d 100644 --- a/cmd/tools/vwhere/finder_utils.v +++ b/cmd/tools/vwhere/finder_utils.v @@ -30,38 +30,36 @@ enum Mutability { not } -const ( - _args = os.args - verbose = '-v' in cmdline.only_options(_args) - header = '-h' in cmdline.only_options(_args) - format = '-f' in cmdline.only_options(_args) - symbols = { - 'fn': Symbol.@fn - 'method': .method - 'struct': .@struct - 'interface': .@interface - 'enum': .@enum - 'const': .@const - 'var': .var - 'regexp': .regexp - } - visibilities = { - 'all': Visibility.all - 'pub': .@pub - 'pri': .pri - } - mutabilities = { - 'any': Mutability.any - 'yes': .yes - 'not': .not - } - vexe = os.real_path(os.getenv_opt('VEXE') or { @VEXE }) - vlib_dir = os.join_path(os.dir(vexe), 'vlib') - vmod_dir = os.vmodules_dir() - vmod_paths = os.vmodules_paths()[1..] - current_dir = os.abs_path('.') - color_out = term.can_show_color_on_stdout() -) +const _args = os.args +const verbose = '-v' in cmdline.only_options(_args) +const header = '-h' in cmdline.only_options(_args) +const format = '-f' in cmdline.only_options(_args) +const symbols = { + 'fn': Symbol.@fn + 'method': .method + 'struct': .@struct + 'interface': .@interface + 'enum': .@enum + 'const': .@const + 'var': .var + 'regexp': .regexp +} +const visibilities = { + 'all': Visibility.all + 'pub': .@pub + 'pri': .pri +} +const mutabilities = { + 'any': Mutability.any + 'yes': .yes + 'not': .not +} +const vexe = os.real_path(os.getenv_opt('VEXE') or { @VEXE }) +const vlib_dir = os.join_path(os.dir(vexe), 'vlib') +const vmod_dir = os.vmodules_dir() +const vmod_paths = os.vmodules_paths()[1..] +const current_dir = os.abs_path('.') +const color_out = term.can_show_color_on_stdout() fn (mut cfg Symbol) set_from_str(str_in string) { if str_in !in symbols { diff --git a/cmd/tools/vwhere/test/file_two.v b/cmd/tools/vwhere/test/file_two.v index a028ee2576..5b4355384c 100644 --- a/cmd/tools/vwhere/test/file_two.v +++ b/cmd/tools/vwhere/test/file_two.v @@ -1,10 +1,8 @@ module test -const ( - x = 10 - y = 100 - z = 1000 -) +const x = 10 +const y = 100 +const z = 1000 pub enum Public { importable diff --git a/cmd/tools/vwhere/test/nested_mod/nested_file.v b/cmd/tools/vwhere/test/nested_mod/nested_file.v index 62a0b46170..1d533ed7bc 100644 --- a/cmd/tools/vwhere/test/nested_mod/nested_file.v +++ b/cmd/tools/vwhere/test/nested_mod/nested_file.v @@ -1,7 +1,5 @@ module nested_mod -pub const ( - a = 30 - b = 60 - c = 120 -) +pub const a = 30 +pub const b = 60 +pub const c = 120 diff --git a/cmd/tools/vwhere/vwhere_test.v b/cmd/tools/vwhere/vwhere_test.v index cd90cd1559..9e3474701e 100644 --- a/cmd/tools/vwhere/vwhere_test.v +++ b/cmd/tools/vwhere/vwhere_test.v @@ -123,8 +123,8 @@ fn test_find_pri_const() { assert fdr.matches == [ Match{ path: os.join_path(test_dir, 'file_two.v') - line: 5 - text: 'y = 100' + line: 4 + text: 'const y = 100' }, ] } @@ -137,7 +137,7 @@ fn test_find_pub_enum() { assert fdr.matches == [ Match{ path: os.join_path(test_dir, 'file_two.v') - line: 9 + line: 7 text: 'pub enum Public' }, ] @@ -151,7 +151,7 @@ fn test_find_pri_enum() { assert fdr.matches == [ Match{ path: os.join_path(test_dir, 'file_two.v') - line: 14 + line: 12 text: 'enum Private' }, ] @@ -165,7 +165,7 @@ fn test_find_fn() { assert fdr.matches == [ Match{ path: os.join_path(test_dir, 'file_two.v') - line: 27 + line: 25 text: 'fn some_function_name(foo string, bar int) string' }, ] @@ -179,8 +179,8 @@ fn test_find_pub_const_with_mod() { assert fdr.matches == [ Match{ path: os.join_path(test_dir, 'nested_mod', 'nested_file.v') - line: 5 - text: 'b = 60' + line: 4 + text: 'pub const b = 60' }, ] } diff --git a/cmd/v/v.v b/cmd/v/v.v index fa2fb67bd7..6599cd3be3 100644 --- a/cmd/v/v.v +++ b/cmd/v/v.v @@ -12,47 +12,45 @@ import v.util.version import v.builder import v.builder.cbuilder -const ( - external_tools = [ - 'ast', - 'bin2v', - 'bug', - 'build-examples', - 'build-tools', - 'build-vbinaries', - 'bump', - 'check-md', - 'complete', - 'compress', - 'doc', - 'doctor', - 'fmt', - 'gret', - 'ls', - 'missdoc', - 'repl', - 'self', - 'setup-freetype', - 'shader', - 'share', - 'should-compile-all', - 'symlink', - 'scan', - 'test', - 'test-all', // runs most of the tests and other checking tools, that will be run by the CI - 'test-cleancode', - 'test-fmt', - 'test-parser', - 'test-self', - 'tracev', - 'up', - 'vet', - 'wipe-cache', - 'watch', - 'where', - ] - list_of_flags_that_allow_duplicates = ['cc', 'd', 'define', 'cf', 'cflags'] -) +const external_tools = [ + 'ast', + 'bin2v', + 'bug', + 'build-examples', + 'build-tools', + 'build-vbinaries', + 'bump', + 'check-md', + 'complete', + 'compress', + 'doc', + 'doctor', + 'fmt', + 'gret', + 'ls', + 'missdoc', + 'repl', + 'self', + 'setup-freetype', + 'shader', + 'share', + 'should-compile-all', + 'symlink', + 'scan', + 'test', + 'test-all', // runs most of the tests and other checking tools, that will be run by the CI + 'test-cleancode', + 'test-fmt', + 'test-parser', + 'test-self', + 'tracev', + 'up', + 'vet', + 'wipe-cache', + 'watch', + 'where', +] +const list_of_flags_that_allow_duplicates = ['cc', 'd', 'define', 'cf', 'cflags'] fn main() { mut timers_should_print := false diff --git a/doc/docs.md b/doc/docs.md index 335eb09ce2..fc2fae19a9 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -4069,8 +4069,8 @@ fn main() { > [!NOTE] > Threads rely on the machine's CPU (number of cores/threads). > Be aware that OS threads spawned with `spawn` -> have limitations in regard to concurrency, -> including resource overhead and scalability issues, +> have limitations in regard to concurrency, +> including resource overhead and scalability issues, > and might affect performance in cases of high thread count. There's also a `go` keyword. Right now `go foo()` will be automatically renamed via vfmt @@ -5539,7 +5539,7 @@ that are substituted at compile time: where the V executable is (as a string). - `@VHASH` => replaced with the shortened commit hash of the V compiler (as a string). - `@VCURRENTHASH` => Similar to `@VHASH`, but changes when the compiler is - recompiled on a different commit (after local modifications, or after + recompiled on a different commit (after local modifications, or after using git bisect etc). - `@VMOD_FILE` => replaced with the contents of the nearest v.mod file (as a string). - `@VMODROOT` => will be substituted with the *folder*, @@ -5695,7 +5695,7 @@ fn main() { ``` Note: compressing binary assets like png or zip files, usually will not gain you much, -and in some cases may even take more space in the final executable, since they are +and in some cases may even take more space in the final executable, since they are already compressed. `$embed_file` returns @@ -5843,21 +5843,21 @@ main_default.c.v: ```v ignore module main -const ( message = 'Hello world' ) +const message = 'Hello world' ``` main_linux.c.v: ```v ignore module main -const ( message = 'Hello linux' ) +const message = 'Hello linux' ``` main_windows.c.v: ```v ignore module main -const ( message = 'Hello windows' ) +const message = 'Hello windows' ``` With the example above: diff --git a/examples/2048/2048.v b/examples/2048/2048.v index 20472fccde..d15c05b76f 100644 --- a/examples/2048/2048.v +++ b/examples/2048/2048.v @@ -45,81 +45,80 @@ struct Theme { tile_colors []gx.Color } -const ( - themes = [ - &Theme{ - bg_color: gx.rgb(250, 248, 239) - padding_color: gx.rgb(143, 130, 119) - victory_color: gx.rgb(100, 160, 100) - game_over_color: gx.rgb(190, 50, 50) - text_color: gx.black - tile_colors: [ - gx.rgb(205, 193, 180), // Empty / 0 tile - gx.rgb(238, 228, 218), // 2 - gx.rgb(237, 224, 200), // 4 - gx.rgb(242, 177, 121), // 8 - gx.rgb(245, 149, 99), // 16 - gx.rgb(246, 124, 95), // 32 - gx.rgb(246, 94, 59), // 64 - gx.rgb(237, 207, 114), // 128 - gx.rgb(237, 204, 97), // 256 - gx.rgb(237, 200, 80), // 512 - gx.rgb(237, 197, 63), // 1024 - gx.rgb(237, 194, 46), - ] - }, - &Theme{ - bg_color: gx.rgb(55, 55, 55) - padding_color: gx.rgb(68, 60, 59) - victory_color: gx.rgb(100, 160, 100) - game_over_color: gx.rgb(190, 50, 50) - text_color: gx.white - tile_colors: [ - gx.rgb(123, 115, 108), - gx.rgb(142, 136, 130), - gx.rgb(142, 134, 120), - gx.rgb(145, 106, 72), - gx.rgb(147, 89, 59), - gx.rgb(147, 74, 57), - gx.rgb(147, 56, 35), - gx.rgb(142, 124, 68), - gx.rgb(142, 122, 58), - gx.rgb(142, 120, 48), - gx.rgb(142, 118, 37), - gx.rgb(142, 116, 27), - ] - }, - &Theme{ - bg_color: gx.rgb(38, 38, 66) - padding_color: gx.rgb(58, 50, 74) - victory_color: gx.rgb(100, 160, 100) - game_over_color: gx.rgb(190, 50, 50) - text_color: gx.white - tile_colors: [ - gx.rgb(92, 86, 140), - gx.rgb(106, 99, 169), - gx.rgb(106, 97, 156), - gx.rgb(108, 79, 93), - gx.rgb(110, 66, 76), - gx.rgb(110, 55, 74), - gx.rgb(110, 42, 45), - gx.rgb(106, 93, 88), - gx.rgb(106, 91, 75), - gx.rgb(106, 90, 62), - gx.rgb(106, 88, 48), - gx.rgb(106, 87, 35), - ] - }, - ] - window_title = 'V 2048' - default_window_width = 544 - default_window_height = 560 - animation_length = 10 // frames - frames_per_ai_move = 8 - possible_moves = [Direction.up, .right, .down, .left] - predictions_per_move = 200 - prediction_depth = 8 -) +const themes = [ + &Theme{ + bg_color: gx.rgb(250, 248, 239) + padding_color: gx.rgb(143, 130, 119) + victory_color: gx.rgb(100, 160, 100) + game_over_color: gx.rgb(190, 50, 50) + text_color: gx.black + tile_colors: [ + gx.rgb(205, 193, 180), // Empty / 0 tile + gx.rgb(238, 228, 218), // 2 + gx.rgb(237, 224, 200), // 4 + gx.rgb(242, 177, 121), // 8 + gx.rgb(245, 149, 99), // 16 + gx.rgb(246, 124, 95), // 32 + gx.rgb(246, 94, 59), // 64 + gx.rgb(237, 207, 114), // 128 + gx.rgb(237, 204, 97), // 256 + gx.rgb(237, 200, 80), // 512 + gx.rgb(237, 197, 63), // 1024 + gx.rgb(237, 194, 46), + ] + }, + &Theme{ + bg_color: gx.rgb(55, 55, 55) + padding_color: gx.rgb(68, 60, 59) + victory_color: gx.rgb(100, 160, 100) + game_over_color: gx.rgb(190, 50, 50) + text_color: gx.white + tile_colors: [ + gx.rgb(123, 115, 108), + gx.rgb(142, 136, 130), + gx.rgb(142, 134, 120), + gx.rgb(145, 106, 72), + gx.rgb(147, 89, 59), + gx.rgb(147, 74, 57), + gx.rgb(147, 56, 35), + gx.rgb(142, 124, 68), + gx.rgb(142, 122, 58), + gx.rgb(142, 120, 48), + gx.rgb(142, 118, 37), + gx.rgb(142, 116, 27), + ] + }, + &Theme{ + bg_color: gx.rgb(38, 38, 66) + padding_color: gx.rgb(58, 50, 74) + victory_color: gx.rgb(100, 160, 100) + game_over_color: gx.rgb(190, 50, 50) + text_color: gx.white + tile_colors: [ + gx.rgb(92, 86, 140), + gx.rgb(106, 99, 169), + gx.rgb(106, 97, 156), + gx.rgb(108, 79, 93), + gx.rgb(110, 66, 76), + gx.rgb(110, 55, 74), + gx.rgb(110, 42, 45), + gx.rgb(106, 93, 88), + gx.rgb(106, 91, 75), + gx.rgb(106, 90, 62), + gx.rgb(106, 88, 48), + gx.rgb(106, 87, 35), + ] + }, +] +const window_title = 'V 2048' +const default_window_width = 544 +const default_window_height = 560 +const animation_length = 10 // frames + +const frames_per_ai_move = 8 +const possible_moves = [Direction.up, .right, .down, .left] +const predictions_per_move = 200 +const prediction_depth = 8 // Used for performance monitoring when `-d showfps` is passed, unused / optimized out otherwise struct Perf { diff --git a/examples/clock/clock.v b/examples/clock/clock.v index 56a515b449..92f479a017 100644 --- a/examples/clock/clock.v +++ b/examples/clock/clock.v @@ -8,27 +8,25 @@ import gx import math import time -const ( - // All coordinates are designed for a clock size of this many pixel. - // You cannot change the size of the clock by adjusting this value. - design_size = 700 - center = 350 +// All coordinates are designed for a clock size of this many pixel. +// You cannot change the size of the clock by adjusting this value. +const design_size = 700 +const center = 350 - // Half the width of a tic-mark. - tw = 9 - // Height of a minute tic-mark. (hour is twice, 3-hour is thrice) - th = 25 - // Padding of tic-mark to window border - tp = 10 +// Half the width of a tic-mark. +const tw = 9 +// Height of a minute tic-mark. (hour is twice, 3-hour is thrice) +const th = 25 +// Padding of tic-mark to window border +const tp = 10 - tic_color = gx.Color{ - r: 50 - g: 50 - b: 50 - } - hand_color = gx.black - second_hand_color = gx.red -) +const tic_color = gx.Color{ + r: 50 + g: 50 + b: 50 +} +const hand_color = gx.black +const second_hand_color = gx.red struct App { minutes_tic []f32 = [f32(center - tw), tp, center + tw, tp, center + tw, tp, center + tw, diff --git a/examples/database/orm.v b/examples/database/orm.v index 11c53b2d41..090e5b5300 100644 --- a/examples/database/orm.v +++ b/examples/database/orm.v @@ -20,20 +20,16 @@ import db.pg // * Child // in the passed databases, so it is better to use empty DBs for it. -const ( - mysql_host = os.getenv_opt('MHOST') or { 'localhost' } - mysql_port = os.getenv_opt('MPORT') or { '3306' }.u32() - mysql_user = os.getenv_opt('MUSER') or { 'myuser' } - mysql_pass = os.getenv_opt('MPASS') or { 'abc' } - mysql_db = os.getenv_opt('MDATABASE') or { 'test' } -) +const mysql_host = os.getenv_opt('MHOST') or { 'localhost' } +const mysql_port = os.getenv_opt('MPORT') or { '3306' }.u32() +const mysql_user = os.getenv_opt('MUSER') or { 'myuser' } +const mysql_pass = os.getenv_opt('MPASS') or { 'abc' } +const mysql_db = os.getenv_opt('MDATABASE') or { 'test' } -const ( - pg_host = os.getenv_opt('PGHOST') or { 'localhost' } - pg_user = os.getenv_opt('PGUSER') or { 'test' } - pg_pass = os.getenv_opt('PGPASS') or { 'abc' } - pg_db = os.getenv_opt('PGDATABASE') or { 'test' } -) +const pg_host = os.getenv_opt('PGHOST') or { 'localhost' } +const pg_user = os.getenv_opt('PGUSER') or { 'test' } +const pg_pass = os.getenv_opt('PGPASS') or { 'abc' } +const pg_db = os.getenv_opt('PGDATABASE') or { 'test' } @[table: 'modules'] struct Module { diff --git a/examples/dynamic_library_loader/use_shared_library.v b/examples/dynamic_library_loader/use_shared_library.v index 97e4334f10..3fae864220 100644 --- a/examples/dynamic_library_loader/use_shared_library.v +++ b/examples/dynamic_library_loader/use_shared_library.v @@ -9,15 +9,13 @@ import dl.loader type FNAdder = fn (int, int) int -const ( - cfolder = os.dir(@FILE) - default_paths = [ - os.join_path(cfolder, 'library${dl.dl_ext}'), - os.join_path(cfolder, 'location1/library${dl.dl_ext}'), - os.join_path(cfolder, 'location2/library${dl.dl_ext}'), - os.join_path(cfolder, 'modules/library/library${dl.dl_ext}'), - ] -) +const cfolder = os.dir(@FILE) +const default_paths = [ + os.join_path(cfolder, 'library${dl.dl_ext}'), + os.join_path(cfolder, 'location1/library${dl.dl_ext}'), + os.join_path(cfolder, 'location2/library${dl.dl_ext}'), + os.join_path(cfolder, 'modules/library/library${dl.dl_ext}'), +] fn main() { mut dl_loader := loader.get_or_create_dynamic_lib_loader( diff --git a/examples/dynamic_library_loader/use_test.v b/examples/dynamic_library_loader/use_test.v index 31e0cbabff..1451f9168f 100644 --- a/examples/dynamic_library_loader/use_test.v +++ b/examples/dynamic_library_loader/use_test.v @@ -5,10 +5,8 @@ module main import os import dl -const ( - vexe = os.real_path(os.getenv('VEXE')) - so_ext = dl.dl_ext -) +const vexe = os.real_path(os.getenv('VEXE')) +const so_ext = dl.dl_ext fn test_vexe() { // dump(vexe) diff --git a/examples/dynamic_library_loading/use_library_test.v b/examples/dynamic_library_loading/use_library_test.v index fba02e2637..33804606f8 100644 --- a/examples/dynamic_library_loading/use_library_test.v +++ b/examples/dynamic_library_loading/use_library_test.v @@ -5,12 +5,10 @@ module main import os import dl -const ( - vexe = os.real_path(os.getenv('VEXE')) - cfolder = os.dir(@FILE) - so_ext = dl.dl_ext - library_file_name = os.join_path(cfolder, dl.get_libname('library')) -) +const vexe = os.real_path(os.getenv('VEXE')) +const cfolder = os.dir(@FILE) +const so_ext = dl.dl_ext +const library_file_name = os.join_path(cfolder, dl.get_libname('library')) fn test_vexe() { // dump(vexe) diff --git a/examples/eventbus/modules/some_module/some_module.v b/examples/eventbus/modules/some_module/some_module.v index 5fc4af5818..9bd35284be 100644 --- a/examples/eventbus/modules/some_module/some_module.v +++ b/examples/eventbus/modules/some_module/some_module.v @@ -2,9 +2,7 @@ module some_module import eventbus -const ( - eb = eventbus.new[string]() -) +const eb = eventbus.new[string]() pub struct Duration { pub: diff --git a/examples/flappylearning/game.v b/examples/flappylearning/game.v index 76b4576f60..f957b113e1 100644 --- a/examples/flappylearning/game.v +++ b/examples/flappylearning/game.v @@ -8,10 +8,8 @@ import math import rand import neuroevolution -const ( - win_width = 500 - win_height = 512 -) +const win_width = 500 +const win_height = 512 struct Bird { mut: diff --git a/examples/game_of_life/life.v b/examples/game_of_life/life.v index 8e99b1e418..33382d778a 100644 --- a/examples/game_of_life/life.v +++ b/examples/game_of_life/life.v @@ -2,15 +2,13 @@ import term import rand import time -const ( - cell = '█' - nothing = ' ' - switches = { - cell: nothing - nothing: cell - } - transformers = [nothing, cell] -) +const cell = '█' +const nothing = ' ' +const switches = { + cell: nothing + nothing: cell +} +const transformers = [nothing, cell] struct Game { mut: diff --git a/examples/game_of_life/life_gg.v b/examples/game_of_life/life_gg.v index 66f129a444..4b465f246b 100644 --- a/examples/game_of_life/life_gg.v +++ b/examples/game_of_life/life_gg.v @@ -4,11 +4,9 @@ import gg import gx import automaton -const ( - screen_width = 800 - screen_height = 600 - filled_color = gx.blue -) +const screen_width = 800 +const screen_height = 600 +const filled_color = gx.blue @[live] fn print_automaton(app &App) { diff --git a/examples/gg/arcs_and_slices.v b/examples/gg/arcs_and_slices.v index 9d48018ef8..ebcada0804 100644 --- a/examples/gg/arcs_and_slices.v +++ b/examples/gg/arcs_and_slices.v @@ -4,12 +4,10 @@ import gg import gx import math -const ( - win_width = 700 - win_height = 800 - bg_color = gx.white - colour = gx.black -) +const win_width = 700 +const win_height = 800 +const bg_color = gx.white +const colour = gx.black enum Selection { segs = 0 diff --git a/examples/gg/bezier.v b/examples/gg/bezier.v index e0bebf4ec1..e33fa8b98a 100644 --- a/examples/gg/bezier.v +++ b/examples/gg/bezier.v @@ -3,9 +3,7 @@ module main import gg import gx -const ( - points = [f32(200.0), 200.0, 200.0, 100.0, 400.0, 100.0, 400.0, 300.0] -) +const points = [f32(200.0), 200.0, 200.0, 100.0, 400.0, 100.0, 400.0, 300.0] struct App { mut: diff --git a/examples/gg/drag_n_drop.v b/examples/gg/drag_n_drop.v index 37d7b07403..cade10a9d4 100644 --- a/examples/gg/drag_n_drop.v +++ b/examples/gg/drag_n_drop.v @@ -5,11 +5,9 @@ import gg import gx import sokol.sapp -const ( - max_files = 12 - text = 'Drag&Drop here max ${max_files} files.' - text_size = 16 -) +const max_files = 12 +const text = 'Drag&Drop here max ${max_files} files.' +const text_size = 16 struct App { mut: diff --git a/examples/gg/raven_text_rendering.v b/examples/gg/raven_text_rendering.v index 4c9477d585..ce418cd1e9 100644 --- a/examples/gg/raven_text_rendering.v +++ b/examples/gg/raven_text_rendering.v @@ -5,14 +5,11 @@ import gx import os import math -const ( - win_width = 600 - win_height = 700 - bg_color = gx.white -) +const win_width = 600 +const win_height = 700 +const bg_color = gx.white -const ( - text = ' +const text = ' Once upon a midnight dreary, while I pondered, weak and weary, Over many a quaint and curious volume of forgotten lore— While I nodded, nearly napping, suddenly there came a tapping, @@ -55,8 +52,8 @@ Soon again I heard a tapping somewhat louder than before. Let my heart be still a moment and this mystery explore;— ’Tis the wind and nothing more!” ' - lines = text.split('\n') -) + +const lines = text.split('\n') struct App { mut: diff --git a/examples/gg/rectangles.v b/examples/gg/rectangles.v index 1a99efb879..d17b388c12 100644 --- a/examples/gg/rectangles.v +++ b/examples/gg/rectangles.v @@ -4,10 +4,8 @@ import gg import gx import os -const ( - win_width = 600 - win_height = 300 -) +const win_width = 600 +const win_height = 300 struct App { mut: diff --git a/examples/gg/stars.v b/examples/gg/stars.v index ea4f593b8a..3e96a11528 100644 --- a/examples/gg/stars.v +++ b/examples/gg/stars.v @@ -6,12 +6,10 @@ import gx import rand import sokol.sgl -const ( - win_width = 800 - win_height = 600 - max_stars = 5000 - max_v_letters = 5 -) +const win_width = 800 +const win_height = 600 +const max_stars = 5000 +const max_v_letters = 5 struct Star { mut: diff --git a/examples/gg/worker_thread.v b/examples/gg/worker_thread.v index 006c652190..2d73492c3b 100644 --- a/examples/gg/worker_thread.v +++ b/examples/gg/worker_thread.v @@ -9,12 +9,10 @@ import gx import math import time -const ( - win_width = 600 - win_height = 700 - bg_color = gx.white - count_color = gx.black -) +const win_width = 600 +const win_height = 700 +const bg_color = gx.white +const count_color = gx.black struct App { mut: diff --git a/examples/hanoi.v b/examples/hanoi.v index 70575ac342..e65f86ece1 100644 --- a/examples/hanoi.v +++ b/examples/hanoi.v @@ -1,7 +1,5 @@ // hanoi tower -const ( - num = 7 -) +const num = 7 fn main() { hanoi(num, 'A', 'B', 'C') diff --git a/examples/hot_reload/bounce.v b/examples/hot_reload/bounce.v index e0af52b067..ea0d8ca4e9 100644 --- a/examples/hot_reload/bounce.v +++ b/examples/hot_reload/bounce.v @@ -18,11 +18,9 @@ mut: draw_fn voidptr } -const ( - window_width = 400 - window_height = 300 - width = 50 -) +const window_width = 400 +const window_height = 300 +const width = 50 fn main() { mut game := &Game{ diff --git a/examples/hot_reload/graph.v b/examples/hot_reload/graph.v index 15e24129ae..5960417a67 100644 --- a/examples/hot_reload/graph.v +++ b/examples/hot_reload/graph.v @@ -5,10 +5,8 @@ import gg import time import math -const ( - size = 700 - scale = 50.0 -) +const size = 700 +const scale = 50.0 struct Context { mut: diff --git a/examples/js_dom_cube/cube.js.v b/examples/js_dom_cube/cube.js.v index f21e7c2b4a..48ecb93e2a 100644 --- a/examples/js_dom_cube/cube.js.v +++ b/examples/js_dom_cube/cube.js.v @@ -1,201 +1,199 @@ import js.dom import math -const ( - vert_code = 'attribute vec3 position;uniform mat4 Pmatrix;uniform mat4 Vmatrix;uniform mat4 Mmatrix;attribute vec3 color;varying vec3 vColor;void main(void) {gl_Position = Pmatrix * Vmatrix * Mmatrix * vec4(position,1.);vColor = color;} +const vert_code = 'attribute vec3 position;uniform mat4 Pmatrix;uniform mat4 Vmatrix;uniform mat4 Mmatrix;attribute vec3 color;varying vec3 vColor;void main(void) {gl_Position = Pmatrix * Vmatrix * Mmatrix * vec4(position,1.);vColor = color;} ' - frag_code = 'precision mediump float;varying vec3 vColor;void main(void) {gl_FragColor = vec4(vColor, 1.);} +const frag_code = 'precision mediump float;varying vec3 vColor;void main(void) {gl_FragColor = vec4(vColor, 1.);} ' - vertices = [ - f32(-1), - -1, - -1, - 1, - -1, - -1, - 1, - 1, - -1, - -1, - 1, - -1, - -1, - -1, - 1, - 1, - -1, - 1, - 1, - 1, - 1, - -1, - 1, - 1, - -1, - -1, - -1, - -1, - 1, - -1, - -1, - 1, - 1, - -1, - -1, - 1, - 1, - -1, - -1, - 1, - 1, - -1, - 1, - 1, - 1, - 1, - -1, - 1, - -1, - -1, - -1, - -1, - -1, - 1, - 1, - -1, - 1, - 1, - -1, - -1, - -1, - 1, - -1, - -1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - -1, - ] - colors = [ - f32(5), - 3, - 7, - 5, - 3, - 7, - 5, - 3, - 7, - 5, - 3, - 7, - 1, - 1, - 3, - 1, - 1, - 3, - 1, - 1, - 3, - 1, - 1, - 3, - 0, - 0, - 1, - 0, - 0, - 1, - 0, - 0, - 1, - 0, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 0, - 1, - 0, - 0, - 1, - 0, - 0, - 1, - 1, - 0, - 1, - 1, - 0, - 1, - 1, - 0, - 1, - 1, - 0, - 0, - 1, - 0, - 0, - 1, - 0, - 0, - 1, - 0, - 0, - 1, - 0, - ] - indices = [ - u16(0), - 1, - 2, - 0, - 2, - 3, - 4, - 5, - 6, - 4, - 6, - 7, - 8, - 9, - 10, - 8, - 10, - 11, - 12, - 13, - 14, - 12, - 14, - 15, - 16, - 17, - 18, - 16, - 18, - 19, - 20, - 21, - 22, - 20, - 22, - 23, - ] - amortization = 0.95 -) +const vertices = [ + f32(-1), + -1, + -1, + 1, + -1, + -1, + 1, + 1, + -1, + -1, + 1, + -1, + -1, + -1, + 1, + 1, + -1, + 1, + 1, + 1, + 1, + -1, + 1, + 1, + -1, + -1, + -1, + -1, + 1, + -1, + -1, + 1, + 1, + -1, + -1, + 1, + 1, + -1, + -1, + 1, + 1, + -1, + 1, + 1, + 1, + 1, + -1, + 1, + -1, + -1, + -1, + -1, + -1, + 1, + 1, + -1, + 1, + 1, + -1, + -1, + -1, + 1, + -1, + -1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + -1, +] +const colors = [ + f32(5), + 3, + 7, + 5, + 3, + 7, + 5, + 3, + 7, + 5, + 3, + 7, + 1, + 1, + 3, + 1, + 1, + 3, + 1, + 1, + 3, + 1, + 1, + 3, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 0, +] +const indices = [ + u16(0), + 1, + 2, + 0, + 2, + 3, + 4, + 5, + 6, + 4, + 6, + 7, + 8, + 9, + 10, + 8, + 10, + 11, + 12, + 13, + 14, + 12, + 14, + 15, + 16, + 17, + 18, + 16, + 18, + 19, + 20, + 21, + 22, + 20, + 22, + 23, +] +const amortization = 0.95 fn get_webgl() (JS.HTMLCanvasElement, JS.WebGLRenderingContext) { JS.console.log(dom.document) diff --git a/examples/js_dom_draw_bechmark_chart/chart/main.v b/examples/js_dom_draw_bechmark_chart/chart/main.v index 57922ae6e4..3bf74fee42 100644 --- a/examples/js_dom_draw_bechmark_chart/chart/main.v +++ b/examples/js_dom_draw_bechmark_chart/chart/main.v @@ -38,10 +38,8 @@ fn (framework_platform FrameworkPlatform) to_map() map[string][]int { return mapa } -const ( - http_port = 3001 - benchmark_loop_length = 20 -) +const http_port = 3001 +const benchmark_loop_length = 20 struct App { vweb.Context diff --git a/examples/nbody.v b/examples/nbody.v index 0f719e81a9..9edc02cfa8 100644 --- a/examples/nbody.v +++ b/examples/nbody.v @@ -4,11 +4,10 @@ // -0.169059907 import math -const ( - solar_mass = 39.47841760435743197 // 4.0 * math.Pi * math.Pi - days_per_year = 365.24 - c_n = 5 -) +const solar_mass = 39.47841760435743197 // 4.0 * math.Pi * math.Pi + +const days_per_year = 365.24 +const c_n = 5 struct Position { pub mut: diff --git a/examples/password/password_test.v b/examples/password/password_test.v index 8ced743ca2..266bcf10dc 100644 --- a/examples/password/password_test.v +++ b/examples/password/password_test.v @@ -1,14 +1,12 @@ import os -const ( - // Expect has to be installed for the test. - expect_exe = os.find_abs_path_of_executable('expect') or { - eprintln('skipping test, since expect is missing') - exit(0) - } - // Directory that contains the Expect scripts used in the test. - expect_tests_path = os.join_path(@VMODROOT, 'examples', 'password', 'tests') -) +// Expect has to be installed for the test. +const expect_exe = os.find_abs_path_of_executable('expect') or { + eprintln('skipping test, since expect is missing') + exit(0) +} +// Directory that contains the Expect scripts used in the test. +const expect_tests_path = os.join_path(@VMODROOT, 'examples', 'password', 'tests') fn test_password_input() { correct := os.execute(os.join_path(expect_tests_path, 'correct.expect')) diff --git a/examples/path_tracing.v b/examples/path_tracing.v index baee56edb4..b9d062631e 100644 --- a/examples/path_tracing.v +++ b/examples/path_tracing.v @@ -30,11 +30,9 @@ import rand import time import term -const ( - inf = 1e+10 - eps = 1e-4 - f_0 = 0.0 -) +const inf = 1e+10 +const eps = 1e-4 +const f_0 = 0.0 //**************************** 3D Vector utility struct ********************* struct Vec { @@ -163,164 +161,163 @@ fn (sp Sphere) intersect(r Ray) f64 { * 2) Psychedelic * The sphere fields are: Sphere{radius, position, emission, color, material} ******************************************************************************/ -const ( - cen = Vec{50, 40.8, -860} // used by scene 1 - spheres = [ - [// scene 0 cornnel box - Sphere{ - rad: 1e+5 - p: Vec{1e+5 + 1, 40.8, 81.6} - e: Vec{} - c: Vec{.75, .25, .25} - refl: .diff - }, // Left - Sphere{ - rad: 1e+5 - p: Vec{-1e+5 + 99, 40.8, 81.6} - e: Vec{} - c: Vec{.25, .25, .75} - refl: .diff - }, // Rght - Sphere{ - rad: 1e+5 - p: Vec{50, 40.8, 1e+5} - e: Vec{} - c: Vec{.75, .75, .75} - refl: .diff - }, // Back - Sphere{ - rad: 1e+5 - p: Vec{50, 40.8, -1e+5 + 170} - e: Vec{} - c: Vec{} - refl: .diff - }, // Frnt - Sphere{ - rad: 1e+5 - p: Vec{50, 1e+5, 81.6} - e: Vec{} - c: Vec{.75, .75, .75} - refl: .diff - }, // Botm - Sphere{ - rad: 1e+5 - p: Vec{50, -1e+5 + 81.6, 81.6} - e: Vec{} - c: Vec{.75, .75, .75} - refl: .diff - }, // Top - Sphere{ - rad: 16.5 - p: Vec{27, 16.5, 47} - e: Vec{} - c: Vec{1, 1, 1}.mult_s(.999) - refl: .spec - }, // Mirr - Sphere{ - rad: 16.5 - p: Vec{73, 16.5, 78} - e: Vec{} - c: Vec{1, 1, 1}.mult_s(.999) - refl: .refr - }, // Glas - Sphere{ - rad: 600 - p: Vec{50, 681.6 - .27, 81.6} - e: Vec{12, 12, 12} - c: Vec{} - refl: .diff - }, // Lite - ], - [// scene 1 sunset - Sphere{ - rad: 1600 - p: Vec{1.0, 0.0, 2.0}.mult_s(3000) - e: Vec{1.0, .9, .8}.mult_s(1.2e+1 * 1.56 * 2) - c: Vec{} - refl: .diff - }, // sun - Sphere{ - rad: 1560 - p: Vec{1, 0, 2}.mult_s(3500) - e: Vec{1.0, .5, .05}.mult_s(4.8e+1 * 1.56 * 2) - c: Vec{} - refl: .diff - }, // horizon sun2 - Sphere{ - rad: 10000 - p: cen + Vec{0, 0, -200} - e: Vec{0.00063842, 0.02001478, 0.28923243}.mult_s(6e-2 * 8) - c: Vec{.7, .7, 1}.mult_s(.25) - refl: .diff - }, // sky - Sphere{ - rad: 100000 - p: Vec{50, -100000, 0} - e: Vec{} - c: Vec{.3, .3, .3} - refl: .diff - }, // grnd - Sphere{ - rad: 110000 - p: Vec{50, -110048.5, 0} - e: Vec{.9, .5, .05}.mult_s(4) - c: Vec{} - refl: .diff - }, // horizon brightener - Sphere{ - rad: 4e+4 - p: Vec{50, -4e+4 - 30, -3000} - e: Vec{} - c: Vec{.2, .2, .2} - refl: .diff - }, // mountains - Sphere{ - rad: 26.5 - p: Vec{22, 26.5, 42} - e: Vec{} - c: Vec{1, 1, 1}.mult_s(.596) - refl: .spec - }, // white Mirr - Sphere{ - rad: 13 - p: Vec{75, 13, 82} - e: Vec{} - c: Vec{.96, .96, .96}.mult_s(.96) - refl: .refr - }, // Glas - Sphere{ - rad: 22 - p: Vec{87, 22, 24} - e: Vec{} - c: Vec{.6, .6, .6}.mult_s(.696) - refl: .refr - }, // Glas2 - ], - [// scene 3 Psychedelic - Sphere{ - rad: 150 - p: Vec{50 + 75, 28, 62} - e: Vec{1, 1, 1}.mult_s(0e-3) - c: Vec{1, .9, .8}.mult_s(.93) - refl: .refr - }, - Sphere{ - rad: 28 - p: Vec{50 + 5, -28, 62} - e: Vec{1, 1, 1}.mult_s(1e+1) - c: Vec{1, 1, 1}.mult_s(0) - refl: .diff - }, - Sphere{ - rad: 300 - p: Vec{50, 28, 62} - e: Vec{1, 1, 1}.mult_s(0e-3) - c: Vec{1, 1, 1}.mult_s(.93) - refl: .spec - }, - ], - ] // end of scene array -) +const cen = Vec{50, 40.8, -860} // used by scene 1 + +const spheres = [ + [// scene 0 cornnel box + Sphere{ + rad: 1e+5 + p: Vec{1e+5 + 1, 40.8, 81.6} + e: Vec{} + c: Vec{.75, .25, .25} + refl: .diff + }, // Left + Sphere{ + rad: 1e+5 + p: Vec{-1e+5 + 99, 40.8, 81.6} + e: Vec{} + c: Vec{.25, .25, .75} + refl: .diff + }, // Rght + Sphere{ + rad: 1e+5 + p: Vec{50, 40.8, 1e+5} + e: Vec{} + c: Vec{.75, .75, .75} + refl: .diff + }, // Back + Sphere{ + rad: 1e+5 + p: Vec{50, 40.8, -1e+5 + 170} + e: Vec{} + c: Vec{} + refl: .diff + }, // Frnt + Sphere{ + rad: 1e+5 + p: Vec{50, 1e+5, 81.6} + e: Vec{} + c: Vec{.75, .75, .75} + refl: .diff + }, // Botm + Sphere{ + rad: 1e+5 + p: Vec{50, -1e+5 + 81.6, 81.6} + e: Vec{} + c: Vec{.75, .75, .75} + refl: .diff + }, // Top + Sphere{ + rad: 16.5 + p: Vec{27, 16.5, 47} + e: Vec{} + c: Vec{1, 1, 1}.mult_s(.999) + refl: .spec + }, // Mirr + Sphere{ + rad: 16.5 + p: Vec{73, 16.5, 78} + e: Vec{} + c: Vec{1, 1, 1}.mult_s(.999) + refl: .refr + }, // Glas + Sphere{ + rad: 600 + p: Vec{50, 681.6 - .27, 81.6} + e: Vec{12, 12, 12} + c: Vec{} + refl: .diff + }, // Lite + ], + [// scene 1 sunset + Sphere{ + rad: 1600 + p: Vec{1.0, 0.0, 2.0}.mult_s(3000) + e: Vec{1.0, .9, .8}.mult_s(1.2e+1 * 1.56 * 2) + c: Vec{} + refl: .diff + }, // sun + Sphere{ + rad: 1560 + p: Vec{1, 0, 2}.mult_s(3500) + e: Vec{1.0, .5, .05}.mult_s(4.8e+1 * 1.56 * 2) + c: Vec{} + refl: .diff + }, // horizon sun2 + Sphere{ + rad: 10000 + p: cen + Vec{0, 0, -200} + e: Vec{0.00063842, 0.02001478, 0.28923243}.mult_s(6e-2 * 8) + c: Vec{.7, .7, 1}.mult_s(.25) + refl: .diff + }, // sky + Sphere{ + rad: 100000 + p: Vec{50, -100000, 0} + e: Vec{} + c: Vec{.3, .3, .3} + refl: .diff + }, // grnd + Sphere{ + rad: 110000 + p: Vec{50, -110048.5, 0} + e: Vec{.9, .5, .05}.mult_s(4) + c: Vec{} + refl: .diff + }, // horizon brightener + Sphere{ + rad: 4e+4 + p: Vec{50, -4e+4 - 30, -3000} + e: Vec{} + c: Vec{.2, .2, .2} + refl: .diff + }, // mountains + Sphere{ + rad: 26.5 + p: Vec{22, 26.5, 42} + e: Vec{} + c: Vec{1, 1, 1}.mult_s(.596) + refl: .spec + }, // white Mirr + Sphere{ + rad: 13 + p: Vec{75, 13, 82} + e: Vec{} + c: Vec{.96, .96, .96}.mult_s(.96) + refl: .refr + }, // Glas + Sphere{ + rad: 22 + p: Vec{87, 22, 24} + e: Vec{} + c: Vec{.6, .6, .6}.mult_s(.696) + refl: .refr + }, // Glas2 + ], + [// scene 3 Psychedelic + Sphere{ + rad: 150 + p: Vec{50 + 75, 28, 62} + e: Vec{1, 1, 1}.mult_s(0e-3) + c: Vec{1, .9, .8}.mult_s(.93) + refl: .refr + }, + Sphere{ + rad: 28 + p: Vec{50 + 5, -28, 62} + e: Vec{1, 1, 1}.mult_s(1e+1) + c: Vec{1, 1, 1}.mult_s(0) + refl: .diff + }, + Sphere{ + rad: 300 + p: Vec{50, 28, 62} + e: Vec{1, 1, 1}.mult_s(0e-3) + c: Vec{1, 1, 1}.mult_s(.93) + refl: .spec + }, + ], +] //********************************** Utilities ****************************** @[inline] @@ -360,10 +357,9 @@ fn rand_f64() f64 { return f64(x) / f64(0x3FFF_FFFF) } -const ( - cache_len = 65536 // the 2*pi angle will be split in 2^16 parts - cache_mask = cache_len - 1 // mask to speed-up the module process -) +const cache_len = 65536 // the 2*pi angle will be split in 2^16 parts + +const cache_mask = cache_len - 1 struct Cache { mut: @@ -383,9 +379,7 @@ fn new_tabs() Cache { } //************ Cache for sin/cos speed-up table and scene selector ********** -const ( - tabs = new_tabs() -) +const tabs = new_tabs() //****************** main function for the radiance calculation ************* fn radiance(r Ray, depthi int, scene_id int) Vec { diff --git a/examples/pendulum-simulation/modules/sim/params.v b/examples/pendulum-simulation/modules/sim/params.v index 558b3b2909..643f3cec49 100644 --- a/examples/pendulum-simulation/modules/sim/params.v +++ b/examples/pendulum-simulation/modules/sim/params.v @@ -2,14 +2,12 @@ module sim import math -pub const ( - default_rope_length = 0.25 - default_bearing_mass = 0.03 - default_magnet_spacing = 0.05 - default_magnet_height = 0.03 - default_magnet_strength = 10.0 - default_gravity = 4.9 -) +pub const default_rope_length = 0.25 +pub const default_bearing_mass = 0.03 +pub const default_magnet_spacing = 0.05 +pub const default_magnet_height = 0.03 +pub const default_magnet_strength = 10.0 +pub const default_gravity = 4.9 @[params] pub struct SimParams { diff --git a/examples/pendulum-simulation/modules/sim/params_test.v b/examples/pendulum-simulation/modules/sim/params_test.v index b48ff9555d..9e205774c2 100644 --- a/examples/pendulum-simulation/modules/sim/params_test.v +++ b/examples/pendulum-simulation/modules/sim/params_test.v @@ -2,34 +2,32 @@ module sim import math -const ( - params_test_mock_params = SimParams{ - rope_length: 0.25 - bearing_mass: 0.03 - magnet_spacing: 0.05 - magnet_height: 0.03 - magnet_strength: 10 - gravity: 4.9 - } - params_test_mock_state = SimState{ - position: vector( - x: -0.016957230930171364 - y: -0.02937078552673521 - z: 0.002311063475327252 - ) - velocity: vector( - x: -7.251158929833104 - y: -12.559375680227724 - z: -105.91539687686381 - ) - accel: vector( - x: -8.337034766251843e-11 - y: -2.842170943040401e-10 - z: 1.2126596023639044e-10 - ) - } - params_test_mock_tetha = 2.0 * math.pi / 3.0 -) +const params_test_mock_params = SimParams{ + rope_length: 0.25 + bearing_mass: 0.03 + magnet_spacing: 0.05 + magnet_height: 0.03 + magnet_strength: 10 + gravity: 4.9 +} +const params_test_mock_state = SimState{ + position: vector( + x: -0.016957230930171364 + y: -0.02937078552673521 + z: 0.002311063475327252 + ) + velocity: vector( + x: -7.251158929833104 + y: -12.559375680227724 + z: -105.91539687686381 + ) + accel: vector( + x: -8.337034766251843e-11 + y: -2.842170943040401e-10 + z: 1.2126596023639044e-10 + ) +} +const params_test_mock_tetha = 2.0 * math.pi / 3.0 pub fn test_get_rope_vector() { result := sim.params_test_mock_params.get_rope_vector(sim.params_test_mock_state) diff --git a/examples/pendulum-simulation/modules/sim/runner.v b/examples/pendulum-simulation/modules/sim/runner.v index d1f508eac0..326f82643a 100644 --- a/examples/pendulum-simulation/modules/sim/runner.v +++ b/examples/pendulum-simulation/modules/sim/runner.v @@ -9,10 +9,8 @@ pub type SimStartHandler = fn () ! pub type SimFinishHandler = fn () ! -pub const ( - default_width = 600 - default_height = 600 -) +pub const default_width = 600 +pub const default_height = 600 @[params] pub struct GridSettings { diff --git a/examples/pendulum-simulation/modules/sim/sim_test.v b/examples/pendulum-simulation/modules/sim/sim_test.v index c27ce1e8f6..c1ea2c8b1f 100644 --- a/examples/pendulum-simulation/modules/sim/sim_test.v +++ b/examples/pendulum-simulation/modules/sim/sim_test.v @@ -1,32 +1,30 @@ module sim -const ( - sim_test_mock_params = SimParams{ - rope_length: 0.25 - bearing_mass: 0.03 - magnet_spacing: 0.05 - magnet_height: 0.03 - magnet_strength: 10 - gravity: 4.9 - } - sim_test_mock_state = SimState{ - position: vector( - x: -0.016957230930171364 - y: -0.02937078552673521 - z: 0.002311063475327252 - ) - velocity: vector( - x: -7.251158929833104 - y: -12.559375680227724 - z: -105.91539687686381 - ) - accel: vector( - x: -8.337034766251843e-11 - y: -2.842170943040401e-10 - z: 1.2126596023639044e-10 - ) - } -) +const sim_test_mock_params = SimParams{ + rope_length: 0.25 + bearing_mass: 0.03 + magnet_spacing: 0.05 + magnet_height: 0.03 + magnet_strength: 10 + gravity: 4.9 +} +const sim_test_mock_state = SimState{ + position: vector( + x: -0.016957230930171364 + y: -0.02937078552673521 + z: 0.002311063475327252 + ) + velocity: vector( + x: -7.251158929833104 + y: -12.559375680227724 + z: -105.91539687686381 + ) + accel: vector( + x: -8.337034766251843e-11 + y: -2.842170943040401e-10 + z: 1.2126596023639044e-10 + ) +} pub fn test_satisfy_rope_constraint() { mut state := SimState{ diff --git a/examples/pendulum-simulation/modules/sim/worker.v b/examples/pendulum-simulation/modules/sim/worker.v index d4b026d1d7..0263c7bf9c 100644 --- a/examples/pendulum-simulation/modules/sim/worker.v +++ b/examples/pendulum-simulation/modules/sim/worker.v @@ -3,10 +3,8 @@ module sim import math import benchmark -const ( - max_iterations = 1000 - simulation_delta_t = 0.0005 -) +const max_iterations = 1000 +const simulation_delta_t = 0.0005 pub struct SimRequest { params SimParams diff --git a/examples/pendulum-simulation/modules/sim/worker_test.v b/examples/pendulum-simulation/modules/sim/worker_test.v index be4bf9e1e1..d7ff9b12fe 100644 --- a/examples/pendulum-simulation/modules/sim/worker_test.v +++ b/examples/pendulum-simulation/modules/sim/worker_test.v @@ -1,32 +1,30 @@ module sim -const ( - worker_test_mock_params = SimParams{ - rope_length: 0.25 - bearing_mass: 0.03 - magnet_spacing: 0.05 - magnet_height: 0.03 - magnet_strength: 10 - gravity: 4.9 - } - worker_test_mock_state = SimState{ - position: vector( - x: -0.016957230930171364 - y: -0.02937078552673521 - z: 0.002311063475327252 - ) - velocity: vector( - x: -7.251158929833104 - y: -12.559375680227724 - z: -105.91539687686381 - ) - accel: vector( - x: -8.337034766251843e-11 - y: -2.842170943040401e-10 - z: 1.2126596023639044e-10 - ) - } -) +const worker_test_mock_params = SimParams{ + rope_length: 0.25 + bearing_mass: 0.03 + magnet_spacing: 0.05 + magnet_height: 0.03 + magnet_strength: 10 + gravity: 4.9 +} +const worker_test_mock_state = SimState{ + position: vector( + x: -0.016957230930171364 + y: -0.02937078552673521 + z: 0.002311063475327252 + ) + velocity: vector( + x: -7.251158929833104 + y: -12.559375680227724 + z: -105.91539687686381 + ) + accel: vector( + x: -8.337034766251843e-11 + y: -2.842170943040401e-10 + z: 1.2126596023639044e-10 + ) +} fn test_compute_result() { request := SimRequest{ diff --git a/examples/pico/pico.v b/examples/pico/pico.v index 882e7fdac1..3ddd6b139d 100644 --- a/examples/pico/pico.v +++ b/examples/pico/pico.v @@ -2,9 +2,7 @@ import json import picoev import picohttpparser -const ( - port = 8089 -) +const port = 8089 struct Message { message string diff --git a/examples/pico/raw_callback.v b/examples/pico/raw_callback.v index 8794f8d2ef..fb1b06f21a 100644 --- a/examples/pico/raw_callback.v +++ b/examples/pico/raw_callback.v @@ -3,10 +3,8 @@ module main import net import picoev -const ( - port = 8080 - http_response = 'HTTP/1.1 200 OK\r\nContent-type: text/html\r\nContent-length: 18\r\n\r\nHello from Picoev!' -) +const port = 8080 +const http_response = 'HTTP/1.1 200 OK\r\nContent-type: text/html\r\nContent-length: 18\r\n\r\nHello from Picoev!' fn main() { println('Starting webserver on http://localhost:${port}/ ...') diff --git a/examples/quadtree_demo/quadtree_demo.v b/examples/quadtree_demo/quadtree_demo.v index 71f382e4f4..0dd024d334 100644 --- a/examples/quadtree_demo/quadtree_demo.v +++ b/examples/quadtree_demo/quadtree_demo.v @@ -8,19 +8,18 @@ import time import math import rand -const ( - win_width = 1340 - win_height = 640 - timer_period = 40 * time.millisecond // defaulted at 25 fps - font_small = gx.TextCfg{ - color: gx.black - size: 20 - } - font_large = gx.TextCfg{ - color: gx.black - size: 40 - } -) +const win_width = 1340 +const win_height = 640 +const timer_period = 40 * time.millisecond // defaulted at 25 fps + +const font_small = gx.TextCfg{ + color: gx.black + size: 20 +} +const font_large = gx.TextCfg{ + color: gx.black + size: 40 +} struct App { mut: diff --git a/examples/quick_sort.v b/examples/quick_sort.v index 4a0c089f1f..964acfc544 100644 --- a/examples/quick_sort.v +++ b/examples/quick_sort.v @@ -1,9 +1,8 @@ import rand -const ( - gen_len = 1000 // how many random numbers to generate - gen_max = 10000 // max of the generated numbers -) +const gen_len = 1000 // how many random numbers to generate + +const gen_max = 10000 fn main() { mut arr := []int{} diff --git a/examples/readline/readline_test.v b/examples/readline/readline_test.v index 17514ca3b5..21231f58e1 100644 --- a/examples/readline/readline_test.v +++ b/examples/readline/readline_test.v @@ -1,14 +1,12 @@ import os -const ( - // Expect has to be installed for the test. - expect_exe = os.find_abs_path_of_executable('expect') or { - eprintln('skipping test, since expect is missing') - exit(0) - } - // Directory that contains the Expect scripts used in the test. - expect_tests_path = os.join_path(@VMODROOT, 'examples', 'readline', 'tests') -) +// Expect has to be installed for the test. +const expect_exe = os.find_abs_path_of_executable('expect') or { + eprintln('skipping test, since expect is missing') + exit(0) +} +// Directory that contains the Expect scripts used in the test. +const expect_tests_path = os.join_path(@VMODROOT, 'examples', 'readline', 'tests') fn test_password_input() { correct := os.execute(os.join_path(expect_tests_path, 'readline.expect')) diff --git a/examples/snek/snek.js.v b/examples/snek/snek.js.v index 22aa1b4e33..a57011849f 100644 --- a/examples/snek/snek.js.v +++ b/examples/snek/snek.js.v @@ -5,13 +5,11 @@ import time import rand // constants -const ( - top_height = 100 - canvas_size = 700 - game_size = 17 - tile_size = canvas_size / game_size - tick_rate_ms = 100 -) +const top_height = 100 +const canvas_size = 700 +const game_size = 17 +const tile_size = canvas_size / game_size +const tick_rate_ms = 100 // types struct Pos { diff --git a/examples/snek/snek.v b/examples/snek/snek.v index f624f57047..9f189db72f 100644 --- a/examples/snek/snek.v +++ b/examples/snek/snek.v @@ -6,13 +6,11 @@ import time import rand // constants -const ( - top_height = 100 - canvas_size = 700 - game_size = 17 - tile_size = canvas_size / game_size - tick_rate_ms = 100 -) +const top_height = 100 +const canvas_size = 700 +const game_size = 17 +const tile_size = canvas_size / game_size +const tick_rate_ms = 100 const high_score_file_path = os.join_path(os.cache_dir(), 'v', 'examples', 'snek') diff --git a/examples/sokol/01_cubes/cube.v b/examples/sokol/01_cubes/cube.v index 2f7284c787..663d28aa9b 100644 --- a/examples/sokol/01_cubes/cube.v +++ b/examples/sokol/01_cubes/cube.v @@ -17,11 +17,9 @@ import sokol.sapp import sokol.gfx import sokol.sgl -const ( - win_width = 800 - win_height = 800 - bg_color = gx.white -) +const win_width = 800 +const win_height = 800 +const bg_color = gx.white struct App { mut: diff --git a/examples/sokol/02_cubes_glsl/cube_glsl.v b/examples/sokol/02_cubes_glsl/cube_glsl.v index 796ef8d688..0ca6fd8978 100644 --- a/examples/sokol/02_cubes_glsl/cube_glsl.v +++ b/examples/sokol/02_cubes_glsl/cube_glsl.v @@ -28,11 +28,9 @@ import gg.m4 fn C.cube_shader_desc(gfx.Backend) &gfx.ShaderDesc -const ( - win_width = 800 - win_height = 800 - bg_color = gx.white -) +const win_width = 800 +const win_height = 800 +const bg_color = gx.white struct App { mut: diff --git a/examples/sokol/03_march_tracing_glsl/rt_glsl.v b/examples/sokol/03_march_tracing_glsl/rt_glsl.v index 59014f5f55..cb65250bdb 100644 --- a/examples/sokol/03_march_tracing_glsl/rt_glsl.v +++ b/examples/sokol/03_march_tracing_glsl/rt_glsl.v @@ -29,11 +29,9 @@ import time fn C.rt_shader_desc(gfx.Backend) &gfx.ShaderDesc -const ( - win_width = 800 - win_height = 800 - bg_color = gx.white -) +const win_width = 800 +const win_height = 800 +const bg_color = gx.white struct App { mut: diff --git a/examples/sokol/04_multi_shader_glsl/rt_glsl.v b/examples/sokol/04_multi_shader_glsl/rt_glsl.v index bf7612cc85..3568b586d9 100644 --- a/examples/sokol/04_multi_shader_glsl/rt_glsl.v +++ b/examples/sokol/04_multi_shader_glsl/rt_glsl.v @@ -30,11 +30,9 @@ import time fn C.rt_march_shader_desc(gfx.Backend) &gfx.ShaderDesc fn C.rt_puppy_shader_desc(gfx.Backend) &gfx.ShaderDesc -const ( - win_width = 800 - win_height = 800 - bg_color = gx.white -) +const win_width = 800 +const win_height = 800 +const bg_color = gx.white struct App { mut: diff --git a/examples/sokol/05_instancing_glsl/rt_glsl.v b/examples/sokol/05_instancing_glsl/rt_glsl.v index c7eda3674a..826d2240ed 100644 --- a/examples/sokol/05_instancing_glsl/rt_glsl.v +++ b/examples/sokol/05_instancing_glsl/rt_glsl.v @@ -21,12 +21,10 @@ import sokol.gfx // import sokol.sgl import time -const ( - win_width = 800 - win_height = 800 - bg_color = gx.white - num_inst = 16384 -) +const win_width = 800 +const win_height = 800 +const bg_color = gx.white +const num_inst = 16384 struct App { mut: diff --git a/examples/sokol/06_obj_viewer/show_obj.v b/examples/sokol/06_obj_viewer/show_obj.v index 33276b0d71..205a8f5ff3 100644 --- a/examples/sokol/06_obj_viewer/show_obj.v +++ b/examples/sokol/06_obj_viewer/show_obj.v @@ -37,11 +37,9 @@ import obj fn C.gouraud_shader_desc(gfx.Backend) &gfx.ShaderDesc -const ( - win_width = 600 - win_height = 600 - bg_color = gx.white -) +const win_width = 600 +const win_height = 600 +const bg_color = gx.white struct App { mut: diff --git a/examples/sokol/drawing.v b/examples/sokol/drawing.v index 02d0f47442..1cd8238874 100644 --- a/examples/sokol/drawing.v +++ b/examples/sokol/drawing.v @@ -7,9 +7,7 @@ struct AppState { pass_action gfx.PassAction } -const ( - used_import = sokol.used_import -) +const used_import = sokol.used_import fn main() { state := &AppState{ diff --git a/examples/sokol/freetype_raven.v b/examples/sokol/freetype_raven.v index 9669b152ea..a739394f31 100644 --- a/examples/sokol/freetype_raven.v +++ b/examples/sokol/freetype_raven.v @@ -6,8 +6,7 @@ import fontstash import sokol.sfons import os -const ( - text = ' +const text = ' Once upon a midnight dreary, while I pondered, weak and weary, Over many a quaint and curious volume of forgotten lore— While I nodded, nearly napping, suddenly there came a tapping, @@ -50,8 +49,8 @@ Soon again I heard a tapping somewhat louder than before. Let my heart be still a moment and this mystery explore;— ’Tis the wind and nothing more!” ' - lines = text.split('\n') -) + +const lines = text.split('\n') struct AppState { mut: @@ -114,9 +113,7 @@ fn frame(mut state AppState) { gfx.commit() } -const ( - black = sfons.rgba(0, 0, 0, 255) -) +const black = sfons.rgba(0, 0, 0, 255) fn (mut state AppState) render_font() { lh := 30 diff --git a/examples/sokol/particles/modules/particle/particle.v b/examples/sokol/particles/modules/particle/particle.v index 307b80f0c5..b2f7439efb 100644 --- a/examples/sokol/particles/modules/particle/particle.v +++ b/examples/sokol/particles/modules/particle/particle.v @@ -5,10 +5,8 @@ module particle import math.vec import sokol.sgl -const ( - default_life_time = 1000 - default_v_color = Color{93, 136, 193, 255} -) +const default_life_time = 1000 +const default_v_color = Color{93, 136, 193, 255} // * Module public pub fn new(location vec.Vec2[f64]) &Particle { diff --git a/examples/sokol/particles/particles.v b/examples/sokol/particles/particles.v index d12e823729..d5a1a7fed8 100644 --- a/examples/sokol/particles/particles.v +++ b/examples/sokol/particles/particles.v @@ -9,9 +9,7 @@ import sokol.gfx import sokol.sgl import particle -const ( - used_import = sokol.used_import -) +const used_import = sokol.used_import fn main() { mut app := &App{ diff --git a/examples/sokol/sounds/simple_sin_tones.v b/examples/sokol/sounds/simple_sin_tones.v index fef5604eef..edb3069d30 100644 --- a/examples/sokol/sounds/simple_sin_tones.v +++ b/examples/sokol/sounds/simple_sin_tones.v @@ -2,10 +2,8 @@ import time import math import sokol.audio -const ( - sw = time.new_stopwatch() - sw_start_ms = sw.elapsed().milliseconds() -) +const sw = time.new_stopwatch() +const sw_start_ms = sw.elapsed().milliseconds() @[inline] fn sintone(periods int, frame int, num_frames int) f32 { diff --git a/examples/term.ui/cursor_chaser.v b/examples/term.ui/cursor_chaser.v index 6cf4b9ecba..59a95b68fc 100644 --- a/examples/term.ui/cursor_chaser.v +++ b/examples/term.ui/cursor_chaser.v @@ -1,15 +1,13 @@ import term.ui as tui -const ( - colors = [ - tui.Color{33, 150, 243}, - tui.Color{0, 150, 136}, - tui.Color{205, 220, 57}, - tui.Color{255, 152, 0}, - tui.Color{244, 67, 54}, - tui.Color{156, 39, 176}, - ] -) +const colors = [ + tui.Color{33, 150, 243}, + tui.Color{0, 150, 136}, + tui.Color{205, 220, 57}, + tui.Color{255, 152, 0}, + tui.Color{244, 67, 54}, + tui.Color{156, 39, 176}, +] struct Point { x int diff --git a/examples/term.ui/pong.v b/examples/term.ui/pong.v index e5327e38ac..6cdbbcc92b 100644 --- a/examples/term.ui/pong.v +++ b/examples/term.ui/pong.v @@ -9,12 +9,12 @@ enum Mode { game } -const ( - player_one = 1 // Human control this racket - player_two = 0 // Take over this AI controller - white = ui.Color{255, 255, 255} - orange = ui.Color{255, 140, 0} -) +const player_one = 1 // Human control this racket + +const player_two = 0 // Take over this AI controller + +const white = ui.Color{255, 255, 255} +const orange = ui.Color{255, 140, 0} @[heap] struct App { diff --git a/examples/term.ui/term_drawing.v b/examples/term.ui/term_drawing.v index 08fa72f252..7c86e7af3b 100644 --- a/examples/term.ui/term_drawing.v +++ b/examples/term.ui/term_drawing.v @@ -6,87 +6,84 @@ module main import term.ui // The color palette, taken from Google's Material design -const ( - colors = [ - [ - ui.Color{239, 154, 154}, - ui.Color{244, 143, 177}, - ui.Color{206, 147, 216}, - ui.Color{179, 157, 219}, - ui.Color{159, 168, 218}, - ui.Color{144, 202, 249}, - ui.Color{129, 212, 250}, - ui.Color{128, 222, 234}, - ui.Color{128, 203, 196}, - ui.Color{165, 214, 167}, - ui.Color{197, 225, 165}, - ui.Color{230, 238, 156}, - ui.Color{255, 245, 157}, - ui.Color{255, 224, 130}, - ui.Color{255, 204, 128}, - ui.Color{255, 171, 145}, - ui.Color{188, 170, 164}, - ui.Color{238, 238, 238}, - ui.Color{176, 190, 197}, - ], - [ - ui.Color{244, 67, 54}, - ui.Color{233, 30, 99}, - ui.Color{156, 39, 176}, - ui.Color{103, 58, 183}, - ui.Color{63, 81, 181}, - ui.Color{33, 150, 243}, - ui.Color{3, 169, 244}, - ui.Color{0, 188, 212}, - ui.Color{0, 150, 136}, - ui.Color{76, 175, 80}, - ui.Color{139, 195, 74}, - ui.Color{205, 220, 57}, - ui.Color{255, 235, 59}, - ui.Color{255, 193, 7}, - ui.Color{255, 152, 0}, - ui.Color{255, 87, 34}, - ui.Color{121, 85, 72}, - ui.Color{120, 120, 120}, - ui.Color{96, 125, 139}, - ], - [ - ui.Color{198, 40, 40}, - ui.Color{173, 20, 87}, - ui.Color{106, 27, 154}, - ui.Color{69, 39, 160}, - ui.Color{40, 53, 147}, - ui.Color{21, 101, 192}, - ui.Color{2, 119, 189}, - ui.Color{0, 131, 143}, - ui.Color{0, 105, 92}, - ui.Color{46, 125, 50}, - ui.Color{85, 139, 47}, - ui.Color{158, 157, 36}, - ui.Color{249, 168, 37}, - ui.Color{255, 143, 0}, - ui.Color{239, 108, 0}, - ui.Color{216, 67, 21}, - ui.Color{78, 52, 46}, - ui.Color{33, 33, 33}, - ui.Color{55, 71, 79}, - ], - ] -) +const colors = [ + [ + ui.Color{239, 154, 154}, + ui.Color{244, 143, 177}, + ui.Color{206, 147, 216}, + ui.Color{179, 157, 219}, + ui.Color{159, 168, 218}, + ui.Color{144, 202, 249}, + ui.Color{129, 212, 250}, + ui.Color{128, 222, 234}, + ui.Color{128, 203, 196}, + ui.Color{165, 214, 167}, + ui.Color{197, 225, 165}, + ui.Color{230, 238, 156}, + ui.Color{255, 245, 157}, + ui.Color{255, 224, 130}, + ui.Color{255, 204, 128}, + ui.Color{255, 171, 145}, + ui.Color{188, 170, 164}, + ui.Color{238, 238, 238}, + ui.Color{176, 190, 197}, + ], + [ + ui.Color{244, 67, 54}, + ui.Color{233, 30, 99}, + ui.Color{156, 39, 176}, + ui.Color{103, 58, 183}, + ui.Color{63, 81, 181}, + ui.Color{33, 150, 243}, + ui.Color{3, 169, 244}, + ui.Color{0, 188, 212}, + ui.Color{0, 150, 136}, + ui.Color{76, 175, 80}, + ui.Color{139, 195, 74}, + ui.Color{205, 220, 57}, + ui.Color{255, 235, 59}, + ui.Color{255, 193, 7}, + ui.Color{255, 152, 0}, + ui.Color{255, 87, 34}, + ui.Color{121, 85, 72}, + ui.Color{120, 120, 120}, + ui.Color{96, 125, 139}, + ], + [ + ui.Color{198, 40, 40}, + ui.Color{173, 20, 87}, + ui.Color{106, 27, 154}, + ui.Color{69, 39, 160}, + ui.Color{40, 53, 147}, + ui.Color{21, 101, 192}, + ui.Color{2, 119, 189}, + ui.Color{0, 131, 143}, + ui.Color{0, 105, 92}, + ui.Color{46, 125, 50}, + ui.Color{85, 139, 47}, + ui.Color{158, 157, 36}, + ui.Color{249, 168, 37}, + ui.Color{255, 143, 0}, + ui.Color{239, 108, 0}, + ui.Color{216, 67, 21}, + ui.Color{78, 52, 46}, + ui.Color{33, 33, 33}, + ui.Color{55, 71, 79}, + ], +] -const ( - frame_rate = 30 // fps - msg_display_time = 5 * frame_rate - w = 200 - h = 100 - space = ' ' - spaces = ' ' - select_color = 'Select color: ' - select_size = 'Size: + -' - help_1 = '╭────────╮' - help_2 = '│ HELP │' - help_3 = '╰────────╯' -) +const frame_rate = 30 // fps + +const msg_display_time = 5 * frame_rate +const w = 200 +const h = 100 +const space = ' ' +const spaces = ' ' +const select_color = 'Select color: ' +const select_size = 'Size: + -' +const help_1 = '╭────────╮' +const help_2 = '│ HELP │' +const help_3 = '╰────────╯' struct App { mut: diff --git a/examples/term.ui/text_editor.v b/examples/term.ui/text_editor.v index 89c1985817..4fcfb03d89 100644 --- a/examples/term.ui/text_editor.v +++ b/examples/term.ui/text_editor.v @@ -9,34 +9,32 @@ import term.ui as tui import encoding.utf8 import encoding.utf8.east_asian -const ( - rune_digits = [`0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`] +const rune_digits = [`0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`] - zero_width_unicode = [ - `\u034f`, // U+034F COMBINING GRAPHEME JOINER - `\u061c`, // U+061C ARABIC LETTER MARK - `\u17b4`, // U+17B4 KHMER VOWEL INHERENT AQ - `\u17b5`, // U+17B5 KHMER VOWEL INHERENT AA - `\u200a`, // U+200A HAIR SPACE - `\u200b`, // U+200B ZERO WIDTH SPACE - `\u200c`, // U+200C ZERO WIDTH NON-JOINER - `\u200d`, // U+200D ZERO WIDTH JOINER - `\u200e`, // U+200E LEFT-TO-RIGHT MARK - `\u200f`, // U+200F RIGHT-TO-LEFT MARK - `\u2060`, // U+2060 WORD JOINER - `\u2061`, // U+2061 FUNCTION APPLICATION - `\u2062`, // U+2062 INVISIBLE TIMES - `\u2063`, // U+2063 INVISIBLE SEPARATOR - `\u2064`, // U+2064 INVISIBLE PLUS - `\u206a`, // U+206A INHIBIT SYMMETRIC SWAPPING - `\u206b`, // U+206B ACTIVATE SYMMETRIC SWAPPING - `\u206c`, // U+206C INHIBIT ARABIC FORM SHAPING - `\u206d`, // U+206D ACTIVATE ARABIC FORM SHAPING - `\u206e`, // U+206E NATIONAL DIGIT SHAPES - `\u206f`, // U+206F NOMINAL DIGIT SHAPES - `\ufeff`, // U+FEFF ZERO WIDTH NO-BREAK SPACE - ] -) +const zero_width_unicode = [ + `\u034f`, // U+034F COMBINING GRAPHEME JOINER + `\u061c`, // U+061C ARABIC LETTER MARK + `\u17b4`, // U+17B4 KHMER VOWEL INHERENT AQ + `\u17b5`, // U+17B5 KHMER VOWEL INHERENT AA + `\u200a`, // U+200A HAIR SPACE + `\u200b`, // U+200B ZERO WIDTH SPACE + `\u200c`, // U+200C ZERO WIDTH NON-JOINER + `\u200d`, // U+200D ZERO WIDTH JOINER + `\u200e`, // U+200E LEFT-TO-RIGHT MARK + `\u200f`, // U+200F RIGHT-TO-LEFT MARK + `\u2060`, // U+2060 WORD JOINER + `\u2061`, // U+2061 FUNCTION APPLICATION + `\u2062`, // U+2062 INVISIBLE TIMES + `\u2063`, // U+2063 INVISIBLE SEPARATOR + `\u2064`, // U+2064 INVISIBLE PLUS + `\u206a`, // U+206A INHIBIT SYMMETRIC SWAPPING + `\u206b`, // U+206B ACTIVATE SYMMETRIC SWAPPING + `\u206c`, // U+206C INHIBIT ARABIC FORM SHAPING + `\u206d`, // U+206D ACTIVATE ARABIC FORM SHAPING + `\u206e`, // U+206E NATIONAL DIGIT SHAPES + `\u206f`, // U+206F NOMINAL DIGIT SHAPES + `\ufeff`, // U+FEFF ZERO WIDTH NO-BREAK SPACE +] enum Movement { up diff --git a/examples/term.ui/vyper.v b/examples/term.ui/vyper.v index 68594496d6..6464a34796 100644 --- a/examples/term.ui/vyper.v +++ b/examples/term.ui/vyper.v @@ -3,16 +3,14 @@ import term.ui as termui import rand // define some global constants -const ( - block_size = 1 - buffer = 10 - green = termui.Color{0, 255, 0} - grey = termui.Color{150, 150, 150} - white = termui.Color{255, 255, 255} - blue = termui.Color{0, 0, 255} - red = termui.Color{255, 0, 0} - black = termui.Color{0, 0, 0} -) +const block_size = 1 +const buffer = 10 +const green = termui.Color{0, 255, 0} +const grey = termui.Color{150, 150, 150} +const white = termui.Color{255, 255, 255} +const blue = termui.Color{0, 0, 255} +const red = termui.Color{255, 0, 0} +const black = termui.Color{0, 0, 0} // what edge of the screen are you facing enum Orientation { diff --git a/examples/tetris/tetris.js.v b/examples/tetris/tetris.js.v index 9e0fd50aac..b7e681cd90 100644 --- a/examples/tetris/tetris.js.v +++ b/examples/tetris/tetris.js.v @@ -9,62 +9,59 @@ import gx import gg // import sokol.sapp -const ( - block_size = 20 // virtual pixels - field_height = 20 // # of blocks - field_width = 10 - tetro_size = 4 - win_width = block_size * field_width - win_height = block_size * field_height - timer_period = 250 // ms - text_size = 24 - limit_thickness = 3 -) +const block_size = 20 // virtual pixels -const ( - text_cfg = gx.TextCfg{ - align: .left - size: text_size - color: gx.rgb(0, 0, 0) - } - over_cfg = gx.TextCfg{ - align: .left - size: text_size - color: gx.white - } -) +const field_height = 20 // # of blocks -const ( - // Tetros' 4 possible states are encoded in binaries - // 0000 0 0000 0 0000 0 0000 0 0000 0 0000 0 - // 0000 0 0000 0 0000 0 0000 0 0011 3 0011 3 - // 0110 6 0010 2 0011 3 0110 6 0001 1 0010 2 - // 0110 6 0111 7 0110 6 0011 3 0001 1 0010 2 - // There is a special case 1111, since 15 can't be used. - b_tetros = [ - [66, 66, 66, 66], - [27, 131, 72, 232], - [36, 231, 36, 231], - [63, 132, 63, 132], - [311, 17, 223, 74], - [322, 71, 113, 47], - [1111, 9, 1111, 9], - ] - // Each tetro has its unique color - colors = [ - gx.rgb(0, 0, 0), // unused ? - gx.rgb(255, 242, 0), // yellow quad - gx.rgb(174, 0, 255), // purple triple - gx.rgb(60, 255, 0), // green short topright - gx.rgb(255, 0, 0), // red short topleft - gx.rgb(255, 180, 31), // orange long topleft - gx.rgb(33, 66, 255), // blue long topright - gx.rgb(74, 198, 255), // lightblue longest - gx.rgb(0, 170, 170), - ] - background_color = gx.white - ui_color = gx.rgba(255, 0, 0, 210) -) +const field_width = 10 +const tetro_size = 4 +const win_width = block_size * field_width +const win_height = block_size * field_height +const timer_period = 250 // ms + +const text_size = 24 +const limit_thickness = 3 + +const text_cfg = gx.TextCfg{ + align: .left + size: text_size + color: gx.rgb(0, 0, 0) +} +const over_cfg = gx.TextCfg{ + align: .left + size: text_size + color: gx.white +} + +// Tetros' 4 possible states are encoded in binaries +// 0000 0 0000 0 0000 0 0000 0 0000 0 0000 0 +// 0000 0 0000 0 0000 0 0000 0 0011 3 0011 3 +// 0110 6 0010 2 0011 3 0110 6 0001 1 0010 2 +// 0110 6 0111 7 0110 6 0011 3 0001 1 0010 2 +// There is a special case 1111, since 15 can't be used. +const b_tetros = [ + [66, 66, 66, 66], + [27, 131, 72, 232], + [36, 231, 36, 231], + [63, 132, 63, 132], + [311, 17, 223, 74], + [322, 71, 113, 47], + [1111, 9, 1111, 9], +] +// Each tetro has its unique color +const colors = [ + gx.rgb(0, 0, 0), // unused ? + gx.rgb(255, 242, 0), // yellow quad + gx.rgb(174, 0, 255), // purple triple + gx.rgb(60, 255, 0), // green short topright + gx.rgb(255, 0, 0), // red short topleft + gx.rgb(255, 180, 31), // orange long topleft + gx.rgb(33, 66, 255), // blue long topright + gx.rgb(74, 198, 255), // lightblue longest + gx.rgb(0, 170, 170), +] +const background_color = gx.white +const ui_color = gx.rgba(255, 0, 0, 210) // TODO: type Tetro [tetro_size]struct{ x, y int } struct Block { diff --git a/examples/tetris/tetris.v b/examples/tetris/tetris.v index 26c2d8e3d8..e3f5f8c90b 100644 --- a/examples/tetris/tetris.v +++ b/examples/tetris/tetris.v @@ -10,62 +10,59 @@ import gx import gg // import sokol.sapp -const ( - block_size = 20 // virtual pixels - field_height = 20 // # of blocks - field_width = 10 - tetro_size = 4 - win_width = block_size * field_width - win_height = block_size * field_height - timer_period = 250 // ms - text_size = 24 - limit_thickness = 3 -) +const block_size = 20 // virtual pixels -const ( - text_cfg = gx.TextCfg{ - align: .left - size: text_size - color: gx.rgb(0, 0, 0) - } - over_cfg = gx.TextCfg{ - align: .left - size: text_size - color: gx.white - } -) +const field_height = 20 // # of blocks -const ( - // Tetros' 4 possible states are encoded in binaries - // 0000 0 0000 0 0000 0 0000 0 0000 0 0000 0 - // 0000 0 0000 0 0000 0 0000 0 0011 3 0011 3 - // 0110 6 0010 2 0011 3 0110 6 0001 1 0010 2 - // 0110 6 0111 7 0110 6 0011 3 0001 1 0010 2 - // There is a special case 1111, since 15 can't be used. - b_tetros = [ - [66, 66, 66, 66], - [27, 131, 72, 232], - [36, 231, 36, 231], - [63, 132, 63, 132], - [311, 17, 223, 74], - [322, 71, 113, 47], - [1111, 9, 1111, 9], - ] - // Each tetro has its unique color - colors = [ - gx.rgb(0, 0, 0), // unused ? - gx.rgb(255, 242, 0), // yellow quad - gx.rgb(174, 0, 255), // purple triple - gx.rgb(60, 255, 0), // green short topright - gx.rgb(255, 0, 0), // red short topleft - gx.rgb(255, 180, 31), // orange long topleft - gx.rgb(33, 66, 255), // blue long topright - gx.rgb(74, 198, 255), // lightblue longest - gx.rgb(0, 170, 170), - ] - background_color = gx.white - ui_color = gx.rgba(255, 0, 0, 210) -) +const field_width = 10 +const tetro_size = 4 +const win_width = block_size * field_width +const win_height = block_size * field_height +const timer_period = 250 // ms + +const text_size = 24 +const limit_thickness = 3 + +const text_cfg = gx.TextCfg{ + align: .left + size: text_size + color: gx.rgb(0, 0, 0) +} +const over_cfg = gx.TextCfg{ + align: .left + size: text_size + color: gx.white +} + +// Tetros' 4 possible states are encoded in binaries +// 0000 0 0000 0 0000 0 0000 0 0000 0 0000 0 +// 0000 0 0000 0 0000 0 0000 0 0011 3 0011 3 +// 0110 6 0010 2 0011 3 0110 6 0001 1 0010 2 +// 0110 6 0111 7 0110 6 0011 3 0001 1 0010 2 +// There is a special case 1111, since 15 can't be used. +const b_tetros = [ + [66, 66, 66, 66], + [27, 131, 72, 232], + [36, 231, 36, 231], + [63, 132, 63, 132], + [311, 17, 223, 74], + [322, 71, 113, 47], + [1111, 9, 1111, 9], +] +// Each tetro has its unique color +const colors = [ + gx.rgb(0, 0, 0), // unused ? + gx.rgb(255, 242, 0), // yellow quad + gx.rgb(174, 0, 255), // purple triple + gx.rgb(60, 255, 0), // green short topright + gx.rgb(255, 0, 0), // red short topleft + gx.rgb(255, 180, 31), // orange long topleft + gx.rgb(33, 66, 255), // blue long topright + gx.rgb(74, 198, 255), // lightblue longest + gx.rgb(0, 170, 170), +] +const background_color = gx.white +const ui_color = gx.rgba(255, 0, 0, 210) // TODO: type Tetro [tetro_size]struct{ x, y int } struct Block { diff --git a/examples/ttf_font/example_ttf.v b/examples/ttf_font/example_ttf.v index 20f1d70e26..35d3400191 100644 --- a/examples/ttf_font/example_ttf.v +++ b/examples/ttf_font/example_ttf.v @@ -7,15 +7,13 @@ import x.ttf import os // import math -const ( - win_width = 600 - win_height = 700 - bg_color = gx.white - font_paths = [ - os.resource_abs_path(os.join_path('..', 'assets', 'fonts', 'Imprima-Regular.ttf')), - os.resource_abs_path(os.join_path('..', 'assets', 'fonts', 'Graduate-Regular.ttf')), - ] -) +const win_width = 600 +const win_height = 700 +const bg_color = gx.white +const font_paths = [ + os.resource_abs_path(os.join_path('..', 'assets', 'fonts', 'Imprima-Regular.ttf')), + os.resource_abs_path(os.join_path('..', 'assets', 'fonts', 'Graduate-Regular.ttf')), +] // UI struct App_data { diff --git a/examples/vcasino/vcasino.v b/examples/vcasino/vcasino.v index 53394e2aa9..abde74c147 100644 --- a/examples/vcasino/vcasino.v +++ b/examples/vcasino/vcasino.v @@ -1,16 +1,16 @@ import rand import os -const ( - help_text = ' Usage:\t./VCasino\n +const help_text = ' Usage:\t./VCasino\n Description:\n VCasino is a little game only made to learn V.\n' - g_desc = " The object of Roulette is to pick the number where the spinning ball will land on the wheel. + +const g_desc = " The object of Roulette is to pick the number where the spinning ball will land on the wheel. If your number is the good one, you'll get your bet x3. If your number is the same color as the ball one, you'll get your bet /2. Otherwise, you will lose your bet.\n" - odd = 'red' - even = 'black' -) + +const odd = 'red' +const even = 'black' struct Options { long_opt string diff --git a/examples/viewer/view.v b/examples/viewer/view.v index 1b53c0af15..d9f6f66640 100644 --- a/examples/viewer/view.v +++ b/examples/viewer/view.v @@ -20,36 +20,32 @@ import szip import strings // Help text -const ( - help_text_rows = [ - 'Image Viewer 0.9 help.', - '', - 'ESC/q - Quit', - 'cur. right - Next image', - 'cur. left - Previous image', - 'cur. up - Next folder', - 'cur. down - Previous folder', - 'F - Toggle full screen', - 'R - Rotate image of 90 degree', - 'I - Toggle the info text', - '', - 'mouse wheel - next/previous images', - 'keep pressed left Mouse button - Pan on the image', - 'keep pressed right Mouse button - Zoom on the image', - ] -) +const help_text_rows = [ + 'Image Viewer 0.9 help.', + '', + 'ESC/q - Quit', + 'cur. right - Next image', + 'cur. left - Previous image', + 'cur. up - Next folder', + 'cur. down - Previous folder', + 'F - Toggle full screen', + 'R - Rotate image of 90 degree', + 'I - Toggle the info text', + '', + 'mouse wheel - next/previous images', + 'keep pressed left Mouse button - Pan on the image', + 'keep pressed right Mouse button - Zoom on the image', +] -const ( - win_width = 800 - win_height = 800 - bg_color = gx.black - pi_2 = 3.14159265359 / 2.0 - uv = [f32(0), 0, 1, 0, 1, 1, 0, 1]! // used for zoom icon during rotations +const win_width = 800 +const win_height = 800 +const bg_color = gx.black +const pi_2 = 3.14159265359 / 2.0 +const uv = [f32(0), 0, 1, 0, 1, 1, 0, 1]! // used for zoom icon during rotations - text_drop_files = 'Drop here some images/folder/zip to navigate in the pics' - text_scanning = 'Scanning...' - text_loading = 'Loading...' -) +const text_drop_files = 'Drop here some images/folder/zip to navigate in the pics' +const text_scanning = 'Scanning...' +const text_loading = 'Loading...' enum Viewer_state { loading diff --git a/examples/vweb/middleware/vweb_example.v b/examples/vweb/middleware/vweb_example.v index d2585b190f..9dcadbb3ec 100644 --- a/examples/vweb/middleware/vweb_example.v +++ b/examples/vweb/middleware/vweb_example.v @@ -3,9 +3,7 @@ module main import vweb // for another example see vlib/vweb/tests/middleware_test_server.v -const ( - http_port = 8080 -) +const http_port = 8080 struct App { vweb.Context diff --git a/examples/vweb/vweb_assets/vweb_assets.v b/examples/vweb/vweb_assets/vweb_assets.v index 93493d9dae..43503dfe6d 100644 --- a/examples/vweb/vweb_assets/vweb_assets.v +++ b/examples/vweb/vweb_assets/vweb_assets.v @@ -5,9 +5,7 @@ import vweb // import vweb.assets import time -const ( - port = 8081 -) +const port = 8081 struct App { vweb.Context diff --git a/examples/vweb_fullstack/src/main.v b/examples/vweb_fullstack/src/main.v index 45ed4b148d..0e036c8637 100644 --- a/examples/vweb_fullstack/src/main.v +++ b/examples/vweb_fullstack/src/main.v @@ -4,9 +4,7 @@ import vweb import databases import os -const ( - port = 8082 -) +const port = 8082 struct App { vweb.Context diff --git a/examples/vweb_orm_jwt/src/main.v b/examples/vweb_orm_jwt/src/main.v index 0f4071a63d..a2685b5de9 100644 --- a/examples/vweb_orm_jwt/src/main.v +++ b/examples/vweb_orm_jwt/src/main.v @@ -3,9 +3,7 @@ module main import vweb import databases -const ( - http_port = 8081 -) +const http_port = 8081 struct App { vweb.Context diff --git a/vlib/benchmark/benchmark.v b/vlib/benchmark/benchmark.v index a8cd2f40ea..c5c36114e0 100644 --- a/vlib/benchmark/benchmark.v +++ b/vlib/benchmark/benchmark.v @@ -3,12 +3,10 @@ module benchmark import time import term -pub const ( - b_ok = term.ok_message('OK ') - b_fail = term.fail_message('FAIL') - b_skip = term.warn_message('SKIP') - b_spent = term.ok_message('SPENT') -) +pub const b_ok = term.ok_message('OK ') +pub const b_fail = term.fail_message('FAIL') +pub const b_skip = term.warn_message('SKIP') +pub const b_spent = term.ok_message('SPENT') pub struct Benchmark { pub mut: diff --git a/vlib/bitfield/bitfield.v b/vlib/bitfield/bitfield.v index 34ea95fc41..d6a5d08855 100644 --- a/vlib/bitfield/bitfield.v +++ b/vlib/bitfield/bitfield.v @@ -20,9 +20,7 @@ mut: } // helper functions -const ( - slot_size = 32 -) +const slot_size = 32 // from_bytes converts a byte array into a bitfield. // [0x0F, 0x01] => 0000 1111 0000 0001 diff --git a/vlib/builtin/array_test.v b/vlib/builtin/array_test.v index 763a401c80..49dbd8973c 100644 --- a/vlib/builtin/array_test.v +++ b/vlib/builtin/array_test.v @@ -352,9 +352,7 @@ fn test_reverse() { assert f.len == 0 } -const ( - c_n = 5 -) +const c_n = 5 struct Foooj { a [5]int // c_n @@ -1288,12 +1286,10 @@ fn test_push_arr_string_free() { assert lines[1] == 'ab' } -const ( - grid_size_1 = 2 - grid_size_2 = 3 - grid_size_3 = 4 - cell_value = 123 -) +const grid_size_1 = 2 +const grid_size_2 = 3 +const grid_size_3 = 4 +const cell_value = 123 fn test_multidimensional_array_initialization_with_consts() { mut data := [][][]int{len: grid_size_1, init: [][]int{len: grid_size_2, init: []int{len: grid_size_3, init: cell_value}}} diff --git a/vlib/builtin/backtraces_windows.c.v b/vlib/builtin/backtraces_windows.c.v index 0d7bc7402b..f674d1baa0 100644 --- a/vlib/builtin/backtraces_windows.c.v +++ b/vlib/builtin/backtraces_windows.c.v @@ -53,15 +53,13 @@ fn C.SymFromAddr(h_process voidptr, address u64, p_displacement voidptr, p_symbo fn C.SymGetLineFromAddr64(h_process voidptr, address u64, p_displacement voidptr, p_line &Line64) int // Ref - https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symsetoptions -const ( - symopt_undname = 0x00000002 - symopt_deferred_loads = 0x00000004 - symopt_no_cpp = 0x00000008 - symopt_load_lines = 0x00000010 - symopt_include_32bit_modules = 0x00002000 - symopt_allow_zero_address = 0x01000000 - symopt_debug = u32(0x80000000) -) +const symopt_undname = 0x00000002 +const symopt_deferred_loads = 0x00000004 +const symopt_no_cpp = 0x00000008 +const symopt_load_lines = 0x00000010 +const symopt_include_32bit_modules = 0x00002000 +const symopt_allow_zero_address = 0x01000000 +const symopt_debug = u32(0x80000000) fn print_backtrace_skipping_top_frames(skipframes int) bool { $if msvc { diff --git a/vlib/builtin/builtin_windows.c.v b/vlib/builtin/builtin_windows.c.v index 6177c8d68f..2b03559424 100644 --- a/vlib/builtin/builtin_windows.c.v +++ b/vlib/builtin/builtin_windows.c.v @@ -41,13 +41,11 @@ fn is_terminal(fd int) int { return int(mode) } -const ( - std_output_handle = -11 - std_error_handle = -12 - enable_processed_output = 1 - enable_wrap_at_eol_output = 2 - evable_virtual_terminal_processing = 4 -) +const std_output_handle = -11 +const std_error_handle = -12 +const enable_processed_output = 1 +const enable_wrap_at_eol_output = 2 +const evable_virtual_terminal_processing = 4 fn builtin_init() { g_original_codepage = C.GetConsoleOutputCP() @@ -136,14 +134,12 @@ fn break_if_debugger_attached() { } } -const ( - format_message_allocate_buffer = 0x00000100 - format_message_argument_array = 0x00002000 - format_message_from_hmodule = 0x00000800 - format_message_from_string = 0x00000400 - format_message_from_system = 0x00001000 - format_message_ignore_inserts = 0x00000200 -) +const format_message_allocate_buffer = 0x00000100 +const format_message_argument_array = 0x00002000 +const format_message_from_hmodule = 0x00000800 +const format_message_from_string = 0x00000400 +const format_message_from_system = 0x00001000 +const format_message_ignore_inserts = 0x00000200 // return an error message generated from WinAPI's `LastError` pub fn winapi_lasterr_str() string { diff --git a/vlib/builtin/int.v b/vlib/builtin/int.v index ac6a4933a9..1ac88311e7 100644 --- a/vlib/builtin/int.v +++ b/vlib/builtin/int.v @@ -37,42 +37,38 @@ pub fn (cptr &char) str() string { return u64(cptr).hex() } -const ( - // digit pairs in reverse order - digit_pairs = '00102030405060708090011121314151617181910212223242526272829203132333435363738393041424344454647484940515253545556575859506162636465666768696071727374757677787970818283848586878889809192939495969798999' -) +// digit pairs in reverse order +const digit_pairs = '00102030405060708090011121314151617181910212223242526272829203132333435363738393041424344454647484940515253545556575859506162636465666768696071727374757677787970818283848586878889809192939495969798999' -pub const ( - min_i8 = i8(-128) - max_i8 = i8(127) +pub const min_i8 = i8(-128) +pub const max_i8 = i8(127) - min_i16 = i16(-32768) - max_i16 = i16(32767) +pub const min_i16 = i16(-32768) +pub const max_i16 = i16(32767) - min_i32 = i32(-2147483648) - max_i32 = i32(2147483647) +pub const min_i32 = i32(-2147483648) +pub const max_i32 = i32(2147483647) - min_int = min_i32 - max_int = max_i32 +pub const min_int = min_i32 +pub const max_int = max_i32 - // -9223372036854775808 is wrong, because C compilers parse literal values - // without sign first, and 9223372036854775808 overflows i64, hence the - // consecutive subtraction by 1 - min_i64 = i64(-9223372036854775807 - 1) - max_i64 = i64(9223372036854775807) +// -9223372036854775808 is wrong, because C compilers parse literal values +// without sign first, and 9223372036854775808 overflows i64, hence the +// consecutive subtraction by 1 +pub const min_i64 = i64(-9223372036854775807 - 1) +pub const max_i64 = i64(9223372036854775807) - min_u8 = u8(0) - max_u8 = u8(255) +pub const min_u8 = u8(0) +pub const max_u8 = u8(255) - min_u16 = u16(0) - max_u16 = u16(65535) +pub const min_u16 = u16(0) +pub const max_u16 = u16(65535) - min_u32 = u32(0) - max_u32 = u32(4294967295) +pub const min_u32 = u32(0) +pub const max_u32 = u32(4294967295) - min_u64 = u64(0) - max_u64 = u64(18446744073709551615) -) +pub const min_u64 = u64(0) +pub const max_u64 = u64(18446744073709551615) // This implementation is the quickest with gcc -O2 // str_l returns the string representation of the integer nn with max chars. diff --git a/vlib/builtin/int_test.v b/vlib/builtin/int_test.v index 633b698cbe..3fbf87b217 100644 --- a/vlib/builtin/int_test.v +++ b/vlib/builtin/int_test.v @@ -1,7 +1,5 @@ -const ( - a = 3 - u = u64(1) -) +const a = 3 +const u = u64(1) fn test_const() { b := (true && true) || false diff --git a/vlib/builtin/js/array_test.js.v b/vlib/builtin/js/array_test.js.v index 877cadc289..42de8a320c 100644 --- a/vlib/builtin/js/array_test.js.v +++ b/vlib/builtin/js/array_test.js.v @@ -343,9 +343,7 @@ fn test_reverse() { assert f.len == 0 } -const ( - c_n = 5 -) +const c_n = 5 struct Foooj { a [5]int // c_n @@ -1250,12 +1248,10 @@ fn test_push_arr_string_free() { assert lines[1] == 'ab' } -const ( - grid_size_1 = 2 - grid_size_2 = 3 - grid_size_3 = 4 - cell_value = 123 -) +const grid_size_1 = 2 +const grid_size_2 = 3 +const grid_size_3 = 4 +const cell_value = 123 fn test_multidimensional_array_initialization_with_consts() { mut data := [][][]int{len: grid_size_1, init: [][]int{len: grid_size_2, init: []int{len: grid_size_3, init: cell_value}}} diff --git a/vlib/builtin/js/int_test.js.v b/vlib/builtin/js/int_test.js.v index 73da7c6f42..643e0c2c2b 100644 --- a/vlib/builtin/js/int_test.js.v +++ b/vlib/builtin/js/int_test.js.v @@ -1,10 +1,8 @@ // vtest flaky: true // vtest retry: 3 -const ( - a = 3 - u = u64(1) -) +const a = 3 +const u = u64(1) fn test_const() { b := (true && true) || false diff --git a/vlib/builtin/linux_bare/linux_syscalls.v b/vlib/builtin/linux_bare/linux_syscalls.v index a82bff211a..f08098816f 100644 --- a/vlib/builtin/linux_bare/linux_syscalls.v +++ b/vlib/builtin/linux_bare/linux_syscalls.v @@ -194,17 +194,18 @@ Paraphrased from "man 2 waitid" on Linux CLD_CONTINUED (child continued by SIGCONT). */ -const ( - wp_sys_wnohang = u64(0x00000001) - wp_sys_wuntraced = u64(0x00000002) - wp_sys_wstopped = u64(0x00000002) - wp_sys_wexited = u64(0x00000004) - wp_sys_wcontinued = u64(0x00000008) - wp_sys_wnowait = u64(0x01000000) // don't reap, just poll status. - wp_sys___wnothread = u64(0x20000000) // don't wait on children of other threads in this group - wp_sys___wall = u64(0x40000000) // wait on all children, regardless of type - wp_sys___wclone = u64(0x80000000) // wait only on non-sigchld children -) +const wp_sys_wnohang = u64(0x00000001) +const wp_sys_wuntraced = u64(0x00000002) +const wp_sys_wstopped = u64(0x00000002) +const wp_sys_wexited = u64(0x00000004) +const wp_sys_wcontinued = u64(0x00000008) +const wp_sys_wnowait = u64(0x01000000) // don't reap, just poll status. + +const wp_sys___wnothread = u64(0x20000000) // don't wait on children of other threads in this group + +const wp_sys___wall = u64(0x40000000) // wait on all children, regardless of type + +const wp_sys___wclone = u64(0x80000000) // First argument to waitid: enum WiWhich { diff --git a/vlib/builtin/linux_bare/old/linuxsys_bare.v b/vlib/builtin/linux_bare/old/linuxsys_bare.v index 8f78e0faba..c9ba4d79bb 100644 --- a/vlib/builtin/linux_bare/old/linuxsys_bare.v +++ b/vlib/builtin/linux_bare/old/linuxsys_bare.v @@ -4,17 +4,18 @@ pub enum Linux_mem { page_size = 4096 } -pub const ( - wp_sys_wnohang = u64(0x00000001) - wp_sys_wuntraced = u64(0x00000002) - wp_sys_wstopped = u64(0x00000002) - wp_sys_wexited = u64(0x00000004) - wp_sys_wcontinued = u64(0x00000008) - wp_sys_wnowait = u64(0x01000000) // don't reap, just poll status. - wp_sys___wnothread = u64(0x20000000) // don't wait on children of other threads in this group - wp_sys___wall = u64(0x40000000) // wait on all children, regardless of type - wp_sys___wclone = u64(0x80000000) // wait only on non-sigchld children -) +pub const wp_sys_wnohang = u64(0x00000001) +pub const wp_sys_wuntraced = u64(0x00000002) +pub const wp_sys_wstopped = u64(0x00000002) +pub const wp_sys_wexited = u64(0x00000004) +pub const wp_sys_wcontinued = u64(0x00000008) +pub const wp_sys_wnowait = u64(0x01000000) // don't reap, just poll status. + +pub const wp_sys___wnothread = u64(0x20000000) // don't wait on children of other threads in this group + +pub const wp_sys___wall = u64(0x40000000) // wait on all children, regardless of type + +pub const wp_sys___wclone = u64(0x80000000) // First argument to waitid: pub enum Wi_which { @@ -107,64 +108,62 @@ pub enum Signo { sigsys = 31 } -pub const ( - fcntlf_dupfd = 0x00000000 - fcntlf_exlck = 0x00000004 - fcntlf_getfd = 0x00000001 - fcntlf_getfl = 0x00000003 - fcntlf_getlk = 0x00000005 - fcntlf_getlk64 = 0x0000000c - fcntlf_getown = 0x00000009 - fcntlf_getowner_uids = 0x00000011 - fcntlf_getown_ex = 0x00000010 - fcntlf_getsig = 0x0000000b - fcntlf_ofd_getlk = 0x00000024 - fcntlf_ofd_setlk = 0x00000025 - fcntlf_ofd_setlkw = 0x00000026 - fcntlf_owner_pgrp = 0x00000002 - fcntlf_owner_pid = 0x00000001 - fcntlf_owner_tid = 0x00000000 - fcntlf_rdlck = 0x00000000 - fcntlf_setfd = 0x00000002 - fcntlf_setfl = 0x00000004 - fcntlf_setlk = 0x00000006 - fcntlf_setlk64 = 0x0000000d - fcntlf_setlkw = 0x00000007 - fcntlf_setlkw64 = 0x0000000e - fcntlf_setown = 0x00000008 - fcntlf_setown_ex = 0x0000000f - fcntlf_setsig = 0x0000000a - fcntlf_shlck = 0x00000008 - fcntlf_unlck = 0x00000002 - fcntlf_wrlck = 0x00000001 - fcntllock_ex = 0x00000002 - fcntllock_mand = 0x00000020 - fcntllock_nb = 0x00000004 - fcntllock_read = 0x00000040 - fcntllock_rw = 0x000000c0 - fcntllock_sh = 0x00000001 - fcntllock_un = 0x00000008 - fcntllock_write = 0x00000080 - fcntlo_accmode = 0x00000003 - fcntlo_append = 0x00000400 - fcntlo_cloexec = 0x00080000 - fcntlo_creat = 0x00000040 - fcntlo_direct = 0x00004000 - fcntlo_directory = 0x00010000 - fcntlo_dsync = 0x00001000 - fcntlo_excl = 0x00000080 - fcntlo_largefile = 0x00008000 - fcntlo_ndelay = 0x00000800 - fcntlo_noatime = 0x00040000 - fcntlo_noctty = 0x00000100 - fcntlo_nofollow = 0x00020000 - fcntlo_nonblock = 0x00000800 - fcntlo_path = 0x00200000 - fcntlo_rdonly = 0x00000000 - fcntlo_rdwr = 0x00000002 - fcntlo_trunc = 0x00000200 - fcntlo_wronly = 0x00000001 -) +pub const fcntlf_dupfd = 0x00000000 +pub const fcntlf_exlck = 0x00000004 +pub const fcntlf_getfd = 0x00000001 +pub const fcntlf_getfl = 0x00000003 +pub const fcntlf_getlk = 0x00000005 +pub const fcntlf_getlk64 = 0x0000000c +pub const fcntlf_getown = 0x00000009 +pub const fcntlf_getowner_uids = 0x00000011 +pub const fcntlf_getown_ex = 0x00000010 +pub const fcntlf_getsig = 0x0000000b +pub const fcntlf_ofd_getlk = 0x00000024 +pub const fcntlf_ofd_setlk = 0x00000025 +pub const fcntlf_ofd_setlkw = 0x00000026 +pub const fcntlf_owner_pgrp = 0x00000002 +pub const fcntlf_owner_pid = 0x00000001 +pub const fcntlf_owner_tid = 0x00000000 +pub const fcntlf_rdlck = 0x00000000 +pub const fcntlf_setfd = 0x00000002 +pub const fcntlf_setfl = 0x00000004 +pub const fcntlf_setlk = 0x00000006 +pub const fcntlf_setlk64 = 0x0000000d +pub const fcntlf_setlkw = 0x00000007 +pub const fcntlf_setlkw64 = 0x0000000e +pub const fcntlf_setown = 0x00000008 +pub const fcntlf_setown_ex = 0x0000000f +pub const fcntlf_setsig = 0x0000000a +pub const fcntlf_shlck = 0x00000008 +pub const fcntlf_unlck = 0x00000002 +pub const fcntlf_wrlck = 0x00000001 +pub const fcntllock_ex = 0x00000002 +pub const fcntllock_mand = 0x00000020 +pub const fcntllock_nb = 0x00000004 +pub const fcntllock_read = 0x00000040 +pub const fcntllock_rw = 0x000000c0 +pub const fcntllock_sh = 0x00000001 +pub const fcntllock_un = 0x00000008 +pub const fcntllock_write = 0x00000080 +pub const fcntlo_accmode = 0x00000003 +pub const fcntlo_append = 0x00000400 +pub const fcntlo_cloexec = 0x00080000 +pub const fcntlo_creat = 0x00000040 +pub const fcntlo_direct = 0x00004000 +pub const fcntlo_directory = 0x00010000 +pub const fcntlo_dsync = 0x00001000 +pub const fcntlo_excl = 0x00000080 +pub const fcntlo_largefile = 0x00008000 +pub const fcntlo_ndelay = 0x00000800 +pub const fcntlo_noatime = 0x00040000 +pub const fcntlo_noctty = 0x00000100 +pub const fcntlo_nofollow = 0x00020000 +pub const fcntlo_nonblock = 0x00000800 +pub const fcntlo_path = 0x00200000 +pub const fcntlo_rdonly = 0x00000000 +pub const fcntlo_rdwr = 0x00000002 +pub const fcntlo_trunc = 0x00000200 +pub const fcntlo_wronly = 0x00000001 pub enum Errno { enoerror = 0x00000000 diff --git a/vlib/builtin/linux_bare/old/mm_bare.v b/vlib/builtin/linux_bare/old/mm_bare.v index 02032c2fe6..a4801cd3f3 100644 --- a/vlib/builtin/linux_bare/old/mm_bare.v +++ b/vlib/builtin/linux_bare/old/mm_bare.v @@ -1,10 +1,8 @@ module builtin -const ( - mem_prot = Mm_prot(int(Mm_prot.prot_read) | int(Mm_prot.prot_write)) - mem_flags = Map_flags(int(Map_flags.map_private) | int(Map_flags.map_anonymous)) - page_size = u64(Linux_mem.page_size) -) +const mem_prot = Mm_prot(int(Mm_prot.prot_read) | int(Mm_prot.prot_write)) +const mem_flags = Map_flags(int(Map_flags.map_private) | int(Map_flags.map_anonymous)) +const page_size = u64(Linux_mem.page_size) pub fn mm_pages(size u64) u32 { pages := (size + u64(4) + page_size) / page_size diff --git a/vlib/builtin/map.v b/vlib/builtin/map.v index 03ece901ff..02f39809f8 100644 --- a/vlib/builtin/map.v +++ b/vlib/builtin/map.v @@ -53,27 +53,25 @@ find the index for their meta's in the new array. Instead of rehashing compl- etely, it simply uses the cached-hashbits stored in the meta, resulting in much faster rehashing. */ -const ( - // Number of bits from the hash stored for each entry - hashbits = 24 - // Number of bits from the hash stored for rehashing - max_cached_hashbits = 16 - // Initial log-number of buckets in the hashtable - init_log_capicity = 5 - // Initial number of buckets in the hashtable - init_capicity = 1 << init_log_capicity - // Maximum load-factor (len / capacity) - max_load_factor = 0.8 - // Initial highest even index in metas - init_even_index = init_capicity - 2 - // Used for incrementing `extra_metas` when max - // probe count is too high, to avoid overflow - extra_metas_inc = 4 - // Bitmask to select all the hashbits - hash_mask = u32(0x00FFFFFF) - // Used for incrementing the probe-count - probe_inc = u32(0x01000000) -) +// Number of bits from the hash stored for each entry +const hashbits = 24 +// Number of bits from the hash stored for rehashing +const max_cached_hashbits = 16 +// Initial log-number of buckets in the hashtable +const init_log_capicity = 5 +// Initial number of buckets in the hashtable +const init_capicity = 1 << init_log_capicity +// Maximum load-factor (len / capacity) +const max_load_factor = 0.8 +// Initial highest even index in metas +const init_even_index = init_capicity - 2 +// Used for incrementing `extra_metas` when max +// probe count is too high, to avoid overflow +const extra_metas_inc = 4 +// Bitmask to select all the hashbits +const hash_mask = u32(0x00FFFFFF) +// Used for incrementing the probe-count +const probe_inc = u32(0x01000000) // DenseArray represents a dynamic array with very low growth factor struct DenseArray { diff --git a/vlib/builtin/sorted_map.v b/vlib/builtin/sorted_map.v index e56cae772b..9601ebb0d3 100644 --- a/vlib/builtin/sorted_map.v +++ b/vlib/builtin/sorted_map.v @@ -14,12 +14,10 @@ module builtin // The number for `degree` has been picked through vigor- // ous benchmarking but can be changed to any number > 1. // `degree` determines the maximum length of each node. -const ( - degree = 6 - mid_index = degree - 1 - max_len = 2 * degree - 1 - children_bytes = sizeof(voidptr) * (max_len + 1) -) +const degree = 6 +const mid_index = degree - 1 +const max_len = 2 * degree - 1 +const children_bytes = sizeof(voidptr) * (max_len + 1) pub struct SortedMap { value_bytes int diff --git a/vlib/builtin/sorting_test.v b/vlib/builtin/sorting_test.v index 26415ac635..e2f4706806 100644 --- a/vlib/builtin/sorting_test.v +++ b/vlib/builtin/sorting_test.v @@ -1,8 +1,6 @@ -const ( - unsorted = [2, 30, 10, 20, 1] - sorted_asc = [1, 2, 10, 20, 30] - sorted_desc = [30, 20, 10, 2, 1] -) +const unsorted = [2, 30, 10, 20, 1] +const sorted_asc = [1, 2, 10, 20, 30] +const sorted_desc = [30, 20, 10, 2, 1] fn test_sorting_simple() { mut a := unsorted.clone() diff --git a/vlib/builtin/string_interpolation.v b/vlib/builtin/string_interpolation.v index 34f5a3f5f2..1a20d074a8 100644 --- a/vlib/builtin/string_interpolation.v +++ b/vlib/builtin/string_interpolation.v @@ -678,11 +678,9 @@ pub fn str_intp(data_len int, input_base &StrIntpData) string { // They are used to substitute old _STR calls. // FIXME: this const is not released from memory => use a precalculated string const for now. // si_s_code = "0x" + int(StrIntpType.si_s).hex() // code for a simple string. -pub const ( - si_s_code = '0xfe10' - si_g32_code = '0xfe0e' - si_g64_code = '0xfe0f' -) +pub const si_s_code = '0xfe10' +pub const si_g32_code = '0xfe0e' +pub const si_g64_code = '0xfe0f' @[inline] pub fn str_intp_sq(in_str string) string { diff --git a/vlib/builtin/wasm/wasi/int.v b/vlib/builtin/wasm/wasi/int.v index 74dfa73fbe..289890d8cd 100644 --- a/vlib/builtin/wasm/wasi/int.v +++ b/vlib/builtin/wasm/wasi/int.v @@ -4,42 +4,38 @@ type byte = u8 // type i32 = int -const ( - // digit pairs in reverse order - digit_pairs = '00102030405060708090011121314151617181910212223242526272829203132333435363738393041424344454647484940515253545556575859506162636465666768696071727374757677787970818283848586878889809192939495969798999' -) +// digit pairs in reverse order +const digit_pairs = '00102030405060708090011121314151617181910212223242526272829203132333435363738393041424344454647484940515253545556575859506162636465666768696071727374757677787970818283848586878889809192939495969798999' -pub const ( - min_i8 = i8(-128) - max_i8 = i8(127) +pub const min_i8 = i8(-128) +pub const max_i8 = i8(127) - min_i16 = i16(-32768) - max_i16 = i16(32767) +pub const min_i16 = i16(-32768) +pub const max_i16 = i16(32767) - min_i32 = i32(-2147483648) - max_i32 = i32(2147483647) +pub const min_i32 = i32(-2147483648) +pub const max_i32 = i32(2147483647) - min_int = min_i32 - max_int = max_i32 +pub const min_int = min_i32 +pub const max_int = max_i32 - // -9223372036854775808 is wrong, because C compilers parse literal values - // without sign first, and 9223372036854775808 overflows i64, hence the - // consecutive subtraction by 1 - min_i64 = i64(-9223372036854775807 - 1) - max_i64 = i64(9223372036854775807) +// -9223372036854775808 is wrong, because C compilers parse literal values +// without sign first, and 9223372036854775808 overflows i64, hence the +// consecutive subtraction by 1 +pub const min_i64 = i64(-9223372036854775807 - 1) +pub const max_i64 = i64(9223372036854775807) - min_u8 = u8(0) - max_u8 = u8(255) +pub const min_u8 = u8(0) +pub const max_u8 = u8(255) - min_u16 = u16(0) - max_u16 = u16(65535) +pub const min_u16 = u16(0) +pub const max_u16 = u16(65535) - min_u32 = u32(0) - max_u32 = u32(4294967295) +pub const min_u32 = u32(0) +pub const max_u32 = u32(4294967295) - min_u64 = u64(0) - max_u64 = u64(18446744073709551615) -) +pub const min_u64 = u64(0) +pub const max_u64 = u64(18446744073709551615) // This implementation is the quickest with gcc -O2 // str_l returns the string representation of the integer nn with max chars. diff --git a/vlib/cli/help.v b/vlib/cli/help.v index 8f62a5fe9b..14ba741abe 100644 --- a/vlib/cli/help.v +++ b/vlib/cli/help.v @@ -3,11 +3,9 @@ module cli import term import strings -const ( - base_indent_len = 2 - min_description_indent_len = 20 - spacing = 2 -) +const base_indent_len = 2 +const min_description_indent_len = 20 +const spacing = 2 fn help_flag(with_abbrev bool) Flag { sabbrev := if with_abbrev { 'h' } else { '' } diff --git a/vlib/clipboard/x11/clipboard.c.v b/vlib/clipboard/x11/clipboard.c.v index d849a42399..a61b791371 100644 --- a/vlib/clipboard/x11/clipboard.c.v +++ b/vlib/clipboard/x11/clipboard.c.v @@ -114,10 +114,8 @@ mut: xselection C.XSelectionEvent } -const ( - atom_names = ['TARGETS', 'CLIPBOARD', 'PRIMARY', 'SECONDARY', 'TEXT', 'UTF8_STRING', 'text/plain', - 'text/html'] -) +const atom_names = ['TARGETS', 'CLIPBOARD', 'PRIMARY', 'SECONDARY', 'TEXT', 'UTF8_STRING', + 'text/plain', 'text/html'] // UNSUPPORTED TYPES: MULTIPLE, INCR, TIMESTAMP, image/bmp, image/jpeg, image/tiff, image/png // all the atom types we need diff --git a/vlib/compress/gzip/gzip.v b/vlib/compress/gzip/gzip.v index e36c14d907..ec7f0bd6e0 100644 --- a/vlib/compress/gzip/gzip.v +++ b/vlib/compress/gzip/gzip.v @@ -47,14 +47,12 @@ pub struct DecompressParams { verify_checksum bool = true } -pub const ( - reserved_bits = 0b1110_0000 - ftext = 0b0000_0001 - fextra = 0b0000_0100 - fname = 0b0000_1000 - fcomment = 0b0001_0000 - fhcrc = 0b0000_0010 -) +pub const reserved_bits = 0b1110_0000 +pub const ftext = 0b0000_0001 +pub const fextra = 0b0000_0100 +pub const fname = 0b0000_1000 +pub const fcomment = 0b0001_0000 +pub const fhcrc = 0b0000_0010 const min_header_length = 18 diff --git a/vlib/context/context.v b/vlib/context/context.v index ba783e6ede..af25bf31d2 100644 --- a/vlib/context/context.v +++ b/vlib/context/context.v @@ -6,16 +6,14 @@ module context import time -const ( - cancel_context_key = Key('context.CancelContext') +const cancel_context_key = Key('context.CancelContext') - // canceled is the error returned by Context.err when the context is canceled. - canceled = error('context canceled') +// canceled is the error returned by Context.err when the context is canceled. +const canceled = error('context canceled') - // deadline_exceeded is the error returned by Context.err when the context's - // deadline passes. - deadline_exceeded = error('context deadline exceeded') -) +// deadline_exceeded is the error returned by Context.err when the context's +// deadline passes. +const deadline_exceeded = error('context deadline exceeded') // Key represents the type for the ValueContext key pub type Key = bool | f32 | f64 | i16 | i64 | i8 | int | string | u16 | u32 | u64 | u8 | voidptr diff --git a/vlib/context/deadline_test.v b/vlib/context/deadline_test.v index fbecf87324..fd53243a23 100644 --- a/vlib/context/deadline_test.v +++ b/vlib/context/deadline_test.v @@ -1,10 +1,8 @@ import context import time -const ( - // a reasonable duration to block in an example - short_duration = 1 * time.millisecond -) +// a reasonable duration to block in an example +const short_duration = 1 * time.millisecond // This example passes a context with an arbitrary deadline to tell a blocking // function that it should abandon its work as soon as it gets to it. diff --git a/vlib/crypto/aes/aes.v b/vlib/crypto/aes/aes.v index 646d9dcc33..ad5f3dc3ad 100644 --- a/vlib/crypto/aes/aes.v +++ b/vlib/crypto/aes/aes.v @@ -8,10 +8,8 @@ module aes import crypto.cipher import crypto.internal.subtle -pub const ( - // The AES block size in bytes. - block_size = 16 -) +// The AES block size in bytes. +pub const block_size = 16 // AesCipher represents an AES encryption using a particular key. // It follows the API of golang's `cipher.Block` and is designed to diff --git a/vlib/crypto/aes/const.v b/vlib/crypto/aes/const.v index 4c0ffbeb7f..193a850663 100644 --- a/vlib/crypto/aes/const.v +++ b/vlib/crypto/aes/const.v @@ -22,37 +22,32 @@ module aes // Addition of these binary polynomials corresponds to binary xor. // Reducing mod poly corresponds to binary xor with poly every // time a 0x100 bit appears. -const ( - poly = (1 << 8) | (1 << 4) | (1 << 3) | (1 << 1) | (1 << 0) // x⁸ + x⁴ + x³ + x + 1 -) +const poly = (1 << 8) | (1 << 4) | (1 << 3) | (1 << 1) | (1 << 0) // Powers of x mod poly in GF(2). -const ( - pow_x = [ - u8(0x01), - 0x02, - 0x04, - 0x08, - 0x10, - 0x20, - 0x40, - 0x80, - 0x1b, - 0x36, - 0x6c, - 0xd8, - 0xab, - 0x4d, - 0x9a, - 0x2f, - ] -) +const pow_x = [ + u8(0x01), + 0x02, + 0x04, + 0x08, + 0x10, + 0x20, + 0x40, + 0x80, + 0x1b, + 0x36, + 0x6c, + 0xd8, + 0xab, + 0x4d, + 0x9a, + 0x2f, +] // vfmt off // FIPS-197 Figure 7. S-box substitution values in hexadecimal format. -const ( - s_box0 = [ +const s_box0 = [ u8(0x63), 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, @@ -69,12 +64,10 @@ const ( 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16, - ] -) +] // FIPS-197 Figure 14. Inverse S-box substitution values in hexadecimal format. -const ( - s_box1 = [ +const s_box1 = [ u8(0x52), 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, @@ -91,13 +84,11 @@ const ( 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d, - ] -) +] // Lookup tables for encryption. -const ( - te0 = [ +const te0 = [ u32(0xc66363a5), 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554, 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d, 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87, 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b, @@ -131,7 +122,7 @@ const ( 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8, 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11, 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a, ] - te1 = [ + const te1 = [ u32(0xa5c66363), 0x84f87c7c, 0x99ee7777, 0x8df67b7b, 0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5, 0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b, 0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676, 0x458fcaca, 0x9d1f8282, 0x4089c9c9, 0x87fa7d7d, 0x15effafa, 0xebb25959, 0xc98e4747, 0x0bfbf0f0, @@ -165,7 +156,7 @@ const ( 0x8f038c8c, 0xf859a1a1, 0x80098989, 0x171a0d0d, 0xda65bfbf, 0x31d7e6e6, 0xc6844242, 0xb8d06868, 0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f, 0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616, ] - te2 = [ + const te2 = [ u32(0x63a5c663), 0x7c84f87c, 0x7799ee77, 0x7b8df67b, 0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5, 0x30506030, 0x01030201, 0x67a9ce67, 0x2b7d562b, 0xfe19e7fe, 0xd762b5d7, 0xabe64dab, 0x769aec76, 0xca458fca, 0x829d1f82, 0xc94089c9, 0x7d87fa7d, 0xfa15effa, 0x59ebb259, 0x47c98e47, 0xf00bfbf0, @@ -199,7 +190,7 @@ const ( 0x8c8f038c, 0xa1f859a1, 0x89800989, 0x0d171a0d, 0xbfda65bf, 0xe631d7e6, 0x42c68442, 0x68b8d068, 0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f, 0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16, ] - te3 = [ + const te3 = [ u32(0x6363a5c6), 0x7c7c84f8, 0x777799ee, 0x7b7b8df6, 0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491, 0x30305060, 0x01010302, 0x6767a9ce, 0x2b2b7d56, 0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec, 0xcaca458f, 0x82829d1f, 0xc9c94089, 0x7d7d87fa, 0xfafa15ef, 0x5959ebb2, 0x4747c98e, 0xf0f00bfb, @@ -233,11 +224,9 @@ const ( 0x8c8c8f03, 0xa1a1f859, 0x89898009, 0x0d0d171a, 0xbfbfda65, 0xe6e631d7, 0x4242c684, 0x6868b8d0, 0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e, 0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c, ] -) // Lookup tables for decryption. -const ( - td0 = [ +const td0 = [ u32(0x51f4a750), 0x7e416553, 0x1a17a4c3, 0x3a275e96, 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393, 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25, 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f, 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1, 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6, @@ -271,7 +260,7 @@ const ( 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f, 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541, 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190, 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742, ] - td1 = [ + const td1 = [ u32(0x5051f4a7), 0x537e4165, 0xc31a17a4, 0x963a275e, 0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303, 0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c, 0xfc4fe5d7, 0xd7c52acb, 0x80263544, 0x8fb562a3, 0x49deb15a, 0x6725ba1b, 0x9845ea0e, 0xe15dfec0, 0x02c32f75, 0x12814cf0, 0xa38d4697, 0xc66bd3f9, @@ -305,7 +294,7 @@ const ( 0x81caaff3, 0x3eb968c4, 0x2c382434, 0x5fc2a340, 0x72161dc3, 0x0cbce225, 0x8b283c49, 0x41ff0d95, 0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1, 0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857, ] - td2 = [ + const td2 = [ u32(0xa75051f4), 0x65537e41, 0xa4c31a17, 0x5e963a27, 0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3, 0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502, 0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562, 0x5a49deb1, 0x1b6725ba, 0x0e9845ea, 0xc0e15dfe, 0x7502c32f, 0xf012814c, 0x97a38d46, 0xf9c66bd3, @@ -339,7 +328,7 @@ const ( 0xf381caaf, 0xc43eb968, 0x342c3824, 0x405fc2a3, 0xc372161d, 0x250cbce2, 0x498b283c, 0x9541ff0d, 0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456, 0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8, ] - td3 = [ + const td3 = [ u32(0xf4a75051), 0x4165537e, 0x17a4c31a, 0x275e963a, 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b, 0x30fa5520, 0x766df6ad, 0xcc769188, 0x024c25f5, 0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5, 0xb15a49de, 0xba1b6725, 0xea0e9845, 0xfec0e15d, 0x2f7502c3, 0x4cf01281, 0x4697a38d, 0xd3f9c66b, @@ -373,6 +362,5 @@ const ( 0xaff381ca, 0x68c43eb9, 0x24342c38, 0xa3405fc2, 0x1dc37216, 0xe2250cbc, 0x3c498b28, 0x0d9541ff, 0xa8017139, 0x0cb3de08, 0xb4e49cd8, 0x56c19064, 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0, ] -) // vfmt on diff --git a/vlib/crypto/bcrypt/bcrypt.v b/vlib/crypto/bcrypt/bcrypt.v index 9c007a20cb..210a8f5807 100644 --- a/vlib/crypto/bcrypt/bcrypt.v +++ b/vlib/crypto/bcrypt/bcrypt.v @@ -3,19 +3,17 @@ module bcrypt import crypto.rand import crypto.blowfish -pub const ( - min_cost = 4 - max_cost = 31 - default_cost = 10 - salt_length = 16 - max_crypted_hash_size = 23 - encoded_salt_size = 22 - encoded_hash_size = 31 - min_hash_size = 59 +pub const min_cost = 4 +pub const max_cost = 31 +pub const default_cost = 10 +pub const salt_length = 16 +pub const max_crypted_hash_size = 23 +pub const encoded_salt_size = 22 +pub const encoded_hash_size = 31 +pub const min_hash_size = 59 - major_version = '2' - minor_version = 'a' -) +pub const major_version = '2' +pub const minor_version = 'a' pub struct Hashed { mut: diff --git a/vlib/crypto/cipher/des_cbc_test.v b/vlib/crypto/cipher/des_cbc_test.v index 2c437e02e5..e33c20cab7 100644 --- a/vlib/crypto/cipher/des_cbc_test.v +++ b/vlib/crypto/cipher/des_cbc_test.v @@ -1,11 +1,9 @@ import crypto.des import crypto.cipher -const ( - key = '123456789012345678901234'.bytes() - iv = 'abcdegfh'.bytes() - str = '73c86d43a9d700a253a96c85b0f6b03ac9792e0e757f869cca306bd3cba1c62b' -) +const key = '123456789012345678901234'.bytes() +const iv = 'abcdegfh'.bytes() +const str = '73c86d43a9d700a253a96c85b0f6b03ac9792e0e757f869cca306bd3cba1c62b' fn test_triple_des_cbc() { mut src := str.bytes() diff --git a/vlib/crypto/cipher/des_cfb_test.v b/vlib/crypto/cipher/des_cfb_test.v index 70117204bc..8fdc0d922c 100644 --- a/vlib/crypto/cipher/des_cfb_test.v +++ b/vlib/crypto/cipher/des_cfb_test.v @@ -1,11 +1,9 @@ import crypto.des import crypto.cipher -const ( - key = '123456789012345678901234'.bytes() - iv = 'abcdegfh'.bytes() - str = '73c86d43a9d700a253a96c85b0f6b03ac9792e0e757f869cca306bd3cba1c62b' -) +const key = '123456789012345678901234'.bytes() +const iv = 'abcdegfh'.bytes() +const str = '73c86d43a9d700a253a96c85b0f6b03ac9792e0e757f869cca306bd3cba1c62b' fn test_triple_des_cfb() { mut src := str.bytes() diff --git a/vlib/crypto/cipher/des_ctr_test.v b/vlib/crypto/cipher/des_ctr_test.v index 0c173dfc81..923666a73b 100644 --- a/vlib/crypto/cipher/des_ctr_test.v +++ b/vlib/crypto/cipher/des_ctr_test.v @@ -1,11 +1,9 @@ import crypto.des import crypto.cipher -const ( - key = '123456789012345678901234'.bytes() - iv = 'abcdegfh'.bytes() - str = '73c86d43a9d700a253a96c85b0f6b03ac9792e0e757f869cca306bd3cba1c62b' -) +const key = '123456789012345678901234'.bytes() +const iv = 'abcdegfh'.bytes() +const str = '73c86d43a9d700a253a96c85b0f6b03ac9792e0e757f869cca306bd3cba1c62b' fn test_triple_des_ctr() { mut src := str.bytes() diff --git a/vlib/crypto/cipher/des_ofb_test.v b/vlib/crypto/cipher/des_ofb_test.v index 86e791b8d1..3d759ebb32 100644 --- a/vlib/crypto/cipher/des_ofb_test.v +++ b/vlib/crypto/cipher/des_ofb_test.v @@ -1,11 +1,9 @@ import crypto.des import crypto.cipher -const ( - key = '123456789012345678901234'.bytes() - iv = 'abcdegfh'.bytes() - str = '73c86d43a9d700a253a96c85b0f6b03ac9792e0e757f869cca306bd3cba1c62b' -) +const key = '123456789012345678901234'.bytes() +const iv = 'abcdegfh'.bytes() +const str = '73c86d43a9d700a253a96c85b0f6b03ac9792e0e757f869cca306bd3cba1c62b' fn test_triple_des_ofb() { mut src := str.bytes() diff --git a/vlib/crypto/des/des_test.v b/vlib/crypto/des/des_test.v index be24c53a62..81fcb06b1d 100644 --- a/vlib/crypto/des/des_test.v +++ b/vlib/crypto/des/des_test.v @@ -1,10 +1,8 @@ import crypto.des -const ( - key = '123456789012345678901234'.bytes() - iv = 'abcdegfh'.bytes() - str = 'aaaaaaaa' -) +const key = '123456789012345678901234'.bytes() +const iv = 'abcdegfh'.bytes() +const str = 'aaaaaaaa' fn test_triple_des() { mut src := str.bytes() diff --git a/vlib/crypto/ed25519/internal/edwards25519/element.v b/vlib/crypto/ed25519/internal/edwards25519/element.v index 1ccb525280..7dae319462 100644 --- a/vlib/crypto/ed25519/internal/edwards25519/element.v +++ b/vlib/crypto/ed25519/internal/edwards25519/element.v @@ -31,31 +31,29 @@ mut: l4 u64 } -const ( - mask_low_51_bits = u64((1 << 51) - 1) - fe_zero = Element{ - l0: 0 - l1: 0 - l2: 0 - l3: 0 - l4: 0 - } - fe_one = Element{ - l0: 1 - l1: 0 - l2: 0 - l3: 0 - l4: 0 - } - // sqrt_m1 is 2^((p-1)/4), which squared is equal to -1 by Euler's Criterion. - sqrt_m1 = Element{ - l0: 1718705420411056 - l1: 234908883556509 - l2: 2233514472574048 - l3: 2117202627021982 - l4: 765476049583133 - } -) +const mask_low_51_bits = u64((1 << 51) - 1) +const fe_zero = Element{ + l0: 0 + l1: 0 + l2: 0 + l3: 0 + l4: 0 +} +const fe_one = Element{ + l0: 1 + l1: 0 + l2: 0 + l3: 0 + l4: 0 +} +// sqrt_m1 is 2^((p-1)/4), which squared is equal to -1 by Euler's Criterion. +const sqrt_m1 = Element{ + l0: 1718705420411056 + l1: 234908883556509 + l2: 2233514472574048 + l3: 2117202627021982 + l4: 765476049583133 +} // mul_64 returns a * b. fn mul_64(a u64, b u64) Uint128 { diff --git a/vlib/crypto/ed25519/internal/edwards25519/element_test.v b/vlib/crypto/ed25519/internal/edwards25519/element_test.v index 0b333971e3..c913f6ecaa 100644 --- a/vlib/crypto/ed25519/internal/edwards25519/element_test.v +++ b/vlib/crypto/ed25519/internal/edwards25519/element_test.v @@ -33,52 +33,50 @@ fn generate_field_element() Element { // weirdLimbs can be combined to generate a range of edge-case edwards25519 elements. // 0 and -1 are intentionally more weighted, as they combine well. -const ( - two_to_51 = u64(1) << 51 - two_to_52 = u64(1) << 52 - weird_limbs_51 = [ - u64(0), - 0, - 0, - 0, - 1, - 19 - 1, - 19, - 0x2aaaaaaaaaaaa, - 0x5555555555555, - two_to_51 - 20, - two_to_51 - 19, - two_to_51 - 1, - two_to_51 - 1, - two_to_51 - 1, - two_to_51 - 1, - ] - weird_limbs_52 = [ - u64(0), - 0, - 0, - 0, - 0, - 0, - 1, - 19 - 1, - 19, - 0x2aaaaaaaaaaaa, - 0x5555555555555, - two_to_51 - 20, - two_to_51 - 19, - two_to_51 - 1, - two_to_51 - 1, - two_to_51 - 1, - two_to_51 - 1, - two_to_51 - 1, - two_to_51 - 1, - two_to_51, - two_to_51 + 1, - two_to_52 - 19, - two_to_52 - 1, - ] -) +const two_to_51 = u64(1) << 51 +const two_to_52 = u64(1) << 52 +const weird_limbs_51 = [ + u64(0), + 0, + 0, + 0, + 1, + 19 - 1, + 19, + 0x2aaaaaaaaaaaa, + 0x5555555555555, + two_to_51 - 20, + two_to_51 - 19, + two_to_51 - 1, + two_to_51 - 1, + two_to_51 - 1, + two_to_51 - 1, +] +const weird_limbs_52 = [ + u64(0), + 0, + 0, + 0, + 0, + 0, + 1, + 19 - 1, + 19, + 0x2aaaaaaaaaaaa, + 0x5555555555555, + two_to_51 - 20, + two_to_51 - 19, + two_to_51 - 1, + two_to_51 - 1, + two_to_51 - 1, + two_to_51 - 1, + two_to_51 - 1, + two_to_51 - 1, + two_to_51, + two_to_51 + 1, + two_to_52 - 19, + two_to_52 - 1, +] fn generate_weird_field_element() Element { return Element{ diff --git a/vlib/crypto/ed25519/internal/edwards25519/extra_test.v b/vlib/crypto/ed25519/internal/edwards25519/extra_test.v index 19b1319003..dd61e418fd 100644 --- a/vlib/crypto/ed25519/internal/edwards25519/extra_test.v +++ b/vlib/crypto/ed25519/internal/edwards25519/extra_test.v @@ -65,10 +65,8 @@ fn test_bytes_montgomery_infinity() { assert got == want } -const ( - loworder_string = '26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85' - loworder_bytes = hex.decode(loworder_string) or { panic(err) } -) +const loworder_string = '26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85' +const loworder_bytes = hex.decode(loworder_string) or { panic(err) } fn fn_cofactor(mut data []u8) bool { if data.len != 64 { diff --git a/vlib/crypto/ed25519/internal/edwards25519/point.v b/vlib/crypto/ed25519/internal/edwards25519/point.v index 402c57264a..ded7aaab66 100644 --- a/vlib/crypto/ed25519/internal/edwards25519/point.v +++ b/vlib/crypto/ed25519/internal/edwards25519/point.v @@ -1,22 +1,20 @@ module edwards25519 -const ( - // d is a constant in the curve equation. - d_bytes = [u8(0xa3), 0x78, 0x59, 0x13, 0xca, 0x4d, 0xeb, 0x75, 0xab, 0xd8, 0x41, 0x41, 0x4d, - 0x0a, 0x70, 0x00, 0x98, 0xe8, 0x79, 0x77, 0x79, 0x40, 0xc7, 0x8c, 0x73, 0xfe, 0x6f, 0x2b, - 0xee, 0x6c, 0x03, 0x52] - id_bytes = [u8(1), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0] - gen_bytes = [u8(0x58), 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, - 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, - 0x66, 0x66, 0x66, 0x66] - d_const = d_const_generate() or { panic(err) } - d2_const = d2_const_generate() or { panic(err) } - // id_point is the point at infinity. - id_point = id_point_generate() or { panic(err) } - // generator point - gen_point = generator() or { panic(err) } -) +// d is a constant in the curve equation. +const d_bytes = [u8(0xa3), 0x78, 0x59, 0x13, 0xca, 0x4d, 0xeb, 0x75, 0xab, 0xd8, 0x41, 0x41, 0x4d, + 0x0a, 0x70, 0x00, 0x98, 0xe8, 0x79, 0x77, 0x79, 0x40, 0xc7, 0x8c, 0x73, 0xfe, 0x6f, 0x2b, 0xee, + 0x6c, 0x03, 0x52] +const id_bytes = [u8(1), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0] +const gen_bytes = [u8(0x58), 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, + 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, + 0x66, 0x66, 0x66, 0x66] +const d_const = d_const_generate() or { panic(err) } +const d2_const = d2_const_generate() or { panic(err) } +// id_point is the point at infinity. +const id_point = id_point_generate() or { panic(err) } +// generator point +const gen_point = generator() or { panic(err) } fn d_const_generate() !Element { mut v := Element{} diff --git a/vlib/crypto/ed25519/internal/edwards25519/scalar.v b/vlib/crypto/ed25519/internal/edwards25519/scalar.v index 01e4b25ee7..5b09b842cc 100644 --- a/vlib/crypto/ed25519/internal/edwards25519/scalar.v +++ b/vlib/crypto/ed25519/internal/edwards25519/scalar.v @@ -21,22 +21,20 @@ mut: s [32]u8 } -pub const ( - sc_zero = Scalar{ - s: [u8(0), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0]! - } +pub const sc_zero = Scalar{ + s: [u8(0), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0]! +} - sc_one = Scalar{ - s: [u8(1), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0]! - } +pub const sc_one = Scalar{ + s: [u8(1), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0]! +} - sc_minus_one = Scalar{ - s: [u8(236), 211, 245, 92, 26, 99, 18, 88, 214, 156, 247, 162, 222, 249, 222, 20, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16]! - } -) +pub const sc_minus_one = Scalar{ + s: [u8(236), 211, 245, 92, 26, 99, 18, 88, 214, 156, 247, 162, 222, 249, 222, 20, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16]! +} // new_scalar return new zero scalar pub fn new_scalar() Scalar { diff --git a/vlib/crypto/ed25519/internal/edwards25519/scalar_test.v b/vlib/crypto/ed25519/internal/edwards25519/scalar_test.v index 94045e1baa..6ea261c8e7 100644 --- a/vlib/crypto/ed25519/internal/edwards25519/scalar_test.v +++ b/vlib/crypto/ed25519/internal/edwards25519/scalar_test.v @@ -99,11 +99,9 @@ fn test_scalar_set_canonical_bytes_round_trip() { } } -const ( - sc_error = Scalar{ - s: [32]u8{init: (u8(-1))} - } -) +const sc_error = Scalar{ + s: [32]u8{init: (u8(-1))} +} fn test_scalar_set_canonical_bytes_on_noncanonical_value() { mut b := sc_minus_one.s diff --git a/vlib/crypto/ed25519/internal/edwards25519/scalarmult_test.v b/vlib/crypto/ed25519/internal/edwards25519/scalarmult_test.v index 62724352fe..2c99a91d70 100644 --- a/vlib/crypto/ed25519/internal/edwards25519/scalarmult_test.v +++ b/vlib/crypto/ed25519/internal/edwards25519/scalarmult_test.v @@ -1,12 +1,10 @@ module edwards25519 -const ( - dalek_scalar = Scalar{[u8(219), 106, 114, 9, 174, 249, 155, 89, 69, 203, 201, 93, 92, 116, - 234, 187, 78, 115, 103, 172, 182, 98, 62, 103, 187, 136, 13, 100, 248, 110, 12, 4]!} - dsc_basepoint = [u8(0xf4), 0xef, 0x7c, 0xa, 0x34, 0x55, 0x7b, 0x9f, 0x72, 0x3b, 0xb6, 0x1e, - 0xf9, 0x46, 0x9, 0x91, 0x1c, 0xb9, 0xc0, 0x6c, 0x17, 0x28, 0x2d, 0x8b, 0x43, 0x2b, 0x5, - 0x18, 0x6a, 0x54, 0x3e, 0x48] -) +const dalek_scalar = Scalar{[u8(219), 106, 114, 9, 174, 249, 155, 89, 69, 203, 201, 93, 92, 116, + 234, 187, 78, 115, 103, 172, 182, 98, 62, 103, 187, 136, 13, 100, 248, 110, 12, 4]!} +const dsc_basepoint = [u8(0xf4), 0xef, 0x7c, 0xa, 0x34, 0x55, 0x7b, 0x9f, 0x72, 0x3b, 0xb6, 0x1e, + 0xf9, 0x46, 0x9, 0x91, 0x1c, 0xb9, 0xc0, 0x6c, 0x17, 0x28, 0x2d, 0x8b, 0x43, 0x2b, 0x5, 0x18, + 0x6a, 0x54, 0x3e, 0x48] fn dalek_scalar_basepoint() Point { mut p := Point{} diff --git a/vlib/crypto/hmac/hmac.v b/vlib/crypto/hmac/hmac.v index 3a07dd9bac..ad1da8c561 100644 --- a/vlib/crypto/hmac/hmac.v +++ b/vlib/crypto/hmac/hmac.v @@ -4,11 +4,10 @@ module hmac import crypto.internal.subtle -const ( - ipad = []u8{len: 256, init: 0x36} // TODO is 256 enough?? - opad = []u8{len: 256, init: 0x5C} - npad = []u8{len: 256, init: 0} -) +const ipad = []u8{len: 256, init: 0x36} // TODO is 256 enough?? + +const opad = []u8{len: 256, init: 0x5C} +const npad = []u8{len: 256, init: 0} // new returns a HMAC byte array, depending on the hash algorithm used. pub fn new(key []u8, data []u8, hash_func fn ([]u8) []u8, blocksize int) []u8 { diff --git a/vlib/crypto/hmac/hmac_test.v b/vlib/crypto/hmac/hmac_test.v index 2d3d978981..92ef17042d 100644 --- a/vlib/crypto/hmac/hmac_test.v +++ b/vlib/crypto/hmac/hmac_test.v @@ -18,41 +18,39 @@ import crypto.sha512 // import crypto.blake2b_256 // import crypto.blake2b_384 // import crypto.blake2b_512 -const ( - keys = [ - [u8(0xb), 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb], - 'Jefe'.bytes(), - [u8(0xAA), 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, - 0xAA, 0xAA], - [u8(0x01), 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, - 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19], - [u8(0x0c), 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c], - [u8(0xaa), 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa], - [u8(0xaa), 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa], - ] - data = ['Hi There'.bytes(), 'what do ya want for nothing?'.bytes(), - [u8(0xDD), 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, - 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, - 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, - 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD], - [u8(0xcd), 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, - 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, - 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, - 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd], - 'Test With Truncation'.bytes(), 'Test Using Larger Than Block-Size Key - Hash Key First'.bytes(), - 'Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data'.bytes()] -) +const keys = [ + [u8(0xb), 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb], + 'Jefe'.bytes(), + [u8(0xAA), 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, + 0xAA], + [u8(0x01), 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19], + [u8(0x0c), 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, + 0x0c], + [u8(0xaa), 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa], + [u8(0xaa), 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa], +] +const data = ['Hi There'.bytes(), 'what do ya want for nothing?'.bytes(), + [u8(0xDD), 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, + 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, + 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, + 0xDD, 0xDD, 0xDD, 0xDD, 0xDD], + [u8(0xcd), 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, + 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, + 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, + 0xcd, 0xcd, 0xcd, 0xcd, 0xcd], + 'Test With Truncation'.bytes(), 'Test Using Larger Than Block-Size Key - Hash Key First'.bytes(), + 'Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data'.bytes()] fn test_hmac_md5() { md5_expected_results := [ diff --git a/vlib/crypto/md5/md5.v b/vlib/crypto/md5/md5.v index ade4c08bc7..509726c307 100644 --- a/vlib/crypto/md5/md5.v +++ b/vlib/crypto/md5/md5.v @@ -10,19 +10,15 @@ module md5 import encoding.binary -pub const ( - // The size of an MD5 checksum in bytes. - size = 16 - // The blocksize of MD5 in bytes. - block_size = 64 -) +// The size of an MD5 checksum in bytes. +pub const size = 16 +// The blocksize of MD5 in bytes. +pub const block_size = 64 -const ( - init0 = 0x67452301 - init1 = u32(0xEFCDAB89) - init2 = u32(0x98BADCFE) - init3 = 0x10325476 -) +const init0 = 0x67452301 +const init1 = u32(0xEFCDAB89) +const init2 = u32(0x98BADCFE) +const init3 = 0x10325476 // Digest represents the partial evaluation of a checksum. struct Digest { diff --git a/vlib/crypto/pem/pem.v b/vlib/crypto/pem/pem.v index 1f61367b56..72fd50dc3a 100644 --- a/vlib/crypto/pem/pem.v +++ b/vlib/crypto/pem/pem.v @@ -2,12 +2,10 @@ // according to RFC 1421 module pem -const ( - pem_begin = '-----BEGIN ' - pem_end = '\n-----END ' - pem_eol = '-----' - colon = ':' -) +const pem_begin = '-----BEGIN ' +const pem_end = '\n-----END ' +const pem_eol = '-----' +const colon = ':' // new returns a new `Block` with the specified block_type @[deprecated: 'use Block.new instead'] diff --git a/vlib/crypto/rand/rand_linux.c.v b/vlib/crypto/rand/rand_linux.c.v index 76d944fc75..775b9bd940 100644 --- a/vlib/crypto/rand/rand_linux.c.v +++ b/vlib/crypto/rand/rand_linux.c.v @@ -5,9 +5,7 @@ module rand #include -const ( - read_batch_size = 256 -) +const read_batch_size = 256 // read returns an array of `bytes_needed` random bytes read from the OS. pub fn read(bytes_needed int) ![]u8 { diff --git a/vlib/crypto/rand/rand_solaris.c.v b/vlib/crypto/rand/rand_solaris.c.v index 2146c98951..907796d168 100644 --- a/vlib/crypto/rand/rand_solaris.c.v +++ b/vlib/crypto/rand/rand_solaris.c.v @@ -8,9 +8,7 @@ module rand fn C.getrandom(p &u8, n usize, flags u32) int -const ( - read_batch_size = 256 -) +const read_batch_size = 256 // read returns an array of `bytes_needed` random bytes read from the OS. pub fn read(bytes_needed int) ![]u8 { diff --git a/vlib/crypto/rand/rand_windows.c.v b/vlib/crypto/rand/rand_windows.c.v index 5491e4b0d1..c1da7ad569 100644 --- a/vlib/crypto/rand/rand_windows.c.v +++ b/vlib/crypto/rand/rand_windows.c.v @@ -8,10 +8,8 @@ module rand #flag windows -lbcrypt #include -const ( - status_success = 0x00000000 - bcrypt_use_system_preferred_rng = 0x00000002 -) +const status_success = 0x00000000 +const bcrypt_use_system_preferred_rng = 0x00000002 // read returns an array of `bytes_needed` random bytes read from the OS. pub fn read(bytes_needed int) ![]u8 { diff --git a/vlib/crypto/sha1/sha1.v b/vlib/crypto/sha1/sha1.v index 1b6c47d713..52df0b229b 100644 --- a/vlib/crypto/sha1/sha1.v +++ b/vlib/crypto/sha1/sha1.v @@ -10,21 +10,17 @@ module sha1 import encoding.binary -pub const ( - // The size of a SHA-1 checksum in bytes. - size = 20 - // The blocksize of SHA-1 in bytes. - block_size = 64 -) +// The size of a SHA-1 checksum in bytes. +pub const size = 20 +// The blocksize of SHA-1 in bytes. +pub const block_size = 64 -const ( - chunk = 64 - init0 = 0x67452301 - init1 = u32(0xEFCDAB89) - init2 = u32(0x98BADCFE) - init3 = 0x10325476 - init4 = u32(0xC3D2E1F0) -) +const chunk = 64 +const init0 = 0x67452301 +const init1 = u32(0xEFCDAB89) +const init2 = u32(0x98BADCFE) +const init3 = 0x10325476 +const init4 = u32(0xC3D2E1F0) // digest represents the partial evaluation of a checksum. struct Digest { diff --git a/vlib/crypto/sha1/sha1block_generic.v b/vlib/crypto/sha1/sha1block_generic.v index d56c0020a8..39867a3542 100644 --- a/vlib/crypto/sha1/sha1block_generic.v +++ b/vlib/crypto/sha1/sha1block_generic.v @@ -8,12 +8,10 @@ module sha1 import math.bits -const ( - _k0 = 0x5A827999 - _k1 = 0x6ED9EBA1 - _k2 = u32(0x8F1BBCDC) - _k3 = u32(0xCA62C1D6) -) +const _k0 = 0x5A827999 +const _k1 = 0x6ED9EBA1 +const _k2 = u32(0x8F1BBCDC) +const _k3 = u32(0xCA62C1D6) fn block_generic(mut dig Digest, p_ []u8) { unsafe { diff --git a/vlib/crypto/sha256/sha256.v b/vlib/crypto/sha256/sha256.v index 62d66caf83..9882c9125b 100644 --- a/vlib/crypto/sha256/sha256.v +++ b/vlib/crypto/sha256/sha256.v @@ -9,34 +9,30 @@ module sha256 import encoding.binary -pub const ( - // The size of a SHA256 checksum in bytes. - size = 32 - // The size of a SHA224 checksum in bytes. - size224 = 28 - // The blocksize of SHA256 and SHA224 in bytes. - block_size = 64 -) +// The size of a SHA256 checksum in bytes. +pub const size = 32 +// The size of a SHA224 checksum in bytes. +pub const size224 = 28 +// The blocksize of SHA256 and SHA224 in bytes. +pub const block_size = 64 -const ( - chunk = 64 - init0 = 0x6A09E667 - init1 = u32(0xBB67AE85) - init2 = 0x3C6EF372 - init3 = u32(0xA54FF53A) - init4 = 0x510E527F - init5 = u32(0x9B05688C) - init6 = 0x1F83D9AB - init7 = 0x5BE0CD19 - init0_224 = u32(0xC1059ED8) - init1_224 = 0x367CD507 - init2_224 = 0x3070DD17 - init3_224 = u32(0xF70E5939) - init4_224 = u32(0xFFC00B31) - init5_224 = 0x68581511 - init6_224 = 0x64F98FA7 - init7_224 = u32(0xBEFA4FA4) -) +const chunk = 64 +const init0 = 0x6A09E667 +const init1 = u32(0xBB67AE85) +const init2 = 0x3C6EF372 +const init3 = u32(0xA54FF53A) +const init4 = 0x510E527F +const init5 = u32(0x9B05688C) +const init6 = 0x1F83D9AB +const init7 = 0x5BE0CD19 +const init0_224 = u32(0xC1059ED8) +const init1_224 = 0x367CD507 +const init2_224 = 0x3070DD17 +const init3_224 = u32(0xF70E5939) +const init4_224 = u32(0xFFC00B31) +const init5_224 = 0x68581511 +const init6_224 = 0x64F98FA7 +const init7_224 = u32(0xBEFA4FA4) // digest represents the partial evaluation of a checksum. struct Digest { diff --git a/vlib/crypto/sha256/sha256block_generic.v b/vlib/crypto/sha256/sha256block_generic.v index d99106315a..7322e2024c 100644 --- a/vlib/crypto/sha256/sha256block_generic.v +++ b/vlib/crypto/sha256/sha256block_generic.v @@ -9,74 +9,72 @@ module sha256 import math.bits -const ( - _k = [ - 0x428a2f98, - 0x71374491, - 0xb5c0fbcf, - 0xe9b5dba5, - 0x3956c25b, - 0x59f111f1, - 0x923f82a4, - 0xab1c5ed5, - 0xd807aa98, - 0x12835b01, - 0x243185be, - 0x550c7dc3, - 0x72be5d74, - 0x80deb1fe, - 0x9bdc06a7, - 0xc19bf174, - 0xe49b69c1, - 0xefbe4786, - 0x0fc19dc6, - 0x240ca1cc, - 0x2de92c6f, - 0x4a7484aa, - 0x5cb0a9dc, - 0x76f988da, - 0x983e5152, - 0xa831c66d, - 0xb00327c8, - 0xbf597fc7, - 0xc6e00bf3, - 0xd5a79147, - 0x06ca6351, - 0x14292967, - 0x27b70a85, - 0x2e1b2138, - 0x4d2c6dfc, - 0x53380d13, - 0x650a7354, - 0x766a0abb, - 0x81c2c92e, - 0x92722c85, - 0xa2bfe8a1, - 0xa81a664b, - 0xc24b8b70, - 0xc76c51a3, - 0xd192e819, - 0xd6990624, - 0xf40e3585, - 0x106aa070, - 0x19a4c116, - 0x1e376c08, - 0x2748774c, - 0x34b0bcb5, - 0x391c0cb3, - 0x4ed8aa4a, - 0x5b9cca4f, - 0x682e6ff3, - 0x748f82ee, - 0x78a5636f, - 0x84c87814, - 0x8cc70208, - 0x90befffa, - 0xa4506ceb, - 0xbef9a3f7, - 0xc67178f2, - ] -) +const _k = [ + 0x428a2f98, + 0x71374491, + 0xb5c0fbcf, + 0xe9b5dba5, + 0x3956c25b, + 0x59f111f1, + 0x923f82a4, + 0xab1c5ed5, + 0xd807aa98, + 0x12835b01, + 0x243185be, + 0x550c7dc3, + 0x72be5d74, + 0x80deb1fe, + 0x9bdc06a7, + 0xc19bf174, + 0xe49b69c1, + 0xefbe4786, + 0x0fc19dc6, + 0x240ca1cc, + 0x2de92c6f, + 0x4a7484aa, + 0x5cb0a9dc, + 0x76f988da, + 0x983e5152, + 0xa831c66d, + 0xb00327c8, + 0xbf597fc7, + 0xc6e00bf3, + 0xd5a79147, + 0x06ca6351, + 0x14292967, + 0x27b70a85, + 0x2e1b2138, + 0x4d2c6dfc, + 0x53380d13, + 0x650a7354, + 0x766a0abb, + 0x81c2c92e, + 0x92722c85, + 0xa2bfe8a1, + 0xa81a664b, + 0xc24b8b70, + 0xc76c51a3, + 0xd192e819, + 0xd6990624, + 0xf40e3585, + 0x106aa070, + 0x19a4c116, + 0x1e376c08, + 0x2748774c, + 0x34b0bcb5, + 0x391c0cb3, + 0x4ed8aa4a, + 0x5b9cca4f, + 0x682e6ff3, + 0x748f82ee, + 0x78a5636f, + 0x84c87814, + 0x8cc70208, + 0x90befffa, + 0xa4506ceb, + 0xbef9a3f7, + 0xc67178f2, +] fn block_generic(mut dig Digest, p_ []u8) { unsafe { diff --git a/vlib/crypto/sha512/sha512.v b/vlib/crypto/sha512/sha512.v index a0e7ee72d1..60986c50c1 100644 --- a/vlib/crypto/sha512/sha512.v +++ b/vlib/crypto/sha512/sha512.v @@ -10,55 +10,51 @@ module sha512 import crypto import encoding.binary -pub const ( - // size is the size, in bytes, of a SHA-512 checksum. - size = 64 - // size224 is the size, in bytes, of a SHA-512/224 checksum. - size224 = 28 - // size256 is the size, in bytes, of a SHA-512/256 checksum. - size256 = 32 - // size384 is the size, in bytes, of a SHA-384 checksum. - size384 = 48 - // block_size is the block size, in bytes, of the SHA-512/224, - // SHA-512/256, SHA-384 and SHA-512 hash functions. - block_size = 128 -) +// size is the size, in bytes, of a SHA-512 checksum. +pub const size = 64 +// size224 is the size, in bytes, of a SHA-512/224 checksum. +pub const size224 = 28 +// size256 is the size, in bytes, of a SHA-512/256 checksum. +pub const size256 = 32 +// size384 is the size, in bytes, of a SHA-384 checksum. +pub const size384 = 48 +// block_size is the block size, in bytes, of the SHA-512/224, +// SHA-512/256, SHA-384 and SHA-512 hash functions. +pub const block_size = 128 -const ( - chunk = 128 - init0 = u64(0x6a09e667f3bcc908) - init1 = u64(0xbb67ae8584caa73b) - init2 = u64(0x3c6ef372fe94f82b) - init3 = u64(0xa54ff53a5f1d36f1) - init4 = u64(0x510e527fade682d1) - init5 = u64(0x9b05688c2b3e6c1f) - init6 = u64(0x1f83d9abfb41bd6b) - init7 = u64(0x5be0cd19137e2179) - init0_224 = u64(0x8c3d37c819544da2) - init1_224 = u64(0x73e1996689dcd4d6) - init2_224 = u64(0x1dfab7ae32ff9c82) - init3_224 = u64(0x679dd514582f9fcf) - init4_224 = u64(0x0f6d2b697bd44da8) - init5_224 = u64(0x77e36f7304c48942) - init6_224 = u64(0x3f9d85a86a1d36c8) - init7_224 = u64(0x1112e6ad91d692a1) - init0_256 = u64(0x22312194fc2bf72c) - init1_256 = u64(0x9f555fa3c84c64c2) - init2_256 = u64(0x2393b86b6f53b151) - init3_256 = u64(0x963877195940eabd) - init4_256 = u64(0x96283ee2a88effe3) - init5_256 = u64(0xbe5e1e2553863992) - init6_256 = u64(0x2b0199fc2c85b8aa) - init7_256 = u64(0x0eb72ddc81c52ca2) - init0_384 = u64(0xcbbb9d5dc1059ed8) - init1_384 = u64(0x629a292a367cd507) - init2_384 = u64(0x9159015a3070dd17) - init3_384 = u64(0x152fecd8f70e5939) - init4_384 = u64(0x67332667ffc00b31) - init5_384 = u64(0x8eb44a8768581511) - init6_384 = u64(0xdb0c2e0d64f98fa7) - init7_384 = u64(0x47b5481dbefa4fa4) -) +const chunk = 128 +const init0 = u64(0x6a09e667f3bcc908) +const init1 = u64(0xbb67ae8584caa73b) +const init2 = u64(0x3c6ef372fe94f82b) +const init3 = u64(0xa54ff53a5f1d36f1) +const init4 = u64(0x510e527fade682d1) +const init5 = u64(0x9b05688c2b3e6c1f) +const init6 = u64(0x1f83d9abfb41bd6b) +const init7 = u64(0x5be0cd19137e2179) +const init0_224 = u64(0x8c3d37c819544da2) +const init1_224 = u64(0x73e1996689dcd4d6) +const init2_224 = u64(0x1dfab7ae32ff9c82) +const init3_224 = u64(0x679dd514582f9fcf) +const init4_224 = u64(0x0f6d2b697bd44da8) +const init5_224 = u64(0x77e36f7304c48942) +const init6_224 = u64(0x3f9d85a86a1d36c8) +const init7_224 = u64(0x1112e6ad91d692a1) +const init0_256 = u64(0x22312194fc2bf72c) +const init1_256 = u64(0x9f555fa3c84c64c2) +const init2_256 = u64(0x2393b86b6f53b151) +const init3_256 = u64(0x963877195940eabd) +const init4_256 = u64(0x96283ee2a88effe3) +const init5_256 = u64(0xbe5e1e2553863992) +const init6_256 = u64(0x2b0199fc2c85b8aa) +const init7_256 = u64(0x0eb72ddc81c52ca2) +const init0_384 = u64(0xcbbb9d5dc1059ed8) +const init1_384 = u64(0x629a292a367cd507) +const init2_384 = u64(0x9159015a3070dd17) +const init3_384 = u64(0x152fecd8f70e5939) +const init4_384 = u64(0x67332667ffc00b31) +const init5_384 = u64(0x8eb44a8768581511) +const init6_384 = u64(0xdb0c2e0d64f98fa7) +const init7_384 = u64(0x47b5481dbefa4fa4) // Digest represents the partial evaluation of a checksum. struct Digest { diff --git a/vlib/datatypes/bloom_filter.v b/vlib/datatypes/bloom_filter.v index c817076f3e..b42056857d 100644 --- a/vlib/datatypes/bloom_filter.v +++ b/vlib/datatypes/bloom_filter.v @@ -20,17 +20,15 @@ fn empty_cb[T](x T) u32 { } */ -const ( - // Salt values(random values). These salts are XORed with the output of the hash function to give multiple unique hashes. - salts = [ - // vfmt off +// Salt values(random values). These salts are XORed with the output of the hash function to give multiple unique hashes. +const salts = [ + // vfmt off u32(0xefd8c55b),0xa1c57493,0x174c3763,0xc26e60d4, 0x9ec387fe,0xdcdc9e97,0xfc495ddc,0x6a1fa748, 0x8d82a03b,0x38dc692a,0x97d0f42d,0x048a2be3, 0x9b5d83aa,0x2380d32f,0x2437552f,0xcc622295, - // vfmt on - ] -) + // vfmt on +] fn (b &BloomFilter[T]) free() { unsafe { diff --git a/vlib/db/mysql/consts.c.v b/vlib/db/mysql/consts.c.v index 68dcde1f63..fcbeaa626a 100644 --- a/vlib/db/mysql/consts.c.v +++ b/vlib/db/mysql/consts.c.v @@ -2,13 +2,11 @@ module mysql // MySQL refresh flags. // Docs: https://dev.mysql.com/doc/c-api/8.0/en/mysql-refresh.html -pub const ( - refresh_grant = u32(C.REFRESH_GRANT) - refresh_log = u32(C.REFRESH_LOG) - refresh_tables = u32(C.REFRESH_TABLES) - refresh_hosts = u32(C.REFRESH_HOSTS) - refresh_status = u32(C.REFRESH_STATUS) - refresh_threads = u32(C.REFRESH_THREADS) - refresh_slave = u32(C.REFRESH_SLAVE) - refresh_master = u32(C.REFRESH_MASTER) -) +pub const refresh_grant = u32(C.REFRESH_GRANT) +pub const refresh_log = u32(C.REFRESH_LOG) +pub const refresh_tables = u32(C.REFRESH_TABLES) +pub const refresh_hosts = u32(C.REFRESH_HOSTS) +pub const refresh_status = u32(C.REFRESH_STATUS) +pub const refresh_threads = u32(C.REFRESH_THREADS) +pub const refresh_slave = u32(C.REFRESH_SLAVE) +pub const refresh_master = u32(C.REFRESH_MASTER) diff --git a/vlib/db/mysql/stmt.c.v b/vlib/db/mysql/stmt.c.v index e9e717f31f..6b9795c512 100644 --- a/vlib/db/mysql/stmt.c.v +++ b/vlib/db/mysql/stmt.c.v @@ -15,37 +15,35 @@ mut: length &u32 } -const ( - mysql_type_decimal = C.MYSQL_TYPE_DECIMAL - mysql_type_tiny = C.MYSQL_TYPE_TINY - mysql_type_short = C.MYSQL_TYPE_SHORT - mysql_type_long = C.MYSQL_TYPE_LONG - mysql_type_float = C.MYSQL_TYPE_FLOAT - mysql_type_double = C.MYSQL_TYPE_DOUBLE - mysql_type_null = C.MYSQL_TYPE_NULL - mysql_type_timestamp = C.MYSQL_TYPE_TIMESTAMP - mysql_type_longlong = C.MYSQL_TYPE_LONGLONG - mysql_type_int24 = C.MYSQL_TYPE_INT24 - mysql_type_date = C.MYSQL_TYPE_DATE - mysql_type_time = C.MYSQL_TYPE_TIME - mysql_type_datetime = C.MYSQL_TYPE_DATETIME - mysql_type_year = C.MYSQL_TYPE_YEAR - mysql_type_varchar = C.MYSQL_TYPE_VARCHAR - mysql_type_bit = C.MYSQL_TYPE_BIT - mysql_type_timestamp22 = C.MYSQL_TYPE_TIMESTAMP - mysql_type_json = C.MYSQL_TYPE_JSON - mysql_type_newdecimal = C.MYSQL_TYPE_NEWDECIMAL - mysql_type_enum = C.MYSQL_TYPE_ENUM - mysql_type_set = C.MYSQL_TYPE_SET - mysql_type_tiny_blob = C.MYSQL_TYPE_TINY_BLOB - mysql_type_medium_blob = C.MYSQL_TYPE_MEDIUM_BLOB - mysql_type_long_blob = C.MYSQL_TYPE_LONG_BLOB - mysql_type_blob = C.MYSQL_TYPE_BLOB - mysql_type_var_string = C.MYSQL_TYPE_VAR_STRING - mysql_type_string = C.MYSQL_TYPE_STRING - mysql_type_geometry = C.MYSQL_TYPE_GEOMETRY - mysql_no_data = C.MYSQL_NO_DATA -) +const mysql_type_decimal = C.MYSQL_TYPE_DECIMAL +const mysql_type_tiny = C.MYSQL_TYPE_TINY +const mysql_type_short = C.MYSQL_TYPE_SHORT +const mysql_type_long = C.MYSQL_TYPE_LONG +const mysql_type_float = C.MYSQL_TYPE_FLOAT +const mysql_type_double = C.MYSQL_TYPE_DOUBLE +const mysql_type_null = C.MYSQL_TYPE_NULL +const mysql_type_timestamp = C.MYSQL_TYPE_TIMESTAMP +const mysql_type_longlong = C.MYSQL_TYPE_LONGLONG +const mysql_type_int24 = C.MYSQL_TYPE_INT24 +const mysql_type_date = C.MYSQL_TYPE_DATE +const mysql_type_time = C.MYSQL_TYPE_TIME +const mysql_type_datetime = C.MYSQL_TYPE_DATETIME +const mysql_type_year = C.MYSQL_TYPE_YEAR +const mysql_type_varchar = C.MYSQL_TYPE_VARCHAR +const mysql_type_bit = C.MYSQL_TYPE_BIT +const mysql_type_timestamp22 = C.MYSQL_TYPE_TIMESTAMP +const mysql_type_json = C.MYSQL_TYPE_JSON +const mysql_type_newdecimal = C.MYSQL_TYPE_NEWDECIMAL +const mysql_type_enum = C.MYSQL_TYPE_ENUM +const mysql_type_set = C.MYSQL_TYPE_SET +const mysql_type_tiny_blob = C.MYSQL_TYPE_TINY_BLOB +const mysql_type_medium_blob = C.MYSQL_TYPE_MEDIUM_BLOB +const mysql_type_long_blob = C.MYSQL_TYPE_LONG_BLOB +const mysql_type_blob = C.MYSQL_TYPE_BLOB +const mysql_type_var_string = C.MYSQL_TYPE_VAR_STRING +const mysql_type_string = C.MYSQL_TYPE_STRING +const mysql_type_geometry = C.MYSQL_TYPE_GEOMETRY +const mysql_no_data = C.MYSQL_NO_DATA fn C.mysql_stmt_init(&C.MYSQL) &C.MYSQL_STMT fn C.mysql_stmt_prepare(&C.MYSQL_STMT, &char, u32) int diff --git a/vlib/db/sqlite/sqlite.c.v b/vlib/db/sqlite/sqlite.c.v index 18978ea59f..f06997edc7 100644 --- a/vlib/db/sqlite/sqlite.c.v +++ b/vlib/db/sqlite/sqlite.c.v @@ -15,28 +15,26 @@ $if windows { #include "sqlite3.h" // https://www.sqlite.org/rescode.html -pub const ( - sqlite_ok = 0 - sqlite_error = 1 - sqlite_row = 100 - sqlite_done = 101 - sqlite_cantopen = 14 - sqlite_ioerr_read = 266 - sqlite_ioerr_short_read = 522 - sqlite_ioerr_write = 778 - sqlite_ioerr_fsync = 1034 - sqlite_ioerr_fstat = 1802 - sqlite_ioerr_delete = 2570 +pub const sqlite_ok = 0 +pub const sqlite_error = 1 +pub const sqlite_row = 100 +pub const sqlite_done = 101 +pub const sqlite_cantopen = 14 +pub const sqlite_ioerr_read = 266 +pub const sqlite_ioerr_short_read = 522 +pub const sqlite_ioerr_write = 778 +pub const sqlite_ioerr_fsync = 1034 +pub const sqlite_ioerr_fstat = 1802 +pub const sqlite_ioerr_delete = 2570 - sqlite_open_main_db = 0x00000100 - sqlite_open_temp_db = 0x00000200 - sqlite_open_transient_db = 0x00000400 - sqlite_open_main_journal = 0x00000800 - sqlite_open_temp_journal = 0x00001000 - sqlite_open_subjournal = 0x00002000 - sqlite_open_super_journal = 0x00004000 - sqlite_open_wal = 0x00080000 -) +pub const sqlite_open_main_db = 0x00000100 +pub const sqlite_open_temp_db = 0x00000200 +pub const sqlite_open_transient_db = 0x00000400 +pub const sqlite_open_main_journal = 0x00000800 +pub const sqlite_open_temp_journal = 0x00001000 +pub const sqlite_open_subjournal = 0x00002000 +pub const sqlite_open_super_journal = 0x00004000 +pub const sqlite_open_wal = 0x00080000 pub enum SyncMode { off diff --git a/vlib/dl/dl_nix.c.v b/vlib/dl/dl_nix.c.v index 667a166f0a..c7c76b5241 100644 --- a/vlib/dl/dl_nix.c.v +++ b/vlib/dl/dl_nix.c.v @@ -6,14 +6,12 @@ $if linux { #flag -ldl } -pub const ( - rtld_now = C.RTLD_NOW - rtld_lazy = C.RTLD_LAZY - rtld_global = C.RTLD_GLOBAL - rtld_local = C.RTLD_LOCAL - rtld_nodelete = C.RTLD_NODELETE - rtld_noload = C.RTLD_NOLOAD -) +pub const rtld_now = C.RTLD_NOW +pub const rtld_lazy = C.RTLD_LAZY +pub const rtld_global = C.RTLD_GLOBAL +pub const rtld_local = C.RTLD_LOCAL +pub const rtld_nodelete = C.RTLD_NODELETE +pub const rtld_noload = C.RTLD_NOLOAD fn C.dlopen(filename &char, flags int) voidptr diff --git a/vlib/dl/dl_windows.c.v b/vlib/dl/dl_windows.c.v index f4f946b080..a034db53f9 100644 --- a/vlib/dl/dl_windows.c.v +++ b/vlib/dl/dl_windows.c.v @@ -1,13 +1,11 @@ module dl -pub const ( - rtld_now = 0 - rtld_lazy = 0 - rtld_global = 0 - rtld_local = 0 - rtld_nodelete = 0 - rtld_noload = 0 -) +pub const rtld_now = 0 +pub const rtld_lazy = 0 +pub const rtld_global = 0 +pub const rtld_local = 0 +pub const rtld_nodelete = 0 +pub const rtld_noload = 0 fn C.LoadLibrary(libfilename &u16) voidptr diff --git a/vlib/dl/loader/loader.v b/vlib/dl/loader/loader.v index 06201f85d6..3e0c9ea756 100644 --- a/vlib/dl/loader/loader.v +++ b/vlib/dl/loader/loader.v @@ -4,27 +4,23 @@ module loader import dl import os -const ( - dl_no_path_issue_msg = 'no paths to dynamic library' - dl_open_issue_msg = 'could not open dynamic library' - dl_sym_issue_msg = 'could not get optional symbol from dynamic library' - dl_close_issue_msg = 'could not close dynamic library' - dl_register_issue_msg = 'could not register dynamic library loader' -) +const dl_no_path_issue_msg = 'no paths to dynamic library' +const dl_open_issue_msg = 'could not open dynamic library' +const dl_sym_issue_msg = 'could not get optional symbol from dynamic library' +const dl_close_issue_msg = 'could not close dynamic library' +const dl_register_issue_msg = 'could not register dynamic library loader' -pub const ( - dl_no_path_issue_code = 1 - dl_open_issue_code = 1 - dl_sym_issue_code = 2 - dl_close_issue_code = 3 - dl_register_issue_code = 4 +pub const dl_no_path_issue_code = 1 +pub const dl_open_issue_code = 1 +pub const dl_sym_issue_code = 2 +pub const dl_close_issue_code = 3 +pub const dl_register_issue_code = 4 - dl_no_path_issue_err = error_with_code(dl_no_path_issue_msg, dl_no_path_issue_code) - dl_open_issue_err = error_with_code(dl_open_issue_msg, dl_open_issue_code) - dl_sym_issue_err = error_with_code(dl_sym_issue_msg, dl_sym_issue_code) - dl_close_issue_err = error_with_code(dl_close_issue_msg, dl_close_issue_code) - dl_register_issue_err = error_with_code(dl_register_issue_msg, dl_register_issue_code) -) +pub const dl_no_path_issue_err = error_with_code(dl_no_path_issue_msg, dl_no_path_issue_code) +pub const dl_open_issue_err = error_with_code(dl_open_issue_msg, dl_open_issue_code) +pub const dl_sym_issue_err = error_with_code(dl_sym_issue_msg, dl_sym_issue_code) +pub const dl_close_issue_err = error_with_code(dl_close_issue_msg, dl_close_issue_code) +pub const dl_register_issue_err = error_with_code(dl_register_issue_msg, dl_register_issue_code) __global ( registered_dl_loaders map[string]&DynamicLibLoader diff --git a/vlib/dlmalloc/dlmalloc.v b/vlib/dlmalloc/dlmalloc.v index 38dbe795b2..f4b74ccb8c 100644 --- a/vlib/dlmalloc/dlmalloc.v +++ b/vlib/dlmalloc/dlmalloc.v @@ -26,14 +26,12 @@ fn //C.VALGRIND_FREELIKE_BLOCK(addr voidptr, rzB usize) fn //C.VALGRIND_MAKE_MEM_UNDEFINED(addr voidptr, size usize) */ -pub const ( - n_small_bins = 32 - n_tree_bins = 32 - small_bin_shift = 3 - tree_bin_shift = 8 +pub const n_small_bins = 32 +pub const n_tree_bins = 32 +pub const small_bin_shift = 3 +pub const tree_bin_shift = 8 - max_release_check_rate = 4095 -) +pub const max_release_check_rate = 4095 fn usize_leading_zeros(x usize) usize { if sizeof(usize) == 8 { @@ -287,13 +285,11 @@ mut: index u32 } -const ( - pinuse = 1 << 0 - cinuse = 1 << 1 - flag4 = 1 << 2 - inuse = pinuse | cinuse - flag_bits = pinuse | cinuse | flag4 -) +const pinuse = 1 << 0 +const cinuse = 1 << 1 +const flag4 = 1 << 2 +const inuse = pinuse | cinuse +const flag_bits = pinuse | cinuse | flag4 fn fencepost_head() usize { return dlmalloc.inuse | sizeof(usize) diff --git a/vlib/encoding/base32/base32.v b/vlib/encoding/base32/base32.v index 51f9140d1f..c2fc6c26e9 100644 --- a/vlib/encoding/base32/base32.v +++ b/vlib/encoding/base32/base32.v @@ -10,12 +10,12 @@ module base32 -pub const ( - std_padding = `=` // Standard padding character - no_padding = u8(-1) // No padding - std_alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'.bytes() - hex_alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUV'.bytes() -) +pub const std_padding = `=` // Standard padding character + +pub const no_padding = u8(-1) // No padding + +pub const std_alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'.bytes() +pub const hex_alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUV'.bytes() struct Encoding { padding_char u8 diff --git a/vlib/encoding/base64/base64.v b/vlib/encoding/base64/base64.v index 622edb30a1..eb690806a9 100644 --- a/vlib/encoding/base64/base64.v +++ b/vlib/encoding/base64/base64.v @@ -5,15 +5,13 @@ // Last commit: https://github.com/golang/go/commit/9a93baf4d7d13d7d5c67388c93960d78abc8e11e module base64 -const ( - index = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 63, 62, 62, 63, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 63, 0, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51]! - ending_table = [0, 2, 1]! - enc_table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' -) +const index = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 63, 62, 62, 63, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 63, 0, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51]! +const ending_table = [0, 2, 1]! +const enc_table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' // url_decode returns a decoded URL `string` version of // the a base64 url encoded `string` passed in `data`. diff --git a/vlib/encoding/base64/base64_test.v b/vlib/encoding/base64/base64_test.v index 19f50483ce..bf26558c76 100644 --- a/vlib/encoding/base64/base64_test.v +++ b/vlib/encoding/base64/base64_test.v @@ -5,33 +5,31 @@ struct TestPair { encoded string } -const ( - pairs = [ - // RFC 3548 examples - TestPair{'\x14\xfb\x9c\x03\xd9\x7e', 'FPucA9l+'}, - TestPair{'\x14\xfb\x9c\x03\xd9', 'FPucA9k='}, - TestPair{'\x14\xfb\x9c\x03', 'FPucAw=='}, - // RFC 4648 examples - TestPair{'', ''}, - TestPair{'f', 'Zg=='}, - TestPair{'fo', 'Zm8='}, - TestPair{'foo', 'Zm9v'}, - TestPair{'foob', 'Zm9vYg=='}, - TestPair{'fooba', 'Zm9vYmE='}, - TestPair{'foobar', 'Zm9vYmFy'}, - // Wikipedia examples - TestPair{'sure.', 'c3VyZS4='}, - TestPair{'sure', 'c3VyZQ=='}, - TestPair{'sur', 'c3Vy'}, - TestPair{'su', 'c3U='}, - TestPair{'leasure.', 'bGVhc3VyZS4='}, - TestPair{'easure.', 'ZWFzdXJlLg=='}, - TestPair{'asure.', 'YXN1cmUu'}, - TestPair{'sure.', 'c3VyZS4='}, - ] +const pairs = [ + // RFC 3548 examples + TestPair{'\x14\xfb\x9c\x03\xd9\x7e', 'FPucA9l+'}, + TestPair{'\x14\xfb\x9c\x03\xd9', 'FPucA9k='}, + TestPair{'\x14\xfb\x9c\x03', 'FPucAw=='}, + // RFC 4648 examples + TestPair{'', ''}, + TestPair{'f', 'Zg=='}, + TestPair{'fo', 'Zm8='}, + TestPair{'foo', 'Zm9v'}, + TestPair{'foob', 'Zm9vYg=='}, + TestPair{'fooba', 'Zm9vYmE='}, + TestPair{'foobar', 'Zm9vYmFy'}, + // Wikipedia examples + TestPair{'sure.', 'c3VyZS4='}, + TestPair{'sure', 'c3VyZQ=='}, + TestPair{'sur', 'c3Vy'}, + TestPair{'su', 'c3U='}, + TestPair{'leasure.', 'bGVhc3VyZS4='}, + TestPair{'easure.', 'ZWFzdXJlLg=='}, + TestPair{'asure.', 'YXN1cmUu'}, + TestPair{'sure.', 'c3VyZS4='}, +] - man_pair = TestPair{'Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure.', 'TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4='} -) +const man_pair = TestPair{'Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure.', 'TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4='} fn test_decode() { assert base64.decode(man_pair.encoded) == man_pair.decoded.bytes() diff --git a/vlib/encoding/html/escape.v b/vlib/encoding/html/escape.v index 9fda7df705..28a537230c 100644 --- a/vlib/encoding/html/escape.v +++ b/vlib/encoding/html/escape.v @@ -14,12 +14,10 @@ pub struct UnescapeConfig { all bool } -const ( - escape_seq = ['&', '&', '<', '<', '>', '>'] - escape_quote_seq = ['"', '"', "'", '''] - unescape_seq = ['&', '&', '<', '<', '>', '>'] - unescape_quote_seq = ['"', '"', ''', "'"] -) +const escape_seq = ['&', '&', '<', '<', '>', '>'] +const escape_quote_seq = ['"', '"', "'", '''] +const unescape_seq = ['&', '&', '<', '<', '>', '>'] +const unescape_quote_seq = ['"', '"', ''', "'"] // escape converts special characters in the input, specifically "<", ">", and "&" // to HTML-safe sequences. If `quote` is set to true (which is default), quotes in diff --git a/vlib/encoding/utf8/east_asian/east_asian_width.v b/vlib/encoding/utf8/east_asian/east_asian_width.v index d1ac54732c..eb0468e645 100644 --- a/vlib/encoding/utf8/east_asian/east_asian_width.v +++ b/vlib/encoding/utf8/east_asian/east_asian_width.v @@ -61,1144 +61,1142 @@ struct EAWEntry { } // EastAsianWidth-13.0.0.txt -const ( - east_asian_width_data = [ - EAWEntry{.neutral, 0x0000, 32}, - EAWEntry{.narrow, 0x0020, 95}, - EAWEntry{.neutral, 0x007f, 34}, - EAWEntry{.ambiguous, 0x00a1, 1}, - EAWEntry{.narrow, 0x00a2, 2}, - EAWEntry{.ambiguous, 0x00a4, 1}, - EAWEntry{.narrow, 0x00a5, 2}, - EAWEntry{.ambiguous, 0x00a7, 2}, - EAWEntry{.neutral, 0x00a9, 1}, - EAWEntry{.ambiguous, 0x00aa, 1}, - EAWEntry{.neutral, 0x00ab, 1}, - EAWEntry{.narrow, 0x00ac, 1}, - EAWEntry{.ambiguous, 0x00ad, 2}, - EAWEntry{.narrow, 0x00af, 1}, - EAWEntry{.ambiguous, 0x00b0, 5}, - EAWEntry{.neutral, 0x00b5, 1}, - EAWEntry{.ambiguous, 0x00b6, 5}, - EAWEntry{.neutral, 0x00bb, 1}, - EAWEntry{.ambiguous, 0x00bc, 4}, - EAWEntry{.neutral, 0x00c0, 6}, - EAWEntry{.ambiguous, 0x00c6, 1}, - EAWEntry{.neutral, 0x00c7, 9}, - EAWEntry{.ambiguous, 0x00d0, 1}, - EAWEntry{.neutral, 0x00d1, 6}, - EAWEntry{.ambiguous, 0x00d7, 2}, - EAWEntry{.neutral, 0x00d9, 5}, - EAWEntry{.ambiguous, 0x00de, 4}, - EAWEntry{.neutral, 0x00e2, 4}, - EAWEntry{.ambiguous, 0x00e6, 1}, - EAWEntry{.neutral, 0x00e7, 1}, - EAWEntry{.ambiguous, 0x00e8, 3}, - EAWEntry{.neutral, 0x00eb, 1}, - EAWEntry{.ambiguous, 0x00ec, 2}, - EAWEntry{.neutral, 0x00ee, 2}, - EAWEntry{.ambiguous, 0x00f0, 1}, - EAWEntry{.neutral, 0x00f1, 1}, - EAWEntry{.ambiguous, 0x00f2, 2}, - EAWEntry{.neutral, 0x00f4, 3}, - EAWEntry{.ambiguous, 0x00f7, 4}, - EAWEntry{.neutral, 0x00fb, 1}, - EAWEntry{.ambiguous, 0x00fc, 1}, - EAWEntry{.neutral, 0x00fd, 1}, - EAWEntry{.ambiguous, 0x00fe, 1}, - EAWEntry{.neutral, 0x00ff, 2}, - EAWEntry{.ambiguous, 0x0101, 1}, - EAWEntry{.neutral, 0x0102, 15}, - EAWEntry{.ambiguous, 0x0111, 1}, - EAWEntry{.neutral, 0x0112, 1}, - EAWEntry{.ambiguous, 0x0113, 1}, - EAWEntry{.neutral, 0x0114, 7}, - EAWEntry{.ambiguous, 0x011b, 1}, - EAWEntry{.neutral, 0x011c, 10}, - EAWEntry{.ambiguous, 0x0126, 2}, - EAWEntry{.neutral, 0x0128, 3}, - EAWEntry{.ambiguous, 0x012b, 1}, - EAWEntry{.neutral, 0x012c, 5}, - EAWEntry{.ambiguous, 0x0131, 3}, - EAWEntry{.neutral, 0x0134, 4}, - EAWEntry{.ambiguous, 0x0138, 1}, - EAWEntry{.neutral, 0x0139, 6}, - EAWEntry{.ambiguous, 0x013f, 4}, - EAWEntry{.neutral, 0x0143, 1}, - EAWEntry{.ambiguous, 0x0144, 1}, - EAWEntry{.neutral, 0x0145, 3}, - EAWEntry{.ambiguous, 0x0148, 4}, - EAWEntry{.neutral, 0x014c, 1}, - EAWEntry{.ambiguous, 0x014d, 1}, - EAWEntry{.neutral, 0x014e, 4}, - EAWEntry{.ambiguous, 0x0152, 2}, - EAWEntry{.neutral, 0x0154, 18}, - EAWEntry{.ambiguous, 0x0166, 2}, - EAWEntry{.neutral, 0x0168, 3}, - EAWEntry{.ambiguous, 0x016b, 1}, - EAWEntry{.neutral, 0x016c, 98}, - EAWEntry{.ambiguous, 0x01ce, 1}, - EAWEntry{.neutral, 0x01cf, 1}, - EAWEntry{.ambiguous, 0x01d0, 1}, - EAWEntry{.neutral, 0x01d1, 1}, - EAWEntry{.ambiguous, 0x01d2, 1}, - EAWEntry{.neutral, 0x01d3, 1}, - EAWEntry{.ambiguous, 0x01d4, 1}, - EAWEntry{.neutral, 0x01d5, 1}, - EAWEntry{.ambiguous, 0x01d6, 1}, - EAWEntry{.neutral, 0x01d7, 1}, - EAWEntry{.ambiguous, 0x01d8, 1}, - EAWEntry{.neutral, 0x01d9, 1}, - EAWEntry{.ambiguous, 0x01da, 1}, - EAWEntry{.neutral, 0x01db, 1}, - EAWEntry{.ambiguous, 0x01dc, 1}, - EAWEntry{.neutral, 0x01dd, 116}, - EAWEntry{.ambiguous, 0x0251, 1}, - EAWEntry{.neutral, 0x0252, 15}, - EAWEntry{.ambiguous, 0x0261, 1}, - EAWEntry{.neutral, 0x0262, 98}, - EAWEntry{.ambiguous, 0x02c4, 1}, - EAWEntry{.neutral, 0x02c5, 2}, - EAWEntry{.ambiguous, 0x02c7, 1}, - EAWEntry{.neutral, 0x02c8, 1}, - EAWEntry{.ambiguous, 0x02c9, 3}, - EAWEntry{.neutral, 0x02cc, 1}, - EAWEntry{.ambiguous, 0x02cd, 1}, - EAWEntry{.neutral, 0x02ce, 2}, - EAWEntry{.ambiguous, 0x02d0, 1}, - EAWEntry{.neutral, 0x02d1, 7}, - EAWEntry{.ambiguous, 0x02d8, 4}, - EAWEntry{.neutral, 0x02dc, 1}, - EAWEntry{.ambiguous, 0x02dd, 1}, - EAWEntry{.neutral, 0x02de, 1}, - EAWEntry{.ambiguous, 0x02df, 1}, - EAWEntry{.neutral, 0x02e0, 32}, - EAWEntry{.ambiguous, 0x0300, 112}, - EAWEntry{.neutral, 0x0370, 8}, - EAWEntry{.neutral, 0x037a, 6}, - EAWEntry{.neutral, 0x0384, 7}, - EAWEntry{.neutral, 0x038c, 1}, - EAWEntry{.neutral, 0x038e, 3}, - EAWEntry{.ambiguous, 0x0391, 17}, - EAWEntry{.ambiguous, 0x03a3, 7}, - EAWEntry{.neutral, 0x03aa, 7}, - EAWEntry{.ambiguous, 0x03b1, 17}, - EAWEntry{.neutral, 0x03c2, 1}, - EAWEntry{.ambiguous, 0x03c3, 7}, - EAWEntry{.neutral, 0x03ca, 55}, - EAWEntry{.ambiguous, 0x0401, 1}, - EAWEntry{.neutral, 0x0402, 14}, - EAWEntry{.ambiguous, 0x0410, 64}, - EAWEntry{.neutral, 0x0450, 1}, - EAWEntry{.ambiguous, 0x0451, 1}, - EAWEntry{.neutral, 0x0452, 222}, - EAWEntry{.neutral, 0x0531, 38}, - EAWEntry{.neutral, 0x0559, 50}, - EAWEntry{.neutral, 0x058d, 3}, - EAWEntry{.neutral, 0x0591, 55}, - EAWEntry{.neutral, 0x05d0, 27}, - EAWEntry{.neutral, 0x05ef, 6}, - EAWEntry{.neutral, 0x0600, 29}, - EAWEntry{.neutral, 0x061e, 240}, - EAWEntry{.neutral, 0x070f, 60}, - EAWEntry{.neutral, 0x074d, 101}, - EAWEntry{.neutral, 0x07c0, 59}, - EAWEntry{.neutral, 0x07fd, 49}, - EAWEntry{.neutral, 0x0830, 15}, - EAWEntry{.neutral, 0x0840, 28}, - EAWEntry{.neutral, 0x085e, 1}, - EAWEntry{.neutral, 0x0860, 11}, - EAWEntry{.neutral, 0x08a0, 21}, - EAWEntry{.neutral, 0x08b6, 18}, - EAWEntry{.neutral, 0x08d3, 177}, - EAWEntry{.neutral, 0x0985, 8}, - EAWEntry{.neutral, 0x098f, 2}, - EAWEntry{.neutral, 0x0993, 22}, - EAWEntry{.neutral, 0x09aa, 7}, - EAWEntry{.neutral, 0x09b2, 1}, - EAWEntry{.neutral, 0x09b6, 4}, - EAWEntry{.neutral, 0x09bc, 9}, - EAWEntry{.neutral, 0x09c7, 2}, - EAWEntry{.neutral, 0x09cb, 4}, - EAWEntry{.neutral, 0x09d7, 1}, - EAWEntry{.neutral, 0x09dc, 2}, - EAWEntry{.neutral, 0x09df, 5}, - EAWEntry{.neutral, 0x09e6, 25}, - EAWEntry{.neutral, 0x0a01, 3}, - EAWEntry{.neutral, 0x0a05, 6}, - EAWEntry{.neutral, 0x0a0f, 2}, - EAWEntry{.neutral, 0x0a13, 22}, - EAWEntry{.neutral, 0x0a2a, 7}, - EAWEntry{.neutral, 0x0a32, 2}, - EAWEntry{.neutral, 0x0a35, 2}, - EAWEntry{.neutral, 0x0a38, 2}, - EAWEntry{.neutral, 0x0a3c, 1}, - EAWEntry{.neutral, 0x0a3e, 5}, - EAWEntry{.neutral, 0x0a47, 2}, - EAWEntry{.neutral, 0x0a4b, 3}, - EAWEntry{.neutral, 0x0a51, 1}, - EAWEntry{.neutral, 0x0a59, 4}, - EAWEntry{.neutral, 0x0a5e, 1}, - EAWEntry{.neutral, 0x0a66, 17}, - EAWEntry{.neutral, 0x0a81, 3}, - EAWEntry{.neutral, 0x0a85, 9}, - EAWEntry{.neutral, 0x0a8f, 3}, - EAWEntry{.neutral, 0x0a93, 22}, - EAWEntry{.neutral, 0x0aaa, 7}, - EAWEntry{.neutral, 0x0ab2, 2}, - EAWEntry{.neutral, 0x0ab5, 5}, - EAWEntry{.neutral, 0x0abc, 10}, - EAWEntry{.neutral, 0x0ac7, 3}, - EAWEntry{.neutral, 0x0acb, 3}, - EAWEntry{.neutral, 0x0ad0, 1}, - EAWEntry{.neutral, 0x0ae0, 4}, - EAWEntry{.neutral, 0x0ae6, 12}, - EAWEntry{.neutral, 0x0af9, 7}, - EAWEntry{.neutral, 0x0b01, 3}, - EAWEntry{.neutral, 0x0b05, 8}, - EAWEntry{.neutral, 0x0b0f, 2}, - EAWEntry{.neutral, 0x0b13, 22}, - EAWEntry{.neutral, 0x0b2a, 7}, - EAWEntry{.neutral, 0x0b32, 2}, - EAWEntry{.neutral, 0x0b35, 5}, - EAWEntry{.neutral, 0x0b3c, 9}, - EAWEntry{.neutral, 0x0b47, 2}, - EAWEntry{.neutral, 0x0b4b, 3}, - EAWEntry{.neutral, 0x0b55, 3}, - EAWEntry{.neutral, 0x0b5c, 2}, - EAWEntry{.neutral, 0x0b5f, 5}, - EAWEntry{.neutral, 0x0b66, 18}, - EAWEntry{.neutral, 0x0b82, 2}, - EAWEntry{.neutral, 0x0b85, 6}, - EAWEntry{.neutral, 0x0b8e, 3}, - EAWEntry{.neutral, 0x0b92, 4}, - EAWEntry{.neutral, 0x0b99, 2}, - EAWEntry{.neutral, 0x0b9c, 1}, - EAWEntry{.neutral, 0x0b9e, 2}, - EAWEntry{.neutral, 0x0ba3, 2}, - EAWEntry{.neutral, 0x0ba8, 3}, - EAWEntry{.neutral, 0x0bae, 12}, - EAWEntry{.neutral, 0x0bbe, 5}, - EAWEntry{.neutral, 0x0bc6, 3}, - EAWEntry{.neutral, 0x0bca, 4}, - EAWEntry{.neutral, 0x0bd0, 1}, - EAWEntry{.neutral, 0x0bd7, 1}, - EAWEntry{.neutral, 0x0be6, 21}, - EAWEntry{.neutral, 0x0c00, 13}, - EAWEntry{.neutral, 0x0c0e, 3}, - EAWEntry{.neutral, 0x0c12, 23}, - EAWEntry{.neutral, 0x0c2a, 16}, - EAWEntry{.neutral, 0x0c3d, 8}, - EAWEntry{.neutral, 0x0c46, 3}, - EAWEntry{.neutral, 0x0c4a, 4}, - EAWEntry{.neutral, 0x0c55, 2}, - EAWEntry{.neutral, 0x0c58, 3}, - EAWEntry{.neutral, 0x0c60, 4}, - EAWEntry{.neutral, 0x0c66, 10}, - EAWEntry{.neutral, 0x0c77, 22}, - EAWEntry{.neutral, 0x0c8e, 3}, - EAWEntry{.neutral, 0x0c92, 23}, - EAWEntry{.neutral, 0x0caa, 10}, - EAWEntry{.neutral, 0x0cb5, 5}, - EAWEntry{.neutral, 0x0cbc, 9}, - EAWEntry{.neutral, 0x0cc6, 3}, - EAWEntry{.neutral, 0x0cca, 4}, - EAWEntry{.neutral, 0x0cd5, 2}, - EAWEntry{.neutral, 0x0cde, 1}, - EAWEntry{.neutral, 0x0ce0, 4}, - EAWEntry{.neutral, 0x0ce6, 10}, - EAWEntry{.neutral, 0x0cf1, 2}, - EAWEntry{.neutral, 0x0d00, 13}, - EAWEntry{.neutral, 0x0d0e, 3}, - EAWEntry{.neutral, 0x0d12, 51}, - EAWEntry{.neutral, 0x0d46, 3}, - EAWEntry{.neutral, 0x0d4a, 6}, - EAWEntry{.neutral, 0x0d54, 16}, - EAWEntry{.neutral, 0x0d66, 26}, - EAWEntry{.neutral, 0x0d81, 3}, - EAWEntry{.neutral, 0x0d85, 18}, - EAWEntry{.neutral, 0x0d9a, 24}, - EAWEntry{.neutral, 0x0db3, 9}, - EAWEntry{.neutral, 0x0dbd, 1}, - EAWEntry{.neutral, 0x0dc0, 7}, - EAWEntry{.neutral, 0x0dca, 1}, - EAWEntry{.neutral, 0x0dcf, 6}, - EAWEntry{.neutral, 0x0dd6, 1}, - EAWEntry{.neutral, 0x0dd8, 8}, - EAWEntry{.neutral, 0x0de6, 10}, - EAWEntry{.neutral, 0x0df2, 3}, - EAWEntry{.neutral, 0x0e01, 58}, - EAWEntry{.neutral, 0x0e3f, 29}, - EAWEntry{.neutral, 0x0e81, 2}, - EAWEntry{.neutral, 0x0e84, 1}, - EAWEntry{.neutral, 0x0e86, 5}, - EAWEntry{.neutral, 0x0e8c, 24}, - EAWEntry{.neutral, 0x0ea5, 1}, - EAWEntry{.neutral, 0x0ea7, 23}, - EAWEntry{.neutral, 0x0ec0, 5}, - EAWEntry{.neutral, 0x0ec6, 1}, - EAWEntry{.neutral, 0x0ec8, 6}, - EAWEntry{.neutral, 0x0ed0, 10}, - EAWEntry{.neutral, 0x0edc, 4}, - EAWEntry{.neutral, 0x0f00, 72}, - EAWEntry{.neutral, 0x0f49, 36}, - EAWEntry{.neutral, 0x0f71, 39}, - EAWEntry{.neutral, 0x0f99, 36}, - EAWEntry{.neutral, 0x0fbe, 15}, - EAWEntry{.neutral, 0x0fce, 13}, - EAWEntry{.neutral, 0x1000, 198}, - EAWEntry{.neutral, 0x10c7, 1}, - EAWEntry{.neutral, 0x10cd, 1}, - EAWEntry{.neutral, 0x10d0, 48}, - EAWEntry{.wide, 0x1100, 96}, - EAWEntry{.neutral, 0x1160, 233}, - EAWEntry{.neutral, 0x124a, 4}, - EAWEntry{.neutral, 0x1250, 7}, - EAWEntry{.neutral, 0x1258, 1}, - EAWEntry{.neutral, 0x125a, 4}, - EAWEntry{.neutral, 0x1260, 41}, - EAWEntry{.neutral, 0x128a, 4}, - EAWEntry{.neutral, 0x1290, 33}, - EAWEntry{.neutral, 0x12b2, 4}, - EAWEntry{.neutral, 0x12b8, 7}, - EAWEntry{.neutral, 0x12c0, 1}, - EAWEntry{.neutral, 0x12c2, 4}, - EAWEntry{.neutral, 0x12c8, 15}, - EAWEntry{.neutral, 0x12d8, 57}, - EAWEntry{.neutral, 0x1312, 4}, - EAWEntry{.neutral, 0x1318, 67}, - EAWEntry{.neutral, 0x135d, 32}, - EAWEntry{.neutral, 0x1380, 26}, - EAWEntry{.neutral, 0x13a0, 86}, - EAWEntry{.neutral, 0x13f8, 6}, - EAWEntry{.neutral, 0x1400, 669}, - EAWEntry{.neutral, 0x16a0, 89}, - EAWEntry{.neutral, 0x1700, 13}, - EAWEntry{.neutral, 0x170e, 7}, - EAWEntry{.neutral, 0x1720, 23}, - EAWEntry{.neutral, 0x1740, 20}, - EAWEntry{.neutral, 0x1760, 13}, - EAWEntry{.neutral, 0x176e, 3}, - EAWEntry{.neutral, 0x1772, 2}, - EAWEntry{.neutral, 0x1780, 94}, - EAWEntry{.neutral, 0x17e0, 10}, - EAWEntry{.neutral, 0x17f0, 10}, - EAWEntry{.neutral, 0x1800, 15}, - EAWEntry{.neutral, 0x1810, 10}, - EAWEntry{.neutral, 0x1820, 89}, - EAWEntry{.neutral, 0x1880, 43}, - EAWEntry{.neutral, 0x18b0, 70}, - EAWEntry{.neutral, 0x1900, 31}, - EAWEntry{.neutral, 0x1920, 12}, - EAWEntry{.neutral, 0x1930, 12}, - EAWEntry{.neutral, 0x1940, 1}, - EAWEntry{.neutral, 0x1944, 42}, - EAWEntry{.neutral, 0x1970, 5}, - EAWEntry{.neutral, 0x1980, 44}, - EAWEntry{.neutral, 0x19b0, 26}, - EAWEntry{.neutral, 0x19d0, 11}, - EAWEntry{.neutral, 0x19de, 62}, - EAWEntry{.neutral, 0x1a1e, 65}, - EAWEntry{.neutral, 0x1a60, 29}, - EAWEntry{.neutral, 0x1a7f, 11}, - EAWEntry{.neutral, 0x1a90, 10}, - EAWEntry{.neutral, 0x1aa0, 14}, - EAWEntry{.neutral, 0x1ab0, 17}, - EAWEntry{.neutral, 0x1b00, 76}, - EAWEntry{.neutral, 0x1b50, 45}, - EAWEntry{.neutral, 0x1b80, 116}, - EAWEntry{.neutral, 0x1bfc, 60}, - EAWEntry{.neutral, 0x1c3b, 15}, - EAWEntry{.neutral, 0x1c4d, 60}, - EAWEntry{.neutral, 0x1c90, 43}, - EAWEntry{.neutral, 0x1cbd, 11}, - EAWEntry{.neutral, 0x1cd0, 43}, - EAWEntry{.neutral, 0x1d00, 250}, - EAWEntry{.neutral, 0x1dfb, 283}, - EAWEntry{.neutral, 0x1f18, 6}, - EAWEntry{.neutral, 0x1f20, 38}, - EAWEntry{.neutral, 0x1f48, 6}, - EAWEntry{.neutral, 0x1f50, 8}, - EAWEntry{.neutral, 0x1f59, 1}, - EAWEntry{.neutral, 0x1f5b, 1}, - EAWEntry{.neutral, 0x1f5d, 1}, - EAWEntry{.neutral, 0x1f5f, 31}, - EAWEntry{.neutral, 0x1f80, 53}, - EAWEntry{.neutral, 0x1fb6, 15}, - EAWEntry{.neutral, 0x1fc6, 14}, - EAWEntry{.neutral, 0x1fd6, 6}, - EAWEntry{.neutral, 0x1fdd, 19}, - EAWEntry{.neutral, 0x1ff2, 3}, - EAWEntry{.neutral, 0x1ff6, 9}, - EAWEntry{.neutral, 0x2000, 16}, - EAWEntry{.ambiguous, 0x2010, 1}, - EAWEntry{.neutral, 0x2011, 2}, - EAWEntry{.ambiguous, 0x2013, 4}, - EAWEntry{.neutral, 0x2017, 1}, - EAWEntry{.ambiguous, 0x2018, 2}, - EAWEntry{.neutral, 0x201a, 2}, - EAWEntry{.ambiguous, 0x201c, 2}, - EAWEntry{.neutral, 0x201e, 2}, - EAWEntry{.ambiguous, 0x2020, 3}, - EAWEntry{.neutral, 0x2023, 1}, - EAWEntry{.ambiguous, 0x2024, 4}, - EAWEntry{.neutral, 0x2028, 8}, - EAWEntry{.ambiguous, 0x2030, 1}, - EAWEntry{.neutral, 0x2031, 1}, - EAWEntry{.ambiguous, 0x2032, 2}, - EAWEntry{.neutral, 0x2034, 1}, - EAWEntry{.ambiguous, 0x2035, 1}, - EAWEntry{.neutral, 0x2036, 5}, - EAWEntry{.ambiguous, 0x203b, 1}, - EAWEntry{.neutral, 0x203c, 2}, - EAWEntry{.ambiguous, 0x203e, 1}, - EAWEntry{.neutral, 0x203f, 38}, - EAWEntry{.neutral, 0x2066, 12}, - EAWEntry{.ambiguous, 0x2074, 1}, - EAWEntry{.neutral, 0x2075, 10}, - EAWEntry{.ambiguous, 0x207f, 1}, - EAWEntry{.neutral, 0x2080, 1}, - EAWEntry{.ambiguous, 0x2081, 4}, - EAWEntry{.neutral, 0x2085, 10}, - EAWEntry{.neutral, 0x2090, 13}, - EAWEntry{.neutral, 0x20a0, 9}, - EAWEntry{.half, 0x20a9, 1}, - EAWEntry{.neutral, 0x20aa, 2}, - EAWEntry{.ambiguous, 0x20ac, 1}, - EAWEntry{.neutral, 0x20ad, 19}, - EAWEntry{.neutral, 0x20d0, 33}, - EAWEntry{.neutral, 0x2100, 3}, - EAWEntry{.ambiguous, 0x2103, 1}, - EAWEntry{.neutral, 0x2104, 1}, - EAWEntry{.ambiguous, 0x2105, 1}, - EAWEntry{.neutral, 0x2106, 3}, - EAWEntry{.ambiguous, 0x2109, 1}, - EAWEntry{.neutral, 0x210a, 9}, - EAWEntry{.ambiguous, 0x2113, 1}, - EAWEntry{.neutral, 0x2114, 2}, - EAWEntry{.ambiguous, 0x2116, 1}, - EAWEntry{.neutral, 0x2117, 10}, - EAWEntry{.ambiguous, 0x2121, 2}, - EAWEntry{.neutral, 0x2123, 3}, - EAWEntry{.ambiguous, 0x2126, 1}, - EAWEntry{.neutral, 0x2127, 4}, - EAWEntry{.ambiguous, 0x212b, 1}, - EAWEntry{.neutral, 0x212c, 39}, - EAWEntry{.ambiguous, 0x2153, 2}, - EAWEntry{.neutral, 0x2155, 6}, - EAWEntry{.ambiguous, 0x215b, 4}, - EAWEntry{.neutral, 0x215f, 1}, - EAWEntry{.ambiguous, 0x2160, 12}, - EAWEntry{.neutral, 0x216c, 4}, - EAWEntry{.ambiguous, 0x2170, 10}, - EAWEntry{.neutral, 0x217a, 15}, - EAWEntry{.ambiguous, 0x2189, 1}, - EAWEntry{.neutral, 0x218a, 2}, - EAWEntry{.ambiguous, 0x2190, 10}, - EAWEntry{.neutral, 0x219a, 30}, - EAWEntry{.ambiguous, 0x21b8, 2}, - EAWEntry{.neutral, 0x21ba, 24}, - EAWEntry{.ambiguous, 0x21d2, 1}, - EAWEntry{.neutral, 0x21d3, 1}, - EAWEntry{.ambiguous, 0x21d4, 1}, - EAWEntry{.neutral, 0x21d5, 18}, - EAWEntry{.ambiguous, 0x21e7, 1}, - EAWEntry{.neutral, 0x21e8, 24}, - EAWEntry{.ambiguous, 0x2200, 1}, - EAWEntry{.neutral, 0x2201, 1}, - EAWEntry{.ambiguous, 0x2202, 2}, - EAWEntry{.neutral, 0x2204, 3}, - EAWEntry{.ambiguous, 0x2207, 2}, - EAWEntry{.neutral, 0x2209, 2}, - EAWEntry{.ambiguous, 0x220b, 1}, - EAWEntry{.neutral, 0x220c, 3}, - EAWEntry{.ambiguous, 0x220f, 1}, - EAWEntry{.neutral, 0x2210, 1}, - EAWEntry{.ambiguous, 0x2211, 1}, - EAWEntry{.neutral, 0x2212, 3}, - EAWEntry{.ambiguous, 0x2215, 1}, - EAWEntry{.neutral, 0x2216, 4}, - EAWEntry{.ambiguous, 0x221a, 1}, - EAWEntry{.neutral, 0x221b, 2}, - EAWEntry{.ambiguous, 0x221d, 4}, - EAWEntry{.neutral, 0x2221, 2}, - EAWEntry{.ambiguous, 0x2223, 1}, - EAWEntry{.neutral, 0x2224, 1}, - EAWEntry{.ambiguous, 0x2225, 1}, - EAWEntry{.neutral, 0x2226, 1}, - EAWEntry{.ambiguous, 0x2227, 6}, - EAWEntry{.neutral, 0x222d, 1}, - EAWEntry{.ambiguous, 0x222e, 1}, - EAWEntry{.neutral, 0x222f, 5}, - EAWEntry{.ambiguous, 0x2234, 4}, - EAWEntry{.neutral, 0x2238, 4}, - EAWEntry{.ambiguous, 0x223c, 2}, - EAWEntry{.neutral, 0x223e, 10}, - EAWEntry{.ambiguous, 0x2248, 1}, - EAWEntry{.neutral, 0x2249, 3}, - EAWEntry{.ambiguous, 0x224c, 1}, - EAWEntry{.neutral, 0x224d, 5}, - EAWEntry{.ambiguous, 0x2252, 1}, - EAWEntry{.neutral, 0x2253, 13}, - EAWEntry{.ambiguous, 0x2260, 2}, - EAWEntry{.neutral, 0x2262, 2}, - EAWEntry{.ambiguous, 0x2264, 4}, - EAWEntry{.neutral, 0x2268, 2}, - EAWEntry{.ambiguous, 0x226a, 2}, - EAWEntry{.neutral, 0x226c, 2}, - EAWEntry{.ambiguous, 0x226e, 2}, - EAWEntry{.neutral, 0x2270, 18}, - EAWEntry{.ambiguous, 0x2282, 2}, - EAWEntry{.neutral, 0x2284, 2}, - EAWEntry{.ambiguous, 0x2286, 2}, - EAWEntry{.neutral, 0x2288, 13}, - EAWEntry{.ambiguous, 0x2295, 1}, - EAWEntry{.neutral, 0x2296, 3}, - EAWEntry{.ambiguous, 0x2299, 1}, - EAWEntry{.neutral, 0x229a, 11}, - EAWEntry{.ambiguous, 0x22a5, 1}, - EAWEntry{.neutral, 0x22a6, 25}, - EAWEntry{.ambiguous, 0x22bf, 1}, - EAWEntry{.neutral, 0x22c0, 82}, - EAWEntry{.ambiguous, 0x2312, 1}, - EAWEntry{.neutral, 0x2313, 7}, - EAWEntry{.wide, 0x231a, 2}, - EAWEntry{.neutral, 0x231c, 13}, - EAWEntry{.wide, 0x2329, 2}, - EAWEntry{.neutral, 0x232b, 190}, - EAWEntry{.wide, 0x23e9, 4}, - EAWEntry{.neutral, 0x23ed, 3}, - EAWEntry{.wide, 0x23f0, 1}, - EAWEntry{.neutral, 0x23f1, 2}, - EAWEntry{.wide, 0x23f3, 1}, - EAWEntry{.neutral, 0x23f4, 51}, - EAWEntry{.neutral, 0x2440, 11}, - EAWEntry{.ambiguous, 0x2460, 138}, - EAWEntry{.neutral, 0x24ea, 1}, - EAWEntry{.ambiguous, 0x24eb, 97}, - EAWEntry{.neutral, 0x254c, 4}, - EAWEntry{.ambiguous, 0x2550, 36}, - EAWEntry{.neutral, 0x2574, 12}, - EAWEntry{.ambiguous, 0x2580, 16}, - EAWEntry{.neutral, 0x2590, 2}, - EAWEntry{.ambiguous, 0x2592, 4}, - EAWEntry{.neutral, 0x2596, 10}, - EAWEntry{.ambiguous, 0x25a0, 2}, - EAWEntry{.neutral, 0x25a2, 1}, - EAWEntry{.ambiguous, 0x25a3, 7}, - EAWEntry{.neutral, 0x25aa, 8}, - EAWEntry{.ambiguous, 0x25b2, 2}, - EAWEntry{.neutral, 0x25b4, 2}, - EAWEntry{.ambiguous, 0x25b6, 2}, - EAWEntry{.neutral, 0x25b8, 4}, - EAWEntry{.ambiguous, 0x25bc, 2}, - EAWEntry{.neutral, 0x25be, 2}, - EAWEntry{.ambiguous, 0x25c0, 2}, - EAWEntry{.neutral, 0x25c2, 4}, - EAWEntry{.ambiguous, 0x25c6, 3}, - EAWEntry{.neutral, 0x25c9, 2}, - EAWEntry{.ambiguous, 0x25cb, 1}, - EAWEntry{.neutral, 0x25cc, 2}, - EAWEntry{.ambiguous, 0x25ce, 4}, - EAWEntry{.neutral, 0x25d2, 16}, - EAWEntry{.ambiguous, 0x25e2, 4}, - EAWEntry{.neutral, 0x25e6, 9}, - EAWEntry{.ambiguous, 0x25ef, 1}, - EAWEntry{.neutral, 0x25f0, 13}, - EAWEntry{.wide, 0x25fd, 2}, - EAWEntry{.neutral, 0x25ff, 6}, - EAWEntry{.ambiguous, 0x2605, 2}, - EAWEntry{.neutral, 0x2607, 2}, - EAWEntry{.ambiguous, 0x2609, 1}, - EAWEntry{.neutral, 0x260a, 4}, - EAWEntry{.ambiguous, 0x260e, 2}, - EAWEntry{.neutral, 0x2610, 4}, - EAWEntry{.wide, 0x2614, 2}, - EAWEntry{.neutral, 0x2616, 6}, - EAWEntry{.ambiguous, 0x261c, 1}, - EAWEntry{.neutral, 0x261d, 1}, - EAWEntry{.ambiguous, 0x261e, 1}, - EAWEntry{.neutral, 0x261f, 33}, - EAWEntry{.ambiguous, 0x2640, 1}, - EAWEntry{.neutral, 0x2641, 1}, - EAWEntry{.ambiguous, 0x2642, 1}, - EAWEntry{.neutral, 0x2643, 5}, - EAWEntry{.wide, 0x2648, 12}, - EAWEntry{.neutral, 0x2654, 12}, - EAWEntry{.ambiguous, 0x2660, 2}, - EAWEntry{.neutral, 0x2662, 1}, - EAWEntry{.ambiguous, 0x2663, 3}, - EAWEntry{.neutral, 0x2666, 1}, - EAWEntry{.ambiguous, 0x2667, 4}, - EAWEntry{.neutral, 0x266b, 1}, - EAWEntry{.ambiguous, 0x266c, 2}, - EAWEntry{.neutral, 0x266e, 1}, - EAWEntry{.ambiguous, 0x266f, 1}, - EAWEntry{.neutral, 0x2670, 15}, - EAWEntry{.wide, 0x267f, 1}, - EAWEntry{.neutral, 0x2680, 19}, - EAWEntry{.wide, 0x2693, 1}, - EAWEntry{.neutral, 0x2694, 10}, - EAWEntry{.ambiguous, 0x269e, 2}, - EAWEntry{.neutral, 0x26a0, 1}, - EAWEntry{.wide, 0x26a1, 1}, - EAWEntry{.neutral, 0x26a2, 8}, - EAWEntry{.wide, 0x26aa, 2}, - EAWEntry{.neutral, 0x26ac, 17}, - EAWEntry{.wide, 0x26bd, 2}, - EAWEntry{.ambiguous, 0x26bf, 1}, - EAWEntry{.neutral, 0x26c0, 4}, - EAWEntry{.wide, 0x26c4, 2}, - EAWEntry{.ambiguous, 0x26c6, 8}, - EAWEntry{.wide, 0x26ce, 1}, - EAWEntry{.ambiguous, 0x26cf, 5}, - EAWEntry{.wide, 0x26d4, 1}, - EAWEntry{.ambiguous, 0x26d5, 13}, - EAWEntry{.neutral, 0x26e2, 1}, - EAWEntry{.ambiguous, 0x26e3, 1}, - EAWEntry{.neutral, 0x26e4, 4}, - EAWEntry{.ambiguous, 0x26e8, 2}, - EAWEntry{.wide, 0x26ea, 1}, - EAWEntry{.ambiguous, 0x26eb, 7}, - EAWEntry{.wide, 0x26f2, 2}, - EAWEntry{.ambiguous, 0x26f4, 1}, - EAWEntry{.wide, 0x26f5, 1}, - EAWEntry{.ambiguous, 0x26f6, 4}, - EAWEntry{.wide, 0x26fa, 1}, - EAWEntry{.ambiguous, 0x26fb, 2}, - EAWEntry{.wide, 0x26fd, 1}, - EAWEntry{.ambiguous, 0x26fe, 2}, - EAWEntry{.neutral, 0x2700, 5}, - EAWEntry{.wide, 0x2705, 1}, - EAWEntry{.neutral, 0x2706, 4}, - EAWEntry{.wide, 0x270a, 2}, - EAWEntry{.neutral, 0x270c, 28}, - EAWEntry{.wide, 0x2728, 1}, - EAWEntry{.neutral, 0x2729, 20}, - EAWEntry{.ambiguous, 0x273d, 1}, - EAWEntry{.neutral, 0x273e, 14}, - EAWEntry{.wide, 0x274c, 1}, - EAWEntry{.neutral, 0x274d, 1}, - EAWEntry{.wide, 0x274e, 1}, - EAWEntry{.neutral, 0x274f, 4}, - EAWEntry{.wide, 0x2753, 3}, - EAWEntry{.neutral, 0x2756, 1}, - EAWEntry{.wide, 0x2757, 1}, - EAWEntry{.neutral, 0x2758, 30}, - EAWEntry{.ambiguous, 0x2776, 10}, - EAWEntry{.neutral, 0x2780, 21}, - EAWEntry{.wide, 0x2795, 3}, - EAWEntry{.neutral, 0x2798, 24}, - EAWEntry{.wide, 0x27b0, 1}, - EAWEntry{.neutral, 0x27b1, 14}, - EAWEntry{.wide, 0x27bf, 1}, - EAWEntry{.neutral, 0x27c0, 38}, - EAWEntry{.narrow, 0x27e6, 8}, - EAWEntry{.neutral, 0x27ee, 407}, - EAWEntry{.narrow, 0x2985, 2}, - EAWEntry{.neutral, 0x2987, 404}, - EAWEntry{.wide, 0x2b1b, 2}, - EAWEntry{.neutral, 0x2b1d, 51}, - EAWEntry{.wide, 0x2b50, 1}, - EAWEntry{.neutral, 0x2b51, 4}, - EAWEntry{.wide, 0x2b55, 1}, - EAWEntry{.ambiguous, 0x2b56, 4}, - EAWEntry{.neutral, 0x2b5a, 26}, - EAWEntry{.neutral, 0x2b76, 32}, - EAWEntry{.neutral, 0x2b97, 152}, - EAWEntry{.neutral, 0x2c30, 47}, - EAWEntry{.neutral, 0x2c60, 148}, - EAWEntry{.neutral, 0x2cf9, 45}, - EAWEntry{.neutral, 0x2d27, 1}, - EAWEntry{.neutral, 0x2d2d, 1}, - EAWEntry{.neutral, 0x2d30, 56}, - EAWEntry{.neutral, 0x2d6f, 2}, - EAWEntry{.neutral, 0x2d7f, 24}, - EAWEntry{.neutral, 0x2da0, 7}, - EAWEntry{.neutral, 0x2da8, 7}, - EAWEntry{.neutral, 0x2db0, 7}, - EAWEntry{.neutral, 0x2db8, 7}, - EAWEntry{.neutral, 0x2dc0, 7}, - EAWEntry{.neutral, 0x2dc8, 7}, - EAWEntry{.neutral, 0x2dd0, 7}, - EAWEntry{.neutral, 0x2dd8, 7}, - EAWEntry{.neutral, 0x2de0, 115}, - EAWEntry{.wide, 0x2e80, 26}, - EAWEntry{.wide, 0x2e9b, 89}, - EAWEntry{.wide, 0x2f00, 214}, - EAWEntry{.wide, 0x2ff0, 12}, - EAWEntry{.full, 0x3000, 1}, - EAWEntry{.wide, 0x3001, 62}, - EAWEntry{.neutral, 0x303f, 1}, - EAWEntry{.wide, 0x3041, 86}, - EAWEntry{.wide, 0x3099, 103}, - EAWEntry{.wide, 0x3105, 43}, - EAWEntry{.wide, 0x3131, 94}, - EAWEntry{.wide, 0x3190, 84}, - EAWEntry{.wide, 0x31f0, 47}, - EAWEntry{.wide, 0x3220, 40}, - EAWEntry{.ambiguous, 0x3248, 8}, - EAWEntry{.wide, 0x3250, 7024}, - EAWEntry{.neutral, 0x4dc0, 64}, - EAWEntry{.wide, 0x4e00, 22157}, - EAWEntry{.wide, 0xa490, 55}, - EAWEntry{.neutral, 0xa4d0, 348}, - EAWEntry{.neutral, 0xa640, 184}, - EAWEntry{.neutral, 0xa700, 192}, - EAWEntry{.neutral, 0xa7c2, 9}, - EAWEntry{.neutral, 0xa7f5, 56}, - EAWEntry{.neutral, 0xa830, 10}, - EAWEntry{.neutral, 0xa840, 56}, - EAWEntry{.neutral, 0xa880, 70}, - EAWEntry{.neutral, 0xa8ce, 12}, - EAWEntry{.neutral, 0xa8e0, 116}, - EAWEntry{.neutral, 0xa95f, 1}, - EAWEntry{.wide, 0xa960, 29}, - EAWEntry{.neutral, 0xa980, 78}, - EAWEntry{.neutral, 0xa9cf, 11}, - EAWEntry{.neutral, 0xa9de, 33}, - EAWEntry{.neutral, 0xaa00, 55}, - EAWEntry{.neutral, 0xaa40, 14}, - EAWEntry{.neutral, 0xaa50, 10}, - EAWEntry{.neutral, 0xaa5c, 103}, - EAWEntry{.neutral, 0xaadb, 28}, - EAWEntry{.neutral, 0xab01, 6}, - EAWEntry{.neutral, 0xab09, 6}, - EAWEntry{.neutral, 0xab11, 6}, - EAWEntry{.neutral, 0xab20, 7}, - EAWEntry{.neutral, 0xab28, 7}, - EAWEntry{.neutral, 0xab30, 60}, - EAWEntry{.neutral, 0xab70, 126}, - EAWEntry{.neutral, 0xabf0, 10}, - EAWEntry{.wide, 0xac00, 11172}, - EAWEntry{.neutral, 0xd7b0, 23}, - EAWEntry{.neutral, 0xd7cb, 49}, - EAWEntry{.neutral, 0xd800, 2048}, - EAWEntry{.ambiguous, 0xe000, 6400}, - EAWEntry{.wide, 0xf900, 512}, - EAWEntry{.neutral, 0xfb00, 7}, - EAWEntry{.neutral, 0xfb13, 5}, - EAWEntry{.neutral, 0xfb1d, 26}, - EAWEntry{.neutral, 0xfb38, 5}, - EAWEntry{.neutral, 0xfb3e, 1}, - EAWEntry{.neutral, 0xfb40, 2}, - EAWEntry{.neutral, 0xfb43, 2}, - EAWEntry{.neutral, 0xfb46, 124}, - EAWEntry{.neutral, 0xfbd3, 365}, - EAWEntry{.neutral, 0xfd50, 64}, - EAWEntry{.neutral, 0xfd92, 54}, - EAWEntry{.neutral, 0xfdf0, 14}, - EAWEntry{.ambiguous, 0xfe00, 16}, - EAWEntry{.wide, 0xfe10, 10}, - EAWEntry{.neutral, 0xfe20, 16}, - EAWEntry{.wide, 0xfe30, 35}, - EAWEntry{.wide, 0xfe54, 19}, - EAWEntry{.wide, 0xfe68, 4}, - EAWEntry{.neutral, 0xfe70, 5}, - EAWEntry{.neutral, 0xfe76, 135}, - EAWEntry{.neutral, 0xfeff, 1}, - EAWEntry{.full, 0xff01, 96}, - EAWEntry{.half, 0xff61, 94}, - EAWEntry{.half, 0xffc2, 6}, - EAWEntry{.half, 0xffca, 6}, - EAWEntry{.half, 0xffd2, 6}, - EAWEntry{.half, 0xffda, 3}, - EAWEntry{.full, 0xffe0, 7}, - EAWEntry{.half, 0xffe8, 7}, - EAWEntry{.neutral, 0xfff9, 4}, - EAWEntry{.ambiguous, 0xfffd, 1}, - EAWEntry{.neutral, 0x10000, 12}, - EAWEntry{.neutral, 0x1000d, 26}, - EAWEntry{.neutral, 0x10028, 19}, - EAWEntry{.neutral, 0x1003c, 2}, - EAWEntry{.neutral, 0x1003f, 15}, - EAWEntry{.neutral, 0x10050, 14}, - EAWEntry{.neutral, 0x10080, 123}, - EAWEntry{.neutral, 0x10100, 3}, - EAWEntry{.neutral, 0x10107, 45}, - EAWEntry{.neutral, 0x10137, 88}, - EAWEntry{.neutral, 0x10190, 13}, - EAWEntry{.neutral, 0x101a0, 1}, - EAWEntry{.neutral, 0x101d0, 46}, - EAWEntry{.neutral, 0x10280, 29}, - EAWEntry{.neutral, 0x102a0, 49}, - EAWEntry{.neutral, 0x102e0, 28}, - EAWEntry{.neutral, 0x10300, 36}, - EAWEntry{.neutral, 0x1032d, 30}, - EAWEntry{.neutral, 0x10350, 43}, - EAWEntry{.neutral, 0x10380, 30}, - EAWEntry{.neutral, 0x1039f, 37}, - EAWEntry{.neutral, 0x103c8, 14}, - EAWEntry{.neutral, 0x10400, 158}, - EAWEntry{.neutral, 0x104a0, 10}, - EAWEntry{.neutral, 0x104b0, 36}, - EAWEntry{.neutral, 0x104d8, 36}, - EAWEntry{.neutral, 0x10500, 40}, - EAWEntry{.neutral, 0x10530, 52}, - EAWEntry{.neutral, 0x1056f, 1}, - EAWEntry{.neutral, 0x10600, 311}, - EAWEntry{.neutral, 0x10740, 22}, - EAWEntry{.neutral, 0x10760, 8}, - EAWEntry{.neutral, 0x10800, 6}, - EAWEntry{.neutral, 0x10808, 1}, - EAWEntry{.neutral, 0x1080a, 44}, - EAWEntry{.neutral, 0x10837, 2}, - EAWEntry{.neutral, 0x1083c, 1}, - EAWEntry{.neutral, 0x1083f, 23}, - EAWEntry{.neutral, 0x10857, 72}, - EAWEntry{.neutral, 0x108a7, 9}, - EAWEntry{.neutral, 0x108e0, 19}, - EAWEntry{.neutral, 0x108f4, 2}, - EAWEntry{.neutral, 0x108fb, 33}, - EAWEntry{.neutral, 0x1091f, 27}, - EAWEntry{.neutral, 0x1093f, 1}, - EAWEntry{.neutral, 0x10980, 56}, - EAWEntry{.neutral, 0x109bc, 20}, - EAWEntry{.neutral, 0x109d2, 50}, - EAWEntry{.neutral, 0x10a05, 2}, - EAWEntry{.neutral, 0x10a0c, 8}, - EAWEntry{.neutral, 0x10a15, 3}, - EAWEntry{.neutral, 0x10a19, 29}, - EAWEntry{.neutral, 0x10a38, 3}, - EAWEntry{.neutral, 0x10a3f, 10}, - EAWEntry{.neutral, 0x10a50, 9}, - EAWEntry{.neutral, 0x10a60, 64}, - EAWEntry{.neutral, 0x10ac0, 39}, - EAWEntry{.neutral, 0x10aeb, 12}, - EAWEntry{.neutral, 0x10b00, 54}, - EAWEntry{.neutral, 0x10b39, 29}, - EAWEntry{.neutral, 0x10b58, 27}, - EAWEntry{.neutral, 0x10b78, 26}, - EAWEntry{.neutral, 0x10b99, 4}, - EAWEntry{.neutral, 0x10ba9, 7}, - EAWEntry{.neutral, 0x10c00, 73}, - EAWEntry{.neutral, 0x10c80, 51}, - EAWEntry{.neutral, 0x10cc0, 51}, - EAWEntry{.neutral, 0x10cfa, 46}, - EAWEntry{.neutral, 0x10d30, 10}, - EAWEntry{.neutral, 0x10e60, 31}, - EAWEntry{.neutral, 0x10e80, 42}, - EAWEntry{.neutral, 0x10eab, 3}, - EAWEntry{.neutral, 0x10eb0, 2}, - EAWEntry{.neutral, 0x10f00, 40}, - EAWEntry{.neutral, 0x10f30, 42}, - EAWEntry{.neutral, 0x10fb0, 28}, - EAWEntry{.neutral, 0x10fe0, 23}, - EAWEntry{.neutral, 0x11000, 78}, - EAWEntry{.neutral, 0x11052, 30}, - EAWEntry{.neutral, 0x1107f, 67}, - EAWEntry{.neutral, 0x110cd, 1}, - EAWEntry{.neutral, 0x110d0, 25}, - EAWEntry{.neutral, 0x110f0, 10}, - EAWEntry{.neutral, 0x11100, 53}, - EAWEntry{.neutral, 0x11136, 18}, - EAWEntry{.neutral, 0x11150, 39}, - EAWEntry{.neutral, 0x11180, 96}, - EAWEntry{.neutral, 0x111e1, 20}, - EAWEntry{.neutral, 0x11200, 18}, - EAWEntry{.neutral, 0x11213, 44}, - EAWEntry{.neutral, 0x11280, 7}, - EAWEntry{.neutral, 0x11288, 1}, - EAWEntry{.neutral, 0x1128a, 4}, - EAWEntry{.neutral, 0x1128f, 15}, - EAWEntry{.neutral, 0x1129f, 11}, - EAWEntry{.neutral, 0x112b0, 59}, - EAWEntry{.neutral, 0x112f0, 10}, - EAWEntry{.neutral, 0x11300, 4}, - EAWEntry{.neutral, 0x11305, 8}, - EAWEntry{.neutral, 0x1130f, 2}, - EAWEntry{.neutral, 0x11313, 22}, - EAWEntry{.neutral, 0x1132a, 7}, - EAWEntry{.neutral, 0x11332, 2}, - EAWEntry{.neutral, 0x11335, 5}, - EAWEntry{.neutral, 0x1133b, 10}, - EAWEntry{.neutral, 0x11347, 2}, - EAWEntry{.neutral, 0x1134b, 3}, - EAWEntry{.neutral, 0x11350, 1}, - EAWEntry{.neutral, 0x11357, 1}, - EAWEntry{.neutral, 0x1135d, 7}, - EAWEntry{.neutral, 0x11366, 7}, - EAWEntry{.neutral, 0x11370, 5}, - EAWEntry{.neutral, 0x11400, 92}, - EAWEntry{.neutral, 0x1145d, 5}, - EAWEntry{.neutral, 0x11480, 72}, - EAWEntry{.neutral, 0x114d0, 10}, - EAWEntry{.neutral, 0x11580, 54}, - EAWEntry{.neutral, 0x115b8, 38}, - EAWEntry{.neutral, 0x11600, 69}, - EAWEntry{.neutral, 0x11650, 10}, - EAWEntry{.neutral, 0x11660, 13}, - EAWEntry{.neutral, 0x11680, 57}, - EAWEntry{.neutral, 0x116c0, 10}, - EAWEntry{.neutral, 0x11700, 27}, - EAWEntry{.neutral, 0x1171d, 15}, - EAWEntry{.neutral, 0x11730, 16}, - EAWEntry{.neutral, 0x11800, 60}, - EAWEntry{.neutral, 0x118a0, 83}, - EAWEntry{.neutral, 0x118ff, 8}, - EAWEntry{.neutral, 0x11909, 1}, - EAWEntry{.neutral, 0x1190c, 8}, - EAWEntry{.neutral, 0x11915, 2}, - EAWEntry{.neutral, 0x11918, 30}, - EAWEntry{.neutral, 0x11937, 2}, - EAWEntry{.neutral, 0x1193b, 12}, - EAWEntry{.neutral, 0x11950, 10}, - EAWEntry{.neutral, 0x119a0, 8}, - EAWEntry{.neutral, 0x119aa, 46}, - EAWEntry{.neutral, 0x119da, 11}, - EAWEntry{.neutral, 0x11a00, 72}, - EAWEntry{.neutral, 0x11a50, 83}, - EAWEntry{.neutral, 0x11ac0, 57}, - EAWEntry{.neutral, 0x11c00, 9}, - EAWEntry{.neutral, 0x11c0a, 45}, - EAWEntry{.neutral, 0x11c38, 14}, - EAWEntry{.neutral, 0x11c50, 29}, - EAWEntry{.neutral, 0x11c70, 32}, - EAWEntry{.neutral, 0x11c92, 22}, - EAWEntry{.neutral, 0x11ca9, 14}, - EAWEntry{.neutral, 0x11d00, 7}, - EAWEntry{.neutral, 0x11d08, 2}, - EAWEntry{.neutral, 0x11d0b, 44}, - EAWEntry{.neutral, 0x11d3a, 1}, - EAWEntry{.neutral, 0x11d3c, 2}, - EAWEntry{.neutral, 0x11d3f, 9}, - EAWEntry{.neutral, 0x11d50, 10}, - EAWEntry{.neutral, 0x11d60, 6}, - EAWEntry{.neutral, 0x11d67, 2}, - EAWEntry{.neutral, 0x11d6a, 37}, - EAWEntry{.neutral, 0x11d90, 2}, - EAWEntry{.neutral, 0x11d93, 6}, - EAWEntry{.neutral, 0x11da0, 10}, - EAWEntry{.neutral, 0x11ee0, 25}, - EAWEntry{.neutral, 0x11fb0, 1}, - EAWEntry{.neutral, 0x11fc0, 50}, - EAWEntry{.neutral, 0x11fff, 923}, - EAWEntry{.neutral, 0x12400, 111}, - EAWEntry{.neutral, 0x12470, 5}, - EAWEntry{.neutral, 0x12480, 196}, - EAWEntry{.neutral, 0x13000, 1071}, - EAWEntry{.neutral, 0x13430, 9}, - EAWEntry{.neutral, 0x14400, 583}, - EAWEntry{.neutral, 0x16800, 569}, - EAWEntry{.neutral, 0x16a40, 31}, - EAWEntry{.neutral, 0x16a60, 10}, - EAWEntry{.neutral, 0x16a6e, 2}, - EAWEntry{.neutral, 0x16ad0, 30}, - EAWEntry{.neutral, 0x16af0, 6}, - EAWEntry{.neutral, 0x16b00, 70}, - EAWEntry{.neutral, 0x16b50, 10}, - EAWEntry{.neutral, 0x16b5b, 7}, - EAWEntry{.neutral, 0x16b63, 21}, - EAWEntry{.neutral, 0x16b7d, 19}, - EAWEntry{.neutral, 0x16e40, 91}, - EAWEntry{.neutral, 0x16f00, 75}, - EAWEntry{.neutral, 0x16f4f, 57}, - EAWEntry{.neutral, 0x16f8f, 17}, - EAWEntry{.wide, 0x16fe0, 5}, - EAWEntry{.wide, 0x16ff0, 2}, - EAWEntry{.wide, 0x17000, 6136}, - EAWEntry{.wide, 0x18800, 1238}, - EAWEntry{.wide, 0x18d00, 9}, - EAWEntry{.wide, 0x1b000, 287}, - EAWEntry{.wide, 0x1b150, 3}, - EAWEntry{.wide, 0x1b164, 4}, - EAWEntry{.wide, 0x1b170, 396}, - EAWEntry{.neutral, 0x1bc00, 107}, - EAWEntry{.neutral, 0x1bc70, 13}, - EAWEntry{.neutral, 0x1bc80, 9}, - EAWEntry{.neutral, 0x1bc90, 10}, - EAWEntry{.neutral, 0x1bc9c, 8}, - EAWEntry{.neutral, 0x1d000, 246}, - EAWEntry{.neutral, 0x1d100, 39}, - EAWEntry{.neutral, 0x1d129, 192}, - EAWEntry{.neutral, 0x1d200, 70}, - EAWEntry{.neutral, 0x1d2e0, 20}, - EAWEntry{.neutral, 0x1d300, 87}, - EAWEntry{.neutral, 0x1d360, 25}, - EAWEntry{.neutral, 0x1d400, 85}, - EAWEntry{.neutral, 0x1d456, 71}, - EAWEntry{.neutral, 0x1d49e, 2}, - EAWEntry{.neutral, 0x1d4a2, 1}, - EAWEntry{.neutral, 0x1d4a5, 2}, - EAWEntry{.neutral, 0x1d4a9, 4}, - EAWEntry{.neutral, 0x1d4ae, 12}, - EAWEntry{.neutral, 0x1d4bb, 1}, - EAWEntry{.neutral, 0x1d4bd, 7}, - EAWEntry{.neutral, 0x1d4c5, 65}, - EAWEntry{.neutral, 0x1d507, 4}, - EAWEntry{.neutral, 0x1d50d, 8}, - EAWEntry{.neutral, 0x1d516, 7}, - EAWEntry{.neutral, 0x1d51e, 28}, - EAWEntry{.neutral, 0x1d53b, 4}, - EAWEntry{.neutral, 0x1d540, 5}, - EAWEntry{.neutral, 0x1d546, 1}, - EAWEntry{.neutral, 0x1d54a, 7}, - EAWEntry{.neutral, 0x1d552, 340}, - EAWEntry{.neutral, 0x1d6a8, 292}, - EAWEntry{.neutral, 0x1d7ce, 702}, - EAWEntry{.neutral, 0x1da9b, 5}, - EAWEntry{.neutral, 0x1daa1, 15}, - EAWEntry{.neutral, 0x1e000, 7}, - EAWEntry{.neutral, 0x1e008, 17}, - EAWEntry{.neutral, 0x1e01b, 7}, - EAWEntry{.neutral, 0x1e023, 2}, - EAWEntry{.neutral, 0x1e026, 5}, - EAWEntry{.neutral, 0x1e100, 45}, - EAWEntry{.neutral, 0x1e130, 14}, - EAWEntry{.neutral, 0x1e140, 10}, - EAWEntry{.neutral, 0x1e14e, 2}, - EAWEntry{.neutral, 0x1e2c0, 58}, - EAWEntry{.neutral, 0x1e2ff, 1}, - EAWEntry{.neutral, 0x1e800, 197}, - EAWEntry{.neutral, 0x1e8c7, 16}, - EAWEntry{.neutral, 0x1e900, 76}, - EAWEntry{.neutral, 0x1e950, 10}, - EAWEntry{.neutral, 0x1e95e, 2}, - EAWEntry{.neutral, 0x1ec71, 68}, - EAWEntry{.neutral, 0x1ed01, 61}, - EAWEntry{.neutral, 0x1ee00, 4}, - EAWEntry{.neutral, 0x1ee05, 27}, - EAWEntry{.neutral, 0x1ee21, 2}, - EAWEntry{.neutral, 0x1ee24, 1}, - EAWEntry{.neutral, 0x1ee27, 1}, - EAWEntry{.neutral, 0x1ee29, 10}, - EAWEntry{.neutral, 0x1ee34, 4}, - EAWEntry{.neutral, 0x1ee39, 1}, - EAWEntry{.neutral, 0x1ee3b, 1}, - EAWEntry{.neutral, 0x1ee42, 1}, - EAWEntry{.neutral, 0x1ee47, 1}, - EAWEntry{.neutral, 0x1ee49, 1}, - EAWEntry{.neutral, 0x1ee4b, 1}, - EAWEntry{.neutral, 0x1ee4d, 3}, - EAWEntry{.neutral, 0x1ee51, 2}, - EAWEntry{.neutral, 0x1ee54, 1}, - EAWEntry{.neutral, 0x1ee57, 1}, - EAWEntry{.neutral, 0x1ee59, 1}, - EAWEntry{.neutral, 0x1ee5b, 1}, - EAWEntry{.neutral, 0x1ee5d, 1}, - EAWEntry{.neutral, 0x1ee5f, 1}, - EAWEntry{.neutral, 0x1ee61, 2}, - EAWEntry{.neutral, 0x1ee64, 1}, - EAWEntry{.neutral, 0x1ee67, 4}, - EAWEntry{.neutral, 0x1ee6c, 7}, - EAWEntry{.neutral, 0x1ee74, 4}, - EAWEntry{.neutral, 0x1ee79, 4}, - EAWEntry{.neutral, 0x1ee7e, 1}, - EAWEntry{.neutral, 0x1ee80, 10}, - EAWEntry{.neutral, 0x1ee8b, 17}, - EAWEntry{.neutral, 0x1eea1, 3}, - EAWEntry{.neutral, 0x1eea5, 5}, - EAWEntry{.neutral, 0x1eeab, 17}, - EAWEntry{.neutral, 0x1eef0, 2}, - EAWEntry{.neutral, 0x1f000, 4}, - EAWEntry{.wide, 0x1f004, 1}, - EAWEntry{.neutral, 0x1f005, 39}, - EAWEntry{.neutral, 0x1f030, 100}, - EAWEntry{.neutral, 0x1f0a0, 15}, - EAWEntry{.neutral, 0x1f0b1, 15}, - EAWEntry{.neutral, 0x1f0c1, 14}, - EAWEntry{.wide, 0x1f0cf, 1}, - EAWEntry{.neutral, 0x1f0d1, 37}, - EAWEntry{.ambiguous, 0x1f100, 11}, - EAWEntry{.neutral, 0x1f10b, 5}, - EAWEntry{.ambiguous, 0x1f110, 30}, - EAWEntry{.neutral, 0x1f12e, 2}, - EAWEntry{.ambiguous, 0x1f130, 58}, - EAWEntry{.neutral, 0x1f16a, 6}, - EAWEntry{.ambiguous, 0x1f170, 30}, - EAWEntry{.wide, 0x1f18e, 1}, - EAWEntry{.ambiguous, 0x1f18f, 2}, - EAWEntry{.wide, 0x1f191, 10}, - EAWEntry{.ambiguous, 0x1f19b, 18}, - EAWEntry{.neutral, 0x1f1ad, 1}, - EAWEntry{.neutral, 0x1f1e6, 26}, - EAWEntry{.wide, 0x1f200, 3}, - EAWEntry{.wide, 0x1f210, 44}, - EAWEntry{.wide, 0x1f240, 9}, - EAWEntry{.wide, 0x1f250, 2}, - EAWEntry{.wide, 0x1f260, 6}, - EAWEntry{.wide, 0x1f300, 33}, - EAWEntry{.neutral, 0x1f321, 12}, - EAWEntry{.wide, 0x1f32d, 9}, - EAWEntry{.neutral, 0x1f336, 1}, - EAWEntry{.wide, 0x1f337, 70}, - EAWEntry{.neutral, 0x1f37d, 1}, - EAWEntry{.wide, 0x1f37e, 22}, - EAWEntry{.neutral, 0x1f394, 12}, - EAWEntry{.wide, 0x1f3a0, 43}, - EAWEntry{.neutral, 0x1f3cb, 4}, - EAWEntry{.wide, 0x1f3cf, 5}, - EAWEntry{.neutral, 0x1f3d4, 12}, - EAWEntry{.wide, 0x1f3e0, 17}, - EAWEntry{.neutral, 0x1f3f1, 3}, - EAWEntry{.wide, 0x1f3f4, 1}, - EAWEntry{.neutral, 0x1f3f5, 3}, - EAWEntry{.wide, 0x1f3f8, 71}, - EAWEntry{.neutral, 0x1f43f, 1}, - EAWEntry{.wide, 0x1f440, 1}, - EAWEntry{.neutral, 0x1f441, 1}, - EAWEntry{.wide, 0x1f442, 187}, - EAWEntry{.neutral, 0x1f4fd, 2}, - EAWEntry{.wide, 0x1f4ff, 63}, - EAWEntry{.neutral, 0x1f53e, 13}, - EAWEntry{.wide, 0x1f54b, 4}, - EAWEntry{.neutral, 0x1f54f, 1}, - EAWEntry{.wide, 0x1f550, 24}, - EAWEntry{.neutral, 0x1f568, 18}, - EAWEntry{.wide, 0x1f57a, 1}, - EAWEntry{.neutral, 0x1f57b, 26}, - EAWEntry{.wide, 0x1f595, 2}, - EAWEntry{.neutral, 0x1f597, 13}, - EAWEntry{.wide, 0x1f5a4, 1}, - EAWEntry{.neutral, 0x1f5a5, 86}, - EAWEntry{.wide, 0x1f5fb, 85}, - EAWEntry{.neutral, 0x1f650, 48}, - EAWEntry{.wide, 0x1f680, 70}, - EAWEntry{.neutral, 0x1f6c6, 6}, - EAWEntry{.wide, 0x1f6cc, 1}, - EAWEntry{.neutral, 0x1f6cd, 3}, - EAWEntry{.wide, 0x1f6d0, 3}, - EAWEntry{.neutral, 0x1f6d3, 2}, - EAWEntry{.wide, 0x1f6d5, 3}, - EAWEntry{.neutral, 0x1f6e0, 11}, - EAWEntry{.wide, 0x1f6eb, 2}, - EAWEntry{.neutral, 0x1f6f0, 4}, - EAWEntry{.wide, 0x1f6f4, 9}, - EAWEntry{.neutral, 0x1f700, 116}, - EAWEntry{.neutral, 0x1f780, 89}, - EAWEntry{.wide, 0x1f7e0, 12}, - EAWEntry{.neutral, 0x1f800, 12}, - EAWEntry{.neutral, 0x1f810, 56}, - EAWEntry{.neutral, 0x1f850, 10}, - EAWEntry{.neutral, 0x1f860, 40}, - EAWEntry{.neutral, 0x1f890, 30}, - EAWEntry{.neutral, 0x1f8b0, 2}, - EAWEntry{.neutral, 0x1f900, 12}, - EAWEntry{.wide, 0x1f90c, 47}, - EAWEntry{.neutral, 0x1f93b, 1}, - EAWEntry{.wide, 0x1f93c, 10}, - EAWEntry{.neutral, 0x1f946, 1}, - EAWEntry{.wide, 0x1f947, 50}, - EAWEntry{.wide, 0x1f97a, 82}, - EAWEntry{.wide, 0x1f9cd, 51}, - EAWEntry{.neutral, 0x1fa00, 84}, - EAWEntry{.neutral, 0x1fa60, 14}, - EAWEntry{.wide, 0x1fa70, 5}, - EAWEntry{.wide, 0x1fa78, 3}, - EAWEntry{.wide, 0x1fa80, 7}, - EAWEntry{.wide, 0x1fa90, 25}, - EAWEntry{.wide, 0x1fab0, 7}, - EAWEntry{.wide, 0x1fac0, 3}, - EAWEntry{.wide, 0x1fad0, 7}, - EAWEntry{.neutral, 0x1fb00, 147}, - EAWEntry{.neutral, 0x1fb94, 55}, - EAWEntry{.neutral, 0x1fbf0, 10}, - EAWEntry{.wide, 0x20000, 65534}, - EAWEntry{.wide, 0x30000, 65534}, - EAWEntry{.neutral, 0xe0001, 1}, - EAWEntry{.neutral, 0xe0020, 96}, - EAWEntry{.ambiguous, 0xe0100, 240}, - EAWEntry{.ambiguous, 0xf0000, 65534}, - EAWEntry{.ambiguous, 0x100000, 65534}, - ] -) +const east_asian_width_data = [ + EAWEntry{.neutral, 0x0000, 32}, + EAWEntry{.narrow, 0x0020, 95}, + EAWEntry{.neutral, 0x007f, 34}, + EAWEntry{.ambiguous, 0x00a1, 1}, + EAWEntry{.narrow, 0x00a2, 2}, + EAWEntry{.ambiguous, 0x00a4, 1}, + EAWEntry{.narrow, 0x00a5, 2}, + EAWEntry{.ambiguous, 0x00a7, 2}, + EAWEntry{.neutral, 0x00a9, 1}, + EAWEntry{.ambiguous, 0x00aa, 1}, + EAWEntry{.neutral, 0x00ab, 1}, + EAWEntry{.narrow, 0x00ac, 1}, + EAWEntry{.ambiguous, 0x00ad, 2}, + EAWEntry{.narrow, 0x00af, 1}, + EAWEntry{.ambiguous, 0x00b0, 5}, + EAWEntry{.neutral, 0x00b5, 1}, + EAWEntry{.ambiguous, 0x00b6, 5}, + EAWEntry{.neutral, 0x00bb, 1}, + EAWEntry{.ambiguous, 0x00bc, 4}, + EAWEntry{.neutral, 0x00c0, 6}, + EAWEntry{.ambiguous, 0x00c6, 1}, + EAWEntry{.neutral, 0x00c7, 9}, + EAWEntry{.ambiguous, 0x00d0, 1}, + EAWEntry{.neutral, 0x00d1, 6}, + EAWEntry{.ambiguous, 0x00d7, 2}, + EAWEntry{.neutral, 0x00d9, 5}, + EAWEntry{.ambiguous, 0x00de, 4}, + EAWEntry{.neutral, 0x00e2, 4}, + EAWEntry{.ambiguous, 0x00e6, 1}, + EAWEntry{.neutral, 0x00e7, 1}, + EAWEntry{.ambiguous, 0x00e8, 3}, + EAWEntry{.neutral, 0x00eb, 1}, + EAWEntry{.ambiguous, 0x00ec, 2}, + EAWEntry{.neutral, 0x00ee, 2}, + EAWEntry{.ambiguous, 0x00f0, 1}, + EAWEntry{.neutral, 0x00f1, 1}, + EAWEntry{.ambiguous, 0x00f2, 2}, + EAWEntry{.neutral, 0x00f4, 3}, + EAWEntry{.ambiguous, 0x00f7, 4}, + EAWEntry{.neutral, 0x00fb, 1}, + EAWEntry{.ambiguous, 0x00fc, 1}, + EAWEntry{.neutral, 0x00fd, 1}, + EAWEntry{.ambiguous, 0x00fe, 1}, + EAWEntry{.neutral, 0x00ff, 2}, + EAWEntry{.ambiguous, 0x0101, 1}, + EAWEntry{.neutral, 0x0102, 15}, + EAWEntry{.ambiguous, 0x0111, 1}, + EAWEntry{.neutral, 0x0112, 1}, + EAWEntry{.ambiguous, 0x0113, 1}, + EAWEntry{.neutral, 0x0114, 7}, + EAWEntry{.ambiguous, 0x011b, 1}, + EAWEntry{.neutral, 0x011c, 10}, + EAWEntry{.ambiguous, 0x0126, 2}, + EAWEntry{.neutral, 0x0128, 3}, + EAWEntry{.ambiguous, 0x012b, 1}, + EAWEntry{.neutral, 0x012c, 5}, + EAWEntry{.ambiguous, 0x0131, 3}, + EAWEntry{.neutral, 0x0134, 4}, + EAWEntry{.ambiguous, 0x0138, 1}, + EAWEntry{.neutral, 0x0139, 6}, + EAWEntry{.ambiguous, 0x013f, 4}, + EAWEntry{.neutral, 0x0143, 1}, + EAWEntry{.ambiguous, 0x0144, 1}, + EAWEntry{.neutral, 0x0145, 3}, + EAWEntry{.ambiguous, 0x0148, 4}, + EAWEntry{.neutral, 0x014c, 1}, + EAWEntry{.ambiguous, 0x014d, 1}, + EAWEntry{.neutral, 0x014e, 4}, + EAWEntry{.ambiguous, 0x0152, 2}, + EAWEntry{.neutral, 0x0154, 18}, + EAWEntry{.ambiguous, 0x0166, 2}, + EAWEntry{.neutral, 0x0168, 3}, + EAWEntry{.ambiguous, 0x016b, 1}, + EAWEntry{.neutral, 0x016c, 98}, + EAWEntry{.ambiguous, 0x01ce, 1}, + EAWEntry{.neutral, 0x01cf, 1}, + EAWEntry{.ambiguous, 0x01d0, 1}, + EAWEntry{.neutral, 0x01d1, 1}, + EAWEntry{.ambiguous, 0x01d2, 1}, + EAWEntry{.neutral, 0x01d3, 1}, + EAWEntry{.ambiguous, 0x01d4, 1}, + EAWEntry{.neutral, 0x01d5, 1}, + EAWEntry{.ambiguous, 0x01d6, 1}, + EAWEntry{.neutral, 0x01d7, 1}, + EAWEntry{.ambiguous, 0x01d8, 1}, + EAWEntry{.neutral, 0x01d9, 1}, + EAWEntry{.ambiguous, 0x01da, 1}, + EAWEntry{.neutral, 0x01db, 1}, + EAWEntry{.ambiguous, 0x01dc, 1}, + EAWEntry{.neutral, 0x01dd, 116}, + EAWEntry{.ambiguous, 0x0251, 1}, + EAWEntry{.neutral, 0x0252, 15}, + EAWEntry{.ambiguous, 0x0261, 1}, + EAWEntry{.neutral, 0x0262, 98}, + EAWEntry{.ambiguous, 0x02c4, 1}, + EAWEntry{.neutral, 0x02c5, 2}, + EAWEntry{.ambiguous, 0x02c7, 1}, + EAWEntry{.neutral, 0x02c8, 1}, + EAWEntry{.ambiguous, 0x02c9, 3}, + EAWEntry{.neutral, 0x02cc, 1}, + EAWEntry{.ambiguous, 0x02cd, 1}, + EAWEntry{.neutral, 0x02ce, 2}, + EAWEntry{.ambiguous, 0x02d0, 1}, + EAWEntry{.neutral, 0x02d1, 7}, + EAWEntry{.ambiguous, 0x02d8, 4}, + EAWEntry{.neutral, 0x02dc, 1}, + EAWEntry{.ambiguous, 0x02dd, 1}, + EAWEntry{.neutral, 0x02de, 1}, + EAWEntry{.ambiguous, 0x02df, 1}, + EAWEntry{.neutral, 0x02e0, 32}, + EAWEntry{.ambiguous, 0x0300, 112}, + EAWEntry{.neutral, 0x0370, 8}, + EAWEntry{.neutral, 0x037a, 6}, + EAWEntry{.neutral, 0x0384, 7}, + EAWEntry{.neutral, 0x038c, 1}, + EAWEntry{.neutral, 0x038e, 3}, + EAWEntry{.ambiguous, 0x0391, 17}, + EAWEntry{.ambiguous, 0x03a3, 7}, + EAWEntry{.neutral, 0x03aa, 7}, + EAWEntry{.ambiguous, 0x03b1, 17}, + EAWEntry{.neutral, 0x03c2, 1}, + EAWEntry{.ambiguous, 0x03c3, 7}, + EAWEntry{.neutral, 0x03ca, 55}, + EAWEntry{.ambiguous, 0x0401, 1}, + EAWEntry{.neutral, 0x0402, 14}, + EAWEntry{.ambiguous, 0x0410, 64}, + EAWEntry{.neutral, 0x0450, 1}, + EAWEntry{.ambiguous, 0x0451, 1}, + EAWEntry{.neutral, 0x0452, 222}, + EAWEntry{.neutral, 0x0531, 38}, + EAWEntry{.neutral, 0x0559, 50}, + EAWEntry{.neutral, 0x058d, 3}, + EAWEntry{.neutral, 0x0591, 55}, + EAWEntry{.neutral, 0x05d0, 27}, + EAWEntry{.neutral, 0x05ef, 6}, + EAWEntry{.neutral, 0x0600, 29}, + EAWEntry{.neutral, 0x061e, 240}, + EAWEntry{.neutral, 0x070f, 60}, + EAWEntry{.neutral, 0x074d, 101}, + EAWEntry{.neutral, 0x07c0, 59}, + EAWEntry{.neutral, 0x07fd, 49}, + EAWEntry{.neutral, 0x0830, 15}, + EAWEntry{.neutral, 0x0840, 28}, + EAWEntry{.neutral, 0x085e, 1}, + EAWEntry{.neutral, 0x0860, 11}, + EAWEntry{.neutral, 0x08a0, 21}, + EAWEntry{.neutral, 0x08b6, 18}, + EAWEntry{.neutral, 0x08d3, 177}, + EAWEntry{.neutral, 0x0985, 8}, + EAWEntry{.neutral, 0x098f, 2}, + EAWEntry{.neutral, 0x0993, 22}, + EAWEntry{.neutral, 0x09aa, 7}, + EAWEntry{.neutral, 0x09b2, 1}, + EAWEntry{.neutral, 0x09b6, 4}, + EAWEntry{.neutral, 0x09bc, 9}, + EAWEntry{.neutral, 0x09c7, 2}, + EAWEntry{.neutral, 0x09cb, 4}, + EAWEntry{.neutral, 0x09d7, 1}, + EAWEntry{.neutral, 0x09dc, 2}, + EAWEntry{.neutral, 0x09df, 5}, + EAWEntry{.neutral, 0x09e6, 25}, + EAWEntry{.neutral, 0x0a01, 3}, + EAWEntry{.neutral, 0x0a05, 6}, + EAWEntry{.neutral, 0x0a0f, 2}, + EAWEntry{.neutral, 0x0a13, 22}, + EAWEntry{.neutral, 0x0a2a, 7}, + EAWEntry{.neutral, 0x0a32, 2}, + EAWEntry{.neutral, 0x0a35, 2}, + EAWEntry{.neutral, 0x0a38, 2}, + EAWEntry{.neutral, 0x0a3c, 1}, + EAWEntry{.neutral, 0x0a3e, 5}, + EAWEntry{.neutral, 0x0a47, 2}, + EAWEntry{.neutral, 0x0a4b, 3}, + EAWEntry{.neutral, 0x0a51, 1}, + EAWEntry{.neutral, 0x0a59, 4}, + EAWEntry{.neutral, 0x0a5e, 1}, + EAWEntry{.neutral, 0x0a66, 17}, + EAWEntry{.neutral, 0x0a81, 3}, + EAWEntry{.neutral, 0x0a85, 9}, + EAWEntry{.neutral, 0x0a8f, 3}, + EAWEntry{.neutral, 0x0a93, 22}, + EAWEntry{.neutral, 0x0aaa, 7}, + EAWEntry{.neutral, 0x0ab2, 2}, + EAWEntry{.neutral, 0x0ab5, 5}, + EAWEntry{.neutral, 0x0abc, 10}, + EAWEntry{.neutral, 0x0ac7, 3}, + EAWEntry{.neutral, 0x0acb, 3}, + EAWEntry{.neutral, 0x0ad0, 1}, + EAWEntry{.neutral, 0x0ae0, 4}, + EAWEntry{.neutral, 0x0ae6, 12}, + EAWEntry{.neutral, 0x0af9, 7}, + EAWEntry{.neutral, 0x0b01, 3}, + EAWEntry{.neutral, 0x0b05, 8}, + EAWEntry{.neutral, 0x0b0f, 2}, + EAWEntry{.neutral, 0x0b13, 22}, + EAWEntry{.neutral, 0x0b2a, 7}, + EAWEntry{.neutral, 0x0b32, 2}, + EAWEntry{.neutral, 0x0b35, 5}, + EAWEntry{.neutral, 0x0b3c, 9}, + EAWEntry{.neutral, 0x0b47, 2}, + EAWEntry{.neutral, 0x0b4b, 3}, + EAWEntry{.neutral, 0x0b55, 3}, + EAWEntry{.neutral, 0x0b5c, 2}, + EAWEntry{.neutral, 0x0b5f, 5}, + EAWEntry{.neutral, 0x0b66, 18}, + EAWEntry{.neutral, 0x0b82, 2}, + EAWEntry{.neutral, 0x0b85, 6}, + EAWEntry{.neutral, 0x0b8e, 3}, + EAWEntry{.neutral, 0x0b92, 4}, + EAWEntry{.neutral, 0x0b99, 2}, + EAWEntry{.neutral, 0x0b9c, 1}, + EAWEntry{.neutral, 0x0b9e, 2}, + EAWEntry{.neutral, 0x0ba3, 2}, + EAWEntry{.neutral, 0x0ba8, 3}, + EAWEntry{.neutral, 0x0bae, 12}, + EAWEntry{.neutral, 0x0bbe, 5}, + EAWEntry{.neutral, 0x0bc6, 3}, + EAWEntry{.neutral, 0x0bca, 4}, + EAWEntry{.neutral, 0x0bd0, 1}, + EAWEntry{.neutral, 0x0bd7, 1}, + EAWEntry{.neutral, 0x0be6, 21}, + EAWEntry{.neutral, 0x0c00, 13}, + EAWEntry{.neutral, 0x0c0e, 3}, + EAWEntry{.neutral, 0x0c12, 23}, + EAWEntry{.neutral, 0x0c2a, 16}, + EAWEntry{.neutral, 0x0c3d, 8}, + EAWEntry{.neutral, 0x0c46, 3}, + EAWEntry{.neutral, 0x0c4a, 4}, + EAWEntry{.neutral, 0x0c55, 2}, + EAWEntry{.neutral, 0x0c58, 3}, + EAWEntry{.neutral, 0x0c60, 4}, + EAWEntry{.neutral, 0x0c66, 10}, + EAWEntry{.neutral, 0x0c77, 22}, + EAWEntry{.neutral, 0x0c8e, 3}, + EAWEntry{.neutral, 0x0c92, 23}, + EAWEntry{.neutral, 0x0caa, 10}, + EAWEntry{.neutral, 0x0cb5, 5}, + EAWEntry{.neutral, 0x0cbc, 9}, + EAWEntry{.neutral, 0x0cc6, 3}, + EAWEntry{.neutral, 0x0cca, 4}, + EAWEntry{.neutral, 0x0cd5, 2}, + EAWEntry{.neutral, 0x0cde, 1}, + EAWEntry{.neutral, 0x0ce0, 4}, + EAWEntry{.neutral, 0x0ce6, 10}, + EAWEntry{.neutral, 0x0cf1, 2}, + EAWEntry{.neutral, 0x0d00, 13}, + EAWEntry{.neutral, 0x0d0e, 3}, + EAWEntry{.neutral, 0x0d12, 51}, + EAWEntry{.neutral, 0x0d46, 3}, + EAWEntry{.neutral, 0x0d4a, 6}, + EAWEntry{.neutral, 0x0d54, 16}, + EAWEntry{.neutral, 0x0d66, 26}, + EAWEntry{.neutral, 0x0d81, 3}, + EAWEntry{.neutral, 0x0d85, 18}, + EAWEntry{.neutral, 0x0d9a, 24}, + EAWEntry{.neutral, 0x0db3, 9}, + EAWEntry{.neutral, 0x0dbd, 1}, + EAWEntry{.neutral, 0x0dc0, 7}, + EAWEntry{.neutral, 0x0dca, 1}, + EAWEntry{.neutral, 0x0dcf, 6}, + EAWEntry{.neutral, 0x0dd6, 1}, + EAWEntry{.neutral, 0x0dd8, 8}, + EAWEntry{.neutral, 0x0de6, 10}, + EAWEntry{.neutral, 0x0df2, 3}, + EAWEntry{.neutral, 0x0e01, 58}, + EAWEntry{.neutral, 0x0e3f, 29}, + EAWEntry{.neutral, 0x0e81, 2}, + EAWEntry{.neutral, 0x0e84, 1}, + EAWEntry{.neutral, 0x0e86, 5}, + EAWEntry{.neutral, 0x0e8c, 24}, + EAWEntry{.neutral, 0x0ea5, 1}, + EAWEntry{.neutral, 0x0ea7, 23}, + EAWEntry{.neutral, 0x0ec0, 5}, + EAWEntry{.neutral, 0x0ec6, 1}, + EAWEntry{.neutral, 0x0ec8, 6}, + EAWEntry{.neutral, 0x0ed0, 10}, + EAWEntry{.neutral, 0x0edc, 4}, + EAWEntry{.neutral, 0x0f00, 72}, + EAWEntry{.neutral, 0x0f49, 36}, + EAWEntry{.neutral, 0x0f71, 39}, + EAWEntry{.neutral, 0x0f99, 36}, + EAWEntry{.neutral, 0x0fbe, 15}, + EAWEntry{.neutral, 0x0fce, 13}, + EAWEntry{.neutral, 0x1000, 198}, + EAWEntry{.neutral, 0x10c7, 1}, + EAWEntry{.neutral, 0x10cd, 1}, + EAWEntry{.neutral, 0x10d0, 48}, + EAWEntry{.wide, 0x1100, 96}, + EAWEntry{.neutral, 0x1160, 233}, + EAWEntry{.neutral, 0x124a, 4}, + EAWEntry{.neutral, 0x1250, 7}, + EAWEntry{.neutral, 0x1258, 1}, + EAWEntry{.neutral, 0x125a, 4}, + EAWEntry{.neutral, 0x1260, 41}, + EAWEntry{.neutral, 0x128a, 4}, + EAWEntry{.neutral, 0x1290, 33}, + EAWEntry{.neutral, 0x12b2, 4}, + EAWEntry{.neutral, 0x12b8, 7}, + EAWEntry{.neutral, 0x12c0, 1}, + EAWEntry{.neutral, 0x12c2, 4}, + EAWEntry{.neutral, 0x12c8, 15}, + EAWEntry{.neutral, 0x12d8, 57}, + EAWEntry{.neutral, 0x1312, 4}, + EAWEntry{.neutral, 0x1318, 67}, + EAWEntry{.neutral, 0x135d, 32}, + EAWEntry{.neutral, 0x1380, 26}, + EAWEntry{.neutral, 0x13a0, 86}, + EAWEntry{.neutral, 0x13f8, 6}, + EAWEntry{.neutral, 0x1400, 669}, + EAWEntry{.neutral, 0x16a0, 89}, + EAWEntry{.neutral, 0x1700, 13}, + EAWEntry{.neutral, 0x170e, 7}, + EAWEntry{.neutral, 0x1720, 23}, + EAWEntry{.neutral, 0x1740, 20}, + EAWEntry{.neutral, 0x1760, 13}, + EAWEntry{.neutral, 0x176e, 3}, + EAWEntry{.neutral, 0x1772, 2}, + EAWEntry{.neutral, 0x1780, 94}, + EAWEntry{.neutral, 0x17e0, 10}, + EAWEntry{.neutral, 0x17f0, 10}, + EAWEntry{.neutral, 0x1800, 15}, + EAWEntry{.neutral, 0x1810, 10}, + EAWEntry{.neutral, 0x1820, 89}, + EAWEntry{.neutral, 0x1880, 43}, + EAWEntry{.neutral, 0x18b0, 70}, + EAWEntry{.neutral, 0x1900, 31}, + EAWEntry{.neutral, 0x1920, 12}, + EAWEntry{.neutral, 0x1930, 12}, + EAWEntry{.neutral, 0x1940, 1}, + EAWEntry{.neutral, 0x1944, 42}, + EAWEntry{.neutral, 0x1970, 5}, + EAWEntry{.neutral, 0x1980, 44}, + EAWEntry{.neutral, 0x19b0, 26}, + EAWEntry{.neutral, 0x19d0, 11}, + EAWEntry{.neutral, 0x19de, 62}, + EAWEntry{.neutral, 0x1a1e, 65}, + EAWEntry{.neutral, 0x1a60, 29}, + EAWEntry{.neutral, 0x1a7f, 11}, + EAWEntry{.neutral, 0x1a90, 10}, + EAWEntry{.neutral, 0x1aa0, 14}, + EAWEntry{.neutral, 0x1ab0, 17}, + EAWEntry{.neutral, 0x1b00, 76}, + EAWEntry{.neutral, 0x1b50, 45}, + EAWEntry{.neutral, 0x1b80, 116}, + EAWEntry{.neutral, 0x1bfc, 60}, + EAWEntry{.neutral, 0x1c3b, 15}, + EAWEntry{.neutral, 0x1c4d, 60}, + EAWEntry{.neutral, 0x1c90, 43}, + EAWEntry{.neutral, 0x1cbd, 11}, + EAWEntry{.neutral, 0x1cd0, 43}, + EAWEntry{.neutral, 0x1d00, 250}, + EAWEntry{.neutral, 0x1dfb, 283}, + EAWEntry{.neutral, 0x1f18, 6}, + EAWEntry{.neutral, 0x1f20, 38}, + EAWEntry{.neutral, 0x1f48, 6}, + EAWEntry{.neutral, 0x1f50, 8}, + EAWEntry{.neutral, 0x1f59, 1}, + EAWEntry{.neutral, 0x1f5b, 1}, + EAWEntry{.neutral, 0x1f5d, 1}, + EAWEntry{.neutral, 0x1f5f, 31}, + EAWEntry{.neutral, 0x1f80, 53}, + EAWEntry{.neutral, 0x1fb6, 15}, + EAWEntry{.neutral, 0x1fc6, 14}, + EAWEntry{.neutral, 0x1fd6, 6}, + EAWEntry{.neutral, 0x1fdd, 19}, + EAWEntry{.neutral, 0x1ff2, 3}, + EAWEntry{.neutral, 0x1ff6, 9}, + EAWEntry{.neutral, 0x2000, 16}, + EAWEntry{.ambiguous, 0x2010, 1}, + EAWEntry{.neutral, 0x2011, 2}, + EAWEntry{.ambiguous, 0x2013, 4}, + EAWEntry{.neutral, 0x2017, 1}, + EAWEntry{.ambiguous, 0x2018, 2}, + EAWEntry{.neutral, 0x201a, 2}, + EAWEntry{.ambiguous, 0x201c, 2}, + EAWEntry{.neutral, 0x201e, 2}, + EAWEntry{.ambiguous, 0x2020, 3}, + EAWEntry{.neutral, 0x2023, 1}, + EAWEntry{.ambiguous, 0x2024, 4}, + EAWEntry{.neutral, 0x2028, 8}, + EAWEntry{.ambiguous, 0x2030, 1}, + EAWEntry{.neutral, 0x2031, 1}, + EAWEntry{.ambiguous, 0x2032, 2}, + EAWEntry{.neutral, 0x2034, 1}, + EAWEntry{.ambiguous, 0x2035, 1}, + EAWEntry{.neutral, 0x2036, 5}, + EAWEntry{.ambiguous, 0x203b, 1}, + EAWEntry{.neutral, 0x203c, 2}, + EAWEntry{.ambiguous, 0x203e, 1}, + EAWEntry{.neutral, 0x203f, 38}, + EAWEntry{.neutral, 0x2066, 12}, + EAWEntry{.ambiguous, 0x2074, 1}, + EAWEntry{.neutral, 0x2075, 10}, + EAWEntry{.ambiguous, 0x207f, 1}, + EAWEntry{.neutral, 0x2080, 1}, + EAWEntry{.ambiguous, 0x2081, 4}, + EAWEntry{.neutral, 0x2085, 10}, + EAWEntry{.neutral, 0x2090, 13}, + EAWEntry{.neutral, 0x20a0, 9}, + EAWEntry{.half, 0x20a9, 1}, + EAWEntry{.neutral, 0x20aa, 2}, + EAWEntry{.ambiguous, 0x20ac, 1}, + EAWEntry{.neutral, 0x20ad, 19}, + EAWEntry{.neutral, 0x20d0, 33}, + EAWEntry{.neutral, 0x2100, 3}, + EAWEntry{.ambiguous, 0x2103, 1}, + EAWEntry{.neutral, 0x2104, 1}, + EAWEntry{.ambiguous, 0x2105, 1}, + EAWEntry{.neutral, 0x2106, 3}, + EAWEntry{.ambiguous, 0x2109, 1}, + EAWEntry{.neutral, 0x210a, 9}, + EAWEntry{.ambiguous, 0x2113, 1}, + EAWEntry{.neutral, 0x2114, 2}, + EAWEntry{.ambiguous, 0x2116, 1}, + EAWEntry{.neutral, 0x2117, 10}, + EAWEntry{.ambiguous, 0x2121, 2}, + EAWEntry{.neutral, 0x2123, 3}, + EAWEntry{.ambiguous, 0x2126, 1}, + EAWEntry{.neutral, 0x2127, 4}, + EAWEntry{.ambiguous, 0x212b, 1}, + EAWEntry{.neutral, 0x212c, 39}, + EAWEntry{.ambiguous, 0x2153, 2}, + EAWEntry{.neutral, 0x2155, 6}, + EAWEntry{.ambiguous, 0x215b, 4}, + EAWEntry{.neutral, 0x215f, 1}, + EAWEntry{.ambiguous, 0x2160, 12}, + EAWEntry{.neutral, 0x216c, 4}, + EAWEntry{.ambiguous, 0x2170, 10}, + EAWEntry{.neutral, 0x217a, 15}, + EAWEntry{.ambiguous, 0x2189, 1}, + EAWEntry{.neutral, 0x218a, 2}, + EAWEntry{.ambiguous, 0x2190, 10}, + EAWEntry{.neutral, 0x219a, 30}, + EAWEntry{.ambiguous, 0x21b8, 2}, + EAWEntry{.neutral, 0x21ba, 24}, + EAWEntry{.ambiguous, 0x21d2, 1}, + EAWEntry{.neutral, 0x21d3, 1}, + EAWEntry{.ambiguous, 0x21d4, 1}, + EAWEntry{.neutral, 0x21d5, 18}, + EAWEntry{.ambiguous, 0x21e7, 1}, + EAWEntry{.neutral, 0x21e8, 24}, + EAWEntry{.ambiguous, 0x2200, 1}, + EAWEntry{.neutral, 0x2201, 1}, + EAWEntry{.ambiguous, 0x2202, 2}, + EAWEntry{.neutral, 0x2204, 3}, + EAWEntry{.ambiguous, 0x2207, 2}, + EAWEntry{.neutral, 0x2209, 2}, + EAWEntry{.ambiguous, 0x220b, 1}, + EAWEntry{.neutral, 0x220c, 3}, + EAWEntry{.ambiguous, 0x220f, 1}, + EAWEntry{.neutral, 0x2210, 1}, + EAWEntry{.ambiguous, 0x2211, 1}, + EAWEntry{.neutral, 0x2212, 3}, + EAWEntry{.ambiguous, 0x2215, 1}, + EAWEntry{.neutral, 0x2216, 4}, + EAWEntry{.ambiguous, 0x221a, 1}, + EAWEntry{.neutral, 0x221b, 2}, + EAWEntry{.ambiguous, 0x221d, 4}, + EAWEntry{.neutral, 0x2221, 2}, + EAWEntry{.ambiguous, 0x2223, 1}, + EAWEntry{.neutral, 0x2224, 1}, + EAWEntry{.ambiguous, 0x2225, 1}, + EAWEntry{.neutral, 0x2226, 1}, + EAWEntry{.ambiguous, 0x2227, 6}, + EAWEntry{.neutral, 0x222d, 1}, + EAWEntry{.ambiguous, 0x222e, 1}, + EAWEntry{.neutral, 0x222f, 5}, + EAWEntry{.ambiguous, 0x2234, 4}, + EAWEntry{.neutral, 0x2238, 4}, + EAWEntry{.ambiguous, 0x223c, 2}, + EAWEntry{.neutral, 0x223e, 10}, + EAWEntry{.ambiguous, 0x2248, 1}, + EAWEntry{.neutral, 0x2249, 3}, + EAWEntry{.ambiguous, 0x224c, 1}, + EAWEntry{.neutral, 0x224d, 5}, + EAWEntry{.ambiguous, 0x2252, 1}, + EAWEntry{.neutral, 0x2253, 13}, + EAWEntry{.ambiguous, 0x2260, 2}, + EAWEntry{.neutral, 0x2262, 2}, + EAWEntry{.ambiguous, 0x2264, 4}, + EAWEntry{.neutral, 0x2268, 2}, + EAWEntry{.ambiguous, 0x226a, 2}, + EAWEntry{.neutral, 0x226c, 2}, + EAWEntry{.ambiguous, 0x226e, 2}, + EAWEntry{.neutral, 0x2270, 18}, + EAWEntry{.ambiguous, 0x2282, 2}, + EAWEntry{.neutral, 0x2284, 2}, + EAWEntry{.ambiguous, 0x2286, 2}, + EAWEntry{.neutral, 0x2288, 13}, + EAWEntry{.ambiguous, 0x2295, 1}, + EAWEntry{.neutral, 0x2296, 3}, + EAWEntry{.ambiguous, 0x2299, 1}, + EAWEntry{.neutral, 0x229a, 11}, + EAWEntry{.ambiguous, 0x22a5, 1}, + EAWEntry{.neutral, 0x22a6, 25}, + EAWEntry{.ambiguous, 0x22bf, 1}, + EAWEntry{.neutral, 0x22c0, 82}, + EAWEntry{.ambiguous, 0x2312, 1}, + EAWEntry{.neutral, 0x2313, 7}, + EAWEntry{.wide, 0x231a, 2}, + EAWEntry{.neutral, 0x231c, 13}, + EAWEntry{.wide, 0x2329, 2}, + EAWEntry{.neutral, 0x232b, 190}, + EAWEntry{.wide, 0x23e9, 4}, + EAWEntry{.neutral, 0x23ed, 3}, + EAWEntry{.wide, 0x23f0, 1}, + EAWEntry{.neutral, 0x23f1, 2}, + EAWEntry{.wide, 0x23f3, 1}, + EAWEntry{.neutral, 0x23f4, 51}, + EAWEntry{.neutral, 0x2440, 11}, + EAWEntry{.ambiguous, 0x2460, 138}, + EAWEntry{.neutral, 0x24ea, 1}, + EAWEntry{.ambiguous, 0x24eb, 97}, + EAWEntry{.neutral, 0x254c, 4}, + EAWEntry{.ambiguous, 0x2550, 36}, + EAWEntry{.neutral, 0x2574, 12}, + EAWEntry{.ambiguous, 0x2580, 16}, + EAWEntry{.neutral, 0x2590, 2}, + EAWEntry{.ambiguous, 0x2592, 4}, + EAWEntry{.neutral, 0x2596, 10}, + EAWEntry{.ambiguous, 0x25a0, 2}, + EAWEntry{.neutral, 0x25a2, 1}, + EAWEntry{.ambiguous, 0x25a3, 7}, + EAWEntry{.neutral, 0x25aa, 8}, + EAWEntry{.ambiguous, 0x25b2, 2}, + EAWEntry{.neutral, 0x25b4, 2}, + EAWEntry{.ambiguous, 0x25b6, 2}, + EAWEntry{.neutral, 0x25b8, 4}, + EAWEntry{.ambiguous, 0x25bc, 2}, + EAWEntry{.neutral, 0x25be, 2}, + EAWEntry{.ambiguous, 0x25c0, 2}, + EAWEntry{.neutral, 0x25c2, 4}, + EAWEntry{.ambiguous, 0x25c6, 3}, + EAWEntry{.neutral, 0x25c9, 2}, + EAWEntry{.ambiguous, 0x25cb, 1}, + EAWEntry{.neutral, 0x25cc, 2}, + EAWEntry{.ambiguous, 0x25ce, 4}, + EAWEntry{.neutral, 0x25d2, 16}, + EAWEntry{.ambiguous, 0x25e2, 4}, + EAWEntry{.neutral, 0x25e6, 9}, + EAWEntry{.ambiguous, 0x25ef, 1}, + EAWEntry{.neutral, 0x25f0, 13}, + EAWEntry{.wide, 0x25fd, 2}, + EAWEntry{.neutral, 0x25ff, 6}, + EAWEntry{.ambiguous, 0x2605, 2}, + EAWEntry{.neutral, 0x2607, 2}, + EAWEntry{.ambiguous, 0x2609, 1}, + EAWEntry{.neutral, 0x260a, 4}, + EAWEntry{.ambiguous, 0x260e, 2}, + EAWEntry{.neutral, 0x2610, 4}, + EAWEntry{.wide, 0x2614, 2}, + EAWEntry{.neutral, 0x2616, 6}, + EAWEntry{.ambiguous, 0x261c, 1}, + EAWEntry{.neutral, 0x261d, 1}, + EAWEntry{.ambiguous, 0x261e, 1}, + EAWEntry{.neutral, 0x261f, 33}, + EAWEntry{.ambiguous, 0x2640, 1}, + EAWEntry{.neutral, 0x2641, 1}, + EAWEntry{.ambiguous, 0x2642, 1}, + EAWEntry{.neutral, 0x2643, 5}, + EAWEntry{.wide, 0x2648, 12}, + EAWEntry{.neutral, 0x2654, 12}, + EAWEntry{.ambiguous, 0x2660, 2}, + EAWEntry{.neutral, 0x2662, 1}, + EAWEntry{.ambiguous, 0x2663, 3}, + EAWEntry{.neutral, 0x2666, 1}, + EAWEntry{.ambiguous, 0x2667, 4}, + EAWEntry{.neutral, 0x266b, 1}, + EAWEntry{.ambiguous, 0x266c, 2}, + EAWEntry{.neutral, 0x266e, 1}, + EAWEntry{.ambiguous, 0x266f, 1}, + EAWEntry{.neutral, 0x2670, 15}, + EAWEntry{.wide, 0x267f, 1}, + EAWEntry{.neutral, 0x2680, 19}, + EAWEntry{.wide, 0x2693, 1}, + EAWEntry{.neutral, 0x2694, 10}, + EAWEntry{.ambiguous, 0x269e, 2}, + EAWEntry{.neutral, 0x26a0, 1}, + EAWEntry{.wide, 0x26a1, 1}, + EAWEntry{.neutral, 0x26a2, 8}, + EAWEntry{.wide, 0x26aa, 2}, + EAWEntry{.neutral, 0x26ac, 17}, + EAWEntry{.wide, 0x26bd, 2}, + EAWEntry{.ambiguous, 0x26bf, 1}, + EAWEntry{.neutral, 0x26c0, 4}, + EAWEntry{.wide, 0x26c4, 2}, + EAWEntry{.ambiguous, 0x26c6, 8}, + EAWEntry{.wide, 0x26ce, 1}, + EAWEntry{.ambiguous, 0x26cf, 5}, + EAWEntry{.wide, 0x26d4, 1}, + EAWEntry{.ambiguous, 0x26d5, 13}, + EAWEntry{.neutral, 0x26e2, 1}, + EAWEntry{.ambiguous, 0x26e3, 1}, + EAWEntry{.neutral, 0x26e4, 4}, + EAWEntry{.ambiguous, 0x26e8, 2}, + EAWEntry{.wide, 0x26ea, 1}, + EAWEntry{.ambiguous, 0x26eb, 7}, + EAWEntry{.wide, 0x26f2, 2}, + EAWEntry{.ambiguous, 0x26f4, 1}, + EAWEntry{.wide, 0x26f5, 1}, + EAWEntry{.ambiguous, 0x26f6, 4}, + EAWEntry{.wide, 0x26fa, 1}, + EAWEntry{.ambiguous, 0x26fb, 2}, + EAWEntry{.wide, 0x26fd, 1}, + EAWEntry{.ambiguous, 0x26fe, 2}, + EAWEntry{.neutral, 0x2700, 5}, + EAWEntry{.wide, 0x2705, 1}, + EAWEntry{.neutral, 0x2706, 4}, + EAWEntry{.wide, 0x270a, 2}, + EAWEntry{.neutral, 0x270c, 28}, + EAWEntry{.wide, 0x2728, 1}, + EAWEntry{.neutral, 0x2729, 20}, + EAWEntry{.ambiguous, 0x273d, 1}, + EAWEntry{.neutral, 0x273e, 14}, + EAWEntry{.wide, 0x274c, 1}, + EAWEntry{.neutral, 0x274d, 1}, + EAWEntry{.wide, 0x274e, 1}, + EAWEntry{.neutral, 0x274f, 4}, + EAWEntry{.wide, 0x2753, 3}, + EAWEntry{.neutral, 0x2756, 1}, + EAWEntry{.wide, 0x2757, 1}, + EAWEntry{.neutral, 0x2758, 30}, + EAWEntry{.ambiguous, 0x2776, 10}, + EAWEntry{.neutral, 0x2780, 21}, + EAWEntry{.wide, 0x2795, 3}, + EAWEntry{.neutral, 0x2798, 24}, + EAWEntry{.wide, 0x27b0, 1}, + EAWEntry{.neutral, 0x27b1, 14}, + EAWEntry{.wide, 0x27bf, 1}, + EAWEntry{.neutral, 0x27c0, 38}, + EAWEntry{.narrow, 0x27e6, 8}, + EAWEntry{.neutral, 0x27ee, 407}, + EAWEntry{.narrow, 0x2985, 2}, + EAWEntry{.neutral, 0x2987, 404}, + EAWEntry{.wide, 0x2b1b, 2}, + EAWEntry{.neutral, 0x2b1d, 51}, + EAWEntry{.wide, 0x2b50, 1}, + EAWEntry{.neutral, 0x2b51, 4}, + EAWEntry{.wide, 0x2b55, 1}, + EAWEntry{.ambiguous, 0x2b56, 4}, + EAWEntry{.neutral, 0x2b5a, 26}, + EAWEntry{.neutral, 0x2b76, 32}, + EAWEntry{.neutral, 0x2b97, 152}, + EAWEntry{.neutral, 0x2c30, 47}, + EAWEntry{.neutral, 0x2c60, 148}, + EAWEntry{.neutral, 0x2cf9, 45}, + EAWEntry{.neutral, 0x2d27, 1}, + EAWEntry{.neutral, 0x2d2d, 1}, + EAWEntry{.neutral, 0x2d30, 56}, + EAWEntry{.neutral, 0x2d6f, 2}, + EAWEntry{.neutral, 0x2d7f, 24}, + EAWEntry{.neutral, 0x2da0, 7}, + EAWEntry{.neutral, 0x2da8, 7}, + EAWEntry{.neutral, 0x2db0, 7}, + EAWEntry{.neutral, 0x2db8, 7}, + EAWEntry{.neutral, 0x2dc0, 7}, + EAWEntry{.neutral, 0x2dc8, 7}, + EAWEntry{.neutral, 0x2dd0, 7}, + EAWEntry{.neutral, 0x2dd8, 7}, + EAWEntry{.neutral, 0x2de0, 115}, + EAWEntry{.wide, 0x2e80, 26}, + EAWEntry{.wide, 0x2e9b, 89}, + EAWEntry{.wide, 0x2f00, 214}, + EAWEntry{.wide, 0x2ff0, 12}, + EAWEntry{.full, 0x3000, 1}, + EAWEntry{.wide, 0x3001, 62}, + EAWEntry{.neutral, 0x303f, 1}, + EAWEntry{.wide, 0x3041, 86}, + EAWEntry{.wide, 0x3099, 103}, + EAWEntry{.wide, 0x3105, 43}, + EAWEntry{.wide, 0x3131, 94}, + EAWEntry{.wide, 0x3190, 84}, + EAWEntry{.wide, 0x31f0, 47}, + EAWEntry{.wide, 0x3220, 40}, + EAWEntry{.ambiguous, 0x3248, 8}, + EAWEntry{.wide, 0x3250, 7024}, + EAWEntry{.neutral, 0x4dc0, 64}, + EAWEntry{.wide, 0x4e00, 22157}, + EAWEntry{.wide, 0xa490, 55}, + EAWEntry{.neutral, 0xa4d0, 348}, + EAWEntry{.neutral, 0xa640, 184}, + EAWEntry{.neutral, 0xa700, 192}, + EAWEntry{.neutral, 0xa7c2, 9}, + EAWEntry{.neutral, 0xa7f5, 56}, + EAWEntry{.neutral, 0xa830, 10}, + EAWEntry{.neutral, 0xa840, 56}, + EAWEntry{.neutral, 0xa880, 70}, + EAWEntry{.neutral, 0xa8ce, 12}, + EAWEntry{.neutral, 0xa8e0, 116}, + EAWEntry{.neutral, 0xa95f, 1}, + EAWEntry{.wide, 0xa960, 29}, + EAWEntry{.neutral, 0xa980, 78}, + EAWEntry{.neutral, 0xa9cf, 11}, + EAWEntry{.neutral, 0xa9de, 33}, + EAWEntry{.neutral, 0xaa00, 55}, + EAWEntry{.neutral, 0xaa40, 14}, + EAWEntry{.neutral, 0xaa50, 10}, + EAWEntry{.neutral, 0xaa5c, 103}, + EAWEntry{.neutral, 0xaadb, 28}, + EAWEntry{.neutral, 0xab01, 6}, + EAWEntry{.neutral, 0xab09, 6}, + EAWEntry{.neutral, 0xab11, 6}, + EAWEntry{.neutral, 0xab20, 7}, + EAWEntry{.neutral, 0xab28, 7}, + EAWEntry{.neutral, 0xab30, 60}, + EAWEntry{.neutral, 0xab70, 126}, + EAWEntry{.neutral, 0xabf0, 10}, + EAWEntry{.wide, 0xac00, 11172}, + EAWEntry{.neutral, 0xd7b0, 23}, + EAWEntry{.neutral, 0xd7cb, 49}, + EAWEntry{.neutral, 0xd800, 2048}, + EAWEntry{.ambiguous, 0xe000, 6400}, + EAWEntry{.wide, 0xf900, 512}, + EAWEntry{.neutral, 0xfb00, 7}, + EAWEntry{.neutral, 0xfb13, 5}, + EAWEntry{.neutral, 0xfb1d, 26}, + EAWEntry{.neutral, 0xfb38, 5}, + EAWEntry{.neutral, 0xfb3e, 1}, + EAWEntry{.neutral, 0xfb40, 2}, + EAWEntry{.neutral, 0xfb43, 2}, + EAWEntry{.neutral, 0xfb46, 124}, + EAWEntry{.neutral, 0xfbd3, 365}, + EAWEntry{.neutral, 0xfd50, 64}, + EAWEntry{.neutral, 0xfd92, 54}, + EAWEntry{.neutral, 0xfdf0, 14}, + EAWEntry{.ambiguous, 0xfe00, 16}, + EAWEntry{.wide, 0xfe10, 10}, + EAWEntry{.neutral, 0xfe20, 16}, + EAWEntry{.wide, 0xfe30, 35}, + EAWEntry{.wide, 0xfe54, 19}, + EAWEntry{.wide, 0xfe68, 4}, + EAWEntry{.neutral, 0xfe70, 5}, + EAWEntry{.neutral, 0xfe76, 135}, + EAWEntry{.neutral, 0xfeff, 1}, + EAWEntry{.full, 0xff01, 96}, + EAWEntry{.half, 0xff61, 94}, + EAWEntry{.half, 0xffc2, 6}, + EAWEntry{.half, 0xffca, 6}, + EAWEntry{.half, 0xffd2, 6}, + EAWEntry{.half, 0xffda, 3}, + EAWEntry{.full, 0xffe0, 7}, + EAWEntry{.half, 0xffe8, 7}, + EAWEntry{.neutral, 0xfff9, 4}, + EAWEntry{.ambiguous, 0xfffd, 1}, + EAWEntry{.neutral, 0x10000, 12}, + EAWEntry{.neutral, 0x1000d, 26}, + EAWEntry{.neutral, 0x10028, 19}, + EAWEntry{.neutral, 0x1003c, 2}, + EAWEntry{.neutral, 0x1003f, 15}, + EAWEntry{.neutral, 0x10050, 14}, + EAWEntry{.neutral, 0x10080, 123}, + EAWEntry{.neutral, 0x10100, 3}, + EAWEntry{.neutral, 0x10107, 45}, + EAWEntry{.neutral, 0x10137, 88}, + EAWEntry{.neutral, 0x10190, 13}, + EAWEntry{.neutral, 0x101a0, 1}, + EAWEntry{.neutral, 0x101d0, 46}, + EAWEntry{.neutral, 0x10280, 29}, + EAWEntry{.neutral, 0x102a0, 49}, + EAWEntry{.neutral, 0x102e0, 28}, + EAWEntry{.neutral, 0x10300, 36}, + EAWEntry{.neutral, 0x1032d, 30}, + EAWEntry{.neutral, 0x10350, 43}, + EAWEntry{.neutral, 0x10380, 30}, + EAWEntry{.neutral, 0x1039f, 37}, + EAWEntry{.neutral, 0x103c8, 14}, + EAWEntry{.neutral, 0x10400, 158}, + EAWEntry{.neutral, 0x104a0, 10}, + EAWEntry{.neutral, 0x104b0, 36}, + EAWEntry{.neutral, 0x104d8, 36}, + EAWEntry{.neutral, 0x10500, 40}, + EAWEntry{.neutral, 0x10530, 52}, + EAWEntry{.neutral, 0x1056f, 1}, + EAWEntry{.neutral, 0x10600, 311}, + EAWEntry{.neutral, 0x10740, 22}, + EAWEntry{.neutral, 0x10760, 8}, + EAWEntry{.neutral, 0x10800, 6}, + EAWEntry{.neutral, 0x10808, 1}, + EAWEntry{.neutral, 0x1080a, 44}, + EAWEntry{.neutral, 0x10837, 2}, + EAWEntry{.neutral, 0x1083c, 1}, + EAWEntry{.neutral, 0x1083f, 23}, + EAWEntry{.neutral, 0x10857, 72}, + EAWEntry{.neutral, 0x108a7, 9}, + EAWEntry{.neutral, 0x108e0, 19}, + EAWEntry{.neutral, 0x108f4, 2}, + EAWEntry{.neutral, 0x108fb, 33}, + EAWEntry{.neutral, 0x1091f, 27}, + EAWEntry{.neutral, 0x1093f, 1}, + EAWEntry{.neutral, 0x10980, 56}, + EAWEntry{.neutral, 0x109bc, 20}, + EAWEntry{.neutral, 0x109d2, 50}, + EAWEntry{.neutral, 0x10a05, 2}, + EAWEntry{.neutral, 0x10a0c, 8}, + EAWEntry{.neutral, 0x10a15, 3}, + EAWEntry{.neutral, 0x10a19, 29}, + EAWEntry{.neutral, 0x10a38, 3}, + EAWEntry{.neutral, 0x10a3f, 10}, + EAWEntry{.neutral, 0x10a50, 9}, + EAWEntry{.neutral, 0x10a60, 64}, + EAWEntry{.neutral, 0x10ac0, 39}, + EAWEntry{.neutral, 0x10aeb, 12}, + EAWEntry{.neutral, 0x10b00, 54}, + EAWEntry{.neutral, 0x10b39, 29}, + EAWEntry{.neutral, 0x10b58, 27}, + EAWEntry{.neutral, 0x10b78, 26}, + EAWEntry{.neutral, 0x10b99, 4}, + EAWEntry{.neutral, 0x10ba9, 7}, + EAWEntry{.neutral, 0x10c00, 73}, + EAWEntry{.neutral, 0x10c80, 51}, + EAWEntry{.neutral, 0x10cc0, 51}, + EAWEntry{.neutral, 0x10cfa, 46}, + EAWEntry{.neutral, 0x10d30, 10}, + EAWEntry{.neutral, 0x10e60, 31}, + EAWEntry{.neutral, 0x10e80, 42}, + EAWEntry{.neutral, 0x10eab, 3}, + EAWEntry{.neutral, 0x10eb0, 2}, + EAWEntry{.neutral, 0x10f00, 40}, + EAWEntry{.neutral, 0x10f30, 42}, + EAWEntry{.neutral, 0x10fb0, 28}, + EAWEntry{.neutral, 0x10fe0, 23}, + EAWEntry{.neutral, 0x11000, 78}, + EAWEntry{.neutral, 0x11052, 30}, + EAWEntry{.neutral, 0x1107f, 67}, + EAWEntry{.neutral, 0x110cd, 1}, + EAWEntry{.neutral, 0x110d0, 25}, + EAWEntry{.neutral, 0x110f0, 10}, + EAWEntry{.neutral, 0x11100, 53}, + EAWEntry{.neutral, 0x11136, 18}, + EAWEntry{.neutral, 0x11150, 39}, + EAWEntry{.neutral, 0x11180, 96}, + EAWEntry{.neutral, 0x111e1, 20}, + EAWEntry{.neutral, 0x11200, 18}, + EAWEntry{.neutral, 0x11213, 44}, + EAWEntry{.neutral, 0x11280, 7}, + EAWEntry{.neutral, 0x11288, 1}, + EAWEntry{.neutral, 0x1128a, 4}, + EAWEntry{.neutral, 0x1128f, 15}, + EAWEntry{.neutral, 0x1129f, 11}, + EAWEntry{.neutral, 0x112b0, 59}, + EAWEntry{.neutral, 0x112f0, 10}, + EAWEntry{.neutral, 0x11300, 4}, + EAWEntry{.neutral, 0x11305, 8}, + EAWEntry{.neutral, 0x1130f, 2}, + EAWEntry{.neutral, 0x11313, 22}, + EAWEntry{.neutral, 0x1132a, 7}, + EAWEntry{.neutral, 0x11332, 2}, + EAWEntry{.neutral, 0x11335, 5}, + EAWEntry{.neutral, 0x1133b, 10}, + EAWEntry{.neutral, 0x11347, 2}, + EAWEntry{.neutral, 0x1134b, 3}, + EAWEntry{.neutral, 0x11350, 1}, + EAWEntry{.neutral, 0x11357, 1}, + EAWEntry{.neutral, 0x1135d, 7}, + EAWEntry{.neutral, 0x11366, 7}, + EAWEntry{.neutral, 0x11370, 5}, + EAWEntry{.neutral, 0x11400, 92}, + EAWEntry{.neutral, 0x1145d, 5}, + EAWEntry{.neutral, 0x11480, 72}, + EAWEntry{.neutral, 0x114d0, 10}, + EAWEntry{.neutral, 0x11580, 54}, + EAWEntry{.neutral, 0x115b8, 38}, + EAWEntry{.neutral, 0x11600, 69}, + EAWEntry{.neutral, 0x11650, 10}, + EAWEntry{.neutral, 0x11660, 13}, + EAWEntry{.neutral, 0x11680, 57}, + EAWEntry{.neutral, 0x116c0, 10}, + EAWEntry{.neutral, 0x11700, 27}, + EAWEntry{.neutral, 0x1171d, 15}, + EAWEntry{.neutral, 0x11730, 16}, + EAWEntry{.neutral, 0x11800, 60}, + EAWEntry{.neutral, 0x118a0, 83}, + EAWEntry{.neutral, 0x118ff, 8}, + EAWEntry{.neutral, 0x11909, 1}, + EAWEntry{.neutral, 0x1190c, 8}, + EAWEntry{.neutral, 0x11915, 2}, + EAWEntry{.neutral, 0x11918, 30}, + EAWEntry{.neutral, 0x11937, 2}, + EAWEntry{.neutral, 0x1193b, 12}, + EAWEntry{.neutral, 0x11950, 10}, + EAWEntry{.neutral, 0x119a0, 8}, + EAWEntry{.neutral, 0x119aa, 46}, + EAWEntry{.neutral, 0x119da, 11}, + EAWEntry{.neutral, 0x11a00, 72}, + EAWEntry{.neutral, 0x11a50, 83}, + EAWEntry{.neutral, 0x11ac0, 57}, + EAWEntry{.neutral, 0x11c00, 9}, + EAWEntry{.neutral, 0x11c0a, 45}, + EAWEntry{.neutral, 0x11c38, 14}, + EAWEntry{.neutral, 0x11c50, 29}, + EAWEntry{.neutral, 0x11c70, 32}, + EAWEntry{.neutral, 0x11c92, 22}, + EAWEntry{.neutral, 0x11ca9, 14}, + EAWEntry{.neutral, 0x11d00, 7}, + EAWEntry{.neutral, 0x11d08, 2}, + EAWEntry{.neutral, 0x11d0b, 44}, + EAWEntry{.neutral, 0x11d3a, 1}, + EAWEntry{.neutral, 0x11d3c, 2}, + EAWEntry{.neutral, 0x11d3f, 9}, + EAWEntry{.neutral, 0x11d50, 10}, + EAWEntry{.neutral, 0x11d60, 6}, + EAWEntry{.neutral, 0x11d67, 2}, + EAWEntry{.neutral, 0x11d6a, 37}, + EAWEntry{.neutral, 0x11d90, 2}, + EAWEntry{.neutral, 0x11d93, 6}, + EAWEntry{.neutral, 0x11da0, 10}, + EAWEntry{.neutral, 0x11ee0, 25}, + EAWEntry{.neutral, 0x11fb0, 1}, + EAWEntry{.neutral, 0x11fc0, 50}, + EAWEntry{.neutral, 0x11fff, 923}, + EAWEntry{.neutral, 0x12400, 111}, + EAWEntry{.neutral, 0x12470, 5}, + EAWEntry{.neutral, 0x12480, 196}, + EAWEntry{.neutral, 0x13000, 1071}, + EAWEntry{.neutral, 0x13430, 9}, + EAWEntry{.neutral, 0x14400, 583}, + EAWEntry{.neutral, 0x16800, 569}, + EAWEntry{.neutral, 0x16a40, 31}, + EAWEntry{.neutral, 0x16a60, 10}, + EAWEntry{.neutral, 0x16a6e, 2}, + EAWEntry{.neutral, 0x16ad0, 30}, + EAWEntry{.neutral, 0x16af0, 6}, + EAWEntry{.neutral, 0x16b00, 70}, + EAWEntry{.neutral, 0x16b50, 10}, + EAWEntry{.neutral, 0x16b5b, 7}, + EAWEntry{.neutral, 0x16b63, 21}, + EAWEntry{.neutral, 0x16b7d, 19}, + EAWEntry{.neutral, 0x16e40, 91}, + EAWEntry{.neutral, 0x16f00, 75}, + EAWEntry{.neutral, 0x16f4f, 57}, + EAWEntry{.neutral, 0x16f8f, 17}, + EAWEntry{.wide, 0x16fe0, 5}, + EAWEntry{.wide, 0x16ff0, 2}, + EAWEntry{.wide, 0x17000, 6136}, + EAWEntry{.wide, 0x18800, 1238}, + EAWEntry{.wide, 0x18d00, 9}, + EAWEntry{.wide, 0x1b000, 287}, + EAWEntry{.wide, 0x1b150, 3}, + EAWEntry{.wide, 0x1b164, 4}, + EAWEntry{.wide, 0x1b170, 396}, + EAWEntry{.neutral, 0x1bc00, 107}, + EAWEntry{.neutral, 0x1bc70, 13}, + EAWEntry{.neutral, 0x1bc80, 9}, + EAWEntry{.neutral, 0x1bc90, 10}, + EAWEntry{.neutral, 0x1bc9c, 8}, + EAWEntry{.neutral, 0x1d000, 246}, + EAWEntry{.neutral, 0x1d100, 39}, + EAWEntry{.neutral, 0x1d129, 192}, + EAWEntry{.neutral, 0x1d200, 70}, + EAWEntry{.neutral, 0x1d2e0, 20}, + EAWEntry{.neutral, 0x1d300, 87}, + EAWEntry{.neutral, 0x1d360, 25}, + EAWEntry{.neutral, 0x1d400, 85}, + EAWEntry{.neutral, 0x1d456, 71}, + EAWEntry{.neutral, 0x1d49e, 2}, + EAWEntry{.neutral, 0x1d4a2, 1}, + EAWEntry{.neutral, 0x1d4a5, 2}, + EAWEntry{.neutral, 0x1d4a9, 4}, + EAWEntry{.neutral, 0x1d4ae, 12}, + EAWEntry{.neutral, 0x1d4bb, 1}, + EAWEntry{.neutral, 0x1d4bd, 7}, + EAWEntry{.neutral, 0x1d4c5, 65}, + EAWEntry{.neutral, 0x1d507, 4}, + EAWEntry{.neutral, 0x1d50d, 8}, + EAWEntry{.neutral, 0x1d516, 7}, + EAWEntry{.neutral, 0x1d51e, 28}, + EAWEntry{.neutral, 0x1d53b, 4}, + EAWEntry{.neutral, 0x1d540, 5}, + EAWEntry{.neutral, 0x1d546, 1}, + EAWEntry{.neutral, 0x1d54a, 7}, + EAWEntry{.neutral, 0x1d552, 340}, + EAWEntry{.neutral, 0x1d6a8, 292}, + EAWEntry{.neutral, 0x1d7ce, 702}, + EAWEntry{.neutral, 0x1da9b, 5}, + EAWEntry{.neutral, 0x1daa1, 15}, + EAWEntry{.neutral, 0x1e000, 7}, + EAWEntry{.neutral, 0x1e008, 17}, + EAWEntry{.neutral, 0x1e01b, 7}, + EAWEntry{.neutral, 0x1e023, 2}, + EAWEntry{.neutral, 0x1e026, 5}, + EAWEntry{.neutral, 0x1e100, 45}, + EAWEntry{.neutral, 0x1e130, 14}, + EAWEntry{.neutral, 0x1e140, 10}, + EAWEntry{.neutral, 0x1e14e, 2}, + EAWEntry{.neutral, 0x1e2c0, 58}, + EAWEntry{.neutral, 0x1e2ff, 1}, + EAWEntry{.neutral, 0x1e800, 197}, + EAWEntry{.neutral, 0x1e8c7, 16}, + EAWEntry{.neutral, 0x1e900, 76}, + EAWEntry{.neutral, 0x1e950, 10}, + EAWEntry{.neutral, 0x1e95e, 2}, + EAWEntry{.neutral, 0x1ec71, 68}, + EAWEntry{.neutral, 0x1ed01, 61}, + EAWEntry{.neutral, 0x1ee00, 4}, + EAWEntry{.neutral, 0x1ee05, 27}, + EAWEntry{.neutral, 0x1ee21, 2}, + EAWEntry{.neutral, 0x1ee24, 1}, + EAWEntry{.neutral, 0x1ee27, 1}, + EAWEntry{.neutral, 0x1ee29, 10}, + EAWEntry{.neutral, 0x1ee34, 4}, + EAWEntry{.neutral, 0x1ee39, 1}, + EAWEntry{.neutral, 0x1ee3b, 1}, + EAWEntry{.neutral, 0x1ee42, 1}, + EAWEntry{.neutral, 0x1ee47, 1}, + EAWEntry{.neutral, 0x1ee49, 1}, + EAWEntry{.neutral, 0x1ee4b, 1}, + EAWEntry{.neutral, 0x1ee4d, 3}, + EAWEntry{.neutral, 0x1ee51, 2}, + EAWEntry{.neutral, 0x1ee54, 1}, + EAWEntry{.neutral, 0x1ee57, 1}, + EAWEntry{.neutral, 0x1ee59, 1}, + EAWEntry{.neutral, 0x1ee5b, 1}, + EAWEntry{.neutral, 0x1ee5d, 1}, + EAWEntry{.neutral, 0x1ee5f, 1}, + EAWEntry{.neutral, 0x1ee61, 2}, + EAWEntry{.neutral, 0x1ee64, 1}, + EAWEntry{.neutral, 0x1ee67, 4}, + EAWEntry{.neutral, 0x1ee6c, 7}, + EAWEntry{.neutral, 0x1ee74, 4}, + EAWEntry{.neutral, 0x1ee79, 4}, + EAWEntry{.neutral, 0x1ee7e, 1}, + EAWEntry{.neutral, 0x1ee80, 10}, + EAWEntry{.neutral, 0x1ee8b, 17}, + EAWEntry{.neutral, 0x1eea1, 3}, + EAWEntry{.neutral, 0x1eea5, 5}, + EAWEntry{.neutral, 0x1eeab, 17}, + EAWEntry{.neutral, 0x1eef0, 2}, + EAWEntry{.neutral, 0x1f000, 4}, + EAWEntry{.wide, 0x1f004, 1}, + EAWEntry{.neutral, 0x1f005, 39}, + EAWEntry{.neutral, 0x1f030, 100}, + EAWEntry{.neutral, 0x1f0a0, 15}, + EAWEntry{.neutral, 0x1f0b1, 15}, + EAWEntry{.neutral, 0x1f0c1, 14}, + EAWEntry{.wide, 0x1f0cf, 1}, + EAWEntry{.neutral, 0x1f0d1, 37}, + EAWEntry{.ambiguous, 0x1f100, 11}, + EAWEntry{.neutral, 0x1f10b, 5}, + EAWEntry{.ambiguous, 0x1f110, 30}, + EAWEntry{.neutral, 0x1f12e, 2}, + EAWEntry{.ambiguous, 0x1f130, 58}, + EAWEntry{.neutral, 0x1f16a, 6}, + EAWEntry{.ambiguous, 0x1f170, 30}, + EAWEntry{.wide, 0x1f18e, 1}, + EAWEntry{.ambiguous, 0x1f18f, 2}, + EAWEntry{.wide, 0x1f191, 10}, + EAWEntry{.ambiguous, 0x1f19b, 18}, + EAWEntry{.neutral, 0x1f1ad, 1}, + EAWEntry{.neutral, 0x1f1e6, 26}, + EAWEntry{.wide, 0x1f200, 3}, + EAWEntry{.wide, 0x1f210, 44}, + EAWEntry{.wide, 0x1f240, 9}, + EAWEntry{.wide, 0x1f250, 2}, + EAWEntry{.wide, 0x1f260, 6}, + EAWEntry{.wide, 0x1f300, 33}, + EAWEntry{.neutral, 0x1f321, 12}, + EAWEntry{.wide, 0x1f32d, 9}, + EAWEntry{.neutral, 0x1f336, 1}, + EAWEntry{.wide, 0x1f337, 70}, + EAWEntry{.neutral, 0x1f37d, 1}, + EAWEntry{.wide, 0x1f37e, 22}, + EAWEntry{.neutral, 0x1f394, 12}, + EAWEntry{.wide, 0x1f3a0, 43}, + EAWEntry{.neutral, 0x1f3cb, 4}, + EAWEntry{.wide, 0x1f3cf, 5}, + EAWEntry{.neutral, 0x1f3d4, 12}, + EAWEntry{.wide, 0x1f3e0, 17}, + EAWEntry{.neutral, 0x1f3f1, 3}, + EAWEntry{.wide, 0x1f3f4, 1}, + EAWEntry{.neutral, 0x1f3f5, 3}, + EAWEntry{.wide, 0x1f3f8, 71}, + EAWEntry{.neutral, 0x1f43f, 1}, + EAWEntry{.wide, 0x1f440, 1}, + EAWEntry{.neutral, 0x1f441, 1}, + EAWEntry{.wide, 0x1f442, 187}, + EAWEntry{.neutral, 0x1f4fd, 2}, + EAWEntry{.wide, 0x1f4ff, 63}, + EAWEntry{.neutral, 0x1f53e, 13}, + EAWEntry{.wide, 0x1f54b, 4}, + EAWEntry{.neutral, 0x1f54f, 1}, + EAWEntry{.wide, 0x1f550, 24}, + EAWEntry{.neutral, 0x1f568, 18}, + EAWEntry{.wide, 0x1f57a, 1}, + EAWEntry{.neutral, 0x1f57b, 26}, + EAWEntry{.wide, 0x1f595, 2}, + EAWEntry{.neutral, 0x1f597, 13}, + EAWEntry{.wide, 0x1f5a4, 1}, + EAWEntry{.neutral, 0x1f5a5, 86}, + EAWEntry{.wide, 0x1f5fb, 85}, + EAWEntry{.neutral, 0x1f650, 48}, + EAWEntry{.wide, 0x1f680, 70}, + EAWEntry{.neutral, 0x1f6c6, 6}, + EAWEntry{.wide, 0x1f6cc, 1}, + EAWEntry{.neutral, 0x1f6cd, 3}, + EAWEntry{.wide, 0x1f6d0, 3}, + EAWEntry{.neutral, 0x1f6d3, 2}, + EAWEntry{.wide, 0x1f6d5, 3}, + EAWEntry{.neutral, 0x1f6e0, 11}, + EAWEntry{.wide, 0x1f6eb, 2}, + EAWEntry{.neutral, 0x1f6f0, 4}, + EAWEntry{.wide, 0x1f6f4, 9}, + EAWEntry{.neutral, 0x1f700, 116}, + EAWEntry{.neutral, 0x1f780, 89}, + EAWEntry{.wide, 0x1f7e0, 12}, + EAWEntry{.neutral, 0x1f800, 12}, + EAWEntry{.neutral, 0x1f810, 56}, + EAWEntry{.neutral, 0x1f850, 10}, + EAWEntry{.neutral, 0x1f860, 40}, + EAWEntry{.neutral, 0x1f890, 30}, + EAWEntry{.neutral, 0x1f8b0, 2}, + EAWEntry{.neutral, 0x1f900, 12}, + EAWEntry{.wide, 0x1f90c, 47}, + EAWEntry{.neutral, 0x1f93b, 1}, + EAWEntry{.wide, 0x1f93c, 10}, + EAWEntry{.neutral, 0x1f946, 1}, + EAWEntry{.wide, 0x1f947, 50}, + EAWEntry{.wide, 0x1f97a, 82}, + EAWEntry{.wide, 0x1f9cd, 51}, + EAWEntry{.neutral, 0x1fa00, 84}, + EAWEntry{.neutral, 0x1fa60, 14}, + EAWEntry{.wide, 0x1fa70, 5}, + EAWEntry{.wide, 0x1fa78, 3}, + EAWEntry{.wide, 0x1fa80, 7}, + EAWEntry{.wide, 0x1fa90, 25}, + EAWEntry{.wide, 0x1fab0, 7}, + EAWEntry{.wide, 0x1fac0, 3}, + EAWEntry{.wide, 0x1fad0, 7}, + EAWEntry{.neutral, 0x1fb00, 147}, + EAWEntry{.neutral, 0x1fb94, 55}, + EAWEntry{.neutral, 0x1fbf0, 10}, + EAWEntry{.wide, 0x20000, 65534}, + EAWEntry{.wide, 0x30000, 65534}, + EAWEntry{.neutral, 0xe0001, 1}, + EAWEntry{.neutral, 0xe0020, 96}, + EAWEntry{.ambiguous, 0xe0100, 240}, + EAWEntry{.ambiguous, 0xf0000, 65534}, + EAWEntry{.ambiguous, 0x100000, 65534}, +] diff --git a/vlib/encoding/utf8/utf8_tables.v b/vlib/encoding/utf8/utf8_tables.v index bcdeee874f..48c456b2d8 100644 --- a/vlib/encoding/utf8/utf8_tables.v +++ b/vlib/encoding/utf8/utf8_tables.v @@ -3,19 +3,27 @@ module utf8 // for unicode type fast lookup -const ( - p_c = 1 // a control character. - p_p = 2 // a punctuation character. - p_n = 4 // a numeral. - p_s = 8 // a symbolic character. - p_z = 16 // a spacing character. - p_lu = 32 // an up_prer-case letter. - p_ll = 64 // a lower-case letter. - p_pr = 128 // a printable character according to Go's definition. - p_g = p_pr | p_z // a graphical character according to the Unicode definition. - p_lo = p_lu | p_ll // a letter that is neither up_prer nor lower case. - p_l_mask = p_lo -) +const p_c = 1 // a control character. + +const p_p = 2 // a punctuation character. + +const p_n = 4 // a numeral. + +const p_s = 8 // a symbolic character. + +const p_z = 16 // a spacing character. + +const p_lu = 32 // an up_prer-case letter. + +const p_ll = 64 // a lower-case letter. + +const p_pr = 128 // a printable character according to Go's definition. + +const p_g = p_pr | p_z // a graphical character according to the Unicode definition. + +const p_lo = p_lu | p_ll // a letter that is neither up_prer nor lower case. + +const p_l_mask = p_lo const props = [ p_c @@ -534,9 +542,7 @@ const props = [ // These tables are based on Go lang's tables: https://cs.opensource.google/go/go/+/refs/tags/go1.17.1:src/unicode/tables.go. // There is no need to investigate unicodes' type like letter yourself. -const ( - max_latin_1 = rune(0x00ff) // '\u00FF' // `ÿ` -) +const max_latin_1 = rune(0x00ff) // Represents all unicode in unicode category L. const letter_table = RangeTable{ diff --git a/vlib/encoding/utf8/utf8_util.v b/vlib/encoding/utf8/utf8_util.v index 34a22cae06..3807538318 100644 --- a/vlib/encoding/utf8/utf8_util.v +++ b/vlib/encoding/utf8/utf8_util.v @@ -556,631 +556,629 @@ fn find_punct_in_table(in_code int, in_table []int) int { // // source: http://www.unicode.org/faq/punctuation_symbols.html -const ( - // Western punctuation mark - // Character Name Browser Image - unicode_punct_western = [ - 0x0021, // EXCLAMATION MARK ! - 0x0022, // QUOTATION MARK " - 0x0027, // APOSTROPHE ' - 0x002A, // ASTERISK * - 0x002C, // COMMA , - 0x002E, // FULL STOP . - 0x002F, // SOLIDUS / - 0x003A, // COLON : - 0x003B, // SEMICOLON ; - 0x003F, // QUESTION MARK ? - 0x00A1, // INVERTED EXCLAMATION MARK ¡ - 0x00A7, // SECTION SIGN § - 0x00B6, // PILCROW SIGN ¶ - 0x00B7, // MIDDLE DOT · - 0x00BF, // INVERTED QUESTION MARK ¿ - 0x037E, // GREEK QUESTION MARK ; - 0x0387, // GREEK ANO TELEIA · - 0x055A, // ARMENIAN APOSTROPHE ՚ - 0x055B, // ARMENIAN EMPHASIS MARK ՛ - 0x055C, // ARMENIAN EXCLAMATION MARK ՜ - 0x055D, // ARMENIAN COMMA ՝ - 0x055E, // ARMENIAN QUESTION MARK ՞ - 0x055F, // ARMENIAN ABBREVIATION MARK ՟ - 0x0589, // ARMENIAN FULL STOP ։ - 0x05C0, // HEBREW PUNCTUATION PASEQ ׀ - 0x05C3, // HEBREW PUNCTUATION SOF PASUQ ׃ - 0x05C6, // HEBREW PUNCTUATION NUN HAFUKHA ׆ - 0x05F3, // HEBREW PUNCTUATION GERESH ׳ - 0x05F4, // HEBREW PUNCTUATION GERSHAYIM ״ - ] +// Western punctuation mark +// Character Name Browser Image +const unicode_punct_western = [ + 0x0021, // EXCLAMATION MARK ! + 0x0022, // QUOTATION MARK " + 0x0027, // APOSTROPHE ' + 0x002A, // ASTERISK * + 0x002C, // COMMA , + 0x002E, // FULL STOP . + 0x002F, // SOLIDUS / + 0x003A, // COLON : + 0x003B, // SEMICOLON ; + 0x003F, // QUESTION MARK ? + 0x00A1, // INVERTED EXCLAMATION MARK ¡ + 0x00A7, // SECTION SIGN § + 0x00B6, // PILCROW SIGN ¶ + 0x00B7, // MIDDLE DOT · + 0x00BF, // INVERTED QUESTION MARK ¿ + 0x037E, // GREEK QUESTION MARK ; + 0x0387, // GREEK ANO TELEIA · + 0x055A, // ARMENIAN APOSTROPHE ՚ + 0x055B, // ARMENIAN EMPHASIS MARK ՛ + 0x055C, // ARMENIAN EXCLAMATION MARK ՜ + 0x055D, // ARMENIAN COMMA ՝ + 0x055E, // ARMENIAN QUESTION MARK ՞ + 0x055F, // ARMENIAN ABBREVIATION MARK ՟ + 0x0589, // ARMENIAN FULL STOP ։ + 0x05C0, // HEBREW PUNCTUATION PASEQ ׀ + 0x05C3, // HEBREW PUNCTUATION SOF PASUQ ׃ + 0x05C6, // HEBREW PUNCTUATION NUN HAFUKHA ׆ + 0x05F3, // HEBREW PUNCTUATION GERESH ׳ + 0x05F4, // HEBREW PUNCTUATION GERSHAYIM ״ +] - // Unicode Characters in the 'Punctuation, Other' Category - // Character Name Browser Image - unicode_punct = [ - 0x0021, // EXCLAMATION MARK ! - 0x0022, // QUOTATION MARK " - 0x0023, // NUMBER SIGN # - 0x0025, // PERCENT SIGN % - 0x0026, // AMPERSAND & - 0x0027, // APOSTROPHE ' - 0x002A, // ASTERISK * - 0x002C, // COMMA , - 0x002E, // FULL STOP . - 0x002F, // SOLIDUS / - 0x003A, // COLON : - 0x003B, // SEMICOLON ; - 0x003F, // QUESTION MARK ? - 0x0040, // COMMERCIAL AT @ - 0x005C, // REVERSE SOLIDUS \ - 0x00A1, // INVERTED EXCLAMATION MARK ¡ - 0x00A7, // SECTION SIGN § - 0x00B6, // PILCROW SIGN ¶ - 0x00B7, // MIDDLE DOT · - 0x00BF, // INVERTED QUESTION MARK ¿ - 0x037E, // GREEK QUESTION MARK ; - 0x0387, // GREEK ANO TELEIA · - 0x055A, // ARMENIAN APOSTROPHE ՚ - 0x055B, // ARMENIAN EMPHASIS MARK ՛ - 0x055C, // ARMENIAN EXCLAMATION MARK ՜ - 0x055D, // ARMENIAN COMMA ՝ - 0x055E, // ARMENIAN QUESTION MARK ՞ - 0x055F, // ARMENIAN ABBREVIATION MARK ՟ - 0x0589, // ARMENIAN FULL STOP ։ - 0x05C0, // HEBREW PUNCTUATION PASEQ ׀ - 0x05C3, // HEBREW PUNCTUATION SOF PASUQ ׃ - 0x05C6, // HEBREW PUNCTUATION NUN HAFUKHA ׆ - 0x05F3, // HEBREW PUNCTUATION GERESH ׳ - 0x05F4, // HEBREW PUNCTUATION GERSHAYIM ״ - 0x0609, // ARABIC-INDIC PER MILLE SIGN ؉ - 0x060A, // ARABIC-INDIC PER TEN THOUSAND SIGN ؊ - 0x060C, // ARABIC COMMA ، - 0x060D, // ARABIC DATE SEPARATOR ؍ - 0x061B, // ARABIC SEMICOLON ؛ - 0x061E, // ARABIC TRIPLE DOT PUNCTUATION MARK ؞ - 0x061F, // ARABIC QUESTION MARK ؟ - 0x066A, // ARABIC PERCENT SIGN ٪ - 0x066B, // ARABIC DECIMAL SEPARATOR ٫ - 0x066C, // ARABIC THOUSANDS SEPARATOR ٬ - 0x066D, // ARABIC FIVE POINTED STAR ٭ - 0x06D4, // ARABIC FULL STOP ۔ - 0x0700, // SYRIAC END OF PARAGRAPH ܀ - 0x0701, // SYRIAC SUPRALINEAR FULL STOP ܁ - 0x0702, // SYRIAC SUBLINEAR FULL STOP ܂ - 0x0703, // SYRIAC SUPRALINEAR COLON ܃ - 0x0704, // SYRIAC SUBLINEAR COLON ܄ - 0x0705, // SYRIAC HORIZONTAL COLON ܅ - 0x0706, // SYRIAC COLON SKEWED LEFT ܆ - 0x0707, // SYRIAC COLON SKEWED RIGHT ܇ - 0x0708, // SYRIAC SUPRALINEAR COLON SKEWED LEFT ܈ - 0x0709, // SYRIAC SUBLINEAR COLON SKEWED RIGHT ܉ - 0x070A, // SYRIAC CONTRACTION ܊ - 0x070B, // SYRIAC HARKLEAN OBELUS ܋ - 0x070C, // SYRIAC HARKLEAN METOBELUS ܌ - 0x070D, // SYRIAC HARKLEAN ASTERISCUS ܍ - 0x07F7, // NKO SYMBOL GBAKURUNEN ߷ - 0x07F8, // NKO COMMA ߸ - 0x07F9, // NKO EXCLAMATION MARK ߹ - 0x0830, // SAMARITAN PUNCTUATION NEQUDAA ࠰ - 0x0831, // SAMARITAN PUNCTUATION AFSAAQ ࠱ - 0x0832, // SAMARITAN PUNCTUATION ANGED ࠲ - 0x0833, // SAMARITAN PUNCTUATION BAU ࠳ - 0x0834, // SAMARITAN PUNCTUATION ATMAAU ࠴ - 0x0835, // SAMARITAN PUNCTUATION SHIYYAALAA ࠵ - 0x0836, // SAMARITAN ABBREVIATION MARK ࠶ - 0x0837, // SAMARITAN PUNCTUATION MELODIC QITSA ࠷ - 0x0838, // SAMARITAN PUNCTUATION ZIQAA ࠸ - 0x0839, // SAMARITAN PUNCTUATION QITSA ࠹ - 0x083A, // SAMARITAN PUNCTUATION ZAEF ࠺ - 0x083B, // SAMARITAN PUNCTUATION TURU ࠻ - 0x083C, // SAMARITAN PUNCTUATION ARKAANU ࠼ - 0x083D, // SAMARITAN PUNCTUATION SOF MASHFAAT ࠽ - 0x083E, // SAMARITAN PUNCTUATION ANNAAU ࠾ - 0x085E, // MANDAIC PUNCTUATION ࡞ - 0x0964, // DEVANAGARI DANDA । - 0x0965, // DEVANAGARI DOUBLE DANDA ॥ - 0x0970, // DEVANAGARI ABBREVIATION SIGN ॰ - 0x09FD, // BENGALI ABBREVIATION SIGN ৽ - 0x0A76, // GURMUKHI ABBREVIATION SIGN ੶ - 0x0AF0, // GUJARATI ABBREVIATION SIGN ૰ - 0x0C77, // TELUGU SIGN SIDDHAM ౷ - 0x0C84, // KANNADA SIGN SIDDHAM ಄ - 0x0DF4, // SINHALA PUNCTUATION KUNDDALIYA ෴ - 0x0E4F, // THAI CHARACTER FONGMAN ๏ - 0x0E5A, // THAI CHARACTER ANGKHANKHU ๚ - 0x0E5B, // THAI CHARACTER KHOMUT ๛ - 0x0F04, // TIBETAN MARK INITIAL YIG MGO MDUN MA ༄ - 0x0F05, // TIBETAN MARK CLOSING YIG MGO SGAB MA ༅ - 0x0F06, // TIBETAN MARK CARET YIG MGO PHUR SHAD MA ༆ - 0x0F07, // TIBETAN MARK YIG MGO TSHEG SHAD MA ༇ - 0x0F08, // TIBETAN MARK SBRUL SHAD ༈ - 0x0F09, // TIBETAN MARK BSKUR YIG MGO ༉ - 0x0F0A, // TIBETAN MARK BKA- SHOG YIG MGO ༊ - 0x0F0B, // TIBETAN MARK INTERSYLLABIC TSHEG ་ - 0x0F0C, // TIBETAN MARK DELIMITER TSHEG BSTAR ༌ - 0x0F0D, // TIBETAN MARK SHAD ། - 0x0F0E, // TIBETAN MARK NYIS SHAD ༎ - 0x0F0F, // TIBETAN MARK TSHEG SHAD ༏ - 0x0F10, // TIBETAN MARK NYIS TSHEG SHAD ༐ - 0x0F11, // TIBETAN MARK RIN CHEN SPUNGS SHAD ༑ - 0x0F12, // TIBETAN MARK RGYA GRAM SHAD ༒ - 0x0F14, // TIBETAN MARK GTER TSHEG ༔ - 0x0F85, // TIBETAN MARK PALUTA ྅ - 0x0FD0, // TIBETAN MARK BSKA- SHOG GI MGO RGYAN ࿐ - 0x0FD1, // TIBETAN MARK MNYAM YIG GI MGO RGYAN ࿑ - 0x0FD2, // TIBETAN MARK NYIS TSHEG ࿒ - 0x0FD3, // TIBETAN MARK INITIAL BRDA RNYING YIG MGO MDUN MA ࿓ - 0x0FD4, // TIBETAN MARK CLOSING BRDA RNYING YIG MGO SGAB MA ࿔ - 0x0FD9, // TIBETAN MARK LEADING MCHAN RTAGS ࿙ - 0x0FDA, // TIBETAN MARK TRAILING MCHAN RTAGS ࿚ - 0x104A, // MYANMAR SIGN LITTLE SECTION ၊ - 0x104B, // MYANMAR SIGN SECTION ။ - 0x104C, // MYANMAR SYMBOL LOCATIVE ၌ - 0x104D, // MYANMAR SYMBOL COMPLETED ၍ - 0x104E, // MYANMAR SYMBOL AFOREMENTIONED ၎ - 0x104F, // MYANMAR SYMBOL GENITIVE ၏ - 0x10FB, // GEORGIAN PARAGRAPH SEPARATOR ჻ - 0x1360, // ETHIOPIC SECTION MARK ፠ - 0x1361, // ETHIOPIC WORDSPACE ፡ - 0x1362, // ETHIOPIC FULL STOP ። - 0x1363, // ETHIOPIC COMMA ፣ - 0x1364, // ETHIOPIC SEMICOLON ፤ - 0x1365, // ETHIOPIC COLON ፥ - 0x1366, // ETHIOPIC PREFACE COLON ፦ - 0x1367, // ETHIOPIC QUESTION MARK ፧ - 0x1368, // ETHIOPIC PARAGRAPH SEPARATOR ፨ - 0x166E, // CANADIAN SYLLABICS FULL STOP ᙮ - 0x16EB, // RUNIC SINGLE PUNCTUATION ᛫ - 0x16EC, // RUNIC MULTIPLE PUNCTUATION ᛬ - 0x16ED, // RUNIC CROSS PUNCTUATION ᛭ - 0x1735, // PHILIPPINE SINGLE PUNCTUATION ᜵ - 0x1736, // PHILIPPINE DOUBLE PUNCTUATION ᜶ - 0x17D4, // KHMER SIGN KHAN ។ - 0x17D5, // KHMER SIGN BARIYOOSAN ៕ - 0x17D6, // KHMER SIGN CAMNUC PII KUUH ៖ - 0x17D8, // KHMER SIGN BEYYAL ៘ - 0x17D9, // KHMER SIGN PHNAEK MUAN ៙ - 0x17DA, // KHMER SIGN KOOMUUT ៚ - 0x1800, // MONGOLIAN BIRGA ᠀ - 0x1801, // MONGOLIAN ELLIPSIS ᠁ - 0x1802, // MONGOLIAN COMMA ᠂ - 0x1803, // MONGOLIAN FULL STOP ᠃ - 0x1804, // MONGOLIAN COLON ᠄ - 0x1805, // MONGOLIAN FOUR DOTS ᠅ - 0x1807, // MONGOLIAN SIBE SYLLABLE BOUNDARY MARKER ᠇ - 0x1808, // MONGOLIAN MANCHU COMMA ᠈ - 0x1809, // MONGOLIAN MANCHU FULL STOP ᠉ - 0x180A, // MONGOLIAN NIRUGU ᠊ - 0x1944, // LIMBU EXCLAMATION MARK ᥄ - 0x1945, // LIMBU QUESTION MARK ᥅ - 0x1A1E, // BUGINESE PALLAWA ᨞ - 0x1A1F, // BUGINESE END OF SECTION ᨟ - 0x1AA0, // TAI THAM SIGN WIANG ᪠ - 0x1AA1, // TAI THAM SIGN WIANGWAAK ᪡ - 0x1AA2, // TAI THAM SIGN SAWAN ᪢ - 0x1AA3, // TAI THAM SIGN KEOW ᪣ - 0x1AA4, // TAI THAM SIGN HOY ᪤ - 0x1AA5, // TAI THAM SIGN DOKMAI ᪥ - 0x1AA6, // TAI THAM SIGN REVERSED ROTATED RANA ᪦ - 0x1AA8, // TAI THAM SIGN KAAN ᪨ - 0x1AA9, // TAI THAM SIGN KAANKUU ᪩ - 0x1AAA, // TAI THAM SIGN SATKAAN ᪪ - 0x1AAB, // TAI THAM SIGN SATKAANKUU ᪫ - 0x1AAC, // TAI THAM SIGN HANG ᪬ - 0x1AAD, // TAI THAM SIGN CAANG ᪭ - 0x1B5A, // BALINESE PANTI ᭚ - 0x1B5B, // BALINESE PAMADA ᭛ - 0x1B5C, // BALINESE WINDU ᭜ - 0x1B5D, // BALINESE CARIK PAMUNGKAH ᭝ - 0x1B5E, // BALINESE CARIK SIKI ᭞ - 0x1B5F, // BALINESE CARIK PAREREN ᭟ - 0x1B60, // BALINESE PAMENENG ᭠ - 0x1BFC, // BATAK SYMBOL BINDU NA METEK ᯼ - 0x1BFD, // BATAK SYMBOL BINDU PINARBORAS ᯽ - 0x1BFE, // BATAK SYMBOL BINDU JUDUL ᯾ - 0x1BFF, // BATAK SYMBOL BINDU PANGOLAT ᯿ - 0x1C3B, // LEPCHA PUNCTUATION TA-ROL ᰻ - 0x1C3C, // LEPCHA PUNCTUATION NYET THYOOM TA-ROL ᰼ - 0x1C3D, // LEPCHA PUNCTUATION CER-WA ᰽ - 0x1C3E, // LEPCHA PUNCTUATION TSHOOK CER-WA ᰾ - 0x1C3F, // LEPCHA PUNCTUATION TSHOOK ᰿ - 0x1C7E, // OL CHIKI PUNCTUATION MUCAAD ᱾ - 0x1C7F, // OL CHIKI PUNCTUATION DOUBLE MUCAAD ᱿ - 0x1CC0, // SUNDANESE PUNCTUATION BINDU SURYA ᳀ - 0x1CC1, // SUNDANESE PUNCTUATION BINDU PANGLONG ᳁ - 0x1CC2, // SUNDANESE PUNCTUATION BINDU PURNAMA ᳂ - 0x1CC3, // SUNDANESE PUNCTUATION BINDU CAKRA ᳃ - 0x1CC4, // SUNDANESE PUNCTUATION BINDU LEU SATANGA ᳄ - 0x1CC5, // SUNDANESE PUNCTUATION BINDU KA SATANGA ᳅ - 0x1CC6, // SUNDANESE PUNCTUATION BINDU DA SATANGA ᳆ - 0x1CC7, // SUNDANESE PUNCTUATION BINDU BA SATANGA ᳇ - 0x1CD3, // VEDIC SIGN NIHSHVASA ᳓ - 0x2016, // DOUBLE VERTICAL LINE ‖ - 0x2017, // DOUBLE LOW LINE ‗ - 0x2020, // DAGGER † - 0x2021, // DOUBLE DAGGER ‡ - 0x2022, // BULLET • - 0x2023, // TRIANGULAR BULLET ‣ - 0x2024, // ONE DOT LEADER ․ - 0x2025, // TWO DOT LEADER ‥ - 0x2026, // HORIZONTAL ELLIPSIS … - 0x2027, // HYPHENATION POINT ‧ - 0x2030, // PER MILLE SIGN ‰ - 0x2031, // PER TEN THOUSAND SIGN ‱ - 0x2032, // PRIME ′ - 0x2033, // DOUBLE PRIME ″ - 0x2034, // TRIPLE PRIME ‴ - 0x2035, // REVERSED PRIME ‵ - 0x2036, // REVERSED DOUBLE PRIME ‶ - 0x2037, // REVERSED TRIPLE PRIME ‷ - 0x2038, // CARET ‸ - 0x203B, // REFERENCE MARK ※ - 0x203C, // DOUBLE EXCLAMATION MARK ‼ - 0x203D, // INTERROBANG ‽ - 0x203E, // OVERLINE ‾ - 0x2041, // CARET INSERTION POINT ⁁ - 0x2042, // ASTERISM ⁂ - 0x2043, // HYPHEN BULLET ⁃ - 0x2047, // DOUBLE QUESTION MARK ⁇ - 0x2048, // QUESTION EXCLAMATION MARK ⁈ - 0x2049, // EXCLAMATION QUESTION MARK ⁉ - 0x204A, // TIRONIAN SIGN ET ⁊ - 0x204B, // REVERSED PILCROW SIGN ⁋ - 0x204C, // BLACK LEFTWARDS BULLET ⁌ - 0x204D, // BLACK RIGHTWARDS BULLET ⁍ - 0x204E, // LOW ASTERISK ⁎ - 0x204F, // REVERSED SEMICOLON ⁏ - 0x2050, // CLOSE UP ⁐ - 0x2051, // TWO ASTERISKS ALIGNED VERTICALLY ⁑ - 0x2053, // SWUNG DASH ⁓ - 0x2055, // FLOWER PUNCTUATION MARK ⁕ - 0x2056, // THREE DOT PUNCTUATION ⁖ - 0x2057, // QUADRUPLE PRIME ⁗ - 0x2058, // FOUR DOT PUNCTUATION ⁘ - 0x2059, // FIVE DOT PUNCTUATION ⁙ - 0x205A, // TWO DOT PUNCTUATION ⁚ - 0x205B, // FOUR DOT MARK ⁛ - 0x205C, // DOTTED CROSS ⁜ - 0x205D, // TRICOLON ⁝ - 0x205E, // VERTICAL FOUR DOTS ⁞ - 0x2CF9, // COPTIC OLD NUBIAN FULL STOP ⳹ - 0x2CFA, // COPTIC OLD NUBIAN DIRECT QUESTION MARK ⳺ - 0x2CFB, // COPTIC OLD NUBIAN INDIRECT QUESTION MARK ⳻ - 0x2CFC, // COPTIC OLD NUBIAN VERSE DIVIDER ⳼ - 0x2CFE, // COPTIC FULL STOP ⳾ - 0x2CFF, // COPTIC MORPHOLOGICAL DIVIDER ⳿ - 0x2D70, // TIFINAGH SEPARATOR MARK ⵰ - 0x2E00, // RIGHT ANGLE SUBSTITUTION MARKER ⸀ - 0x2E01, // RIGHT ANGLE DOTTED SUBSTITUTION MARKER ⸁ - 0x2E06, // RAISED INTERPOLATION MARKER ⸆ - 0x2E07, // RAISED DOTTED INTERPOLATION MARKER ⸇ - 0x2E08, // DOTTED TRANSPOSITION MARKER ⸈ - 0x2E0B, // RAISED SQUARE ⸋ - 0x2E0E, // EDITORIAL CORONIS ⸎ - 0x2E0F, // PARAGRAPHOS ⸏ - 0x2E10, // FORKED PARAGRAPHOS ⸐ - 0x2E11, // REVERSED FORKED PARAGRAPHOS ⸑ - 0x2E12, // HYPODIASTOLE ⸒ - 0x2E13, // DOTTED OBELOS ⸓ - 0x2E14, // DOWNWARDS ANCORA ⸔ - 0x2E15, // UPWARDS ANCORA ⸕ - 0x2E16, // DOTTED RIGHT-POINTING ANGLE ⸖ - 0x2E18, // INVERTED INTERROBANG ⸘ - 0x2E19, // PALM BRANCH ⸙ - 0x2E1B, // TILDE WITH RING ABOVE ⸛ - 0x2E1E, // TILDE WITH DOT ABOVE ⸞ - 0x2E1F, // TILDE WITH DOT BELOW ⸟ - 0x2E2A, // TWO DOTS OVER ONE DOT PUNCTUATION ⸪ - 0x2E2B, // ONE DOT OVER TWO DOTS PUNCTUATION ⸫ - 0x2E2C, // SQUARED FOUR DOT PUNCTUATION ⸬ - 0x2E2D, // FIVE DOT MARK ⸭ - 0x2E2E, // REVERSED QUESTION MARK ⸮ - 0x2E30, // RING POINT ⸰ - 0x2E31, // WORD SEPARATOR MIDDLE DOT ⸱ - 0x2E32, // TURNED COMMA ⸲ - 0x2E33, // RAISED DOT ⸳ - 0x2E34, // RAISED COMMA ⸴ - 0x2E35, // TURNED SEMICOLON ⸵ - 0x2E36, // DAGGER WITH LEFT GUARD ⸶ - 0x2E37, // DAGGER WITH RIGHT GUARD ⸷ - 0x2E38, // TURNED DAGGER ⸸ - 0x2E39, // TOP HALF SECTION SIGN ⸹ - 0x2E3C, // STENOGRAPHIC FULL STOP ⸼ - 0x2E3D, // VERTICAL SIX DOTS ⸽ - 0x2E3E, // WIGGLY VERTICAL LINE ⸾ - 0x2E3F, // CAPITULUM ⸿ - 0x2E41, // REVERSED COMMA ⹁ - 0x2E43, // DASH WITH LEFT UPTURN ⹃ - 0x2E44, // DOUBLE SUSPENSION MARK ⹄ - 0x2E45, // INVERTED LOW KAVYKA ⹅ - 0x2E46, // INVERTED LOW KAVYKA WITH KAVYKA ABOVE ⹆ - 0x2E47, // LOW KAVYKA ⹇ - 0x2E48, // LOW KAVYKA WITH DOT ⹈ - 0x2E49, // DOUBLE STACKED COMMA ⹉ - 0x2E4A, // DOTTED SOLIDUS ⹊ - 0x2E4B, // TRIPLE DAGGER ⹋ - 0x2E4C, // MEDIEVAL COMMA ⹌ - 0x2E4D, // PARAGRAPHUS MARK ⹍ - 0x2E4E, // PUNCTUS ELEVATUS MARK ⹎ - 0x2E4F, // CORNISH VERSE DIVIDER ⹏ - 0x3001, // IDEOGRAPHIC COMMA 、 - 0x3002, // IDEOGRAPHIC FULL STOP 。 - 0x3003, // DITTO MARK 〃 - 0x303D, // PART ALTERNATION MARK 〽 - 0x30FB, // KATAKANA MIDDLE DOT ・ - 0xA4FE, // LISU PUNCTUATION COMMA ꓾ - 0xA4FF, // LISU PUNCTUATION FULL STOP ꓿ - 0xA60D, // VAI COMMA ꘍ - 0xA60E, // VAI FULL STOP ꘎ - 0xA60F, // VAI QUESTION MARK ꘏ - 0xA673, // SLAVONIC ASTERISK ꙳ - 0xA67E, // CYRILLIC KAVYKA ꙾ - 0xA6F2, // BAMUM NJAEMLI ꛲ - 0xA6F3, // BAMUM FULL STOP ꛳ - 0xA6F4, // BAMUM COLON ꛴ - 0xA6F5, // BAMUM COMMA ꛵ - 0xA6F6, // BAMUM SEMICOLON ꛶ - 0xA6F7, // BAMUM QUESTION MARK ꛷ - 0xA874, // PHAGS-PA SINGLE HEAD MARK ꡴ - 0xA875, // PHAGS-PA DOUBLE HEAD MARK ꡵ - 0xA876, // PHAGS-PA MARK SHAD ꡶ - 0xA877, // PHAGS-PA MARK DOUBLE SHAD ꡷ - 0xA8CE, // SAURASHTRA DANDA ꣎ - 0xA8CF, // SAURASHTRA DOUBLE DANDA ꣏ - 0xA8F8, // DEVANAGARI SIGN PUSHPIKA ꣸ - 0xA8F9, // DEVANAGARI GAP FILLER ꣹ - 0xA8FA, // DEVANAGARI CARET ꣺ - 0xA8FC, // DEVANAGARI SIGN SIDDHAM ꣼ - 0xA92E, // KAYAH LI SIGN CWI ꤮ - 0xA92F, // KAYAH LI SIGN SHYA ꤯ - 0xA95F, // REJANG SECTION MARK ꥟ - 0xA9C1, // JAVANESE LEFT RERENGGAN ꧁ - 0xA9C2, // JAVANESE RIGHT RERENGGAN ꧂ - 0xA9C3, // JAVANESE PADA ANDAP ꧃ - 0xA9C4, // JAVANESE PADA MADYA ꧄ - 0xA9C5, // JAVANESE PADA LUHUR ꧅ - 0xA9C6, // JAVANESE PADA WINDU ꧆ - 0xA9C7, // JAVANESE PADA PANGKAT ꧇ - 0xA9C8, // JAVANESE PADA LINGSA ꧈ - 0xA9C9, // JAVANESE PADA LUNGSI ꧉ - 0xA9CA, // JAVANESE PADA ADEG ꧊ - 0xA9CB, // JAVANESE PADA ADEG ADEG ꧋ - 0xA9CC, // JAVANESE PADA PISELEH ꧌ - 0xA9CD, // JAVANESE TURNED PADA PISELEH ꧍ - 0xA9DE, // JAVANESE PADA TIRTA TUMETES ꧞ - 0xA9DF, // JAVANESE PADA ISEN-ISEN ꧟ - 0xAA5C, // CHAM PUNCTUATION SPIRAL ꩜ - 0xAA5D, // CHAM PUNCTUATION DANDA ꩝ - 0xAA5E, // CHAM PUNCTUATION DOUBLE DANDA ꩞ - 0xAA5F, // CHAM PUNCTUATION TRIPLE DANDA ꩟ - 0xAADE, // TAI VIET SYMBOL HO HOI ꫞ - 0xAADF, // TAI VIET SYMBOL KOI KOI ꫟ - 0xAAF0, // MEETEI MAYEK CHEIKHAN ꫰ - 0xAAF1, // MEETEI MAYEK AHANG KHUDAM ꫱ - 0xABEB, // MEETEI MAYEK CHEIKHEI ꯫ - 0xFE10, // PRESENTATION FORM FOR VERTICAL COMMA ︐ - 0xFE11, // PRESENTATION FORM FOR VERTICAL IDEOGRAPHIC COMMA ︑ - 0xFE12, // PRESENTATION FORM FOR VERTICAL IDEOGRAPHIC FULL STOP ︒ - 0xFE13, // PRESENTATION FORM FOR VERTICAL COLON ︓ - 0xFE14, // PRESENTATION FORM FOR VERTICAL SEMICOLON ︔ - 0xFE15, // PRESENTATION FORM FOR VERTICAL EXCLAMATION MARK ︕ - 0xFE16, // PRESENTATION FORM FOR VERTICAL QUESTION MARK ︖ - 0xFE19, // PRESENTATION FORM FOR VERTICAL HORIZONTAL ELLIPSIS ︙ - 0xFE30, // PRESENTATION FORM FOR VERTICAL TWO DOT LEADER ︰ - 0xFE45, // SESAME DOT ﹅ - 0xFE46, // WHITE SESAME DOT ﹆ - 0xFE49, // DASHED OVERLINE ﹉ - 0xFE4A, // CENTRELINE OVERLINE ﹊ - 0xFE4B, // WAVY OVERLINE ﹋ - 0xFE4C, // DOUBLE WAVY OVERLINE ﹌ - 0xFE50, // SMALL COMMA ﹐ - 0xFE51, // SMALL IDEOGRAPHIC COMMA ﹑ - 0xFE52, // SMALL FULL STOP ﹒ - 0xFE54, // SMALL SEMICOLON ﹔ - 0xFE55, // SMALL COLON ﹕ - 0xFE56, // SMALL QUESTION MARK ﹖ - 0xFE57, // SMALL EXCLAMATION MARK ﹗ - 0xFE5F, // SMALL NUMBER SIGN ﹟ - 0xFE60, // SMALL AMPERSAND ﹠ - 0xFE61, // SMALL ASTERISK ﹡ - 0xFE68, // SMALL REVERSE SOLIDUS ﹨ - 0xFE6A, // SMALL PERCENT SIGN ﹪ - 0xFE6B, // SMALL COMMERCIAL AT ﹫ - 0xFF01, // FULLWIDTH EXCLAMATION MARK ! - 0xFF02, // FULLWIDTH QUOTATION MARK " - 0xFF03, // FULLWIDTH NUMBER SIGN # - 0xFF05, // FULLWIDTH PERCENT SIGN % - 0xFF06, // FULLWIDTH AMPERSAND & - 0xFF07, // FULLWIDTH APOSTROPHE ' - 0xFF0A, // FULLWIDTH ASTERISK * - 0xFF0C, // FULLWIDTH COMMA , - 0xFF0E, // FULLWIDTH FULL STOP . - 0xFF0F, // FULLWIDTH SOLIDUS / - 0xFF1A, // FULLWIDTH COLON : - 0xFF1B, // FULLWIDTH SEMICOLON ; - 0xFF1F, // FULLWIDTH QUESTION MARK ? - 0xFF20, // FULLWIDTH COMMERCIAL AT @ - 0xFF3C, // FULLWIDTH REVERSE SOLIDUS \ - 0xFF61, // HALFWIDTH IDEOGRAPHIC FULL STOP 。 - 0xFF64, // HALFWIDTH IDEOGRAPHIC COMMA 、 - 0xFF65, // HALFWIDTH KATAKANA MIDDLE DOT ・ - 0x10100, // AEGEAN WORD SEPARATOR LINE 𐄀 - 0x10101, // AEGEAN WORD SEPARATOR DOT 𐄁 - 0x10102, // AEGEAN CHECK MARK 𐄂 - 0x1039F, // UGARITIC WORD DIVIDER 𐎟 - 0x103D0, // OLD PERSIAN WORD DIVIDER 𐏐 - 0x1056F, // CAUCASIAN ALBANIAN CITATION MARK 𐕯 - 0x10857, // IMPERIAL ARAMAIC SECTION SIGN 𐡗 - 0x1091F, // PHOENICIAN WORD SEPARATOR 𐤟 - 0x1093F, // LYDIAN TRIANGULAR MARK 𐤿 - 0x10A50, // KHAROSHTHI PUNCTUATION DOT 𐩐 - 0x10A51, // KHAROSHTHI PUNCTUATION SMALL CIRCLE 𐩑 - 0x10A52, // KHAROSHTHI PUNCTUATION CIRCLE 𐩒 - 0x10A53, // KHAROSHTHI PUNCTUATION CRESCENT BAR 𐩓 - 0x10A54, // KHAROSHTHI PUNCTUATION MANGALAM 𐩔 - 0x10A55, // KHAROSHTHI PUNCTUATION LOTUS 𐩕 - 0x10A56, // KHAROSHTHI PUNCTUATION DANDA 𐩖 - 0x10A57, // KHAROSHTHI PUNCTUATION DOUBLE DANDA 𐩗 - 0x10A58, // KHAROSHTHI PUNCTUATION LINES 𐩘 - 0x10A7F, // OLD SOUTH ARABIAN NUMERIC INDICATOR 𐩿 - 0x10AF0, // MANICHAEAN PUNCTUATION STAR 𐫰 - 0x10AF1, // MANICHAEAN PUNCTUATION FLEURON 𐫱 - 0x10AF2, // MANICHAEAN PUNCTUATION DOUBLE DOT WITHIN DOT 𐫲 - 0x10AF3, // MANICHAEAN PUNCTUATION DOT WITHIN DOT 𐫳 - 0x10AF4, // MANICHAEAN PUNCTUATION DOT 𐫴 - 0x10AF5, // MANICHAEAN PUNCTUATION TWO DOTS 𐫵 - 0x10AF6, // MANICHAEAN PUNCTUATION LINE FILLER 𐫶 - 0x10B39, // AVESTAN ABBREVIATION MARK 𐬹 - 0x10B3A, // TINY TWO DOTS OVER ONE DOT PUNCTUATION 𐬺 - 0x10B3B, // SMALL TWO DOTS OVER ONE DOT PUNCTUATION 𐬻 - 0x10B3C, // LARGE TWO DOTS OVER ONE DOT PUNCTUATION 𐬼 - 0x10B3D, // LARGE ONE DOT OVER TWO DOTS PUNCTUATION 𐬽 - 0x10B3E, // LARGE TWO RINGS OVER ONE RING PUNCTUATION 𐬾 - 0x10B3F, // LARGE ONE RING OVER TWO RINGS PUNCTUATION 𐬿 - 0x10B99, // PSALTER PAHLAVI SECTION MARK 𐮙 - 0x10B9A, // PSALTER PAHLAVI TURNED SECTION MARK 𐮚 - 0x10B9B, // PSALTER PAHLAVI FOUR DOTS WITH CROSS 𐮛 - 0x10B9C, // PSALTER PAHLAVI FOUR DOTS WITH DOT 𐮜 - 0x10F55, // SOGDIAN PUNCTUATION TWO VERTICAL BARS 𐽕 - 0x10F56, // SOGDIAN PUNCTUATION TWO VERTICAL BARS WITH DOTS 𐽖 - 0x10F57, // SOGDIAN PUNCTUATION CIRCLE WITH DOT 𐽗 - 0x10F58, // SOGDIAN PUNCTUATION TWO CIRCLES WITH DOTS 𐽘 - 0x10F59, // SOGDIAN PUNCTUATION HALF CIRCLE WITH DOT 𐽙 - 0x11047, // BRAHMI DANDA 𑁇 - 0x11048, // BRAHMI DOUBLE DANDA 𑁈 - 0x11049, // BRAHMI PUNCTUATION DOT 𑁉 - 0x1104A, // BRAHMI PUNCTUATION DOUBLE DOT 𑁊 - 0x1104B, // BRAHMI PUNCTUATION LINE 𑁋 - 0x1104C, // BRAHMI PUNCTUATION CRESCENT BAR 𑁌 - 0x1104D, // BRAHMI PUNCTUATION LOTUS 𑁍 - 0x110BB, // KAITHI ABBREVIATION SIGN 𑂻 - 0x110BC, // KAITHI ENUMERATION SIGN 𑂼 - 0x110BE, // KAITHI SECTION MARK 𑂾 - 0x110BF, // KAITHI DOUBLE SECTION MARK 𑂿 - 0x110C0, // KAITHI DANDA 𑃀 - 0x110C1, // KAITHI DOUBLE DANDA 𑃁 - 0x11140, // CHAKMA SECTION MARK 𑅀 - 0x11141, // CHAKMA DANDA 𑅁 - 0x11142, // CHAKMA DOUBLE DANDA 𑅂 - 0x11143, // CHAKMA QUESTION MARK 𑅃 - 0x11174, // MAHAJANI ABBREVIATION SIGN 𑅴 - 0x11175, // MAHAJANI SECTION MARK 𑅵 - 0x111C5, // SHARADA DANDA 𑇅 - 0x111C6, // SHARADA DOUBLE DANDA 𑇆 - 0x111C7, // SHARADA ABBREVIATION SIGN 𑇇 - 0x111C8, // SHARADA SEPARATOR 𑇈 - 0x111CD, // SHARADA SUTRA MARK 𑇍 - 0x111DB, // SHARADA SIGN SIDDHAM 𑇛 - 0x111DD, // SHARADA CONTINUATION SIGN 𑇝 - 0x111DE, // SHARADA SECTION MARK-1 𑇞 - 0x111DF, // SHARADA SECTION MARK-2 𑇟 - 0x11238, // KHOJKI DANDA 𑈸 - 0x11239, // KHOJKI DOUBLE DANDA 𑈹 - 0x1123A, // KHOJKI WORD SEPARATOR 𑈺 - 0x1123B, // KHOJKI SECTION MARK 𑈻 - 0x1123C, // KHOJKI DOUBLE SECTION MARK 𑈼 - 0x1123D, // KHOJKI ABBREVIATION SIGN 𑈽 - 0x112A9, // MULTANI SECTION MARK 𑊩 - 0x1144B, // NEWA DANDA 𑑋 - 0x1144C, // NEWA DOUBLE DANDA 𑑌 - 0x1144D, // NEWA COMMA 𑑍 - 0x1144E, // NEWA GAP FILLER 𑑎 - 0x1144F, // NEWA ABBREVIATION SIGN 𑑏 - 0x1145B, // NEWA PLACEHOLDER MARK 𑑛 - 0x1145D, // NEWA INSERTION SIGN 𑑝 - 0x114C6, // TIRHUTA ABBREVIATION SIGN 𑓆 - 0x115C1, // SIDDHAM SIGN SIDDHAM 𑗁 - 0x115C2, // SIDDHAM DANDA 𑗂 - 0x115C3, // SIDDHAM DOUBLE DANDA 𑗃 - 0x115C4, // SIDDHAM SEPARATOR DOT 𑗄 - 0x115C5, // SIDDHAM SEPARATOR BAR 𑗅 - 0x115C6, // SIDDHAM REPETITION MARK-1 𑗆 - 0x115C7, // SIDDHAM REPETITION MARK-2 𑗇 - 0x115C8, // SIDDHAM REPETITION MARK-3 𑗈 - 0x115C9, // SIDDHAM END OF TEXT MARK 𑗉 - 0x115CA, // SIDDHAM SECTION MARK WITH TRIDENT AND U-SHAPED ORNAMENTS 𑗊 - 0x115CB, // SIDDHAM SECTION MARK WITH TRIDENT AND DOTTED CRESCENTS 𑗋 - 0x115CC, // SIDDHAM SECTION MARK WITH RAYS AND DOTTED CRESCENTS 𑗌 - 0x115CD, // SIDDHAM SECTION MARK WITH RAYS AND DOTTED DOUBLE CRESCENTS 𑗍 - 0x115CE, // SIDDHAM SECTION MARK WITH RAYS AND DOTTED TRIPLE CRESCENTS 𑗎 - 0x115CF, // SIDDHAM SECTION MARK DOUBLE RING 𑗏 - 0x115D0, // SIDDHAM SECTION MARK DOUBLE RING WITH RAYS 𑗐 - 0x115D1, // SIDDHAM SECTION MARK WITH DOUBLE CRESCENTS 𑗑 - 0x115D2, // SIDDHAM SECTION MARK WITH TRIPLE CRESCENTS 𑗒 - 0x115D3, // SIDDHAM SECTION MARK WITH QUADRUPLE CRESCENTS 𑗓 - 0x115D4, // SIDDHAM SECTION MARK WITH SEPTUPLE CRESCENTS 𑗔 - 0x115D5, // SIDDHAM SECTION MARK WITH CIRCLES AND RAYS 𑗕 - 0x115D6, // SIDDHAM SECTION MARK WITH CIRCLES AND TWO ENCLOSURES 𑗖 - 0x115D7, // SIDDHAM SECTION MARK WITH CIRCLES AND FOUR ENCLOSURES 𑗗 - 0x11641, // MODI DANDA 𑙁 - 0x11642, // MODI DOUBLE DANDA 𑙂 - 0x11643, // MODI ABBREVIATION SIGN 𑙃 - 0x11660, // MONGOLIAN BIRGA WITH ORNAMENT 𑙠 - 0x11661, // MONGOLIAN ROTATED BIRGA 𑙡 - 0x11662, // MONGOLIAN DOUBLE BIRGA WITH ORNAMENT 𑙢 - 0x11663, // MONGOLIAN TRIPLE BIRGA WITH ORNAMENT 𑙣 - 0x11664, // MONGOLIAN BIRGA WITH DOUBLE ORNAMENT 𑙤 - 0x11665, // MONGOLIAN ROTATED BIRGA WITH ORNAMENT 𑙥 - 0x11666, // MONGOLIAN ROTATED BIRGA WITH DOUBLE ORNAMENT 𑙦 - 0x11667, // MONGOLIAN INVERTED BIRGA 𑙧 - 0x11668, // MONGOLIAN INVERTED BIRGA WITH DOUBLE ORNAMENT 𑙨 - 0x11669, // MONGOLIAN SWIRL BIRGA 𑙩 - 0x1166A, // MONGOLIAN SWIRL BIRGA WITH ORNAMENT 𑙪 - 0x1166B, // MONGOLIAN SWIRL BIRGA WITH DOUBLE ORNAMENT 𑙫 - 0x1166C, // MONGOLIAN TURNED SWIRL BIRGA WITH DOUBLE ORNAMENT 𑙬 - 0x1173C, // AHOM SIGN SMALL SECTION 𑜼 - 0x1173D, // AHOM SIGN SECTION 𑜽 - 0x1173E, // AHOM SIGN RULAI 𑜾 - 0x1183B, // DOGRA ABBREVIATION SIGN 𑠻 - 0x119E2, // NANDINAGARI SIGN SIDDHAM 𑧢 - 0x11A3F, // ZANABAZAR SQUARE INITIAL HEAD MARK 𑨿 - 0x11A40, // ZANABAZAR SQUARE CLOSING HEAD MARK 𑩀 - 0x11A41, // ZANABAZAR SQUARE MARK TSHEG 𑩁 - 0x11A42, // ZANABAZAR SQUARE MARK SHAD 𑩂 - 0x11A43, // ZANABAZAR SQUARE MARK DOUBLE SHAD 𑩃 - 0x11A44, // ZANABAZAR SQUARE MARK LONG TSHEG 𑩄 - 0x11A45, // ZANABAZAR SQUARE INITIAL DOUBLE-LINED HEAD MARK 𑩅 - 0x11A46, // ZANABAZAR SQUARE CLOSING DOUBLE-LINED HEAD MARK 𑩆 - 0x11A9A, // SOYOMBO MARK TSHEG 𑪚 - 0x11A9B, // SOYOMBO MARK SHAD 𑪛 - 0x11A9C, // SOYOMBO MARK DOUBLE SHAD 𑪜 - 0x11A9E, // SOYOMBO HEAD MARK WITH MOON AND SUN AND TRIPLE FLAME 𑪞 - 0x11A9F, // SOYOMBO HEAD MARK WITH MOON AND SUN AND FLAME 𑪟 - 0x11AA0, // SOYOMBO HEAD MARK WITH MOON AND SUN 𑪠 - 0x11AA1, // SOYOMBO TERMINAL MARK-1 𑪡 - 0x11AA2, // SOYOMBO TERMINAL MARK-2 𑪢 - 0x11C41, // BHAIKSUKI DANDA 𑱁 - 0x11C42, // BHAIKSUKI DOUBLE DANDA 𑱂 - 0x11C43, // BHAIKSUKI WORD SEPARATOR 𑱃 - 0x11C44, // BHAIKSUKI GAP FILLER-1 𑱄 - 0x11C45, // BHAIKSUKI GAP FILLER-2 𑱅 - 0x11C70, // MARCHEN HEAD MARK 𑱰 - 0x11C71, // MARCHEN MARK SHAD 𑱱 - 0x11EF7, // MAKASAR PASSIMBANG 𑻷 - 0x11EF8, // MAKASAR END OF SECTION 𑻸 - 0x11FFF, // TAMIL PUNCTUATION END OF TEXT 𑿿 - 0x12470, // CUNEIFORM PUNCTUATION SIGN OLD ASSYRIAN WORD DIVIDER 𒑰 - 0x12471, // CUNEIFORM PUNCTUATION SIGN VERTICAL COLON 𒑱 - 0x12472, // CUNEIFORM PUNCTUATION SIGN DIAGONAL COLON 𒑲 - 0x12473, // CUNEIFORM PUNCTUATION SIGN DIAGONAL TRICOLON 𒑳 - 0x12474, // CUNEIFORM PUNCTUATION SIGN DIAGONAL QUADCOLON 𒑴 - 0x16A6E, // MRO DANDA 𖩮 - 0x16A6F, // MRO DOUBLE DANDA 𖩯 - 0x16AF5, // BASSA VAH FULL STOP 𖫵 - 0x16B37, // PAHAWH HMONG SIGN VOS THOM 𖬷 - 0x16B38, // PAHAWH HMONG SIGN VOS TSHAB CEEB 𖬸 - 0x16B39, // PAHAWH HMONG SIGN CIM CHEEM 𖬹 - 0x16B3A, // PAHAWH HMONG SIGN VOS THIAB 𖬺 - 0x16B3B, // PAHAWH HMONG SIGN VOS FEEM 𖬻 - 0x16B44, // PAHAWH HMONG SIGN XAUS 𖭄 - 0x16E97, // MEDEFAIDRIN COMMA 𖺗 - 0x16E98, // MEDEFAIDRIN FULL STOP 𖺘 - 0x16E99, // MEDEFAIDRIN SYMBOL AIVA 𖺙 - 0x16E9A, // MEDEFAIDRIN EXCLAMATION OH 𖺚 - 0x16FE2, // OLD CHINESE HOOK MARK 𖿢 - 0x1BC9F, // DUPLOYAN PUNCTUATION CHINOOK FULL STOP 𛲟 - 0x1DA87, // SIGNWRITING COMMA 𝪇 - 0x1DA88, // SIGNWRITING FULL STOP 𝪈 - 0x1DA89, // SIGNWRITING SEMICOLON 𝪉 - 0x1DA8A, // SIGNWRITING COLON 𝪊 - 0x1DA8B, // SIGNWRITING PARENTHESIS 𝪋 - 0x1E95E, // ADLAM INITIAL EXCLAMATION MARK 𞥞 - 0x1E95F, // ADLAM INITIAL QUESTION MARK - ] -) +// Unicode Characters in the 'Punctuation, Other' Category +// Character Name Browser Image +const unicode_punct = [ + 0x0021, // EXCLAMATION MARK ! + 0x0022, // QUOTATION MARK " + 0x0023, // NUMBER SIGN # + 0x0025, // PERCENT SIGN % + 0x0026, // AMPERSAND & + 0x0027, // APOSTROPHE ' + 0x002A, // ASTERISK * + 0x002C, // COMMA , + 0x002E, // FULL STOP . + 0x002F, // SOLIDUS / + 0x003A, // COLON : + 0x003B, // SEMICOLON ; + 0x003F, // QUESTION MARK ? + 0x0040, // COMMERCIAL AT @ + 0x005C, // REVERSE SOLIDUS \ + 0x00A1, // INVERTED EXCLAMATION MARK ¡ + 0x00A7, // SECTION SIGN § + 0x00B6, // PILCROW SIGN ¶ + 0x00B7, // MIDDLE DOT · + 0x00BF, // INVERTED QUESTION MARK ¿ + 0x037E, // GREEK QUESTION MARK ; + 0x0387, // GREEK ANO TELEIA · + 0x055A, // ARMENIAN APOSTROPHE ՚ + 0x055B, // ARMENIAN EMPHASIS MARK ՛ + 0x055C, // ARMENIAN EXCLAMATION MARK ՜ + 0x055D, // ARMENIAN COMMA ՝ + 0x055E, // ARMENIAN QUESTION MARK ՞ + 0x055F, // ARMENIAN ABBREVIATION MARK ՟ + 0x0589, // ARMENIAN FULL STOP ։ + 0x05C0, // HEBREW PUNCTUATION PASEQ ׀ + 0x05C3, // HEBREW PUNCTUATION SOF PASUQ ׃ + 0x05C6, // HEBREW PUNCTUATION NUN HAFUKHA ׆ + 0x05F3, // HEBREW PUNCTUATION GERESH ׳ + 0x05F4, // HEBREW PUNCTUATION GERSHAYIM ״ + 0x0609, // ARABIC-INDIC PER MILLE SIGN ؉ + 0x060A, // ARABIC-INDIC PER TEN THOUSAND SIGN ؊ + 0x060C, // ARABIC COMMA ، + 0x060D, // ARABIC DATE SEPARATOR ؍ + 0x061B, // ARABIC SEMICOLON ؛ + 0x061E, // ARABIC TRIPLE DOT PUNCTUATION MARK ؞ + 0x061F, // ARABIC QUESTION MARK ؟ + 0x066A, // ARABIC PERCENT SIGN ٪ + 0x066B, // ARABIC DECIMAL SEPARATOR ٫ + 0x066C, // ARABIC THOUSANDS SEPARATOR ٬ + 0x066D, // ARABIC FIVE POINTED STAR ٭ + 0x06D4, // ARABIC FULL STOP ۔ + 0x0700, // SYRIAC END OF PARAGRAPH ܀ + 0x0701, // SYRIAC SUPRALINEAR FULL STOP ܁ + 0x0702, // SYRIAC SUBLINEAR FULL STOP ܂ + 0x0703, // SYRIAC SUPRALINEAR COLON ܃ + 0x0704, // SYRIAC SUBLINEAR COLON ܄ + 0x0705, // SYRIAC HORIZONTAL COLON ܅ + 0x0706, // SYRIAC COLON SKEWED LEFT ܆ + 0x0707, // SYRIAC COLON SKEWED RIGHT ܇ + 0x0708, // SYRIAC SUPRALINEAR COLON SKEWED LEFT ܈ + 0x0709, // SYRIAC SUBLINEAR COLON SKEWED RIGHT ܉ + 0x070A, // SYRIAC CONTRACTION ܊ + 0x070B, // SYRIAC HARKLEAN OBELUS ܋ + 0x070C, // SYRIAC HARKLEAN METOBELUS ܌ + 0x070D, // SYRIAC HARKLEAN ASTERISCUS ܍ + 0x07F7, // NKO SYMBOL GBAKURUNEN ߷ + 0x07F8, // NKO COMMA ߸ + 0x07F9, // NKO EXCLAMATION MARK ߹ + 0x0830, // SAMARITAN PUNCTUATION NEQUDAA ࠰ + 0x0831, // SAMARITAN PUNCTUATION AFSAAQ ࠱ + 0x0832, // SAMARITAN PUNCTUATION ANGED ࠲ + 0x0833, // SAMARITAN PUNCTUATION BAU ࠳ + 0x0834, // SAMARITAN PUNCTUATION ATMAAU ࠴ + 0x0835, // SAMARITAN PUNCTUATION SHIYYAALAA ࠵ + 0x0836, // SAMARITAN ABBREVIATION MARK ࠶ + 0x0837, // SAMARITAN PUNCTUATION MELODIC QITSA ࠷ + 0x0838, // SAMARITAN PUNCTUATION ZIQAA ࠸ + 0x0839, // SAMARITAN PUNCTUATION QITSA ࠹ + 0x083A, // SAMARITAN PUNCTUATION ZAEF ࠺ + 0x083B, // SAMARITAN PUNCTUATION TURU ࠻ + 0x083C, // SAMARITAN PUNCTUATION ARKAANU ࠼ + 0x083D, // SAMARITAN PUNCTUATION SOF MASHFAAT ࠽ + 0x083E, // SAMARITAN PUNCTUATION ANNAAU ࠾ + 0x085E, // MANDAIC PUNCTUATION ࡞ + 0x0964, // DEVANAGARI DANDA । + 0x0965, // DEVANAGARI DOUBLE DANDA ॥ + 0x0970, // DEVANAGARI ABBREVIATION SIGN ॰ + 0x09FD, // BENGALI ABBREVIATION SIGN ৽ + 0x0A76, // GURMUKHI ABBREVIATION SIGN ੶ + 0x0AF0, // GUJARATI ABBREVIATION SIGN ૰ + 0x0C77, // TELUGU SIGN SIDDHAM ౷ + 0x0C84, // KANNADA SIGN SIDDHAM ಄ + 0x0DF4, // SINHALA PUNCTUATION KUNDDALIYA ෴ + 0x0E4F, // THAI CHARACTER FONGMAN ๏ + 0x0E5A, // THAI CHARACTER ANGKHANKHU ๚ + 0x0E5B, // THAI CHARACTER KHOMUT ๛ + 0x0F04, // TIBETAN MARK INITIAL YIG MGO MDUN MA ༄ + 0x0F05, // TIBETAN MARK CLOSING YIG MGO SGAB MA ༅ + 0x0F06, // TIBETAN MARK CARET YIG MGO PHUR SHAD MA ༆ + 0x0F07, // TIBETAN MARK YIG MGO TSHEG SHAD MA ༇ + 0x0F08, // TIBETAN MARK SBRUL SHAD ༈ + 0x0F09, // TIBETAN MARK BSKUR YIG MGO ༉ + 0x0F0A, // TIBETAN MARK BKA- SHOG YIG MGO ༊ + 0x0F0B, // TIBETAN MARK INTERSYLLABIC TSHEG ་ + 0x0F0C, // TIBETAN MARK DELIMITER TSHEG BSTAR ༌ + 0x0F0D, // TIBETAN MARK SHAD ། + 0x0F0E, // TIBETAN MARK NYIS SHAD ༎ + 0x0F0F, // TIBETAN MARK TSHEG SHAD ༏ + 0x0F10, // TIBETAN MARK NYIS TSHEG SHAD ༐ + 0x0F11, // TIBETAN MARK RIN CHEN SPUNGS SHAD ༑ + 0x0F12, // TIBETAN MARK RGYA GRAM SHAD ༒ + 0x0F14, // TIBETAN MARK GTER TSHEG ༔ + 0x0F85, // TIBETAN MARK PALUTA ྅ + 0x0FD0, // TIBETAN MARK BSKA- SHOG GI MGO RGYAN ࿐ + 0x0FD1, // TIBETAN MARK MNYAM YIG GI MGO RGYAN ࿑ + 0x0FD2, // TIBETAN MARK NYIS TSHEG ࿒ + 0x0FD3, // TIBETAN MARK INITIAL BRDA RNYING YIG MGO MDUN MA ࿓ + 0x0FD4, // TIBETAN MARK CLOSING BRDA RNYING YIG MGO SGAB MA ࿔ + 0x0FD9, // TIBETAN MARK LEADING MCHAN RTAGS ࿙ + 0x0FDA, // TIBETAN MARK TRAILING MCHAN RTAGS ࿚ + 0x104A, // MYANMAR SIGN LITTLE SECTION ၊ + 0x104B, // MYANMAR SIGN SECTION ။ + 0x104C, // MYANMAR SYMBOL LOCATIVE ၌ + 0x104D, // MYANMAR SYMBOL COMPLETED ၍ + 0x104E, // MYANMAR SYMBOL AFOREMENTIONED ၎ + 0x104F, // MYANMAR SYMBOL GENITIVE ၏ + 0x10FB, // GEORGIAN PARAGRAPH SEPARATOR ჻ + 0x1360, // ETHIOPIC SECTION MARK ፠ + 0x1361, // ETHIOPIC WORDSPACE ፡ + 0x1362, // ETHIOPIC FULL STOP ። + 0x1363, // ETHIOPIC COMMA ፣ + 0x1364, // ETHIOPIC SEMICOLON ፤ + 0x1365, // ETHIOPIC COLON ፥ + 0x1366, // ETHIOPIC PREFACE COLON ፦ + 0x1367, // ETHIOPIC QUESTION MARK ፧ + 0x1368, // ETHIOPIC PARAGRAPH SEPARATOR ፨ + 0x166E, // CANADIAN SYLLABICS FULL STOP ᙮ + 0x16EB, // RUNIC SINGLE PUNCTUATION ᛫ + 0x16EC, // RUNIC MULTIPLE PUNCTUATION ᛬ + 0x16ED, // RUNIC CROSS PUNCTUATION ᛭ + 0x1735, // PHILIPPINE SINGLE PUNCTUATION ᜵ + 0x1736, // PHILIPPINE DOUBLE PUNCTUATION ᜶ + 0x17D4, // KHMER SIGN KHAN ។ + 0x17D5, // KHMER SIGN BARIYOOSAN ៕ + 0x17D6, // KHMER SIGN CAMNUC PII KUUH ៖ + 0x17D8, // KHMER SIGN BEYYAL ៘ + 0x17D9, // KHMER SIGN PHNAEK MUAN ៙ + 0x17DA, // KHMER SIGN KOOMUUT ៚ + 0x1800, // MONGOLIAN BIRGA ᠀ + 0x1801, // MONGOLIAN ELLIPSIS ᠁ + 0x1802, // MONGOLIAN COMMA ᠂ + 0x1803, // MONGOLIAN FULL STOP ᠃ + 0x1804, // MONGOLIAN COLON ᠄ + 0x1805, // MONGOLIAN FOUR DOTS ᠅ + 0x1807, // MONGOLIAN SIBE SYLLABLE BOUNDARY MARKER ᠇ + 0x1808, // MONGOLIAN MANCHU COMMA ᠈ + 0x1809, // MONGOLIAN MANCHU FULL STOP ᠉ + 0x180A, // MONGOLIAN NIRUGU ᠊ + 0x1944, // LIMBU EXCLAMATION MARK ᥄ + 0x1945, // LIMBU QUESTION MARK ᥅ + 0x1A1E, // BUGINESE PALLAWA ᨞ + 0x1A1F, // BUGINESE END OF SECTION ᨟ + 0x1AA0, // TAI THAM SIGN WIANG ᪠ + 0x1AA1, // TAI THAM SIGN WIANGWAAK ᪡ + 0x1AA2, // TAI THAM SIGN SAWAN ᪢ + 0x1AA3, // TAI THAM SIGN KEOW ᪣ + 0x1AA4, // TAI THAM SIGN HOY ᪤ + 0x1AA5, // TAI THAM SIGN DOKMAI ᪥ + 0x1AA6, // TAI THAM SIGN REVERSED ROTATED RANA ᪦ + 0x1AA8, // TAI THAM SIGN KAAN ᪨ + 0x1AA9, // TAI THAM SIGN KAANKUU ᪩ + 0x1AAA, // TAI THAM SIGN SATKAAN ᪪ + 0x1AAB, // TAI THAM SIGN SATKAANKUU ᪫ + 0x1AAC, // TAI THAM SIGN HANG ᪬ + 0x1AAD, // TAI THAM SIGN CAANG ᪭ + 0x1B5A, // BALINESE PANTI ᭚ + 0x1B5B, // BALINESE PAMADA ᭛ + 0x1B5C, // BALINESE WINDU ᭜ + 0x1B5D, // BALINESE CARIK PAMUNGKAH ᭝ + 0x1B5E, // BALINESE CARIK SIKI ᭞ + 0x1B5F, // BALINESE CARIK PAREREN ᭟ + 0x1B60, // BALINESE PAMENENG ᭠ + 0x1BFC, // BATAK SYMBOL BINDU NA METEK ᯼ + 0x1BFD, // BATAK SYMBOL BINDU PINARBORAS ᯽ + 0x1BFE, // BATAK SYMBOL BINDU JUDUL ᯾ + 0x1BFF, // BATAK SYMBOL BINDU PANGOLAT ᯿ + 0x1C3B, // LEPCHA PUNCTUATION TA-ROL ᰻ + 0x1C3C, // LEPCHA PUNCTUATION NYET THYOOM TA-ROL ᰼ + 0x1C3D, // LEPCHA PUNCTUATION CER-WA ᰽ + 0x1C3E, // LEPCHA PUNCTUATION TSHOOK CER-WA ᰾ + 0x1C3F, // LEPCHA PUNCTUATION TSHOOK ᰿ + 0x1C7E, // OL CHIKI PUNCTUATION MUCAAD ᱾ + 0x1C7F, // OL CHIKI PUNCTUATION DOUBLE MUCAAD ᱿ + 0x1CC0, // SUNDANESE PUNCTUATION BINDU SURYA ᳀ + 0x1CC1, // SUNDANESE PUNCTUATION BINDU PANGLONG ᳁ + 0x1CC2, // SUNDANESE PUNCTUATION BINDU PURNAMA ᳂ + 0x1CC3, // SUNDANESE PUNCTUATION BINDU CAKRA ᳃ + 0x1CC4, // SUNDANESE PUNCTUATION BINDU LEU SATANGA ᳄ + 0x1CC5, // SUNDANESE PUNCTUATION BINDU KA SATANGA ᳅ + 0x1CC6, // SUNDANESE PUNCTUATION BINDU DA SATANGA ᳆ + 0x1CC7, // SUNDANESE PUNCTUATION BINDU BA SATANGA ᳇ + 0x1CD3, // VEDIC SIGN NIHSHVASA ᳓ + 0x2016, // DOUBLE VERTICAL LINE ‖ + 0x2017, // DOUBLE LOW LINE ‗ + 0x2020, // DAGGER † + 0x2021, // DOUBLE DAGGER ‡ + 0x2022, // BULLET • + 0x2023, // TRIANGULAR BULLET ‣ + 0x2024, // ONE DOT LEADER ․ + 0x2025, // TWO DOT LEADER ‥ + 0x2026, // HORIZONTAL ELLIPSIS … + 0x2027, // HYPHENATION POINT ‧ + 0x2030, // PER MILLE SIGN ‰ + 0x2031, // PER TEN THOUSAND SIGN ‱ + 0x2032, // PRIME ′ + 0x2033, // DOUBLE PRIME ″ + 0x2034, // TRIPLE PRIME ‴ + 0x2035, // REVERSED PRIME ‵ + 0x2036, // REVERSED DOUBLE PRIME ‶ + 0x2037, // REVERSED TRIPLE PRIME ‷ + 0x2038, // CARET ‸ + 0x203B, // REFERENCE MARK ※ + 0x203C, // DOUBLE EXCLAMATION MARK ‼ + 0x203D, // INTERROBANG ‽ + 0x203E, // OVERLINE ‾ + 0x2041, // CARET INSERTION POINT ⁁ + 0x2042, // ASTERISM ⁂ + 0x2043, // HYPHEN BULLET ⁃ + 0x2047, // DOUBLE QUESTION MARK ⁇ + 0x2048, // QUESTION EXCLAMATION MARK ⁈ + 0x2049, // EXCLAMATION QUESTION MARK ⁉ + 0x204A, // TIRONIAN SIGN ET ⁊ + 0x204B, // REVERSED PILCROW SIGN ⁋ + 0x204C, // BLACK LEFTWARDS BULLET ⁌ + 0x204D, // BLACK RIGHTWARDS BULLET ⁍ + 0x204E, // LOW ASTERISK ⁎ + 0x204F, // REVERSED SEMICOLON ⁏ + 0x2050, // CLOSE UP ⁐ + 0x2051, // TWO ASTERISKS ALIGNED VERTICALLY ⁑ + 0x2053, // SWUNG DASH ⁓ + 0x2055, // FLOWER PUNCTUATION MARK ⁕ + 0x2056, // THREE DOT PUNCTUATION ⁖ + 0x2057, // QUADRUPLE PRIME ⁗ + 0x2058, // FOUR DOT PUNCTUATION ⁘ + 0x2059, // FIVE DOT PUNCTUATION ⁙ + 0x205A, // TWO DOT PUNCTUATION ⁚ + 0x205B, // FOUR DOT MARK ⁛ + 0x205C, // DOTTED CROSS ⁜ + 0x205D, // TRICOLON ⁝ + 0x205E, // VERTICAL FOUR DOTS ⁞ + 0x2CF9, // COPTIC OLD NUBIAN FULL STOP ⳹ + 0x2CFA, // COPTIC OLD NUBIAN DIRECT QUESTION MARK ⳺ + 0x2CFB, // COPTIC OLD NUBIAN INDIRECT QUESTION MARK ⳻ + 0x2CFC, // COPTIC OLD NUBIAN VERSE DIVIDER ⳼ + 0x2CFE, // COPTIC FULL STOP ⳾ + 0x2CFF, // COPTIC MORPHOLOGICAL DIVIDER ⳿ + 0x2D70, // TIFINAGH SEPARATOR MARK ⵰ + 0x2E00, // RIGHT ANGLE SUBSTITUTION MARKER ⸀ + 0x2E01, // RIGHT ANGLE DOTTED SUBSTITUTION MARKER ⸁ + 0x2E06, // RAISED INTERPOLATION MARKER ⸆ + 0x2E07, // RAISED DOTTED INTERPOLATION MARKER ⸇ + 0x2E08, // DOTTED TRANSPOSITION MARKER ⸈ + 0x2E0B, // RAISED SQUARE ⸋ + 0x2E0E, // EDITORIAL CORONIS ⸎ + 0x2E0F, // PARAGRAPHOS ⸏ + 0x2E10, // FORKED PARAGRAPHOS ⸐ + 0x2E11, // REVERSED FORKED PARAGRAPHOS ⸑ + 0x2E12, // HYPODIASTOLE ⸒ + 0x2E13, // DOTTED OBELOS ⸓ + 0x2E14, // DOWNWARDS ANCORA ⸔ + 0x2E15, // UPWARDS ANCORA ⸕ + 0x2E16, // DOTTED RIGHT-POINTING ANGLE ⸖ + 0x2E18, // INVERTED INTERROBANG ⸘ + 0x2E19, // PALM BRANCH ⸙ + 0x2E1B, // TILDE WITH RING ABOVE ⸛ + 0x2E1E, // TILDE WITH DOT ABOVE ⸞ + 0x2E1F, // TILDE WITH DOT BELOW ⸟ + 0x2E2A, // TWO DOTS OVER ONE DOT PUNCTUATION ⸪ + 0x2E2B, // ONE DOT OVER TWO DOTS PUNCTUATION ⸫ + 0x2E2C, // SQUARED FOUR DOT PUNCTUATION ⸬ + 0x2E2D, // FIVE DOT MARK ⸭ + 0x2E2E, // REVERSED QUESTION MARK ⸮ + 0x2E30, // RING POINT ⸰ + 0x2E31, // WORD SEPARATOR MIDDLE DOT ⸱ + 0x2E32, // TURNED COMMA ⸲ + 0x2E33, // RAISED DOT ⸳ + 0x2E34, // RAISED COMMA ⸴ + 0x2E35, // TURNED SEMICOLON ⸵ + 0x2E36, // DAGGER WITH LEFT GUARD ⸶ + 0x2E37, // DAGGER WITH RIGHT GUARD ⸷ + 0x2E38, // TURNED DAGGER ⸸ + 0x2E39, // TOP HALF SECTION SIGN ⸹ + 0x2E3C, // STENOGRAPHIC FULL STOP ⸼ + 0x2E3D, // VERTICAL SIX DOTS ⸽ + 0x2E3E, // WIGGLY VERTICAL LINE ⸾ + 0x2E3F, // CAPITULUM ⸿ + 0x2E41, // REVERSED COMMA ⹁ + 0x2E43, // DASH WITH LEFT UPTURN ⹃ + 0x2E44, // DOUBLE SUSPENSION MARK ⹄ + 0x2E45, // INVERTED LOW KAVYKA ⹅ + 0x2E46, // INVERTED LOW KAVYKA WITH KAVYKA ABOVE ⹆ + 0x2E47, // LOW KAVYKA ⹇ + 0x2E48, // LOW KAVYKA WITH DOT ⹈ + 0x2E49, // DOUBLE STACKED COMMA ⹉ + 0x2E4A, // DOTTED SOLIDUS ⹊ + 0x2E4B, // TRIPLE DAGGER ⹋ + 0x2E4C, // MEDIEVAL COMMA ⹌ + 0x2E4D, // PARAGRAPHUS MARK ⹍ + 0x2E4E, // PUNCTUS ELEVATUS MARK ⹎ + 0x2E4F, // CORNISH VERSE DIVIDER ⹏ + 0x3001, // IDEOGRAPHIC COMMA 、 + 0x3002, // IDEOGRAPHIC FULL STOP 。 + 0x3003, // DITTO MARK 〃 + 0x303D, // PART ALTERNATION MARK 〽 + 0x30FB, // KATAKANA MIDDLE DOT ・ + 0xA4FE, // LISU PUNCTUATION COMMA ꓾ + 0xA4FF, // LISU PUNCTUATION FULL STOP ꓿ + 0xA60D, // VAI COMMA ꘍ + 0xA60E, // VAI FULL STOP ꘎ + 0xA60F, // VAI QUESTION MARK ꘏ + 0xA673, // SLAVONIC ASTERISK ꙳ + 0xA67E, // CYRILLIC KAVYKA ꙾ + 0xA6F2, // BAMUM NJAEMLI ꛲ + 0xA6F3, // BAMUM FULL STOP ꛳ + 0xA6F4, // BAMUM COLON ꛴ + 0xA6F5, // BAMUM COMMA ꛵ + 0xA6F6, // BAMUM SEMICOLON ꛶ + 0xA6F7, // BAMUM QUESTION MARK ꛷ + 0xA874, // PHAGS-PA SINGLE HEAD MARK ꡴ + 0xA875, // PHAGS-PA DOUBLE HEAD MARK ꡵ + 0xA876, // PHAGS-PA MARK SHAD ꡶ + 0xA877, // PHAGS-PA MARK DOUBLE SHAD ꡷ + 0xA8CE, // SAURASHTRA DANDA ꣎ + 0xA8CF, // SAURASHTRA DOUBLE DANDA ꣏ + 0xA8F8, // DEVANAGARI SIGN PUSHPIKA ꣸ + 0xA8F9, // DEVANAGARI GAP FILLER ꣹ + 0xA8FA, // DEVANAGARI CARET ꣺ + 0xA8FC, // DEVANAGARI SIGN SIDDHAM ꣼ + 0xA92E, // KAYAH LI SIGN CWI ꤮ + 0xA92F, // KAYAH LI SIGN SHYA ꤯ + 0xA95F, // REJANG SECTION MARK ꥟ + 0xA9C1, // JAVANESE LEFT RERENGGAN ꧁ + 0xA9C2, // JAVANESE RIGHT RERENGGAN ꧂ + 0xA9C3, // JAVANESE PADA ANDAP ꧃ + 0xA9C4, // JAVANESE PADA MADYA ꧄ + 0xA9C5, // JAVANESE PADA LUHUR ꧅ + 0xA9C6, // JAVANESE PADA WINDU ꧆ + 0xA9C7, // JAVANESE PADA PANGKAT ꧇ + 0xA9C8, // JAVANESE PADA LINGSA ꧈ + 0xA9C9, // JAVANESE PADA LUNGSI ꧉ + 0xA9CA, // JAVANESE PADA ADEG ꧊ + 0xA9CB, // JAVANESE PADA ADEG ADEG ꧋ + 0xA9CC, // JAVANESE PADA PISELEH ꧌ + 0xA9CD, // JAVANESE TURNED PADA PISELEH ꧍ + 0xA9DE, // JAVANESE PADA TIRTA TUMETES ꧞ + 0xA9DF, // JAVANESE PADA ISEN-ISEN ꧟ + 0xAA5C, // CHAM PUNCTUATION SPIRAL ꩜ + 0xAA5D, // CHAM PUNCTUATION DANDA ꩝ + 0xAA5E, // CHAM PUNCTUATION DOUBLE DANDA ꩞ + 0xAA5F, // CHAM PUNCTUATION TRIPLE DANDA ꩟ + 0xAADE, // TAI VIET SYMBOL HO HOI ꫞ + 0xAADF, // TAI VIET SYMBOL KOI KOI ꫟ + 0xAAF0, // MEETEI MAYEK CHEIKHAN ꫰ + 0xAAF1, // MEETEI MAYEK AHANG KHUDAM ꫱ + 0xABEB, // MEETEI MAYEK CHEIKHEI ꯫ + 0xFE10, // PRESENTATION FORM FOR VERTICAL COMMA ︐ + 0xFE11, // PRESENTATION FORM FOR VERTICAL IDEOGRAPHIC COMMA ︑ + 0xFE12, // PRESENTATION FORM FOR VERTICAL IDEOGRAPHIC FULL STOP ︒ + 0xFE13, // PRESENTATION FORM FOR VERTICAL COLON ︓ + 0xFE14, // PRESENTATION FORM FOR VERTICAL SEMICOLON ︔ + 0xFE15, // PRESENTATION FORM FOR VERTICAL EXCLAMATION MARK ︕ + 0xFE16, // PRESENTATION FORM FOR VERTICAL QUESTION MARK ︖ + 0xFE19, // PRESENTATION FORM FOR VERTICAL HORIZONTAL ELLIPSIS ︙ + 0xFE30, // PRESENTATION FORM FOR VERTICAL TWO DOT LEADER ︰ + 0xFE45, // SESAME DOT ﹅ + 0xFE46, // WHITE SESAME DOT ﹆ + 0xFE49, // DASHED OVERLINE ﹉ + 0xFE4A, // CENTRELINE OVERLINE ﹊ + 0xFE4B, // WAVY OVERLINE ﹋ + 0xFE4C, // DOUBLE WAVY OVERLINE ﹌ + 0xFE50, // SMALL COMMA ﹐ + 0xFE51, // SMALL IDEOGRAPHIC COMMA ﹑ + 0xFE52, // SMALL FULL STOP ﹒ + 0xFE54, // SMALL SEMICOLON ﹔ + 0xFE55, // SMALL COLON ﹕ + 0xFE56, // SMALL QUESTION MARK ﹖ + 0xFE57, // SMALL EXCLAMATION MARK ﹗ + 0xFE5F, // SMALL NUMBER SIGN ﹟ + 0xFE60, // SMALL AMPERSAND ﹠ + 0xFE61, // SMALL ASTERISK ﹡ + 0xFE68, // SMALL REVERSE SOLIDUS ﹨ + 0xFE6A, // SMALL PERCENT SIGN ﹪ + 0xFE6B, // SMALL COMMERCIAL AT ﹫ + 0xFF01, // FULLWIDTH EXCLAMATION MARK ! + 0xFF02, // FULLWIDTH QUOTATION MARK " + 0xFF03, // FULLWIDTH NUMBER SIGN # + 0xFF05, // FULLWIDTH PERCENT SIGN % + 0xFF06, // FULLWIDTH AMPERSAND & + 0xFF07, // FULLWIDTH APOSTROPHE ' + 0xFF0A, // FULLWIDTH ASTERISK * + 0xFF0C, // FULLWIDTH COMMA , + 0xFF0E, // FULLWIDTH FULL STOP . + 0xFF0F, // FULLWIDTH SOLIDUS / + 0xFF1A, // FULLWIDTH COLON : + 0xFF1B, // FULLWIDTH SEMICOLON ; + 0xFF1F, // FULLWIDTH QUESTION MARK ? + 0xFF20, // FULLWIDTH COMMERCIAL AT @ + 0xFF3C, // FULLWIDTH REVERSE SOLIDUS \ + 0xFF61, // HALFWIDTH IDEOGRAPHIC FULL STOP 。 + 0xFF64, // HALFWIDTH IDEOGRAPHIC COMMA 、 + 0xFF65, // HALFWIDTH KATAKANA MIDDLE DOT ・ + 0x10100, // AEGEAN WORD SEPARATOR LINE 𐄀 + 0x10101, // AEGEAN WORD SEPARATOR DOT 𐄁 + 0x10102, // AEGEAN CHECK MARK 𐄂 + 0x1039F, // UGARITIC WORD DIVIDER 𐎟 + 0x103D0, // OLD PERSIAN WORD DIVIDER 𐏐 + 0x1056F, // CAUCASIAN ALBANIAN CITATION MARK 𐕯 + 0x10857, // IMPERIAL ARAMAIC SECTION SIGN 𐡗 + 0x1091F, // PHOENICIAN WORD SEPARATOR 𐤟 + 0x1093F, // LYDIAN TRIANGULAR MARK 𐤿 + 0x10A50, // KHAROSHTHI PUNCTUATION DOT 𐩐 + 0x10A51, // KHAROSHTHI PUNCTUATION SMALL CIRCLE 𐩑 + 0x10A52, // KHAROSHTHI PUNCTUATION CIRCLE 𐩒 + 0x10A53, // KHAROSHTHI PUNCTUATION CRESCENT BAR 𐩓 + 0x10A54, // KHAROSHTHI PUNCTUATION MANGALAM 𐩔 + 0x10A55, // KHAROSHTHI PUNCTUATION LOTUS 𐩕 + 0x10A56, // KHAROSHTHI PUNCTUATION DANDA 𐩖 + 0x10A57, // KHAROSHTHI PUNCTUATION DOUBLE DANDA 𐩗 + 0x10A58, // KHAROSHTHI PUNCTUATION LINES 𐩘 + 0x10A7F, // OLD SOUTH ARABIAN NUMERIC INDICATOR 𐩿 + 0x10AF0, // MANICHAEAN PUNCTUATION STAR 𐫰 + 0x10AF1, // MANICHAEAN PUNCTUATION FLEURON 𐫱 + 0x10AF2, // MANICHAEAN PUNCTUATION DOUBLE DOT WITHIN DOT 𐫲 + 0x10AF3, // MANICHAEAN PUNCTUATION DOT WITHIN DOT 𐫳 + 0x10AF4, // MANICHAEAN PUNCTUATION DOT 𐫴 + 0x10AF5, // MANICHAEAN PUNCTUATION TWO DOTS 𐫵 + 0x10AF6, // MANICHAEAN PUNCTUATION LINE FILLER 𐫶 + 0x10B39, // AVESTAN ABBREVIATION MARK 𐬹 + 0x10B3A, // TINY TWO DOTS OVER ONE DOT PUNCTUATION 𐬺 + 0x10B3B, // SMALL TWO DOTS OVER ONE DOT PUNCTUATION 𐬻 + 0x10B3C, // LARGE TWO DOTS OVER ONE DOT PUNCTUATION 𐬼 + 0x10B3D, // LARGE ONE DOT OVER TWO DOTS PUNCTUATION 𐬽 + 0x10B3E, // LARGE TWO RINGS OVER ONE RING PUNCTUATION 𐬾 + 0x10B3F, // LARGE ONE RING OVER TWO RINGS PUNCTUATION 𐬿 + 0x10B99, // PSALTER PAHLAVI SECTION MARK 𐮙 + 0x10B9A, // PSALTER PAHLAVI TURNED SECTION MARK 𐮚 + 0x10B9B, // PSALTER PAHLAVI FOUR DOTS WITH CROSS 𐮛 + 0x10B9C, // PSALTER PAHLAVI FOUR DOTS WITH DOT 𐮜 + 0x10F55, // SOGDIAN PUNCTUATION TWO VERTICAL BARS 𐽕 + 0x10F56, // SOGDIAN PUNCTUATION TWO VERTICAL BARS WITH DOTS 𐽖 + 0x10F57, // SOGDIAN PUNCTUATION CIRCLE WITH DOT 𐽗 + 0x10F58, // SOGDIAN PUNCTUATION TWO CIRCLES WITH DOTS 𐽘 + 0x10F59, // SOGDIAN PUNCTUATION HALF CIRCLE WITH DOT 𐽙 + 0x11047, // BRAHMI DANDA 𑁇 + 0x11048, // BRAHMI DOUBLE DANDA 𑁈 + 0x11049, // BRAHMI PUNCTUATION DOT 𑁉 + 0x1104A, // BRAHMI PUNCTUATION DOUBLE DOT 𑁊 + 0x1104B, // BRAHMI PUNCTUATION LINE 𑁋 + 0x1104C, // BRAHMI PUNCTUATION CRESCENT BAR 𑁌 + 0x1104D, // BRAHMI PUNCTUATION LOTUS 𑁍 + 0x110BB, // KAITHI ABBREVIATION SIGN 𑂻 + 0x110BC, // KAITHI ENUMERATION SIGN 𑂼 + 0x110BE, // KAITHI SECTION MARK 𑂾 + 0x110BF, // KAITHI DOUBLE SECTION MARK 𑂿 + 0x110C0, // KAITHI DANDA 𑃀 + 0x110C1, // KAITHI DOUBLE DANDA 𑃁 + 0x11140, // CHAKMA SECTION MARK 𑅀 + 0x11141, // CHAKMA DANDA 𑅁 + 0x11142, // CHAKMA DOUBLE DANDA 𑅂 + 0x11143, // CHAKMA QUESTION MARK 𑅃 + 0x11174, // MAHAJANI ABBREVIATION SIGN 𑅴 + 0x11175, // MAHAJANI SECTION MARK 𑅵 + 0x111C5, // SHARADA DANDA 𑇅 + 0x111C6, // SHARADA DOUBLE DANDA 𑇆 + 0x111C7, // SHARADA ABBREVIATION SIGN 𑇇 + 0x111C8, // SHARADA SEPARATOR 𑇈 + 0x111CD, // SHARADA SUTRA MARK 𑇍 + 0x111DB, // SHARADA SIGN SIDDHAM 𑇛 + 0x111DD, // SHARADA CONTINUATION SIGN 𑇝 + 0x111DE, // SHARADA SECTION MARK-1 𑇞 + 0x111DF, // SHARADA SECTION MARK-2 𑇟 + 0x11238, // KHOJKI DANDA 𑈸 + 0x11239, // KHOJKI DOUBLE DANDA 𑈹 + 0x1123A, // KHOJKI WORD SEPARATOR 𑈺 + 0x1123B, // KHOJKI SECTION MARK 𑈻 + 0x1123C, // KHOJKI DOUBLE SECTION MARK 𑈼 + 0x1123D, // KHOJKI ABBREVIATION SIGN 𑈽 + 0x112A9, // MULTANI SECTION MARK 𑊩 + 0x1144B, // NEWA DANDA 𑑋 + 0x1144C, // NEWA DOUBLE DANDA 𑑌 + 0x1144D, // NEWA COMMA 𑑍 + 0x1144E, // NEWA GAP FILLER 𑑎 + 0x1144F, // NEWA ABBREVIATION SIGN 𑑏 + 0x1145B, // NEWA PLACEHOLDER MARK 𑑛 + 0x1145D, // NEWA INSERTION SIGN 𑑝 + 0x114C6, // TIRHUTA ABBREVIATION SIGN 𑓆 + 0x115C1, // SIDDHAM SIGN SIDDHAM 𑗁 + 0x115C2, // SIDDHAM DANDA 𑗂 + 0x115C3, // SIDDHAM DOUBLE DANDA 𑗃 + 0x115C4, // SIDDHAM SEPARATOR DOT 𑗄 + 0x115C5, // SIDDHAM SEPARATOR BAR 𑗅 + 0x115C6, // SIDDHAM REPETITION MARK-1 𑗆 + 0x115C7, // SIDDHAM REPETITION MARK-2 𑗇 + 0x115C8, // SIDDHAM REPETITION MARK-3 𑗈 + 0x115C9, // SIDDHAM END OF TEXT MARK 𑗉 + 0x115CA, // SIDDHAM SECTION MARK WITH TRIDENT AND U-SHAPED ORNAMENTS 𑗊 + 0x115CB, // SIDDHAM SECTION MARK WITH TRIDENT AND DOTTED CRESCENTS 𑗋 + 0x115CC, // SIDDHAM SECTION MARK WITH RAYS AND DOTTED CRESCENTS 𑗌 + 0x115CD, // SIDDHAM SECTION MARK WITH RAYS AND DOTTED DOUBLE CRESCENTS 𑗍 + 0x115CE, // SIDDHAM SECTION MARK WITH RAYS AND DOTTED TRIPLE CRESCENTS 𑗎 + 0x115CF, // SIDDHAM SECTION MARK DOUBLE RING 𑗏 + 0x115D0, // SIDDHAM SECTION MARK DOUBLE RING WITH RAYS 𑗐 + 0x115D1, // SIDDHAM SECTION MARK WITH DOUBLE CRESCENTS 𑗑 + 0x115D2, // SIDDHAM SECTION MARK WITH TRIPLE CRESCENTS 𑗒 + 0x115D3, // SIDDHAM SECTION MARK WITH QUADRUPLE CRESCENTS 𑗓 + 0x115D4, // SIDDHAM SECTION MARK WITH SEPTUPLE CRESCENTS 𑗔 + 0x115D5, // SIDDHAM SECTION MARK WITH CIRCLES AND RAYS 𑗕 + 0x115D6, // SIDDHAM SECTION MARK WITH CIRCLES AND TWO ENCLOSURES 𑗖 + 0x115D7, // SIDDHAM SECTION MARK WITH CIRCLES AND FOUR ENCLOSURES 𑗗 + 0x11641, // MODI DANDA 𑙁 + 0x11642, // MODI DOUBLE DANDA 𑙂 + 0x11643, // MODI ABBREVIATION SIGN 𑙃 + 0x11660, // MONGOLIAN BIRGA WITH ORNAMENT 𑙠 + 0x11661, // MONGOLIAN ROTATED BIRGA 𑙡 + 0x11662, // MONGOLIAN DOUBLE BIRGA WITH ORNAMENT 𑙢 + 0x11663, // MONGOLIAN TRIPLE BIRGA WITH ORNAMENT 𑙣 + 0x11664, // MONGOLIAN BIRGA WITH DOUBLE ORNAMENT 𑙤 + 0x11665, // MONGOLIAN ROTATED BIRGA WITH ORNAMENT 𑙥 + 0x11666, // MONGOLIAN ROTATED BIRGA WITH DOUBLE ORNAMENT 𑙦 + 0x11667, // MONGOLIAN INVERTED BIRGA 𑙧 + 0x11668, // MONGOLIAN INVERTED BIRGA WITH DOUBLE ORNAMENT 𑙨 + 0x11669, // MONGOLIAN SWIRL BIRGA 𑙩 + 0x1166A, // MONGOLIAN SWIRL BIRGA WITH ORNAMENT 𑙪 + 0x1166B, // MONGOLIAN SWIRL BIRGA WITH DOUBLE ORNAMENT 𑙫 + 0x1166C, // MONGOLIAN TURNED SWIRL BIRGA WITH DOUBLE ORNAMENT 𑙬 + 0x1173C, // AHOM SIGN SMALL SECTION 𑜼 + 0x1173D, // AHOM SIGN SECTION 𑜽 + 0x1173E, // AHOM SIGN RULAI 𑜾 + 0x1183B, // DOGRA ABBREVIATION SIGN 𑠻 + 0x119E2, // NANDINAGARI SIGN SIDDHAM 𑧢 + 0x11A3F, // ZANABAZAR SQUARE INITIAL HEAD MARK 𑨿 + 0x11A40, // ZANABAZAR SQUARE CLOSING HEAD MARK 𑩀 + 0x11A41, // ZANABAZAR SQUARE MARK TSHEG 𑩁 + 0x11A42, // ZANABAZAR SQUARE MARK SHAD 𑩂 + 0x11A43, // ZANABAZAR SQUARE MARK DOUBLE SHAD 𑩃 + 0x11A44, // ZANABAZAR SQUARE MARK LONG TSHEG 𑩄 + 0x11A45, // ZANABAZAR SQUARE INITIAL DOUBLE-LINED HEAD MARK 𑩅 + 0x11A46, // ZANABAZAR SQUARE CLOSING DOUBLE-LINED HEAD MARK 𑩆 + 0x11A9A, // SOYOMBO MARK TSHEG 𑪚 + 0x11A9B, // SOYOMBO MARK SHAD 𑪛 + 0x11A9C, // SOYOMBO MARK DOUBLE SHAD 𑪜 + 0x11A9E, // SOYOMBO HEAD MARK WITH MOON AND SUN AND TRIPLE FLAME 𑪞 + 0x11A9F, // SOYOMBO HEAD MARK WITH MOON AND SUN AND FLAME 𑪟 + 0x11AA0, // SOYOMBO HEAD MARK WITH MOON AND SUN 𑪠 + 0x11AA1, // SOYOMBO TERMINAL MARK-1 𑪡 + 0x11AA2, // SOYOMBO TERMINAL MARK-2 𑪢 + 0x11C41, // BHAIKSUKI DANDA 𑱁 + 0x11C42, // BHAIKSUKI DOUBLE DANDA 𑱂 + 0x11C43, // BHAIKSUKI WORD SEPARATOR 𑱃 + 0x11C44, // BHAIKSUKI GAP FILLER-1 𑱄 + 0x11C45, // BHAIKSUKI GAP FILLER-2 𑱅 + 0x11C70, // MARCHEN HEAD MARK 𑱰 + 0x11C71, // MARCHEN MARK SHAD 𑱱 + 0x11EF7, // MAKASAR PASSIMBANG 𑻷 + 0x11EF8, // MAKASAR END OF SECTION 𑻸 + 0x11FFF, // TAMIL PUNCTUATION END OF TEXT 𑿿 + 0x12470, // CUNEIFORM PUNCTUATION SIGN OLD ASSYRIAN WORD DIVIDER 𒑰 + 0x12471, // CUNEIFORM PUNCTUATION SIGN VERTICAL COLON 𒑱 + 0x12472, // CUNEIFORM PUNCTUATION SIGN DIAGONAL COLON 𒑲 + 0x12473, // CUNEIFORM PUNCTUATION SIGN DIAGONAL TRICOLON 𒑳 + 0x12474, // CUNEIFORM PUNCTUATION SIGN DIAGONAL QUADCOLON 𒑴 + 0x16A6E, // MRO DANDA 𖩮 + 0x16A6F, // MRO DOUBLE DANDA 𖩯 + 0x16AF5, // BASSA VAH FULL STOP 𖫵 + 0x16B37, // PAHAWH HMONG SIGN VOS THOM 𖬷 + 0x16B38, // PAHAWH HMONG SIGN VOS TSHAB CEEB 𖬸 + 0x16B39, // PAHAWH HMONG SIGN CIM CHEEM 𖬹 + 0x16B3A, // PAHAWH HMONG SIGN VOS THIAB 𖬺 + 0x16B3B, // PAHAWH HMONG SIGN VOS FEEM 𖬻 + 0x16B44, // PAHAWH HMONG SIGN XAUS 𖭄 + 0x16E97, // MEDEFAIDRIN COMMA 𖺗 + 0x16E98, // MEDEFAIDRIN FULL STOP 𖺘 + 0x16E99, // MEDEFAIDRIN SYMBOL AIVA 𖺙 + 0x16E9A, // MEDEFAIDRIN EXCLAMATION OH 𖺚 + 0x16FE2, // OLD CHINESE HOOK MARK 𖿢 + 0x1BC9F, // DUPLOYAN PUNCTUATION CHINOOK FULL STOP 𛲟 + 0x1DA87, // SIGNWRITING COMMA 𝪇 + 0x1DA88, // SIGNWRITING FULL STOP 𝪈 + 0x1DA89, // SIGNWRITING SEMICOLON 𝪉 + 0x1DA8A, // SIGNWRITING COLON 𝪊 + 0x1DA8B, // SIGNWRITING PARENTHESIS 𝪋 + 0x1E95E, // ADLAM INITIAL EXCLAMATION MARK 𞥞 + 0x1E95F, // ADLAM INITIAL QUESTION MARK +] diff --git a/vlib/encoding/xml/parser.v b/vlib/encoding/xml/parser.v index 9a52d1d31d..17d7009ec4 100644 --- a/vlib/encoding/xml/parser.v +++ b/vlib/encoding/xml/parser.v @@ -4,24 +4,22 @@ import io import os import strings -const ( - default_prolog_attributes = { - 'version': '1.0' - 'encoding': 'UTF-8' - } - default_string_builder_cap = 32 +const default_prolog_attributes = { + 'version': '1.0' + 'encoding': 'UTF-8' +} +const default_string_builder_cap = 32 - element_len = ' @@ -19,79 +18,79 @@ const ( ' - xml_elements = [ - XMLNode{ - name: 'c' - attributes: { - 'id': 'c1' - } - }, - XMLNode{ - name: 'c' - attributes: { - 'id': 'c2' - } - children: [ - 'Sample Text', - ] - }, - XMLNode{ - name: 'empty' - attributes: {} - }, - XMLNode{ - name: 'c' - attributes: { - 'id': 'c3' - } - }, - XMLNode{ - name: 'abc' - attributes: { - 'id': 'c4' - } - }, - XMLNode{ - name: 'xyz' - attributes: { - 'id': 'c5' - } - }, - XMLNode{ - name: 'c' - attributes: { - 'id': 'c6' - } - }, - XMLNode{ - name: 'cx' - attributes: { - 'id': 'c7' - } - }, - XMLNode{ - name: 'cd' - attributes: { - 'id': 'c8' - } - }, - XMLNode{ - name: 'child' - attributes: { - 'id': 'c9' - } - children: [ - 'More Sample Text', - ] - }, - XMLNode{ - name: 'cz' - attributes: { - 'id': 'c10' - } - }, - ] -) + +const xml_elements = [ + XMLNode{ + name: 'c' + attributes: { + 'id': 'c1' + } + }, + XMLNode{ + name: 'c' + attributes: { + 'id': 'c2' + } + children: [ + 'Sample Text', + ] + }, + XMLNode{ + name: 'empty' + attributes: {} + }, + XMLNode{ + name: 'c' + attributes: { + 'id': 'c3' + } + }, + XMLNode{ + name: 'abc' + attributes: { + 'id': 'c4' + } + }, + XMLNode{ + name: 'xyz' + attributes: { + 'id': 'c5' + } + }, + XMLNode{ + name: 'c' + attributes: { + 'id': 'c6' + } + }, + XMLNode{ + name: 'cx' + attributes: { + 'id': 'c7' + } + }, + XMLNode{ + name: 'cd' + attributes: { + 'id': 'c8' + } + }, + XMLNode{ + name: 'child' + attributes: { + 'id': 'c9' + } + children: [ + 'More Sample Text', + ] + }, + XMLNode{ + name: 'cz' + attributes: { + 'id': 'c10' + } + }, +] fn test_single_element_parsing() ! { mut reader := FullBufferReader{ diff --git a/vlib/encoding/xml/query_test.v b/vlib/encoding/xml/query_test.v index a1e84973b3..6e18c24de9 100644 --- a/vlib/encoding/xml/query_test.v +++ b/vlib/encoding/xml/query_test.v @@ -2,8 +2,7 @@ module main import encoding.xml -const ( - sample_document = ' +const sample_document = ' @@ -22,7 +21,6 @@ const ( Text9 ' -) fn test_querying() ! { doc := xml.XMLDocument.from_string(sample_document)! diff --git a/vlib/flag/flag.v b/vlib/flag/flag.v index 05b1cb0e41..8578bf1935 100644 --- a/vlib/flag/flag.v +++ b/vlib/flag/flag.v @@ -122,12 +122,10 @@ fn (mut f FlagParser) free() { } } -pub const ( - // used for formatting usage message - space = ' ' - underline = '-----------------------------------------------' - max_args_number = 4048 -) +// used for formatting usage message +pub const space = ' ' +pub const underline = '-----------------------------------------------' +pub const max_args_number = 4048 // new_flag_parser - create a new flag parser for the given args pub fn new_flag_parser(args []string) &FlagParser { diff --git a/vlib/fontstash/fontstash.c.v b/vlib/fontstash/fontstash.c.v index ce8ea33665..bd56610747 100644 --- a/vlib/fontstash/fontstash.c.v +++ b/vlib/fontstash/fontstash.c.v @@ -21,11 +21,9 @@ $if windows { pub type Context = C.FONScontext //#flag -lfreetype -pub const ( - // TODO: fontstash.used_import is used to keep v from warning about unused imports - used_import = 1 - invalid = C.FONS_INVALID // -1 -) +// TODO: fontstash.used_import is used to keep v from warning about unused imports +pub const used_import = 1 +pub const invalid = C.FONS_INVALID // create_internal returns a fontstash Context allocated on the heap. // diff --git a/vlib/gx/color.v b/vlib/gx/color.v index f30d8f8cf9..f1da39d4f4 100644 --- a/vlib/gx/color.v +++ b/vlib/gx/color.v @@ -1,117 +1,115 @@ module gx -pub const ( - black = Color{ - r: 0 - g: 0 - b: 0 - } - gray = Color{ - r: 128 - g: 128 - b: 128 - } - white = Color{ - r: 255 - g: 255 - b: 255 - } - red = Color{ - r: 255 - g: 0 - b: 0 - } - green = Color{ - r: 0 - g: 255 - b: 0 - } - blue = Color{ - r: 0 - g: 0 - b: 255 - } - yellow = Color{ - r: 255 - g: 255 - b: 0 - } - magenta = Color{ - r: 255 - g: 0 - b: 255 - } - cyan = Color{ - r: 0 - g: 255 - b: 255 - } - orange = Color{ - r: 255 - g: 165 - b: 0 - } - purple = Color{ - r: 128 - g: 0 - b: 128 - } - indigo = Color{ - r: 75 - g: 0 - b: 130 - } - pink = Color{ - r: 255 - g: 192 - b: 203 - } - violet = Color{ - r: 238 - g: 130 - b: 238 - } - dark_blue = Color{ - r: 0 - g: 0 - b: 139 - } - dark_gray = Color{ - r: 169 - g: 169 - b: 169 - } - dark_green = Color{ - r: 0 - g: 100 - b: 0 - } - dark_red = Color{ - r: 139 - g: 0 - b: 0 - } - light_blue = Color{ - r: 173 - g: 216 - b: 230 - } - light_gray = Color{ - r: 211 - g: 211 - b: 211 - } - light_green = Color{ - r: 144 - g: 238 - b: 144 - } - light_red = Color{ - r: 255 - g: 204 - b: 203 - } -) +pub const black = Color{ + r: 0 + g: 0 + b: 0 +} +pub const gray = Color{ + r: 128 + g: 128 + b: 128 +} +pub const white = Color{ + r: 255 + g: 255 + b: 255 +} +pub const red = Color{ + r: 255 + g: 0 + b: 0 +} +pub const green = Color{ + r: 0 + g: 255 + b: 0 +} +pub const blue = Color{ + r: 0 + g: 0 + b: 255 +} +pub const yellow = Color{ + r: 255 + g: 255 + b: 0 +} +pub const magenta = Color{ + r: 255 + g: 0 + b: 255 +} +pub const cyan = Color{ + r: 0 + g: 255 + b: 255 +} +pub const orange = Color{ + r: 255 + g: 165 + b: 0 +} +pub const purple = Color{ + r: 128 + g: 0 + b: 128 +} +pub const indigo = Color{ + r: 75 + g: 0 + b: 130 +} +pub const pink = Color{ + r: 255 + g: 192 + b: 203 +} +pub const violet = Color{ + r: 238 + g: 130 + b: 238 +} +pub const dark_blue = Color{ + r: 0 + g: 0 + b: 139 +} +pub const dark_gray = Color{ + r: 169 + g: 169 + b: 169 +} +pub const dark_green = Color{ + r: 0 + g: 100 + b: 0 +} +pub const dark_red = Color{ + r: 139 + g: 0 + b: 0 +} +pub const light_blue = Color{ + r: 173 + g: 216 + b: 230 +} +pub const light_gray = Color{ + r: 211 + g: 211 + b: 211 +} +pub const light_green = Color{ + r: 144 + g: 238 + b: 144 +} +pub const light_red = Color{ + r: 255 + g: 204 + b: 203 +} // Color represents a 32 bit color value in sRGB format pub struct Color { @@ -281,30 +279,28 @@ pub fn (c Color) abgr8() int { return int(u32(c.a) << 24 | u32(c.b) << 16 | u32(c.g) << 8 | u32(c.r)) } -const ( - string_colors = { - 'blue': blue - 'red': red - 'green': green - 'yellow': yellow - 'orange': orange - 'purple': purple - 'black': black - 'gray': gray - 'indigo': indigo - 'pink': pink - 'violet': violet - 'white': white - 'dark_blue': dark_blue - 'dark_gray': dark_gray - 'dark_green': dark_green - 'dark_red': dark_red - 'light_blue': light_blue - 'light_gray': light_gray - 'light_green': light_green - 'light_red': light_red - } -) +const string_colors = { + 'blue': blue + 'red': red + 'green': green + 'yellow': yellow + 'orange': orange + 'purple': purple + 'black': black + 'gray': gray + 'indigo': indigo + 'pink': pink + 'violet': violet + 'white': white + 'dark_blue': dark_blue + 'dark_gray': dark_gray + 'dark_green': dark_green + 'dark_red': dark_red + 'light_blue': light_blue + 'light_gray': light_gray + 'light_green': light_green + 'light_red': light_red +} // color_from_string returns a Color, corresponding to the given string // or black Color if string is not found in lookup table, or a hex color if starting with # diff --git a/vlib/gx/text.v b/vlib/gx/text.v index a6931df6eb..8a450a57a2 100644 --- a/vlib/gx/text.v +++ b/vlib/gx/text.v @@ -1,10 +1,8 @@ module gx // TODO: remove these, and use the enum everywhere -pub const ( - align_left = HorizontalAlign.left - align_right = HorizontalAlign.right -) +pub const align_left = HorizontalAlign.left +pub const align_right = HorizontalAlign.right @[params] pub struct TextCfg { diff --git a/vlib/hash/crc32/crc32.v b/vlib/hash/crc32/crc32.v index a66fceb0a2..e6228a7168 100644 --- a/vlib/hash/crc32/crc32.v +++ b/vlib/hash/crc32/crc32.v @@ -7,16 +7,12 @@ module crc32 // polynomials -pub const ( - ieee = u32(0xedb88320) - castagnoli = u32(0x82f63b78) - koopman = u32(0xeb31d82e) -) +pub const ieee = u32(0xedb88320) +pub const castagnoli = u32(0x82f63b78) +pub const koopman = u32(0xeb31d82e) // The size of a CRC-32 checksum in bytes. -const ( - size = 4 -) +const size = 4 struct Crc32 { mut: diff --git a/vlib/hash/fnv1a/fnv1a.v b/vlib/hash/fnv1a/fnv1a.v index d8033508fc..c7a8aa6294 100644 --- a/vlib/hash/fnv1a/fnv1a.v +++ b/vlib/hash/fnv1a/fnv1a.v @@ -3,12 +3,10 @@ module fnv1a // This module implements a FNV-1a hash. // (see https://en.wikipedia.org/wiki/Fowler–Noll–Vo_hash_function) -const ( - fnv64_prime = u64(1099511628211) - fnv64_offset_basis = u64(14695981039346656037) - fnv32_offset_basis = u32(2166136261) - fnv32_prime = u32(16777619) -) +const fnv64_prime = u64(1099511628211) +const fnv64_offset_basis = u64(14695981039346656037) +const fnv32_offset_basis = u32(2166136261) +const fnv32_prime = u32(16777619) // sum32 returns a fnv1a hash of the string, described by `data` @[direct_array_access; inline] diff --git a/vlib/hash/wyhash.v b/vlib/hash/wyhash.v index 59cf5c6fbd..56c73326a8 100644 --- a/vlib/hash/wyhash.v +++ b/vlib/hash/wyhash.v @@ -15,13 +15,11 @@ // try running with and without the `-prod` flag module hash -const ( - wyp0 = u64(0xa0761d6478bd642f) - wyp1 = u64(0xe7037ed1a0b428db) - wyp2 = u64(0x8ebc6af09c88c6e3) - wyp3 = u64(0x589965cc75374cc3) - wyp4 = u64(0x1d8e4e27c47d124f) -) +const wyp0 = u64(0xa0761d6478bd642f) +const wyp1 = u64(0xe7037ed1a0b428db) +const wyp2 = u64(0x8ebc6af09c88c6e3) +const wyp3 = u64(0x589965cc75374cc3) +const wyp4 = u64(0x1d8e4e27c47d124f) @[inline] fn wyrotr(v u64, k u32) u64 { diff --git a/vlib/io/io.v b/vlib/io/io.v index 24066f3c36..f19c47dcd8 100644 --- a/vlib/io/io.v +++ b/vlib/io/io.v @@ -1,8 +1,6 @@ module io -const ( - buf_max_len = 1024 -) +const buf_max_len = 1024 // cp copies from `src` to `dst` by allocating // a maximum of 1024 bytes buffer for reading diff --git a/vlib/io/reader.v b/vlib/io/reader.v index ea4df0db96..1b9e11719b 100644 --- a/vlib/io/reader.v +++ b/vlib/io/reader.v @@ -29,10 +29,8 @@ mut: read(mut buf []u8) !int } -const ( - read_all_len = 10 * 1024 - read_all_grow_len = 1024 -) +const read_all_len = 10 * 1024 +const read_all_grow_len = 1024 // ReadAllConfig allows options to be passed for the behaviour // of read_all. diff --git a/vlib/io/reader_test.v b/vlib/io/reader_test.v index adfeb62f3f..62ba3ce3c1 100644 --- a/vlib/io/reader_test.v +++ b/vlib/io/reader_test.v @@ -53,9 +53,7 @@ fn (mut s StringReader) read(mut buf []u8) !int { return read } -const ( - newline_count = 100000 -) +const newline_count = 100000 fn test_stringreader() { text := '12345\n'.repeat(io.newline_count) diff --git a/vlib/io/util/util.v b/vlib/io/util/util.v index a465f65043..5d789699cb 100644 --- a/vlib/io/util/util.v +++ b/vlib/io/util/util.v @@ -3,9 +3,7 @@ module util import os import rand -const ( - retries = 10000 -) +const retries = 10000 @[params] pub struct TempFileOptions { diff --git a/vlib/io/util/util_test.v b/vlib/io/util/util_test.v index 396f630ad7..150ab49c06 100644 --- a/vlib/io/util/util_test.v +++ b/vlib/io/util/util_test.v @@ -1,12 +1,10 @@ import os import io.util -const ( - // tfolder will contain all the temporary files/subfolders made by - // the different tests. It would be removed in testsuite_end(), so - // individual os tests do not need to clean up after themselves. - tfolder = os.join_path(os.vtmp_dir(), 'tests', 'io_util_test') -) +// tfolder will contain all the temporary files/subfolders made by +// the different tests. It would be removed in testsuite_end(), so +// individual os tests do not need to clean up after themselves. +const tfolder = os.join_path(os.vtmp_dir(), 'tests', 'io_util_test') fn testsuite_begin() { eprintln('testsuite_begin, tfolder = ${tfolder}') diff --git a/vlib/js/dom/dom.js.v b/vlib/js/dom/dom.js.v index ba78a2d4cb..7d2c5bc988 100644 --- a/vlib/js/dom/dom.js.v +++ b/vlib/js/dom/dom.js.v @@ -338,9 +338,7 @@ mut: slot JS.String } -pub const ( - document = JS.Document{} -) +pub const document = JS.Document{} pub fn window() JS.Window { mut x := JS.Any(unsafe { voidptr(u64(0)) }) diff --git a/vlib/math/big/big.v b/vlib/math/big/big.v index 5068a6ca4c..d3d413acbe 100644 --- a/vlib/math/big/big.v +++ b/vlib/math/big/big.v @@ -1,24 +1,22 @@ module big -pub const ( - zero_int = Integer{ - digits: []u32{len: 0} - signum: 0 - is_const: true - } - one_int = Integer{ - digits: [u32(1)] - signum: 1 - is_const: true - } - two_int = Integer{ - digits: [u32(2)] - signum: 1 - is_const: true - } - three_int = Integer{ - digits: [u32(3)] - signum: 1 - is_const: true - } -) +pub const zero_int = Integer{ + digits: []u32{len: 0} + signum: 0 + is_const: true +} +pub const one_int = Integer{ + digits: [u32(1)] + signum: 1 + is_const: true +} +pub const two_int = Integer{ + digits: [u32(2)] + signum: 1 + is_const: true +} +pub const three_int = Integer{ + digits: [u32(3)] + signum: 1 + is_const: true +} diff --git a/vlib/math/bits.v b/vlib/math/bits.v index e3d2bceb2c..592ee0cdcc 100644 --- a/vlib/math/bits.v +++ b/vlib/math/bits.v @@ -3,18 +3,17 @@ // that can be found in the LICENSE file. module math -const ( - uvnan = u64(0x7FF8000000000001) - uvinf = u64(0x7FF0000000000000) - uvneginf = u64(0xFFF0000000000000) - uvone = u64(0x3FF0000000000000) - mask = 0x7FF - shift = 64 - 11 - 1 - bias = 1023 - normalize_smallest_mask = u64(u64(1) << 52) - sign_mask = u64(0x8000000000000000) // (u64(1) << 63) - frac_mask = u64((u64(1) << u64(shift)) - u64(1)) -) +const uvnan = u64(0x7FF8000000000001) +const uvinf = u64(0x7FF0000000000000) +const uvneginf = u64(0xFFF0000000000000) +const uvone = u64(0x3FF0000000000000) +const mask = 0x7FF +const shift = 64 - 11 - 1 +const bias = 1023 +const normalize_smallest_mask = u64(u64(1) << 52) +const sign_mask = u64(0x8000000000000000) // (u64(1) << 63) + +const frac_mask = u64((u64(1) << u64(shift)) - u64(1)) // inf returns positive infinity if sign >= 0, negative infinity if sign < 0. pub fn inf(sign int) f64 { diff --git a/vlib/math/bits/bits.v b/vlib/math/bits/bits.v index 58c610532d..9cdd2117e0 100644 --- a/vlib/math/bits/bits.v +++ b/vlib/math/bits/bits.v @@ -3,31 +3,29 @@ // that can be found in the LICENSE file. module bits -const ( - // See http://supertech.csail.mit.edu/papers/debruijn.pdf - de_bruijn32 = u32(0x077CB531) - de_bruijn32tab = [u8(0), 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, - 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9]! - de_bruijn64 = u64(0x03f79d71b4ca8b09) - de_bruijn64tab = [u8(0), 1, 56, 2, 57, 49, 28, 3, 61, 58, 42, 50, 38, 29, 17, 4, 62, 47, 59, - 36, 45, 43, 51, 22, 53, 39, 33, 30, 24, 18, 12, 5, 63, 55, 48, 27, 60, 41, 37, 16, 46, - 35, 44, 21, 52, 32, 23, 11, 54, 26, 40, 15, 34, 20, 31, 10, 25, 14, 19, 9, 13, 8, 7, 6]! -) +// See http://supertech.csail.mit.edu/papers/debruijn.pdf +const de_bruijn32 = u32(0x077CB531) +const de_bruijn32tab = [u8(0), 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, + 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9]! +const de_bruijn64 = u64(0x03f79d71b4ca8b09) +const de_bruijn64tab = [u8(0), 1, 56, 2, 57, 49, 28, 3, 61, 58, 42, 50, 38, 29, 17, 4, 62, 47, + 59, 36, 45, 43, 51, 22, 53, 39, 33, 30, 24, 18, 12, 5, 63, 55, 48, 27, 60, 41, 37, 16, 46, + 35, 44, 21, 52, 32, 23, 11, 54, 26, 40, 15, 34, 20, 31, 10, 25, 14, 19, 9, 13, 8, 7, 6]! -const ( - m0 = u64(0x5555555555555555) // 01010101 ... - m1 = u64(0x3333333333333333) // 00110011 ... - m2 = u64(0x0f0f0f0f0f0f0f0f) // 00001111 ... - m3 = u64(0x00ff00ff00ff00ff) // etc. - m4 = u64(0x0000ffff0000ffff) -) +const m0 = u64(0x5555555555555555) // 01010101 ... + +const m1 = u64(0x3333333333333333) // 00110011 ... + +const m2 = u64(0x0f0f0f0f0f0f0f0f) // 00001111 ... + +const m3 = u64(0x00ff00ff00ff00ff) // etc. + +const m4 = u64(0x0000ffff0000ffff) // TODO: this consts should be taken from int.v -const ( - // save importing math mod just for these - max_u32 = u32(4294967295) - max_u64 = u64(18446744073709551615) -) +// save importing math mod just for these +const max_u32 = u32(4294967295) +const max_u64 = u64(18446744073709551615) // --- LeadingZeros --- // leading_zeros_8 returns the number of leading zero bits in x; the result is 8 for x == 0. @@ -140,12 +138,10 @@ pub fn ones_count_64(x u64) int { return int(y) & ((1 << 7) - 1) } -const ( - n8 = u8(8) - n16 = u16(16) - n32 = u32(32) - n64 = u64(64) -) +const n8 = u8(8) +const n16 = u16(16) +const n32 = u32(32) +const n64 = u64(64) // --- RotateLeft --- // rotate_left_8 returns the value of x rotated left by (k mod 8) bits. @@ -362,12 +358,10 @@ pub fn sub_64(x u64, y u64, borrow u64) (u64, u64) { } // --- Full-width multiply --- -const ( - two32 = u64(0x100000000) - mask32 = two32 - 1 - overflow_error = 'Overflow Error' - divide_error = 'Divide Error' -) +const two32 = u64(0x100000000) +const mask32 = two32 - 1 +const overflow_error = 'Overflow Error' +const divide_error = 'Divide Error' // mul_32 returns the 64-bit product of x and y: (hi, lo) = x * y // with the product bits' upper half returned in hi and the lower diff --git a/vlib/math/bits/bits_tables.v b/vlib/math/bits/bits_tables.v index 4378a40dd7..4b54dcb0cd 100644 --- a/vlib/math/bits/bits_tables.v +++ b/vlib/math/bits/bits_tables.v @@ -3,77 +3,71 @@ // that can be found in the LICENSE file. module bits -const ( - ntz_8_tab = [u8(0x08), 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, - 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, - 0x02, 0x00, 0x01, 0x00, 0x05, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, - 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, - 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x06, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, - 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, - 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x05, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, - 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, - 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x07, 0x00, 0x01, 0x00, 0x02, - 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, - 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x05, 0x00, 0x01, - 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, - 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x06, - 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, - 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, - 0x00, 0x05, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, - 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, - 0x00, 0x01, 0x00]! - pop_8_tab = [u8(0x00), 0x01, 0x01, 0x02, 0x01, 0x02, 0x02, 0x03, 0x01, 0x02, 0x02, 0x03, 0x02, - 0x03, 0x03, 0x04, 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, 0x02, 0x03, 0x03, 0x04, - 0x03, 0x04, 0x04, 0x05, 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, 0x02, 0x03, 0x03, - 0x04, 0x03, 0x04, 0x04, 0x05, 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 0x03, 0x04, - 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, 0x02, - 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, - 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, - 0x05, 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, - 0x05, 0x06, 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, 0x01, 0x02, 0x02, 0x03, 0x02, - 0x03, 0x03, 0x04, 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 0x02, 0x03, 0x03, 0x04, - 0x03, 0x04, 0x04, 0x05, 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 0x02, 0x03, 0x03, - 0x04, 0x03, 0x04, 0x04, 0x05, 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 0x03, 0x04, - 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, 0x02, - 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, - 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, - 0x07, 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, - 0x06, 0x07, 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, 0x05, 0x06, 0x06, 0x07, 0x06, - 0x07, 0x07, 0x08]! - rev_8_tab = [u8(0x00), 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, - 0xb0, 0x70, 0xf0, 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 0x18, 0x98, 0x58, 0xd8, - 0x38, 0xb8, 0x78, 0xf8, 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, 0x14, 0x94, 0x54, - 0xd4, 0x34, 0xb4, 0x74, 0xf4, 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, 0x1c, 0x9c, - 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, 0x12, - 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, - 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, - 0xe6, 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, - 0x6e, 0xee, 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, 0x01, 0x81, 0x41, 0xc1, 0x21, - 0xa1, 0x61, 0xe1, 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, 0x09, 0x89, 0x49, 0xc9, - 0x29, 0xa9, 0x69, 0xe9, 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, 0x05, 0x85, 0x45, - 0xc5, 0x25, 0xa5, 0x65, 0xe5, 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, 0x0d, 0x8d, - 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, 0x03, - 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, - 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, - 0xfb, 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, - 0x77, 0xf7, 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, - 0xbf, 0x7f, 0xff]! - len_8_tab = [u8(0x00), 0x01, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08]! -) +const ntz_8_tab = [u8(0x08), 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, + 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, + 0x02, 0x00, 0x01, 0x00, 0x05, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, + 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, + 0x02, 0x00, 0x01, 0x00, 0x06, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, + 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, + 0x02, 0x00, 0x01, 0x00, 0x05, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, + 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, + 0x02, 0x00, 0x01, 0x00, 0x07, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, + 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, + 0x02, 0x00, 0x01, 0x00, 0x05, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, + 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, + 0x02, 0x00, 0x01, 0x00, 0x06, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, + 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, + 0x02, 0x00, 0x01, 0x00, 0x05, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, + 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, + 0x02, 0x00, 0x01, 0x00]! +const pop_8_tab = [u8(0x00), 0x01, 0x01, 0x02, 0x01, 0x02, 0x02, 0x03, 0x01, 0x02, 0x02, 0x03, + 0x02, 0x03, 0x03, 0x04, 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, 0x02, 0x03, 0x03, 0x04, + 0x03, 0x04, 0x04, 0x05, 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, 0x02, 0x03, 0x03, 0x04, + 0x03, 0x04, 0x04, 0x05, 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 0x03, 0x04, 0x04, 0x05, + 0x04, 0x05, 0x05, 0x06, 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, 0x02, 0x03, 0x03, 0x04, + 0x03, 0x04, 0x04, 0x05, 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 0x03, 0x04, 0x04, 0x05, + 0x04, 0x05, 0x05, 0x06, 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 0x03, 0x04, 0x04, 0x05, + 0x04, 0x05, 0x05, 0x06, 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 0x04, 0x05, 0x05, 0x06, + 0x05, 0x06, 0x06, 0x07, 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, 0x02, 0x03, 0x03, 0x04, + 0x03, 0x04, 0x04, 0x05, 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 0x03, 0x04, 0x04, 0x05, + 0x04, 0x05, 0x05, 0x06, 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 0x03, 0x04, 0x04, 0x05, + 0x04, 0x05, 0x05, 0x06, 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 0x04, 0x05, 0x05, 0x06, + 0x05, 0x06, 0x06, 0x07, 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 0x03, 0x04, 0x04, 0x05, + 0x04, 0x05, 0x05, 0x06, 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 0x04, 0x05, 0x05, 0x06, + 0x05, 0x06, 0x06, 0x07, 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 0x04, 0x05, 0x05, 0x06, + 0x05, 0x06, 0x06, 0x07, 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, 0x05, 0x06, 0x06, 0x07, + 0x06, 0x07, 0x07, 0x08]! +const rev_8_tab = [u8(0x00), 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, + 0x30, 0xb0, 0x70, 0xf0, 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 0x18, 0x98, 0x58, 0xd8, + 0x38, 0xb8, 0x78, 0xf8, 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, 0x14, 0x94, 0x54, 0xd4, + 0x34, 0xb4, 0x74, 0xf4, 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, 0x1c, 0x9c, 0x5c, 0xdc, + 0x3c, 0xbc, 0x7c, 0xfc, 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, 0x12, 0x92, 0x52, 0xd2, + 0x32, 0xb2, 0x72, 0xf2, 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, 0x1a, 0x9a, 0x5a, 0xda, + 0x3a, 0xba, 0x7a, 0xfa, 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 0x16, 0x96, 0x56, 0xd6, + 0x36, 0xb6, 0x76, 0xf6, 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 0x1e, 0x9e, 0x5e, 0xde, + 0x3e, 0xbe, 0x7e, 0xfe, 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, 0x11, 0x91, 0x51, 0xd1, + 0x31, 0xb1, 0x71, 0xf1, 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 0x19, 0x99, 0x59, 0xd9, + 0x39, 0xb9, 0x79, 0xf9, 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 0x15, 0x95, 0x55, 0xd5, + 0x35, 0xb5, 0x75, 0xf5, 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, 0x1d, 0x9d, 0x5d, 0xdd, + 0x3d, 0xbd, 0x7d, 0xfd, 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, 0x13, 0x93, 0x53, 0xd3, + 0x33, 0xb3, 0x73, 0xf3, 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 0x1b, 0x9b, 0x5b, 0xdb, + 0x3b, 0xbb, 0x7b, 0xfb, 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 0x17, 0x97, 0x57, 0xd7, + 0x37, 0xb7, 0x77, 0xf7, 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, + 0x3f, 0xbf, 0x7f, 0xff]! +const len_8_tab = [u8(0x00), 0x01, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08]! diff --git a/vlib/math/const.v b/vlib/math/const.v index a48265f2cd..a5a67f9dc0 100644 --- a/vlib/math/const.v +++ b/vlib/math/const.v @@ -3,63 +3,60 @@ // that can be found in the LICENSE file. module math -pub const ( - epsilon = 2.2204460492503130808472633361816E-16 - e = 2.71828182845904523536028747135266249775724709369995957496696763 - pi = 3.14159265358979323846264338327950288419716939937510582097494459 - pi_2 = pi / 2.0 - pi_4 = pi / 4.0 - phi = 1.61803398874989484820458683436563811772030917980576286213544862 - tau = 6.28318530717958647692528676655900576839433879875021164194988918 - one_over_tau = 1.0 / tau - one_over_pi = 1.0 / pi - tau_over2 = tau / 2.0 - tau_over4 = tau / 4.0 - tau_over8 = tau / 8.0 - sqrt2 = 1.41421356237309504880168872420969807856967187537694807317667974 - sqrt_3 = 1.73205080756887729352744634150587236694280525381038062805580697 - sqrt_5 = 2.23606797749978969640917366873127623544061835961152572427089724 - sqrt_e = 1.64872127070012814684865078781416357165377610071014801157507931 - sqrt_pi = 1.77245385090551602729816748334114518279754945612238712821380779 - sqrt_tau = 2.50662827463100050241576528481104525300698674060993831662992357 - sqrt_phi = 1.27201964951406896425242246173749149171560804184009624861664038 - ln2 = 0.693147180559945309417232121458176568075500134360255254120680009 - log2_e = 1.0 / ln2 - ln10 = 2.30258509299404568401799145468436420760110148862877297603332790 - log10_e = 1.0 / ln10 - two_thirds = 0.66666666666666666666666666666666666666666666666666666666666667 -) +pub const epsilon = 2.2204460492503130808472633361816E-16 +pub const e = 2.71828182845904523536028747135266249775724709369995957496696763 +pub const pi = 3.14159265358979323846264338327950288419716939937510582097494459 +pub const pi_2 = pi / 2.0 +pub const pi_4 = pi / 4.0 +pub const phi = 1.61803398874989484820458683436563811772030917980576286213544862 +pub const tau = 6.28318530717958647692528676655900576839433879875021164194988918 +pub const one_over_tau = 1.0 / tau +pub const one_over_pi = 1.0 / pi +pub const tau_over2 = tau / 2.0 +pub const tau_over4 = tau / 4.0 +pub const tau_over8 = tau / 8.0 +pub const sqrt2 = 1.41421356237309504880168872420969807856967187537694807317667974 +pub const sqrt_3 = 1.73205080756887729352744634150587236694280525381038062805580697 +pub const sqrt_5 = 2.23606797749978969640917366873127623544061835961152572427089724 +pub const sqrt_e = 1.64872127070012814684865078781416357165377610071014801157507931 +pub const sqrt_pi = 1.77245385090551602729816748334114518279754945612238712821380779 +pub const sqrt_tau = 2.50662827463100050241576528481104525300698674060993831662992357 +pub const sqrt_phi = 1.27201964951406896425242246173749149171560804184009624861664038 +pub const ln2 = 0.693147180559945309417232121458176568075500134360255254120680009 +pub const log2_e = 1.0 / ln2 +pub const ln10 = 2.30258509299404568401799145468436420760110148862877297603332790 +pub const log10_e = 1.0 / ln10 +pub const two_thirds = 0.66666666666666666666666666666666666666666666666666666666666667 // Floating-point limit values // max is the largest finite value representable by the type. // smallest_non_zero is the smallest positive, non-zero value representable by the type. -pub const ( - max_f32 = 3.40282346638528859811704183484516925440e+38 // 2**127 * (2**24 - 1) / 2**23 - smallest_non_zero_f32 = 1.401298464324817070923729583289916131280e-45 // 1 / 2**(127 - 1 + 23) - max_f64 = 1.797693134862315708145274237317043567981e+308 // 2**1023 * (2**53 - 1) / 2**52 - smallest_non_zero_f64 = 4.940656458412465441765687928682213723651e-324 // 1 / 2**(1023 - 1 + 52) -) +pub const max_f32 = 3.40282346638528859811704183484516925440e+38 // 2**127 * (2**24 - 1) / 2**23 + +pub const smallest_non_zero_f32 = 1.401298464324817070923729583289916131280e-45 // 1 / 2**(127 - 1 + 23) + +pub const max_f64 = 1.797693134862315708145274237317043567981e+308 // 2**1023 * (2**53 - 1) / 2**52 + +pub const smallest_non_zero_f64 = 4.940656458412465441765687928682213723651e-324 @[deprecated: 'use built-in constants instead (e.g. min_i8 instead of math.min_i8)'] @[deprecated_after: '2023-12-31'] -pub const ( - min_i8 = i8(-128) - max_i8 = i8(127) - min_i16 = i16(-32768) - max_i16 = i16(32767) - min_i32 = i32(-2147483648) - max_i32 = i32(2147483647) - // -9223372036854775808 is wrong, because C compilers parse literal values - // without sign first, and 9223372036854775808 overflows i64, hence the - // consecutive subtraction by 1 - min_i64 = i64(-9223372036854775807 - 1) - max_i64 = i64(9223372036854775807) - min_u8 = u8(0) - max_u8 = u8(255) - min_u16 = u16(0) - max_u16 = u16(65535) - min_u32 = u32(0) - max_u32 = u32(4294967295) - min_u64 = u64(0) - max_u64 = u64(18446744073709551615) -) +pub const min_i8 = i8(-128) +pub const max_i8 = i8(127) +pub const min_i16 = i16(-32768) +pub const max_i16 = i16(32767) +pub const min_i32 = i32(-2147483648) +pub const max_i32 = i32(2147483647) +// -9223372036854775808 is wrong, because C compilers parse literal values +// without sign first, and 9223372036854775808 overflows i64, hence the +// consecutive subtraction by 1 +pub const min_i64 = i64(-9223372036854775807 - 1) +pub const max_i64 = i64(9223372036854775807) +pub const min_u8 = u8(0) +pub const max_u8 = u8(255) +pub const min_u16 = u16(0) +pub const max_u16 = u16(65535) +pub const min_u32 = u32(0) +pub const max_u32 = u32(4294967295) +pub const min_u64 = u64(0) +pub const max_u64 = u64(18446744073709551615) diff --git a/vlib/math/erf.v b/vlib/math/erf.v index 546219c141..3864bdf1eb 100644 --- a/vlib/math/erf.v +++ b/vlib/math/erf.v @@ -92,68 +92,121 @@ module math * erfc(0) = 1, erfc(inf) = 0, erfc(-inf) = 2, * erfc/erf(nan) is nan */ -const ( - erx = 8.45062911510467529297e-01 // 0x3FEB0AC160000000 - // Coefficients for approximation to erf in [0, 0.84375] - efx = 1.28379167095512586316e-01 // 0x3FC06EBA8214DB69 - efx8 = 1.02703333676410069053e+00 // 0x3FF06EBA8214DB69 - pp0 = 1.28379167095512558561e-01 // 0x3FC06EBA8214DB68 - pp1 = -3.25042107247001499370e-01 // 0xBFD4CD7D691CB913 - pp2 = -2.84817495755985104766e-02 // 0xBF9D2A51DBD7194F - pp3 = -5.77027029648944159157e-03 // 0xBF77A291236668E4 - pp4 = -2.37630166566501626084e-05 // 0xBEF8EAD6120016AC - qq1 = 3.97917223959155352819e-01 // 0x3FD97779CDDADC09 - qq2 = 6.50222499887672944485e-02 // 0x3FB0A54C5536CEBA - qq3 = 5.08130628187576562776e-03 // 0x3F74D022C4D36B0F - qq4 = 1.32494738004321644526e-04 // 0x3F215DC9221C1A10 - qq5 = -3.96022827877536812320e-06 // 0xBED09C4342A26120 - // Coefficients for approximation to erf in [0.84375, 1.25] - pa0 = -2.36211856075265944077e-03 // 0xBF6359B8BEF77538 - pa1 = 4.14856118683748331666e-01 // 0x3FDA8D00AD92B34D - pa2 = -3.72207876035701323847e-01 // 0xBFD7D240FBB8C3F1 - pa3 = 3.18346619901161753674e-01 // 0x3FD45FCA805120E4 - pa4 = -1.10894694282396677476e-01 // 0xBFBC63983D3E28EC - pa5 = 3.54783043256182359371e-02 // 0x3FA22A36599795EB - pa6 = -2.16637559486879084300e-03 // 0xBF61BF380A96073F - qa1 = 1.06420880400844228286e-01 // 0x3FBB3E6618EEE323 - qa2 = 5.40397917702171048937e-01 // 0x3FE14AF092EB6F33 - qa3 = 7.18286544141962662868e-02 // 0x3FB2635CD99FE9A7 - qa4 = 1.26171219808761642112e-01 // 0x3FC02660E763351F - qa5 = 1.36370839120290507362e-02 // 0x3F8BEDC26B51DD1C - qa6 = 1.19844998467991074170e-02 // 0x3F888B545735151D - // Coefficients for approximation to erfc in [1.25, 1/0.35] - ra0 = -9.86494403484714822705e-03 // 0xBF843412600D6435 - ra1 = -6.93858572707181764372e-01 // 0xBFE63416E4BA7360 - ra2 = -1.05586262253232909814e+01 // 0xC0251E0441B0E726 - ra3 = -6.23753324503260060396e+01 // 0xC04F300AE4CBA38D - ra4 = -1.62396669462573470355e+02 // 0xC0644CB184282266 - ra5 = -1.84605092906711035994e+02 // 0xC067135CEBCCABB2 - ra6 = -8.12874355063065934246e+01 // 0xC054526557E4D2F2 - ra7 = -9.81432934416914548592e+00 // 0xC023A0EFC69AC25C - sa1 = 1.96512716674392571292e+01 // 0x4033A6B9BD707687 - sa2 = 1.37657754143519042600e+02 // 0x4061350C526AE721 - sa3 = 4.34565877475229228821e+02 // 0x407B290DD58A1A71 - sa4 = 6.45387271733267880336e+02 // 0x40842B1921EC2868 - sa5 = 4.29008140027567833386e+02 // 0x407AD02157700314 - sa6 = 1.08635005541779435134e+02 // 0x405B28A3EE48AE2C - sa7 = 6.57024977031928170135e+00 // 0x401A47EF8E484A93 - sa8 = -6.04244152148580987438e-02 // 0xBFAEEFF2EE749A62 - // Coefficients for approximation to erfc in [1/.35, 28] - rb0 = -9.86494292470009928597e-03 // 0xBF84341239E86F4A - rb1 = -7.99283237680523006574e-01 // 0xBFE993BA70C285DE - rb2 = -1.77579549177547519889e+01 // 0xC031C209555F995A - rb3 = -1.60636384855821916062e+02 // 0xC064145D43C5ED98 - rb4 = -6.37566443368389627722e+02 // 0xC083EC881375F228 - rb5 = -1.02509513161107724954e+03 // 0xC09004616A2E5992 - rb6 = -4.83519191608651397019e+02 // 0xC07E384E9BDC383F - sb1 = 3.03380607434824582924e+01 // 0x403E568B261D5190 - sb2 = 3.25792512996573918826e+02 // 0x40745CAE221B9F0A - sb3 = 1.53672958608443695994e+03 // 0x409802EB189D5118 - sb4 = 3.19985821950859553908e+03 // 0x40A8FFB7688C246A - sb5 = 2.55305040643316442583e+03 // 0x40A3F219CEDF3BE6 - sb6 = 4.74528541206955367215e+02 // 0x407DA874E79FE763 - sb7 = -2.24409524465858183362e+01 // 0xC03670E242712D62 -) +const erx = 8.45062911510467529297e-01 // 0x3FEB0AC160000000 + +// Coefficients for approximation to erf in [0, 0.84375] +const efx = 1.28379167095512586316e-01 // 0x3FC06EBA8214DB69 + +const efx8 = 1.02703333676410069053e+00 // 0x3FF06EBA8214DB69 + +const pp0 = 1.28379167095512558561e-01 // 0x3FC06EBA8214DB68 + +const pp1 = -3.25042107247001499370e-01 // 0xBFD4CD7D691CB913 + +const pp2 = -2.84817495755985104766e-02 // 0xBF9D2A51DBD7194F + +const pp3 = -5.77027029648944159157e-03 // 0xBF77A291236668E4 + +const pp4 = -2.37630166566501626084e-05 // 0xBEF8EAD6120016AC + +const qq1 = 3.97917223959155352819e-01 // 0x3FD97779CDDADC09 + +const qq2 = 6.50222499887672944485e-02 // 0x3FB0A54C5536CEBA + +const qq3 = 5.08130628187576562776e-03 // 0x3F74D022C4D36B0F + +const qq4 = 1.32494738004321644526e-04 // 0x3F215DC9221C1A10 + +const qq5 = -3.96022827877536812320e-06 // 0xBED09C4342A26120 + +// Coefficients for approximation to erf in [0.84375, 1.25] +const pa0 = -2.36211856075265944077e-03 // 0xBF6359B8BEF77538 + +const pa1 = 4.14856118683748331666e-01 // 0x3FDA8D00AD92B34D + +const pa2 = -3.72207876035701323847e-01 // 0xBFD7D240FBB8C3F1 + +const pa3 = 3.18346619901161753674e-01 // 0x3FD45FCA805120E4 + +const pa4 = -1.10894694282396677476e-01 // 0xBFBC63983D3E28EC + +const pa5 = 3.54783043256182359371e-02 // 0x3FA22A36599795EB + +const pa6 = -2.16637559486879084300e-03 // 0xBF61BF380A96073F + +const qa1 = 1.06420880400844228286e-01 // 0x3FBB3E6618EEE323 + +const qa2 = 5.40397917702171048937e-01 // 0x3FE14AF092EB6F33 + +const qa3 = 7.18286544141962662868e-02 // 0x3FB2635CD99FE9A7 + +const qa4 = 1.26171219808761642112e-01 // 0x3FC02660E763351F + +const qa5 = 1.36370839120290507362e-02 // 0x3F8BEDC26B51DD1C + +const qa6 = 1.19844998467991074170e-02 // 0x3F888B545735151D + +// Coefficients for approximation to erfc in [1.25, 1/0.35] +const ra0 = -9.86494403484714822705e-03 // 0xBF843412600D6435 + +const ra1 = -6.93858572707181764372e-01 // 0xBFE63416E4BA7360 + +const ra2 = -1.05586262253232909814e+01 // 0xC0251E0441B0E726 + +const ra3 = -6.23753324503260060396e+01 // 0xC04F300AE4CBA38D + +const ra4 = -1.62396669462573470355e+02 // 0xC0644CB184282266 + +const ra5 = -1.84605092906711035994e+02 // 0xC067135CEBCCABB2 + +const ra6 = -8.12874355063065934246e+01 // 0xC054526557E4D2F2 + +const ra7 = -9.81432934416914548592e+00 // 0xC023A0EFC69AC25C + +const sa1 = 1.96512716674392571292e+01 // 0x4033A6B9BD707687 + +const sa2 = 1.37657754143519042600e+02 // 0x4061350C526AE721 + +const sa3 = 4.34565877475229228821e+02 // 0x407B290DD58A1A71 + +const sa4 = 6.45387271733267880336e+02 // 0x40842B1921EC2868 + +const sa5 = 4.29008140027567833386e+02 // 0x407AD02157700314 + +const sa6 = 1.08635005541779435134e+02 // 0x405B28A3EE48AE2C + +const sa7 = 6.57024977031928170135e+00 // 0x401A47EF8E484A93 + +const sa8 = -6.04244152148580987438e-02 // 0xBFAEEFF2EE749A62 + +// Coefficients for approximation to erfc in [1/.35, 28] +const rb0 = -9.86494292470009928597e-03 // 0xBF84341239E86F4A + +const rb1 = -7.99283237680523006574e-01 // 0xBFE993BA70C285DE + +const rb2 = -1.77579549177547519889e+01 // 0xC031C209555F995A + +const rb3 = -1.60636384855821916062e+02 // 0xC064145D43C5ED98 + +const rb4 = -6.37566443368389627722e+02 // 0xC083EC881375F228 + +const rb5 = -1.02509513161107724954e+03 // 0xC09004616A2E5992 + +const rb6 = -4.83519191608651397019e+02 // 0xC07E384E9BDC383F + +const sb1 = 3.03380607434824582924e+01 // 0x403E568B261D5190 + +const sb2 = 3.25792512996573918826e+02 // 0x40745CAE221B9F0A + +const sb3 = 1.53672958608443695994e+03 // 0x409802EB189D5118 + +const sb4 = 3.19985821950859553908e+03 // 0x40A8FFB7688C246A + +const sb5 = 2.55305040643316442583e+03 // 0x40A3F219CEDF3BE6 + +const sb6 = 4.74528541206955367215e+02 // 0x407DA874E79FE763 + +const sb7 = -2.24409524465858183362e+01 // erf returns the error function of x. // diff --git a/vlib/math/exp.v b/vlib/math/exp.v index 4e5f59e57b..c845820b05 100644 --- a/vlib/math/exp.v +++ b/vlib/math/exp.v @@ -2,23 +2,32 @@ module math import math.internal -const ( - f64_max_exp = f64(1024) - f64_min_exp = f64(-1021) - threshold = 7.09782712893383973096e+02 // 0x40862E42FEFA39EF - ln2_x56 = 3.88162421113569373274e+01 // 0x4043687a9f1af2b1 - ln2_halfx3 = 1.03972077083991796413e+00 // 0x3ff0a2b23f3bab73 - ln2_half = 3.46573590279972654709e-01 // 0x3fd62e42fefa39ef - ln2hi = 6.93147180369123816490e-01 // 0x3fe62e42fee00000 - ln2lo = 1.90821492927058770002e-10 // 0x3dea39ef35793c76 - inv_ln2 = 1.44269504088896338700e+00 // 0x3ff71547652b82fe - // scaled coefficients related to expm1 - expm1_q1 = -3.33333333333331316428e-02 // 0xBFA11111111110F4 - expm1_q2 = 1.58730158725481460165e-03 // 0x3F5A01A019FE5585 - expm1_q3 = -7.93650757867487942473e-05 // 0xBF14CE199EAADBB7 - expm1_q4 = 4.00821782732936239552e-06 // 0x3ED0CFCA86E65239 - expm1_q5 = -2.01099218183624371326e-07 // 0xBE8AFDB76E09C32D -) +const f64_max_exp = f64(1024) +const f64_min_exp = f64(-1021) +const threshold = 7.09782712893383973096e+02 // 0x40862E42FEFA39EF + +const ln2_x56 = 3.88162421113569373274e+01 // 0x4043687a9f1af2b1 + +const ln2_halfx3 = 1.03972077083991796413e+00 // 0x3ff0a2b23f3bab73 + +const ln2_half = 3.46573590279972654709e-01 // 0x3fd62e42fefa39ef + +const ln2hi = 6.93147180369123816490e-01 // 0x3fe62e42fee00000 + +const ln2lo = 1.90821492927058770002e-10 // 0x3dea39ef35793c76 + +const inv_ln2 = 1.44269504088896338700e+00 // 0x3ff71547652b82fe + +// scaled coefficients related to expm1 +const expm1_q1 = -3.33333333333331316428e-02 // 0xBFA11111111110F4 + +const expm1_q2 = 1.58730158725481460165e-03 // 0x3F5A01A019FE5585 + +const expm1_q3 = -7.93650757867487942473e-05 // 0xBF14CE199EAADBB7 + +const expm1_q4 = 4.00821782732936239552e-06 // 0x3ED0CFCA86E65239 + +const expm1_q5 = -2.01099218183624371326e-07 // exp returns e**x, the base-e exponential of x. // diff --git a/vlib/math/factorial_tables.v b/vlib/math/factorial_tables.v index 5154b218ca..6d0d35b285 100644 --- a/vlib/math/factorial_tables.v +++ b/vlib/math/factorial_tables.v @@ -1,711 +1,709 @@ module math -const ( - log_sqrt_2pi = 9.18938533204672741780329736e-1 - bernoulli = [ - /* - Bernoulli numbers B(2),B(4),B(6),...,B(20). Only B(2),...,B(10) currently +const log_sqrt_2pi = 9.18938533204672741780329736e-1 +const bernoulli = [ + /* + Bernoulli numbers B(2),B(4),B(6),...,B(20). Only B(2),...,B(10) currently * used. - */ - 1.0 / (6.0 * 2.0 * 1.0), - -1.0 / (30.0 * 4.0 * 3.0), - 1.0 / (42.0 * 6.0 * 5.0), - -1.0 / (30.0 * 8.0 * 7.0), - 5.0 / (66.0 * 10.0 * 9.0), - -691.0 / (2730.0 * 12.0 * 11.0), - 7.0 / (6.0 * 14.0 * 13.0), - -3617.0 / (510.0 * 16.0 * 15.0), - 43867.0 / (796.0 * 18.0 * 17.0), - -174611.0 / (330.0 * 20.0 * 19.0), - ] - factorials_table = [ - // 0! - 1.000000000000000000000e+0, - // 1! - 1.000000000000000000000e+0, - // 2! - 2.000000000000000000000e+0, - // 3! - 6.000000000000000000000e+0, - // 4! - 2.400000000000000000000e+1, - // 5! - 1.200000000000000000000e+2, - // 6! - 7.200000000000000000000e+2, - // 7! - 5.040000000000000000000e+3, - // 8! - 4.032000000000000000000e+4, - // 9! - 3.628800000000000000000e+5, - // 10! - 3.628800000000000000000e+6, - // 11! - 3.991680000000000000000e+7, - // 12! - 4.790016000000000000000e+8, - // 13! - 6.227020800000000000000e+9, - // 14! - 8.717829120000000000000e+10, - // 15! - 1.307674368000000000000e+12, - // 16! - 2.092278988800000000000e+13, - // 17! - 3.556874280960000000000e+14, - // 18! - 6.402373705728000000000e+15, - // 19! - 1.216451004088320000000e+17, - // 20! - 2.432902008176640000000e+18, - // 21! - 5.109094217170944000000e+19, - // 22! - 1.124000727777607680000e+21, - // 23! - 2.585201673888497664000e+22, - // 24! - 6.204484017332394393600e+23, - // 25! - 1.551121004333098598400e+25, - // 26! - 4.032914611266056355840e+26, - // 27! - 1.088886945041835216077e+28, - // 28! - 3.048883446117138605015e+29, - // 29! - 8.841761993739701954544e+30, - // 30! - 2.652528598121910586363e+32, - // 31! - 8.222838654177922817726e+33, - // 32! - 2.631308369336935301672e+35, - // 33! - 8.683317618811886495518e+36, - // 34! - 2.952327990396041408476e+38, - // 35! - 1.033314796638614492967e+40, - // 36! - 3.719933267899012174680e+41, - // 37! - 1.376375309122634504632e+43, - // 38! - 5.230226174666011117600e+44, - // 39! - 2.039788208119744335864e+46, - // 40! - 8.159152832478977343456e+47, - // 41! - 3.345252661316380710817e+49, - // 42! - 1.405006117752879898543e+51, - // 43! - 6.041526306337383563736e+52, - // 44! - 2.658271574788448768044e+54, - // 45! - 1.196222208654801945620e+56, - // 46! - 5.502622159812088949850e+57, - // 47! - 2.586232415111681806430e+59, - // 48! - 1.241391559253607267086e+61, - // 49! - 6.082818640342675608723e+62, - // 50! - 3.041409320171337804361e+64, - // 51! - 1.551118753287382280224e+66, - // 52! - 8.065817517094387857166e+67, - // 53! - 4.274883284060025564298e+69, - // 54! - 2.308436973392413804721e+71, - // 55! - 1.269640335365827592597e+73, - // 56! - 7.109985878048634518540e+74, - // 57! - 4.052691950487721675568e+76, - // 58! - 2.350561331282878571829e+78, - // 59! - 1.386831185456898357379e+80, - // 60! - 8.320987112741390144276e+81, - // 61! - 5.075802138772247988009e+83, - // 62! - 3.146997326038793752565e+85, - // 63! - 1.982608315404440064116e+87, - // 64! - 1.268869321858841641034e+89, - // 65! - 8.247650592082470666723e+90, - // 66! - 5.443449390774430640037e+92, - // 67! - 3.647111091818868528825e+94, - // 68! - 2.480035542436830599601e+96, - // 69! - 1.711224524281413113725e+98, - // 70! - 1.197857166996989179607e+100, - // 71! - 8.504785885678623175212e+101, - // 72! - 6.123445837688608686152e+103, - // 73! - 4.470115461512684340891e+105, - // 74! - 3.307885441519386412260e+107, - // 75! - 2.480914081139539809195e+109, - // 76! - 1.885494701666050254988e+111, - // 77! - 1.451830920282858696341e+113, - // 78! - 1.132428117820629783146e+115, - // 79! - 8.946182130782975286851e+116, - // 80! - 7.156945704626380229481e+118, - // 81! - 5.797126020747367985880e+120, - // 82! - 4.753643337012841748421e+122, - // 83! - 3.945523969720658651190e+124, - // 84! - 3.314240134565353266999e+126, - // 85! - 2.817104114380550276949e+128, - // 86! - 2.422709538367273238177e+130, - // 87! - 2.107757298379527717214e+132, - // 88! - 1.854826422573984391148e+134, - // 89! - 1.650795516090846108122e+136, - // 90! - 1.485715964481761497310e+138, - // 91! - 1.352001527678402962552e+140, - // 92! - 1.243841405464130725548e+142, - // 93! - 1.156772507081641574759e+144, - // 94! - 1.087366156656743080274e+146, - // 95! - 1.032997848823905926260e+148, - // 96! - 9.916779348709496892096e+149, - // 97! - 9.619275968248211985333e+151, - // 98! - 9.426890448883247745626e+153, - // 99! - 9.332621544394415268170e+155, - // 100! - 9.332621544394415268170e+157, - // 101! - 9.425947759838359420852e+159, - // 102! - 9.614466715035126609269e+161, - // 103! - 9.902900716486180407547e+163, - // 104! - 1.029901674514562762385e+166, - // 105! - 1.081396758240290900504e+168, - // 106! - 1.146280563734708354534e+170, - // 107! - 1.226520203196137939352e+172, - // 108! - 1.324641819451828974500e+174, - // 109! - 1.443859583202493582205e+176, - // 110! - 1.588245541522742940425e+178, - // 111! - 1.762952551090244663872e+180, - // 112! - 1.974506857221074023537e+182, - // 113! - 2.231192748659813646597e+184, - // 114! - 2.543559733472187557120e+186, - // 115! - 2.925093693493015690688e+188, - // 116! - 3.393108684451898201198e+190, - // 117! - 3.969937160808720895402e+192, - // 118! - 4.684525849754290656574e+194, - // 119! - 5.574585761207605881323e+196, - // 120! - 6.689502913449127057588e+198, - // 121! - 8.094298525273443739682e+200, - // 122! - 9.875044200833601362412e+202, - // 123! - 1.214630436702532967577e+205, - // 124! - 1.506141741511140879795e+207, - // 125! - 1.882677176888926099744e+209, - // 126! - 2.372173242880046885677e+211, - // 127! - 3.012660018457659544810e+213, - // 128! - 3.856204823625804217357e+215, - // 129! - 4.974504222477287440390e+217, - // 130! - 6.466855489220473672507e+219, - // 131! - 8.471580690878820510985e+221, - // 132! - 1.118248651196004307450e+224, - // 133! - 1.487270706090685728908e+226, - // 134! - 1.992942746161518876737e+228, - // 135! - 2.690472707318050483595e+230, - // 136! - 3.659042881952548657690e+232, - // 137! - 5.012888748274991661035e+234, - // 138! - 6.917786472619488492228e+236, - // 139! - 9.615723196941089004197e+238, - // 140! - 1.346201247571752460588e+241, - // 141! - 1.898143759076170969429e+243, - // 142! - 2.695364137888162776589e+245, - // 143! - 3.854370717180072770522e+247, - // 144! - 5.550293832739304789551e+249, - // 145! - 8.047926057471991944849e+251, - // 146! - 1.174997204390910823948e+254, - // 147! - 1.727245890454638911203e+256, - // 148! - 2.556323917872865588581e+258, - // 149! - 3.808922637630569726986e+260, - // 150! - 5.713383956445854590479e+262, - // 151! - 8.627209774233240431623e+264, - // 152! - 1.311335885683452545607e+267, - // 153! - 2.006343905095682394778e+269, - // 154! - 3.089769613847350887959e+271, - // 155! - 4.789142901463393876336e+273, - // 156! - 7.471062926282894447084e+275, - // 157! - 1.172956879426414428192e+278, - // 158! - 1.853271869493734796544e+280, - // 159! - 2.946702272495038326504e+282, - // 160! - 4.714723635992061322407e+284, - // 161! - 7.590705053947218729075e+286, - // 162! - 1.229694218739449434110e+289, - // 163! - 2.004401576545302577600e+291, - // 164! - 3.287218585534296227263e+293, - // 165! - 5.423910666131588774984e+295, - // 166! - 9.003691705778437366474e+297, - // 167! - 1.503616514864999040201e+300, - // 168! - 2.526075744973198387538e+302, - // 169! - 4.269068009004705274939e+304, - // 170! - 7.257415615307998967397e+306, - ] - log_factorials_table = [ - // 0! - 0.000000000000000000000e+0, - // 1! - 0.000000000000000000000e+0, - // 2! - 6.931471805599453094172e-1, - // 3! - 1.791759469228055000812e+0, - // 4! - 3.178053830347945619647e+0, - // 5! - 4.787491742782045994248e+0, - // 6! - 6.579251212010100995060e+0, - // 7! - 8.525161361065414300166e+0, - // 8! - 1.060460290274525022842e+1, - // 9! - 1.280182748008146961121e+1, - // 10! - 1.510441257307551529523e+1, - // 11! - 1.750230784587388583929e+1, - // 12! - 1.998721449566188614952e+1, - // 13! - 2.255216385312342288557e+1, - // 14! - 2.519122118273868150009e+1, - // 15! - 2.789927138384089156609e+1, - // 16! - 3.067186010608067280376e+1, - // 17! - 3.350507345013688888401e+1, - // 18! - 3.639544520803305357622e+1, - // 19! - 3.933988418719949403622e+1, - // 20! - 4.233561646075348502966e+1, - // 21! - 4.538013889847690802616e+1, - // 22! - 4.847118135183522387964e+1, - // 23! - 5.160667556776437357045e+1, - // 24! - 5.478472939811231919009e+1, - // 25! - 5.800360522298051993929e+1, - // 26! - 6.126170176100200198477e+1, - // 27! - 6.455753862700633105895e+1, - // 28! - 6.788974313718153498289e+1, - // 29! - 7.125703896716800901007e+1, - // 30! - 7.465823634883016438549e+1, - // 31! - 7.809222355331531063142e+1, - // 32! - 8.155795945611503717850e+1, - // 33! - 8.505446701758151741396e+1, - // 34! - 8.858082754219767880363e+1, - // 35! - 9.213617560368709248333e+1, - // 36! - 9.571969454214320248496e+1, - // 37! - 9.933061245478742692933e+1, - // 38! - 1.029681986145138126988e+2, - // 39! - 1.066317602606434591262e+2, - // 40! - 1.103206397147573954291e+2, - // 41! - 1.140342117814617032329e+2, - // 42! - 1.177718813997450715388e+2, - // 43! - 1.215330815154386339623e+2, - // 44! - 1.253172711493568951252e+2, - // 45! - 1.291239336391272148826e+2, - // 46! - 1.329525750356163098828e+2, - // 47! - 1.368027226373263684696e+2, - // 48! - 1.406739236482342593987e+2, - // 49! - 1.445657439463448860089e+2, - // 50! - 1.484777669517730320675e+2, - // 51! - 1.524095925844973578392e+2, - // 52! - 1.563608363030787851941e+2, - // 53! - 1.603311282166309070282e+2, - // 54! - 1.643201122631951814118e+2, - // 55! - 1.683274454484276523305e+2, - // 56! - 1.723527971391628015638e+2, - // 57! - 1.763958484069973517152e+2, - // 58! - 1.804562914175437710518e+2, - // 59! - 1.845338288614494905025e+2, - // 60! - 1.886281734236715911873e+2, - // 61! - 1.927390472878449024360e+2, - // 62! - 1.968661816728899939914e+2, - // 63! - 2.010093163992815266793e+2, - // 64! - 2.051681994826411985358e+2, - // 65! - 2.093425867525368356464e+2, - // 66! - 2.135322414945632611913e+2, - // 67! - 2.177369341139542272510e+2, - // 68! - 2.219564418191303339501e+2, - // 69! - 2.261905483237275933323e+2, - // 70! - 2.304390435657769523214e+2, - // 71! - 2.347017234428182677427e+2, - // 72! - 2.389783895618343230538e+2, - // 73! - 2.432688490029827141829e+2, - // 74! - 2.475729140961868839366e+2, - // 75! - 2.518904022097231943772e+2, - // 76! - 2.562211355500095254561e+2, - // 77! - 2.605649409718632093053e+2, - // 78! - 2.649216497985528010421e+2, - // 79! - 2.692910976510198225363e+2, - // 80! - 2.736731242856937041486e+2, - // 81! - 2.780675734403661429141e+2, - // 82! - 2.824742926876303960274e+2, - // 83! - 2.868931332954269939509e+2, - // 84! - 2.913239500942703075662e+2, - // 85! - 2.957666013507606240211e+2, - // 86! - 3.002209486470141317540e+2, - // 87! - 3.046868567656687154726e+2, - // 88! - 3.091641935801469219449e+2, - // 89! - 3.136528299498790617832e+2, - // 90! - 3.181526396202093268500e+2, - // 91! - 3.226634991267261768912e+2, - // 92! - 3.271852877037752172008e+2, - // 93! - 3.317178871969284731381e+2, - // 94! - 3.362611819791984770344e+2, - // 95! - 3.408150588707990178690e+2, - // 96! - 3.453794070622668541074e+2, - // 97! - 3.499541180407702369296e+2, - // 98! - 3.545390855194408088492e+2, - // 99! - 3.591342053695753987760e+2, - // 100! - 3.637393755555634901441e+2, - // 101! - 3.683544960724047495950e+2, - // 102! - 3.729794688856890206760e+2, - // 103! - 3.776141978739186564468e+2, - // 104! - 3.822585887730600291111e+2, - // 105! - 3.869125491232175524822e+2, - // 106! - 3.915759882173296196258e+2, - // 107! - 3.962488170517915257991e+2, - // 108! - 4.009309482789157454921e+2, - // 109! - 4.056222961611448891925e+2, - // 110! - 4.103227765269373054205e+2, - // 111! - 4.150323067282496395563e+2, - // 112! - 4.197508055995447340991e+2, - // 113! - 4.244781934182570746677e+2, - // 114! - 4.292143918666515701285e+2, - // 115! - 4.339593239950148201939e+2, - // 116! - 4.387129141861211848399e+2, - // 117! - 4.434750881209189409588e+2, - // 118! - 4.482457727453846057188e+2, - // 119! - 4.530248962384961351041e+2, - // 120! - 4.578123879812781810984e+2, - // 121! - 4.626081785268749221865e+2, - // 122! - 4.674121995716081787447e+2, - // 123! - 4.722243839269805962399e+2, - // 124! - 4.770446654925856331047e+2, - // 125! - 4.818729792298879342285e+2, - // 126! - 4.867092611368394122258e+2, - // 127! - 4.915534482232980034989e+2, - // 128! - 4.964054784872176206648e+2, - // 129! - 5.012652908915792927797e+2, - // 130! - 5.061328253420348751997e+2, - // 131! - 5.110080226652360267439e+2, - // 132! - 5.158908245878223975982e+2, - // 133! - 5.207811737160441513633e+2, - // 134! - 5.256790135159950627324e+2, - // 135! - 5.305842882944334921812e+2, - // 136! - 5.354969431801695441897e+2, - // 137! - 5.404169241059976691050e+2, - // 138! - 5.453441777911548737966e+2, - // 139! - 5.502786517242855655538e+2, - // 140! - 5.552202941468948698523e+2, - // 141! - 5.601690540372730381305e+2, - // 142! - 5.651248810948742988613e+2, - // 143! - 5.700877257251342061414e+2, - // 144! - 5.750575390247102067619e+2, - // 145! - 5.800342727671307811636e+2, - // 146! - 5.850178793888391176022e+2, - // 147! - 5.900083119756178539038e+2, - // 148! - 5.950055242493819689670e+2, - // 149! - 6.000094705553274281080e+2, - // 150! - 6.050201058494236838580e+2, - // 151! - 6.100373856862386081868e+2, - // 152! - 6.150612662070848845750e+2, - // 153! - 6.200917041284773200381e+2, - // 154! - 6.251286567308909491967e+2, - // 155! - 6.301720818478101958172e+2, - // 156! - 6.352219378550597328635e+2, - // 157! - 6.402781836604080409209e+2, - // 158! - 6.453407786934350077245e+2, - // 159! - 6.504096828956552392500e+2, - // 160! - 6.554848567108890661717e+2, - // 161! - 6.605662610758735291676e+2, - // 162! - 6.656538574111059132426e+2, - // 163! - 6.707476076119126755767e+2, - // 164! - 6.758474740397368739994e+2, - // 165! - 6.809534195136374546094e+2, - // 166! - 6.860654073019939978423e+2, - // 167! - 6.911834011144107529496e+2, - // 168! - 6.963073650938140118743e+2, - // 169! - 7.014372638087370853465e+2, - // 170! - 7.065730622457873471107e+2, - // 171! - 7.117147258022900069535e+2, - ] -) + */ + 1.0 / (6.0 * 2.0 * 1.0), + -1.0 / (30.0 * 4.0 * 3.0), + 1.0 / (42.0 * 6.0 * 5.0), + -1.0 / (30.0 * 8.0 * 7.0), + 5.0 / (66.0 * 10.0 * 9.0), + -691.0 / (2730.0 * 12.0 * 11.0), + 7.0 / (6.0 * 14.0 * 13.0), + -3617.0 / (510.0 * 16.0 * 15.0), + 43867.0 / (796.0 * 18.0 * 17.0), + -174611.0 / (330.0 * 20.0 * 19.0), +] +const factorials_table = [ + // 0! + 1.000000000000000000000e+0, + // 1! + 1.000000000000000000000e+0, + // 2! + 2.000000000000000000000e+0, + // 3! + 6.000000000000000000000e+0, + // 4! + 2.400000000000000000000e+1, + // 5! + 1.200000000000000000000e+2, + // 6! + 7.200000000000000000000e+2, + // 7! + 5.040000000000000000000e+3, + // 8! + 4.032000000000000000000e+4, + // 9! + 3.628800000000000000000e+5, + // 10! + 3.628800000000000000000e+6, + // 11! + 3.991680000000000000000e+7, + // 12! + 4.790016000000000000000e+8, + // 13! + 6.227020800000000000000e+9, + // 14! + 8.717829120000000000000e+10, + // 15! + 1.307674368000000000000e+12, + // 16! + 2.092278988800000000000e+13, + // 17! + 3.556874280960000000000e+14, + // 18! + 6.402373705728000000000e+15, + // 19! + 1.216451004088320000000e+17, + // 20! + 2.432902008176640000000e+18, + // 21! + 5.109094217170944000000e+19, + // 22! + 1.124000727777607680000e+21, + // 23! + 2.585201673888497664000e+22, + // 24! + 6.204484017332394393600e+23, + // 25! + 1.551121004333098598400e+25, + // 26! + 4.032914611266056355840e+26, + // 27! + 1.088886945041835216077e+28, + // 28! + 3.048883446117138605015e+29, + // 29! + 8.841761993739701954544e+30, + // 30! + 2.652528598121910586363e+32, + // 31! + 8.222838654177922817726e+33, + // 32! + 2.631308369336935301672e+35, + // 33! + 8.683317618811886495518e+36, + // 34! + 2.952327990396041408476e+38, + // 35! + 1.033314796638614492967e+40, + // 36! + 3.719933267899012174680e+41, + // 37! + 1.376375309122634504632e+43, + // 38! + 5.230226174666011117600e+44, + // 39! + 2.039788208119744335864e+46, + // 40! + 8.159152832478977343456e+47, + // 41! + 3.345252661316380710817e+49, + // 42! + 1.405006117752879898543e+51, + // 43! + 6.041526306337383563736e+52, + // 44! + 2.658271574788448768044e+54, + // 45! + 1.196222208654801945620e+56, + // 46! + 5.502622159812088949850e+57, + // 47! + 2.586232415111681806430e+59, + // 48! + 1.241391559253607267086e+61, + // 49! + 6.082818640342675608723e+62, + // 50! + 3.041409320171337804361e+64, + // 51! + 1.551118753287382280224e+66, + // 52! + 8.065817517094387857166e+67, + // 53! + 4.274883284060025564298e+69, + // 54! + 2.308436973392413804721e+71, + // 55! + 1.269640335365827592597e+73, + // 56! + 7.109985878048634518540e+74, + // 57! + 4.052691950487721675568e+76, + // 58! + 2.350561331282878571829e+78, + // 59! + 1.386831185456898357379e+80, + // 60! + 8.320987112741390144276e+81, + // 61! + 5.075802138772247988009e+83, + // 62! + 3.146997326038793752565e+85, + // 63! + 1.982608315404440064116e+87, + // 64! + 1.268869321858841641034e+89, + // 65! + 8.247650592082470666723e+90, + // 66! + 5.443449390774430640037e+92, + // 67! + 3.647111091818868528825e+94, + // 68! + 2.480035542436830599601e+96, + // 69! + 1.711224524281413113725e+98, + // 70! + 1.197857166996989179607e+100, + // 71! + 8.504785885678623175212e+101, + // 72! + 6.123445837688608686152e+103, + // 73! + 4.470115461512684340891e+105, + // 74! + 3.307885441519386412260e+107, + // 75! + 2.480914081139539809195e+109, + // 76! + 1.885494701666050254988e+111, + // 77! + 1.451830920282858696341e+113, + // 78! + 1.132428117820629783146e+115, + // 79! + 8.946182130782975286851e+116, + // 80! + 7.156945704626380229481e+118, + // 81! + 5.797126020747367985880e+120, + // 82! + 4.753643337012841748421e+122, + // 83! + 3.945523969720658651190e+124, + // 84! + 3.314240134565353266999e+126, + // 85! + 2.817104114380550276949e+128, + // 86! + 2.422709538367273238177e+130, + // 87! + 2.107757298379527717214e+132, + // 88! + 1.854826422573984391148e+134, + // 89! + 1.650795516090846108122e+136, + // 90! + 1.485715964481761497310e+138, + // 91! + 1.352001527678402962552e+140, + // 92! + 1.243841405464130725548e+142, + // 93! + 1.156772507081641574759e+144, + // 94! + 1.087366156656743080274e+146, + // 95! + 1.032997848823905926260e+148, + // 96! + 9.916779348709496892096e+149, + // 97! + 9.619275968248211985333e+151, + // 98! + 9.426890448883247745626e+153, + // 99! + 9.332621544394415268170e+155, + // 100! + 9.332621544394415268170e+157, + // 101! + 9.425947759838359420852e+159, + // 102! + 9.614466715035126609269e+161, + // 103! + 9.902900716486180407547e+163, + // 104! + 1.029901674514562762385e+166, + // 105! + 1.081396758240290900504e+168, + // 106! + 1.146280563734708354534e+170, + // 107! + 1.226520203196137939352e+172, + // 108! + 1.324641819451828974500e+174, + // 109! + 1.443859583202493582205e+176, + // 110! + 1.588245541522742940425e+178, + // 111! + 1.762952551090244663872e+180, + // 112! + 1.974506857221074023537e+182, + // 113! + 2.231192748659813646597e+184, + // 114! + 2.543559733472187557120e+186, + // 115! + 2.925093693493015690688e+188, + // 116! + 3.393108684451898201198e+190, + // 117! + 3.969937160808720895402e+192, + // 118! + 4.684525849754290656574e+194, + // 119! + 5.574585761207605881323e+196, + // 120! + 6.689502913449127057588e+198, + // 121! + 8.094298525273443739682e+200, + // 122! + 9.875044200833601362412e+202, + // 123! + 1.214630436702532967577e+205, + // 124! + 1.506141741511140879795e+207, + // 125! + 1.882677176888926099744e+209, + // 126! + 2.372173242880046885677e+211, + // 127! + 3.012660018457659544810e+213, + // 128! + 3.856204823625804217357e+215, + // 129! + 4.974504222477287440390e+217, + // 130! + 6.466855489220473672507e+219, + // 131! + 8.471580690878820510985e+221, + // 132! + 1.118248651196004307450e+224, + // 133! + 1.487270706090685728908e+226, + // 134! + 1.992942746161518876737e+228, + // 135! + 2.690472707318050483595e+230, + // 136! + 3.659042881952548657690e+232, + // 137! + 5.012888748274991661035e+234, + // 138! + 6.917786472619488492228e+236, + // 139! + 9.615723196941089004197e+238, + // 140! + 1.346201247571752460588e+241, + // 141! + 1.898143759076170969429e+243, + // 142! + 2.695364137888162776589e+245, + // 143! + 3.854370717180072770522e+247, + // 144! + 5.550293832739304789551e+249, + // 145! + 8.047926057471991944849e+251, + // 146! + 1.174997204390910823948e+254, + // 147! + 1.727245890454638911203e+256, + // 148! + 2.556323917872865588581e+258, + // 149! + 3.808922637630569726986e+260, + // 150! + 5.713383956445854590479e+262, + // 151! + 8.627209774233240431623e+264, + // 152! + 1.311335885683452545607e+267, + // 153! + 2.006343905095682394778e+269, + // 154! + 3.089769613847350887959e+271, + // 155! + 4.789142901463393876336e+273, + // 156! + 7.471062926282894447084e+275, + // 157! + 1.172956879426414428192e+278, + // 158! + 1.853271869493734796544e+280, + // 159! + 2.946702272495038326504e+282, + // 160! + 4.714723635992061322407e+284, + // 161! + 7.590705053947218729075e+286, + // 162! + 1.229694218739449434110e+289, + // 163! + 2.004401576545302577600e+291, + // 164! + 3.287218585534296227263e+293, + // 165! + 5.423910666131588774984e+295, + // 166! + 9.003691705778437366474e+297, + // 167! + 1.503616514864999040201e+300, + // 168! + 2.526075744973198387538e+302, + // 169! + 4.269068009004705274939e+304, + // 170! + 7.257415615307998967397e+306, +] +const log_factorials_table = [ + // 0! + 0.000000000000000000000e+0, + // 1! + 0.000000000000000000000e+0, + // 2! + 6.931471805599453094172e-1, + // 3! + 1.791759469228055000812e+0, + // 4! + 3.178053830347945619647e+0, + // 5! + 4.787491742782045994248e+0, + // 6! + 6.579251212010100995060e+0, + // 7! + 8.525161361065414300166e+0, + // 8! + 1.060460290274525022842e+1, + // 9! + 1.280182748008146961121e+1, + // 10! + 1.510441257307551529523e+1, + // 11! + 1.750230784587388583929e+1, + // 12! + 1.998721449566188614952e+1, + // 13! + 2.255216385312342288557e+1, + // 14! + 2.519122118273868150009e+1, + // 15! + 2.789927138384089156609e+1, + // 16! + 3.067186010608067280376e+1, + // 17! + 3.350507345013688888401e+1, + // 18! + 3.639544520803305357622e+1, + // 19! + 3.933988418719949403622e+1, + // 20! + 4.233561646075348502966e+1, + // 21! + 4.538013889847690802616e+1, + // 22! + 4.847118135183522387964e+1, + // 23! + 5.160667556776437357045e+1, + // 24! + 5.478472939811231919009e+1, + // 25! + 5.800360522298051993929e+1, + // 26! + 6.126170176100200198477e+1, + // 27! + 6.455753862700633105895e+1, + // 28! + 6.788974313718153498289e+1, + // 29! + 7.125703896716800901007e+1, + // 30! + 7.465823634883016438549e+1, + // 31! + 7.809222355331531063142e+1, + // 32! + 8.155795945611503717850e+1, + // 33! + 8.505446701758151741396e+1, + // 34! + 8.858082754219767880363e+1, + // 35! + 9.213617560368709248333e+1, + // 36! + 9.571969454214320248496e+1, + // 37! + 9.933061245478742692933e+1, + // 38! + 1.029681986145138126988e+2, + // 39! + 1.066317602606434591262e+2, + // 40! + 1.103206397147573954291e+2, + // 41! + 1.140342117814617032329e+2, + // 42! + 1.177718813997450715388e+2, + // 43! + 1.215330815154386339623e+2, + // 44! + 1.253172711493568951252e+2, + // 45! + 1.291239336391272148826e+2, + // 46! + 1.329525750356163098828e+2, + // 47! + 1.368027226373263684696e+2, + // 48! + 1.406739236482342593987e+2, + // 49! + 1.445657439463448860089e+2, + // 50! + 1.484777669517730320675e+2, + // 51! + 1.524095925844973578392e+2, + // 52! + 1.563608363030787851941e+2, + // 53! + 1.603311282166309070282e+2, + // 54! + 1.643201122631951814118e+2, + // 55! + 1.683274454484276523305e+2, + // 56! + 1.723527971391628015638e+2, + // 57! + 1.763958484069973517152e+2, + // 58! + 1.804562914175437710518e+2, + // 59! + 1.845338288614494905025e+2, + // 60! + 1.886281734236715911873e+2, + // 61! + 1.927390472878449024360e+2, + // 62! + 1.968661816728899939914e+2, + // 63! + 2.010093163992815266793e+2, + // 64! + 2.051681994826411985358e+2, + // 65! + 2.093425867525368356464e+2, + // 66! + 2.135322414945632611913e+2, + // 67! + 2.177369341139542272510e+2, + // 68! + 2.219564418191303339501e+2, + // 69! + 2.261905483237275933323e+2, + // 70! + 2.304390435657769523214e+2, + // 71! + 2.347017234428182677427e+2, + // 72! + 2.389783895618343230538e+2, + // 73! + 2.432688490029827141829e+2, + // 74! + 2.475729140961868839366e+2, + // 75! + 2.518904022097231943772e+2, + // 76! + 2.562211355500095254561e+2, + // 77! + 2.605649409718632093053e+2, + // 78! + 2.649216497985528010421e+2, + // 79! + 2.692910976510198225363e+2, + // 80! + 2.736731242856937041486e+2, + // 81! + 2.780675734403661429141e+2, + // 82! + 2.824742926876303960274e+2, + // 83! + 2.868931332954269939509e+2, + // 84! + 2.913239500942703075662e+2, + // 85! + 2.957666013507606240211e+2, + // 86! + 3.002209486470141317540e+2, + // 87! + 3.046868567656687154726e+2, + // 88! + 3.091641935801469219449e+2, + // 89! + 3.136528299498790617832e+2, + // 90! + 3.181526396202093268500e+2, + // 91! + 3.226634991267261768912e+2, + // 92! + 3.271852877037752172008e+2, + // 93! + 3.317178871969284731381e+2, + // 94! + 3.362611819791984770344e+2, + // 95! + 3.408150588707990178690e+2, + // 96! + 3.453794070622668541074e+2, + // 97! + 3.499541180407702369296e+2, + // 98! + 3.545390855194408088492e+2, + // 99! + 3.591342053695753987760e+2, + // 100! + 3.637393755555634901441e+2, + // 101! + 3.683544960724047495950e+2, + // 102! + 3.729794688856890206760e+2, + // 103! + 3.776141978739186564468e+2, + // 104! + 3.822585887730600291111e+2, + // 105! + 3.869125491232175524822e+2, + // 106! + 3.915759882173296196258e+2, + // 107! + 3.962488170517915257991e+2, + // 108! + 4.009309482789157454921e+2, + // 109! + 4.056222961611448891925e+2, + // 110! + 4.103227765269373054205e+2, + // 111! + 4.150323067282496395563e+2, + // 112! + 4.197508055995447340991e+2, + // 113! + 4.244781934182570746677e+2, + // 114! + 4.292143918666515701285e+2, + // 115! + 4.339593239950148201939e+2, + // 116! + 4.387129141861211848399e+2, + // 117! + 4.434750881209189409588e+2, + // 118! + 4.482457727453846057188e+2, + // 119! + 4.530248962384961351041e+2, + // 120! + 4.578123879812781810984e+2, + // 121! + 4.626081785268749221865e+2, + // 122! + 4.674121995716081787447e+2, + // 123! + 4.722243839269805962399e+2, + // 124! + 4.770446654925856331047e+2, + // 125! + 4.818729792298879342285e+2, + // 126! + 4.867092611368394122258e+2, + // 127! + 4.915534482232980034989e+2, + // 128! + 4.964054784872176206648e+2, + // 129! + 5.012652908915792927797e+2, + // 130! + 5.061328253420348751997e+2, + // 131! + 5.110080226652360267439e+2, + // 132! + 5.158908245878223975982e+2, + // 133! + 5.207811737160441513633e+2, + // 134! + 5.256790135159950627324e+2, + // 135! + 5.305842882944334921812e+2, + // 136! + 5.354969431801695441897e+2, + // 137! + 5.404169241059976691050e+2, + // 138! + 5.453441777911548737966e+2, + // 139! + 5.502786517242855655538e+2, + // 140! + 5.552202941468948698523e+2, + // 141! + 5.601690540372730381305e+2, + // 142! + 5.651248810948742988613e+2, + // 143! + 5.700877257251342061414e+2, + // 144! + 5.750575390247102067619e+2, + // 145! + 5.800342727671307811636e+2, + // 146! + 5.850178793888391176022e+2, + // 147! + 5.900083119756178539038e+2, + // 148! + 5.950055242493819689670e+2, + // 149! + 6.000094705553274281080e+2, + // 150! + 6.050201058494236838580e+2, + // 151! + 6.100373856862386081868e+2, + // 152! + 6.150612662070848845750e+2, + // 153! + 6.200917041284773200381e+2, + // 154! + 6.251286567308909491967e+2, + // 155! + 6.301720818478101958172e+2, + // 156! + 6.352219378550597328635e+2, + // 157! + 6.402781836604080409209e+2, + // 158! + 6.453407786934350077245e+2, + // 159! + 6.504096828956552392500e+2, + // 160! + 6.554848567108890661717e+2, + // 161! + 6.605662610758735291676e+2, + // 162! + 6.656538574111059132426e+2, + // 163! + 6.707476076119126755767e+2, + // 164! + 6.758474740397368739994e+2, + // 165! + 6.809534195136374546094e+2, + // 166! + 6.860654073019939978423e+2, + // 167! + 6.911834011144107529496e+2, + // 168! + 6.963073650938140118743e+2, + // 169! + 7.014372638087370853465e+2, + // 170! + 7.065730622457873471107e+2, + // 171! + 7.117147258022900069535e+2, +] diff --git a/vlib/math/fractions/approximations.v b/vlib/math/fractions/approximations.v index af41e5ef8a..b45031955e 100644 --- a/vlib/math/fractions/approximations.v +++ b/vlib/math/fractions/approximations.v @@ -5,11 +5,9 @@ module fractions import math -const ( - default_eps = 1.0e-4 - max_iterations = 50 - zero = fraction(0, 1) -) +const default_eps = 1.0e-4 +const max_iterations = 50 +const zero = fraction(0, 1) // ------------------------------------------------------------------------ // Unwrapped evaluation methods for fast evaluation of continued fractions. diff --git a/vlib/math/gamma_tables.v b/vlib/math/gamma_tables.v index 8bf9076dd3..8a7d62680d 100644 --- a/vlib/math/gamma_tables.v +++ b/vlib/math/gamma_tables.v @@ -1,163 +1,161 @@ module math -const ( - gamma_p = [ - 1.60119522476751861407e-04, - 1.19135147006586384913e-03, - 1.04213797561761569935e-02, - 4.76367800457137231464e-02, - 2.07448227648435975150e-01, - 4.94214826801497100753e-01, - 9.99999999999999996796e-01, - ] - gamma_q = [ - -2.31581873324120129819e-05, - 5.39605580493303397842e-04, - -4.45641913851797240494e-03, - 1.18139785222060435552e-02, - 3.58236398605498653373e-02, - -2.34591795718243348568e-01, - 7.14304917030273074085e-02, - 1.00000000000000000320e+00, - ] - gamma_s = [ - 7.87311395793093628397e-04, - -2.29549961613378126380e-04, - -2.68132617805781232825e-03, - 3.47222221605458667310e-03, - 8.33333333333482257126e-02, - ] - lgamma_a = [ - // 0x3FB3C467E37DB0C8 - 7.72156649015328655494e-02, - // 0x3FD4A34CC4A60FAD - 3.22467033424113591611e-01, - // 0x3FB13E001A5562A7 - 6.73523010531292681824e-02, - // 0x3F951322AC92547B - 2.05808084325167332806e-02, - // 0x3F7E404FB68FEFE8 - 7.38555086081402883957e-03, - // 0x3F67ADD8CCB7926B - 2.89051383673415629091e-03, - // 0x3F538A94116F3F5D - 1.19270763183362067845e-03, - // 0x3F40B6C689B99C00 - 5.10069792153511336608e-04, - // 0x3F2CF2ECED10E54D - 2.20862790713908385557e-04, - // 0x3F1C5088987DFB07 - 1.08011567247583939954e-04, - // 0x3EFA7074428CFA52 - 2.52144565451257326939e-05, - // 0x3F07858E90A45837 - 4.48640949618915160150e-05, - ] - lgamma_r = [ - // placeholder - 1.0, - // 0x3FF645A762C4AB74 - 1.39200533467621045958e+00, - // 0x3FE71A1893D3DCDC - 7.21935547567138069525e-01, - // 0x3FC601EDCCFBDF27 - 1.71933865632803078993e-01, - // 0x3F9317EA742ED475 - 1.86459191715652901344e-02, - // 0x3F497DDACA41A95B - 7.77942496381893596434e-04, - // 0x3EDEBAF7A5B38140 - 7.32668430744625636189e-06, - ] - lgamma_s = [ - // 0xBFB3C467E37DB0C8 - -7.72156649015328655494e-02, - // 0x3FCB848B36E20878 - 2.14982415960608852501e-01, - // 0x3FD4D98F4F139F59 - 3.25778796408930981787e-01, - // 0x3FC2BB9CBEE5F2F7 - 1.46350472652464452805e-01, - // 0x3F9B481C7E939961 - 2.66422703033638609560e-02, - // 0x3F5E26B67368F239 - 1.84028451407337715652e-03, - // 0x3F00BFECDD17E945 - 3.19475326584100867617e-05, - ] - lgamma_t = [ - // 0x3FDEF72BC8EE38A2 - 4.83836122723810047042e-01, - // 0xBFC2E4278DC6C509 - -1.47587722994593911752e-01, - // 0x3FB08B4294D5419B - 6.46249402391333854778e-02, - // 0xBFA0C9A8DF35B713 - -3.27885410759859649565e-02, - // 0x3F9266E7970AF9EC - 1.79706750811820387126e-02, - // 0xBF851F9FBA91EC6A - -1.03142241298341437450e-02, - // 0x3F78FCE0E370E344 - 6.10053870246291332635e-03, - // 0xBF6E2EFFB3E914D7 - -3.68452016781138256760e-03, - // 0x3F6282D32E15C915 - 2.25964780900612472250e-03, - // 0xBF56FE8EBF2D1AF1 - -1.40346469989232843813e-03, - // 0x3F4CDF0CEF61A8E9 - 8.81081882437654011382e-04, - // 0xBF41A6109C73E0EC - -5.38595305356740546715e-04, - // 0x3F34AF6D6C0EBBF7 - 3.15632070903625950361e-04, - // 0xBF347F24ECC38C38 - -3.12754168375120860518e-04, - // 0x3F35FD3EE8C2D3F4 - 3.35529192635519073543e-04, - ] - lgamma_u = [ - // 0xBFB3C467E37DB0C8 - -7.72156649015328655494e-02, - // 0x3FE4401E8B005DFF - 6.32827064025093366517e-01, - // 0x3FF7475CD119BD6F - 1.45492250137234768737e+00, - // 0x3FEF497644EA8450 - 9.77717527963372745603e-01, - // 0x3FCD4EAEF6010924 - 2.28963728064692451092e-01, - // 0x3F8B678BBF2BAB09 - 1.33810918536787660377e-02, - ] - lgamma_v = [ - 1.0, - // 0x4003A5D7C2BD619C - 2.45597793713041134822e+00, - // 0x40010725A42B18F5 - 2.12848976379893395361e+00, - // 0x3FE89DFBE45050AF - 7.69285150456672783825e-01, - // 0x3FBAAE55D6537C88 - 1.04222645593369134254e-01, - // 0x3F6A5ABB57D0CF61 - 3.21709242282423911810e-03, - ] - lgamma_w = [ - // 0x3FDACFE390C97D69 - 4.18938533204672725052e-01, - // 0x3FB555555555553B - 8.33333333333329678849e-02, - // 0xBF66C16C16B02E5C - -2.77777777728775536470e-03, - // 0x3F4A019F98CF38B6 - 7.93650558643019558500e-04, - // 0xBF4380CB8C0FE741 - -5.95187557450339963135e-04, - // 0x3F4B67BA4CDAD5D1 - 8.36339918996282139126e-04, - // 0xBF5AB89D0B9E43E4 - -1.63092934096575273989e-03, - ] -) +const gamma_p = [ + 1.60119522476751861407e-04, + 1.19135147006586384913e-03, + 1.04213797561761569935e-02, + 4.76367800457137231464e-02, + 2.07448227648435975150e-01, + 4.94214826801497100753e-01, + 9.99999999999999996796e-01, +] +const gamma_q = [ + -2.31581873324120129819e-05, + 5.39605580493303397842e-04, + -4.45641913851797240494e-03, + 1.18139785222060435552e-02, + 3.58236398605498653373e-02, + -2.34591795718243348568e-01, + 7.14304917030273074085e-02, + 1.00000000000000000320e+00, +] +const gamma_s = [ + 7.87311395793093628397e-04, + -2.29549961613378126380e-04, + -2.68132617805781232825e-03, + 3.47222221605458667310e-03, + 8.33333333333482257126e-02, +] +const lgamma_a = [ + // 0x3FB3C467E37DB0C8 + 7.72156649015328655494e-02, + // 0x3FD4A34CC4A60FAD + 3.22467033424113591611e-01, + // 0x3FB13E001A5562A7 + 6.73523010531292681824e-02, + // 0x3F951322AC92547B + 2.05808084325167332806e-02, + // 0x3F7E404FB68FEFE8 + 7.38555086081402883957e-03, + // 0x3F67ADD8CCB7926B + 2.89051383673415629091e-03, + // 0x3F538A94116F3F5D + 1.19270763183362067845e-03, + // 0x3F40B6C689B99C00 + 5.10069792153511336608e-04, + // 0x3F2CF2ECED10E54D + 2.20862790713908385557e-04, + // 0x3F1C5088987DFB07 + 1.08011567247583939954e-04, + // 0x3EFA7074428CFA52 + 2.52144565451257326939e-05, + // 0x3F07858E90A45837 + 4.48640949618915160150e-05, +] +const lgamma_r = [ + // placeholder + 1.0, + // 0x3FF645A762C4AB74 + 1.39200533467621045958e+00, + // 0x3FE71A1893D3DCDC + 7.21935547567138069525e-01, + // 0x3FC601EDCCFBDF27 + 1.71933865632803078993e-01, + // 0x3F9317EA742ED475 + 1.86459191715652901344e-02, + // 0x3F497DDACA41A95B + 7.77942496381893596434e-04, + // 0x3EDEBAF7A5B38140 + 7.32668430744625636189e-06, +] +const lgamma_s = [ + // 0xBFB3C467E37DB0C8 + -7.72156649015328655494e-02, + // 0x3FCB848B36E20878 + 2.14982415960608852501e-01, + // 0x3FD4D98F4F139F59 + 3.25778796408930981787e-01, + // 0x3FC2BB9CBEE5F2F7 + 1.46350472652464452805e-01, + // 0x3F9B481C7E939961 + 2.66422703033638609560e-02, + // 0x3F5E26B67368F239 + 1.84028451407337715652e-03, + // 0x3F00BFECDD17E945 + 3.19475326584100867617e-05, +] +const lgamma_t = [ + // 0x3FDEF72BC8EE38A2 + 4.83836122723810047042e-01, + // 0xBFC2E4278DC6C509 + -1.47587722994593911752e-01, + // 0x3FB08B4294D5419B + 6.46249402391333854778e-02, + // 0xBFA0C9A8DF35B713 + -3.27885410759859649565e-02, + // 0x3F9266E7970AF9EC + 1.79706750811820387126e-02, + // 0xBF851F9FBA91EC6A + -1.03142241298341437450e-02, + // 0x3F78FCE0E370E344 + 6.10053870246291332635e-03, + // 0xBF6E2EFFB3E914D7 + -3.68452016781138256760e-03, + // 0x3F6282D32E15C915 + 2.25964780900612472250e-03, + // 0xBF56FE8EBF2D1AF1 + -1.40346469989232843813e-03, + // 0x3F4CDF0CEF61A8E9 + 8.81081882437654011382e-04, + // 0xBF41A6109C73E0EC + -5.38595305356740546715e-04, + // 0x3F34AF6D6C0EBBF7 + 3.15632070903625950361e-04, + // 0xBF347F24ECC38C38 + -3.12754168375120860518e-04, + // 0x3F35FD3EE8C2D3F4 + 3.35529192635519073543e-04, +] +const lgamma_u = [ + // 0xBFB3C467E37DB0C8 + -7.72156649015328655494e-02, + // 0x3FE4401E8B005DFF + 6.32827064025093366517e-01, + // 0x3FF7475CD119BD6F + 1.45492250137234768737e+00, + // 0x3FEF497644EA8450 + 9.77717527963372745603e-01, + // 0x3FCD4EAEF6010924 + 2.28963728064692451092e-01, + // 0x3F8B678BBF2BAB09 + 1.33810918536787660377e-02, +] +const lgamma_v = [ + 1.0, + // 0x4003A5D7C2BD619C + 2.45597793713041134822e+00, + // 0x40010725A42B18F5 + 2.12848976379893395361e+00, + // 0x3FE89DFBE45050AF + 7.69285150456672783825e-01, + // 0x3FBAAE55D6537C88 + 1.04222645593369134254e-01, + // 0x3F6A5ABB57D0CF61 + 3.21709242282423911810e-03, +] +const lgamma_w = [ + // 0x3FDACFE390C97D69 + 4.18938533204672725052e-01, + // 0x3FB555555555553B + 8.33333333333329678849e-02, + // 0xBF66C16C16B02E5C + -2.77777777728775536470e-03, + // 0x3F4A019F98CF38B6 + 7.93650558643019558500e-04, + // 0xBF4380CB8C0FE741 + -5.95187557450339963135e-04, + // 0x3F4B67BA4CDAD5D1 + 8.36339918996282139126e-04, + // 0xBF5AB89D0B9E43E4 + -1.63092934096575273989e-03, +] diff --git a/vlib/math/internal/machine.v b/vlib/math/internal/machine.v index e4ffb62f78..ba9e26b5ac 100644 --- a/vlib/math/internal/machine.v +++ b/vlib/math/internal/machine.v @@ -2,57 +2,55 @@ module internal // contants to do fine tuning of precision for the functions // implemented in pure V -pub const ( - f64_epsilon = 2.2204460492503131e-16 - sqrt_f64_epsilon = 1.4901161193847656e-08 - root3_f64_epsilon = 6.0554544523933429e-06 - root4_f64_epsilon = 1.2207031250000000e-04 - root5_f64_epsilon = 7.4009597974140505e-04 - root6_f64_epsilon = 2.4607833005759251e-03 - log_f64_epsilon = -3.6043653389117154e+01 - f64_min = 2.2250738585072014e-308 - sqrt_f64_min = 1.4916681462400413e-154 - root3_f64_min = 2.8126442852362996e-103 - root4_f64_min = 1.2213386697554620e-77 - root5_f64_min = 2.9476022969691763e-62 - root6_f64_min = 5.3034368905798218e-52 - log_f64_min = -7.0839641853226408e+02 - f64_max = 1.7976931348623157e+308 - sqrt_f64_max = 1.3407807929942596e+154 - root3_f64_max = 5.6438030941222897e+102 - root4_f64_max = 1.1579208923731620e+77 - root5_f64_max = 4.4765466227572707e+61 - root6_f64_max = 2.3756689782295612e+51 - log_f64_max = 7.0978271289338397e+02 - f32_epsilon = 1.1920928955078125e-07 - sqrt_f32_epsilon = 3.4526698300124393e-04 - root3_f32_epsilon = 4.9215666011518501e-03 - root4_f32_epsilon = 1.8581361171917516e-02 - root5_f32_epsilon = 4.1234622211652937e-02 - root6_f32_epsilon = 7.0153878019335827e-02 - log_f32_epsilon = -1.5942385152878742e+01 - f32_min = 1.1754943508222875e-38 - sqrt_f32_min = 1.0842021724855044e-19 - root3_f32_min = 2.2737367544323241e-13 - root4_f32_min = 3.2927225399135965e-10 - root5_f32_min = 2.5944428542140822e-08 - root6_f32_min = 4.7683715820312542e-07 - log_f32_min = -8.7336544750553102e+01 - f32_max = 3.4028234663852886e+38 - sqrt_f32_max = 1.8446743523953730e+19 - root3_f32_max = 6.9814635196223242e+12 - root4_f32_max = 4.2949672319999986e+09 - root5_f32_max = 5.0859007855960041e+07 - root6_f32_max = 2.6422459233807749e+06 - log_f32_max = 8.8722839052068352e+01 - sflt_epsilon = 4.8828125000000000e-04 - sqrt_sflt_epsilon = 2.2097086912079612e-02 - root3_sflt_epsilon = 7.8745065618429588e-02 - root4_sflt_epsilon = 1.4865088937534013e-01 - root5_sflt_epsilon = 2.1763764082403100e-01 - root6_sflt_epsilon = 2.8061551207734325e-01 - log_sflt_epsilon = -7.6246189861593985e+00 - max_int_fact_arg = 170 - max_f64_fact_arg = 171.0 - max_long_f64_fact_arg = 1755.5 -) +pub const f64_epsilon = 2.2204460492503131e-16 +pub const sqrt_f64_epsilon = 1.4901161193847656e-08 +pub const root3_f64_epsilon = 6.0554544523933429e-06 +pub const root4_f64_epsilon = 1.2207031250000000e-04 +pub const root5_f64_epsilon = 7.4009597974140505e-04 +pub const root6_f64_epsilon = 2.4607833005759251e-03 +pub const log_f64_epsilon = -3.6043653389117154e+01 +pub const f64_min = 2.2250738585072014e-308 +pub const sqrt_f64_min = 1.4916681462400413e-154 +pub const root3_f64_min = 2.8126442852362996e-103 +pub const root4_f64_min = 1.2213386697554620e-77 +pub const root5_f64_min = 2.9476022969691763e-62 +pub const root6_f64_min = 5.3034368905798218e-52 +pub const log_f64_min = -7.0839641853226408e+02 +pub const f64_max = 1.7976931348623157e+308 +pub const sqrt_f64_max = 1.3407807929942596e+154 +pub const root3_f64_max = 5.6438030941222897e+102 +pub const root4_f64_max = 1.1579208923731620e+77 +pub const root5_f64_max = 4.4765466227572707e+61 +pub const root6_f64_max = 2.3756689782295612e+51 +pub const log_f64_max = 7.0978271289338397e+02 +pub const f32_epsilon = 1.1920928955078125e-07 +pub const sqrt_f32_epsilon = 3.4526698300124393e-04 +pub const root3_f32_epsilon = 4.9215666011518501e-03 +pub const root4_f32_epsilon = 1.8581361171917516e-02 +pub const root5_f32_epsilon = 4.1234622211652937e-02 +pub const root6_f32_epsilon = 7.0153878019335827e-02 +pub const log_f32_epsilon = -1.5942385152878742e+01 +pub const f32_min = 1.1754943508222875e-38 +pub const sqrt_f32_min = 1.0842021724855044e-19 +pub const root3_f32_min = 2.2737367544323241e-13 +pub const root4_f32_min = 3.2927225399135965e-10 +pub const root5_f32_min = 2.5944428542140822e-08 +pub const root6_f32_min = 4.7683715820312542e-07 +pub const log_f32_min = -8.7336544750553102e+01 +pub const f32_max = 3.4028234663852886e+38 +pub const sqrt_f32_max = 1.8446743523953730e+19 +pub const root3_f32_max = 6.9814635196223242e+12 +pub const root4_f32_max = 4.2949672319999986e+09 +pub const root5_f32_max = 5.0859007855960041e+07 +pub const root6_f32_max = 2.6422459233807749e+06 +pub const log_f32_max = 8.8722839052068352e+01 +pub const sflt_epsilon = 4.8828125000000000e-04 +pub const sqrt_sflt_epsilon = 2.2097086912079612e-02 +pub const root3_sflt_epsilon = 7.8745065618429588e-02 +pub const root4_sflt_epsilon = 1.4865088937534013e-01 +pub const root5_sflt_epsilon = 2.1763764082403100e-01 +pub const root6_sflt_epsilon = 2.8061551207734325e-01 +pub const log_sflt_epsilon = -7.6246189861593985e+00 +pub const max_int_fact_arg = 170 +pub const max_f64_fact_arg = 171.0 +pub const max_long_f64_fact_arg = 1755.5 diff --git a/vlib/math/invtrig.v b/vlib/math/invtrig.v index 36fd9f034e..7a8b3b6f62 100644 --- a/vlib/math/invtrig.v +++ b/vlib/math/invtrig.v @@ -45,10 +45,8 @@ module math // pi/2.0 = PIO2 + morebits // tan3pio8 = tan(3*pi/8) -const ( - morebits = 6.123233995736765886130e-17 - tan3pio8 = 2.41421356237309504880 -) +const morebits = 6.123233995736765886130e-17 +const tan3pio8 = 2.41421356237309504880 // xatan evaluates a series valid in the range [0, 0.66]. @[inline] diff --git a/vlib/math/math_test.v b/vlib/math/math_test.v index fb65421989..c59dae2fbb 100644 --- a/vlib/math/math_test.v +++ b/vlib/math/math_test.v @@ -5,211 +5,185 @@ struct Fi { i int } -const ( - vf_ = [f64(4.9790119248836735e+00), 7.7388724745781045e+00, -2.7688005719200159e-01, - -5.0106036182710749e+00, 9.6362937071984173e+00, 2.9263772392439646e+00, - 5.2290834314593066e+00, 2.7279399104360102e+00, 1.8253080916808550e+00, - -8.6859247685756013e+00] - // The expected results below were computed by the high precision calculators - // at https://keisan.casio.com/. More exact input values (array vf_[], above) - // were obtained by printing them with "%.26f". The answers were calculated - // to 26 digits (by using the "Digit number" drop-down control of each - // calculator). - acos_ = [f64(1.0496193546107222142571536e+00), 6.8584012813664425171660692e-01, - 1.5984878714577160325521819e+00, 2.0956199361475859327461799e+00, - 2.7053008467824138592616927e-01, 1.2738121680361776018155625e+00, - 1.0205369421140629186287407e+00, 1.2945003481781246062157835e+00, - 1.3872364345374451433846657e+00, 2.6231510803970463967294145e+00] - acosh_ = [f64(2.4743347004159012494457618e+00), 2.8576385344292769649802701e+00, - 7.2796961502981066190593175e-01, 2.4796794418831451156471977e+00, - 3.0552020742306061857212962e+00, 2.044238592688586588942468e+00, - 2.5158701513104513595766636e+00, 1.99050839282411638174299e+00, - 1.6988625798424034227205445e+00, 2.9611454842470387925531875e+00] - asin_ = [f64(5.2117697218417440497416805e-01), 8.8495619865825236751471477e-01, - -2.769154466281941332086016e-02, -5.2482360935268931351485822e-01, - 1.3002662421166552333051524e+00, 2.9698415875871901741575922e-01, - 5.5025938468083370060258102e-01, 2.7629597861677201301553823e-01, - 1.83559892257451475846656e-01, -1.0523547536021497774980928e+00] - asinh_ = [f64(2.3083139124923523427628243e+00), 2.743551594301593620039021e+00, - -2.7345908534880091229413487e-01, -2.3145157644718338650499085e+00, - 2.9613652154015058521951083e+00, 1.7949041616585821933067568e+00, - 2.3564032905983506405561554e+00, 1.7287118790768438878045346e+00, - 1.3626658083714826013073193e+00, -2.8581483626513914445234004e+00] - atan_ = [f64(1.372590262129621651920085e+00), 1.442290609645298083020664e+00, - -2.7011324359471758245192595e-01, -1.3738077684543379452781531e+00, - 1.4673921193587666049154681e+00, 1.2415173565870168649117764e+00, - 1.3818396865615168979966498e+00, 1.2194305844639670701091426e+00, - 1.0696031952318783760193244e+00, -1.4561721938838084990898679e+00] - atanh_ = [f64(5.4651163712251938116878204e-01), 1.0299474112843111224914709e+00, - -2.7695084420740135145234906e-02, -5.5072096119207195480202529e-01, - 1.9943940993171843235906642e+00, 3.01448604578089708203017e-01, - 5.8033427206942188834370595e-01, 2.7987997499441511013958297e-01, - 1.8459947964298794318714228e-01, -1.3273186910532645867272502e+00] - atan2_ = [f64(1.1088291730037004444527075e+00), 9.1218183188715804018797795e-01, - 1.5984772603216203736068915e+00, 2.0352918654092086637227327e+00, - 8.0391819139044720267356014e-01, 1.2861075249894661588866752e+00, - 1.0889904479131695712182587e+00, 1.3044821793397925293797357e+00, - 1.3902530903455392306872261e+00, 2.2859857424479142655411058e+00] - ceil_ = [f64(5.0000000000000000e+00), 8.0000000000000000e+00, copysign(0, -1), - -5.0000000000000000e+00, 1.0000000000000000e+01, 3.0000000000000000e+00, - 6.0000000000000000e+00, 3.0000000000000000e+00, 2.0000000000000000e+00, - -8.0000000000000000e+00] - cos_ = [f64(2.634752140995199110787593e-01), 1.148551260848219865642039e-01, - 9.6191297325640768154550453e-01, 2.938141150061714816890637e-01, - -9.777138189897924126294461e-01, -9.7693041344303219127199518e-01, - 4.940088096948647263961162e-01, -9.1565869021018925545016502e-01, - -2.517729313893103197176091e-01, -7.39241351595676573201918e-01] - // Results for 100000 * pi + vf_[i] - cos_large_ = [f64(2.634752141185559426744e-01), 1.14855126055543100712e-01, - 9.61912973266488928113e-01, 2.9381411499556122552e-01, -9.777138189880161924641e-01, - -9.76930413445147608049e-01, 4.940088097314976789841e-01, -9.15658690217517835002e-01, - -2.51772931436786954751e-01, -7.3924135157173099849e-01] - cosh_ = [f64(7.2668796942212842775517446e+01), 1.1479413465659254502011135e+03, - 1.0385767908766418550935495e+00, 7.5000957789658051428857788e+01, - 7.655246669605357888468613e+03, 9.3567491758321272072888257e+00, - 9.331351599270605471131735e+01, 7.6833430994624643209296404e+00, - 3.1829371625150718153881164e+00, 2.9595059261916188501640911e+03] - exp_ = [f64(1.4533071302642137507696589e+02), 2.2958822575694449002537581e+03, - 7.5814542574851666582042306e-01, 6.6668778421791005061482264e-03, - 1.5310493273896033740861206e+04, 1.8659907517999328638667732e+01, - 1.8662167355098714543942057e+02, 1.5301332413189378961665788e+01, - 6.2047063430646876349125085e+00, 1.6894712385826521111610438e-04] - expm1_ = [f64(5.105047796122957327384770212e-02), 8.046199708567344080562675439e-02, - -2.764970978891639815187418703e-03, -4.8871434888875355394330300273e-02, - 1.0115864277221467777117227494e-01, 2.969616407795910726014621657e-02, - 5.368214487944892300914037972e-02, 2.765488851131274068067445335e-02, - 1.842068661871398836913874273e-02, -8.3193870863553801814961137573e-02] - expm1_large_ = [f64(4.2031418113550844e+21), 4.0690789717473863e+33, -0.9372627915981363e+00, - -1.0, 7.077694784145933e+41, 5.117936223839153e+12, 5.124137759001189e+22, - 7.03546003972584e+11, 8.456921800389698e+07, -1.0] - exp2_ = [f64(3.1537839463286288034313104e+01), 2.1361549283756232296144849e+02, - 8.2537402562185562902577219e-01, 3.1021158628740294833424229e-02, - 7.9581744110252191462569661e+02, 7.6019905892596359262696423e+00, - 3.7506882048388096973183084e+01, 6.6250893439173561733216375e+00, - 3.5438267900243941544605339e+00, 2.4281533133513300984289196e-03] - fabs_ = [f64(4.9790119248836735e+00), 7.7388724745781045e+00, 2.7688005719200159e-01, - 5.0106036182710749e+00, 9.6362937071984173e+00, 2.9263772392439646e+00, - 5.2290834314593066e+00, 2.7279399104360102e+00, 1.8253080916808550e+00, - 8.6859247685756013e+00] - floor_ = [f64(4.0000000000000000e+00), 7.0000000000000000e+00, -1.0000000000000000e+00, - -6.0000000000000000e+00, 9.0000000000000000e+00, 2.0000000000000000e+00, - 5.0000000000000000e+00, 2.0000000000000000e+00, 1.0000000000000000e+00, - -9.0000000000000000e+00] - fmod_ = [f64(4.197615023265299782906368e-02), 2.261127525421895434476482e+00, - 3.231794108794261433104108e-02, 4.989396381728925078391512e+00, - 3.637062928015826201999516e-01, 1.220868282268106064236690e+00, - 4.770916568540693347699744e+00, 1.816180268691969246219742e+00, - 8.734595415957246977711748e-01, 1.314075231424398637614104e+00] - frexp_ = [Fi{6.2237649061045918750e-01, 3}, Fi{9.6735905932226306250e-01, 3}, - Fi{-5.5376011438400318000e-01, -1}, Fi{-6.2632545228388436250e-01, 3}, - Fi{6.02268356699901081250e-01, 4}, Fi{7.3159430981099115000e-01, 2}, - Fi{6.5363542893241332500e-01, 3}, Fi{6.8198497760900255000e-01, 2}, - Fi{9.1265404584042750000e-01, 1}, Fi{-5.4287029803597508250e-01, 4}] - gamma_ = [f64(2.3254348370739963835386613898e+01), 2.991153837155317076427529816e+03, - -4.561154336726758060575129109e+00, 7.719403468842639065959210984e-01, - 1.6111876618855418534325755566e+05, 1.8706575145216421164173224946e+00, - 3.4082787447257502836734201635e+01, 1.579733951448952054898583387e+00, - 9.3834586598354592860187267089e-01, -2.093995902923148389186189429e-05] - log_gamma_ = [Fi{3.146492141244545774319734e+00, 1}, Fi{8.003414490659126375852113e+00, 1}, - Fi{1.517575735509779707488106e+00, -1}, Fi{-2.588480028182145853558748e-01, 1}, - Fi{1.1989897050205555002007985e+01, 1}, Fi{6.262899811091257519386906e-01, 1}, - Fi{3.5287924899091566764846037e+00, 1}, Fi{4.5725644770161182299423372e-01, 1}, - Fi{-6.363667087767961257654854e-02, 1}, Fi{-1.077385130910300066425564e+01, -1}] - log_ = [f64(1.605231462693062999102599e+00), 2.0462560018708770653153909e+00, - -1.2841708730962657801275038e+00, 1.6115563905281545116286206e+00, - 2.2655365644872016636317461e+00, 1.0737652208918379856272735e+00, - 1.6542360106073546632707956e+00, 1.0035467127723465801264487e+00, - 6.0174879014578057187016475e-01, 2.161703872847352815363655e+00] - logb_ = [f64(2.0000000000000000e+00), 2.0000000000000000e+00, -2.0000000000000000e+00, - 2.0000000000000000e+00, 3.0000000000000000e+00, 1.0000000000000000e+00, - 2.0000000000000000e+00, 1.0000000000000000e+00, 0.0000000000000000e+00, - 3.0000000000000000e+00] - log10_ = [f64(6.9714316642508290997617083e-01), 8.886776901739320576279124e-01, - -5.5770832400658929815908236e-01, 6.998900476822994346229723e-01, - 9.8391002850684232013281033e-01, 4.6633031029295153334285302e-01, - 7.1842557117242328821552533e-01, 4.3583479968917773161304553e-01, - 2.6133617905227038228626834e-01, 9.3881606348649405716214241e-01] - log1p_ = [f64(4.8590257759797794104158205e-02), 7.4540265965225865330849141e-02, - -2.7726407903942672823234024e-03, -5.1404917651627649094953380e-02, - 9.1998280672258624681335010e-02, 2.8843762576593352865894824e-02, - 5.0969534581863707268992645e-02, 2.6913947602193238458458594e-02, - 1.8088493239630770262045333e-02, -9.0865245631588989681559268e-02] - log2_ = [f64(2.3158594707062190618898251e+00), 2.9521233862883917703341018e+00, - -1.8526669502700329984917062e+00, 2.3249844127278861543568029e+00, - 3.268478366538305087466309e+00, 1.5491157592596970278166492e+00, - 2.3865580889631732407886495e+00, 1.447811865817085365540347e+00, - 8.6813999540425116282815557e-01, 3.118679457227342224364709e+00] - modf_ = [[f64(4.0000000000000000e+00), 9.7901192488367350108546816e-01], - [f64(7.0000000000000000e+00), 7.3887247457810456552351752e-01], - [f64(-0.0), -2.7688005719200159404635997e-01], - [f64(-5.0000000000000000e+00), - -1.060361827107492160848778e-02], - [f64(9.0000000000000000e+00), 6.3629370719841737980004837e-01], - [f64(2.0000000000000000e+00), 9.2637723924396464525443662e-01], - [f64(5.0000000000000000e+00), 2.2908343145930665230025625e-01], - [f64(2.0000000000000000e+00), 7.2793991043601025126008608e-01], - [f64(1.0000000000000000e+00), 8.2530809168085506044576505e-01], - [f64(-8.0000000000000000e+00), -6.8592476857560136238589621e-01]] - nextafter32_ = [4.979012489318848e+00, 7.738873004913330e+00, -2.768800258636475e-01, - -5.010602951049805e+00, 9.636294364929199e+00, 2.926377534866333e+00, 5.229084014892578e+00, - 2.727940082550049e+00, 1.825308203697205e+00, -8.685923576354980e+00] - nextafter64_ = [f64(4.97901192488367438926388786e+00), 7.73887247457810545370193722e+00, - -2.7688005719200153853520874e-01, -5.01060361827107403343006808e+00, - 9.63629370719841915615688777e+00, 2.92637723924396508934364647e+00, - 5.22908343145930754047867595e+00, 2.72793991043601069534929593e+00, - 1.82530809168085528249036997e+00, -8.68592476857559958602905681e+00] - pow_ = [f64(9.5282232631648411840742957e+04), 5.4811599352999901232411871e+07, - 5.2859121715894396531132279e-01, 9.7587991957286474464259698e-06, - 4.328064329346044846740467e+09, 8.4406761805034547437659092e+02, - 1.6946633276191194947742146e+05, 5.3449040147551939075312879e+02, - 6.688182138451414936380374e+01, 2.0609869004248742886827439e-09] - remainder_ = [f64(4.197615023265299782906368e-02), 2.261127525421895434476482e+00, - 3.231794108794261433104108e-02, -2.120723654214984321697556e-02, - 3.637062928015826201999516e-01, 1.220868282268106064236690e+00, - -4.581668629186133046005125e-01, -9.117596417440410050403443e-01, - 8.734595415957246977711748e-01, 1.314075231424398637614104e+00] - round_ = [f64(5), 8, copysign(0, -1), -5, 10, 3, 5, 3, 2, -9] - signbit_ = [false, false, true, true, false, false, false, false, false, true] - sin_ = [f64(-9.6466616586009283766724726e-01), 9.9338225271646545763467022e-01, - -2.7335587039794393342449301e-01, 9.5586257685042792878173752e-01, - -2.099421066779969164496634e-01, 2.135578780799860532750616e-01, - -8.694568971167362743327708e-01, 4.019566681155577786649878e-01, - 9.6778633541687993721617774e-01, -6.734405869050344734943028e-01] - // Results for 100000 * pi + vf_[i] - sin_large_ = [f64(-9.646661658548936063912e-01), 9.933822527198506903752e-01, - -2.7335587036246899796e-01, 9.55862576853689321268e-01, -2.099421066862688873691e-01, - 2.13557878070308981163e-01, -8.694568970959221300497e-01, 4.01956668098863248917e-01, - 9.67786335404528727927e-01, -6.7344058693131973066e-01] - sinh_ = [f64(7.2661916084208532301448439e+01), 1.1479409110035194500526446e+03, - -2.8043136512812518927312641e-01, -7.499429091181587232835164e+01, - 7.6552466042906758523925934e+03, 9.3031583421672014313789064e+00, - 9.330815755828109072810322e+01, 7.6179893137269146407361477e+00, - 3.021769180549615819524392e+00, -2.95950575724449499189888e+03] - sqrt_ = [f64(2.2313699659365484748756904e+00), 2.7818829009464263511285458e+00, - 5.2619393496314796848143251e-01, 2.2384377628763938724244104e+00, - 3.1042380236055381099288487e+00, 1.7106657298385224403917771e+00, - 2.286718922705479046148059e+00, 1.6516476350711159636222979e+00, - 1.3510396336454586262419247e+00, 2.9471892997524949215723329e+00] - tan_ = [f64(-3.661316565040227801781974e+00), 8.64900232648597589369854e+00, - -2.8417941955033612725238097e-01, 3.253290185974728640827156e+00, - 2.147275640380293804770778e-01, -2.18600910711067004921551e-01, - -1.760002817872367935518928e+00, -4.389808914752818126249079e-01, - -3.843885560201130679995041e+00, 9.10988793377685105753416e-01] - // Results for 100000 * pi + vf_[i] - tan_large_ = [f64(-3.66131656475596512705e+00), 8.6490023287202547927e+00, - -2.841794195104782406e-01, 3.2532901861033120983e+00, 2.14727564046880001365e-01, - -2.18600910700688062874e-01, -1.760002817699722747043e+00, -4.38980891453536115952e-01, - -3.84388555942723509071e+00, 9.1098879344275101051e-01] - tanh_ = [f64(9.9990531206936338549262119e-01), 9.9999962057085294197613294e-01, - -2.7001505097318677233756845e-01, -9.9991110943061718603541401e-01, - 9.9999999146798465745022007e-01, 9.9427249436125236705001048e-01, - 9.9994257600983138572705076e-01, 9.9149409509772875982054701e-01, - 9.4936501296239685514466577e-01, -9.9999994291374030946055701e-01] - trunc_ = [f64(4.0000000000000000e+00), 7.0000000000000000e+00, copysign(0, -1), - -5.0000000000000000e+00, 9.0000000000000000e+00, 2.0000000000000000e+00, - 5.0000000000000000e+00, 2.0000000000000000e+00, 1.0000000000000000e+00, - -8.0000000000000000e+00] -) +const vf_ = [f64(4.9790119248836735e+00), 7.7388724745781045e+00, -2.7688005719200159e-01, + -5.0106036182710749e+00, 9.6362937071984173e+00, 2.9263772392439646e+00, 5.2290834314593066e+00, + 2.7279399104360102e+00, 1.8253080916808550e+00, -8.6859247685756013e+00] +// The expected results below were computed by the high precision calculators +// at https://keisan.casio.com/. More exact input values (array vf_[], above) +// were obtained by printing them with "%.26f". The answers were calculated +// to 26 digits (by using the "Digit number" drop-down control of each +// calculator). +const acos_ = [f64(1.0496193546107222142571536e+00), 6.8584012813664425171660692e-01, + 1.5984878714577160325521819e+00, 2.0956199361475859327461799e+00, 2.7053008467824138592616927e-01, + 1.2738121680361776018155625e+00, 1.0205369421140629186287407e+00, 1.2945003481781246062157835e+00, + 1.3872364345374451433846657e+00, 2.6231510803970463967294145e+00] +const acosh_ = [f64(2.4743347004159012494457618e+00), 2.8576385344292769649802701e+00, + 7.2796961502981066190593175e-01, 2.4796794418831451156471977e+00, 3.0552020742306061857212962e+00, + 2.044238592688586588942468e+00, 2.5158701513104513595766636e+00, 1.99050839282411638174299e+00, + 1.6988625798424034227205445e+00, 2.9611454842470387925531875e+00] +const asin_ = [f64(5.2117697218417440497416805e-01), 8.8495619865825236751471477e-01, + -2.769154466281941332086016e-02, -5.2482360935268931351485822e-01, + 1.3002662421166552333051524e+00, 2.9698415875871901741575922e-01, 5.5025938468083370060258102e-01, + 2.7629597861677201301553823e-01, 1.83559892257451475846656e-01, -1.0523547536021497774980928e+00] +const asinh_ = [f64(2.3083139124923523427628243e+00), 2.743551594301593620039021e+00, + -2.7345908534880091229413487e-01, -2.3145157644718338650499085e+00, + 2.9613652154015058521951083e+00, 1.7949041616585821933067568e+00, 2.3564032905983506405561554e+00, + 1.7287118790768438878045346e+00, 1.3626658083714826013073193e+00, + -2.8581483626513914445234004e+00] +const atan_ = [f64(1.372590262129621651920085e+00), 1.442290609645298083020664e+00, + -2.7011324359471758245192595e-01, -1.3738077684543379452781531e+00, + 1.4673921193587666049154681e+00, 1.2415173565870168649117764e+00, 1.3818396865615168979966498e+00, + 1.2194305844639670701091426e+00, 1.0696031952318783760193244e+00, + -1.4561721938838084990898679e+00] +const atanh_ = [f64(5.4651163712251938116878204e-01), 1.0299474112843111224914709e+00, + -2.7695084420740135145234906e-02, -5.5072096119207195480202529e-01, + 1.9943940993171843235906642e+00, 3.01448604578089708203017e-01, 5.8033427206942188834370595e-01, + 2.7987997499441511013958297e-01, 1.8459947964298794318714228e-01, + -1.3273186910532645867272502e+00] +const atan2_ = [f64(1.1088291730037004444527075e+00), 9.1218183188715804018797795e-01, + 1.5984772603216203736068915e+00, 2.0352918654092086637227327e+00, 8.0391819139044720267356014e-01, + 1.2861075249894661588866752e+00, 1.0889904479131695712182587e+00, 1.3044821793397925293797357e+00, + 1.3902530903455392306872261e+00, 2.2859857424479142655411058e+00] +const ceil_ = [f64(5.0000000000000000e+00), 8.0000000000000000e+00, copysign(0, -1), + -5.0000000000000000e+00, 1.0000000000000000e+01, 3.0000000000000000e+00, 6.0000000000000000e+00, + 3.0000000000000000e+00, 2.0000000000000000e+00, -8.0000000000000000e+00] +const cos_ = [f64(2.634752140995199110787593e-01), 1.148551260848219865642039e-01, + 9.6191297325640768154550453e-01, 2.938141150061714816890637e-01, -9.777138189897924126294461e-01, + -9.7693041344303219127199518e-01, 4.940088096948647263961162e-01, + -9.1565869021018925545016502e-01, -2.517729313893103197176091e-01, -7.39241351595676573201918e-01] +// Results for 100000 * pi + vf_[i] +const cos_large_ = [f64(2.634752141185559426744e-01), 1.14855126055543100712e-01, + 9.61912973266488928113e-01, 2.9381411499556122552e-01, -9.777138189880161924641e-01, + -9.76930413445147608049e-01, 4.940088097314976789841e-01, -9.15658690217517835002e-01, + -2.51772931436786954751e-01, -7.3924135157173099849e-01] +const cosh_ = [f64(7.2668796942212842775517446e+01), 1.1479413465659254502011135e+03, + 1.0385767908766418550935495e+00, 7.5000957789658051428857788e+01, 7.655246669605357888468613e+03, + 9.3567491758321272072888257e+00, 9.331351599270605471131735e+01, 7.6833430994624643209296404e+00, + 3.1829371625150718153881164e+00, 2.9595059261916188501640911e+03] +const exp_ = [f64(1.4533071302642137507696589e+02), 2.2958822575694449002537581e+03, + 7.5814542574851666582042306e-01, 6.6668778421791005061482264e-03, 1.5310493273896033740861206e+04, + 1.8659907517999328638667732e+01, 1.8662167355098714543942057e+02, 1.5301332413189378961665788e+01, + 6.2047063430646876349125085e+00, 1.6894712385826521111610438e-04] +const expm1_ = [f64(5.105047796122957327384770212e-02), 8.046199708567344080562675439e-02, + -2.764970978891639815187418703e-03, -4.8871434888875355394330300273e-02, + 1.0115864277221467777117227494e-01, 2.969616407795910726014621657e-02, + 5.368214487944892300914037972e-02, 2.765488851131274068067445335e-02, + 1.842068661871398836913874273e-02, -8.3193870863553801814961137573e-02] +const expm1_large_ = [f64(4.2031418113550844e+21), 4.0690789717473863e+33, -0.9372627915981363e+00, + -1.0, 7.077694784145933e+41, 5.117936223839153e+12, 5.124137759001189e+22, 7.03546003972584e+11, + 8.456921800389698e+07, -1.0] +const exp2_ = [f64(3.1537839463286288034313104e+01), 2.1361549283756232296144849e+02, + 8.2537402562185562902577219e-01, 3.1021158628740294833424229e-02, 7.9581744110252191462569661e+02, + 7.6019905892596359262696423e+00, 3.7506882048388096973183084e+01, 6.6250893439173561733216375e+00, + 3.5438267900243941544605339e+00, 2.4281533133513300984289196e-03] +const fabs_ = [f64(4.9790119248836735e+00), 7.7388724745781045e+00, 2.7688005719200159e-01, + 5.0106036182710749e+00, 9.6362937071984173e+00, 2.9263772392439646e+00, 5.2290834314593066e+00, + 2.7279399104360102e+00, 1.8253080916808550e+00, 8.6859247685756013e+00] +const floor_ = [f64(4.0000000000000000e+00), 7.0000000000000000e+00, -1.0000000000000000e+00, + -6.0000000000000000e+00, 9.0000000000000000e+00, 2.0000000000000000e+00, 5.0000000000000000e+00, + 2.0000000000000000e+00, 1.0000000000000000e+00, -9.0000000000000000e+00] +const fmod_ = [f64(4.197615023265299782906368e-02), 2.261127525421895434476482e+00, + 3.231794108794261433104108e-02, 4.989396381728925078391512e+00, 3.637062928015826201999516e-01, + 1.220868282268106064236690e+00, 4.770916568540693347699744e+00, 1.816180268691969246219742e+00, + 8.734595415957246977711748e-01, 1.314075231424398637614104e+00] +const frexp_ = [Fi{6.2237649061045918750e-01, 3}, Fi{9.6735905932226306250e-01, 3}, + Fi{-5.5376011438400318000e-01, -1}, Fi{-6.2632545228388436250e-01, 3}, + Fi{6.02268356699901081250e-01, 4}, Fi{7.3159430981099115000e-01, 2}, + Fi{6.5363542893241332500e-01, 3}, Fi{6.8198497760900255000e-01, 2}, + Fi{9.1265404584042750000e-01, 1}, Fi{-5.4287029803597508250e-01, 4}] +const gamma_ = [f64(2.3254348370739963835386613898e+01), 2.991153837155317076427529816e+03, + -4.561154336726758060575129109e+00, 7.719403468842639065959210984e-01, + 1.6111876618855418534325755566e+05, 1.8706575145216421164173224946e+00, + 3.4082787447257502836734201635e+01, 1.579733951448952054898583387e+00, + 9.3834586598354592860187267089e-01, -2.093995902923148389186189429e-05] +const log_gamma_ = [Fi{3.146492141244545774319734e+00, 1}, Fi{8.003414490659126375852113e+00, 1}, + Fi{1.517575735509779707488106e+00, -1}, Fi{-2.588480028182145853558748e-01, 1}, + Fi{1.1989897050205555002007985e+01, 1}, Fi{6.262899811091257519386906e-01, 1}, + Fi{3.5287924899091566764846037e+00, 1}, Fi{4.5725644770161182299423372e-01, 1}, + Fi{-6.363667087767961257654854e-02, 1}, Fi{-1.077385130910300066425564e+01, -1}] +const log_ = [f64(1.605231462693062999102599e+00), 2.0462560018708770653153909e+00, + -1.2841708730962657801275038e+00, 1.6115563905281545116286206e+00, + 2.2655365644872016636317461e+00, 1.0737652208918379856272735e+00, 1.6542360106073546632707956e+00, + 1.0035467127723465801264487e+00, 6.0174879014578057187016475e-01, 2.161703872847352815363655e+00] +const logb_ = [f64(2.0000000000000000e+00), 2.0000000000000000e+00, -2.0000000000000000e+00, + 2.0000000000000000e+00, 3.0000000000000000e+00, 1.0000000000000000e+00, 2.0000000000000000e+00, + 1.0000000000000000e+00, 0.0000000000000000e+00, 3.0000000000000000e+00] +const log10_ = [f64(6.9714316642508290997617083e-01), 8.886776901739320576279124e-01, + -5.5770832400658929815908236e-01, 6.998900476822994346229723e-01, 9.8391002850684232013281033e-01, + 4.6633031029295153334285302e-01, 7.1842557117242328821552533e-01, 4.3583479968917773161304553e-01, + 2.6133617905227038228626834e-01, 9.3881606348649405716214241e-01] +const log1p_ = [f64(4.8590257759797794104158205e-02), 7.4540265965225865330849141e-02, + -2.7726407903942672823234024e-03, -5.1404917651627649094953380e-02, + 9.1998280672258624681335010e-02, 2.8843762576593352865894824e-02, 5.0969534581863707268992645e-02, + 2.6913947602193238458458594e-02, 1.8088493239630770262045333e-02, + -9.0865245631588989681559268e-02] +const log2_ = [f64(2.3158594707062190618898251e+00), 2.9521233862883917703341018e+00, + -1.8526669502700329984917062e+00, 2.3249844127278861543568029e+00, 3.268478366538305087466309e+00, + 1.5491157592596970278166492e+00, 2.3865580889631732407886495e+00, 1.447811865817085365540347e+00, + 8.6813999540425116282815557e-01, 3.118679457227342224364709e+00] +const modf_ = [[f64(4.0000000000000000e+00), 9.7901192488367350108546816e-01], + [f64(7.0000000000000000e+00), 7.3887247457810456552351752e-01], + [f64(-0.0), -2.7688005719200159404635997e-01], + [f64(-5.0000000000000000e+00), + -1.060361827107492160848778e-02], + [f64(9.0000000000000000e+00), 6.3629370719841737980004837e-01], + [f64(2.0000000000000000e+00), 9.2637723924396464525443662e-01], + [f64(5.0000000000000000e+00), 2.2908343145930665230025625e-01], + [f64(2.0000000000000000e+00), 7.2793991043601025126008608e-01], + [f64(1.0000000000000000e+00), 8.2530809168085506044576505e-01], + [f64(-8.0000000000000000e+00), -6.8592476857560136238589621e-01]] +const nextafter32_ = [4.979012489318848e+00, 7.738873004913330e+00, -2.768800258636475e-01, + -5.010602951049805e+00, 9.636294364929199e+00, 2.926377534866333e+00, 5.229084014892578e+00, + 2.727940082550049e+00, 1.825308203697205e+00, -8.685923576354980e+00] +const nextafter64_ = [f64(4.97901192488367438926388786e+00), 7.73887247457810545370193722e+00, + -2.7688005719200153853520874e-01, -5.01060361827107403343006808e+00, + 9.63629370719841915615688777e+00, 2.92637723924396508934364647e+00, + 5.22908343145930754047867595e+00, 2.72793991043601069534929593e+00, + 1.82530809168085528249036997e+00, -8.68592476857559958602905681e+00] +const pow_ = [f64(9.5282232631648411840742957e+04), 5.4811599352999901232411871e+07, + 5.2859121715894396531132279e-01, 9.7587991957286474464259698e-06, 4.328064329346044846740467e+09, + 8.4406761805034547437659092e+02, 1.6946633276191194947742146e+05, 5.3449040147551939075312879e+02, + 6.688182138451414936380374e+01, 2.0609869004248742886827439e-09] +const remainder_ = [f64(4.197615023265299782906368e-02), 2.261127525421895434476482e+00, + 3.231794108794261433104108e-02, -2.120723654214984321697556e-02, 3.637062928015826201999516e-01, + 1.220868282268106064236690e+00, -4.581668629186133046005125e-01, -9.117596417440410050403443e-01, + 8.734595415957246977711748e-01, 1.314075231424398637614104e+00] +const round_ = [f64(5), 8, copysign(0, -1), -5, 10, 3, 5, 3, 2, -9] +const signbit_ = [false, false, true, true, false, false, false, false, false, true] +const sin_ = [f64(-9.6466616586009283766724726e-01), 9.9338225271646545763467022e-01, + -2.7335587039794393342449301e-01, 9.5586257685042792878173752e-01, + -2.099421066779969164496634e-01, 2.135578780799860532750616e-01, -8.694568971167362743327708e-01, + 4.019566681155577786649878e-01, 9.6778633541687993721617774e-01, -6.734405869050344734943028e-01] +// Results for 100000 * pi + vf_[i] +const sin_large_ = [f64(-9.646661658548936063912e-01), 9.933822527198506903752e-01, + -2.7335587036246899796e-01, 9.55862576853689321268e-01, -2.099421066862688873691e-01, + 2.13557878070308981163e-01, -8.694568970959221300497e-01, 4.01956668098863248917e-01, + 9.67786335404528727927e-01, -6.7344058693131973066e-01] +const sinh_ = [f64(7.2661916084208532301448439e+01), 1.1479409110035194500526446e+03, + -2.8043136512812518927312641e-01, -7.499429091181587232835164e+01, + 7.6552466042906758523925934e+03, 9.3031583421672014313789064e+00, 9.330815755828109072810322e+01, + 7.6179893137269146407361477e+00, 3.021769180549615819524392e+00, -2.95950575724449499189888e+03] +const sqrt_ = [f64(2.2313699659365484748756904e+00), 2.7818829009464263511285458e+00, + 5.2619393496314796848143251e-01, 2.2384377628763938724244104e+00, 3.1042380236055381099288487e+00, + 1.7106657298385224403917771e+00, 2.286718922705479046148059e+00, 1.6516476350711159636222979e+00, + 1.3510396336454586262419247e+00, 2.9471892997524949215723329e+00] +const tan_ = [f64(-3.661316565040227801781974e+00), 8.64900232648597589369854e+00, + -2.8417941955033612725238097e-01, 3.253290185974728640827156e+00, 2.147275640380293804770778e-01, + -2.18600910711067004921551e-01, -1.760002817872367935518928e+00, -4.389808914752818126249079e-01, + -3.843885560201130679995041e+00, 9.10988793377685105753416e-01] +// Results for 100000 * pi + vf_[i] +const tan_large_ = [f64(-3.66131656475596512705e+00), 8.6490023287202547927e+00, + -2.841794195104782406e-01, 3.2532901861033120983e+00, 2.14727564046880001365e-01, + -2.18600910700688062874e-01, -1.760002817699722747043e+00, -4.38980891453536115952e-01, + -3.84388555942723509071e+00, 9.1098879344275101051e-01] +const tanh_ = [f64(9.9990531206936338549262119e-01), 9.9999962057085294197613294e-01, + -2.7001505097318677233756845e-01, -9.9991110943061718603541401e-01, + 9.9999999146798465745022007e-01, 9.9427249436125236705001048e-01, 9.9994257600983138572705076e-01, + 9.9149409509772875982054701e-01, 9.4936501296239685514466577e-01, + -9.9999994291374030946055701e-01] +const trunc_ = [f64(4.0000000000000000e+00), 7.0000000000000000e+00, copysign(0, -1), + -5.0000000000000000e+00, 9.0000000000000000e+00, 2.0000000000000000e+00, 5.0000000000000000e+00, + 2.0000000000000000e+00, 1.0000000000000000e+00, -8.0000000000000000e+00] fn soclose(a f64, b f64, e_ f64) bool { return tolerance(a, b, e_) diff --git a/vlib/math/modf.v b/vlib/math/modf.v index bac08bf0de..5421c5fb55 100644 --- a/vlib/math/modf.v +++ b/vlib/math/modf.v @@ -1,8 +1,6 @@ module math -const ( - modf_maxpowtwo = 4.503599627370496000e+15 -) +const modf_maxpowtwo = 4.503599627370496000e+15 // modf returns integer and fractional floating-point numbers // that sum to f. Both values have the same sign as f. diff --git a/vlib/math/pow.v b/vlib/math/pow.v index 2d99b95fb2..0930212150 100644 --- a/vlib/math/pow.v +++ b/vlib/math/pow.v @@ -1,13 +1,12 @@ module math -const ( - pow10tab = [f64(1e+00), 1e+01, 1e+02, 1e+03, 1e+04, 1e+05, 1e+06, 1e+07, 1e+08, 1e+09, - 1e+10, 1e+11, 1e+12, 1e+13, 1e+14, 1e+15, 1e+16, 1e+17, 1e+18, 1e+19, 1e+20, 1e+21, 1e+22, - 1e+23, 1e+24, 1e+25, 1e+26, 1e+27, 1e+28, 1e+29, 1e+30, 1e+31] - pow10postab32 = [f64(1e+00), 1e+32, 1e+64, 1e+96, 1e+128, 1e+160, 1e+192, 1e+224, 1e+256, 1e+288] - pow10negtab32 = [f64(1e-00), 1e-32, 1e-64, 1e-96, 1e-128, 1e-160, 1e-192, 1e-224, 1e-256, 1e-288, - 1e-320] -) +const pow10tab = [f64(1e+00), 1e+01, 1e+02, 1e+03, 1e+04, 1e+05, 1e+06, 1e+07, 1e+08, 1e+09, 1e+10, + 1e+11, 1e+12, 1e+13, 1e+14, 1e+15, 1e+16, 1e+17, 1e+18, 1e+19, 1e+20, 1e+21, 1e+22, 1e+23, + 1e+24, 1e+25, 1e+26, 1e+27, 1e+28, 1e+29, 1e+30, 1e+31] +const pow10postab32 = [f64(1e+00), 1e+32, 1e+64, 1e+96, 1e+128, 1e+160, 1e+192, 1e+224, 1e+256, + 1e+288] +const pow10negtab32 = [f64(1e-00), 1e-32, 1e-64, 1e-96, 1e-128, 1e-160, 1e-192, 1e-224, 1e-256, + 1e-288, 1e-320] // powf returns base raised to the provided power. (float32) @[inline] diff --git a/vlib/math/sin.v b/vlib/math/sin.v index d86924924f..698a12a1e1 100644 --- a/vlib/math/sin.v +++ b/vlib/math/sin.v @@ -2,47 +2,45 @@ module math import math.internal -const ( - sin_data = [ - -0.3295190160663511504173, - 0.0025374284671667991990, - 0.0006261928782647355874, - -4.6495547521854042157541e-06, - -5.6917531549379706526677e-07, - 3.7283335140973803627866e-09, - 3.0267376484747473727186e-10, - -1.7400875016436622322022e-12, - -1.0554678305790849834462e-13, - 5.3701981409132410797062e-16, - 2.5984137983099020336115e-17, - -1.1821555255364833468288e-19, - ] - sin_cs = ChebSeries{ - c: sin_data - order: 11 - a: -1 - b: 1 - } - cos_data = [ - 0.165391825637921473505668118136, - -0.00084852883845000173671196530195, - -0.000210086507222940730213625768083, - 1.16582269619760204299639757584e-6, - 1.43319375856259870334412701165e-7, - -7.4770883429007141617951330184e-10, - -6.0969994944584252706997438007e-11, - 2.90748249201909353949854872638e-13, - 1.77126739876261435667156490461e-14, - -7.6896421502815579078577263149e-17, - -3.7363121133079412079201377318e-18, - ] - cos_cs = ChebSeries{ - c: cos_data - order: 10 - a: -1 - b: 1 - } -) +const sin_data = [ + -0.3295190160663511504173, + 0.0025374284671667991990, + 0.0006261928782647355874, + -4.6495547521854042157541e-06, + -5.6917531549379706526677e-07, + 3.7283335140973803627866e-09, + 3.0267376484747473727186e-10, + -1.7400875016436622322022e-12, + -1.0554678305790849834462e-13, + 5.3701981409132410797062e-16, + 2.5984137983099020336115e-17, + -1.1821555255364833468288e-19, +] +const sin_cs = ChebSeries{ + c: sin_data + order: 11 + a: -1 + b: 1 +} +const cos_data = [ + 0.165391825637921473505668118136, + -0.00084852883845000173671196530195, + -0.000210086507222940730213625768083, + 1.16582269619760204299639757584e-6, + 1.43319375856259870334412701165e-7, + -7.4770883429007141617951330184e-10, + -6.0969994944584252706997438007e-11, + 2.90748249201909353949854872638e-13, + 1.77126739876261435667156490461e-14, + -7.6896421502815579078577263149e-17, + -3.7363121133079412079201377318e-18, +] +const cos_cs = ChebSeries{ + c: cos_data + order: 10 + a: -1 + b: 1 +} // sin calculates the sine of the angle in radians pub fn sin(x f64) f64 { diff --git a/vlib/math/tan.v b/vlib/math/tan.v index f18556389b..f1ba3b15e4 100644 --- a/vlib/math/tan.v +++ b/vlib/math/tan.v @@ -1,23 +1,21 @@ module math -const ( - tan_p = [ - -1.30936939181383777646e+4, - 1.15351664838587416140e+6, - -1.79565251976484877988e+7, - ] - tan_q = [ - 1.00000000000000000000e+0, - 1.36812963470692954678e+4, - -1.32089234440210967447e+6, - 2.50083801823357915839e+7, - -5.38695755929454629881e+7, - ] - tan_dp1 = 7.853981554508209228515625e-1 - tan_dp2 = 7.94662735614792836714e-9 - tan_dp3 = 3.06161699786838294307e-17 - tan_lossth = 1.073741824e+9 -) +const tan_p = [ + -1.30936939181383777646e+4, + 1.15351664838587416140e+6, + -1.79565251976484877988e+7, +] +const tan_q = [ + 1.00000000000000000000e+0, + 1.36812963470692954678e+4, + -1.32089234440210967447e+6, + 2.50083801823357915839e+7, + -5.38695755929454629881e+7, +] +const tan_dp1 = 7.853981554508209228515625e-1 +const tan_dp2 = 7.94662735614792836714e-9 +const tan_dp3 = 3.06161699786838294307e-17 +const tan_lossth = 1.073741824e+9 // tan calculates tangent of a number pub fn tan(a f64) f64 { diff --git a/vlib/math/tanh.v b/vlib/math/tanh.v index ac9590e822..26dd790a15 100644 --- a/vlib/math/tanh.v +++ b/vlib/math/tanh.v @@ -1,17 +1,15 @@ module math -const ( - tanh_p = [ - -9.64399179425052238628e-1, - -9.92877231001918586564e+1, - -1.61468768441708447952e+3, - ] - tanh_q = [ - 1.12811678491632931402e+2, - 2.23548839060100448583e+3, - 4.84406305325125486048e+3, - ] -) +const tanh_p = [ + -9.64399179425052238628e-1, + -9.92877231001918586564e+1, + -1.61468768441708447952e+3, +] +const tanh_q = [ + 1.12811678491632931402e+2, + 2.23548839060100448583e+3, + 4.84406305325125486048e+3, +] // tanh returns the hyperbolic tangent of x. // diff --git a/vlib/math/unsigned/uint128.v b/vlib/math/unsigned/uint128.v index ff36c66128..a22c0d5100 100644 --- a/vlib/math/unsigned/uint128.v +++ b/vlib/math/unsigned/uint128.v @@ -9,10 +9,8 @@ pub mut: hi u64 } -pub const ( - uint128_zero = Uint128{} - uint128_max = Uint128{18446744073709551615, 18446744073709551615} -) +pub const uint128_zero = Uint128{} +pub const uint128_max = Uint128{18446744073709551615, 18446744073709551615} // is_zero returns true if u == 0 pub fn (u Uint128) is_zero() bool { diff --git a/vlib/math/unsigned/uint256.v b/vlib/math/unsigned/uint256.v index 765e28d63e..7a5782419d 100644 --- a/vlib/math/unsigned/uint256.v +++ b/vlib/math/unsigned/uint256.v @@ -2,10 +2,8 @@ module unsigned import math.bits -pub const ( - uint256_zero = Uint256{Uint128{}, Uint128{}} - uint256_max = Uint256{uint128_max, uint128_max} -) +pub const uint256_zero = Uint256{Uint128{}, Uint128{}} +pub const uint256_max = Uint256{uint128_max, uint128_max} // Uint256 is an unsigned 256-bit number pub struct Uint256 { diff --git a/vlib/net/address.c.v b/vlib/net/address.c.v index 466b0bfe9b..3f8c5cf600 100644 --- a/vlib/net/address.c.v +++ b/vlib/net/address.c.v @@ -10,10 +10,8 @@ union AddrData { Ip6 } -const ( - addr_ip6_any = [16]u8{init: u8(0)} - addr_ip_any = [4]u8{init: u8(0)} -) +const addr_ip6_any = [16]u8{init: u8(0)} +const addr_ip_any = [4]u8{init: u8(0)} // new_ip6 creates a new Addr from the IP6 address family, based on the given port and addr pub fn new_ip6(port u16, addr [16]u8) Addr { @@ -62,10 +60,8 @@ pub fn (a Addr) family() AddrFamily { return unsafe { AddrFamily(a.f) } } -const ( - max_ip_len = 24 - max_ip6_len = 46 -) +const max_ip_len = 24 +const max_ip6_len = 46 // str returns a string representation of `a` pub fn (a Ip) str() string { diff --git a/vlib/net/errors.c.v b/vlib/net/errors.c.v index 8f5723a74a..73e98c4204 100644 --- a/vlib/net/errors.c.v +++ b/vlib/net/errors.c.v @@ -1,22 +1,20 @@ module net // Well defined errors that are returned from socket functions -pub const ( - errors_base = 0 - err_new_socket_failed = error_with_code('net: new_socket failed to create socket', - errors_base + 1) - err_option_not_settable = error_with_code('net: set_option_xxx option not settable', - errors_base + 2) - err_option_wrong_type = error_with_code('net: set_option_xxx option wrong type', - errors_base + 3) - err_port_out_of_range = error_with_code('net: port out of range', errors_base + 5) - err_no_udp_remote = error_with_code('net: no udp remote', errors_base + 6) - err_connect_failed = error_with_code('net: connect failed', errors_base + 7) - err_connect_timed_out = error_with_code('net: connect timed out', errors_base + 8) - err_timed_out = error_with_code('net: op timed out', errors_base + 9) - err_timed_out_code = errors_base + 9 - err_connection_refused = error_with_code('net: connection refused', errors_base + 10) -) +pub const errors_base = 0 +pub const err_new_socket_failed = error_with_code('net: new_socket failed to create socket', + errors_base + 1) +pub const err_option_not_settable = error_with_code('net: set_option_xxx option not settable', + errors_base + 2) +pub const err_option_wrong_type = error_with_code('net: set_option_xxx option wrong type', + errors_base + 3) +pub const err_port_out_of_range = error_with_code('net: port out of range', errors_base + 5) +pub const err_no_udp_remote = error_with_code('net: no udp remote', errors_base + 6) +pub const err_connect_failed = error_with_code('net: connect failed', errors_base + 7) +pub const err_connect_timed_out = error_with_code('net: connect timed out', errors_base + 8) +pub const err_timed_out = error_with_code('net: op timed out', errors_base + 9) +pub const err_timed_out_code = errors_base + 9 +pub const err_connection_refused = error_with_code('net: connection refused', errors_base + 10) pub fn socket_error_message(potential_code int, s string) !int { return socket_error(potential_code) or { return error('${err.msg()}; ${s}') } diff --git a/vlib/net/ftp/ftp.v b/vlib/net/ftp/ftp.v index c6ba89e96a..023023450f 100644 --- a/vlib/net/ftp/ftp.v +++ b/vlib/net/ftp/ftp.v @@ -20,19 +20,17 @@ basic ftp module import net import io -const ( - connected = 220 - specify_password = 331 - logged_in = 230 - login_first = 503 - anonymous = 530 - open_data_connection = 150 - close_data_connection = 226 - command_ok = 200 - denied = 550 - passive_mode = 227 - complete = 226 -) +const connected = 220 +const specify_password = 331 +const logged_in = 230 +const login_first = 503 +const anonymous = 530 +const open_data_connection = 150 +const close_data_connection = 226 +const command_ok = 200 +const denied = 550 +const passive_mode = 227 +const complete = 226 struct DTP { mut: diff --git a/vlib/net/html/data_structures.v b/vlib/net/html/data_structures.v index cb4fb6e5c7..fb7a9657d0 100644 --- a/vlib/net/html/data_structures.v +++ b/vlib/net/html/data_structures.v @@ -1,8 +1,6 @@ module html -const ( - null_element = int(0x80000000) -) +const null_element = int(0x80000000) struct Stack { mut: diff --git a/vlib/net/html/tag_test.v b/vlib/net/html/tag_test.v index fcf3c02227..6ffe2ae67d 100644 --- a/vlib/net/html/tag_test.v +++ b/vlib/net/html/tag_test.v @@ -2,8 +2,7 @@ module html import strings -const ( - html = ' +const html = ' @@ -28,7 +27,6 @@ const (
' -) fn test_search_tag_by_type() { mut dom := parse(html.html) diff --git a/vlib/net/http/cookie_test.v b/vlib/net/http/cookie_test.v index e3c0936f84..7ea966f249 100644 --- a/vlib/net/http/cookie_test.v +++ b/vlib/net/http/cookie_test.v @@ -15,415 +15,413 @@ struct AddCookieTestCase { raw string } -const ( - write_set_cookie_tests = [ - SetCookieTestCase{ - cookie: &http.Cookie{ - name: 'cookie-1' - value: 'v1' - } - raw: 'cookie-1=v1' +const write_set_cookie_tests = [ + SetCookieTestCase{ + cookie: &http.Cookie{ + name: 'cookie-1' + value: 'v1' + } + raw: 'cookie-1=v1' + }, + SetCookieTestCase{ + cookie: &http.Cookie{ + name: 'cookie-2' + value: 'two' + max_age: 3600 + } + raw: 'cookie-2=two; Max-Age=3600' + }, + SetCookieTestCase{ + cookie: &http.Cookie{ + name: 'cookie-3' + value: 'three' + domain: '.example.com' + } + raw: 'cookie-3=three; domain=example.com' + }, + SetCookieTestCase{ + cookie: &http.Cookie{ + name: 'cookie-4' + value: 'four' + path: '/restricted/' + } + raw: 'cookie-4=four; path=/restricted/' + }, + SetCookieTestCase{ + cookie: &http.Cookie{ + name: 'cookie-5' + value: 'five' + domain: 'wrong;bad.abc' + } + raw: 'cookie-5=five' + }, + SetCookieTestCase{ + cookie: &http.Cookie{ + name: 'cookie-6' + value: 'six' + domain: 'bad-.abc' + } + raw: 'cookie-6=six' + }, + // SetCookieTestCase{ + // cookie: &http.Cookie{name: 'cookie-7', value: 'seven', domain: '127.0.0.1'}, + // raw: 'cookie-7=seven; domain=127.0.0.1' + // }, + SetCookieTestCase{ + cookie: &http.Cookie{ + name: 'cookie-8' + value: 'eight' + domain: '::1' + } + raw: 'cookie-8=eight' + }, + // { + // cookie: &http.Cookie{name: 'cookie-9', value: 'expiring', expires: time.unix(1257894000, 0)}, + // 'cookie-9=expiring; Expires=Tue, 10 Nov 2009 23:00:00 GMT', + // }, + // According to IETF 6265 Section 5.1.1.5, the year cannot be less than 1601 + // SetCookieTestCase{ + // cookie: &http.Cookie{name: 'cookie-10', value: 'expiring-1601', expires: time.parse('Mon, 01 Jan 1601 01:01:01 GMT')}, + // raw: 'cookie-10=expiring-1601; Expires=Mon, 01 Jan 1601 01:01:01 GMT' + // }, + // SetCookieTestCase{ + // cookie: &http.Cookie{name: 'cookie-11', value: 'invalid-expiry', expires: time.parse('Mon, 01 Jan 1600 01:01:01 GMT')}, + // raw: 'cookie-11=invalid-expiry' + // }, + SetCookieTestCase{ + cookie: &http.Cookie{ + name: 'cookie-12' + value: 'samesite-default' + same_site: .same_site_default_mode + } + raw: 'cookie-12=samesite-default; SameSite' + }, + SetCookieTestCase{ + cookie: &http.Cookie{ + name: 'cookie-13' + value: 'samesite-lax' + same_site: .same_site_lax_mode + } + raw: 'cookie-13=samesite-lax; SameSite=Lax' + }, + SetCookieTestCase{ + cookie: &http.Cookie{ + name: 'cookie-14' + value: 'samesite-strict' + same_site: .same_site_strict_mode + } + raw: 'cookie-14=samesite-strict; SameSite=Strict' + }, + SetCookieTestCase{ + cookie: &http.Cookie{ + name: 'cookie-15' + value: 'samesite-none' + same_site: .same_site_none_mode + } + raw: 'cookie-15=samesite-none; SameSite=None' + }, + // The 'special' cookies have values containing commas or spaces which + // are disallowed by RFC 6265 but are common in the wild. + SetCookieTestCase{ + cookie: &http.Cookie{ + name: 'special-1' + value: 'a z' + } + raw: 'special-1=a z' + }, + SetCookieTestCase{ + cookie: &http.Cookie{ + name: 'special-2' + value: ' z' + } + raw: 'special-2=" z"' + }, + SetCookieTestCase{ + cookie: &http.Cookie{ + name: 'special-3' + value: 'a ' + } + raw: 'special-3="a "' + }, + SetCookieTestCase{ + cookie: &http.Cookie{ + name: 'special-4' + value: ' ' + } + raw: 'special-4=" "' + }, + SetCookieTestCase{ + cookie: &http.Cookie{ + name: 'special-5' + value: 'a,z' + } + raw: 'special-5=a,z' + }, + SetCookieTestCase{ + cookie: &http.Cookie{ + name: 'special-6' + value: ',z' + } + raw: 'special-6=",z"' + }, + SetCookieTestCase{ + cookie: &http.Cookie{ + name: 'special-7' + value: 'a,' + } + raw: 'special-7="a,"' + }, + SetCookieTestCase{ + cookie: &http.Cookie{ + name: 'special-8' + value: ',' + } + raw: 'special-8=","' + }, + SetCookieTestCase{ + cookie: &http.Cookie{ + name: 'empty-value' + value: '' + } + raw: 'empty-value=' + }, + SetCookieTestCase{ + cookie: &http.Cookie{ + name: '' + } + raw: '' + }, + SetCookieTestCase{ + cookie: &http.Cookie{ + name: '\t' + } + raw: '' + }, + SetCookieTestCase{ + cookie: &http.Cookie{ + name: '\r' + } + raw: '' + }, + SetCookieTestCase{ + cookie: &http.Cookie{ + name: 'a\nb' + value: 'v' + } + raw: '' + }, + SetCookieTestCase{ + cookie: &http.Cookie{ + name: 'a\nb' + value: 'v' + } + raw: '' + }, + SetCookieTestCase{ + cookie: &http.Cookie{ + name: 'a\rb' + value: 'v' + } + raw: '' + }, +] +const add_cookies_tests = [ + AddCookieTestCase{ + cookie: [] + raw: '' + }, + AddCookieTestCase{ + cookie: [&http.Cookie{ + name: 'cookie-1' + value: 'v1' + }] + raw: 'cookie-1=v1' + }, + AddCookieTestCase{ + cookie: [&http.Cookie{ + name: 'cookie-1' + value: 'v1' + }, &http.Cookie{ + name: 'cookie-2' + value: 'v2' }, - SetCookieTestCase{ - cookie: &http.Cookie{ - name: 'cookie-2' - value: 'two' - max_age: 3600 - } - raw: 'cookie-2=two; Max-Age=3600' - }, - SetCookieTestCase{ - cookie: &http.Cookie{ + &http.Cookie{ name: 'cookie-3' - value: 'three' - domain: '.example.com' - } - raw: 'cookie-3=three; domain=example.com' - }, - SetCookieTestCase{ - cookie: &http.Cookie{ - name: 'cookie-4' - value: 'four' - path: '/restricted/' - } - raw: 'cookie-4=four; path=/restricted/' - }, - SetCookieTestCase{ - cookie: &http.Cookie{ - name: 'cookie-5' - value: 'five' - domain: 'wrong;bad.abc' - } - raw: 'cookie-5=five' - }, - SetCookieTestCase{ - cookie: &http.Cookie{ - name: 'cookie-6' - value: 'six' - domain: 'bad-.abc' - } - raw: 'cookie-6=six' - }, - // SetCookieTestCase{ - // cookie: &http.Cookie{name: 'cookie-7', value: 'seven', domain: '127.0.0.1'}, - // raw: 'cookie-7=seven; domain=127.0.0.1' - // }, - SetCookieTestCase{ - cookie: &http.Cookie{ - name: 'cookie-8' - value: 'eight' - domain: '::1' - } - raw: 'cookie-8=eight' - }, - // { - // cookie: &http.Cookie{name: 'cookie-9', value: 'expiring', expires: time.unix(1257894000, 0)}, - // 'cookie-9=expiring; Expires=Tue, 10 Nov 2009 23:00:00 GMT', - // }, - // According to IETF 6265 Section 5.1.1.5, the year cannot be less than 1601 - // SetCookieTestCase{ - // cookie: &http.Cookie{name: 'cookie-10', value: 'expiring-1601', expires: time.parse('Mon, 01 Jan 1601 01:01:01 GMT')}, - // raw: 'cookie-10=expiring-1601; Expires=Mon, 01 Jan 1601 01:01:01 GMT' - // }, - // SetCookieTestCase{ - // cookie: &http.Cookie{name: 'cookie-11', value: 'invalid-expiry', expires: time.parse('Mon, 01 Jan 1600 01:01:01 GMT')}, - // raw: 'cookie-11=invalid-expiry' - // }, - SetCookieTestCase{ - cookie: &http.Cookie{ - name: 'cookie-12' - value: 'samesite-default' - same_site: .same_site_default_mode - } - raw: 'cookie-12=samesite-default; SameSite' - }, - SetCookieTestCase{ - cookie: &http.Cookie{ - name: 'cookie-13' - value: 'samesite-lax' - same_site: .same_site_lax_mode - } - raw: 'cookie-13=samesite-lax; SameSite=Lax' - }, - SetCookieTestCase{ - cookie: &http.Cookie{ - name: 'cookie-14' - value: 'samesite-strict' - same_site: .same_site_strict_mode - } - raw: 'cookie-14=samesite-strict; SameSite=Strict' - }, - SetCookieTestCase{ - cookie: &http.Cookie{ - name: 'cookie-15' - value: 'samesite-none' - same_site: .same_site_none_mode - } - raw: 'cookie-15=samesite-none; SameSite=None' - }, - // The 'special' cookies have values containing commas or spaces which - // are disallowed by RFC 6265 but are common in the wild. - SetCookieTestCase{ - cookie: &http.Cookie{ - name: 'special-1' - value: 'a z' - } + value: 'v3' + }] + raw: 'cookie-1=v1; cookie-2=v2; cookie-3=v3' + }, +] +const read_set_cookies_tests = [ + ReadSetCookiesTestCase{ + header: { + 'Set-Cookie': ['Cookie-1=v1'] + } + cookies: [&http.Cookie{ + name: 'Cookie-1' + value: 'v1' + raw: 'Cookie-1=v1' + }] + }, + // ReadSetCookiesTestCase{ + // header: {"Set-Cookie": ["NID=99=YsDT5i3E-CXax-; expires=Wed, 23-Nov-2011 01:05:03 GMT; path=/; domain=.google.ch; HttpOnly"]}, + // cookies: [&http.Cookie{ + // name: "NID", + // value: "99=YsDT5i3E-CXax-", + // path: "/", + // domain: ".google.ch", + // http_only: true, + // expires: time.parse_iso('Wed, 23-Nov-2011 01:05:03 GMT'), + // raw_expires: "Wed, 23-Nov-2011 01:05:03 GMT", + // raw: "NID=99=YsDT5i3E-CXax-; expires=Wed, 23-Nov-2011 01:05:03 GMT; path=/; domain=.google.ch; HttpOnly" + // }] + // }, + // ReadSetCookiesTestCase{ + // header: {"Set-Cookie": [".ASPXAUTH=7E3AA; expires=Wed, 07-Mar-2012 14:25:06 GMT; path=/; HttpOnly"]}, + // cookies: [&http.Cookie{ + // name: ".ASPXAUTH", + // value: "7E3AA", + // path: "/", + // expires: time.parse_iso('Wed, 07-Mar-2012 14:25:06 GMT'), + // raw_expires: "Wed, 07-Mar-2012 14:25:06 GMT", + // http_only: true, + // raw: ".ASPXAUTH=7E3AA; expires=Wed, 07-Mar-2012 14:25:06 GMT; path=/; HttpOnly" + // }] + // }, + ReadSetCookiesTestCase{ + header: { + 'Set-Cookie': ['ASP.NET_SessionId=foo; path=/; HttpOnly'] + } + cookies: [&http.Cookie{ + name: 'ASP.NET_SessionId' + value: 'foo' + path: '/' + http_only: true + raw: 'ASP.NET_SessionId=foo; path=/; HttpOnly' + }] + }, + ReadSetCookiesTestCase{ + header: { + 'Set-Cookie': ['samesitedefault=foo; SameSite'] + } + cookies: [&http.Cookie{ + name: 'samesitedefault' + value: 'foo' + same_site: .same_site_default_mode + raw: 'samesitedefault=foo; SameSite' + }] + }, + ReadSetCookiesTestCase{ + header: { + 'Set-Cookie': ['samesitelax=foo; SameSite=Lax'] + } + cookies: [&http.Cookie{ + name: 'samesitelax' + value: 'foo' + same_site: .same_site_lax_mode + raw: 'samesitelax=foo; SameSite=Lax' + }] + }, + ReadSetCookiesTestCase{ + header: { + 'Set-Cookie': ['samesitestrict=foo; SameSite=Strict'] + } + cookies: [&http.Cookie{ + name: 'samesitestrict' + value: 'foo' + same_site: .same_site_strict_mode + raw: 'samesitestrict=foo; SameSite=Strict' + }] + }, + ReadSetCookiesTestCase{ + header: { + 'Set-Cookie': ['samesitenone=foo; SameSite=None'] + } + cookies: [&http.Cookie{ + name: 'samesitenone' + value: 'foo' + same_site: .same_site_none_mode + raw: 'samesitenone=foo; SameSite=None' + }] + }, + // Make sure we can properly read back the Set-Cookie headers we create + // for values containing spaces or commas: + ReadSetCookiesTestCase{ + header: { + 'Set-Cookie': ['special-1=a z'] + } + cookies: [&http.Cookie{ + name: 'special-1' + value: 'a z' raw: 'special-1=a z' - }, - SetCookieTestCase{ - cookie: &http.Cookie{ - name: 'special-2' - value: ' z' - } + }] + }, + ReadSetCookiesTestCase{ + header: { + 'Set-Cookie': ['special-2=" z"'] + } + cookies: [&http.Cookie{ + name: 'special-2' + value: ' z' raw: 'special-2=" z"' - }, - SetCookieTestCase{ - cookie: &http.Cookie{ - name: 'special-3' - value: 'a ' - } + }] + }, + ReadSetCookiesTestCase{ + header: { + 'Set-Cookie': ['special-3="a "'] + } + cookies: [&http.Cookie{ + name: 'special-3' + value: 'a ' raw: 'special-3="a "' - }, - SetCookieTestCase{ - cookie: &http.Cookie{ - name: 'special-4' - value: ' ' - } + }] + }, + ReadSetCookiesTestCase{ + header: { + 'Set-Cookie': ['special-4=" "'] + } + cookies: [&http.Cookie{ + name: 'special-4' + value: ' ' raw: 'special-4=" "' - }, - SetCookieTestCase{ - cookie: &http.Cookie{ - name: 'special-5' - value: 'a,z' - } + }] + }, + ReadSetCookiesTestCase{ + header: { + 'Set-Cookie': ['special-5=a,z'] + } + cookies: [&http.Cookie{ + name: 'special-5' + value: 'a,z' raw: 'special-5=a,z' - }, - SetCookieTestCase{ - cookie: &http.Cookie{ - name: 'special-6' - value: ',z' - } + }] + }, + ReadSetCookiesTestCase{ + header: { + 'Set-Cookie': ['special-6=",z"'] + } + cookies: [&http.Cookie{ + name: 'special-6' + value: ',z' raw: 'special-6=",z"' - }, - SetCookieTestCase{ - cookie: &http.Cookie{ - name: 'special-7' - value: 'a,' - } - raw: 'special-7="a,"' - }, - SetCookieTestCase{ - cookie: &http.Cookie{ - name: 'special-8' - value: ',' - } + }] + }, + ReadSetCookiesTestCase{ + header: { + 'Set-Cookie': ['special-7=","'] + } + cookies: [&http.Cookie{ + name: 'special-7' + value: ',' raw: 'special-8=","' - }, - SetCookieTestCase{ - cookie: &http.Cookie{ - name: 'empty-value' - value: '' - } - raw: 'empty-value=' - }, - SetCookieTestCase{ - cookie: &http.Cookie{ - name: '' - } - raw: '' - }, - SetCookieTestCase{ - cookie: &http.Cookie{ - name: '\t' - } - raw: '' - }, - SetCookieTestCase{ - cookie: &http.Cookie{ - name: '\r' - } - raw: '' - }, - SetCookieTestCase{ - cookie: &http.Cookie{ - name: 'a\nb' - value: 'v' - } - raw: '' - }, - SetCookieTestCase{ - cookie: &http.Cookie{ - name: 'a\nb' - value: 'v' - } - raw: '' - }, - SetCookieTestCase{ - cookie: &http.Cookie{ - name: 'a\rb' - value: 'v' - } - raw: '' - }, - ] - add_cookies_tests = [ - AddCookieTestCase{ - cookie: [] - raw: '' - }, - AddCookieTestCase{ - cookie: [&http.Cookie{ - name: 'cookie-1' - value: 'v1' - }] - raw: 'cookie-1=v1' - }, - AddCookieTestCase{ - cookie: [&http.Cookie{ - name: 'cookie-1' - value: 'v1' - }, &http.Cookie{ - name: 'cookie-2' - value: 'v2' - }, - &http.Cookie{ - name: 'cookie-3' - value: 'v3' - }] - raw: 'cookie-1=v1; cookie-2=v2; cookie-3=v3' - }, - ] - read_set_cookies_tests = [ - ReadSetCookiesTestCase{ - header: { - 'Set-Cookie': ['Cookie-1=v1'] - } - cookies: [&http.Cookie{ - name: 'Cookie-1' - value: 'v1' - raw: 'Cookie-1=v1' - }] - }, - // ReadSetCookiesTestCase{ - // header: {"Set-Cookie": ["NID=99=YsDT5i3E-CXax-; expires=Wed, 23-Nov-2011 01:05:03 GMT; path=/; domain=.google.ch; HttpOnly"]}, - // cookies: [&http.Cookie{ - // name: "NID", - // value: "99=YsDT5i3E-CXax-", - // path: "/", - // domain: ".google.ch", - // http_only: true, - // expires: time.parse_iso('Wed, 23-Nov-2011 01:05:03 GMT'), - // raw_expires: "Wed, 23-Nov-2011 01:05:03 GMT", - // raw: "NID=99=YsDT5i3E-CXax-; expires=Wed, 23-Nov-2011 01:05:03 GMT; path=/; domain=.google.ch; HttpOnly" - // }] - // }, - // ReadSetCookiesTestCase{ - // header: {"Set-Cookie": [".ASPXAUTH=7E3AA; expires=Wed, 07-Mar-2012 14:25:06 GMT; path=/; HttpOnly"]}, - // cookies: [&http.Cookie{ - // name: ".ASPXAUTH", - // value: "7E3AA", - // path: "/", - // expires: time.parse_iso('Wed, 07-Mar-2012 14:25:06 GMT'), - // raw_expires: "Wed, 07-Mar-2012 14:25:06 GMT", - // http_only: true, - // raw: ".ASPXAUTH=7E3AA; expires=Wed, 07-Mar-2012 14:25:06 GMT; path=/; HttpOnly" - // }] - // }, - ReadSetCookiesTestCase{ - header: { - 'Set-Cookie': ['ASP.NET_SessionId=foo; path=/; HttpOnly'] - } - cookies: [&http.Cookie{ - name: 'ASP.NET_SessionId' - value: 'foo' - path: '/' - http_only: true - raw: 'ASP.NET_SessionId=foo; path=/; HttpOnly' - }] - }, - ReadSetCookiesTestCase{ - header: { - 'Set-Cookie': ['samesitedefault=foo; SameSite'] - } - cookies: [&http.Cookie{ - name: 'samesitedefault' - value: 'foo' - same_site: .same_site_default_mode - raw: 'samesitedefault=foo; SameSite' - }] - }, - ReadSetCookiesTestCase{ - header: { - 'Set-Cookie': ['samesitelax=foo; SameSite=Lax'] - } - cookies: [&http.Cookie{ - name: 'samesitelax' - value: 'foo' - same_site: .same_site_lax_mode - raw: 'samesitelax=foo; SameSite=Lax' - }] - }, - ReadSetCookiesTestCase{ - header: { - 'Set-Cookie': ['samesitestrict=foo; SameSite=Strict'] - } - cookies: [&http.Cookie{ - name: 'samesitestrict' - value: 'foo' - same_site: .same_site_strict_mode - raw: 'samesitestrict=foo; SameSite=Strict' - }] - }, - ReadSetCookiesTestCase{ - header: { - 'Set-Cookie': ['samesitenone=foo; SameSite=None'] - } - cookies: [&http.Cookie{ - name: 'samesitenone' - value: 'foo' - same_site: .same_site_none_mode - raw: 'samesitenone=foo; SameSite=None' - }] - }, - // Make sure we can properly read back the Set-Cookie headers we create - // for values containing spaces or commas: - ReadSetCookiesTestCase{ - header: { - 'Set-Cookie': ['special-1=a z'] - } - cookies: [&http.Cookie{ - name: 'special-1' - value: 'a z' - raw: 'special-1=a z' - }] - }, - ReadSetCookiesTestCase{ - header: { - 'Set-Cookie': ['special-2=" z"'] - } - cookies: [&http.Cookie{ - name: 'special-2' - value: ' z' - raw: 'special-2=" z"' - }] - }, - ReadSetCookiesTestCase{ - header: { - 'Set-Cookie': ['special-3="a "'] - } - cookies: [&http.Cookie{ - name: 'special-3' - value: 'a ' - raw: 'special-3="a "' - }] - }, - ReadSetCookiesTestCase{ - header: { - 'Set-Cookie': ['special-4=" "'] - } - cookies: [&http.Cookie{ - name: 'special-4' - value: ' ' - raw: 'special-4=" "' - }] - }, - ReadSetCookiesTestCase{ - header: { - 'Set-Cookie': ['special-5=a,z'] - } - cookies: [&http.Cookie{ - name: 'special-5' - value: 'a,z' - raw: 'special-5=a,z' - }] - }, - ReadSetCookiesTestCase{ - header: { - 'Set-Cookie': ['special-6=",z"'] - } - cookies: [&http.Cookie{ - name: 'special-6' - value: ',z' - raw: 'special-6=",z"' - }] - }, - ReadSetCookiesTestCase{ - header: { - 'Set-Cookie': ['special-7=","'] - } - cookies: [&http.Cookie{ - name: 'special-7' - value: ',' - raw: 'special-8=","' - }] - }, - // TODO(bradfitz): users have reported seeing this in the - // wild, but do browsers handle it? RFC 6265 just says "don't - // do that" (section 3) and then never mentions header folding - // again. - // Header{"Set-Cookie": ["ASP.NET_SessionId=foo; path=/; HttpOnly, .ASPXAUTH=7E3AA; expires=Wed, 07-Mar-2012 14:25:06 GMT; path=/; HttpOnly"]}, - ] -) + }] + }, + // TODO(bradfitz): users have reported seeing this in the + // wild, but do browsers handle it? RFC 6265 just says "don't + // do that" (section 3) and then never mentions header folding + // again. + // Header{"Set-Cookie": ["ASP.NET_SessionId=foo; path=/; HttpOnly, .ASPXAUTH=7E3AA; expires=Wed, 07-Mar-2012 14:25:06 GMT; path=/; HttpOnly"]}, +] fn test_write_set_cookies() { for _, tt in write_set_cookie_tests { diff --git a/vlib/net/http/http.v b/vlib/net/http/http.v index 5302b60487..5c777dd397 100644 --- a/vlib/net/http/http.v +++ b/vlib/net/http/http.v @@ -5,11 +5,10 @@ module http import net.urllib -const ( - max_redirects = 16 // safari max - other browsers allow up to 20 - content_type_default = 'text/plain' - bufsize = 1536 -) +const max_redirects = 16 // safari max - other browsers allow up to 20 + +const content_type_default = 'text/plain' +const bufsize = 1536 // FetchConfig holds configuration data for the fetch function. pub struct FetchConfig { diff --git a/vlib/net/http/http_proxy_test.v b/vlib/net/http/http_proxy_test.v index d671f01d0b..2730298685 100644 --- a/vlib/net/http/http_proxy_test.v +++ b/vlib/net/http/http_proxy_test.v @@ -2,16 +2,14 @@ module http import encoding.base64 -const ( - sample_proxy_url = 'https://localhost' - sample_auth_proxy_url = 'http://user:pass@localhost:8888' +const sample_proxy_url = 'https://localhost' +const sample_auth_proxy_url = 'http://user:pass@localhost:8888' - sample_host = '127.0.0.1:1337' - sample_request = &Request{ - url: 'http://${sample_host}' - } - sample_path = '/' -) +const sample_host = '127.0.0.1:1337' +const sample_request = &Request{ + url: 'http://${sample_host}' +} +const sample_path = '/' fn test_proxy_fields() ? { sample_proxy := new_http_proxy(http.sample_proxy_url)! diff --git a/vlib/net/net_nix.c.v b/vlib/net/net_nix.c.v index c8604d616d..fc224675a0 100644 --- a/vlib/net/net_nix.c.v +++ b/vlib/net/net_nix.c.v @@ -20,13 +20,9 @@ pub fn error_code() int { fn init() { } -pub const ( - msg_nosignal = 0x4000 -) +pub const msg_nosignal = 0x4000 -pub const ( - error_ewouldblock = C.EWOULDBLOCK - error_einprogress = C.EINPROGRESS -) +pub const error_ewouldblock = C.EWOULDBLOCK +pub const error_einprogress = C.EINPROGRESS fn C.unlink(&char) int diff --git a/vlib/net/net_windows.c.v b/vlib/net/net_windows.c.v index db895c7330..bca967066b 100644 --- a/vlib/net/net_windows.c.v +++ b/vlib/net/net_windows.c.v @@ -739,10 +739,8 @@ pub fn wsa_error(code int) WsaError { return unsafe { WsaError(code) } } -pub const ( - error_ewouldblock = WsaError.wsaewouldblock - error_einprogress = WsaError.wsaeinprogress -) +pub const error_ewouldblock = WsaError.wsaewouldblock +pub const error_einprogress = WsaError.wsaeinprogress // Link to Winsock library #flag -lws2_32 @@ -750,11 +748,9 @@ pub const ( #include // Constants that windows needs -const ( - fionbio = C.FIONBIO - msg_nosignal = 0 - wsa_v22 = 0x202 // C.MAKEWORD(2, 2) -) +const fionbio = C.FIONBIO +const msg_nosignal = 0 +const wsa_v22 = 0x202 // Error code returns the last socket error pub fn error_code() int { diff --git a/vlib/net/smtp/smtp.v b/vlib/net/smtp/smtp.v index 6f69dc57bd..d73caf62b8 100644 --- a/vlib/net/smtp/smtp.v +++ b/vlib/net/smtp/smtp.v @@ -12,9 +12,7 @@ import strings import time import io -const ( - recv_size = 128 -) +const recv_size = 128 enum ReplyCode { ready = 220 diff --git a/vlib/net/socket_options.c.v b/vlib/net/socket_options.c.v index 6fe00394a3..1a32f65a35 100644 --- a/vlib/net/socket_options.c.v +++ b/vlib/net/socket_options.c.v @@ -21,30 +21,29 @@ pub enum SocketOption { ipv6_only = C.IPV6_V6ONLY } -pub const ( - opts_bool = [SocketOption.broadcast, .debug, .dont_route, .error, .keep_alive, .oob_inline] - opts_int = [ - .receive_buf_size, - .receive_low_size, - .receive_timeout, - .send_buf_size, - .send_low_size, - .send_timeout, - ] +pub const opts_bool = [SocketOption.broadcast, .debug, .dont_route, .error, .keep_alive, .oob_inline] - opts_can_set = [ - SocketOption.broadcast, - .debug, - .dont_route, - .keep_alive, - .linger, - .oob_inline, - .receive_buf_size, - .receive_low_size, - .receive_timeout, - .send_buf_size, - .send_low_size, - .send_timeout, - .ipv6_only, - ] -) +pub const opts_int = [ + SocketOption.receive_buf_size, + .receive_low_size, + .receive_timeout, + .send_buf_size, + .send_low_size, + .send_timeout, +] + +pub const opts_can_set = [ + SocketOption.broadcast, + .debug, + .dont_route, + .keep_alive, + .linger, + .oob_inline, + .receive_buf_size, + .receive_low_size, + .receive_timeout, + .send_buf_size, + .send_low_size, + .send_timeout, + .ipv6_only, +] diff --git a/vlib/net/tcp.c.v b/vlib/net/tcp.c.v index 70c7946f36..9c44916322 100644 --- a/vlib/net/tcp.c.v +++ b/vlib/net/tcp.c.v @@ -3,10 +3,8 @@ module net import time import strings -pub const ( - tcp_default_read_timeout = 30 * time.second - tcp_default_write_timeout = 30 * time.second -) +pub const tcp_default_read_timeout = 30 * time.second +pub const tcp_default_write_timeout = 30 * time.second @[heap] pub struct TcpConn { @@ -537,9 +535,7 @@ fn (mut s TcpSocket) @select(test Select, timeout time.Duration) !bool { return @select(s.handle, test, timeout) } -const ( - connect_timeout = 5 * time.second -) +const connect_timeout = 5 * time.second fn (mut s TcpSocket) connect(a Addr) ! { $if !net_blocking_sockets ? { diff --git a/vlib/net/tcp_read_line.c.v b/vlib/net/tcp_read_line.c.v index 92eb397064..9e6c9c7989 100644 --- a/vlib/net/tcp_read_line.c.v +++ b/vlib/net/tcp_read_line.c.v @@ -2,12 +2,10 @@ module net import strings -const ( - crlf = '\r\n' - msg_peek = 0x02 - max_read = 400 - max_read_line_len = 1048576 -) +const crlf = '\r\n' +const msg_peek = 0x02 +const max_read = 400 +const max_read_line_len = 1048576 // get_blocking returns whether the connection is in a blocking state, // that is calls to .read_line, C.recv etc will block till there is new diff --git a/vlib/net/tcp_simple_client_server_test.v b/vlib/net/tcp_simple_client_server_test.v index a19ed36026..d4db326fe0 100644 --- a/vlib/net/tcp_simple_client_server_test.v +++ b/vlib/net/tcp_simple_client_server_test.v @@ -2,9 +2,7 @@ import io import net import strings -const ( - server_port = ':22443' -) +const server_port = ':22443' fn accept(mut server net.TcpListener, c chan &net.TcpConn) { c <- server.accept() or { panic(err) } diff --git a/vlib/net/tcp_test.v b/vlib/net/tcp_test.v index 8cdf772453..f0141aeb16 100644 --- a/vlib/net/tcp_test.v +++ b/vlib/net/tcp_test.v @@ -3,9 +3,7 @@ import net import os -const ( - test_port = 45123 -) +const test_port = 45123 fn handle_conn(mut c net.TcpConn) { for { diff --git a/vlib/net/udp.c.v b/vlib/net/udp.c.v index 349aebf244..932efb5184 100644 --- a/vlib/net/udp.c.v +++ b/vlib/net/udp.c.v @@ -2,10 +2,8 @@ module net import time -const ( - udp_default_read_timeout = time.second / 10 - udp_default_write_timeout = time.second / 10 -) +const udp_default_read_timeout = time.second / 10 +const udp_default_write_timeout = time.second / 10 struct UdpSocket { Socket diff --git a/vlib/net/unix/common.c.v b/vlib/net/unix/common.c.v index e7cbd80d66..afd7045ac9 100644 --- a/vlib/net/unix/common.c.v +++ b/vlib/net/unix/common.c.v @@ -3,19 +3,17 @@ module unix import time import net -const ( - // no_deadline should be given to functions when no deadline is wanted (i.e. all functions - // return instantly) - no_deadline = time.Time{ - unix: 0 - } - // no_timeout should be given to functions when no timeout is wanted (i.e. all functions - // return instantly) - no_timeout = time.Duration(0) - // infinite_timeout should be given to functions when an infinite_timeout is wanted (i.e. functions - // only ever return with data) - infinite_timeout = time.infinite -) +// no_deadline should be given to functions when no deadline is wanted (i.e. all functions +// return instantly) +const no_deadline = time.Time{ + unix: 0 +} +// no_timeout should be given to functions when no timeout is wanted (i.e. all functions +// return instantly) +const no_timeout = time.Duration(0) +// infinite_timeout should be given to functions when an infinite_timeout is wanted (i.e. functions +// only ever return with data) +const infinite_timeout = time.infinite fn C.strncpy(&char, &char, int) diff --git a/vlib/net/unix/stream.c.v b/vlib/net/unix/stream.c.v index e756993e1d..247936c9cd 100644 --- a/vlib/net/unix/stream.c.v +++ b/vlib/net/unix/stream.c.v @@ -4,12 +4,10 @@ import time import os import net -const ( - unix_default_read_timeout = 30 * time.second - unix_default_write_timeout = 30 * time.second - connect_timeout = 5 * time.second - msg_nosignal = 0x4000 -) +const unix_default_read_timeout = 30 * time.second +const unix_default_write_timeout = 30 * time.second +const connect_timeout = 5 * time.second +const msg_nosignal = 0x4000 @[heap] pub struct StreamConn { diff --git a/vlib/net/unix/unix_test.v b/vlib/net/unix/unix_test.v index 7f7b6227ab..134c733e5c 100644 --- a/vlib/net/unix/unix_test.v +++ b/vlib/net/unix/unix_test.v @@ -1,10 +1,8 @@ import os import net.unix -const ( - tfolder = os.join_path(os.vtmp_dir(), 'unix_test') - socket_path = os.join_path(tfolder, 'v_unix.sock') -) +const tfolder = os.join_path(os.vtmp_dir(), 'unix_test') +const socket_path = os.join_path(tfolder, 'v_unix.sock') fn testsuite_begin() { os.mkdir_all(tfolder) or {} diff --git a/vlib/net/unix/use_net_and_net_unix_together_test.v b/vlib/net/unix/use_net_and_net_unix_together_test.v index 498973dea8..3298cc1d0d 100644 --- a/vlib/net/unix/use_net_and_net_unix_together_test.v +++ b/vlib/net/unix/use_net_and_net_unix_together_test.v @@ -2,11 +2,10 @@ import os import net.unix import net -const ( - use_net = net.no_timeout // ensure that `net` is used, i.e. no warnings - tfolder = os.join_path(os.vtmp_dir(), 'net_and_unix_together') - test_port = os.join_path(tfolder, 'unix_domain_socket') -) +const use_net = net.no_timeout // ensure that `net` is used, i.e. no warnings + +const tfolder = os.join_path(os.vtmp_dir(), 'net_and_unix_together') +const test_port = os.join_path(tfolder, 'unix_domain_socket') fn testsuite_begin() { os.mkdir_all(tfolder) or {} diff --git a/vlib/net/urllib/urllib.v b/vlib/net/urllib/urllib.v index a8104e02c3..28899a4015 100644 --- a/vlib/net/urllib/urllib.v +++ b/vlib/net/urllib/urllib.v @@ -20,10 +20,8 @@ enum EncodingMode { encode_fragment } -const ( - err_msg_escape = 'unescape: invalid URL escape' - err_msg_parse = 'parse: failed parsing url' -) +const err_msg_escape = 'unescape: invalid URL escape' +const err_msg_parse = 'parse: failed parsing url' fn error_msg(message string, val string) string { mut msg := 'net.urllib.${message}' diff --git a/vlib/net/util.v b/vlib/net/util.v index d027cf5f81..d557f70061 100644 --- a/vlib/net/util.v +++ b/vlib/net/util.v @@ -1,8 +1,6 @@ module net -const ( - socket_max_port = u16(0xFFFF) -) +const socket_max_port = u16(0xFFFF) // validate_port checks whether a port is valid // and returns the port or an error diff --git a/vlib/net/websocket/message.v b/vlib/net/websocket/message.v index e8832264b7..032985e9a4 100644 --- a/vlib/net/websocket/message.v +++ b/vlib/net/websocket/message.v @@ -2,12 +2,13 @@ module websocket import encoding.utf8 -const ( - header_len_offset = 2 // offset for lengthpart of websocket header - buffer_size = 256 // default buffer size - extended_payload16_end_byte = 4 // header length with 16-bit extended payload - extended_payload64_end_byte = 10 // header length with 64-bit extended payload -) +const header_len_offset = 2 // offset for lengthpart of websocket header + +const buffer_size = 256 // default buffer size + +const extended_payload16_end_byte = 4 // header length with 16-bit extended payload + +const extended_payload64_end_byte = 10 // Fragment represents a websocket data fragment struct Fragment { @@ -32,9 +33,7 @@ mut: masking_key [4]u8 // all frames from client to server is masked with this key } -const ( - invalid_close_codes = [999, 1004, 1005, 1006, 1014, 1015, 1016, 1100, 2000, 2999, 5000, 65536] -) +const invalid_close_codes = [999, 1004, 1005, 1006, 1014, 1015, 1016, 1100, 2000, 2999, 5000, 65536] // validate_client validates client frame rules from RFC6455 pub fn (mut ws Client) validate_frame(frame &Frame) ! { diff --git a/vlib/net/websocket/websocket_client.v b/vlib/net/websocket/websocket_client.v index 2707409e8a..635a86d62d 100644 --- a/vlib/net/websocket/websocket_client.v +++ b/vlib/net/websocket/websocket_client.v @@ -12,9 +12,7 @@ import time import log import rand -const ( - empty_bytearr = []u8{} // used as empty response to avoid allocation -) +const empty_bytearr = []u8{} pub struct ClientState { pub mut: diff --git a/vlib/net/websocket/websocket_nix.c.v b/vlib/net/websocket/websocket_nix.c.v index f986b98f0b..16c987ad7e 100644 --- a/vlib/net/websocket/websocket_nix.c.v +++ b/vlib/net/websocket/websocket_nix.c.v @@ -5,6 +5,4 @@ fn error_code() int { return C.errno } -const ( - error_ewouldblock = C.EWOULDBLOCK // blocking error code -) +const error_ewouldblock = C.EWOULDBLOCK diff --git a/vlib/net/websocket/websocket_windows.c.v b/vlib/net/websocket/websocket_windows.c.v index e9f4fc3d73..0a25c28489 100644 --- a/vlib/net/websocket/websocket_windows.c.v +++ b/vlib/net/websocket/websocket_windows.c.v @@ -7,6 +7,4 @@ fn error_code() int { return C.WSAGetLastError() } -const ( - error_ewouldblock = net.WsaError.wsaewouldblock // blocking error code -) +const error_ewouldblock = net.WsaError.wsaewouldblock diff --git a/vlib/orm/orm.v b/vlib/orm/orm.v index 0834a706b7..61ff2d87d5 100644 --- a/vlib/orm/orm.v +++ b/vlib/orm/orm.v @@ -2,42 +2,40 @@ module orm import time -pub const ( - num64 = [typeof[i64]().idx, typeof[u64]().idx] - nums = [ - typeof[i8]().idx, - typeof[i16]().idx, - typeof[int]().idx, - typeof[u8]().idx, - typeof[u16]().idx, - typeof[u32]().idx, - typeof[bool]().idx, - ] - float = [ - typeof[f32]().idx, - typeof[f64]().idx, - ] - type_string = typeof[string]().idx - serial = -1 - time_ = -2 - enum_ = -3 - type_idx = { - 'i8': typeof[i8]().idx - 'i16': typeof[i16]().idx - 'int': typeof[int]().idx - 'i64': typeof[i64]().idx - 'u8': typeof[u8]().idx - 'u16': typeof[u16]().idx - 'u32': typeof[u32]().idx - 'u64': typeof[u64]().idx - 'f32': typeof[f32]().idx - 'f64': typeof[f64]().idx - 'bool': typeof[bool]().idx - 'string': typeof[string]().idx - } - string_max_len = 2048 - null_primitive = Primitive(Null{}) -) +pub const num64 = [typeof[i64]().idx, typeof[u64]().idx] +pub const nums = [ + typeof[i8]().idx, + typeof[i16]().idx, + typeof[int]().idx, + typeof[u8]().idx, + typeof[u16]().idx, + typeof[u32]().idx, + typeof[bool]().idx, +] +pub const float = [ + typeof[f32]().idx, + typeof[f64]().idx, +] +pub const type_string = typeof[string]().idx +pub const serial = -1 +pub const time_ = -2 +pub const enum_ = -3 +pub const type_idx = { + 'i8': typeof[i8]().idx + 'i16': typeof[i16]().idx + 'int': typeof[int]().idx + 'i64': typeof[i64]().idx + 'u8': typeof[u8]().idx + 'u16': typeof[u16]().idx + 'u32': typeof[u32]().idx + 'u64': typeof[u64]().idx + 'f32': typeof[f32]().idx + 'f64': typeof[f64]().idx + 'bool': typeof[bool]().idx + 'string': typeof[string]().idx +} +pub const string_max_len = 2048 +pub const null_primitive = Primitive(Null{}) pub type Primitive = InfixType | Null diff --git a/vlib/orm/orm_null_test.v b/vlib/orm/orm_null_test.v index cd55ab2fb1..df3f1a5e70 100644 --- a/vlib/orm/orm_null_test.v +++ b/vlib/orm/orm_null_test.v @@ -54,25 +54,23 @@ fn (db MockDB) delete(table string, where orm.QueryData) ! { return db.db.delete(table, where) } -const ( - typ_to_typename = { - typeof[i8]().idx: 'i8' - typeof[i16]().idx: 'i16' - typeof[int]().idx: 'int' - typeof[i64]().idx: 'i64' - typeof[u8]().idx: 'u8' - typeof[u16]().idx: 'u16' - typeof[u32]().idx: 'u32' - typeof[u64]().idx: 'u64' - typeof[f32]().idx: 'f32' - typeof[f64]().idx: 'f64' - typeof[string]().idx: 'string' - typeof[bool]().idx: 'bool' - orm.serial: 'serial' - orm.time_: 'time' - orm.enum_: 'enum' - } -) +const typ_to_typename = { + typeof[i8]().idx: 'i8' + typeof[i16]().idx: 'i16' + typeof[int]().idx: 'int' + typeof[i64]().idx: 'i64' + typeof[u8]().idx: 'u8' + typeof[u16]().idx: 'u16' + typeof[u32]().idx: 'u32' + typeof[u64]().idx: 'u64' + typeof[f32]().idx: 'f32' + typeof[f64]().idx: 'f64' + typeof[string]().idx: 'string' + typeof[bool]().idx: 'bool' + orm.serial: 'serial' + orm.time_: 'time' + orm.enum_: 'enum' +} fn mock_type_from_v(typ int) !string { return if typ in typ_to_typename { diff --git a/vlib/orm/orm_sql_or_blocks_test.v b/vlib/orm/orm_sql_or_blocks_test.v index 5f381f32d6..ab8d70eebd 100644 --- a/vlib/orm/orm_sql_or_blocks_test.v +++ b/vlib/orm/orm_sql_or_blocks_test.v @@ -6,10 +6,8 @@ struct User { name string @[unique] } -const ( - db_folder = os.join_path(os.vtmp_dir(), 'orm_sql') - db_path = os.join_path(db_folder, 'sql_statement_or_blocks.db') -) +const db_folder = os.join_path(os.vtmp_dir(), 'orm_sql') +const db_path = os.join_path(db_folder, 'sql_statement_or_blocks.db') fn testsuite_begin() { os.mkdir_all(db_folder) or {} diff --git a/vlib/orm/orm_test.v b/vlib/orm/orm_test.v index 85d9a6a314..ea8508812a 100644 --- a/vlib/orm/orm_test.v +++ b/vlib/orm/orm_test.v @@ -3,9 +3,7 @@ import time import db.sqlite -const ( - offset_const = 2 -) +const offset_const = 2 struct Module { id int @[primary; sql: serial] diff --git a/vlib/os/const_nix.c.v b/vlib/os/const_nix.c.v index 6b24a03ccc..7f1c4035da 100644 --- a/vlib/os/const_nix.c.v +++ b/vlib/os/const_nix.c.v @@ -2,16 +2,24 @@ module os const max_path_buffer_size = max_path_len -const ( - o_binary = 0 // input and output is not translated; the default on unix - o_rdonly = C.O_RDONLY // open the file read-only. - o_wronly = C.O_WRONLY // open the file write-only. - o_rdwr = C.O_RDWR // open the file read-write. - o_create = C.O_CREAT // create a new file if none exists. - o_excl = C.O_EXCL // used with o_create, file must not exist. - o_noctty = C.O_NOCTTY // if file is terminal, don't make it the controller terminal - o_trunc = C.O_TRUNC // truncate regular writable file when opened. - o_append = C.O_APPEND // append data to the file when writing. - o_nonblock = C.O_NONBLOCK // prevents blocking when opening files - o_sync = C.O_SYNC // open for synchronous I/O. -) +const o_binary = 0 // input and output is not translated; the default on unix + +const o_rdonly = C.O_RDONLY // open the file read-only. + +const o_wronly = C.O_WRONLY // open the file write-only. + +const o_rdwr = C.O_RDWR // open the file read-write. + +const o_create = C.O_CREAT // create a new file if none exists. + +const o_excl = C.O_EXCL // used with o_create, file must not exist. + +const o_noctty = C.O_NOCTTY // if file is terminal, don't make it the controller terminal + +const o_trunc = C.O_TRUNC // truncate regular writable file when opened. + +const o_append = C.O_APPEND // append data to the file when writing. + +const o_nonblock = C.O_NONBLOCK // prevents blocking when opening files + +const o_sync = C.O_SYNC diff --git a/vlib/os/const_windows.c.v b/vlib/os/const_windows.c.v index 47eab9e478..3e72b671a8 100644 --- a/vlib/os/const_windows.c.v +++ b/vlib/os/const_windows.c.v @@ -3,161 +3,142 @@ module os const max_path_buffer_size = 2 * max_path_len // Ref - winnt.h -const ( - success = 0x0000 // ERROR_SUCCESS - error_insufficient_buffer = 0x0082 -) +const success = 0x0000 // ERROR_SUCCESS -const ( - handle_generic_read = u32(0x80000000) - handle_open_existing = 0x00000003 -) +const error_insufficient_buffer = 0x0082 -const ( - file_share_read = 0x01 - file_share_write = 0x02 - file_share_delete = 0x04 -) +const handle_generic_read = u32(0x80000000) +const handle_open_existing = 0x00000003 -const ( - file_notify_change_file_name = 0x01 - file_notify_change_dir_name = 0x02 - file_notify_change_attributes = 0x04 - file_notify_change_size = 0x08 - file_notify_change_last_write = 0x10 - file_notify_change_last_access = 0x20 - file_notify_change_creation = 0x40 - file_notify_change_security = 0x80 -) +const file_share_read = 0x01 +const file_share_write = 0x02 +const file_share_delete = 0x04 -const ( - file_action_added = 0x01 - file_action_removed = 0x02 - file_action_modified = 0x03 - file_action_renamed_old_name = 0x04 - file_action_renamed_new_name = 0x05 -) +const file_notify_change_file_name = 0x01 +const file_notify_change_dir_name = 0x02 +const file_notify_change_attributes = 0x04 +const file_notify_change_size = 0x08 +const file_notify_change_last_write = 0x10 +const file_notify_change_last_access = 0x20 +const file_notify_change_creation = 0x40 +const file_notify_change_security = 0x80 -const ( - file_attr_readonly = 0x00000001 - file_attr_hidden = 0x00000002 - file_attr_system = 0x00000004 - file_attr_directory = 0x00000010 - file_attr_archive = 0x00000020 - file_attr_device = 0x00000040 - file_attr_normal = 0x00000080 - file_attr_temporary = 0x00000100 - file_attr_sparse_file = 0x00000200 - file_attr_reparse_point = 0x00000400 - file_attr_compressed = 0x00000800 - file_attr_offline = 0x00001000 - file_attr_not_content_indexed = 0x00002000 - file_attr_encrypted = 0x00004000 - file_attr_integrity_stream = 0x00008000 - file_attr_virtual = 0x00010000 - file_attr_no_scrub_data = 0x00020000 - // file_attr_recall_on_open = u32(0x...) - // file_attr_recall_on_data_access = u32(0x...) -) +const file_action_added = 0x01 +const file_action_removed = 0x02 +const file_action_modified = 0x03 +const file_action_renamed_old_name = 0x04 +const file_action_renamed_new_name = 0x05 -const ( - file_type_unknown = 0x00 - file_type_disk = 0x01 - file_type_char = 0x02 - file_type_pipe = 0x03 -) +const file_attr_readonly = 0x00000001 +const file_attr_hidden = 0x00000002 +const file_attr_system = 0x00000004 +const file_attr_directory = 0x00000010 +const file_attr_archive = 0x00000020 +const file_attr_device = 0x00000040 +const file_attr_normal = 0x00000080 +const file_attr_temporary = 0x00000100 +const file_attr_sparse_file = 0x00000200 +const file_attr_reparse_point = 0x00000400 +const file_attr_compressed = 0x00000800 +const file_attr_offline = 0x00001000 +const file_attr_not_content_indexed = 0x00002000 +const file_attr_encrypted = 0x00004000 +const file_attr_integrity_stream = 0x00008000 +const file_attr_virtual = 0x00010000 +const file_attr_no_scrub_data = 0x00020000 -const ( - file_invalid_file_id = (-1) -) +const file_type_unknown = 0x00 +const file_type_disk = 0x01 +const file_type_char = 0x02 +const file_type_pipe = 0x03 -const ( - invalid_handle_value = voidptr(-1) -) +const file_invalid_file_id = (-1) + +const invalid_handle_value = voidptr(-1) // https://docs.microsoft.com/en-us/windows/console/setconsolemode -const ( - // Input Buffer - enable_echo_input = 0x0004 - enable_extended_flags = 0x0080 - enable_insert_mode = 0x0020 - enable_line_input = 0x0002 - enable_mouse_input = 0x0010 - enable_processed_input = 0x0001 - enable_quick_edit_mode = 0x0040 - enable_window_input = 0x0008 - enable_virtual_terminal_input = 0x0200 - // Output Screen Buffer - enable_processed_output = 0x01 - enable_wrap_at_eol_output = 0x02 - enable_virtual_terminal_processing = 0x04 - disable_newline_auto_return = 0x08 - enable_lvb_grid_worldwide = 0x10 -) +// Input Buffer +const enable_echo_input = 0x0004 +const enable_extended_flags = 0x0080 +const enable_insert_mode = 0x0020 +const enable_line_input = 0x0002 +const enable_mouse_input = 0x0010 +const enable_processed_input = 0x0001 +const enable_quick_edit_mode = 0x0040 +const enable_window_input = 0x0008 +const enable_virtual_terminal_input = 0x0200 +// Output Screen Buffer +const enable_processed_output = 0x01 +const enable_wrap_at_eol_output = 0x02 +const enable_virtual_terminal_processing = 0x04 +const disable_newline_auto_return = 0x08 +const enable_lvb_grid_worldwide = 0x10 // File modes -const ( - o_rdonly = 0x0000 // open the file read-only. - o_wronly = 0x0001 // open the file write-only. - o_rdwr = 0x0002 // open the file read-write. - o_append = 0x0008 // append data to the file when writing. - o_create = 0x0100 // create a new file if none exists. - o_binary = 0x8000 // input and output is not translated. - o_trunc = 0x0200 // truncate regular writable file when opened. - o_excl = 0x0400 // used with o_create, file must not exist. - o_sync = 0x0000 // open for synchronous I/O (ignored on Windows) - o_noctty = 0x0000 // make file non-controlling tty (ignored on Windows) - o_nonblock = 0x0000 // don't block on opening file (ignored on Windows) -) +const o_rdonly = 0x0000 // open the file read-only. -const ( - status_access_violation = u32(0xC0000005) - status_in_page_error = u32(0xC0000006) - status_invalid_handle = u32(0xC0000008) - status_invalid_parameter = u32(0xC000000D) - status_no_memory = u32(0xC0000017) - status_illegal_instruction = u32(0xC000001D) - status_noncontinuable_exception = u32(0xC0000025) - status_invalid_disposition = u32(0xC0000026) - status_array_bounds_exceeded = u32(0xC000008C) - status_float_denormal_operand = u32(0xC000008D) - status_float_divide_by_zero = u32(0xC000008E) - status_float_inexact_result = u32(0xC000008F) - status_float_invalid_operation = u32(0xC0000090) - status_float_overflow = u32(0xC0000091) - status_float_stack_check = u32(0xC0000092) - status_float_underflow = u32(0xC0000093) - status_integer_divide_by_zero = u32(0xC0000094) - status_integer_overflow = u32(0xC0000095) - status_privileged_instruction = u32(0xC0000096) - status_stack_overflow = u32(0xC00000FD) - status_dll_not_found = u32(0xC0000135) - status_ordinal_not_found = u32(0xC0000138) - status_entrypoint_not_found = u32(0xC0000139) - status_control_c_exit = u32(0xC000013A) - status_dll_init_failed = u32(0xC0000142) - status_float_multiple_faults = u32(0xC00002B4) - status_float_multiple_traps = u32(0xC00002B5) - status_reg_nat_consumption = u32(0xC00002C9) - status_heap_corruption = u32(0xC0000374) - status_stack_buffer_overrun = u32(0xC0000409) - status_invalid_cruntime_parameter = u32(0xC0000417) - status_assertion_failure = u32(0xC0000420) -) +const o_wronly = 0x0001 // open the file write-only. + +const o_rdwr = 0x0002 // open the file read-write. + +const o_append = 0x0008 // append data to the file when writing. + +const o_create = 0x0100 // create a new file if none exists. + +const o_binary = 0x8000 // input and output is not translated. + +const o_trunc = 0x0200 // truncate regular writable file when opened. + +const o_excl = 0x0400 // used with o_create, file must not exist. + +const o_sync = 0x0000 // open for synchronous I/O (ignored on Windows) + +const o_noctty = 0x0000 // make file non-controlling tty (ignored on Windows) + +const o_nonblock = 0x0000 + +const status_access_violation = u32(0xC0000005) +const status_in_page_error = u32(0xC0000006) +const status_invalid_handle = u32(0xC0000008) +const status_invalid_parameter = u32(0xC000000D) +const status_no_memory = u32(0xC0000017) +const status_illegal_instruction = u32(0xC000001D) +const status_noncontinuable_exception = u32(0xC0000025) +const status_invalid_disposition = u32(0xC0000026) +const status_array_bounds_exceeded = u32(0xC000008C) +const status_float_denormal_operand = u32(0xC000008D) +const status_float_divide_by_zero = u32(0xC000008E) +const status_float_inexact_result = u32(0xC000008F) +const status_float_invalid_operation = u32(0xC0000090) +const status_float_overflow = u32(0xC0000091) +const status_float_stack_check = u32(0xC0000092) +const status_float_underflow = u32(0xC0000093) +const status_integer_divide_by_zero = u32(0xC0000094) +const status_integer_overflow = u32(0xC0000095) +const status_privileged_instruction = u32(0xC0000096) +const status_stack_overflow = u32(0xC00000FD) +const status_dll_not_found = u32(0xC0000135) +const status_ordinal_not_found = u32(0xC0000138) +const status_entrypoint_not_found = u32(0xC0000139) +const status_control_c_exit = u32(0xC000013A) +const status_dll_init_failed = u32(0xC0000142) +const status_float_multiple_faults = u32(0xC00002B4) +const status_float_multiple_traps = u32(0xC00002B5) +const status_reg_nat_consumption = u32(0xC00002C9) +const status_heap_corruption = u32(0xC0000374) +const status_stack_buffer_overrun = u32(0xC0000409) +const status_invalid_cruntime_parameter = u32(0xC0000417) +const status_assertion_failure = u32(0xC0000420) // Windows Registry Constants -pub const ( - hkey_local_machine = voidptr(0x80000002) - hkey_current_user = voidptr(0x80000001) - key_query_value = 0x0001 - key_set_value = 0x0002 - key_enumerate_sub_keys = 0x0008 - key_wow64_32key = 0x0200 -) +pub const hkey_local_machine = voidptr(0x80000002) +pub const hkey_current_user = voidptr(0x80000001) +pub const key_query_value = 0x0001 +pub const key_set_value = 0x0002 +pub const key_enumerate_sub_keys = 0x0008 +pub const key_wow64_32key = 0x0200 // Windows Messages -pub const ( - hwnd_broadcast = voidptr(0xFFFF) - wm_settingchange = 0x001A - smto_abortifhung = 0x0002 -) +pub const hwnd_broadcast = voidptr(0xFFFF) +pub const wm_settingchange = 0x001A +pub const smto_abortifhung = 0x0002 diff --git a/vlib/os/file_test.v b/vlib/os/file_test.v index 42542d5aa7..31c838d8ef 100644 --- a/vlib/os/file_test.v +++ b/vlib/os/file_test.v @@ -1,9 +1,7 @@ import os -const ( - tfolder = os.join_path(os.vtmp_dir(), 'tests', 'os_file_test') - tfile = os.join_path_single(tfolder, 'test_file') -) +const tfolder = os.join_path(os.vtmp_dir(), 'tests', 'os_file_test') +const tfile = os.join_path_single(tfolder, 'test_file') fn testsuite_begin() { os.rmdir_all(tfolder) or {} @@ -48,14 +46,12 @@ enum Permissions { execute } -const ( - unit_point = Point{1.0, 1.0, 1.0} - another_point = Point{0.25, 2.25, 6.25} - extended_point = Extended_Point{1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0} - another_byte = u8(123) - another_color = Color.red - another_permission = Permissions.read | .write -) +const unit_point = Point{1.0, 1.0, 1.0} +const another_point = Point{0.25, 2.25, 6.25} +const extended_point = Extended_Point{1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0} +const another_byte = u8(123) +const another_color = Color.red +const another_permission = Permissions.read | .write // test_read_bytes_into_newline_text tests reading text from a file with newlines. // This test simulates reading a larger text file step by step into a buffer and diff --git a/vlib/os/filepath.v b/vlib/os/filepath.v index 1a3ddac53f..0412508247 100644 --- a/vlib/os/filepath.v +++ b/vlib/os/filepath.v @@ -7,16 +7,14 @@ import strings.textscanner // The following functions handle paths depending on the operating system, // therefore results may be different for certain operating systems. -const ( - fslash = `/` - bslash = `\\` - dot = `.` - qmark = `?` - fslash_str = '/' - dot_dot = '..' - empty_str = '' - dot_str = '.' -) +const fslash = `/` +const bslash = `\\` +const dot = `.` +const qmark = `?` +const fslash_str = '/' +const dot_dot = '..' +const empty_str = '' +const dot_str = '.' // is_abs_path returns `true` if the given `path` is absolute. pub fn is_abs_path(path string) bool { diff --git a/vlib/os/inode_test.v b/vlib/os/inode_test.v index c29fb93af3..93bfd77861 100644 --- a/vlib/os/inode_test.v +++ b/vlib/os/inode_test.v @@ -1,11 +1,9 @@ import os -const ( - // tfolder will contain all the temporary files/subfolders made by - // the different tests. It would be removed in testsuite_end(), so - // individual os tests do not need to clean up after themselves. - tfolder = os.join_path(os.vtmp_dir(), 'tests', 'inode_test') -) +// tfolder will contain all the temporary files/subfolders made by +// the different tests. It would be removed in testsuite_end(), so +// individual os tests do not need to clean up after themselves. +const tfolder = os.join_path(os.vtmp_dir(), 'tests', 'inode_test') fn testsuite_begin() { eprintln('testsuite_begin, tfolder = ${tfolder}') diff --git a/vlib/os/notify/backend_darwin.c.v b/vlib/os/notify/backend_darwin.c.v index 733ccb1ded..0f336cad3e 100644 --- a/vlib/os/notify/backend_darwin.c.v +++ b/vlib/os/notify/backend_darwin.c.v @@ -48,44 +48,43 @@ pub fn new() !FdNotifier { return x } -const ( - // filter types - kqueue_read = i16(C.EVFILT_READ) - kqueue_write = i16(C.EVFILT_WRITE) - kqueue_aio = i16(C.EVFILT_AIO) - kqueue_vnode = i16(C.EVFILT_VNODE) - kqueue_proc = i16(C.EVFILT_PROC) - kqueue_signal = i16(C.EVFILT_SIGNAL) - kqueue_timer = i16(C.EVFILT_TIMER) - kqueue_machport = i16(C.EVFILT_MACHPORT) - kqueue_fs = i16(C.EVFILT_FS) - kqueue_user = i16(C.EVFILT_USER) - kqueue_vm = i16(C.EVFILT_VM) - kqueue_exception = i16(C.EVFILT_EXCEPT) - kqueue_syscount = i16(C.EVFILT_SYSCOUNT) +// filter types +const kqueue_read = i16(C.EVFILT_READ) +const kqueue_write = i16(C.EVFILT_WRITE) +const kqueue_aio = i16(C.EVFILT_AIO) +const kqueue_vnode = i16(C.EVFILT_VNODE) +const kqueue_proc = i16(C.EVFILT_PROC) +const kqueue_signal = i16(C.EVFILT_SIGNAL) +const kqueue_timer = i16(C.EVFILT_TIMER) +const kqueue_machport = i16(C.EVFILT_MACHPORT) +const kqueue_fs = i16(C.EVFILT_FS) +const kqueue_user = i16(C.EVFILT_USER) +const kqueue_vm = i16(C.EVFILT_VM) +const kqueue_exception = i16(C.EVFILT_EXCEPT) +const kqueue_syscount = i16(C.EVFILT_SYSCOUNT) - // actions - kqueue_add = u16(C.EV_ADD) - kqueue_delete = u16(C.EV_DELETE) - kqueue_enable = u16(C.EV_ENABLE) - kqueue_disable = u16(C.EV_DISABLE) +// actions +const kqueue_add = u16(C.EV_ADD) +const kqueue_delete = u16(C.EV_DELETE) +const kqueue_enable = u16(C.EV_ENABLE) +const kqueue_disable = u16(C.EV_DISABLE) - // flags - kqueue_oneshot = u16(C.EV_ONESHOT) - kqueue_edge_trigger = u16(C.EV_CLEAR) // kqueue_clear - kqueue_receipt = u16(C.EV_RECEIPT) - kqueue_dispatch = u16(C.EV_DISPATCH) - kqueue_udata_specific = u16(C.EV_UDATA_SPECIFIC) - kqueue_dispatch2 = u16(C.EV_DISPATCH | C.EV_UDATA_SPECIFIC) - kqueue_vanished = u16(C.EV_VANISHED) - kqueue_sysflags = u16(C.EV_SYSFLAGS) - kqueue_flag0 = u16(C.EV_FLAG0) - kqueue_flag1 = u16(C.EV_FLAG1) +// flags +const kqueue_oneshot = u16(C.EV_ONESHOT) +const kqueue_edge_trigger = u16(C.EV_CLEAR) // kqueue_clear - // returned values - kqueue_eof = u16(C.EV_EOF) - kqueue_error = u16(C.EV_ERROR) -) +const kqueue_receipt = u16(C.EV_RECEIPT) +const kqueue_dispatch = u16(C.EV_DISPATCH) +const kqueue_udata_specific = u16(C.EV_UDATA_SPECIFIC) +const kqueue_dispatch2 = u16(C.EV_DISPATCH | C.EV_UDATA_SPECIFIC) +const kqueue_vanished = u16(C.EV_VANISHED) +const kqueue_sysflags = u16(C.EV_SYSFLAGS) +const kqueue_flag0 = u16(C.EV_FLAG0) +const kqueue_flag1 = u16(C.EV_FLAG1) + +// returned values +const kqueue_eof = u16(C.EV_EOF) +const kqueue_error = u16(C.EV_ERROR) // ctl is a helper method for add, modify, and remove fn (mut kn KqueueNotifier) ctl(fd int, filter i16, flags u16) ! { diff --git a/vlib/os/notify/backend_linux.c.v b/vlib/os/notify/backend_linux.c.v index 35521471ee..716da3ada7 100644 --- a/vlib/os/notify/backend_linux.c.v +++ b/vlib/os/notify/backend_linux.c.v @@ -53,18 +53,16 @@ pub fn new() !FdNotifier { return x } -const ( - epoll_read = u32(C.EPOLLIN) - epoll_write = u32(C.EPOLLOUT) - epoll_peer_hangup = u32(C.EPOLLRDHUP) - epoll_exception = u32(C.EPOLLPRI) - epoll_error = u32(C.EPOLLERR) - epoll_hangup = u32(C.EPOLLHUP) - epoll_edge_trigger = u32(C.EPOLLET) - epoll_one_shot = u32(C.EPOLLONESHOT) - epoll_wake_up = u32(C.EPOLLWAKEUP) - epoll_exclusive = u32(C.EPOLLEXCLUSIVE) -) +const epoll_read = u32(C.EPOLLIN) +const epoll_write = u32(C.EPOLLOUT) +const epoll_peer_hangup = u32(C.EPOLLRDHUP) +const epoll_exception = u32(C.EPOLLPRI) +const epoll_error = u32(C.EPOLLERR) +const epoll_hangup = u32(C.EPOLLHUP) +const epoll_edge_trigger = u32(C.EPOLLET) +const epoll_one_shot = u32(C.EPOLLONESHOT) +const epoll_wake_up = u32(C.EPOLLWAKEUP) +const epoll_exclusive = u32(C.EPOLLEXCLUSIVE) // ctl is a helper method for add, modify, and remove fn (mut en EpollNotifier) ctl(fd int, op int, mask u32) ! { diff --git a/vlib/os/os.c.v b/vlib/os/os.c.v index 265e6e16f3..712bc71bec 100644 --- a/vlib/os/os.c.v +++ b/vlib/os/os.c.v @@ -9,9 +9,7 @@ $if freebsd { #include } -pub const ( - args = []string{} -) +pub const args = []string{} fn C.readdir(voidptr) &C.dirent diff --git a/vlib/os/os.js.v b/vlib/os/os.js.v index e16f27a21f..ad177c161d 100644 --- a/vlib/os/os.js.v +++ b/vlib/os/os.js.v @@ -6,11 +6,9 @@ $if js_node { #var tty = require('tty') } -pub const ( - path_delimiter = get_path_delimiter() - path_separator = get_path_separator() - args = []string{} -) +pub const path_delimiter = get_path_delimiter() +pub const path_separator = get_path_separator() +pub const args = []string{} const executable_suffixes = [''] diff --git a/vlib/os/os_darwin.c.v b/vlib/os/os_darwin.c.v index 8fbae15b6d..67ac6afd24 100644 --- a/vlib/os/os_darwin.c.v +++ b/vlib/os/os_darwin.c.v @@ -3,12 +3,10 @@ // that can be found in the LICENSE file. module os -pub const ( - sys_write = 4 - sys_open = 5 - sys_close = 6 - sys_mkdir = 136 - sys_creat = 8 - sys_open_nocancel = 398 - sys_stat64 = 338 -) +pub const sys_write = 4 +pub const sys_open = 5 +pub const sys_close = 6 +pub const sys_mkdir = 136 +pub const sys_creat = 8 +pub const sys_open_nocancel = 398 +pub const sys_stat64 = 338 diff --git a/vlib/os/os_linux.c.v b/vlib/os/os_linux.c.v index bb1f927358..c93ae1cf3e 100644 --- a/vlib/os/os_linux.c.v +++ b/vlib/os/os_linux.c.v @@ -3,17 +3,13 @@ // that can be found in the LICENSE file. module os -const ( - prot_read = 1 - prot_write = 2 - map_private = 0x02 - map_anonymous = 0x20 -) +const prot_read = 1 +const prot_write = 2 +const map_private = 0x02 +const map_anonymous = 0x20 -pub const ( - sys_write = 1 - sys_open = 2 - sys_close = 3 - sys_mkdir = 83 - sys_creat = 85 -) +pub const sys_write = 1 +pub const sys_open = 2 +pub const sys_close = 3 +pub const sys_mkdir = 83 +pub const sys_creat = 85 diff --git a/vlib/os/os_nix.c.v b/vlib/os/os_nix.c.v index 8eec04bc06..be116780c1 100644 --- a/vlib/os/os_nix.c.v +++ b/vlib/os/os_nix.c.v @@ -9,38 +9,46 @@ import strings #include #include -pub const ( - path_separator = '/' - path_delimiter = ':' -) +pub const path_separator = '/' +pub const path_delimiter = ':' const executable_suffixes = [''] -const ( - stdin_value = 0 - stdout_value = 1 - stderr_value = 2 -) +const stdin_value = 0 +const stdout_value = 1 +const stderr_value = 2 // (Must be realized in Syscall) (Must be specified) // ref: http://www.ccfit.nsu.ru/~deviv/courses/unix/unix/ng7c229.html -pub const ( - s_ifmt = 0xF000 // type of file - s_ifdir = 0x4000 // directory - s_iflnk = 0xa000 // link - s_isuid = 0o4000 // SUID - s_isgid = 0o2000 // SGID - s_isvtx = 0o1000 // Sticky - s_irusr = 0o0400 // Read by owner - s_iwusr = 0o0200 // Write by owner - s_ixusr = 0o0100 // Execute by owner - s_irgrp = 0o0040 // Read by group - s_iwgrp = 0o0020 // Write by group - s_ixgrp = 0o0010 // Execute by group - s_iroth = 0o0004 // Read by others - s_iwoth = 0o0002 // Write by others - s_ixoth = 0o0001 // Execute by others -) +pub const s_ifmt = 0xF000 // type of file + +pub const s_ifdir = 0x4000 // directory + +pub const s_iflnk = 0xa000 // link + +pub const s_isuid = 0o4000 // SUID + +pub const s_isgid = 0o2000 // SGID + +pub const s_isvtx = 0o1000 // Sticky + +pub const s_irusr = 0o0400 // Read by owner + +pub const s_iwusr = 0o0200 // Write by owner + +pub const s_ixusr = 0o0100 // Execute by owner + +pub const s_irgrp = 0o0040 // Read by group + +pub const s_iwgrp = 0o0020 // Write by group + +pub const s_ixgrp = 0o0010 // Execute by group + +pub const s_iroth = 0o0004 // Read by others + +pub const s_iwoth = 0o0002 // Write by others + +pub const s_ixoth = 0o0001 fn C.utime(&char, voidptr) int diff --git a/vlib/os/os_test.c.v b/vlib/os/os_test.c.v index 5a04330228..31feffc37e 100644 --- a/vlib/os/os_test.c.v +++ b/vlib/os/os_test.c.v @@ -1,12 +1,10 @@ import os import time -const ( - // tfolder will contain all the temporary files/subfolders made by - // the different tests. It would be removed in testsuite_end(), so - // individual os tests do not need to clean up after themselves. - tfolder = os.join_path(os.vtmp_dir(), 'tests', 'os_test') -) +// tfolder will contain all the temporary files/subfolders made by +// the different tests. It would be removed in testsuite_end(), so +// individual os tests do not need to clean up after themselves. +const tfolder = os.join_path(os.vtmp_dir(), 'tests', 'os_test') // os.args has to be *already initialized* with the program's argc/argv at this point // thus it can be used for other consts too: diff --git a/vlib/os/os_windows.c.v b/vlib/os/os_windows.c.v index 9a2538d195..6e2e8f1996 100644 --- a/vlib/os/os_windows.c.v +++ b/vlib/os/os_windows.c.v @@ -16,10 +16,8 @@ fn C._getpid() int const executable_suffixes = ['.exe', '.bat', '.cmd', ''] -pub const ( - path_separator = '\\' - path_delimiter = ';' -) +pub const path_separator = '\\' +pub const path_delimiter = ';' // Ref - https://docs.microsoft.com/en-us/windows/desktop/winprog/windows-data-types // A handle to an object. @@ -236,26 +234,20 @@ pub fn get_module_filename(handle HANDLE) !string { } // Ref - https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-FormatMessageWa#parameters -const ( - format_message_allocate_buffer = 0x00000100 - format_message_argument_array = 0x00002000 - format_message_from_hmodule = 0x00000800 - format_message_from_string = 0x00000400 - format_message_from_system = 0x00001000 - format_message_ignore_inserts = 0x00000200 -) +const format_message_allocate_buffer = 0x00000100 +const format_message_argument_array = 0x00002000 +const format_message_from_hmodule = 0x00000800 +const format_message_from_string = 0x00000400 +const format_message_from_system = 0x00001000 +const format_message_ignore_inserts = 0x00000200 // Ref - winnt.h -const ( - sublang_neutral = 0x00 - sublang_default = 0x01 - lang_neutral = sublang_neutral -) +const sublang_neutral = 0x00 +const sublang_default = 0x01 +const lang_neutral = sublang_neutral // Ref - https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes--12000-15999- -const ( - max_error_code = 15841 // ERROR_API_UNAVAILABLE -) +const max_error_code = 15841 // ptr_win_get_error_msg return string (voidptr) // representation of error, only for windows. diff --git a/vlib/os/process_test.v b/vlib/os/process_test.v index 77695d473d..c278e70258 100644 --- a/vlib/os/process_test.v +++ b/vlib/os/process_test.v @@ -3,13 +3,11 @@ import os import time -const ( - vexe = os.getenv('VEXE') - vroot = os.dir(vexe) - tfolder = os.join_path(os.vtmp_dir(), 'tests', 'os_process') - test_os_process = os.join_path(tfolder, 'test_os_process.exe') - test_os_process_source = os.join_path(vroot, 'cmd/tools/test_os_process.v') -) +const vexe = os.getenv('VEXE') +const vroot = os.dir(vexe) +const tfolder = os.join_path(os.vtmp_dir(), 'tests', 'os_process') +const test_os_process = os.join_path(tfolder, 'test_os_process.exe') +const test_os_process_source = os.join_path(vroot, 'cmd/tools/test_os_process.v') fn testsuite_begin() { os.rmdir_all(tfolder) or {} diff --git a/vlib/picoev/picoev.v b/vlib/picoev/picoev.v index 9379b23a17..3e2150e7e6 100644 --- a/vlib/picoev/picoev.v +++ b/vlib/picoev/picoev.v @@ -3,18 +3,16 @@ module picoev import picohttpparser import time -pub const ( - max_fds = 1024 - max_queue = 4096 +pub const max_fds = 1024 +pub const max_queue = 4096 - // events - picoev_read = 1 - picoev_write = 2 - picoev_timeout = 4 - picoev_add = 0x40000000 - picoev_del = 0x20000000 - picoev_readwrite = 3 // 1 xor 2 -) +// events +pub const picoev_read = 1 +pub const picoev_write = 2 +pub const picoev_timeout = 4 +pub const picoev_add = 0x40000000 +pub const picoev_del = 0x20000000 +pub const picoev_readwrite = 3 // Target is a data representation of everything that needs to be associated with a single // file descriptor (connection) diff --git a/vlib/picohttpparser/misc.v b/vlib/picohttpparser/misc.v index dcee15a3c2..c379adb435 100644 --- a/vlib/picohttpparser/misc.v +++ b/vlib/picohttpparser/misc.v @@ -1,21 +1,208 @@ module picohttpparser -const ( - // vfmt off - g_digits_lut = [ - `0`,`0`,`0`,`1`,`0`,`2`,`0`,`3`,`0`,`4`,`0`,`5`,`0`,`6`,`0`,`7`,`0`,`8`,`0`,`9`, - `1`,`0`,`1`,`1`,`1`,`2`,`1`,`3`,`1`,`4`,`1`,`5`,`1`,`6`,`1`,`7`,`1`,`8`,`1`,`9`, - `2`,`0`,`2`,`1`,`2`,`2`,`2`,`3`,`2`,`4`,`2`,`5`,`2`,`6`,`2`,`7`,`2`,`8`,`2`,`9`, - `3`,`0`,`3`,`1`,`3`,`2`,`3`,`3`,`3`,`4`,`3`,`5`,`3`,`6`,`3`,`7`,`3`,`8`,`3`,`9`, - `4`,`0`,`4`,`1`,`4`,`2`,`4`,`3`,`4`,`4`,`4`,`5`,`4`,`6`,`4`,`7`,`4`,`8`,`4`,`9`, - `5`,`0`,`5`,`1`,`5`,`2`,`5`,`3`,`5`,`4`,`5`,`5`,`5`,`6`,`5`,`7`,`5`,`8`,`5`,`9`, - `6`,`0`,`6`,`1`,`6`,`2`,`6`,`3`,`6`,`4`,`6`,`5`,`6`,`6`,`6`,`7`,`6`,`8`,`6`,`9`, - `7`,`0`,`7`,`1`,`7`,`2`,`7`,`3`,`7`,`4`,`7`,`5`,`7`,`6`,`7`,`7`,`7`,`8`,`7`,`9`, - `8`,`0`,`8`,`1`,`8`,`2`,`8`,`3`,`8`,`4`,`8`,`5`,`8`,`6`,`8`,`7`,`8`,`8`,`8`,`9`, - `9`,`0`,`9`,`1`,`9`,`2`,`9`,`3`,`9`,`4`,`9`,`5`,`9`,`6`,`9`,`7`,`9`,`8`,`9`,`9` - ] - // vfmt on -) +// vfmt off +const g_digits_lut = [ + `0`, + `0`, + `0`, + `1`, + `0`, + `2`, + `0`, + `3`, + `0`, + `4`, + `0`, + `5`, + `0`, + `6`, + `0`, + `7`, + `0`, + `8`, + `0`, + `9`, + `1`, + `0`, + `1`, + `1`, + `1`, + `2`, + `1`, + `3`, + `1`, + `4`, + `1`, + `5`, + `1`, + `6`, + `1`, + `7`, + `1`, + `8`, + `1`, + `9`, + `2`, + `0`, + `2`, + `1`, + `2`, + `2`, + `2`, + `3`, + `2`, + `4`, + `2`, + `5`, + `2`, + `6`, + `2`, + `7`, + `2`, + `8`, + `2`, + `9`, + `3`, + `0`, + `3`, + `1`, + `3`, + `2`, + `3`, + `3`, + `3`, + `4`, + `3`, + `5`, + `3`, + `6`, + `3`, + `7`, + `3`, + `8`, + `3`, + `9`, + `4`, + `0`, + `4`, + `1`, + `4`, + `2`, + `4`, + `3`, + `4`, + `4`, + `4`, + `5`, + `4`, + `6`, + `4`, + `7`, + `4`, + `8`, + `4`, + `9`, + `5`, + `0`, + `5`, + `1`, + `5`, + `2`, + `5`, + `3`, + `5`, + `4`, + `5`, + `5`, + `5`, + `6`, + `5`, + `7`, + `5`, + `8`, + `5`, + `9`, + `6`, + `0`, + `6`, + `1`, + `6`, + `2`, + `6`, + `3`, + `6`, + `4`, + `6`, + `5`, + `6`, + `6`, + `6`, + `7`, + `6`, + `8`, + `6`, + `9`, + `7`, + `0`, + `7`, + `1`, + `7`, + `2`, + `7`, + `3`, + `7`, + `4`, + `7`, + `5`, + `7`, + `6`, + `7`, + `7`, + `7`, + `8`, + `7`, + `9`, + `8`, + `0`, + `8`, + `1`, + `8`, + `2`, + `8`, + `3`, + `8`, + `4`, + `8`, + `5`, + `8`, + `6`, + `8`, + `7`, + `8`, + `8`, + `8`, + `9`, + `9`, + `0`, + `9`, + `1`, + `9`, + `2`, + `9`, + `3`, + `9`, + `4`, + `9`, + `5`, + `9`, + `6`, + `9`, + `7`, + `9`, + `8`, + `9`, + `9`, +] // u64toa converts `value` to an ascii string and stores it at `buf_start` // then it returns the length of the ascii string (branch lookup table implementation) diff --git a/vlib/picohttpparser/picohttpparser.v b/vlib/picohttpparser/picohttpparser.v index 9ca7462cb9..f177d8abd1 100644 --- a/vlib/picohttpparser/picohttpparser.v +++ b/vlib/picohttpparser/picohttpparser.v @@ -3,17 +3,15 @@ module picohttpparser // NOTE: picohttpparser is designed for speed. Please do some benchmarks when // you change something in this file -const ( - // token_char_map contains all allowed characters in HTTP headers - token_char_map = '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0' + - '\0\1\0\1\1\1\1\1\0\0\1\1\0\1\1\0\1\1\1\1\1\1\1\1\1\1\0\0\0\0\0\0' + - '\0\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\0\0\0\1\1' + - '\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\0\1\0\1\0' + - '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0' + - '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0' + - '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0' + - '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0' -) +// token_char_map contains all allowed characters in HTTP headers +const token_char_map = '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0' + + '\0\1\0\1\1\1\1\1\0\0\1\1\0\1\1\0\1\1\1\1\1\1\1\1\1\1\0\0\0\0\0\0' + + '\0\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\0\0\0\1\1' + + '\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\0\1\0\1\0' + + '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0' + + '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0' + + '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0' + + '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0' fn (mut r Request) phr_parse_request_path(buf_start &u8, buf_end &u8, mut pret Pret) { mut buf := unsafe { buf_start + 0 } diff --git a/vlib/picohttpparser/request.v b/vlib/picohttpparser/request.v index 0a78b7cdf9..83468bce1d 100644 --- a/vlib/picohttpparser/request.v +++ b/vlib/picohttpparser/request.v @@ -1,8 +1,6 @@ module picohttpparser -const ( - max_headers = 100 -) +const max_headers = 100 pub struct Header { pub mut: diff --git a/vlib/rand/constants/constants.v b/vlib/rand/constants/constants.v index db3ee30493..1b2f0bf609 100644 --- a/vlib/rand/constants/constants.v +++ b/vlib/rand/constants/constants.v @@ -1,17 +1,15 @@ module constants // Commonly used constants across RNGs - some taken from "Numerical Recipes". -pub const ( - lower_mask = u64(0x00000000FFFFFFFF) - max_u32 = u32(0xFFFFFFFF) - max_u64 = u64(0xFFFFFFFFFFFFFFFF) - u31_mask = u32(0x7FFFFFFF) - u63_mask = u64(0x7FFFFFFFFFFFFFFF) - // 23 bits for f32 - ieee754_mantissa_f32_mask = (u32(1) << 23) - 1 - // 52 bits for f64 - ieee754_mantissa_f64_mask = (u64(1) << 52) - 1 - // smallest mantissa with exponent 0 (un normalized) - reciprocal_2_23rd = 1.0 / f64(u32(1) << 23) - reciprocal_2_52nd = 1.0 / f64(u64(1) << 52) -) +pub const lower_mask = u64(0x00000000FFFFFFFF) +pub const max_u32 = u32(0xFFFFFFFF) +pub const max_u64 = u64(0xFFFFFFFFFFFFFFFF) +pub const u31_mask = u32(0x7FFFFFFF) +pub const u63_mask = u64(0x7FFFFFFFFFFFFFFF) +// 23 bits for f32 +pub const ieee754_mantissa_f32_mask = (u32(1) << 23) - 1 +// 52 bits for f64 +pub const ieee754_mantissa_f64_mask = (u64(1) << 52) - 1 +// smallest mantissa with exponent 0 (un normalized) +pub const reciprocal_2_23rd = 1.0 / f64(u32(1) << 23) +pub const reciprocal_2_52nd = 1.0 / f64(u64(1) << 52) diff --git a/vlib/rand/dist_test.v b/vlib/rand/dist_test.v index 96afb8b25d..0209be6a18 100644 --- a/vlib/rand/dist_test.v +++ b/vlib/rand/dist_test.v @@ -1,15 +1,13 @@ import math import rand -const ( - // The sample size to be used - count = 2000 - // Accepted error is within 5% of the actual values. - error = 0.05 - // The seeds used (for reproducible testing) - seeds = [[u32(0xffff24), 0xabcd], [u32(0x141024), 0x42851], - [u32(0x1452), 0x90cd]] -) +// The sample size to be used +const count = 2000 +// Accepted error is within 5% of the actual values. +const error = 0.05 +// The seeds used (for reproducible testing) +const seeds = [[u32(0xffff24), 0xabcd], [u32(0x141024), 0x42851], + [u32(0x1452), 0x90cd]] fn test_bernoulli() { ps := [0.0, 0.1, 1.0 / 3.0, 0.5, 0.8, 17.0 / 18.0, 1.0] diff --git a/vlib/rand/fp_test.v b/vlib/rand/fp_test.v index e1edebb099..b955504a75 100644 --- a/vlib/rand/fp_test.v +++ b/vlib/rand/fp_test.v @@ -6,12 +6,10 @@ mut: ct int } -const ( - // The sample size to be used; keep cpu time less than 5 seconds - count = 9100100 - // Two sets of seeds - seeds = [[u32(2742798260), 2159764996], [u32(2135051596), 958016781]] -) +// The sample size to be used; keep cpu time less than 5 seconds +const count = 9100100 +// Two sets of seeds +const seeds = [[u32(2742798260), 2159764996], [u32(2135051596), 958016781]] fn test_f32() { mut histo := []Histo{} diff --git a/vlib/rand/mt19937/mt19937.v b/vlib/rand/mt19937/mt19937.v index 7c9a2c4510..c41c7ab0f9 100644 --- a/vlib/rand/mt19937/mt19937.v +++ b/vlib/rand/mt19937/mt19937.v @@ -49,14 +49,12 @@ C++ functions for MT19937, with initialization improved 2002/2/10. */ pub const seed_len = 2 -const ( - nn = 312 - mm = 156 - matrix_a = 0xB5026F5AA96619E9 - um = 0xFFFFFFFF80000000 - lm = 0x7FFFFFFF - inv_f64_limit = 1.0 / 9007199254740992.0 -) +const nn = 312 +const mm = 156 +const matrix_a = 0xB5026F5AA96619E9 +const um = 0xFFFFFFFF80000000 +const lm = 0x7FFFFFFF +const inv_f64_limit = 1.0 / 9007199254740992.0 // MT19937RNG is generator that uses the Mersenne Twister algorithm with period 2^19937. // **NOTE**: The RNG is not seeded when instantiated so remember to seed it before use. diff --git a/vlib/rand/mt19937/mt19937_test.v b/vlib/rand/mt19937/mt19937_test.v index 65a9d12bca..c1a42f171f 100644 --- a/vlib/rand/mt19937/mt19937_test.v +++ b/vlib/rand/mt19937/mt19937_test.v @@ -3,17 +3,13 @@ import rand import rand.mt19937 import rand.seed -const ( - range_limit = 40 - value_count = 1000 - seeds = [[u32(0xcafebabe), u32(0xdeadbeef)], [u32(0xc0de), u32(0xfeed)]] -) +const range_limit = 40 +const value_count = 1000 +const seeds = [[u32(0xcafebabe), u32(0xdeadbeef)], [u32(0xc0de), u32(0xfeed)]] -const ( - sample_size = 1000 - stats_epsilon = 0.05 - inv_sqrt_12 = 1.0 / math.sqrt(12) -) +const sample_size = 1000 +const stats_epsilon = 0.05 +const inv_sqrt_12 = 1.0 / math.sqrt(12) fn mt19937_basic_test() { mut rng := &rand.PRNG(&mt19937.MT19937RNG{}) diff --git a/vlib/rand/musl/musl_rng_test.v b/vlib/rand/musl/musl_rng_test.v index 1984306562..c52f94df91 100644 --- a/vlib/rand/musl/musl_rng_test.v +++ b/vlib/rand/musl/musl_rng_test.v @@ -3,17 +3,13 @@ import rand import rand.musl import rand.seed -const ( - range_limit = 40 - value_count = 1000 - seeds = [[u32(42)], [u32(256)]] -) +const range_limit = 40 +const value_count = 1000 +const seeds = [[u32(42)], [u32(256)]] -const ( - sample_size = 1000 - stats_epsilon = 0.05 - inv_sqrt_12 = 1.0 / math.sqrt(12) -) +const sample_size = 1000 +const stats_epsilon = 0.05 +const inv_sqrt_12 = 1.0 / math.sqrt(12) fn gen_randoms(seed_data []u32, bound int) []u64 { bound_u64 := u64(bound) diff --git a/vlib/rand/pcg32/pcg32_test.v b/vlib/rand/pcg32/pcg32_test.v index 98fd978487..dc184d88c7 100644 --- a/vlib/rand/pcg32/pcg32_test.v +++ b/vlib/rand/pcg32/pcg32_test.v @@ -3,17 +3,13 @@ import rand import rand.pcg32 import rand.seed -const ( - range_limit = 40 - value_count = 1000 - seeds = [[u32(42), 242, 267, 14195], [u32(256), 340, 1451, 1505]] -) +const range_limit = 40 +const value_count = 1000 +const seeds = [[u32(42), 242, 267, 14195], [u32(256), 340, 1451, 1505]] -const ( - sample_size = 1000 - stats_epsilon = 0.05 - inv_sqrt_12 = 1.0 / math.sqrt(12) -) +const sample_size = 1000 +const stats_epsilon = 0.05 +const inv_sqrt_12 = 1.0 / math.sqrt(12) fn gen_randoms(seed_data []u32, bound int) []u32 { mut randoms := []u32{len: 20} diff --git a/vlib/rand/rand.js.v b/vlib/rand/rand.js.v index 7fe4533511..9c33c7f1e1 100644 --- a/vlib/rand/rand.js.v +++ b/vlib/rand/rand.js.v @@ -16,9 +16,7 @@ fn internal_string_from_set(mut rng PRNG, charset string, len int) string { return result } -const ( - ulid_encoding = '0123456789ABCDEFGHJKMNPQRSTVWXYZ' -) +const ulid_encoding = '0123456789ABCDEFGHJKMNPQRSTVWXYZ' fn internal_ulid_at_millisecond(mut rng PRNG, unix_time_milli u64) string { mut buf := []u8{cap: 27} diff --git a/vlib/rand/rand.v b/vlib/rand/rand.v index 31717cfa6a..dac8c645c3 100644 --- a/vlib/rand/rand.v +++ b/vlib/rand/rand.v @@ -651,11 +651,9 @@ pub fn read(mut buf []u8) { read_internal(mut default_rng, mut buf) } -const ( - english_letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' - hex_chars = 'abcdef0123456789' - ascii_chars = '!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\\^_`abcdefghijklmnopqrstuvwxyz{|}~' -) +const english_letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' +const hex_chars = 'abcdef0123456789' +const ascii_chars = '!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\\^_`abcdefghijklmnopqrstuvwxyz{|}~' // ulid generates an Unique Lexicographically sortable IDentifier. // See https://github.com/ulid/spec . diff --git a/vlib/rand/random_numbers_test.v b/vlib/rand/random_numbers_test.v index 1ddbd80b80..ad7efa68ed 100644 --- a/vlib/rand/random_numbers_test.v +++ b/vlib/rand/random_numbers_test.v @@ -3,10 +3,8 @@ import rand.splitmix64 import rand.musl import rand.mt19937 -const ( - rnd_count = 40 - seeds = [[u32(42), 0], [u32(256), 0]] -) +const rnd_count = 40 +const seeds = [[u32(42), 0], [u32(256), 0]] fn get_n_random_ints(seed_data []u32, n int) []int { mut values := []int{cap: n} @@ -217,9 +215,7 @@ fn test_rand_u16() { // dump( all[32768] ) } -const ( - string_count = 25 -) +const string_count = 25 fn test_rand_string_from_set() { sets := [ diff --git a/vlib/rand/splitmix64/splitmix64_test.v b/vlib/rand/splitmix64/splitmix64_test.v index 0edf704d7b..405d2acd43 100644 --- a/vlib/rand/splitmix64/splitmix64_test.v +++ b/vlib/rand/splitmix64/splitmix64_test.v @@ -3,17 +3,13 @@ import rand import rand.splitmix64 import rand.seed -const ( - range_limit = 40 - value_count = 1000 - seeds = [[u32(42), 0], [u32(256), 0]] -) +const range_limit = 40 +const value_count = 1000 +const seeds = [[u32(42), 0], [u32(256), 0]] -const ( - sample_size = 1000 - stats_epsilon = 0.05 - inv_sqrt_12 = 1.0 / math.sqrt(12) -) +const sample_size = 1000 +const stats_epsilon = 0.05 +const inv_sqrt_12 = 1.0 / math.sqrt(12) fn gen_randoms(seed_data []u32, bound int) []u64 { bound_u64 := u64(bound) diff --git a/vlib/rand/sys/system_rng.c.v b/vlib/rand/sys/system_rng.c.v index b90d820399..668e328a17 100644 --- a/vlib/rand/sys/system_rng.c.v +++ b/vlib/rand/sys/system_rng.c.v @@ -20,14 +20,12 @@ import rand.seed pub const seed_len = 1 -const ( - rand_limit = u64(C.RAND_MAX) - rand_bitsize = bits.len_64(rand_limit) - rand_bytesize = rand_bitsize / 8 - u16_iter_count = calculate_iterations_for(16) - u32_iter_count = calculate_iterations_for(32) - u64_iter_count = calculate_iterations_for(64) -) +const rand_limit = u64(C.RAND_MAX) +const rand_bitsize = bits.len_64(rand_limit) +const rand_bytesize = rand_bitsize / 8 +const u16_iter_count = calculate_iterations_for(16) +const u32_iter_count = calculate_iterations_for(32) +const u64_iter_count = calculate_iterations_for(64) fn calculate_iterations_for(bits_ int) int { base := bits_ / sys.rand_bitsize diff --git a/vlib/rand/sys/system_rng_test.v b/vlib/rand/sys/system_rng_test.v index 8d0866b71c..3a4fb3aea9 100644 --- a/vlib/rand/sys/system_rng_test.v +++ b/vlib/rand/sys/system_rng_test.v @@ -2,17 +2,13 @@ import math import rand import rand.sys -const ( - range_limit = 40 - value_count = 1000 - seeds = [u32(42), 256] -) +const range_limit = 40 +const value_count = 1000 +const seeds = [u32(42), 256] -const ( - sample_size = 1000 - stats_epsilon = 0.05 - inv_sqrt_12 = 1.0 / math.sqrt(12) -) +const sample_size = 1000 +const stats_epsilon = 0.05 +const inv_sqrt_12 = 1.0 / math.sqrt(12) fn get_n_randoms(n int, mut r rand.PRNG) []int { mut ints := []int{cap: n} diff --git a/vlib/rand/wyrand/wyrand.v b/vlib/rand/wyrand/wyrand.v index 2058ea0d1b..25808afb5b 100644 --- a/vlib/rand/wyrand/wyrand.v +++ b/vlib/rand/wyrand/wyrand.v @@ -8,10 +8,8 @@ import rand.buffer import rand.seed // Redefinition of some constants that we will need for pseudorandom number generation. -const ( - wyp0 = u64(0xa0761d6478bd642f) - wyp1 = u64(0xe7037ed1a0b428db) -) +const wyp0 = u64(0xa0761d6478bd642f) +const wyp1 = u64(0xe7037ed1a0b428db) pub const seed_len = 2 diff --git a/vlib/rand/wyrand/wyrand_test.v b/vlib/rand/wyrand/wyrand_test.v index 13350ddf3a..f5386eb745 100644 --- a/vlib/rand/wyrand/wyrand_test.v +++ b/vlib/rand/wyrand/wyrand_test.v @@ -3,17 +3,13 @@ import rand import rand.seed import rand.wyrand -const ( - range_limit = 40 - value_count = 1000 - seeds = [[u32(42), 0], [u32(256), 0]] -) +const range_limit = 40 +const value_count = 1000 +const seeds = [[u32(42), 0], [u32(256), 0]] -const ( - sample_size = 1000 - stats_epsilon = 0.05 - inv_sqrt_12 = 1.0 / math.sqrt(12) -) +const sample_size = 1000 +const stats_epsilon = 0.05 +const inv_sqrt_12 = 1.0 / math.sqrt(12) fn gen_randoms(seed_data []u32, bound int) []u64 { bound_u64 := u64(bound) diff --git a/vlib/rand/xoroshiro128pp/xoros128pp_test.v b/vlib/rand/xoroshiro128pp/xoros128pp_test.v index 3885c8920f..e09b83ed6e 100644 --- a/vlib/rand/xoroshiro128pp/xoros128pp_test.v +++ b/vlib/rand/xoroshiro128pp/xoros128pp_test.v @@ -4,17 +4,13 @@ import math import rand import rand.seed -const ( - range_limit = 40 - value_count = 1000 - seeds = [[u32(42), 242, 267, 14195], [u32(256), 340, 1451, 1505]] -) +const range_limit = 40 +const value_count = 1000 +const seeds = [[u32(42), 242, 267, 14195], [u32(256), 340, 1451, 1505]] -const ( - sample_size = 1000 - stats_epsilon = 0.05 - inv_sqrt_12 = 1.0 / math.sqrt(12) -) +const sample_size = 1000 +const stats_epsilon = 0.05 +const inv_sqrt_12 = 1.0 / math.sqrt(12) fn gen_randoms(seed_data []u32, bound int) []u32 { mut randoms := []u32{len: 20} diff --git a/vlib/regex/regex.v b/vlib/regex/regex.v index 1637579a32..ae7c54722e 100644 --- a/vlib/regex/regex.v +++ b/vlib/regex/regex.v @@ -16,59 +16,77 @@ module regex import strings -pub const ( - v_regex_version = '1.0 alpha' // regex module version +pub const v_regex_version = '1.0 alpha' // regex module version - max_code_len = 256 // default small base code len for the regex programs - max_quantifier = 1073741824 // default max repetitions allowed for the quantifiers = 2^30 - // spaces chars (here only westerns!!) TODO: manage all the spaces from unicode - spaces = [` `, `\t`, `\n`, `\r`, `\v`, `\f`] - // new line chars for now only '\n' - new_line_list = [`\n`, `\r`] +pub const max_code_len = 256 // default small base code len for the regex programs - // Results - no_match_found = -1 +pub const max_quantifier = 1073741824 // default max repetitions allowed for the quantifiers = 2^30 - // Errors - compile_ok = 0 // the regex string compiled, all ok - err_char_unknown = -2 // the char used is unknow to the system - err_undefined = -3 // the compiler symbol is undefined - err_internal_error = -4 // Bug in the regex system!! - err_cc_alloc_overflow = -5 // memory for char class full!! - err_syntax_error = -6 // syntax error in regex compiling - err_groups_overflow = -7 // max number of groups reached - err_groups_max_nested = -8 // max number of nested group reached - err_group_not_balanced = -9 // group not balanced - err_group_qm_notation = -10 // group invalid notation - err_invalid_or_with_cc = -11 // invalid or on two consecutive char class - err_neg_group_quantifier = -12 // negation groups can not have quantifier - err_consecutive_dots = -13 // two consecutive dots is an error -) +// spaces chars (here only westerns!!) TODO: manage all the spaces from unicode +pub const spaces = [` `, `\t`, `\n`, `\r`, `\v`, `\f`] +// new line chars for now only '\n' +pub const new_line_list = [`\n`, `\r`] -const ( - //************************************* - // regex program instructions - //************************************* - ist_simple_char = u32(0x7FFFFFFF) // single char instruction, 31 bit available to char - // char class 11 0100 AA xxxxxxxx - // AA = 00 regular class - // AA = 01 Negated class ^ char - ist_char_class = u32(0xD1000000) // MASK - ist_char_class_pos = u32(0xD0000000) // char class normal [abc] - ist_char_class_neg = u32(0xD1000000) // char class negate [^abc] - // dot char 10 0110 xx xxxxxxxx - ist_dot_char = u32(0x98000000) // match any char except \n - // backslash chars 10 0100 xx xxxxxxxx - ist_bsls_char = u32(0x90000000) // backslash char - // OR | 10 010Y xx xxxxxxxx - ist_or_branch = u32(0x91000000) // OR case - // groups 10 010Y xx xxxxxxxx - ist_group_start = u32(0x92000000) // group start ( - ist_group_end = u32(0x94000000) // group end ) - // control instructions - ist_prog_end = u32(0x88000000) // 10 0010 xx xxxxxxxx - //************************************* -) +// Results +pub const no_match_found = -1 + +// Errors +pub const compile_ok = 0 // the regex string compiled, all ok + +pub const err_char_unknown = -2 // the char used is unknow to the system + +pub const err_undefined = -3 // the compiler symbol is undefined + +pub const err_internal_error = -4 // Bug in the regex system!! + +pub const err_cc_alloc_overflow = -5 // memory for char class full!! + +pub const err_syntax_error = -6 // syntax error in regex compiling + +pub const err_groups_overflow = -7 // max number of groups reached + +pub const err_groups_max_nested = -8 // max number of nested group reached + +pub const err_group_not_balanced = -9 // group not balanced + +pub const err_group_qm_notation = -10 // group invalid notation + +pub const err_invalid_or_with_cc = -11 // invalid or on two consecutive char class + +pub const err_neg_group_quantifier = -12 // negation groups can not have quantifier + +pub const err_consecutive_dots = -13 + +//************************************* +// regex program instructions +//************************************* +const ist_simple_char = u32(0x7FFFFFFF) // single char instruction, 31 bit available to char + +// char class 11 0100 AA xxxxxxxx +// AA = 00 regular class +// AA = 01 Negated class ^ char +const ist_char_class = u32(0xD1000000) // MASK + +const ist_char_class_pos = u32(0xD0000000) // char class normal [abc] + +const ist_char_class_neg = u32(0xD1000000) // char class negate [^abc] + +// dot char 10 0110 xx xxxxxxxx +const ist_dot_char = u32(0x98000000) // match any char except \n + +// backslash chars 10 0100 xx xxxxxxxx +const ist_bsls_char = u32(0x90000000) // backslash char + +// OR | 10 010Y xx xxxxxxxx +const ist_or_branch = u32(0x91000000) // OR case + +// groups 10 010Y xx xxxxxxxx +const ist_group_start = u32(0x92000000) // group start ( + +const ist_group_end = u32(0x94000000) // group end ) + +// control instructions +const ist_prog_end = u32(0x88000000) /* General Utilities @@ -275,16 +293,18 @@ fn (mut tok Token) reset() { * Regex struct * ******************************************************************************/ -pub const ( - f_nl = 0x00000001 // end the match when find a new line symbol - f_ms = 0x00000002 // match true only if the match is at the start of the string - f_me = 0x00000004 // match true only if the match is at the end of the string +pub const f_nl = 0x00000001 // end the match when find a new line symbol - f_efm = 0x00000100 // exit on first token matched, used by search - f_bin = 0x00000200 // work only on bytes, ignore utf-8 - // behaviour modifier flags - f_src = 0x00020000 // search mode enabled -) +pub const f_ms = 0x00000002 // match true only if the match is at the start of the string + +pub const f_me = 0x00000004 // match true only if the match is at the end of the string + +pub const f_efm = 0x00000100 // exit on first token matched, used by search + +pub const f_bin = 0x00000200 // work only on bytes, ignore utf-8 + +// behaviour modifier flags +pub const f_src = 0x00020000 // Log function prototype pub type FnLog = fn (string) @@ -379,22 +399,20 @@ struct BslsStruct { validator FnValidator = unsafe { nil } // validator function pointer } -const ( - bsls_validator_array = [ - BslsStruct{`w`, is_alnum}, - BslsStruct{`W`, is_not_alnum}, - BslsStruct{`s`, is_space}, - BslsStruct{`S`, is_not_space}, - BslsStruct{`d`, is_digit}, - BslsStruct{`D`, is_not_digit}, - BslsStruct{`a`, is_lower}, - BslsStruct{`A`, is_upper}, - ] +const bsls_validator_array = [ + BslsStruct{`w`, is_alnum}, + BslsStruct{`W`, is_not_alnum}, + BslsStruct{`s`, is_space}, + BslsStruct{`S`, is_not_space}, + BslsStruct{`d`, is_digit}, + BslsStruct{`D`, is_not_digit}, + BslsStruct{`a`, is_lower}, + BslsStruct{`A`, is_upper}, +] - // these chars are escape if preceded by a \ - bsls_escape_list = [`\\`, `|`, `.`, `:`, `*`, `+`, `-`, `{`, `}`, `[`, `]`, `(`, `)`, `?`, - `^`, `!`] -) +// these chars are escape if preceded by a \ +const bsls_escape_list = [`\\`, `|`, `.`, `:`, `*`, `+`, `-`, `{`, `}`, `[`, `]`, `(`, `)`, `?`, + `^`, `!`] enum BSLS_parse_state { start @@ -450,13 +468,15 @@ fn (re RE) parse_bsls(in_txt string, in_i int) (int, int) { * Char class * ******************************************************************************/ -const ( - cc_null = 0 // empty cc token - cc_char = 1 // simple char: a - cc_int = 2 // char interval: a-z - cc_bsls = 3 // backslash char - cc_end = 4 // cc sequence terminator -) +const cc_null = 0 // empty cc token + +const cc_char = 1 // simple char: a + +const cc_int = 2 // char interval: a-z + +const cc_bsls = 3 // backslash char + +const cc_end = 4 struct CharClass { mut: @@ -910,9 +930,7 @@ fn (re RE) parse_groups(in_txt string, in_i int) (int, bool, bool, string, int) return -2, true, false, name, i } -const ( - quntifier_chars = [rune(`+`), `*`, `?`, `{`] -) +const quntifier_chars = [rune(`+`), `*`, `?`, `{`] // // main compiler diff --git a/vlib/regex/regex_test.v b/vlib/regex/regex_test.v index 942ab500a4..1bbf892104 100644 --- a/vlib/regex/regex_test.v +++ b/vlib/regex/regex_test.v @@ -776,17 +776,15 @@ fn rest_regex_replace_n() { } // test quantifier wrong sequences -const ( - test_quantifier_sequences_list = [ - r'+{3}.*+{3}', - r'+{3}.*?{3}', - r'+{3}.**{3}', - r'+{3}.*\+{3}*', - r'+{3}.*\+{3}+', - r'+{3}.*\+{3}??', - r'+{3}.*\+{3}{4}', - ] -) +const test_quantifier_sequences_list = [ + r'+{3}.*+{3}', + r'+{3}.*?{3}', + r'+{3}.**{3}', + r'+{3}.*\+{3}*', + r'+{3}.*\+{3}+', + r'+{3}.*\+{3}??', + r'+{3}.*\+{3}{4}', +] fn test_quantifier_sequences() { for pattern in test_quantifier_sequences_list { @@ -863,11 +861,9 @@ fn test_groups_in_find() { } } -const ( - err_query_list = [ - r'([a]|[b])*', - ] -) +const err_query_list = [ + r'([a]|[b])*', +] fn test_errors() { mut count := 0 @@ -923,16 +919,14 @@ struct Test_negation_group { res bool } -const ( - negation_groups = [ - Test_negation_group{'automobile', false}, - Test_negation_group{'botomobile', true}, - Test_negation_group{'auto_caravan', false}, - Test_negation_group{'moto_mobile', true}, - Test_negation_group{'pippole', true}, - Test_negation_group{'boring test', false}, - ] -) +const negation_groups = [ + Test_negation_group{'automobile', false}, + Test_negation_group{'botomobile', true}, + Test_negation_group{'auto_caravan', false}, + Test_negation_group{'moto_mobile', true}, + Test_negation_group{'pippole', true}, + Test_negation_group{'boring test', false}, +] fn test_negation_groups() { mut query := r'(?!auto)\w+le' diff --git a/vlib/semver/parse.v b/vlib/semver/parse.v index 3db05fd636..8e8f166c75 100644 --- a/vlib/semver/parse.v +++ b/vlib/semver/parse.v @@ -8,12 +8,10 @@ mut: raw_ints []string } -const ( - ver_major = 0 - ver_minor = 1 - ver_patch = 2 - versions = [ver_major, ver_minor, ver_patch] -) +const ver_major = 0 +const ver_minor = 1 +const ver_patch = 2 +const versions = [ver_major, ver_minor, ver_patch] // TODO: Rewrite using regexps? // /(\d+)\.(\d+)\.(\d+)(?:\-([0-9A-Za-z-.]+))?(?:\+([0-9A-Za-z-]+))?/ diff --git a/vlib/semver/range.v b/vlib/semver/range.v index 4174cb3e0b..00d555a9ad 100644 --- a/vlib/semver/range.v +++ b/vlib/semver/range.v @@ -1,12 +1,10 @@ module semver // * Private functions. -const ( - comparator_sep = ' ' - comparator_set_sep = ' || ' - hyphen_range_sep = ' - ' - x_range_symbols = 'Xx*' -) +const comparator_sep = ' ' +const comparator_set_sep = ' || ' +const hyphen_range_sep = ' - ' +const x_range_symbols = 'Xx*' enum Operator { gt diff --git a/vlib/semver/semver_test.v b/vlib/semver/semver_test.v index 286a6c3eb3..f3bc29ec61 100644 --- a/vlib/semver/semver_test.v +++ b/vlib/semver/semver_test.v @@ -20,60 +20,58 @@ struct TestCoerce { valid string } -const ( - versions_to_test = [ - TestVersion{'1.2.4', 1, 2, 4, '', ''}, - TestVersion{'1.2.4-prerelease-1', 1, 2, 4, 'prerelease-1', ''}, - TestVersion{'1.2.4+20191231', 1, 2, 4, '', '20191231'}, - TestVersion{'1.2.4-prerelease-1+20191231', 1, 2, 4, 'prerelease-1', '20191231'}, - TestVersion{'1.2.4+20191231-prerelease-1', 1, 2, 4, '', '20191231-prerelease-1'}, - ] - ranges_to_test = [ - TestRange{'1.1.0', '1.1.0', '1.1.1'}, - TestRange{'1.1.0', '=1.1.0', '=1.1.1'}, - TestRange{'1.1.0', '>=1.0.0', '<1.1.0'}, - TestRange{'1.1.0', '>=1.0.0 <=1.1.0', '>=1.0.0 <1.1.0'}, - TestRange{'2.3.1', '>=1.0.0 <=1.1.0 || >2.0.0 <2.3.4', '>=1.0.0 <1.1.0'}, - TestRange{'2.3.1', '>=1.0.0 <=1.1.0 || >2.0.0 <2.3.4', '>=1.0.0 <1.1.0 || >4.0.0 <5.0.0'}, - TestRange{'2.3.1', '~2.3.0', '~2.4.0'}, - TestRange{'3.0.0', '~3.0.0', '~4.0.0'}, - TestRange{'2.3.1', '^2.0.0', '^2.4.0'}, - TestRange{'0.3.1', '^0.3.0', '^2.4.0'}, - TestRange{'0.0.4', '^0.0.1', '^0.1.0'}, - TestRange{'2.3.4', '^0.0.1 || ^2.3.0', '^3.1.0 || ^4.2.0'}, - TestRange{'2.3.4', '>2 || <3', '>3 || >4'}, - TestRange{'2.3.4', '2.3.4 - 2.3.5', '2.5.1 - 2.8.3'}, - TestRange{'2.3.4', '2.2 - 2.3', '2.4 - 2.8'}, - TestRange{'2.3.4', '2.3.x', '2.4.x'}, - TestRange{'2.3.4', '2.x', '3.x'}, - TestRange{'2.3.4', '*', '3.x'}, - ] - coerce_to_test = [ - TestCoerce{'1.2.0.4', '1.2.0'}, - TestCoerce{'1.2.0', '1.2.0'}, - TestCoerce{'1.2', '1.2.0'}, - TestCoerce{'1', '1.0.0'}, - TestCoerce{'1-alpha', '1.0.0-alpha'}, - TestCoerce{'1+meta', '1.0.0+meta'}, - TestCoerce{'1-alpha+meta', '1.0.0-alpha+meta'}, - ] - invalid_versions_to_test = [ - 'a.b.c', - '1.2', - '1.2.x', - '1.2.3.4', - '1.2.3-alpha@', - '1.2.3+meta%', - ] - invalid_ranges_to_test = [ - '^a', - '~b', - 'a - c', - '>a', - 'a', - 'a.x', - ] -) +const versions_to_test = [ + TestVersion{'1.2.4', 1, 2, 4, '', ''}, + TestVersion{'1.2.4-prerelease-1', 1, 2, 4, 'prerelease-1', ''}, + TestVersion{'1.2.4+20191231', 1, 2, 4, '', '20191231'}, + TestVersion{'1.2.4-prerelease-1+20191231', 1, 2, 4, 'prerelease-1', '20191231'}, + TestVersion{'1.2.4+20191231-prerelease-1', 1, 2, 4, '', '20191231-prerelease-1'}, +] +const ranges_to_test = [ + TestRange{'1.1.0', '1.1.0', '1.1.1'}, + TestRange{'1.1.0', '=1.1.0', '=1.1.1'}, + TestRange{'1.1.0', '>=1.0.0', '<1.1.0'}, + TestRange{'1.1.0', '>=1.0.0 <=1.1.0', '>=1.0.0 <1.1.0'}, + TestRange{'2.3.1', '>=1.0.0 <=1.1.0 || >2.0.0 <2.3.4', '>=1.0.0 <1.1.0'}, + TestRange{'2.3.1', '>=1.0.0 <=1.1.0 || >2.0.0 <2.3.4', '>=1.0.0 <1.1.0 || >4.0.0 <5.0.0'}, + TestRange{'2.3.1', '~2.3.0', '~2.4.0'}, + TestRange{'3.0.0', '~3.0.0', '~4.0.0'}, + TestRange{'2.3.1', '^2.0.0', '^2.4.0'}, + TestRange{'0.3.1', '^0.3.0', '^2.4.0'}, + TestRange{'0.0.4', '^0.0.1', '^0.1.0'}, + TestRange{'2.3.4', '^0.0.1 || ^2.3.0', '^3.1.0 || ^4.2.0'}, + TestRange{'2.3.4', '>2 || <3', '>3 || >4'}, + TestRange{'2.3.4', '2.3.4 - 2.3.5', '2.5.1 - 2.8.3'}, + TestRange{'2.3.4', '2.2 - 2.3', '2.4 - 2.8'}, + TestRange{'2.3.4', '2.3.x', '2.4.x'}, + TestRange{'2.3.4', '2.x', '3.x'}, + TestRange{'2.3.4', '*', '3.x'}, +] +const coerce_to_test = [ + TestCoerce{'1.2.0.4', '1.2.0'}, + TestCoerce{'1.2.0', '1.2.0'}, + TestCoerce{'1.2', '1.2.0'}, + TestCoerce{'1', '1.0.0'}, + TestCoerce{'1-alpha', '1.0.0-alpha'}, + TestCoerce{'1+meta', '1.0.0+meta'}, + TestCoerce{'1-alpha+meta', '1.0.0-alpha+meta'}, +] +const invalid_versions_to_test = [ + 'a.b.c', + '1.2', + '1.2.x', + '1.2.3.4', + '1.2.3-alpha@', + '1.2.3+meta%', +] +const invalid_ranges_to_test = [ + '^a', + '~b', + 'a - c', + '>a', + 'a', + 'a.x', +] fn test_from() { for item in versions_to_test { diff --git a/vlib/sokol/sapp/sapp_structs.c.v b/vlib/sokol/sapp/sapp_structs.c.v index dc82c1e81b..14da83931c 100644 --- a/vlib/sokol/sapp/sapp_structs.c.v +++ b/vlib/sokol/sapp/sapp_structs.c.v @@ -1,11 +1,9 @@ module sapp -const ( - max_touchpoints = 8 - max_mousebuttons = 3 - max_keycodes = 512 - max_iconimages = 8 -) +const max_touchpoints = 8 +const max_mousebuttons = 3 +const max_keycodes = 512 +const max_iconimages = 8 // sapp_range is a general pointer/size-pair struct for passing binary blobs into sokol_app.h @[typedef] diff --git a/vlib/sokol/sokol.v b/vlib/sokol/sokol.v index 8c9a632b15..50a6a98244 100644 --- a/vlib/sokol/sokol.v +++ b/vlib/sokol/sokol.v @@ -3,9 +3,7 @@ module sokol import sokol.c import sokol.f -pub const ( - used_import = c.used_import + f.used_import -) +pub const used_import = c.used_import + f.used_import /* pub enum Key { diff --git a/vlib/strconv/atof.c.v b/vlib/strconv/atof.c.v index 95aafa8da4..634989f2e1 100644 --- a/vlib/strconv/atof.c.v +++ b/vlib/strconv/atof.c.v @@ -17,31 +17,25 @@ module strconv // Note: when u128 will be available, these function can be refactored. // f32 constants -pub const ( - single_plus_zero = u32(0x0000_0000) - single_minus_zero = u32(0x8000_0000) - single_plus_infinity = u32(0x7F80_0000) - single_minus_infinity = u32(0xFF80_0000) -) +pub const single_plus_zero = u32(0x0000_0000) +pub const single_minus_zero = u32(0x8000_0000) +pub const single_plus_infinity = u32(0x7F80_0000) +pub const single_minus_infinity = u32(0xFF80_0000) // f64 constants -pub const ( - digits = 18 - double_plus_zero = u64(0x0000000000000000) - double_minus_zero = u64(0x8000000000000000) - double_plus_infinity = u64(0x7FF0000000000000) - double_minus_infinity = u64(0xFFF0000000000000) -) +pub const digits = 18 +pub const double_plus_zero = u64(0x0000000000000000) +pub const double_minus_zero = u64(0x8000000000000000) +pub const double_plus_infinity = u64(0x7FF0000000000000) +pub const double_minus_infinity = u64(0xFFF0000000000000) // char constants -pub const ( - c_dpoint = `.` - c_plus = `+` - c_minus = `-` - c_zero = `0` - c_nine = `9` - c_ten = u32(10) -) +pub const c_dpoint = `.` +pub const c_plus = `+` +pub const c_minus = `-` +pub const c_zero = `0` +pub const c_nine = `9` +pub const c_ten = u32(10) // right logical shift 96 bit fn lsr96(s2 u32, s1 u32, s0 u32) (u32, u32, u32) { diff --git a/vlib/strconv/atofq.c.v b/vlib/strconv/atofq.c.v index ae0416abe4..808c57acea 100644 --- a/vlib/strconv/atofq.c.v +++ b/vlib/strconv/atofq.c.v @@ -132,218 +132,216 @@ pub fn atof_quick(s string) f64 { } } -const ( - // positive exp of 10 binary form - pos_exp = [u64(0x3ff0000000000000), u64(0x4024000000000000), u64(0x4059000000000000), - u64(0x408f400000000000), u64(0x40c3880000000000), u64(0x40f86a0000000000), - u64(0x412e848000000000), u64(0x416312d000000000), u64(0x4197d78400000000), - u64(0x41cdcd6500000000), u64(0x4202a05f20000000), u64(0x42374876e8000000), - u64(0x426d1a94a2000000), u64(0x42a2309ce5400000), u64(0x42d6bcc41e900000), - u64(0x430c6bf526340000), u64(0x4341c37937e08000), u64(0x4376345785d8a000), - u64(0x43abc16d674ec800), u64(0x43e158e460913d00), u64(0x4415af1d78b58c40), - u64(0x444b1ae4d6e2ef50), u64(0x4480f0cf064dd592), u64(0x44b52d02c7e14af6), - u64(0x44ea784379d99db4), u64(0x45208b2a2c280291), u64(0x4554adf4b7320335), - u64(0x4589d971e4fe8402), u64(0x45c027e72f1f1281), u64(0x45f431e0fae6d721), - u64(0x46293e5939a08cea), u64(0x465f8def8808b024), u64(0x4693b8b5b5056e17), - u64(0x46c8a6e32246c99c), u64(0x46fed09bead87c03), u64(0x4733426172c74d82), - u64(0x476812f9cf7920e3), u64(0x479e17b84357691b), u64(0x47d2ced32a16a1b1), - u64(0x48078287f49c4a1d), u64(0x483d6329f1c35ca5), u64(0x48725dfa371a19e7), - u64(0x48a6f578c4e0a061), u64(0x48dcb2d6f618c879), u64(0x4911efc659cf7d4c), - u64(0x49466bb7f0435c9e), u64(0x497c06a5ec5433c6), u64(0x49b18427b3b4a05c), - u64(0x49e5e531a0a1c873), u64(0x4a1b5e7e08ca3a8f), u64(0x4a511b0ec57e649a), - u64(0x4a8561d276ddfdc0), u64(0x4ababa4714957d30), u64(0x4af0b46c6cdd6e3e), - u64(0x4b24e1878814c9ce), u64(0x4b5a19e96a19fc41), u64(0x4b905031e2503da9), - u64(0x4bc4643e5ae44d13), u64(0x4bf97d4df19d6057), u64(0x4c2fdca16e04b86d), - u64(0x4c63e9e4e4c2f344), u64(0x4c98e45e1df3b015), u64(0x4ccf1d75a5709c1b), - u64(0x4d03726987666191), u64(0x4d384f03e93ff9f5), u64(0x4d6e62c4e38ff872), - u64(0x4da2fdbb0e39fb47), u64(0x4dd7bd29d1c87a19), u64(0x4e0dac74463a989f), - u64(0x4e428bc8abe49f64), u64(0x4e772ebad6ddc73d), u64(0x4eacfa698c95390c), - u64(0x4ee21c81f7dd43a7), u64(0x4f16a3a275d49491), u64(0x4f4c4c8b1349b9b5), - u64(0x4f81afd6ec0e1411), u64(0x4fb61bcca7119916), u64(0x4feba2bfd0d5ff5b), - u64(0x502145b7e285bf99), u64(0x50559725db272f7f), u64(0x508afcef51f0fb5f), - u64(0x50c0de1593369d1b), u64(0x50f5159af8044462), u64(0x512a5b01b605557b), - u64(0x516078e111c3556d), u64(0x5194971956342ac8), u64(0x51c9bcdfabc1357a), - u64(0x5200160bcb58c16c), u64(0x52341b8ebe2ef1c7), u64(0x526922726dbaae39), - u64(0x529f6b0f092959c7), u64(0x52d3a2e965b9d81d), u64(0x53088ba3bf284e24), - u64(0x533eae8caef261ad), u64(0x53732d17ed577d0c), u64(0x53a7f85de8ad5c4f), - u64(0x53ddf67562d8b363), u64(0x5412ba095dc7701e), u64(0x5447688bb5394c25), - u64(0x547d42aea2879f2e), u64(0x54b249ad2594c37d), u64(0x54e6dc186ef9f45c), - u64(0x551c931e8ab87173), u64(0x5551dbf316b346e8), u64(0x558652efdc6018a2), - u64(0x55bbe7abd3781eca), u64(0x55f170cb642b133f), u64(0x5625ccfe3d35d80e), - u64(0x565b403dcc834e12), u64(0x569108269fd210cb), u64(0x56c54a3047c694fe), - u64(0x56fa9cbc59b83a3d), u64(0x5730a1f5b8132466), u64(0x5764ca732617ed80), - u64(0x5799fd0fef9de8e0), u64(0x57d03e29f5c2b18c), u64(0x58044db473335def), - u64(0x583961219000356b), u64(0x586fb969f40042c5), u64(0x58a3d3e2388029bb), - u64(0x58d8c8dac6a0342a), u64(0x590efb1178484135), u64(0x59435ceaeb2d28c1), - u64(0x59783425a5f872f1), u64(0x59ae412f0f768fad), u64(0x59e2e8bd69aa19cc), - u64(0x5a17a2ecc414a03f), u64(0x5a4d8ba7f519c84f), u64(0x5a827748f9301d32), - u64(0x5ab7151b377c247e), u64(0x5aecda62055b2d9e), u64(0x5b22087d4358fc82), - u64(0x5b568a9c942f3ba3), u64(0x5b8c2d43b93b0a8c), u64(0x5bc19c4a53c4e697), - u64(0x5bf6035ce8b6203d), u64(0x5c2b843422e3a84d), u64(0x5c6132a095ce4930), - u64(0x5c957f48bb41db7c), u64(0x5ccadf1aea12525b), u64(0x5d00cb70d24b7379), - u64(0x5d34fe4d06de5057), u64(0x5d6a3de04895e46d), u64(0x5da066ac2d5daec4), - u64(0x5dd4805738b51a75), u64(0x5e09a06d06e26112), u64(0x5e400444244d7cab), - u64(0x5e7405552d60dbd6), u64(0x5ea906aa78b912cc), u64(0x5edf485516e7577f), - u64(0x5f138d352e5096af), u64(0x5f48708279e4bc5b), u64(0x5f7e8ca3185deb72), - u64(0x5fb317e5ef3ab327), u64(0x5fe7dddf6b095ff1), u64(0x601dd55745cbb7ed), - u64(0x6052a5568b9f52f4), u64(0x60874eac2e8727b1), u64(0x60bd22573a28f19d), - u64(0x60f2357684599702), u64(0x6126c2d4256ffcc3), u64(0x615c73892ecbfbf4), - u64(0x6191c835bd3f7d78), u64(0x61c63a432c8f5cd6), u64(0x61fbc8d3f7b3340c), - u64(0x62315d847ad00087), u64(0x6265b4e5998400a9), u64(0x629b221effe500d4), - u64(0x62d0f5535fef2084), u64(0x630532a837eae8a5), u64(0x633a7f5245e5a2cf), - u64(0x63708f936baf85c1), u64(0x63a4b378469b6732), u64(0x63d9e056584240fe), - u64(0x64102c35f729689f), u64(0x6444374374f3c2c6), u64(0x647945145230b378), - u64(0x64af965966bce056), u64(0x64e3bdf7e0360c36), u64(0x6518ad75d8438f43), - u64(0x654ed8d34e547314), u64(0x6583478410f4c7ec), u64(0x65b819651531f9e8), - u64(0x65ee1fbe5a7e7861), u64(0x6622d3d6f88f0b3d), u64(0x665788ccb6b2ce0c), - u64(0x668d6affe45f818f), u64(0x66c262dfeebbb0f9), u64(0x66f6fb97ea6a9d38), - u64(0x672cba7de5054486), u64(0x6761f48eaf234ad4), u64(0x679671b25aec1d89), - u64(0x67cc0e1ef1a724eb), u64(0x680188d357087713), u64(0x6835eb082cca94d7), - u64(0x686b65ca37fd3a0d), u64(0x68a11f9e62fe4448), u64(0x68d56785fbbdd55a), - u64(0x690ac1677aad4ab1), u64(0x6940b8e0acac4eaf), u64(0x6974e718d7d7625a), - u64(0x69aa20df0dcd3af1), u64(0x69e0548b68a044d6), u64(0x6a1469ae42c8560c), - u64(0x6a498419d37a6b8f), u64(0x6a7fe52048590673), u64(0x6ab3ef342d37a408), - u64(0x6ae8eb0138858d0a), u64(0x6b1f25c186a6f04c), u64(0x6b537798f4285630), - u64(0x6b88557f31326bbb), u64(0x6bbe6adefd7f06aa), u64(0x6bf302cb5e6f642a), - u64(0x6c27c37e360b3d35), u64(0x6c5db45dc38e0c82), u64(0x6c9290ba9a38c7d1), - u64(0x6cc734e940c6f9c6), u64(0x6cfd022390f8b837), u64(0x6d3221563a9b7323), - u64(0x6d66a9abc9424feb), u64(0x6d9c5416bb92e3e6), u64(0x6dd1b48e353bce70), - u64(0x6e0621b1c28ac20c), u64(0x6e3baa1e332d728f), u64(0x6e714a52dffc6799), - u64(0x6ea59ce797fb817f), u64(0x6edb04217dfa61df), u64(0x6f10e294eebc7d2c), - u64(0x6f451b3a2a6b9c76), u64(0x6f7a6208b5068394), u64(0x6fb07d457124123d), - u64(0x6fe49c96cd6d16cc), u64(0x7019c3bc80c85c7f), u64(0x70501a55d07d39cf), - u64(0x708420eb449c8843), u64(0x70b9292615c3aa54), u64(0x70ef736f9b3494e9), - u64(0x7123a825c100dd11), u64(0x7158922f31411456), u64(0x718eb6bafd91596b), - u64(0x71c33234de7ad7e3), u64(0x71f7fec216198ddc), u64(0x722dfe729b9ff153), - u64(0x7262bf07a143f6d4), u64(0x72976ec98994f489), u64(0x72cd4a7bebfa31ab), - u64(0x73024e8d737c5f0b), u64(0x7336e230d05b76cd), u64(0x736c9abd04725481), - u64(0x73a1e0b622c774d0), u64(0x73d658e3ab795204), u64(0x740bef1c9657a686), - u64(0x74417571ddf6c814), u64(0x7475d2ce55747a18), u64(0x74ab4781ead1989e), - u64(0x74e10cb132c2ff63), u64(0x75154fdd7f73bf3c), u64(0x754aa3d4df50af0b), - u64(0x7580a6650b926d67), u64(0x75b4cffe4e7708c0), u64(0x75ea03fde214caf1), - u64(0x7620427ead4cfed6), u64(0x7654531e58a03e8c), u64(0x768967e5eec84e2f), - u64(0x76bfc1df6a7a61bb), u64(0x76f3d92ba28c7d15), u64(0x7728cf768b2f9c5a), - u64(0x775f03542dfb8370), u64(0x779362149cbd3226), u64(0x77c83a99c3ec7eb0), - u64(0x77fe494034e79e5c), u64(0x7832edc82110c2f9), u64(0x7867a93a2954f3b8), - u64(0x789d9388b3aa30a5), u64(0x78d27c35704a5e67), u64(0x79071b42cc5cf601), - u64(0x793ce2137f743382), u64(0x79720d4c2fa8a031), u64(0x79a6909f3b92c83d), - u64(0x79dc34c70a777a4d), u64(0x7a11a0fc668aac70), u64(0x7a46093b802d578c), - u64(0x7a7b8b8a6038ad6f), u64(0x7ab137367c236c65), u64(0x7ae585041b2c477f), - u64(0x7b1ae64521f7595e), u64(0x7b50cfeb353a97db), u64(0x7b8503e602893dd2), - u64(0x7bba44df832b8d46), u64(0x7bf06b0bb1fb384c), u64(0x7c2485ce9e7a065f), - u64(0x7c59a742461887f6), u64(0x7c9008896bcf54fa), u64(0x7cc40aabc6c32a38), - u64(0x7cf90d56b873f4c7), u64(0x7d2f50ac6690f1f8), u64(0x7d63926bc01a973b), - u64(0x7d987706b0213d0a), u64(0x7dce94c85c298c4c), u64(0x7e031cfd3999f7b0), - u64(0x7e37e43c8800759c), u64(0x7e6ddd4baa009303), u64(0x7ea2aa4f4a405be2), - u64(0x7ed754e31cd072da), u64(0x7f0d2a1be4048f90), u64(0x7f423a516e82d9ba), - u64(0x7f76c8e5ca239029), u64(0x7fac7b1f3cac7433), u64(0x7fe1ccf385ebc8a0)]! - // negative exp of 10 binary form - neg_exp = [u64(0x3ff0000000000000), u64(0x3fb999999999999a), u64(0x3f847ae147ae147b), - u64(0x3f50624dd2f1a9fc), u64(0x3f1a36e2eb1c432d), u64(0x3ee4f8b588e368f1), - u64(0x3eb0c6f7a0b5ed8d), u64(0x3e7ad7f29abcaf48), u64(0x3e45798ee2308c3a), - u64(0x3e112e0be826d695), u64(0x3ddb7cdfd9d7bdbb), u64(0x3da5fd7fe1796495), - u64(0x3d719799812dea11), u64(0x3d3c25c268497682), u64(0x3d06849b86a12b9b), - u64(0x3cd203af9ee75616), u64(0x3c9cd2b297d889bc), u64(0x3c670ef54646d497), - u64(0x3c32725dd1d243ac), u64(0x3bfd83c94fb6d2ac), u64(0x3bc79ca10c924223), - u64(0x3b92e3b40a0e9b4f), u64(0x3b5e392010175ee6), u64(0x3b282db34012b251), - u64(0x3af357c299a88ea7), u64(0x3abef2d0f5da7dd9), u64(0x3a88c240c4aecb14), - u64(0x3a53ce9a36f23c10), u64(0x3a1fb0f6be506019), u64(0x39e95a5efea6b347), - u64(0x39b4484bfeebc2a0), u64(0x398039d665896880), u64(0x3949f623d5a8a733), - u64(0x3914c4e977ba1f5c), u64(0x38e09d8792fb4c49), u64(0x38aa95a5b7f87a0f), - u64(0x38754484932d2e72), u64(0x3841039d428a8b8f), u64(0x380b38fb9daa78e4), - u64(0x37d5c72fb1552d83), u64(0x37a16c262777579c), u64(0x376be03d0bf225c7), - u64(0x37364cfda3281e39), u64(0x3701d7314f534b61), u64(0x36cc8b8218854567), - u64(0x3696d601ad376ab9), u64(0x366244ce242c5561), u64(0x362d3ae36d13bbce), - u64(0x35f7624f8a762fd8), u64(0x35c2b50c6ec4f313), u64(0x358dee7a4ad4b81f), - u64(0x3557f1fb6f10934c), u64(0x352327fc58da0f70), u64(0x34eea6608e29b24d), - u64(0x34b8851a0b548ea4), u64(0x34839dae6f76d883), u64(0x344f62b0b257c0d2), - u64(0x34191bc08eac9a41), u64(0x33e41633a556e1ce), u64(0x33b011c2eaabe7d8), - u64(0x3379b604aaaca626), u64(0x3344919d5556eb52), u64(0x3310747ddddf22a8), - u64(0x32da53fc9631d10d), u64(0x32a50ffd44f4a73d), u64(0x3270d9976a5d5297), - u64(0x323af5bf109550f2), u64(0x32059165a6ddda5b), u64(0x31d1411e1f17e1e3), - u64(0x319b9b6364f30304), u64(0x316615e91d8f359d), u64(0x3131ab20e472914a), - u64(0x30fc45016d841baa), u64(0x30c69d9abe034955), u64(0x309217aefe690777), - u64(0x305cf2b1970e7258), u64(0x3027288e1271f513), u64(0x2ff286d80ec190dc), - u64(0x2fbda48ce468e7c7), u64(0x2f87b6d71d20b96c), u64(0x2f52f8ac174d6123), - u64(0x2f1e5aacf2156838), u64(0x2ee8488a5b445360), u64(0x2eb36d3b7c36a91a), - u64(0x2e7f152bf9f10e90), u64(0x2e48ddbcc7f40ba6), u64(0x2e13e497065cd61f), - u64(0x2ddfd424d6faf031), u64(0x2da97683df2f268d), u64(0x2d745ecfe5bf520b), - u64(0x2d404bd984990e6f), u64(0x2d0a12f5a0f4e3e5), u64(0x2cd4dbf7b3f71cb7), - u64(0x2ca0aff95cc5b092), u64(0x2c6ab328946f80ea), u64(0x2c355c2076bf9a55), - u64(0x2c0116805effaeaa), u64(0x2bcb5733cb32b111), u64(0x2b95df5ca28ef40d), - u64(0x2b617f7d4ed8c33e), u64(0x2b2bff2ee48e0530), u64(0x2af665bf1d3e6a8d), - u64(0x2ac1eaff4a98553d), u64(0x2a8cab3210f3bb95), u64(0x2a56ef5b40c2fc77), - u64(0x2a225915cd68c9f9), u64(0x29ed5b561574765b), u64(0x29b77c44ddf6c516), - u64(0x2982c9d0b1923745), u64(0x294e0fb44f50586e), u64(0x29180c903f7379f2), - u64(0x28e33d4032c2c7f5), u64(0x28aec866b79e0cba), u64(0x2878a0522c7e7095), - u64(0x2843b374f06526de), u64(0x280f8587e7083e30), u64(0x27d9379fec069826), - u64(0x27a42c7ff0054685), u64(0x277023998cd10537), u64(0x2739d28f47b4d525), - u64(0x2704a8729fc3ddb7), u64(0x26d086c219697e2c), u64(0x269a71368f0f3047), - u64(0x2665275ed8d8f36c), u64(0x2630ec4be0ad8f89), u64(0x25fb13ac9aaf4c0f), - u64(0x25c5a956e225d672), u64(0x2591544581b7dec2), u64(0x255bba08cf8c979d), - u64(0x25262e6d72d6dfb0), u64(0x24f1bebdf578b2f4), u64(0x24bc6463225ab7ec), - u64(0x2486b6b5b5155ff0), u64(0x24522bc490dde65a), u64(0x241d12d41afca3c3), - u64(0x23e7424348ca1c9c), u64(0x23b29b69070816e3), u64(0x237dc574d80cf16b), - u64(0x2347d12a4670c123), u64(0x23130dbb6b8d674f), u64(0x22de7c5f127bd87e), - u64(0x22a8637f41fcad32), u64(0x227382cc34ca2428), u64(0x223f37ad21436d0c), - u64(0x2208f9574dcf8a70), u64(0x21d3faac3e3fa1f3), u64(0x219ff779fd329cb9), - u64(0x216992c7fdc216fa), u64(0x2134756ccb01abfb), u64(0x21005df0a267bcc9), - u64(0x20ca2fe76a3f9475), u64(0x2094f31f8832dd2a), u64(0x2060c27fa028b0ef), - u64(0x202ad0cc33744e4b), u64(0x1ff573d68f903ea2), u64(0x1fc1297872d9cbb5), - u64(0x1f8b758d848fac55), u64(0x1f55f7a46a0c89dd), u64(0x1f2192e9ee706e4b), - u64(0x1eec1e43171a4a11), u64(0x1eb67e9c127b6e74), u64(0x1e81fee341fc585d), - u64(0x1e4ccb0536608d61), u64(0x1e1708d0f84d3de7), u64(0x1de26d73f9d764b9), - u64(0x1dad7becc2f23ac2), u64(0x1d779657025b6235), u64(0x1d42deac01e2b4f7), - u64(0x1d0e3113363787f2), u64(0x1cd8274291c6065b), u64(0x1ca3529ba7d19eaf), - u64(0x1c6eea92a61c3118), u64(0x1c38bba884e35a7a), u64(0x1c03c9539d82aec8), - u64(0x1bcfa885c8d117a6), u64(0x1b99539e3a40dfb8), u64(0x1b6442e4fb671960), - u64(0x1b303583fc527ab3), u64(0x1af9ef3993b72ab8), u64(0x1ac4bf6142f8eefa), - u64(0x1a90991a9bfa58c8), u64(0x1a5a8e90f9908e0d), u64(0x1a253eda614071a4), - u64(0x19f0ff151a99f483), u64(0x19bb31bb5dc320d2), u64(0x1985c162b168e70e), - u64(0x1951678227871f3e), u64(0x191bd8d03f3e9864), u64(0x18e6470cff6546b6), - u64(0x18b1d270cc51055f), u64(0x187c83e7ad4e6efe), u64(0x1846cfec8aa52598), - u64(0x18123ff06eea847a), u64(0x17dd331a4b10d3f6), u64(0x17a75c1508da432b), - u64(0x1772b010d3e1cf56), u64(0x173de6815302e556), u64(0x1707eb9aa8cf1dde), - u64(0x16d322e220a5b17e), u64(0x169e9e369aa2b597), u64(0x16687e92154ef7ac), - u64(0x16339874ddd8c623), u64(0x15ff5a549627a36c), u64(0x15c91510781fb5f0), - u64(0x159410d9f9b2f7f3), u64(0x15600d7b2e28c65c), u64(0x1529af2b7d0e0a2d), - u64(0x14f48c22ca71a1bd), u64(0x14c0701bd527b498), u64(0x148a4cf9550c5426), - u64(0x14550a6110d6a9b8), u64(0x1420d51a73deee2d), u64(0x13eaee90b964b047), - u64(0x13b58ba6fab6f36c), u64(0x13813c85955f2923), u64(0x134b9408eefea839), - u64(0x1316100725988694), u64(0x12e1a66c1e139edd), u64(0x12ac3d79c9b8fe2e), - u64(0x12769794a160cb58), u64(0x124212dd4de70913), u64(0x120ceafbafd80e85), - u64(0x11d72262f3133ed1), u64(0x11a281e8c275cbda), u64(0x116d9ca79d89462a), - u64(0x1137b08617a104ee), u64(0x1102f39e794d9d8b), u64(0x10ce5297287c2f45), - u64(0x1098421286c9bf6b), u64(0x1063680ed23aff89), u64(0x102f0ce4839198db), - u64(0x0ff8d71d360e13e2), u64(0x0fc3df4a91a4dcb5), u64(0x0f8fcbaa82a16121), - u64(0x0f596fbb9bb44db4), u64(0x0f245962e2f6a490), u64(0x0ef047824f2bb6da), - u64(0x0eba0c03b1df8af6), u64(0x0e84d6695b193bf8), u64(0x0e50ab877c142ffa), - u64(0x0e1aac0bf9b9e65c), u64(0x0de5566ffafb1eb0), u64(0x0db111f32f2f4bc0), - u64(0x0d7b4feb7eb212cd), u64(0x0d45d98932280f0a), u64(0x0d117ad428200c08), - u64(0x0cdbf7b9d9cce00d), u64(0x0ca65fc7e170b33e), u64(0x0c71e6398126f5cb), - u64(0x0c3ca38f350b22df), u64(0x0c06e93f5da2824c), u64(0x0bd25432b14ecea3), - u64(0x0b9d53844ee47dd1), u64(0x0b677603725064a8), u64(0x0b32c4cf8ea6b6ec), - u64(0x0afe07b27dd78b14), u64(0x0ac8062864ac6f43), u64(0x0a9338205089f29c), - u64(0x0a5ec033b40fea93), u64(0x0a2899c2f6732210), u64(0x09f3ae3591f5b4d9), - u64(0x09bf7d228322baf5), u64(0x098930e868e89591), u64(0x0954272053ed4474), - u64(0x09201f4d0ff10390), u64(0x08e9cbae7fe805b3), u64(0x08b4a2f1ffecd15c), - u64(0x0880825b3323dab0), u64(0x084a6a2b85062ab3), u64(0x081521bc6a6b555c), - u64(0x07e0e7c9eebc444a), u64(0x07ab0c764ac6d3a9), u64(0x0775a391d56bdc87), - u64(0x07414fa7ddefe3a0), u64(0x070bb2a62fe638ff), u64(0x06d62884f31e93ff), - u64(0x06a1ba03f5b21000), u64(0x066c5cd322b67fff), u64(0x0636b0a8e891ffff), - u64(0x060226ed86db3333), u64(0x05cd0b15a491eb84), u64(0x05973c115074bc6a), - u64(0x05629674405d6388), u64(0x052dbd86cd6238d9), u64(0x04f7cad23de82d7b), - u64(0x04c308a831868ac9), u64(0x048e74404f3daadb), u64(0x04585d003f6488af), - u64(0x04237d99cc506d59), u64(0x03ef2f5c7a1a488e), u64(0x03b8f2b061aea072), - u64(0x0383f559e7bee6c1), u64(0x034feef63f97d79c), u64(0x03198bf832dfdfb0), - u64(0x02e46ff9c24cb2f3), u64(0x02b059949b708f29), u64(0x027a28edc580e50e), - u64(0x0244ed8b04671da5), u64(0x0210be08d0527e1d), u64(0x01dac9a7b3b7302f), - u64(0x01a56e1fc2f8f359), u64(0x017124e63593f5e1), u64(0x013b6e3d22865634), - u64(0x0105f1ca820511c3), u64(0x00d18e3b9b374169), u64(0x009c16c5c5253575), - u64(0x0066789e3750f791), u64(0x0031fa182c40c60d), u64(0x000730d67819e8d2), - u64(0x0000b8157268fdaf), u64(0x000012688b70e62b), u64(0x000001d74124e3d1), - u64(0x0000002f201d49fb), u64(0x00000004b6695433), u64(0x0000000078a42205), - u64(0x000000000c1069cd), u64(0x000000000134d761), u64(0x00000000001ee257), - u64(0x00000000000316a2), u64(0x0000000000004f10), u64(0x00000000000007e8), - u64(0x00000000000000ca), u64(0x0000000000000014), u64(0x0000000000000002)]! -) +// positive exp of 10 binary form +const pos_exp = [u64(0x3ff0000000000000), u64(0x4024000000000000), u64(0x4059000000000000), + u64(0x408f400000000000), u64(0x40c3880000000000), u64(0x40f86a0000000000), + u64(0x412e848000000000), u64(0x416312d000000000), u64(0x4197d78400000000), + u64(0x41cdcd6500000000), u64(0x4202a05f20000000), u64(0x42374876e8000000), + u64(0x426d1a94a2000000), u64(0x42a2309ce5400000), u64(0x42d6bcc41e900000), + u64(0x430c6bf526340000), u64(0x4341c37937e08000), u64(0x4376345785d8a000), + u64(0x43abc16d674ec800), u64(0x43e158e460913d00), u64(0x4415af1d78b58c40), + u64(0x444b1ae4d6e2ef50), u64(0x4480f0cf064dd592), u64(0x44b52d02c7e14af6), + u64(0x44ea784379d99db4), u64(0x45208b2a2c280291), u64(0x4554adf4b7320335), + u64(0x4589d971e4fe8402), u64(0x45c027e72f1f1281), u64(0x45f431e0fae6d721), + u64(0x46293e5939a08cea), u64(0x465f8def8808b024), u64(0x4693b8b5b5056e17), + u64(0x46c8a6e32246c99c), u64(0x46fed09bead87c03), u64(0x4733426172c74d82), + u64(0x476812f9cf7920e3), u64(0x479e17b84357691b), u64(0x47d2ced32a16a1b1), + u64(0x48078287f49c4a1d), u64(0x483d6329f1c35ca5), u64(0x48725dfa371a19e7), + u64(0x48a6f578c4e0a061), u64(0x48dcb2d6f618c879), u64(0x4911efc659cf7d4c), + u64(0x49466bb7f0435c9e), u64(0x497c06a5ec5433c6), u64(0x49b18427b3b4a05c), + u64(0x49e5e531a0a1c873), u64(0x4a1b5e7e08ca3a8f), u64(0x4a511b0ec57e649a), + u64(0x4a8561d276ddfdc0), u64(0x4ababa4714957d30), u64(0x4af0b46c6cdd6e3e), + u64(0x4b24e1878814c9ce), u64(0x4b5a19e96a19fc41), u64(0x4b905031e2503da9), + u64(0x4bc4643e5ae44d13), u64(0x4bf97d4df19d6057), u64(0x4c2fdca16e04b86d), + u64(0x4c63e9e4e4c2f344), u64(0x4c98e45e1df3b015), u64(0x4ccf1d75a5709c1b), + u64(0x4d03726987666191), u64(0x4d384f03e93ff9f5), u64(0x4d6e62c4e38ff872), + u64(0x4da2fdbb0e39fb47), u64(0x4dd7bd29d1c87a19), u64(0x4e0dac74463a989f), + u64(0x4e428bc8abe49f64), u64(0x4e772ebad6ddc73d), u64(0x4eacfa698c95390c), + u64(0x4ee21c81f7dd43a7), u64(0x4f16a3a275d49491), u64(0x4f4c4c8b1349b9b5), + u64(0x4f81afd6ec0e1411), u64(0x4fb61bcca7119916), u64(0x4feba2bfd0d5ff5b), + u64(0x502145b7e285bf99), u64(0x50559725db272f7f), u64(0x508afcef51f0fb5f), + u64(0x50c0de1593369d1b), u64(0x50f5159af8044462), u64(0x512a5b01b605557b), + u64(0x516078e111c3556d), u64(0x5194971956342ac8), u64(0x51c9bcdfabc1357a), + u64(0x5200160bcb58c16c), u64(0x52341b8ebe2ef1c7), u64(0x526922726dbaae39), + u64(0x529f6b0f092959c7), u64(0x52d3a2e965b9d81d), u64(0x53088ba3bf284e24), + u64(0x533eae8caef261ad), u64(0x53732d17ed577d0c), u64(0x53a7f85de8ad5c4f), + u64(0x53ddf67562d8b363), u64(0x5412ba095dc7701e), u64(0x5447688bb5394c25), + u64(0x547d42aea2879f2e), u64(0x54b249ad2594c37d), u64(0x54e6dc186ef9f45c), + u64(0x551c931e8ab87173), u64(0x5551dbf316b346e8), u64(0x558652efdc6018a2), + u64(0x55bbe7abd3781eca), u64(0x55f170cb642b133f), u64(0x5625ccfe3d35d80e), + u64(0x565b403dcc834e12), u64(0x569108269fd210cb), u64(0x56c54a3047c694fe), + u64(0x56fa9cbc59b83a3d), u64(0x5730a1f5b8132466), u64(0x5764ca732617ed80), + u64(0x5799fd0fef9de8e0), u64(0x57d03e29f5c2b18c), u64(0x58044db473335def), + u64(0x583961219000356b), u64(0x586fb969f40042c5), u64(0x58a3d3e2388029bb), + u64(0x58d8c8dac6a0342a), u64(0x590efb1178484135), u64(0x59435ceaeb2d28c1), + u64(0x59783425a5f872f1), u64(0x59ae412f0f768fad), u64(0x59e2e8bd69aa19cc), + u64(0x5a17a2ecc414a03f), u64(0x5a4d8ba7f519c84f), u64(0x5a827748f9301d32), + u64(0x5ab7151b377c247e), u64(0x5aecda62055b2d9e), u64(0x5b22087d4358fc82), + u64(0x5b568a9c942f3ba3), u64(0x5b8c2d43b93b0a8c), u64(0x5bc19c4a53c4e697), + u64(0x5bf6035ce8b6203d), u64(0x5c2b843422e3a84d), u64(0x5c6132a095ce4930), + u64(0x5c957f48bb41db7c), u64(0x5ccadf1aea12525b), u64(0x5d00cb70d24b7379), + u64(0x5d34fe4d06de5057), u64(0x5d6a3de04895e46d), u64(0x5da066ac2d5daec4), + u64(0x5dd4805738b51a75), u64(0x5e09a06d06e26112), u64(0x5e400444244d7cab), + u64(0x5e7405552d60dbd6), u64(0x5ea906aa78b912cc), u64(0x5edf485516e7577f), + u64(0x5f138d352e5096af), u64(0x5f48708279e4bc5b), u64(0x5f7e8ca3185deb72), + u64(0x5fb317e5ef3ab327), u64(0x5fe7dddf6b095ff1), u64(0x601dd55745cbb7ed), + u64(0x6052a5568b9f52f4), u64(0x60874eac2e8727b1), u64(0x60bd22573a28f19d), + u64(0x60f2357684599702), u64(0x6126c2d4256ffcc3), u64(0x615c73892ecbfbf4), + u64(0x6191c835bd3f7d78), u64(0x61c63a432c8f5cd6), u64(0x61fbc8d3f7b3340c), + u64(0x62315d847ad00087), u64(0x6265b4e5998400a9), u64(0x629b221effe500d4), + u64(0x62d0f5535fef2084), u64(0x630532a837eae8a5), u64(0x633a7f5245e5a2cf), + u64(0x63708f936baf85c1), u64(0x63a4b378469b6732), u64(0x63d9e056584240fe), + u64(0x64102c35f729689f), u64(0x6444374374f3c2c6), u64(0x647945145230b378), + u64(0x64af965966bce056), u64(0x64e3bdf7e0360c36), u64(0x6518ad75d8438f43), + u64(0x654ed8d34e547314), u64(0x6583478410f4c7ec), u64(0x65b819651531f9e8), + u64(0x65ee1fbe5a7e7861), u64(0x6622d3d6f88f0b3d), u64(0x665788ccb6b2ce0c), + u64(0x668d6affe45f818f), u64(0x66c262dfeebbb0f9), u64(0x66f6fb97ea6a9d38), + u64(0x672cba7de5054486), u64(0x6761f48eaf234ad4), u64(0x679671b25aec1d89), + u64(0x67cc0e1ef1a724eb), u64(0x680188d357087713), u64(0x6835eb082cca94d7), + u64(0x686b65ca37fd3a0d), u64(0x68a11f9e62fe4448), u64(0x68d56785fbbdd55a), + u64(0x690ac1677aad4ab1), u64(0x6940b8e0acac4eaf), u64(0x6974e718d7d7625a), + u64(0x69aa20df0dcd3af1), u64(0x69e0548b68a044d6), u64(0x6a1469ae42c8560c), + u64(0x6a498419d37a6b8f), u64(0x6a7fe52048590673), u64(0x6ab3ef342d37a408), + u64(0x6ae8eb0138858d0a), u64(0x6b1f25c186a6f04c), u64(0x6b537798f4285630), + u64(0x6b88557f31326bbb), u64(0x6bbe6adefd7f06aa), u64(0x6bf302cb5e6f642a), + u64(0x6c27c37e360b3d35), u64(0x6c5db45dc38e0c82), u64(0x6c9290ba9a38c7d1), + u64(0x6cc734e940c6f9c6), u64(0x6cfd022390f8b837), u64(0x6d3221563a9b7323), + u64(0x6d66a9abc9424feb), u64(0x6d9c5416bb92e3e6), u64(0x6dd1b48e353bce70), + u64(0x6e0621b1c28ac20c), u64(0x6e3baa1e332d728f), u64(0x6e714a52dffc6799), + u64(0x6ea59ce797fb817f), u64(0x6edb04217dfa61df), u64(0x6f10e294eebc7d2c), + u64(0x6f451b3a2a6b9c76), u64(0x6f7a6208b5068394), u64(0x6fb07d457124123d), + u64(0x6fe49c96cd6d16cc), u64(0x7019c3bc80c85c7f), u64(0x70501a55d07d39cf), + u64(0x708420eb449c8843), u64(0x70b9292615c3aa54), u64(0x70ef736f9b3494e9), + u64(0x7123a825c100dd11), u64(0x7158922f31411456), u64(0x718eb6bafd91596b), + u64(0x71c33234de7ad7e3), u64(0x71f7fec216198ddc), u64(0x722dfe729b9ff153), + u64(0x7262bf07a143f6d4), u64(0x72976ec98994f489), u64(0x72cd4a7bebfa31ab), + u64(0x73024e8d737c5f0b), u64(0x7336e230d05b76cd), u64(0x736c9abd04725481), + u64(0x73a1e0b622c774d0), u64(0x73d658e3ab795204), u64(0x740bef1c9657a686), + u64(0x74417571ddf6c814), u64(0x7475d2ce55747a18), u64(0x74ab4781ead1989e), + u64(0x74e10cb132c2ff63), u64(0x75154fdd7f73bf3c), u64(0x754aa3d4df50af0b), + u64(0x7580a6650b926d67), u64(0x75b4cffe4e7708c0), u64(0x75ea03fde214caf1), + u64(0x7620427ead4cfed6), u64(0x7654531e58a03e8c), u64(0x768967e5eec84e2f), + u64(0x76bfc1df6a7a61bb), u64(0x76f3d92ba28c7d15), u64(0x7728cf768b2f9c5a), + u64(0x775f03542dfb8370), u64(0x779362149cbd3226), u64(0x77c83a99c3ec7eb0), + u64(0x77fe494034e79e5c), u64(0x7832edc82110c2f9), u64(0x7867a93a2954f3b8), + u64(0x789d9388b3aa30a5), u64(0x78d27c35704a5e67), u64(0x79071b42cc5cf601), + u64(0x793ce2137f743382), u64(0x79720d4c2fa8a031), u64(0x79a6909f3b92c83d), + u64(0x79dc34c70a777a4d), u64(0x7a11a0fc668aac70), u64(0x7a46093b802d578c), + u64(0x7a7b8b8a6038ad6f), u64(0x7ab137367c236c65), u64(0x7ae585041b2c477f), + u64(0x7b1ae64521f7595e), u64(0x7b50cfeb353a97db), u64(0x7b8503e602893dd2), + u64(0x7bba44df832b8d46), u64(0x7bf06b0bb1fb384c), u64(0x7c2485ce9e7a065f), + u64(0x7c59a742461887f6), u64(0x7c9008896bcf54fa), u64(0x7cc40aabc6c32a38), + u64(0x7cf90d56b873f4c7), u64(0x7d2f50ac6690f1f8), u64(0x7d63926bc01a973b), + u64(0x7d987706b0213d0a), u64(0x7dce94c85c298c4c), u64(0x7e031cfd3999f7b0), + u64(0x7e37e43c8800759c), u64(0x7e6ddd4baa009303), u64(0x7ea2aa4f4a405be2), + u64(0x7ed754e31cd072da), u64(0x7f0d2a1be4048f90), u64(0x7f423a516e82d9ba), + u64(0x7f76c8e5ca239029), u64(0x7fac7b1f3cac7433), u64(0x7fe1ccf385ebc8a0)]! +// negative exp of 10 binary form +const neg_exp = [u64(0x3ff0000000000000), u64(0x3fb999999999999a), u64(0x3f847ae147ae147b), + u64(0x3f50624dd2f1a9fc), u64(0x3f1a36e2eb1c432d), u64(0x3ee4f8b588e368f1), + u64(0x3eb0c6f7a0b5ed8d), u64(0x3e7ad7f29abcaf48), u64(0x3e45798ee2308c3a), + u64(0x3e112e0be826d695), u64(0x3ddb7cdfd9d7bdbb), u64(0x3da5fd7fe1796495), + u64(0x3d719799812dea11), u64(0x3d3c25c268497682), u64(0x3d06849b86a12b9b), + u64(0x3cd203af9ee75616), u64(0x3c9cd2b297d889bc), u64(0x3c670ef54646d497), + u64(0x3c32725dd1d243ac), u64(0x3bfd83c94fb6d2ac), u64(0x3bc79ca10c924223), + u64(0x3b92e3b40a0e9b4f), u64(0x3b5e392010175ee6), u64(0x3b282db34012b251), + u64(0x3af357c299a88ea7), u64(0x3abef2d0f5da7dd9), u64(0x3a88c240c4aecb14), + u64(0x3a53ce9a36f23c10), u64(0x3a1fb0f6be506019), u64(0x39e95a5efea6b347), + u64(0x39b4484bfeebc2a0), u64(0x398039d665896880), u64(0x3949f623d5a8a733), + u64(0x3914c4e977ba1f5c), u64(0x38e09d8792fb4c49), u64(0x38aa95a5b7f87a0f), + u64(0x38754484932d2e72), u64(0x3841039d428a8b8f), u64(0x380b38fb9daa78e4), + u64(0x37d5c72fb1552d83), u64(0x37a16c262777579c), u64(0x376be03d0bf225c7), + u64(0x37364cfda3281e39), u64(0x3701d7314f534b61), u64(0x36cc8b8218854567), + u64(0x3696d601ad376ab9), u64(0x366244ce242c5561), u64(0x362d3ae36d13bbce), + u64(0x35f7624f8a762fd8), u64(0x35c2b50c6ec4f313), u64(0x358dee7a4ad4b81f), + u64(0x3557f1fb6f10934c), u64(0x352327fc58da0f70), u64(0x34eea6608e29b24d), + u64(0x34b8851a0b548ea4), u64(0x34839dae6f76d883), u64(0x344f62b0b257c0d2), + u64(0x34191bc08eac9a41), u64(0x33e41633a556e1ce), u64(0x33b011c2eaabe7d8), + u64(0x3379b604aaaca626), u64(0x3344919d5556eb52), u64(0x3310747ddddf22a8), + u64(0x32da53fc9631d10d), u64(0x32a50ffd44f4a73d), u64(0x3270d9976a5d5297), + u64(0x323af5bf109550f2), u64(0x32059165a6ddda5b), u64(0x31d1411e1f17e1e3), + u64(0x319b9b6364f30304), u64(0x316615e91d8f359d), u64(0x3131ab20e472914a), + u64(0x30fc45016d841baa), u64(0x30c69d9abe034955), u64(0x309217aefe690777), + u64(0x305cf2b1970e7258), u64(0x3027288e1271f513), u64(0x2ff286d80ec190dc), + u64(0x2fbda48ce468e7c7), u64(0x2f87b6d71d20b96c), u64(0x2f52f8ac174d6123), + u64(0x2f1e5aacf2156838), u64(0x2ee8488a5b445360), u64(0x2eb36d3b7c36a91a), + u64(0x2e7f152bf9f10e90), u64(0x2e48ddbcc7f40ba6), u64(0x2e13e497065cd61f), + u64(0x2ddfd424d6faf031), u64(0x2da97683df2f268d), u64(0x2d745ecfe5bf520b), + u64(0x2d404bd984990e6f), u64(0x2d0a12f5a0f4e3e5), u64(0x2cd4dbf7b3f71cb7), + u64(0x2ca0aff95cc5b092), u64(0x2c6ab328946f80ea), u64(0x2c355c2076bf9a55), + u64(0x2c0116805effaeaa), u64(0x2bcb5733cb32b111), u64(0x2b95df5ca28ef40d), + u64(0x2b617f7d4ed8c33e), u64(0x2b2bff2ee48e0530), u64(0x2af665bf1d3e6a8d), + u64(0x2ac1eaff4a98553d), u64(0x2a8cab3210f3bb95), u64(0x2a56ef5b40c2fc77), + u64(0x2a225915cd68c9f9), u64(0x29ed5b561574765b), u64(0x29b77c44ddf6c516), + u64(0x2982c9d0b1923745), u64(0x294e0fb44f50586e), u64(0x29180c903f7379f2), + u64(0x28e33d4032c2c7f5), u64(0x28aec866b79e0cba), u64(0x2878a0522c7e7095), + u64(0x2843b374f06526de), u64(0x280f8587e7083e30), u64(0x27d9379fec069826), + u64(0x27a42c7ff0054685), u64(0x277023998cd10537), u64(0x2739d28f47b4d525), + u64(0x2704a8729fc3ddb7), u64(0x26d086c219697e2c), u64(0x269a71368f0f3047), + u64(0x2665275ed8d8f36c), u64(0x2630ec4be0ad8f89), u64(0x25fb13ac9aaf4c0f), + u64(0x25c5a956e225d672), u64(0x2591544581b7dec2), u64(0x255bba08cf8c979d), + u64(0x25262e6d72d6dfb0), u64(0x24f1bebdf578b2f4), u64(0x24bc6463225ab7ec), + u64(0x2486b6b5b5155ff0), u64(0x24522bc490dde65a), u64(0x241d12d41afca3c3), + u64(0x23e7424348ca1c9c), u64(0x23b29b69070816e3), u64(0x237dc574d80cf16b), + u64(0x2347d12a4670c123), u64(0x23130dbb6b8d674f), u64(0x22de7c5f127bd87e), + u64(0x22a8637f41fcad32), u64(0x227382cc34ca2428), u64(0x223f37ad21436d0c), + u64(0x2208f9574dcf8a70), u64(0x21d3faac3e3fa1f3), u64(0x219ff779fd329cb9), + u64(0x216992c7fdc216fa), u64(0x2134756ccb01abfb), u64(0x21005df0a267bcc9), + u64(0x20ca2fe76a3f9475), u64(0x2094f31f8832dd2a), u64(0x2060c27fa028b0ef), + u64(0x202ad0cc33744e4b), u64(0x1ff573d68f903ea2), u64(0x1fc1297872d9cbb5), + u64(0x1f8b758d848fac55), u64(0x1f55f7a46a0c89dd), u64(0x1f2192e9ee706e4b), + u64(0x1eec1e43171a4a11), u64(0x1eb67e9c127b6e74), u64(0x1e81fee341fc585d), + u64(0x1e4ccb0536608d61), u64(0x1e1708d0f84d3de7), u64(0x1de26d73f9d764b9), + u64(0x1dad7becc2f23ac2), u64(0x1d779657025b6235), u64(0x1d42deac01e2b4f7), + u64(0x1d0e3113363787f2), u64(0x1cd8274291c6065b), u64(0x1ca3529ba7d19eaf), + u64(0x1c6eea92a61c3118), u64(0x1c38bba884e35a7a), u64(0x1c03c9539d82aec8), + u64(0x1bcfa885c8d117a6), u64(0x1b99539e3a40dfb8), u64(0x1b6442e4fb671960), + u64(0x1b303583fc527ab3), u64(0x1af9ef3993b72ab8), u64(0x1ac4bf6142f8eefa), + u64(0x1a90991a9bfa58c8), u64(0x1a5a8e90f9908e0d), u64(0x1a253eda614071a4), + u64(0x19f0ff151a99f483), u64(0x19bb31bb5dc320d2), u64(0x1985c162b168e70e), + u64(0x1951678227871f3e), u64(0x191bd8d03f3e9864), u64(0x18e6470cff6546b6), + u64(0x18b1d270cc51055f), u64(0x187c83e7ad4e6efe), u64(0x1846cfec8aa52598), + u64(0x18123ff06eea847a), u64(0x17dd331a4b10d3f6), u64(0x17a75c1508da432b), + u64(0x1772b010d3e1cf56), u64(0x173de6815302e556), u64(0x1707eb9aa8cf1dde), + u64(0x16d322e220a5b17e), u64(0x169e9e369aa2b597), u64(0x16687e92154ef7ac), + u64(0x16339874ddd8c623), u64(0x15ff5a549627a36c), u64(0x15c91510781fb5f0), + u64(0x159410d9f9b2f7f3), u64(0x15600d7b2e28c65c), u64(0x1529af2b7d0e0a2d), + u64(0x14f48c22ca71a1bd), u64(0x14c0701bd527b498), u64(0x148a4cf9550c5426), + u64(0x14550a6110d6a9b8), u64(0x1420d51a73deee2d), u64(0x13eaee90b964b047), + u64(0x13b58ba6fab6f36c), u64(0x13813c85955f2923), u64(0x134b9408eefea839), + u64(0x1316100725988694), u64(0x12e1a66c1e139edd), u64(0x12ac3d79c9b8fe2e), + u64(0x12769794a160cb58), u64(0x124212dd4de70913), u64(0x120ceafbafd80e85), + u64(0x11d72262f3133ed1), u64(0x11a281e8c275cbda), u64(0x116d9ca79d89462a), + u64(0x1137b08617a104ee), u64(0x1102f39e794d9d8b), u64(0x10ce5297287c2f45), + u64(0x1098421286c9bf6b), u64(0x1063680ed23aff89), u64(0x102f0ce4839198db), + u64(0x0ff8d71d360e13e2), u64(0x0fc3df4a91a4dcb5), u64(0x0f8fcbaa82a16121), + u64(0x0f596fbb9bb44db4), u64(0x0f245962e2f6a490), u64(0x0ef047824f2bb6da), + u64(0x0eba0c03b1df8af6), u64(0x0e84d6695b193bf8), u64(0x0e50ab877c142ffa), + u64(0x0e1aac0bf9b9e65c), u64(0x0de5566ffafb1eb0), u64(0x0db111f32f2f4bc0), + u64(0x0d7b4feb7eb212cd), u64(0x0d45d98932280f0a), u64(0x0d117ad428200c08), + u64(0x0cdbf7b9d9cce00d), u64(0x0ca65fc7e170b33e), u64(0x0c71e6398126f5cb), + u64(0x0c3ca38f350b22df), u64(0x0c06e93f5da2824c), u64(0x0bd25432b14ecea3), + u64(0x0b9d53844ee47dd1), u64(0x0b677603725064a8), u64(0x0b32c4cf8ea6b6ec), + u64(0x0afe07b27dd78b14), u64(0x0ac8062864ac6f43), u64(0x0a9338205089f29c), + u64(0x0a5ec033b40fea93), u64(0x0a2899c2f6732210), u64(0x09f3ae3591f5b4d9), + u64(0x09bf7d228322baf5), u64(0x098930e868e89591), u64(0x0954272053ed4474), + u64(0x09201f4d0ff10390), u64(0x08e9cbae7fe805b3), u64(0x08b4a2f1ffecd15c), + u64(0x0880825b3323dab0), u64(0x084a6a2b85062ab3), u64(0x081521bc6a6b555c), + u64(0x07e0e7c9eebc444a), u64(0x07ab0c764ac6d3a9), u64(0x0775a391d56bdc87), + u64(0x07414fa7ddefe3a0), u64(0x070bb2a62fe638ff), u64(0x06d62884f31e93ff), + u64(0x06a1ba03f5b21000), u64(0x066c5cd322b67fff), u64(0x0636b0a8e891ffff), + u64(0x060226ed86db3333), u64(0x05cd0b15a491eb84), u64(0x05973c115074bc6a), + u64(0x05629674405d6388), u64(0x052dbd86cd6238d9), u64(0x04f7cad23de82d7b), + u64(0x04c308a831868ac9), u64(0x048e74404f3daadb), u64(0x04585d003f6488af), + u64(0x04237d99cc506d59), u64(0x03ef2f5c7a1a488e), u64(0x03b8f2b061aea072), + u64(0x0383f559e7bee6c1), u64(0x034feef63f97d79c), u64(0x03198bf832dfdfb0), + u64(0x02e46ff9c24cb2f3), u64(0x02b059949b708f29), u64(0x027a28edc580e50e), + u64(0x0244ed8b04671da5), u64(0x0210be08d0527e1d), u64(0x01dac9a7b3b7302f), + u64(0x01a56e1fc2f8f359), u64(0x017124e63593f5e1), u64(0x013b6e3d22865634), + u64(0x0105f1ca820511c3), u64(0x00d18e3b9b374169), u64(0x009c16c5c5253575), + u64(0x0066789e3750f791), u64(0x0031fa182c40c60d), u64(0x000730d67819e8d2), + u64(0x0000b8157268fdaf), u64(0x000012688b70e62b), u64(0x000001d74124e3d1), + u64(0x0000002f201d49fb), u64(0x00000004b6695433), u64(0x0000000078a42205), + u64(0x000000000c1069cd), u64(0x000000000134d761), u64(0x00000000001ee257), + u64(0x00000000000316a2), u64(0x0000000000004f10), u64(0x00000000000007e8), + u64(0x00000000000000ca), u64(0x0000000000000014), u64(0x0000000000000002)]! diff --git a/vlib/strconv/atoi.v b/vlib/strconv/atoi.v index e1bcf7075f..331845ec8d 100644 --- a/vlib/strconv/atoi.v +++ b/vlib/strconv/atoi.v @@ -4,13 +4,11 @@ module strconv // Use of this source code is governed by an MIT license // that can be found in the LICENSE file. // TODO: use options, or some way to return default with error. -const ( - // int_size is the size in bits of an int or uint value. - // int_size = 32 << (~u32(0) >> 63) - // max_u64 = u64(u64(1 << 63) - 1) - int_size = 32 - max_u64 = u64(18446744073709551615) // as u64 // use this until we add support -) +// int_size is the size in bits of an int or uint value. +// int_size = 32 << (~u32(0) >> 63) +// max_u64 = u64(u64(1 << 63) - 1) +const int_size = 32 +const max_u64 = u64(18446744073709551615) @[inline] pub fn byte_to_lower(c u8) u8 { diff --git a/vlib/strconv/f32_str.c.v b/vlib/strconv/f32_str.c.v index 9f09f4114c..4639c6b73b 100644 --- a/vlib/strconv/f32_str.c.v +++ b/vlib/strconv/f32_str.c.v @@ -21,32 +21,29 @@ https://github.com/cespare/ryu/tree/ba56a33f39e3bbbfa409095d0f9ae168a595feea =============================================================================*/ // pow of ten table used by n_digit reduction -const ( - ten_pow_table_32 = [ - u32(1), - u32(10), - u32(100), - u32(1000), - u32(10000), - u32(100000), - u32(1000000), - u32(10000000), - u32(100000000), - u32(1000000000), - u32(10000000000), - u32(100000000000), - ]! -) +const ten_pow_table_32 = [ + u32(1), + u32(10), + u32(100), + u32(1000), + u32(10000), + u32(100000), + u32(1000000), + u32(10000000), + u32(100000000), + u32(1000000000), + u32(10000000000), + u32(100000000000), +]! //============================================================================= // Conversion Functions //============================================================================= -const ( - mantbits32 = u32(23) - expbits32 = u32(8) - bias32 = 127 // f32 exponent bias - maxexp32 = 255 -) +const mantbits32 = u32(23) +const expbits32 = u32(8) +const bias32 = 127 // f32 exponent bias + +const maxexp32 = 255 // max 46 char // -3.40282346638528859811704183484516925440e+38 diff --git a/vlib/strconv/f64_str.v b/vlib/strconv/f64_str.v index 4a374a543f..35b8a2a15b 100644 --- a/vlib/strconv/f64_str.v +++ b/vlib/strconv/f64_str.v @@ -1,37 +1,34 @@ module strconv // pow of ten table used by n_digit reduction -const ( - ten_pow_table_64 = [ - u64(1), - u64(10), - u64(100), - u64(1000), - u64(10000), - u64(100000), - u64(1000000), - u64(10000000), - u64(100000000), - u64(1000000000), - u64(10000000000), - u64(100000000000), - u64(1000000000000), - u64(10000000000000), - u64(100000000000000), - u64(1000000000000000), - u64(10000000000000000), - u64(100000000000000000), - u64(1000000000000000000), - u64(10000000000000000000), - ]! -) +const ten_pow_table_64 = [ + u64(1), + u64(10), + u64(100), + u64(1000), + u64(10000), + u64(100000), + u64(1000000), + u64(10000000), + u64(100000000), + u64(1000000000), + u64(10000000000), + u64(100000000000), + u64(1000000000000), + u64(10000000000000), + u64(100000000000000), + u64(1000000000000000), + u64(10000000000000000), + u64(100000000000000000), + u64(1000000000000000000), + u64(10000000000000000000), +]! //============================================================================= // Conversion Functions //============================================================================= -const ( - mantbits64 = u32(52) - expbits64 = u32(11) - bias64 = 1023 // f64 exponent bias - maxexp64 = 2047 -) +const mantbits64 = u32(52) +const expbits64 = u32(11) +const bias64 = 1023 // f64 exponent bias + +const maxexp64 = 2047 diff --git a/vlib/strconv/format.v b/vlib/strconv/format.v index 8a5873debf..d62f653bac 100644 --- a/vlib/strconv/format.v +++ b/vlib/strconv/format.v @@ -20,31 +20,29 @@ pub enum Align_text { /* Float conversion utility */ -const ( - // rounding value - dec_round = [ - f64(0.5), - 0.05, - 0.005, - 0.0005, - 0.00005, - 0.000005, - 0.0000005, - 0.00000005, - 0.000000005, - 0.0000000005, - 0.00000000005, - 0.000000000005, - 0.0000000000005, - 0.00000000000005, - 0.000000000000005, - 0.0000000000000005, - 0.00000000000000005, - 0.000000000000000005, - 0.0000000000000000005, - 0.00000000000000000005, - ]! -) +// rounding value +const dec_round = [ + f64(0.5), + 0.05, + 0.005, + 0.0005, + 0.00005, + 0.000005, + 0.0000005, + 0.00000005, + 0.000000005, + 0.0000000005, + 0.00000000005, + 0.000000000005, + 0.0000000000005, + 0.00000000000005, + 0.000000000000005, + 0.0000000000000005, + 0.00000000000000005, + 0.000000000000000005, + 0.0000000000000000005, + 0.00000000000000000005, +]! /* const( diff --git a/vlib/strconv/format_mem.c.v b/vlib/strconv/format_mem.c.v index de0740ef18..8a231308cf 100644 --- a/vlib/strconv/format_mem.c.v +++ b/vlib/strconv/format_mem.c.v @@ -34,11 +34,10 @@ pub fn format_str_sb(s string, p BF_param, mut sb strings.Builder) { } } -const ( - max_size_f64_char = 32 // the f64 max representation is -36,028,797,018,963,968e1023, 21 chars, 32 is faster for the memory manger - // digit pairs in reverse order - digit_pairs = '00102030405060708090011121314151617181910212223242526272829203132333435363738393041424344454647484940515253545556575859506162636465666768696071727374757677787970818283848586878889809192939495969798999' -) +const max_size_f64_char = 32 // the f64 max representation is -36,028,797,018,963,968e1023, 21 chars, 32 is faster for the memory manger + +// digit pairs in reverse order +const digit_pairs = '00102030405060708090011121314151617181910212223242526272829203132333435363738393041424344454647484940515253545556575859506162636465666768696071727374757677787970818283848586878889809192939495969798999' // format_dec_sb formats an u64 using a `strings.Builder`. @[direct_array_access] diff --git a/vlib/strconv/format_mem.js.v b/vlib/strconv/format_mem.js.v index c48a21e60d..0fe57d60d4 100644 --- a/vlib/strconv/format_mem.js.v +++ b/vlib/strconv/format_mem.js.v @@ -30,11 +30,10 @@ pub fn format_str_sb(s string, p BF_param, mut sb strings.Builder) { } } -const ( - max_size_f64_char = 32 // the f64 max representation is -36,028,797,018,963,968e1023, 21 chars, 32 is faster for the memory manger - // digit pairs in reverse order - digit_pairs = '00102030405060708090011121314151617181910212223242526272829203132333435363738393041424344454647484940515253545556575859506162636465666768696071727374757677787970818283848586878889809192939495969798999' -) +const max_size_f64_char = 32 // the f64 max representation is -36,028,797,018,963,968e1023, 21 chars, 32 is faster for the memory manger + +// digit pairs in reverse order +const digit_pairs = '00102030405060708090011121314151617181910212223242526272829203132333435363738393041424344454647484940515253545556575859506162636465666768696071727374757677787970818283848586878889809192939495969798999' // format_dec_sb format a u64 @[direct_array_access] diff --git a/vlib/strconv/tables.v b/vlib/strconv/tables.v index 06dc91b90c..70176a5d36 100644 --- a/vlib/strconv/tables.v +++ b/vlib/strconv/tables.v @@ -1,1356 +1,1354 @@ module strconv -const ( - pow5_num_bits_32 = 61 - pow5_inv_num_bits_32 = 59 - pow5_num_bits_64 = 121 - pow5_inv_num_bits_64 = 122 +const pow5_num_bits_32 = 61 +const pow5_inv_num_bits_32 = 59 +const pow5_num_bits_64 = 121 +const pow5_inv_num_bits_64 = 122 - powers_of_10 = [ - u64(1e0), - u64(1e1), - u64(1e2), - u64(1e3), - u64(1e4), - u64(1e5), - u64(1e6), - u64(1e7), - u64(1e8), - u64(1e9), - u64(1e10), - u64(1e11), - u64(1e12), - u64(1e13), - u64(1e14), - u64(1e15), - u64(1e16), - u64(1e17), - // We only need to find the length of at most 17 digit numbers. - ]! +const powers_of_10 = [ + u64(1e0), + u64(1e1), + u64(1e2), + u64(1e3), + u64(1e4), + u64(1e5), + u64(1e6), + u64(1e7), + u64(1e8), + u64(1e9), + u64(1e10), + u64(1e11), + u64(1e12), + u64(1e13), + u64(1e14), + u64(1e15), + u64(1e16), + u64(1e17), + // We only need to find the length of at most 17 digit numbers. +]! - pow5_split_32 = [ - u64(1152921504606846976), - u64(1441151880758558720), - u64(1801439850948198400), - u64(2251799813685248000), - u64(1407374883553280000), - u64(1759218604441600000), - u64(2199023255552000000), - u64(1374389534720000000), - u64(1717986918400000000), - u64(2147483648000000000), - u64(1342177280000000000), - u64(1677721600000000000), - u64(2097152000000000000), - u64(1310720000000000000), - u64(1638400000000000000), - u64(2048000000000000000), - u64(1280000000000000000), - u64(1600000000000000000), - u64(2000000000000000000), - u64(1250000000000000000), - u64(1562500000000000000), - u64(1953125000000000000), - u64(1220703125000000000), - u64(1525878906250000000), - u64(1907348632812500000), - u64(1192092895507812500), - u64(1490116119384765625), - u64(1862645149230957031), - u64(1164153218269348144), - u64(1455191522836685180), - u64(1818989403545856475), - u64(2273736754432320594), - u64(1421085471520200371), - u64(1776356839400250464), - u64(2220446049250313080), - u64(1387778780781445675), - u64(1734723475976807094), - u64(2168404344971008868), - u64(1355252715606880542), - u64(1694065894508600678), - u64(2117582368135750847), - u64(1323488980084844279), - u64(1654361225106055349), - u64(2067951531382569187), - u64(1292469707114105741), - u64(1615587133892632177), - u64(2019483917365790221), - ]! +const pow5_split_32 = [ + u64(1152921504606846976), + u64(1441151880758558720), + u64(1801439850948198400), + u64(2251799813685248000), + u64(1407374883553280000), + u64(1759218604441600000), + u64(2199023255552000000), + u64(1374389534720000000), + u64(1717986918400000000), + u64(2147483648000000000), + u64(1342177280000000000), + u64(1677721600000000000), + u64(2097152000000000000), + u64(1310720000000000000), + u64(1638400000000000000), + u64(2048000000000000000), + u64(1280000000000000000), + u64(1600000000000000000), + u64(2000000000000000000), + u64(1250000000000000000), + u64(1562500000000000000), + u64(1953125000000000000), + u64(1220703125000000000), + u64(1525878906250000000), + u64(1907348632812500000), + u64(1192092895507812500), + u64(1490116119384765625), + u64(1862645149230957031), + u64(1164153218269348144), + u64(1455191522836685180), + u64(1818989403545856475), + u64(2273736754432320594), + u64(1421085471520200371), + u64(1776356839400250464), + u64(2220446049250313080), + u64(1387778780781445675), + u64(1734723475976807094), + u64(2168404344971008868), + u64(1355252715606880542), + u64(1694065894508600678), + u64(2117582368135750847), + u64(1323488980084844279), + u64(1654361225106055349), + u64(2067951531382569187), + u64(1292469707114105741), + u64(1615587133892632177), + u64(2019483917365790221), +]! - pow5_inv_split_32 = [ - u64(576460752303423489), - u64(461168601842738791), - u64(368934881474191033), - u64(295147905179352826), - u64(472236648286964522), - u64(377789318629571618), - u64(302231454903657294), - u64(483570327845851670), - u64(386856262276681336), - u64(309485009821345069), - u64(495176015714152110), - u64(396140812571321688), - u64(316912650057057351), - u64(507060240091291761), - u64(405648192073033409), - u64(324518553658426727), - u64(519229685853482763), - u64(415383748682786211), - u64(332306998946228969), - u64(531691198313966350), - u64(425352958651173080), - u64(340282366920938464), - u64(544451787073501542), - u64(435561429658801234), - u64(348449143727040987), - u64(557518629963265579), - u64(446014903970612463), - u64(356811923176489971), - u64(570899077082383953), - u64(456719261665907162), - u64(365375409332725730), - ]! +const pow5_inv_split_32 = [ + u64(576460752303423489), + u64(461168601842738791), + u64(368934881474191033), + u64(295147905179352826), + u64(472236648286964522), + u64(377789318629571618), + u64(302231454903657294), + u64(483570327845851670), + u64(386856262276681336), + u64(309485009821345069), + u64(495176015714152110), + u64(396140812571321688), + u64(316912650057057351), + u64(507060240091291761), + u64(405648192073033409), + u64(324518553658426727), + u64(519229685853482763), + u64(415383748682786211), + u64(332306998946228969), + u64(531691198313966350), + u64(425352958651173080), + u64(340282366920938464), + u64(544451787073501542), + u64(435561429658801234), + u64(348449143727040987), + u64(557518629963265579), + u64(446014903970612463), + u64(356811923176489971), + u64(570899077082383953), + u64(456719261665907162), + u64(365375409332725730), +]! - pow5_split_64_x = [ - u64(0x0000000000000000), - u64(0x0100000000000000), - u64(0x0000000000000000), - u64(0x0140000000000000), - u64(0x0000000000000000), - u64(0x0190000000000000), - u64(0x0000000000000000), - u64(0x01f4000000000000), - u64(0x0000000000000000), - u64(0x0138800000000000), - u64(0x0000000000000000), - u64(0x0186a00000000000), - u64(0x0000000000000000), - u64(0x01e8480000000000), - u64(0x0000000000000000), - u64(0x01312d0000000000), - u64(0x0000000000000000), - u64(0x017d784000000000), - u64(0x0000000000000000), - u64(0x01dcd65000000000), - u64(0x0000000000000000), - u64(0x012a05f200000000), - u64(0x0000000000000000), - u64(0x0174876e80000000), - u64(0x0000000000000000), - u64(0x01d1a94a20000000), - u64(0x0000000000000000), - u64(0x012309ce54000000), - u64(0x0000000000000000), - u64(0x016bcc41e9000000), - u64(0x0000000000000000), - u64(0x01c6bf5263400000), - u64(0x0000000000000000), - u64(0x011c37937e080000), - u64(0x0000000000000000), - u64(0x016345785d8a0000), - u64(0x0000000000000000), - u64(0x01bc16d674ec8000), - u64(0x0000000000000000), - u64(0x01158e460913d000), - u64(0x0000000000000000), - u64(0x015af1d78b58c400), - u64(0x0000000000000000), - u64(0x01b1ae4d6e2ef500), - u64(0x0000000000000000), - u64(0x010f0cf064dd5920), - u64(0x0000000000000000), - u64(0x0152d02c7e14af68), - u64(0x0000000000000000), - u64(0x01a784379d99db42), - u64(0x4000000000000000), - u64(0x0108b2a2c2802909), - u64(0x9000000000000000), - u64(0x014adf4b7320334b), - u64(0x7400000000000000), - u64(0x019d971e4fe8401e), - u64(0x0880000000000000), - u64(0x01027e72f1f12813), - u64(0xcaa0000000000000), - u64(0x01431e0fae6d7217), - u64(0xbd48000000000000), - u64(0x0193e5939a08ce9d), - u64(0x2c9a000000000000), - u64(0x01f8def8808b0245), - u64(0x3be0400000000000), - u64(0x013b8b5b5056e16b), - u64(0x0ad8500000000000), - u64(0x018a6e32246c99c6), - u64(0x8d8e640000000000), - u64(0x01ed09bead87c037), - u64(0xb878fe8000000000), - u64(0x013426172c74d822), - u64(0x66973e2000000000), - u64(0x01812f9cf7920e2b), - u64(0x403d0da800000000), - u64(0x01e17b84357691b6), - u64(0xe826288900000000), - u64(0x012ced32a16a1b11), - u64(0x622fb2ab40000000), - u64(0x0178287f49c4a1d6), - u64(0xfabb9f5610000000), - u64(0x01d6329f1c35ca4b), - u64(0x7cb54395ca000000), - u64(0x0125dfa371a19e6f), - u64(0x5be2947b3c800000), - u64(0x016f578c4e0a060b), - u64(0x32db399a0ba00000), - u64(0x01cb2d6f618c878e), - u64(0xdfc9040047440000), - u64(0x011efc659cf7d4b8), - u64(0x17bb450059150000), - u64(0x0166bb7f0435c9e7), - u64(0xddaa16406f5a4000), - u64(0x01c06a5ec5433c60), - u64(0x8a8a4de845986800), - u64(0x0118427b3b4a05bc), - u64(0xad2ce16256fe8200), - u64(0x015e531a0a1c872b), - u64(0x987819baecbe2280), - u64(0x01b5e7e08ca3a8f6), - u64(0x1f4b1014d3f6d590), - u64(0x0111b0ec57e6499a), - u64(0xa71dd41a08f48af4), - u64(0x01561d276ddfdc00), - u64(0xd0e549208b31adb1), - u64(0x01aba4714957d300), - u64(0x828f4db456ff0c8e), - u64(0x010b46c6cdd6e3e0), - u64(0xa33321216cbecfb2), - u64(0x014e1878814c9cd8), - u64(0xcbffe969c7ee839e), - u64(0x01a19e96a19fc40e), - u64(0x3f7ff1e21cf51243), - u64(0x0105031e2503da89), - u64(0x8f5fee5aa43256d4), - u64(0x014643e5ae44d12b), - u64(0x7337e9f14d3eec89), - u64(0x0197d4df19d60576), - u64(0x1005e46da08ea7ab), - u64(0x01fdca16e04b86d4), - u64(0x8a03aec4845928cb), - u64(0x013e9e4e4c2f3444), - u64(0xac849a75a56f72fd), - u64(0x018e45e1df3b0155), - u64(0x17a5c1130ecb4fbd), - u64(0x01f1d75a5709c1ab), - u64(0xeec798abe93f11d6), - u64(0x013726987666190a), - u64(0xaa797ed6e38ed64b), - u64(0x0184f03e93ff9f4d), - u64(0x1517de8c9c728bde), - u64(0x01e62c4e38ff8721), - u64(0xad2eeb17e1c7976b), - u64(0x012fdbb0e39fb474), - u64(0xd87aa5ddda397d46), - u64(0x017bd29d1c87a191), - u64(0x4e994f5550c7dc97), - u64(0x01dac74463a989f6), - u64(0xf11fd195527ce9de), - u64(0x0128bc8abe49f639), - u64(0x6d67c5faa71c2456), - u64(0x0172ebad6ddc73c8), - u64(0x88c1b77950e32d6c), - u64(0x01cfa698c95390ba), - u64(0x957912abd28dfc63), - u64(0x0121c81f7dd43a74), - u64(0xbad75756c7317b7c), - u64(0x016a3a275d494911), - u64(0x298d2d2c78fdda5b), - u64(0x01c4c8b1349b9b56), - u64(0xd9f83c3bcb9ea879), - u64(0x011afd6ec0e14115), - u64(0x50764b4abe865297), - u64(0x0161bcca7119915b), - u64(0x2493de1d6e27e73d), - u64(0x01ba2bfd0d5ff5b2), - u64(0x56dc6ad264d8f086), - u64(0x01145b7e285bf98f), - u64(0x2c938586fe0f2ca8), - u64(0x0159725db272f7f3), - u64(0xf7b866e8bd92f7d2), - u64(0x01afcef51f0fb5ef), - u64(0xfad34051767bdae3), - u64(0x010de1593369d1b5), - u64(0x79881065d41ad19c), - u64(0x015159af80444623), - u64(0x57ea147f49218603), - u64(0x01a5b01b605557ac), - u64(0xb6f24ccf8db4f3c1), - u64(0x01078e111c3556cb), - u64(0xa4aee003712230b2), - u64(0x014971956342ac7e), - u64(0x4dda98044d6abcdf), - u64(0x019bcdfabc13579e), - u64(0xf0a89f02b062b60b), - u64(0x010160bcb58c16c2), - u64(0xacd2c6c35c7b638e), - u64(0x0141b8ebe2ef1c73), - u64(0x98077874339a3c71), - u64(0x01922726dbaae390), - u64(0xbe0956914080cb8e), - u64(0x01f6b0f092959c74), - u64(0xf6c5d61ac8507f38), - u64(0x013a2e965b9d81c8), - u64(0x34774ba17a649f07), - u64(0x0188ba3bf284e23b), - u64(0x01951e89d8fdc6c8), - u64(0x01eae8caef261aca), - u64(0x40fd3316279e9c3d), - u64(0x0132d17ed577d0be), - u64(0xd13c7fdbb186434c), - u64(0x017f85de8ad5c4ed), - u64(0x458b9fd29de7d420), - u64(0x01df67562d8b3629), - u64(0xcb7743e3a2b0e494), - u64(0x012ba095dc7701d9), - u64(0x3e5514dc8b5d1db9), - u64(0x017688bb5394c250), - u64(0x4dea5a13ae346527), - u64(0x01d42aea2879f2e4), - u64(0xb0b2784c4ce0bf38), - u64(0x01249ad2594c37ce), - u64(0x5cdf165f6018ef06), - u64(0x016dc186ef9f45c2), - u64(0xf416dbf7381f2ac8), - u64(0x01c931e8ab871732), - u64(0xd88e497a83137abd), - u64(0x011dbf316b346e7f), - u64(0xceb1dbd923d8596c), - u64(0x01652efdc6018a1f), - u64(0xc25e52cf6cce6fc7), - u64(0x01be7abd3781eca7), - u64(0xd97af3c1a40105dc), - u64(0x01170cb642b133e8), - u64(0x0fd9b0b20d014754), - u64(0x015ccfe3d35d80e3), - u64(0xd3d01cde90419929), - u64(0x01b403dcc834e11b), - u64(0x6462120b1a28ffb9), - u64(0x01108269fd210cb1), - u64(0xbd7a968de0b33fa8), - u64(0x0154a3047c694fdd), - u64(0x2cd93c3158e00f92), - u64(0x01a9cbc59b83a3d5), - u64(0x3c07c59ed78c09bb), - u64(0x010a1f5b81324665), - u64(0x8b09b7068d6f0c2a), - u64(0x014ca732617ed7fe), - u64(0x2dcc24c830cacf34), - u64(0x019fd0fef9de8dfe), - u64(0xdc9f96fd1e7ec180), - u64(0x0103e29f5c2b18be), - u64(0x93c77cbc661e71e1), - u64(0x0144db473335deee), - u64(0x38b95beb7fa60e59), - u64(0x01961219000356aa), - u64(0xc6e7b2e65f8f91ef), - u64(0x01fb969f40042c54), - u64(0xfc50cfcffbb9bb35), - u64(0x013d3e2388029bb4), - u64(0x3b6503c3faa82a03), - u64(0x018c8dac6a0342a2), - u64(0xca3e44b4f9523484), - u64(0x01efb1178484134a), - u64(0xbe66eaf11bd360d2), - u64(0x0135ceaeb2d28c0e), - u64(0x6e00a5ad62c83907), - u64(0x0183425a5f872f12), - u64(0x0980cf18bb7a4749), - u64(0x01e412f0f768fad7), - u64(0x65f0816f752c6c8d), - u64(0x012e8bd69aa19cc6), - u64(0xff6ca1cb527787b1), - u64(0x017a2ecc414a03f7), - u64(0xff47ca3e2715699d), - u64(0x01d8ba7f519c84f5), - u64(0xbf8cde66d86d6202), - u64(0x0127748f9301d319), - u64(0x2f7016008e88ba83), - u64(0x017151b377c247e0), - u64(0x3b4c1b80b22ae923), - u64(0x01cda62055b2d9d8), - u64(0x250f91306f5ad1b6), - u64(0x012087d4358fc827), - u64(0xee53757c8b318623), - u64(0x0168a9c942f3ba30), - u64(0x29e852dbadfde7ac), - u64(0x01c2d43b93b0a8bd), - u64(0x3a3133c94cbeb0cc), - u64(0x0119c4a53c4e6976), - u64(0xc8bd80bb9fee5cff), - u64(0x016035ce8b6203d3), - u64(0xbaece0ea87e9f43e), - u64(0x01b843422e3a84c8), - u64(0x74d40c9294f238a7), - u64(0x01132a095ce492fd), - u64(0xd2090fb73a2ec6d1), - u64(0x0157f48bb41db7bc), - u64(0x068b53a508ba7885), - u64(0x01adf1aea12525ac), - u64(0x8417144725748b53), - u64(0x010cb70d24b7378b), - u64(0x651cd958eed1ae28), - u64(0x014fe4d06de5056e), - u64(0xfe640faf2a8619b2), - u64(0x01a3de04895e46c9), - u64(0x3efe89cd7a93d00f), - u64(0x01066ac2d5daec3e), - u64(0xcebe2c40d938c413), - u64(0x014805738b51a74d), - u64(0x426db7510f86f518), - u64(0x019a06d06e261121), - u64(0xc9849292a9b4592f), - u64(0x0100444244d7cab4), - u64(0xfbe5b73754216f7a), - u64(0x01405552d60dbd61), - u64(0x7adf25052929cb59), - u64(0x01906aa78b912cba), - u64(0x1996ee4673743e2f), - u64(0x01f485516e7577e9), - u64(0xaffe54ec0828a6dd), - u64(0x0138d352e5096af1), - u64(0x1bfdea270a32d095), - u64(0x018708279e4bc5ae), - u64(0xa2fd64b0ccbf84ba), - u64(0x01e8ca3185deb719), - u64(0x05de5eee7ff7b2f4), - u64(0x01317e5ef3ab3270), - u64(0x0755f6aa1ff59fb1), - u64(0x017dddf6b095ff0c), - u64(0x092b7454a7f3079e), - u64(0x01dd55745cbb7ecf), - u64(0x65bb28b4e8f7e4c3), - u64(0x012a5568b9f52f41), - u64(0xbf29f2e22335ddf3), - u64(0x0174eac2e8727b11), - u64(0x2ef46f9aac035570), - u64(0x01d22573a28f19d6), - u64(0xdd58c5c0ab821566), - u64(0x0123576845997025), - u64(0x54aef730d6629ac0), - u64(0x016c2d4256ffcc2f), - u64(0x29dab4fd0bfb4170), - u64(0x01c73892ecbfbf3b), - u64(0xfa28b11e277d08e6), - u64(0x011c835bd3f7d784), - u64(0x38b2dd65b15c4b1f), - u64(0x0163a432c8f5cd66), - u64(0xc6df94bf1db35de7), - u64(0x01bc8d3f7b3340bf), - u64(0xdc4bbcf772901ab0), - u64(0x0115d847ad000877), - u64(0xd35eac354f34215c), - u64(0x015b4e5998400a95), - u64(0x48365742a30129b4), - u64(0x01b221effe500d3b), - u64(0x0d21f689a5e0ba10), - u64(0x010f5535fef20845), - u64(0x506a742c0f58e894), - u64(0x01532a837eae8a56), - u64(0xe4851137132f22b9), - u64(0x01a7f5245e5a2ceb), - u64(0x6ed32ac26bfd75b4), - u64(0x0108f936baf85c13), - u64(0x4a87f57306fcd321), - u64(0x014b378469b67318), - u64(0x5d29f2cfc8bc07e9), - u64(0x019e056584240fde), - u64(0xfa3a37c1dd7584f1), - u64(0x0102c35f729689ea), - u64(0xb8c8c5b254d2e62e), - u64(0x014374374f3c2c65), - u64(0x26faf71eea079fb9), - u64(0x01945145230b377f), - u64(0xf0b9b4e6a48987a8), - u64(0x01f965966bce055e), - u64(0x5674111026d5f4c9), - u64(0x013bdf7e0360c35b), - u64(0x2c111554308b71fb), - u64(0x018ad75d8438f432), - u64(0xb7155aa93cae4e7a), - u64(0x01ed8d34e547313e), - u64(0x326d58a9c5ecf10c), - u64(0x013478410f4c7ec7), - u64(0xff08aed437682d4f), - u64(0x01819651531f9e78), - u64(0x3ecada89454238a3), - u64(0x01e1fbe5a7e78617), - u64(0x873ec895cb496366), - u64(0x012d3d6f88f0b3ce), - u64(0x290e7abb3e1bbc3f), - u64(0x01788ccb6b2ce0c2), - u64(0xb352196a0da2ab4f), - u64(0x01d6affe45f818f2), - u64(0xb0134fe24885ab11), - u64(0x01262dfeebbb0f97), - u64(0x9c1823dadaa715d6), - u64(0x016fb97ea6a9d37d), - u64(0x031e2cd19150db4b), - u64(0x01cba7de5054485d), - u64(0x21f2dc02fad2890f), - u64(0x011f48eaf234ad3a), - u64(0xaa6f9303b9872b53), - u64(0x01671b25aec1d888), - u64(0xd50b77c4a7e8f628), - u64(0x01c0e1ef1a724eaa), - u64(0xc5272adae8f199d9), - u64(0x01188d357087712a), - u64(0x7670f591a32e004f), - u64(0x015eb082cca94d75), - u64(0xd40d32f60bf98063), - u64(0x01b65ca37fd3a0d2), - u64(0xc4883fd9c77bf03e), - u64(0x0111f9e62fe44483), - u64(0xb5aa4fd0395aec4d), - u64(0x0156785fbbdd55a4), - u64(0xe314e3c447b1a760), - u64(0x01ac1677aad4ab0d), - u64(0xaded0e5aaccf089c), - u64(0x010b8e0acac4eae8), - u64(0xd96851f15802cac3), - u64(0x014e718d7d7625a2), - u64(0x8fc2666dae037d74), - u64(0x01a20df0dcd3af0b), - u64(0x39d980048cc22e68), - u64(0x010548b68a044d67), - u64(0x084fe005aff2ba03), - u64(0x01469ae42c8560c1), - u64(0x4a63d8071bef6883), - u64(0x0198419d37a6b8f1), - u64(0x9cfcce08e2eb42a4), - u64(0x01fe52048590672d), - u64(0x821e00c58dd309a7), - u64(0x013ef342d37a407c), - u64(0xa2a580f6f147cc10), - u64(0x018eb0138858d09b), - u64(0x8b4ee134ad99bf15), - u64(0x01f25c186a6f04c2), - u64(0x97114cc0ec80176d), - u64(0x0137798f428562f9), - u64(0xfcd59ff127a01d48), - u64(0x018557f31326bbb7), - u64(0xfc0b07ed7188249a), - u64(0x01e6adefd7f06aa5), - u64(0xbd86e4f466f516e0), - u64(0x01302cb5e6f642a7), - u64(0xace89e3180b25c98), - u64(0x017c37e360b3d351), - u64(0x1822c5bde0def3be), - u64(0x01db45dc38e0c826), - u64(0xcf15bb96ac8b5857), - u64(0x01290ba9a38c7d17), - u64(0xc2db2a7c57ae2e6d), - u64(0x01734e940c6f9c5d), - u64(0x3391f51b6d99ba08), - u64(0x01d022390f8b8375), - u64(0x403b393124801445), - u64(0x01221563a9b73229), - u64(0x904a077d6da01956), - u64(0x016a9abc9424feb3), - u64(0x745c895cc9081fac), - u64(0x01c5416bb92e3e60), - u64(0x48b9d5d9fda513cb), - u64(0x011b48e353bce6fc), - u64(0x5ae84b507d0e58be), - u64(0x01621b1c28ac20bb), - u64(0x31a25e249c51eeee), - u64(0x01baa1e332d728ea), - u64(0x5f057ad6e1b33554), - u64(0x0114a52dffc67992), - u64(0xf6c6d98c9a2002aa), - u64(0x0159ce797fb817f6), - u64(0xb4788fefc0a80354), - u64(0x01b04217dfa61df4), - u64(0xf0cb59f5d8690214), - u64(0x010e294eebc7d2b8), - u64(0x2cfe30734e83429a), - u64(0x0151b3a2a6b9c767), - u64(0xf83dbc9022241340), - u64(0x01a6208b50683940), - u64(0x9b2695da15568c08), - u64(0x0107d457124123c8), - u64(0xc1f03b509aac2f0a), - u64(0x0149c96cd6d16cba), - u64(0x726c4a24c1573acd), - u64(0x019c3bc80c85c7e9), - u64(0xe783ae56f8d684c0), - u64(0x0101a55d07d39cf1), - u64(0x616499ecb70c25f0), - u64(0x01420eb449c8842e), - u64(0xf9bdc067e4cf2f6c), - u64(0x019292615c3aa539), - u64(0x782d3081de02fb47), - u64(0x01f736f9b3494e88), - u64(0x4b1c3e512ac1dd0c), - u64(0x013a825c100dd115), - u64(0x9de34de57572544f), - u64(0x018922f31411455a), - u64(0x455c215ed2cee963), - u64(0x01eb6bafd91596b1), - u64(0xcb5994db43c151de), - u64(0x0133234de7ad7e2e), - u64(0x7e2ffa1214b1a655), - u64(0x017fec216198ddba), - u64(0x1dbbf89699de0feb), - u64(0x01dfe729b9ff1529), - u64(0xb2957b5e202ac9f3), - u64(0x012bf07a143f6d39), - u64(0x1f3ada35a8357c6f), - u64(0x0176ec98994f4888), - u64(0x270990c31242db8b), - u64(0x01d4a7bebfa31aaa), - u64(0x5865fa79eb69c937), - u64(0x0124e8d737c5f0aa), - u64(0xee7f791866443b85), - u64(0x016e230d05b76cd4), - u64(0x2a1f575e7fd54a66), - u64(0x01c9abd04725480a), - u64(0x5a53969b0fe54e80), - u64(0x011e0b622c774d06), - u64(0xf0e87c41d3dea220), - u64(0x01658e3ab7952047), - u64(0xed229b5248d64aa8), - u64(0x01bef1c9657a6859), - u64(0x3435a1136d85eea9), - u64(0x0117571ddf6c8138), - u64(0x4143095848e76a53), - u64(0x015d2ce55747a186), - u64(0xd193cbae5b2144e8), - u64(0x01b4781ead1989e7), - u64(0xe2fc5f4cf8f4cb11), - u64(0x0110cb132c2ff630), - u64(0x1bbb77203731fdd5), - u64(0x0154fdd7f73bf3bd), - u64(0x62aa54e844fe7d4a), - u64(0x01aa3d4df50af0ac), - u64(0xbdaa75112b1f0e4e), - u64(0x010a6650b926d66b), - u64(0xad15125575e6d1e2), - u64(0x014cffe4e7708c06), - u64(0x585a56ead360865b), - u64(0x01a03fde214caf08), - u64(0x37387652c41c53f8), - u64(0x010427ead4cfed65), - u64(0x850693e7752368f7), - u64(0x014531e58a03e8be), - u64(0x264838e1526c4334), - u64(0x01967e5eec84e2ee), - u64(0xafda4719a7075402), - u64(0x01fc1df6a7a61ba9), - u64(0x0de86c7008649481), - u64(0x013d92ba28c7d14a), - u64(0x9162878c0a7db9a1), - u64(0x018cf768b2f9c59c), - u64(0xb5bb296f0d1d280a), - u64(0x01f03542dfb83703), - u64(0x5194f9e568323906), - u64(0x01362149cbd32262), - u64(0xe5fa385ec23ec747), - u64(0x0183a99c3ec7eafa), - u64(0x9f78c67672ce7919), - u64(0x01e494034e79e5b9), - u64(0x03ab7c0a07c10bb0), - u64(0x012edc82110c2f94), - u64(0x04965b0c89b14e9c), - u64(0x017a93a2954f3b79), - u64(0x45bbf1cfac1da243), - u64(0x01d9388b3aa30a57), - u64(0x8b957721cb92856a), - u64(0x0127c35704a5e676), - u64(0x2e7ad4ea3e7726c4), - u64(0x0171b42cc5cf6014), - u64(0x3a198a24ce14f075), - u64(0x01ce2137f7433819), - u64(0xc44ff65700cd1649), - u64(0x0120d4c2fa8a030f), - u64(0xb563f3ecc1005bdb), - u64(0x016909f3b92c83d3), - u64(0xa2bcf0e7f14072d2), - u64(0x01c34c70a777a4c8), - u64(0x65b61690f6c847c3), - u64(0x011a0fc668aac6fd), - u64(0xbf239c35347a59b4), - u64(0x016093b802d578bc), - u64(0xeeec83428198f021), - u64(0x01b8b8a6038ad6eb), - u64(0x7553d20990ff9615), - u64(0x01137367c236c653), - u64(0x52a8c68bf53f7b9a), - u64(0x01585041b2c477e8), - u64(0x6752f82ef28f5a81), - u64(0x01ae64521f7595e2), - u64(0x8093db1d57999890), - u64(0x010cfeb353a97dad), - u64(0xe0b8d1e4ad7ffeb4), - u64(0x01503e602893dd18), - u64(0x18e7065dd8dffe62), - u64(0x01a44df832b8d45f), - u64(0x6f9063faa78bfefd), - u64(0x0106b0bb1fb384bb), - u64(0x4b747cf9516efebc), - u64(0x01485ce9e7a065ea), - u64(0xde519c37a5cabe6b), - u64(0x019a742461887f64), - u64(0x0af301a2c79eb703), - u64(0x01008896bcf54f9f), - u64(0xcdafc20b798664c4), - u64(0x0140aabc6c32a386), - u64(0x811bb28e57e7fdf5), - u64(0x0190d56b873f4c68), - u64(0xa1629f31ede1fd72), - u64(0x01f50ac6690f1f82), - u64(0xa4dda37f34ad3e67), - u64(0x013926bc01a973b1), - u64(0x0e150c5f01d88e01), - u64(0x0187706b0213d09e), - u64(0x919a4f76c24eb181), - u64(0x01e94c85c298c4c5), - u64(0x7b0071aa39712ef1), - u64(0x0131cfd3999f7afb), - u64(0x59c08e14c7cd7aad), - u64(0x017e43c8800759ba), - u64(0xf030b199f9c0d958), - u64(0x01ddd4baa0093028), - u64(0x961e6f003c1887d7), - u64(0x012aa4f4a405be19), - u64(0xfba60ac04b1ea9cd), - u64(0x01754e31cd072d9f), - u64(0xfa8f8d705de65440), - u64(0x01d2a1be4048f907), - u64(0xfc99b8663aaff4a8), - u64(0x0123a516e82d9ba4), - u64(0x3bc0267fc95bf1d2), - u64(0x016c8e5ca239028e), - u64(0xcab0301fbbb2ee47), - u64(0x01c7b1f3cac74331), - u64(0x1eae1e13d54fd4ec), - u64(0x011ccf385ebc89ff), - u64(0xe659a598caa3ca27), - u64(0x01640306766bac7e), - u64(0x9ff00efefd4cbcb1), - u64(0x01bd03c81406979e), - u64(0x23f6095f5e4ff5ef), - u64(0x0116225d0c841ec3), - u64(0xecf38bb735e3f36a), - u64(0x015baaf44fa52673), - u64(0xe8306ea5035cf045), - u64(0x01b295b1638e7010), - u64(0x911e4527221a162b), - u64(0x010f9d8ede39060a), - u64(0x3565d670eaa09bb6), - u64(0x015384f295c7478d), - u64(0x82bf4c0d2548c2a3), - u64(0x01a8662f3b391970), - u64(0x51b78f88374d79a6), - u64(0x01093fdd8503afe6), - u64(0xe625736a4520d810), - u64(0x014b8fd4e6449bdf), - u64(0xdfaed044d6690e14), - u64(0x019e73ca1fd5c2d7), - u64(0xebcd422b0601a8cc), - u64(0x0103085e53e599c6), - u64(0xa6c092b5c78212ff), - u64(0x0143ca75e8df0038), - u64(0xd070b763396297bf), - u64(0x0194bd136316c046), - u64(0x848ce53c07bb3daf), - u64(0x01f9ec583bdc7058), - u64(0x52d80f4584d5068d), - u64(0x013c33b72569c637), - u64(0x278e1316e60a4831), - u64(0x018b40a4eec437c5), - ]! +const pow5_split_64_x = [ + u64(0x0000000000000000), + u64(0x0100000000000000), + u64(0x0000000000000000), + u64(0x0140000000000000), + u64(0x0000000000000000), + u64(0x0190000000000000), + u64(0x0000000000000000), + u64(0x01f4000000000000), + u64(0x0000000000000000), + u64(0x0138800000000000), + u64(0x0000000000000000), + u64(0x0186a00000000000), + u64(0x0000000000000000), + u64(0x01e8480000000000), + u64(0x0000000000000000), + u64(0x01312d0000000000), + u64(0x0000000000000000), + u64(0x017d784000000000), + u64(0x0000000000000000), + u64(0x01dcd65000000000), + u64(0x0000000000000000), + u64(0x012a05f200000000), + u64(0x0000000000000000), + u64(0x0174876e80000000), + u64(0x0000000000000000), + u64(0x01d1a94a20000000), + u64(0x0000000000000000), + u64(0x012309ce54000000), + u64(0x0000000000000000), + u64(0x016bcc41e9000000), + u64(0x0000000000000000), + u64(0x01c6bf5263400000), + u64(0x0000000000000000), + u64(0x011c37937e080000), + u64(0x0000000000000000), + u64(0x016345785d8a0000), + u64(0x0000000000000000), + u64(0x01bc16d674ec8000), + u64(0x0000000000000000), + u64(0x01158e460913d000), + u64(0x0000000000000000), + u64(0x015af1d78b58c400), + u64(0x0000000000000000), + u64(0x01b1ae4d6e2ef500), + u64(0x0000000000000000), + u64(0x010f0cf064dd5920), + u64(0x0000000000000000), + u64(0x0152d02c7e14af68), + u64(0x0000000000000000), + u64(0x01a784379d99db42), + u64(0x4000000000000000), + u64(0x0108b2a2c2802909), + u64(0x9000000000000000), + u64(0x014adf4b7320334b), + u64(0x7400000000000000), + u64(0x019d971e4fe8401e), + u64(0x0880000000000000), + u64(0x01027e72f1f12813), + u64(0xcaa0000000000000), + u64(0x01431e0fae6d7217), + u64(0xbd48000000000000), + u64(0x0193e5939a08ce9d), + u64(0x2c9a000000000000), + u64(0x01f8def8808b0245), + u64(0x3be0400000000000), + u64(0x013b8b5b5056e16b), + u64(0x0ad8500000000000), + u64(0x018a6e32246c99c6), + u64(0x8d8e640000000000), + u64(0x01ed09bead87c037), + u64(0xb878fe8000000000), + u64(0x013426172c74d822), + u64(0x66973e2000000000), + u64(0x01812f9cf7920e2b), + u64(0x403d0da800000000), + u64(0x01e17b84357691b6), + u64(0xe826288900000000), + u64(0x012ced32a16a1b11), + u64(0x622fb2ab40000000), + u64(0x0178287f49c4a1d6), + u64(0xfabb9f5610000000), + u64(0x01d6329f1c35ca4b), + u64(0x7cb54395ca000000), + u64(0x0125dfa371a19e6f), + u64(0x5be2947b3c800000), + u64(0x016f578c4e0a060b), + u64(0x32db399a0ba00000), + u64(0x01cb2d6f618c878e), + u64(0xdfc9040047440000), + u64(0x011efc659cf7d4b8), + u64(0x17bb450059150000), + u64(0x0166bb7f0435c9e7), + u64(0xddaa16406f5a4000), + u64(0x01c06a5ec5433c60), + u64(0x8a8a4de845986800), + u64(0x0118427b3b4a05bc), + u64(0xad2ce16256fe8200), + u64(0x015e531a0a1c872b), + u64(0x987819baecbe2280), + u64(0x01b5e7e08ca3a8f6), + u64(0x1f4b1014d3f6d590), + u64(0x0111b0ec57e6499a), + u64(0xa71dd41a08f48af4), + u64(0x01561d276ddfdc00), + u64(0xd0e549208b31adb1), + u64(0x01aba4714957d300), + u64(0x828f4db456ff0c8e), + u64(0x010b46c6cdd6e3e0), + u64(0xa33321216cbecfb2), + u64(0x014e1878814c9cd8), + u64(0xcbffe969c7ee839e), + u64(0x01a19e96a19fc40e), + u64(0x3f7ff1e21cf51243), + u64(0x0105031e2503da89), + u64(0x8f5fee5aa43256d4), + u64(0x014643e5ae44d12b), + u64(0x7337e9f14d3eec89), + u64(0x0197d4df19d60576), + u64(0x1005e46da08ea7ab), + u64(0x01fdca16e04b86d4), + u64(0x8a03aec4845928cb), + u64(0x013e9e4e4c2f3444), + u64(0xac849a75a56f72fd), + u64(0x018e45e1df3b0155), + u64(0x17a5c1130ecb4fbd), + u64(0x01f1d75a5709c1ab), + u64(0xeec798abe93f11d6), + u64(0x013726987666190a), + u64(0xaa797ed6e38ed64b), + u64(0x0184f03e93ff9f4d), + u64(0x1517de8c9c728bde), + u64(0x01e62c4e38ff8721), + u64(0xad2eeb17e1c7976b), + u64(0x012fdbb0e39fb474), + u64(0xd87aa5ddda397d46), + u64(0x017bd29d1c87a191), + u64(0x4e994f5550c7dc97), + u64(0x01dac74463a989f6), + u64(0xf11fd195527ce9de), + u64(0x0128bc8abe49f639), + u64(0x6d67c5faa71c2456), + u64(0x0172ebad6ddc73c8), + u64(0x88c1b77950e32d6c), + u64(0x01cfa698c95390ba), + u64(0x957912abd28dfc63), + u64(0x0121c81f7dd43a74), + u64(0xbad75756c7317b7c), + u64(0x016a3a275d494911), + u64(0x298d2d2c78fdda5b), + u64(0x01c4c8b1349b9b56), + u64(0xd9f83c3bcb9ea879), + u64(0x011afd6ec0e14115), + u64(0x50764b4abe865297), + u64(0x0161bcca7119915b), + u64(0x2493de1d6e27e73d), + u64(0x01ba2bfd0d5ff5b2), + u64(0x56dc6ad264d8f086), + u64(0x01145b7e285bf98f), + u64(0x2c938586fe0f2ca8), + u64(0x0159725db272f7f3), + u64(0xf7b866e8bd92f7d2), + u64(0x01afcef51f0fb5ef), + u64(0xfad34051767bdae3), + u64(0x010de1593369d1b5), + u64(0x79881065d41ad19c), + u64(0x015159af80444623), + u64(0x57ea147f49218603), + u64(0x01a5b01b605557ac), + u64(0xb6f24ccf8db4f3c1), + u64(0x01078e111c3556cb), + u64(0xa4aee003712230b2), + u64(0x014971956342ac7e), + u64(0x4dda98044d6abcdf), + u64(0x019bcdfabc13579e), + u64(0xf0a89f02b062b60b), + u64(0x010160bcb58c16c2), + u64(0xacd2c6c35c7b638e), + u64(0x0141b8ebe2ef1c73), + u64(0x98077874339a3c71), + u64(0x01922726dbaae390), + u64(0xbe0956914080cb8e), + u64(0x01f6b0f092959c74), + u64(0xf6c5d61ac8507f38), + u64(0x013a2e965b9d81c8), + u64(0x34774ba17a649f07), + u64(0x0188ba3bf284e23b), + u64(0x01951e89d8fdc6c8), + u64(0x01eae8caef261aca), + u64(0x40fd3316279e9c3d), + u64(0x0132d17ed577d0be), + u64(0xd13c7fdbb186434c), + u64(0x017f85de8ad5c4ed), + u64(0x458b9fd29de7d420), + u64(0x01df67562d8b3629), + u64(0xcb7743e3a2b0e494), + u64(0x012ba095dc7701d9), + u64(0x3e5514dc8b5d1db9), + u64(0x017688bb5394c250), + u64(0x4dea5a13ae346527), + u64(0x01d42aea2879f2e4), + u64(0xb0b2784c4ce0bf38), + u64(0x01249ad2594c37ce), + u64(0x5cdf165f6018ef06), + u64(0x016dc186ef9f45c2), + u64(0xf416dbf7381f2ac8), + u64(0x01c931e8ab871732), + u64(0xd88e497a83137abd), + u64(0x011dbf316b346e7f), + u64(0xceb1dbd923d8596c), + u64(0x01652efdc6018a1f), + u64(0xc25e52cf6cce6fc7), + u64(0x01be7abd3781eca7), + u64(0xd97af3c1a40105dc), + u64(0x01170cb642b133e8), + u64(0x0fd9b0b20d014754), + u64(0x015ccfe3d35d80e3), + u64(0xd3d01cde90419929), + u64(0x01b403dcc834e11b), + u64(0x6462120b1a28ffb9), + u64(0x01108269fd210cb1), + u64(0xbd7a968de0b33fa8), + u64(0x0154a3047c694fdd), + u64(0x2cd93c3158e00f92), + u64(0x01a9cbc59b83a3d5), + u64(0x3c07c59ed78c09bb), + u64(0x010a1f5b81324665), + u64(0x8b09b7068d6f0c2a), + u64(0x014ca732617ed7fe), + u64(0x2dcc24c830cacf34), + u64(0x019fd0fef9de8dfe), + u64(0xdc9f96fd1e7ec180), + u64(0x0103e29f5c2b18be), + u64(0x93c77cbc661e71e1), + u64(0x0144db473335deee), + u64(0x38b95beb7fa60e59), + u64(0x01961219000356aa), + u64(0xc6e7b2e65f8f91ef), + u64(0x01fb969f40042c54), + u64(0xfc50cfcffbb9bb35), + u64(0x013d3e2388029bb4), + u64(0x3b6503c3faa82a03), + u64(0x018c8dac6a0342a2), + u64(0xca3e44b4f9523484), + u64(0x01efb1178484134a), + u64(0xbe66eaf11bd360d2), + u64(0x0135ceaeb2d28c0e), + u64(0x6e00a5ad62c83907), + u64(0x0183425a5f872f12), + u64(0x0980cf18bb7a4749), + u64(0x01e412f0f768fad7), + u64(0x65f0816f752c6c8d), + u64(0x012e8bd69aa19cc6), + u64(0xff6ca1cb527787b1), + u64(0x017a2ecc414a03f7), + u64(0xff47ca3e2715699d), + u64(0x01d8ba7f519c84f5), + u64(0xbf8cde66d86d6202), + u64(0x0127748f9301d319), + u64(0x2f7016008e88ba83), + u64(0x017151b377c247e0), + u64(0x3b4c1b80b22ae923), + u64(0x01cda62055b2d9d8), + u64(0x250f91306f5ad1b6), + u64(0x012087d4358fc827), + u64(0xee53757c8b318623), + u64(0x0168a9c942f3ba30), + u64(0x29e852dbadfde7ac), + u64(0x01c2d43b93b0a8bd), + u64(0x3a3133c94cbeb0cc), + u64(0x0119c4a53c4e6976), + u64(0xc8bd80bb9fee5cff), + u64(0x016035ce8b6203d3), + u64(0xbaece0ea87e9f43e), + u64(0x01b843422e3a84c8), + u64(0x74d40c9294f238a7), + u64(0x01132a095ce492fd), + u64(0xd2090fb73a2ec6d1), + u64(0x0157f48bb41db7bc), + u64(0x068b53a508ba7885), + u64(0x01adf1aea12525ac), + u64(0x8417144725748b53), + u64(0x010cb70d24b7378b), + u64(0x651cd958eed1ae28), + u64(0x014fe4d06de5056e), + u64(0xfe640faf2a8619b2), + u64(0x01a3de04895e46c9), + u64(0x3efe89cd7a93d00f), + u64(0x01066ac2d5daec3e), + u64(0xcebe2c40d938c413), + u64(0x014805738b51a74d), + u64(0x426db7510f86f518), + u64(0x019a06d06e261121), + u64(0xc9849292a9b4592f), + u64(0x0100444244d7cab4), + u64(0xfbe5b73754216f7a), + u64(0x01405552d60dbd61), + u64(0x7adf25052929cb59), + u64(0x01906aa78b912cba), + u64(0x1996ee4673743e2f), + u64(0x01f485516e7577e9), + u64(0xaffe54ec0828a6dd), + u64(0x0138d352e5096af1), + u64(0x1bfdea270a32d095), + u64(0x018708279e4bc5ae), + u64(0xa2fd64b0ccbf84ba), + u64(0x01e8ca3185deb719), + u64(0x05de5eee7ff7b2f4), + u64(0x01317e5ef3ab3270), + u64(0x0755f6aa1ff59fb1), + u64(0x017dddf6b095ff0c), + u64(0x092b7454a7f3079e), + u64(0x01dd55745cbb7ecf), + u64(0x65bb28b4e8f7e4c3), + u64(0x012a5568b9f52f41), + u64(0xbf29f2e22335ddf3), + u64(0x0174eac2e8727b11), + u64(0x2ef46f9aac035570), + u64(0x01d22573a28f19d6), + u64(0xdd58c5c0ab821566), + u64(0x0123576845997025), + u64(0x54aef730d6629ac0), + u64(0x016c2d4256ffcc2f), + u64(0x29dab4fd0bfb4170), + u64(0x01c73892ecbfbf3b), + u64(0xfa28b11e277d08e6), + u64(0x011c835bd3f7d784), + u64(0x38b2dd65b15c4b1f), + u64(0x0163a432c8f5cd66), + u64(0xc6df94bf1db35de7), + u64(0x01bc8d3f7b3340bf), + u64(0xdc4bbcf772901ab0), + u64(0x0115d847ad000877), + u64(0xd35eac354f34215c), + u64(0x015b4e5998400a95), + u64(0x48365742a30129b4), + u64(0x01b221effe500d3b), + u64(0x0d21f689a5e0ba10), + u64(0x010f5535fef20845), + u64(0x506a742c0f58e894), + u64(0x01532a837eae8a56), + u64(0xe4851137132f22b9), + u64(0x01a7f5245e5a2ceb), + u64(0x6ed32ac26bfd75b4), + u64(0x0108f936baf85c13), + u64(0x4a87f57306fcd321), + u64(0x014b378469b67318), + u64(0x5d29f2cfc8bc07e9), + u64(0x019e056584240fde), + u64(0xfa3a37c1dd7584f1), + u64(0x0102c35f729689ea), + u64(0xb8c8c5b254d2e62e), + u64(0x014374374f3c2c65), + u64(0x26faf71eea079fb9), + u64(0x01945145230b377f), + u64(0xf0b9b4e6a48987a8), + u64(0x01f965966bce055e), + u64(0x5674111026d5f4c9), + u64(0x013bdf7e0360c35b), + u64(0x2c111554308b71fb), + u64(0x018ad75d8438f432), + u64(0xb7155aa93cae4e7a), + u64(0x01ed8d34e547313e), + u64(0x326d58a9c5ecf10c), + u64(0x013478410f4c7ec7), + u64(0xff08aed437682d4f), + u64(0x01819651531f9e78), + u64(0x3ecada89454238a3), + u64(0x01e1fbe5a7e78617), + u64(0x873ec895cb496366), + u64(0x012d3d6f88f0b3ce), + u64(0x290e7abb3e1bbc3f), + u64(0x01788ccb6b2ce0c2), + u64(0xb352196a0da2ab4f), + u64(0x01d6affe45f818f2), + u64(0xb0134fe24885ab11), + u64(0x01262dfeebbb0f97), + u64(0x9c1823dadaa715d6), + u64(0x016fb97ea6a9d37d), + u64(0x031e2cd19150db4b), + u64(0x01cba7de5054485d), + u64(0x21f2dc02fad2890f), + u64(0x011f48eaf234ad3a), + u64(0xaa6f9303b9872b53), + u64(0x01671b25aec1d888), + u64(0xd50b77c4a7e8f628), + u64(0x01c0e1ef1a724eaa), + u64(0xc5272adae8f199d9), + u64(0x01188d357087712a), + u64(0x7670f591a32e004f), + u64(0x015eb082cca94d75), + u64(0xd40d32f60bf98063), + u64(0x01b65ca37fd3a0d2), + u64(0xc4883fd9c77bf03e), + u64(0x0111f9e62fe44483), + u64(0xb5aa4fd0395aec4d), + u64(0x0156785fbbdd55a4), + u64(0xe314e3c447b1a760), + u64(0x01ac1677aad4ab0d), + u64(0xaded0e5aaccf089c), + u64(0x010b8e0acac4eae8), + u64(0xd96851f15802cac3), + u64(0x014e718d7d7625a2), + u64(0x8fc2666dae037d74), + u64(0x01a20df0dcd3af0b), + u64(0x39d980048cc22e68), + u64(0x010548b68a044d67), + u64(0x084fe005aff2ba03), + u64(0x01469ae42c8560c1), + u64(0x4a63d8071bef6883), + u64(0x0198419d37a6b8f1), + u64(0x9cfcce08e2eb42a4), + u64(0x01fe52048590672d), + u64(0x821e00c58dd309a7), + u64(0x013ef342d37a407c), + u64(0xa2a580f6f147cc10), + u64(0x018eb0138858d09b), + u64(0x8b4ee134ad99bf15), + u64(0x01f25c186a6f04c2), + u64(0x97114cc0ec80176d), + u64(0x0137798f428562f9), + u64(0xfcd59ff127a01d48), + u64(0x018557f31326bbb7), + u64(0xfc0b07ed7188249a), + u64(0x01e6adefd7f06aa5), + u64(0xbd86e4f466f516e0), + u64(0x01302cb5e6f642a7), + u64(0xace89e3180b25c98), + u64(0x017c37e360b3d351), + u64(0x1822c5bde0def3be), + u64(0x01db45dc38e0c826), + u64(0xcf15bb96ac8b5857), + u64(0x01290ba9a38c7d17), + u64(0xc2db2a7c57ae2e6d), + u64(0x01734e940c6f9c5d), + u64(0x3391f51b6d99ba08), + u64(0x01d022390f8b8375), + u64(0x403b393124801445), + u64(0x01221563a9b73229), + u64(0x904a077d6da01956), + u64(0x016a9abc9424feb3), + u64(0x745c895cc9081fac), + u64(0x01c5416bb92e3e60), + u64(0x48b9d5d9fda513cb), + u64(0x011b48e353bce6fc), + u64(0x5ae84b507d0e58be), + u64(0x01621b1c28ac20bb), + u64(0x31a25e249c51eeee), + u64(0x01baa1e332d728ea), + u64(0x5f057ad6e1b33554), + u64(0x0114a52dffc67992), + u64(0xf6c6d98c9a2002aa), + u64(0x0159ce797fb817f6), + u64(0xb4788fefc0a80354), + u64(0x01b04217dfa61df4), + u64(0xf0cb59f5d8690214), + u64(0x010e294eebc7d2b8), + u64(0x2cfe30734e83429a), + u64(0x0151b3a2a6b9c767), + u64(0xf83dbc9022241340), + u64(0x01a6208b50683940), + u64(0x9b2695da15568c08), + u64(0x0107d457124123c8), + u64(0xc1f03b509aac2f0a), + u64(0x0149c96cd6d16cba), + u64(0x726c4a24c1573acd), + u64(0x019c3bc80c85c7e9), + u64(0xe783ae56f8d684c0), + u64(0x0101a55d07d39cf1), + u64(0x616499ecb70c25f0), + u64(0x01420eb449c8842e), + u64(0xf9bdc067e4cf2f6c), + u64(0x019292615c3aa539), + u64(0x782d3081de02fb47), + u64(0x01f736f9b3494e88), + u64(0x4b1c3e512ac1dd0c), + u64(0x013a825c100dd115), + u64(0x9de34de57572544f), + u64(0x018922f31411455a), + u64(0x455c215ed2cee963), + u64(0x01eb6bafd91596b1), + u64(0xcb5994db43c151de), + u64(0x0133234de7ad7e2e), + u64(0x7e2ffa1214b1a655), + u64(0x017fec216198ddba), + u64(0x1dbbf89699de0feb), + u64(0x01dfe729b9ff1529), + u64(0xb2957b5e202ac9f3), + u64(0x012bf07a143f6d39), + u64(0x1f3ada35a8357c6f), + u64(0x0176ec98994f4888), + u64(0x270990c31242db8b), + u64(0x01d4a7bebfa31aaa), + u64(0x5865fa79eb69c937), + u64(0x0124e8d737c5f0aa), + u64(0xee7f791866443b85), + u64(0x016e230d05b76cd4), + u64(0x2a1f575e7fd54a66), + u64(0x01c9abd04725480a), + u64(0x5a53969b0fe54e80), + u64(0x011e0b622c774d06), + u64(0xf0e87c41d3dea220), + u64(0x01658e3ab7952047), + u64(0xed229b5248d64aa8), + u64(0x01bef1c9657a6859), + u64(0x3435a1136d85eea9), + u64(0x0117571ddf6c8138), + u64(0x4143095848e76a53), + u64(0x015d2ce55747a186), + u64(0xd193cbae5b2144e8), + u64(0x01b4781ead1989e7), + u64(0xe2fc5f4cf8f4cb11), + u64(0x0110cb132c2ff630), + u64(0x1bbb77203731fdd5), + u64(0x0154fdd7f73bf3bd), + u64(0x62aa54e844fe7d4a), + u64(0x01aa3d4df50af0ac), + u64(0xbdaa75112b1f0e4e), + u64(0x010a6650b926d66b), + u64(0xad15125575e6d1e2), + u64(0x014cffe4e7708c06), + u64(0x585a56ead360865b), + u64(0x01a03fde214caf08), + u64(0x37387652c41c53f8), + u64(0x010427ead4cfed65), + u64(0x850693e7752368f7), + u64(0x014531e58a03e8be), + u64(0x264838e1526c4334), + u64(0x01967e5eec84e2ee), + u64(0xafda4719a7075402), + u64(0x01fc1df6a7a61ba9), + u64(0x0de86c7008649481), + u64(0x013d92ba28c7d14a), + u64(0x9162878c0a7db9a1), + u64(0x018cf768b2f9c59c), + u64(0xb5bb296f0d1d280a), + u64(0x01f03542dfb83703), + u64(0x5194f9e568323906), + u64(0x01362149cbd32262), + u64(0xe5fa385ec23ec747), + u64(0x0183a99c3ec7eafa), + u64(0x9f78c67672ce7919), + u64(0x01e494034e79e5b9), + u64(0x03ab7c0a07c10bb0), + u64(0x012edc82110c2f94), + u64(0x04965b0c89b14e9c), + u64(0x017a93a2954f3b79), + u64(0x45bbf1cfac1da243), + u64(0x01d9388b3aa30a57), + u64(0x8b957721cb92856a), + u64(0x0127c35704a5e676), + u64(0x2e7ad4ea3e7726c4), + u64(0x0171b42cc5cf6014), + u64(0x3a198a24ce14f075), + u64(0x01ce2137f7433819), + u64(0xc44ff65700cd1649), + u64(0x0120d4c2fa8a030f), + u64(0xb563f3ecc1005bdb), + u64(0x016909f3b92c83d3), + u64(0xa2bcf0e7f14072d2), + u64(0x01c34c70a777a4c8), + u64(0x65b61690f6c847c3), + u64(0x011a0fc668aac6fd), + u64(0xbf239c35347a59b4), + u64(0x016093b802d578bc), + u64(0xeeec83428198f021), + u64(0x01b8b8a6038ad6eb), + u64(0x7553d20990ff9615), + u64(0x01137367c236c653), + u64(0x52a8c68bf53f7b9a), + u64(0x01585041b2c477e8), + u64(0x6752f82ef28f5a81), + u64(0x01ae64521f7595e2), + u64(0x8093db1d57999890), + u64(0x010cfeb353a97dad), + u64(0xe0b8d1e4ad7ffeb4), + u64(0x01503e602893dd18), + u64(0x18e7065dd8dffe62), + u64(0x01a44df832b8d45f), + u64(0x6f9063faa78bfefd), + u64(0x0106b0bb1fb384bb), + u64(0x4b747cf9516efebc), + u64(0x01485ce9e7a065ea), + u64(0xde519c37a5cabe6b), + u64(0x019a742461887f64), + u64(0x0af301a2c79eb703), + u64(0x01008896bcf54f9f), + u64(0xcdafc20b798664c4), + u64(0x0140aabc6c32a386), + u64(0x811bb28e57e7fdf5), + u64(0x0190d56b873f4c68), + u64(0xa1629f31ede1fd72), + u64(0x01f50ac6690f1f82), + u64(0xa4dda37f34ad3e67), + u64(0x013926bc01a973b1), + u64(0x0e150c5f01d88e01), + u64(0x0187706b0213d09e), + u64(0x919a4f76c24eb181), + u64(0x01e94c85c298c4c5), + u64(0x7b0071aa39712ef1), + u64(0x0131cfd3999f7afb), + u64(0x59c08e14c7cd7aad), + u64(0x017e43c8800759ba), + u64(0xf030b199f9c0d958), + u64(0x01ddd4baa0093028), + u64(0x961e6f003c1887d7), + u64(0x012aa4f4a405be19), + u64(0xfba60ac04b1ea9cd), + u64(0x01754e31cd072d9f), + u64(0xfa8f8d705de65440), + u64(0x01d2a1be4048f907), + u64(0xfc99b8663aaff4a8), + u64(0x0123a516e82d9ba4), + u64(0x3bc0267fc95bf1d2), + u64(0x016c8e5ca239028e), + u64(0xcab0301fbbb2ee47), + u64(0x01c7b1f3cac74331), + u64(0x1eae1e13d54fd4ec), + u64(0x011ccf385ebc89ff), + u64(0xe659a598caa3ca27), + u64(0x01640306766bac7e), + u64(0x9ff00efefd4cbcb1), + u64(0x01bd03c81406979e), + u64(0x23f6095f5e4ff5ef), + u64(0x0116225d0c841ec3), + u64(0xecf38bb735e3f36a), + u64(0x015baaf44fa52673), + u64(0xe8306ea5035cf045), + u64(0x01b295b1638e7010), + u64(0x911e4527221a162b), + u64(0x010f9d8ede39060a), + u64(0x3565d670eaa09bb6), + u64(0x015384f295c7478d), + u64(0x82bf4c0d2548c2a3), + u64(0x01a8662f3b391970), + u64(0x51b78f88374d79a6), + u64(0x01093fdd8503afe6), + u64(0xe625736a4520d810), + u64(0x014b8fd4e6449bdf), + u64(0xdfaed044d6690e14), + u64(0x019e73ca1fd5c2d7), + u64(0xebcd422b0601a8cc), + u64(0x0103085e53e599c6), + u64(0xa6c092b5c78212ff), + u64(0x0143ca75e8df0038), + u64(0xd070b763396297bf), + u64(0x0194bd136316c046), + u64(0x848ce53c07bb3daf), + u64(0x01f9ec583bdc7058), + u64(0x52d80f4584d5068d), + u64(0x013c33b72569c637), + u64(0x278e1316e60a4831), + u64(0x018b40a4eec437c5), +]! - pow5_inv_split_64_x = [ - u64(0x0000000000000001), - u64(0x0400000000000000), - u64(0x3333333333333334), - u64(0x0333333333333333), - u64(0x28f5c28f5c28f5c3), - u64(0x028f5c28f5c28f5c), - u64(0xed916872b020c49c), - u64(0x020c49ba5e353f7c), - u64(0xaf4f0d844d013a93), - u64(0x0346dc5d63886594), - u64(0x8c3f3e0370cdc876), - u64(0x029f16b11c6d1e10), - u64(0xd698fe69270b06c5), - u64(0x0218def416bdb1a6), - u64(0xf0f4ca41d811a46e), - u64(0x035afe535795e90a), - u64(0xf3f70834acdae9f1), - u64(0x02af31dc4611873b), - u64(0x5cc5a02a23e254c1), - u64(0x0225c17d04dad296), - u64(0xfad5cd10396a2135), - u64(0x036f9bfb3af7b756), - u64(0xfbde3da69454e75e), - u64(0x02bfaffc2f2c92ab), - u64(0x2fe4fe1edd10b918), - u64(0x0232f33025bd4223), - u64(0x4ca19697c81ac1bf), - u64(0x0384b84d092ed038), - u64(0x3d4e1213067bce33), - u64(0x02d09370d4257360), - u64(0x643e74dc052fd829), - u64(0x024075f3dceac2b3), - u64(0x6d30baf9a1e626a7), - u64(0x039a5652fb113785), - u64(0x2426fbfae7eb5220), - u64(0x02e1dea8c8da92d1), - u64(0x1cebfcc8b9890e80), - u64(0x024e4bba3a487574), - u64(0x94acc7a78f41b0cc), - u64(0x03b07929f6da5586), - u64(0xaa23d2ec729af3d7), - u64(0x02f394219248446b), - u64(0xbb4fdbf05baf2979), - u64(0x025c768141d369ef), - u64(0xc54c931a2c4b758d), - u64(0x03c7240202ebdcb2), - u64(0x9dd6dc14f03c5e0b), - u64(0x0305b66802564a28), - u64(0x4b1249aa59c9e4d6), - u64(0x026af8533511d4ed), - u64(0x44ea0f76f60fd489), - u64(0x03de5a1ebb4fbb15), - u64(0x6a54d92bf80caa07), - u64(0x0318481895d96277), - u64(0x21dd7a89933d54d2), - u64(0x0279d346de4781f9), - u64(0x362f2a75b8622150), - u64(0x03f61ed7ca0c0328), - u64(0xf825bb91604e810d), - u64(0x032b4bdfd4d668ec), - u64(0xc684960de6a5340b), - u64(0x0289097fdd7853f0), - u64(0xd203ab3e521dc33c), - u64(0x02073accb12d0ff3), - u64(0xe99f7863b696052c), - u64(0x033ec47ab514e652), - u64(0x87b2c6b62bab3757), - u64(0x02989d2ef743eb75), - u64(0xd2f56bc4efbc2c45), - u64(0x0213b0f25f69892a), - u64(0x1e55793b192d13a2), - u64(0x0352b4b6ff0f41de), - u64(0x4b77942f475742e8), - u64(0x02a8909265a5ce4b), - u64(0xd5f9435905df68ba), - u64(0x022073a8515171d5), - u64(0x565b9ef4d6324129), - u64(0x03671f73b54f1c89), - u64(0xdeafb25d78283421), - u64(0x02b8e5f62aa5b06d), - u64(0x188c8eb12cecf681), - u64(0x022d84c4eeeaf38b), - u64(0x8dadb11b7b14bd9b), - u64(0x037c07a17e44b8de), - u64(0x7157c0e2c8dd647c), - u64(0x02c99fb46503c718), - u64(0x8ddfcd823a4ab6ca), - u64(0x023ae629ea696c13), - u64(0x1632e269f6ddf142), - u64(0x0391704310a8acec), - u64(0x44f581ee5f17f435), - u64(0x02dac035a6ed5723), - u64(0x372ace584c1329c4), - u64(0x024899c4858aac1c), - u64(0xbeaae3c079b842d3), - u64(0x03a75c6da27779c6), - u64(0x6555830061603576), - u64(0x02ec49f14ec5fb05), - u64(0xb7779c004de6912b), - u64(0x0256a18dd89e626a), - u64(0xf258f99a163db512), - u64(0x03bdcf495a9703dd), - u64(0x5b7a614811caf741), - u64(0x02fe3f6de212697e), - u64(0xaf951aa00e3bf901), - u64(0x0264ff8b1b41edfe), - u64(0x7f54f7667d2cc19b), - u64(0x03d4cc11c5364997), - u64(0x32aa5f8530f09ae3), - u64(0x0310a3416a91d479), - u64(0xf55519375a5a1582), - u64(0x0273b5cdeedb1060), - u64(0xbbbb5b8bc3c3559d), - u64(0x03ec56164af81a34), - u64(0x2fc916096969114a), - u64(0x03237811d593482a), - u64(0x596dab3ababa743c), - u64(0x0282c674aadc39bb), - u64(0x478aef622efb9030), - u64(0x0202385d557cfafc), - u64(0xd8de4bd04b2c19e6), - u64(0x0336c0955594c4c6), - u64(0xad7ea30d08f014b8), - u64(0x029233aaaadd6a38), - u64(0x24654f3da0c01093), - u64(0x020e8fbbbbe454fa), - u64(0x3a3bb1fc346680eb), - u64(0x034a7f92c63a2190), - u64(0x94fc8e635d1ecd89), - u64(0x02a1ffa89e94e7a6), - u64(0xaa63a51c4a7f0ad4), - u64(0x021b32ed4baa52eb), - u64(0xdd6c3b607731aaed), - u64(0x035eb7e212aa1e45), - u64(0x1789c919f8f488bd), - u64(0x02b22cb4dbbb4b6b), - u64(0xac6e3a7b2d906d64), - u64(0x022823c3e2fc3c55), - u64(0x13e390c515b3e23a), - u64(0x03736c6c9e606089), - u64(0xdcb60d6a77c31b62), - u64(0x02c2bd23b1e6b3a0), - u64(0x7d5e7121f968e2b5), - u64(0x0235641c8e52294d), - u64(0xc8971b698f0e3787), - u64(0x0388a02db0837548), - u64(0xa078e2bad8d82c6c), - u64(0x02d3b357c0692aa0), - u64(0xe6c71bc8ad79bd24), - u64(0x0242f5dfcd20eee6), - u64(0x0ad82c7448c2c839), - u64(0x039e5632e1ce4b0b), - u64(0x3be023903a356cfa), - u64(0x02e511c24e3ea26f), - u64(0x2fe682d9c82abd95), - u64(0x0250db01d8321b8c), - u64(0x4ca4048fa6aac8ee), - u64(0x03b4919c8d1cf8e0), - u64(0x3d5003a61eef0725), - u64(0x02f6dae3a4172d80), - u64(0x9773361e7f259f51), - u64(0x025f1582e9ac2466), - u64(0x8beb89ca6508fee8), - u64(0x03cb559e42ad070a), - u64(0x6fefa16eb73a6586), - u64(0x0309114b688a6c08), - u64(0xf3261abef8fb846b), - u64(0x026da76f86d52339), - u64(0x51d691318e5f3a45), - u64(0x03e2a57f3e21d1f6), - u64(0x0e4540f471e5c837), - u64(0x031bb798fe8174c5), - u64(0xd8376729f4b7d360), - u64(0x027c92e0cb9ac3d0), - u64(0xf38bd84321261eff), - u64(0x03fa849adf5e061a), - u64(0x293cad0280eb4bff), - u64(0x032ed07be5e4d1af), - u64(0xedca240200bc3ccc), - u64(0x028bd9fcb7ea4158), - u64(0xbe3b50019a3030a4), - u64(0x02097b309321cde0), - u64(0xc9f88002904d1a9f), - u64(0x03425eb41e9c7c9a), - u64(0x3b2d3335403daee6), - u64(0x029b7ef67ee396e2), - u64(0x95bdc291003158b8), - u64(0x0215ff2b98b6124e), - u64(0x892f9db4cd1bc126), - u64(0x035665128df01d4a), - u64(0x07594af70a7c9a85), - u64(0x02ab840ed7f34aa2), - u64(0x6c476f2c0863aed1), - u64(0x0222d00bdff5d54e), - u64(0x13a57eacda3917b4), - u64(0x036ae67966562217), - u64(0x0fb7988a482dac90), - u64(0x02bbeb9451de81ac), - u64(0xd95fad3b6cf156da), - u64(0x022fefa9db1867bc), - u64(0xf565e1f8ae4ef15c), - u64(0x037fe5dc91c0a5fa), - u64(0x911e4e608b725ab0), - u64(0x02ccb7e3a7cd5195), - u64(0xda7ea51a0928488d), - u64(0x023d5fe9530aa7aa), - u64(0xf7310829a8407415), - u64(0x039566421e7772aa), - u64(0x2c2739baed005cde), - u64(0x02ddeb68185f8eef), - u64(0xbcec2e2f24004a4b), - u64(0x024b22b9ad193f25), - u64(0x94ad16b1d333aa11), - u64(0x03ab6ac2ae8ecb6f), - u64(0xaa241227dc2954db), - u64(0x02ef889bbed8a2bf), - u64(0x54e9a81fe35443e2), - u64(0x02593a163246e899), - u64(0x2175d9cc9eed396a), - u64(0x03c1f689ea0b0dc2), - u64(0xe7917b0a18bdc788), - u64(0x03019207ee6f3e34), - u64(0xb9412f3b46fe393a), - u64(0x0267a8065858fe90), - u64(0xf535185ed7fd285c), - u64(0x03d90cd6f3c1974d), - u64(0xc42a79e57997537d), - u64(0x03140a458fce12a4), - u64(0x03552e512e12a931), - u64(0x02766e9e0ca4dbb7), - u64(0x9eeeb081e3510eb4), - u64(0x03f0b0fce107c5f1), - u64(0x4bf226ce4f740bc3), - u64(0x0326f3fd80d304c1), - u64(0xa3281f0b72c33c9c), - u64(0x02858ffe00a8d09a), - u64(0x1c2018d5f568fd4a), - u64(0x020473319a20a6e2), - u64(0xf9ccf48988a7fba9), - u64(0x033a51e8f69aa49c), - u64(0xfb0a5d3ad3b99621), - u64(0x02950e53f87bb6e3), - u64(0x2f3b7dc8a96144e7), - u64(0x0210d8432d2fc583), - u64(0xe52bfc7442353b0c), - u64(0x034e26d1e1e608d1), - u64(0xb756639034f76270), - u64(0x02a4ebdb1b1e6d74), - u64(0x2c451c735d92b526), - u64(0x021d897c15b1f12a), - u64(0x13a1c71efc1deea3), - u64(0x0362759355e981dd), - u64(0x761b05b2634b2550), - u64(0x02b52adc44bace4a), - u64(0x91af37c1e908eaa6), - u64(0x022a88b036fbd83b), - u64(0x82b1f2cfdb417770), - u64(0x03774119f192f392), - u64(0xcef4c23fe29ac5f3), - u64(0x02c5cdae5adbf60e), - u64(0x3f2a34ffe87bd190), - u64(0x0237d7beaf165e72), - u64(0x984387ffda5fb5b2), - u64(0x038c8c644b56fd83), - u64(0xe0360666484c915b), - u64(0x02d6d6b6a2abfe02), - u64(0x802b3851d3707449), - u64(0x024578921bbccb35), - u64(0x99dec082ebe72075), - u64(0x03a25a835f947855), - u64(0xae4bcd358985b391), - u64(0x02e8486919439377), - u64(0xbea30a913ad15c74), - u64(0x02536d20e102dc5f), - u64(0xfdd1aa81f7b560b9), - u64(0x03b8ae9b019e2d65), - u64(0x97daeece5fc44d61), - u64(0x02fa2548ce182451), - u64(0xdfe258a51969d781), - u64(0x0261b76d71ace9da), - u64(0x996a276e8f0fbf34), - u64(0x03cf8be24f7b0fc4), - u64(0xe121b9253f3fcc2a), - u64(0x030c6fe83f95a636), - u64(0xb41afa8432997022), - u64(0x02705986994484f8), - u64(0xecf7f739ea8f19cf), - u64(0x03e6f5a4286da18d), - u64(0x23f99294bba5ae40), - u64(0x031f2ae9b9f14e0b), - u64(0x4ffadbaa2fb7be99), - u64(0x027f5587c7f43e6f), - u64(0x7ff7c5dd1925fdc2), - u64(0x03feef3fa6539718), - u64(0xccc637e4141e649b), - u64(0x033258ffb842df46), - u64(0xd704f983434b83af), - u64(0x028ead9960357f6b), - u64(0x126a6135cf6f9c8c), - u64(0x020bbe144cf79923), - u64(0x83dd685618b29414), - u64(0x0345fced47f28e9e), - u64(0x9cb12044e08edcdd), - u64(0x029e63f1065ba54b), - u64(0x16f419d0b3a57d7d), - u64(0x02184ff405161dd6), - u64(0x8b20294dec3bfbfb), - u64(0x035a19866e89c956), - u64(0x3c19baa4bcfcc996), - u64(0x02ae7ad1f207d445), - u64(0xc9ae2eea30ca3adf), - u64(0x02252f0e5b39769d), - u64(0x0f7d17dd1add2afd), - u64(0x036eb1b091f58a96), - u64(0x3f97464a7be42264), - u64(0x02bef48d41913bab), - u64(0xcc790508631ce850), - u64(0x02325d3dce0dc955), - u64(0xe0c1a1a704fb0d4d), - u64(0x0383c862e3494222), - u64(0x4d67b4859d95a43e), - u64(0x02cfd3824f6dce82), - u64(0x711fc39e17aae9cb), - u64(0x023fdc683f8b0b9b), - u64(0xe832d2968c44a945), - u64(0x039960a6cc11ac2b), - u64(0xecf575453d03ba9e), - u64(0x02e11a1f09a7bcef), - u64(0x572ac4376402fbb1), - u64(0x024dae7f3aec9726), - u64(0x58446d256cd192b5), - u64(0x03af7d985e47583d), - u64(0x79d0575123dadbc4), - u64(0x02f2cae04b6c4697), - u64(0x94a6ac40e97be303), - u64(0x025bd5803c569edf), - u64(0x8771139b0f2c9e6c), - u64(0x03c62266c6f0fe32), - u64(0x9f8da948d8f07ebd), - u64(0x0304e85238c0cb5b), - u64(0xe60aedd3e0c06564), - u64(0x026a5374fa33d5e2), - u64(0xa344afb9679a3bd2), - u64(0x03dd5254c3862304), - u64(0xe903bfc78614fca8), - u64(0x031775109c6b4f36), - u64(0xba6966393810ca20), - u64(0x02792a73b055d8f8), - u64(0x2a423d2859b4769a), - u64(0x03f510b91a22f4c1), - u64(0xee9b642047c39215), - u64(0x032a73c7481bf700), - u64(0xbee2b680396941aa), - u64(0x02885c9f6ce32c00), - u64(0xff1bc53361210155), - u64(0x0206b07f8a4f5666), - u64(0x31c6085235019bbb), - u64(0x033de73276e5570b), - u64(0x27d1a041c4014963), - u64(0x0297ec285f1ddf3c), - u64(0xeca7b367d0010782), - u64(0x021323537f4b18fc), - u64(0xadd91f0c8001a59d), - u64(0x0351d21f3211c194), - u64(0xf17a7f3d3334847e), - u64(0x02a7db4c280e3476), - u64(0x279532975c2a0398), - u64(0x021fe2a3533e905f), - u64(0xd8eeb75893766c26), - u64(0x0366376bb8641a31), - u64(0x7a5892ad42c52352), - u64(0x02b82c562d1ce1c1), - u64(0xfb7a0ef102374f75), - u64(0x022cf044f0e3e7cd), - u64(0xc59017e8038bb254), - u64(0x037b1a07e7d30c7c), - u64(0x37a67986693c8eaa), - u64(0x02c8e19feca8d6ca), - u64(0xf951fad1edca0bbb), - u64(0x023a4e198a20abd4), - u64(0x28832ae97c76792b), - u64(0x03907cf5a9cddfbb), - u64(0x2068ef21305ec756), - u64(0x02d9fd9154a4b2fc), - u64(0x19ed8c1a8d189f78), - u64(0x0247fe0ddd508f30), - u64(0x5caf4690e1c0ff26), - u64(0x03a66349621a7eb3), - u64(0x4a25d20d81673285), - u64(0x02eb82a11b48655c), - u64(0x3b5174d79ab8f537), - u64(0x0256021a7c39eab0), - u64(0x921bee25c45b21f1), - u64(0x03bcd02a605caab3), - u64(0xdb498b5169e2818e), - u64(0x02fd735519e3bbc2), - u64(0x15d46f7454b53472), - u64(0x02645c4414b62fcf), - u64(0xefba4bed545520b6), - u64(0x03d3c6d35456b2e4), - u64(0xf2fb6ff110441a2b), - u64(0x030fd242a9def583), - u64(0x8f2f8cc0d9d014ef), - u64(0x02730e9bbb18c469), - u64(0xb1e5ae015c80217f), - u64(0x03eb4a92c4f46d75), - u64(0xc1848b344a001acc), - u64(0x0322a20f03f6bdf7), - u64(0xce03a2903b3348a3), - u64(0x02821b3f365efe5f), - u64(0xd802e873628f6d4f), - u64(0x0201af65c518cb7f), - u64(0x599e40b89db2487f), - u64(0x0335e56fa1c14599), - u64(0xe14b66fa17c1d399), - u64(0x029184594e3437ad), - u64(0x81091f2e7967dc7a), - u64(0x020e037aa4f692f1), - u64(0x9b41cb7d8f0c93f6), - u64(0x03499f2aa18a84b5), - u64(0xaf67d5fe0c0a0ff8), - u64(0x02a14c221ad536f7), - u64(0xf2b977fe70080cc7), - u64(0x021aa34e7bddc592), - u64(0x1df58cca4cd9ae0b), - u64(0x035dd2172c9608eb), - u64(0xe4c470a1d7148b3c), - u64(0x02b174df56de6d88), - u64(0x83d05a1b1276d5ca), - u64(0x022790b2abe5246d), - u64(0x9fb3c35e83f1560f), - u64(0x0372811ddfd50715), - u64(0xb2f635e5365aab3f), - u64(0x02c200e4b310d277), - u64(0xf591c4b75eaeef66), - u64(0x0234cd83c273db92), - u64(0xef4fa125644b18a3), - u64(0x0387af39371fc5b7), - u64(0x8c3fb41de9d5ad4f), - u64(0x02d2f2942c196af9), - u64(0x3cffc34b2177bdd9), - u64(0x02425ba9bce12261), - u64(0x94cc6bab68bf9628), - u64(0x039d5f75fb01d09b), - u64(0x10a38955ed6611b9), - u64(0x02e44c5e6267da16), - u64(0xda1c6dde5784dafb), - u64(0x02503d184eb97b44), - u64(0xf693e2fd58d49191), - u64(0x03b394f3b128c53a), - u64(0xc5431bfde0aa0e0e), - u64(0x02f610c2f4209dc8), - u64(0x6a9c1664b3bb3e72), - u64(0x025e73cf29b3b16d), - u64(0x10f9bd6dec5eca4f), - u64(0x03ca52e50f85e8af), - u64(0xda616457f04bd50c), - u64(0x03084250d937ed58), - u64(0xe1e783798d09773d), - u64(0x026d01da475ff113), - u64(0x030c058f480f252e), - u64(0x03e19c9072331b53), - u64(0x68d66ad906728425), - u64(0x031ae3a6c1c27c42), - u64(0x8711ef14052869b7), - u64(0x027be952349b969b), - u64(0x0b4fe4ecd50d75f2), - u64(0x03f97550542c242c), - u64(0xa2a650bd773df7f5), - u64(0x032df7737689b689), - u64(0xb551da312c31932a), - u64(0x028b2c5c5ed49207), - u64(0x5ddb14f4235adc22), - u64(0x0208f049e576db39), - u64(0x2fc4ee536bc49369), - u64(0x034180763bf15ec2), - u64(0xbfd0bea92303a921), - u64(0x029acd2b63277f01), - u64(0x9973cbba8269541a), - u64(0x021570ef8285ff34), - u64(0x5bec792a6a42202a), - u64(0x0355817f373ccb87), - u64(0xe3239421ee9b4cef), - u64(0x02aacdff5f63d605), - u64(0xb5b6101b25490a59), - u64(0x02223e65e5e97804), - u64(0x22bce691d541aa27), - u64(0x0369fd6fd64259a1), - u64(0xb563eba7ddce21b9), - u64(0x02bb31264501e14d), - u64(0xf78322ecb171b494), - u64(0x022f5a850401810a), - u64(0x259e9e47824f8753), - u64(0x037ef73b399c01ab), - u64(0x1e187e9f9b72d2a9), - u64(0x02cbf8fc2e1667bc), - u64(0x4b46cbb2e2c24221), - u64(0x023cc73024deb963), - u64(0x120adf849e039d01), - u64(0x039471e6a1645bd2), - u64(0xdb3be603b19c7d9a), - u64(0x02dd27ebb4504974), - u64(0x7c2feb3627b0647c), - u64(0x024a865629d9d45d), - u64(0x2d197856a5e7072c), - u64(0x03aa7089dc8fba2f), - u64(0x8a7ac6abb7ec05bd), - u64(0x02eec06e4a0c94f2), - u64(0xd52f05562cbcd164), - u64(0x025899f1d4d6dd8e), - u64(0x21e4d556adfae8a0), - u64(0x03c0f64fbaf1627e), - u64(0xe7ea444557fbed4d), - u64(0x0300c50c958de864), - u64(0xecbb69d1132ff10a), - u64(0x0267040a113e5383), - u64(0xadf8a94e851981aa), - u64(0x03d8067681fd526c), - u64(0x8b2d543ed0e13488), - u64(0x0313385ece6441f0), - u64(0xd5bddcff0d80f6d3), - u64(0x0275c6b23eb69b26), - u64(0x892fc7fe7c018aeb), - u64(0x03efa45064575ea4), - u64(0x3a8c9ffec99ad589), - u64(0x03261d0d1d12b21d), - u64(0xc8707fff07af113b), - u64(0x0284e40a7da88e7d), - u64(0x39f39998d2f2742f), - u64(0x0203e9a1fe2071fe), - u64(0x8fec28f484b7204b), - u64(0x033975cffd00b663), - u64(0xd989ba5d36f8e6a2), - u64(0x02945e3ffd9a2b82), - u64(0x47a161e42bfa521c), - u64(0x02104b66647b5602), - u64(0x0c35696d132a1cf9), - u64(0x034d4570a0c5566a), - u64(0x09c454574288172d), - u64(0x02a4378d4d6aab88), - u64(0xa169dd129ba0128b), - u64(0x021cf93dd7888939), - u64(0x0242fb50f9001dab), - u64(0x03618ec958da7529), - u64(0x9b68c90d940017bc), - u64(0x02b4723aad7b90ed), - u64(0x4920a0d7a999ac96), - u64(0x0229f4fbbdfc73f1), - u64(0x750101590f5c4757), - u64(0x037654c5fcc71fe8), - u64(0x2a6734473f7d05df), - u64(0x02c5109e63d27fed), - u64(0xeeb8f69f65fd9e4c), - u64(0x0237407eb641fff0), - u64(0xe45b24323cc8fd46), - u64(0x038b9a6456cfffe7), - u64(0xb6af502830a0ca9f), - u64(0x02d6151d123fffec), - u64(0xf88c402026e7087f), - u64(0x0244ddb0db666656), - u64(0x2746cd003e3e73fe), - u64(0x03a162b4923d708b), - u64(0x1f6bd73364fec332), - u64(0x02e7822a0e978d3c), - u64(0xe5efdf5c50cbcf5b), - u64(0x0252ce880bac70fc), - u64(0x3cb2fefa1adfb22b), - u64(0x03b7b0d9ac471b2e), - u64(0x308f3261af195b56), - u64(0x02f95a47bd05af58), - u64(0x5a0c284e25ade2ab), - u64(0x0261150630d15913), - u64(0x29ad0d49d5e30445), - u64(0x03ce8809e7b55b52), - u64(0x548a7107de4f369d), - u64(0x030ba007ec9115db), - u64(0xdd3b8d9fe50c2bb1), - u64(0x026fb3398a0dab15), - u64(0x952c15cca1ad12b5), - u64(0x03e5eb8f434911bc), - u64(0x775677d6e7bda891), - u64(0x031e560c35d40e30), - u64(0xc5dec645863153a7), - u64(0x027eab3cf7dcd826), - ]! -) +const pow5_inv_split_64_x = [ + u64(0x0000000000000001), + u64(0x0400000000000000), + u64(0x3333333333333334), + u64(0x0333333333333333), + u64(0x28f5c28f5c28f5c3), + u64(0x028f5c28f5c28f5c), + u64(0xed916872b020c49c), + u64(0x020c49ba5e353f7c), + u64(0xaf4f0d844d013a93), + u64(0x0346dc5d63886594), + u64(0x8c3f3e0370cdc876), + u64(0x029f16b11c6d1e10), + u64(0xd698fe69270b06c5), + u64(0x0218def416bdb1a6), + u64(0xf0f4ca41d811a46e), + u64(0x035afe535795e90a), + u64(0xf3f70834acdae9f1), + u64(0x02af31dc4611873b), + u64(0x5cc5a02a23e254c1), + u64(0x0225c17d04dad296), + u64(0xfad5cd10396a2135), + u64(0x036f9bfb3af7b756), + u64(0xfbde3da69454e75e), + u64(0x02bfaffc2f2c92ab), + u64(0x2fe4fe1edd10b918), + u64(0x0232f33025bd4223), + u64(0x4ca19697c81ac1bf), + u64(0x0384b84d092ed038), + u64(0x3d4e1213067bce33), + u64(0x02d09370d4257360), + u64(0x643e74dc052fd829), + u64(0x024075f3dceac2b3), + u64(0x6d30baf9a1e626a7), + u64(0x039a5652fb113785), + u64(0x2426fbfae7eb5220), + u64(0x02e1dea8c8da92d1), + u64(0x1cebfcc8b9890e80), + u64(0x024e4bba3a487574), + u64(0x94acc7a78f41b0cc), + u64(0x03b07929f6da5586), + u64(0xaa23d2ec729af3d7), + u64(0x02f394219248446b), + u64(0xbb4fdbf05baf2979), + u64(0x025c768141d369ef), + u64(0xc54c931a2c4b758d), + u64(0x03c7240202ebdcb2), + u64(0x9dd6dc14f03c5e0b), + u64(0x0305b66802564a28), + u64(0x4b1249aa59c9e4d6), + u64(0x026af8533511d4ed), + u64(0x44ea0f76f60fd489), + u64(0x03de5a1ebb4fbb15), + u64(0x6a54d92bf80caa07), + u64(0x0318481895d96277), + u64(0x21dd7a89933d54d2), + u64(0x0279d346de4781f9), + u64(0x362f2a75b8622150), + u64(0x03f61ed7ca0c0328), + u64(0xf825bb91604e810d), + u64(0x032b4bdfd4d668ec), + u64(0xc684960de6a5340b), + u64(0x0289097fdd7853f0), + u64(0xd203ab3e521dc33c), + u64(0x02073accb12d0ff3), + u64(0xe99f7863b696052c), + u64(0x033ec47ab514e652), + u64(0x87b2c6b62bab3757), + u64(0x02989d2ef743eb75), + u64(0xd2f56bc4efbc2c45), + u64(0x0213b0f25f69892a), + u64(0x1e55793b192d13a2), + u64(0x0352b4b6ff0f41de), + u64(0x4b77942f475742e8), + u64(0x02a8909265a5ce4b), + u64(0xd5f9435905df68ba), + u64(0x022073a8515171d5), + u64(0x565b9ef4d6324129), + u64(0x03671f73b54f1c89), + u64(0xdeafb25d78283421), + u64(0x02b8e5f62aa5b06d), + u64(0x188c8eb12cecf681), + u64(0x022d84c4eeeaf38b), + u64(0x8dadb11b7b14bd9b), + u64(0x037c07a17e44b8de), + u64(0x7157c0e2c8dd647c), + u64(0x02c99fb46503c718), + u64(0x8ddfcd823a4ab6ca), + u64(0x023ae629ea696c13), + u64(0x1632e269f6ddf142), + u64(0x0391704310a8acec), + u64(0x44f581ee5f17f435), + u64(0x02dac035a6ed5723), + u64(0x372ace584c1329c4), + u64(0x024899c4858aac1c), + u64(0xbeaae3c079b842d3), + u64(0x03a75c6da27779c6), + u64(0x6555830061603576), + u64(0x02ec49f14ec5fb05), + u64(0xb7779c004de6912b), + u64(0x0256a18dd89e626a), + u64(0xf258f99a163db512), + u64(0x03bdcf495a9703dd), + u64(0x5b7a614811caf741), + u64(0x02fe3f6de212697e), + u64(0xaf951aa00e3bf901), + u64(0x0264ff8b1b41edfe), + u64(0x7f54f7667d2cc19b), + u64(0x03d4cc11c5364997), + u64(0x32aa5f8530f09ae3), + u64(0x0310a3416a91d479), + u64(0xf55519375a5a1582), + u64(0x0273b5cdeedb1060), + u64(0xbbbb5b8bc3c3559d), + u64(0x03ec56164af81a34), + u64(0x2fc916096969114a), + u64(0x03237811d593482a), + u64(0x596dab3ababa743c), + u64(0x0282c674aadc39bb), + u64(0x478aef622efb9030), + u64(0x0202385d557cfafc), + u64(0xd8de4bd04b2c19e6), + u64(0x0336c0955594c4c6), + u64(0xad7ea30d08f014b8), + u64(0x029233aaaadd6a38), + u64(0x24654f3da0c01093), + u64(0x020e8fbbbbe454fa), + u64(0x3a3bb1fc346680eb), + u64(0x034a7f92c63a2190), + u64(0x94fc8e635d1ecd89), + u64(0x02a1ffa89e94e7a6), + u64(0xaa63a51c4a7f0ad4), + u64(0x021b32ed4baa52eb), + u64(0xdd6c3b607731aaed), + u64(0x035eb7e212aa1e45), + u64(0x1789c919f8f488bd), + u64(0x02b22cb4dbbb4b6b), + u64(0xac6e3a7b2d906d64), + u64(0x022823c3e2fc3c55), + u64(0x13e390c515b3e23a), + u64(0x03736c6c9e606089), + u64(0xdcb60d6a77c31b62), + u64(0x02c2bd23b1e6b3a0), + u64(0x7d5e7121f968e2b5), + u64(0x0235641c8e52294d), + u64(0xc8971b698f0e3787), + u64(0x0388a02db0837548), + u64(0xa078e2bad8d82c6c), + u64(0x02d3b357c0692aa0), + u64(0xe6c71bc8ad79bd24), + u64(0x0242f5dfcd20eee6), + u64(0x0ad82c7448c2c839), + u64(0x039e5632e1ce4b0b), + u64(0x3be023903a356cfa), + u64(0x02e511c24e3ea26f), + u64(0x2fe682d9c82abd95), + u64(0x0250db01d8321b8c), + u64(0x4ca4048fa6aac8ee), + u64(0x03b4919c8d1cf8e0), + u64(0x3d5003a61eef0725), + u64(0x02f6dae3a4172d80), + u64(0x9773361e7f259f51), + u64(0x025f1582e9ac2466), + u64(0x8beb89ca6508fee8), + u64(0x03cb559e42ad070a), + u64(0x6fefa16eb73a6586), + u64(0x0309114b688a6c08), + u64(0xf3261abef8fb846b), + u64(0x026da76f86d52339), + u64(0x51d691318e5f3a45), + u64(0x03e2a57f3e21d1f6), + u64(0x0e4540f471e5c837), + u64(0x031bb798fe8174c5), + u64(0xd8376729f4b7d360), + u64(0x027c92e0cb9ac3d0), + u64(0xf38bd84321261eff), + u64(0x03fa849adf5e061a), + u64(0x293cad0280eb4bff), + u64(0x032ed07be5e4d1af), + u64(0xedca240200bc3ccc), + u64(0x028bd9fcb7ea4158), + u64(0xbe3b50019a3030a4), + u64(0x02097b309321cde0), + u64(0xc9f88002904d1a9f), + u64(0x03425eb41e9c7c9a), + u64(0x3b2d3335403daee6), + u64(0x029b7ef67ee396e2), + u64(0x95bdc291003158b8), + u64(0x0215ff2b98b6124e), + u64(0x892f9db4cd1bc126), + u64(0x035665128df01d4a), + u64(0x07594af70a7c9a85), + u64(0x02ab840ed7f34aa2), + u64(0x6c476f2c0863aed1), + u64(0x0222d00bdff5d54e), + u64(0x13a57eacda3917b4), + u64(0x036ae67966562217), + u64(0x0fb7988a482dac90), + u64(0x02bbeb9451de81ac), + u64(0xd95fad3b6cf156da), + u64(0x022fefa9db1867bc), + u64(0xf565e1f8ae4ef15c), + u64(0x037fe5dc91c0a5fa), + u64(0x911e4e608b725ab0), + u64(0x02ccb7e3a7cd5195), + u64(0xda7ea51a0928488d), + u64(0x023d5fe9530aa7aa), + u64(0xf7310829a8407415), + u64(0x039566421e7772aa), + u64(0x2c2739baed005cde), + u64(0x02ddeb68185f8eef), + u64(0xbcec2e2f24004a4b), + u64(0x024b22b9ad193f25), + u64(0x94ad16b1d333aa11), + u64(0x03ab6ac2ae8ecb6f), + u64(0xaa241227dc2954db), + u64(0x02ef889bbed8a2bf), + u64(0x54e9a81fe35443e2), + u64(0x02593a163246e899), + u64(0x2175d9cc9eed396a), + u64(0x03c1f689ea0b0dc2), + u64(0xe7917b0a18bdc788), + u64(0x03019207ee6f3e34), + u64(0xb9412f3b46fe393a), + u64(0x0267a8065858fe90), + u64(0xf535185ed7fd285c), + u64(0x03d90cd6f3c1974d), + u64(0xc42a79e57997537d), + u64(0x03140a458fce12a4), + u64(0x03552e512e12a931), + u64(0x02766e9e0ca4dbb7), + u64(0x9eeeb081e3510eb4), + u64(0x03f0b0fce107c5f1), + u64(0x4bf226ce4f740bc3), + u64(0x0326f3fd80d304c1), + u64(0xa3281f0b72c33c9c), + u64(0x02858ffe00a8d09a), + u64(0x1c2018d5f568fd4a), + u64(0x020473319a20a6e2), + u64(0xf9ccf48988a7fba9), + u64(0x033a51e8f69aa49c), + u64(0xfb0a5d3ad3b99621), + u64(0x02950e53f87bb6e3), + u64(0x2f3b7dc8a96144e7), + u64(0x0210d8432d2fc583), + u64(0xe52bfc7442353b0c), + u64(0x034e26d1e1e608d1), + u64(0xb756639034f76270), + u64(0x02a4ebdb1b1e6d74), + u64(0x2c451c735d92b526), + u64(0x021d897c15b1f12a), + u64(0x13a1c71efc1deea3), + u64(0x0362759355e981dd), + u64(0x761b05b2634b2550), + u64(0x02b52adc44bace4a), + u64(0x91af37c1e908eaa6), + u64(0x022a88b036fbd83b), + u64(0x82b1f2cfdb417770), + u64(0x03774119f192f392), + u64(0xcef4c23fe29ac5f3), + u64(0x02c5cdae5adbf60e), + u64(0x3f2a34ffe87bd190), + u64(0x0237d7beaf165e72), + u64(0x984387ffda5fb5b2), + u64(0x038c8c644b56fd83), + u64(0xe0360666484c915b), + u64(0x02d6d6b6a2abfe02), + u64(0x802b3851d3707449), + u64(0x024578921bbccb35), + u64(0x99dec082ebe72075), + u64(0x03a25a835f947855), + u64(0xae4bcd358985b391), + u64(0x02e8486919439377), + u64(0xbea30a913ad15c74), + u64(0x02536d20e102dc5f), + u64(0xfdd1aa81f7b560b9), + u64(0x03b8ae9b019e2d65), + u64(0x97daeece5fc44d61), + u64(0x02fa2548ce182451), + u64(0xdfe258a51969d781), + u64(0x0261b76d71ace9da), + u64(0x996a276e8f0fbf34), + u64(0x03cf8be24f7b0fc4), + u64(0xe121b9253f3fcc2a), + u64(0x030c6fe83f95a636), + u64(0xb41afa8432997022), + u64(0x02705986994484f8), + u64(0xecf7f739ea8f19cf), + u64(0x03e6f5a4286da18d), + u64(0x23f99294bba5ae40), + u64(0x031f2ae9b9f14e0b), + u64(0x4ffadbaa2fb7be99), + u64(0x027f5587c7f43e6f), + u64(0x7ff7c5dd1925fdc2), + u64(0x03feef3fa6539718), + u64(0xccc637e4141e649b), + u64(0x033258ffb842df46), + u64(0xd704f983434b83af), + u64(0x028ead9960357f6b), + u64(0x126a6135cf6f9c8c), + u64(0x020bbe144cf79923), + u64(0x83dd685618b29414), + u64(0x0345fced47f28e9e), + u64(0x9cb12044e08edcdd), + u64(0x029e63f1065ba54b), + u64(0x16f419d0b3a57d7d), + u64(0x02184ff405161dd6), + u64(0x8b20294dec3bfbfb), + u64(0x035a19866e89c956), + u64(0x3c19baa4bcfcc996), + u64(0x02ae7ad1f207d445), + u64(0xc9ae2eea30ca3adf), + u64(0x02252f0e5b39769d), + u64(0x0f7d17dd1add2afd), + u64(0x036eb1b091f58a96), + u64(0x3f97464a7be42264), + u64(0x02bef48d41913bab), + u64(0xcc790508631ce850), + u64(0x02325d3dce0dc955), + u64(0xe0c1a1a704fb0d4d), + u64(0x0383c862e3494222), + u64(0x4d67b4859d95a43e), + u64(0x02cfd3824f6dce82), + u64(0x711fc39e17aae9cb), + u64(0x023fdc683f8b0b9b), + u64(0xe832d2968c44a945), + u64(0x039960a6cc11ac2b), + u64(0xecf575453d03ba9e), + u64(0x02e11a1f09a7bcef), + u64(0x572ac4376402fbb1), + u64(0x024dae7f3aec9726), + u64(0x58446d256cd192b5), + u64(0x03af7d985e47583d), + u64(0x79d0575123dadbc4), + u64(0x02f2cae04b6c4697), + u64(0x94a6ac40e97be303), + u64(0x025bd5803c569edf), + u64(0x8771139b0f2c9e6c), + u64(0x03c62266c6f0fe32), + u64(0x9f8da948d8f07ebd), + u64(0x0304e85238c0cb5b), + u64(0xe60aedd3e0c06564), + u64(0x026a5374fa33d5e2), + u64(0xa344afb9679a3bd2), + u64(0x03dd5254c3862304), + u64(0xe903bfc78614fca8), + u64(0x031775109c6b4f36), + u64(0xba6966393810ca20), + u64(0x02792a73b055d8f8), + u64(0x2a423d2859b4769a), + u64(0x03f510b91a22f4c1), + u64(0xee9b642047c39215), + u64(0x032a73c7481bf700), + u64(0xbee2b680396941aa), + u64(0x02885c9f6ce32c00), + u64(0xff1bc53361210155), + u64(0x0206b07f8a4f5666), + u64(0x31c6085235019bbb), + u64(0x033de73276e5570b), + u64(0x27d1a041c4014963), + u64(0x0297ec285f1ddf3c), + u64(0xeca7b367d0010782), + u64(0x021323537f4b18fc), + u64(0xadd91f0c8001a59d), + u64(0x0351d21f3211c194), + u64(0xf17a7f3d3334847e), + u64(0x02a7db4c280e3476), + u64(0x279532975c2a0398), + u64(0x021fe2a3533e905f), + u64(0xd8eeb75893766c26), + u64(0x0366376bb8641a31), + u64(0x7a5892ad42c52352), + u64(0x02b82c562d1ce1c1), + u64(0xfb7a0ef102374f75), + u64(0x022cf044f0e3e7cd), + u64(0xc59017e8038bb254), + u64(0x037b1a07e7d30c7c), + u64(0x37a67986693c8eaa), + u64(0x02c8e19feca8d6ca), + u64(0xf951fad1edca0bbb), + u64(0x023a4e198a20abd4), + u64(0x28832ae97c76792b), + u64(0x03907cf5a9cddfbb), + u64(0x2068ef21305ec756), + u64(0x02d9fd9154a4b2fc), + u64(0x19ed8c1a8d189f78), + u64(0x0247fe0ddd508f30), + u64(0x5caf4690e1c0ff26), + u64(0x03a66349621a7eb3), + u64(0x4a25d20d81673285), + u64(0x02eb82a11b48655c), + u64(0x3b5174d79ab8f537), + u64(0x0256021a7c39eab0), + u64(0x921bee25c45b21f1), + u64(0x03bcd02a605caab3), + u64(0xdb498b5169e2818e), + u64(0x02fd735519e3bbc2), + u64(0x15d46f7454b53472), + u64(0x02645c4414b62fcf), + u64(0xefba4bed545520b6), + u64(0x03d3c6d35456b2e4), + u64(0xf2fb6ff110441a2b), + u64(0x030fd242a9def583), + u64(0x8f2f8cc0d9d014ef), + u64(0x02730e9bbb18c469), + u64(0xb1e5ae015c80217f), + u64(0x03eb4a92c4f46d75), + u64(0xc1848b344a001acc), + u64(0x0322a20f03f6bdf7), + u64(0xce03a2903b3348a3), + u64(0x02821b3f365efe5f), + u64(0xd802e873628f6d4f), + u64(0x0201af65c518cb7f), + u64(0x599e40b89db2487f), + u64(0x0335e56fa1c14599), + u64(0xe14b66fa17c1d399), + u64(0x029184594e3437ad), + u64(0x81091f2e7967dc7a), + u64(0x020e037aa4f692f1), + u64(0x9b41cb7d8f0c93f6), + u64(0x03499f2aa18a84b5), + u64(0xaf67d5fe0c0a0ff8), + u64(0x02a14c221ad536f7), + u64(0xf2b977fe70080cc7), + u64(0x021aa34e7bddc592), + u64(0x1df58cca4cd9ae0b), + u64(0x035dd2172c9608eb), + u64(0xe4c470a1d7148b3c), + u64(0x02b174df56de6d88), + u64(0x83d05a1b1276d5ca), + u64(0x022790b2abe5246d), + u64(0x9fb3c35e83f1560f), + u64(0x0372811ddfd50715), + u64(0xb2f635e5365aab3f), + u64(0x02c200e4b310d277), + u64(0xf591c4b75eaeef66), + u64(0x0234cd83c273db92), + u64(0xef4fa125644b18a3), + u64(0x0387af39371fc5b7), + u64(0x8c3fb41de9d5ad4f), + u64(0x02d2f2942c196af9), + u64(0x3cffc34b2177bdd9), + u64(0x02425ba9bce12261), + u64(0x94cc6bab68bf9628), + u64(0x039d5f75fb01d09b), + u64(0x10a38955ed6611b9), + u64(0x02e44c5e6267da16), + u64(0xda1c6dde5784dafb), + u64(0x02503d184eb97b44), + u64(0xf693e2fd58d49191), + u64(0x03b394f3b128c53a), + u64(0xc5431bfde0aa0e0e), + u64(0x02f610c2f4209dc8), + u64(0x6a9c1664b3bb3e72), + u64(0x025e73cf29b3b16d), + u64(0x10f9bd6dec5eca4f), + u64(0x03ca52e50f85e8af), + u64(0xda616457f04bd50c), + u64(0x03084250d937ed58), + u64(0xe1e783798d09773d), + u64(0x026d01da475ff113), + u64(0x030c058f480f252e), + u64(0x03e19c9072331b53), + u64(0x68d66ad906728425), + u64(0x031ae3a6c1c27c42), + u64(0x8711ef14052869b7), + u64(0x027be952349b969b), + u64(0x0b4fe4ecd50d75f2), + u64(0x03f97550542c242c), + u64(0xa2a650bd773df7f5), + u64(0x032df7737689b689), + u64(0xb551da312c31932a), + u64(0x028b2c5c5ed49207), + u64(0x5ddb14f4235adc22), + u64(0x0208f049e576db39), + u64(0x2fc4ee536bc49369), + u64(0x034180763bf15ec2), + u64(0xbfd0bea92303a921), + u64(0x029acd2b63277f01), + u64(0x9973cbba8269541a), + u64(0x021570ef8285ff34), + u64(0x5bec792a6a42202a), + u64(0x0355817f373ccb87), + u64(0xe3239421ee9b4cef), + u64(0x02aacdff5f63d605), + u64(0xb5b6101b25490a59), + u64(0x02223e65e5e97804), + u64(0x22bce691d541aa27), + u64(0x0369fd6fd64259a1), + u64(0xb563eba7ddce21b9), + u64(0x02bb31264501e14d), + u64(0xf78322ecb171b494), + u64(0x022f5a850401810a), + u64(0x259e9e47824f8753), + u64(0x037ef73b399c01ab), + u64(0x1e187e9f9b72d2a9), + u64(0x02cbf8fc2e1667bc), + u64(0x4b46cbb2e2c24221), + u64(0x023cc73024deb963), + u64(0x120adf849e039d01), + u64(0x039471e6a1645bd2), + u64(0xdb3be603b19c7d9a), + u64(0x02dd27ebb4504974), + u64(0x7c2feb3627b0647c), + u64(0x024a865629d9d45d), + u64(0x2d197856a5e7072c), + u64(0x03aa7089dc8fba2f), + u64(0x8a7ac6abb7ec05bd), + u64(0x02eec06e4a0c94f2), + u64(0xd52f05562cbcd164), + u64(0x025899f1d4d6dd8e), + u64(0x21e4d556adfae8a0), + u64(0x03c0f64fbaf1627e), + u64(0xe7ea444557fbed4d), + u64(0x0300c50c958de864), + u64(0xecbb69d1132ff10a), + u64(0x0267040a113e5383), + u64(0xadf8a94e851981aa), + u64(0x03d8067681fd526c), + u64(0x8b2d543ed0e13488), + u64(0x0313385ece6441f0), + u64(0xd5bddcff0d80f6d3), + u64(0x0275c6b23eb69b26), + u64(0x892fc7fe7c018aeb), + u64(0x03efa45064575ea4), + u64(0x3a8c9ffec99ad589), + u64(0x03261d0d1d12b21d), + u64(0xc8707fff07af113b), + u64(0x0284e40a7da88e7d), + u64(0x39f39998d2f2742f), + u64(0x0203e9a1fe2071fe), + u64(0x8fec28f484b7204b), + u64(0x033975cffd00b663), + u64(0xd989ba5d36f8e6a2), + u64(0x02945e3ffd9a2b82), + u64(0x47a161e42bfa521c), + u64(0x02104b66647b5602), + u64(0x0c35696d132a1cf9), + u64(0x034d4570a0c5566a), + u64(0x09c454574288172d), + u64(0x02a4378d4d6aab88), + u64(0xa169dd129ba0128b), + u64(0x021cf93dd7888939), + u64(0x0242fb50f9001dab), + u64(0x03618ec958da7529), + u64(0x9b68c90d940017bc), + u64(0x02b4723aad7b90ed), + u64(0x4920a0d7a999ac96), + u64(0x0229f4fbbdfc73f1), + u64(0x750101590f5c4757), + u64(0x037654c5fcc71fe8), + u64(0x2a6734473f7d05df), + u64(0x02c5109e63d27fed), + u64(0xeeb8f69f65fd9e4c), + u64(0x0237407eb641fff0), + u64(0xe45b24323cc8fd46), + u64(0x038b9a6456cfffe7), + u64(0xb6af502830a0ca9f), + u64(0x02d6151d123fffec), + u64(0xf88c402026e7087f), + u64(0x0244ddb0db666656), + u64(0x2746cd003e3e73fe), + u64(0x03a162b4923d708b), + u64(0x1f6bd73364fec332), + u64(0x02e7822a0e978d3c), + u64(0xe5efdf5c50cbcf5b), + u64(0x0252ce880bac70fc), + u64(0x3cb2fefa1adfb22b), + u64(0x03b7b0d9ac471b2e), + u64(0x308f3261af195b56), + u64(0x02f95a47bd05af58), + u64(0x5a0c284e25ade2ab), + u64(0x0261150630d15913), + u64(0x29ad0d49d5e30445), + u64(0x03ce8809e7b55b52), + u64(0x548a7107de4f369d), + u64(0x030ba007ec9115db), + u64(0xdd3b8d9fe50c2bb1), + u64(0x026fb3398a0dab15), + u64(0x952c15cca1ad12b5), + u64(0x03e5eb8f434911bc), + u64(0x775677d6e7bda891), + u64(0x031e560c35d40e30), + u64(0xc5dec645863153a7), + u64(0x027eab3cf7dcd826), +]! diff --git a/vlib/sync/channel_1_test.v b/vlib/sync/channel_1_test.v index 745441a090..4a21499524 100644 --- a/vlib/sync/channel_1_test.v +++ b/vlib/sync/channel_1_test.v @@ -1,6 +1,4 @@ -const ( - num_iterations = 10000 -) +const num_iterations = 10000 fn do_send(ch chan int) { for i in 0 .. num_iterations { diff --git a/vlib/sync/channel_2_test.v b/vlib/sync/channel_2_test.v index 3b28032f15..b2ef217cea 100644 --- a/vlib/sync/channel_2_test.v +++ b/vlib/sync/channel_2_test.v @@ -1,6 +1,4 @@ -const ( - num_iterations = 10000 -) +const num_iterations = 10000 fn do_send(ch chan int) { for i in 0 .. num_iterations { diff --git a/vlib/sync/channel_array_mut_test.v b/vlib/sync/channel_array_mut_test.v index edeb0ef99d..16704bded6 100644 --- a/vlib/sync/channel_array_mut_test.v +++ b/vlib/sync/channel_array_mut_test.v @@ -1,6 +1,4 @@ -const ( - num_iterations = 10000 -) +const num_iterations = 10000 struct St { mut: diff --git a/vlib/sync/channel_fill_test.v b/vlib/sync/channel_fill_test.v index 5e89a85c97..193d0b1546 100644 --- a/vlib/sync/channel_fill_test.v +++ b/vlib/sync/channel_fill_test.v @@ -1,9 +1,7 @@ import sync -const ( - queue_len = 1000 - queue_fill = 763 -) +const queue_len = 1000 +const queue_fill = 763 fn do_send(ch chan int, mut fin sync.Semaphore) { for i in 0 .. queue_fill { diff --git a/vlib/sync/channel_opt_propagate_test.v b/vlib/sync/channel_opt_propagate_test.v index ee78023c6a..2e8a662797 100644 --- a/vlib/sync/channel_opt_propagate_test.v +++ b/vlib/sync/channel_opt_propagate_test.v @@ -1,8 +1,6 @@ import sync -const ( - num_iterations = 10000 -) +const num_iterations = 10000 fn get_val_from_chan(ch chan i64) ?i64 { r := <-ch? diff --git a/vlib/sync/channel_polling_test.v b/vlib/sync/channel_polling_test.v index 1f56d2ffac..892202f04d 100644 --- a/vlib/sync/channel_polling_test.v +++ b/vlib/sync/channel_polling_test.v @@ -5,13 +5,11 @@ // // The receive threads add all received numbers and send them to the // main thread where the total sum is compare to the expected value. -const ( - nsend = 2 - nrec = 2 - buflen = 100 - nobj = 10000 - objs_per_thread = 5000 -) +const nsend = 2 +const nrec = 2 +const buflen = 100 +const nobj = 10000 +const objs_per_thread = 5000 fn do_rec(ch chan int, resch chan i64, n int) { mut sum := i64(0) diff --git a/vlib/sync/channels.c.v b/vlib/sync/channels.c.v index f056932572..1c5cefb031 100644 --- a/vlib/sync/channels.c.v +++ b/vlib/sync/channels.c.v @@ -6,11 +6,9 @@ import sync.stdatomic const aops_used = stdatomic.used -const ( - // how often to try to get data without blocking before to wait for semaphore - spinloops = 750 - spinloops_sem = 4000 -) +// how often to try to get data without blocking before to wait for semaphore +const spinloops = 750 +const spinloops_sem = 4000 enum BufferElemStat { unused = 0 diff --git a/vlib/sync/pool/pool.c.v b/vlib/sync/pool/pool.c.v index 41b4b0c30c..6c962ef437 100644 --- a/vlib/sync/pool/pool.c.v +++ b/vlib/sync/pool/pool.c.v @@ -6,9 +6,7 @@ import runtime @[trusted] fn C.atomic_fetch_add_u32(voidptr, u32) u32 -pub const ( - no_result = unsafe { nil } -) +pub const no_result = unsafe { nil } pub struct PoolProcessor { thread_cb voidptr diff --git a/vlib/szip/szip_test.v b/vlib/szip/szip_test.v index 0971b596f6..aaf03be27c 100644 --- a/vlib/szip/szip_test.v +++ b/vlib/szip/szip_test.v @@ -1,27 +1,25 @@ import szip import os -const ( - test_out_zip = 'v_test_zip.zip' - test_dir_zip = 'v_test_dir_zip.zip' - test_path = 'zip files' - test_path2 = '.zip folder' - test_path3 = 'test zip folder' - test_path3_1 = os.join_path(test_path3, '1', '1') - test_path3_2 = os.join_path(test_path3, '2', '1') - test_path3_3 = os.join_path(test_path3, '3', '1') - test_path3_4 = os.join_path(test_path3, '4', '1') - fname1 = 'file_1.txt' - fpath1 = os.join_path(test_path, fname1) - fname2 = 'file_2.txt' - fpath2 = os.join_path(test_path, fname2) - fname3 = '.New Text Document.txt' - fpath3 = os.join_path(test_path2, fname3) - fname4 = 'file.txt' - fpath4 = os.join_path(test_path3_1, fname4) - fpath5 = os.join_path(test_path3_2, fname4) - fpath6 = os.join_path(test_path3_4, fname4) -) +const test_out_zip = 'v_test_zip.zip' +const test_dir_zip = 'v_test_dir_zip.zip' +const test_path = 'zip files' +const test_path2 = '.zip folder' +const test_path3 = 'test zip folder' +const test_path3_1 = os.join_path(test_path3, '1', '1') +const test_path3_2 = os.join_path(test_path3, '2', '1') +const test_path3_3 = os.join_path(test_path3, '3', '1') +const test_path3_4 = os.join_path(test_path3, '4', '1') +const fname1 = 'file_1.txt' +const fpath1 = os.join_path(test_path, fname1) +const fname2 = 'file_2.txt' +const fpath2 = os.join_path(test_path, fname2) +const fname3 = '.New Text Document.txt' +const fpath3 = os.join_path(test_path2, fname3) +const fname4 = 'file.txt' +const fpath4 = os.join_path(test_path3_1, fname4) +const fpath5 = os.join_path(test_path3_2, fname4) +const fpath6 = os.join_path(test_path3_4, fname4) fn cleanup() { os.chdir(os.temp_dir()) or {} diff --git a/vlib/term/term.v b/vlib/term/term.v index 699046c687..75d67b3390 100644 --- a/vlib/term/term.v +++ b/vlib/term/term.v @@ -3,10 +3,8 @@ module term import os import strings.textscanner -const ( - default_columns_size = 80 - default_rows_size = 25 -) +const default_columns_size = 80 +const default_rows_size = 25 // Coord - used by term.get_cursor_position and term.set_cursor_position pub struct Coord { diff --git a/vlib/time/format.v b/vlib/time/format.v index 1571ed127b..063307ef4c 100644 --- a/vlib/time/format.v +++ b/vlib/time/format.v @@ -95,12 +95,10 @@ fn ordinal_suffix(n int) string { } } -const ( - tokens_2 = ['MM', 'Mo', 'DD', 'Do', 'YY', 'ss', 'kk', 'NN', 'mm', 'hh', 'HH', 'ii', 'ZZ', 'dd', - 'Qo', 'QQ', 'wo', 'ww'] - tokens_3 = ['MMM', 'DDD', 'ZZZ', 'ddd'] - tokens_4 = ['MMMM', 'DDDD', 'DDDo', 'dddd', 'YYYY'] -) +const tokens_2 = ['MM', 'Mo', 'DD', 'Do', 'YY', 'ss', 'kk', 'NN', 'mm', 'hh', 'HH', 'ii', 'ZZ', + 'dd', 'Qo', 'QQ', 'wo', 'ww'] +const tokens_3 = ['MMM', 'DDD', 'ZZZ', 'ddd'] +const tokens_4 = ['MMMM', 'DDDD', 'DDDo', 'dddd', 'YYYY'] // custom_format returns a date with custom format // diff --git a/vlib/time/misc/misc.v b/vlib/time/misc/misc.v index 408903644b..20eb62bdda 100644 --- a/vlib/time/misc/misc.v +++ b/vlib/time/misc/misc.v @@ -3,9 +3,7 @@ module misc import rand import time -const ( - start_time_unix = time.now().unix // start_time_unix is set when the program is started. -) +const start_time_unix = time.now().unix // random returns a random time struct in *the past*. pub fn random() time.Time { diff --git a/vlib/time/time.v b/vlib/time/time.v index b401de7c6f..92dc0b9f4e 100644 --- a/vlib/time/time.v +++ b/vlib/time/time.v @@ -1,41 +1,38 @@ module time -pub const ( - days_string = 'MonTueWedThuFriSatSun' - long_days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', - 'Sunday'] - month_days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] - months_string = 'JanFebMarAprMayJunJulAugSepOctNovDec' - long_months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', - 'September', 'October', 'November', 'December'] - // The unsigned zero year for internal calculations. - // Must be 1 mod 400, and times before it will not compute correctly, - // but otherwise can be changed at will. - absolute_zero_year = i64(-292277022399) - seconds_per_minute = 60 - seconds_per_hour = 60 * seconds_per_minute - seconds_per_day = 24 * seconds_per_hour - seconds_per_week = 7 * seconds_per_day - days_per_400_years = days_in_year * 400 + 97 - days_per_100_years = days_in_year * 100 + 24 - days_per_4_years = days_in_year * 4 + 1 - days_in_year = 365 - days_before = [ - 0, - 31, - 31 + 28, - 31 + 28 + 31, - 31 + 28 + 31 + 30, - 31 + 28 + 31 + 30 + 31, - 31 + 28 + 31 + 30 + 31 + 30, - 31 + 28 + 31 + 30 + 31 + 30 + 31, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31, - ] -) +pub const days_string = 'MonTueWedThuFriSatSun' +pub const long_days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] +pub const month_days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] +pub const months_string = 'JanFebMarAprMayJunJulAugSepOctNovDec' +pub const long_months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', + 'September', 'October', 'November', 'December'] +// The unsigned zero year for internal calculations. +// Must be 1 mod 400, and times before it will not compute correctly, +// but otherwise can be changed at will. +pub const absolute_zero_year = i64(-292277022399) +pub const seconds_per_minute = 60 +pub const seconds_per_hour = 60 * seconds_per_minute +pub const seconds_per_day = 24 * seconds_per_hour +pub const seconds_per_week = 7 * seconds_per_day +pub const days_per_400_years = days_in_year * 400 + 97 +pub const days_per_100_years = days_in_year * 100 + 24 +pub const days_per_4_years = days_in_year * 4 + 1 +pub const days_in_year = 365 +pub const days_before = [ + 0, + 31, + 31 + 28, + 31 + 28 + 31, + 31 + 28 + 31 + 30, + 31 + 28 + 31 + 30 + 31, + 31 + 28 + 31 + 30 + 31 + 30, + 31 + 28 + 31 + 30 + 31 + 30 + 31, + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31, + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30, + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31, + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30, + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31, +] // Time contains various time units for a point in time. pub struct Time { @@ -343,16 +340,14 @@ pub fn (t Time) debug() string { // A lot of these are taken from the Go library. pub type Duration = i64 -pub const ( - nanosecond = Duration(1) - microsecond = Duration(1000 * nanosecond) - millisecond = Duration(1000 * microsecond) - second = Duration(1000 * millisecond) - minute = Duration(60 * second) - hour = Duration(60 * minute) - // day = Duration(24 * hour) - infinite = Duration(i64(9223372036854775807)) -) +pub const nanosecond = Duration(1) +pub const microsecond = Duration(1000 * nanosecond) +pub const millisecond = Duration(1000 * microsecond) +pub const second = Duration(1000 * millisecond) +pub const minute = Duration(60 * second) +pub const hour = Duration(60 * minute) +// day = Duration(24 * hour) +pub const infinite = Duration(i64(9223372036854775807)) // nanoseconds returns the duration as an integer number of nanoseconds. pub fn (d Duration) nanoseconds() i64 { diff --git a/vlib/time/time_format_test.v b/vlib/time/time_format_test.v index 6042cf96da..e92472c6ba 100644 --- a/vlib/time/time_format_test.v +++ b/vlib/time/time_format_test.v @@ -1,16 +1,14 @@ import time -const ( - time_to_test = time.Time{ - year: 1980 - month: 7 - day: 11 - hour: 21 - minute: 23 - second: 42 - unix: 332198622 - } -) +const time_to_test = time.Time{ + year: 1980 + month: 7 + day: 11 + hour: 21 + minute: 23 + second: 42 + unix: 332198622 +} fn test_now_format() { t := time.now() diff --git a/vlib/time/time_windows.c.v b/vlib/time/time_windows.c.v index 16565c625f..ef0105ccc9 100644 --- a/vlib/time/time_windows.c.v +++ b/vlib/time/time_windows.c.v @@ -41,12 +41,10 @@ fn C.localtime_s(t &C.time_t, tm &C.tm) fn C.timespec_get(t &C.timespec, base int) int -const ( - // start_time is needed on Darwin and Windows because of potential overflows - start_time = init_win_time_start() - freq_time = init_win_time_freq() - start_local_time = local_as_unix_time() -) +// start_time is needed on Darwin and Windows because of potential overflows +const start_time = init_win_time_start() +const freq_time = init_win_time_freq() +const start_local_time = local_as_unix_time() // in most systems, these are __quad_t, which is an i64 pub struct C.timespec { diff --git a/vlib/toml/decoder/decoder.v b/vlib/toml/decoder/decoder.v index 465a0f84d3..4cc3c3cb9b 100644 --- a/vlib/toml/decoder/decoder.v +++ b/vlib/toml/decoder/decoder.v @@ -9,10 +9,8 @@ import toml.token import toml.scanner import strconv -const ( - // utf8_max is the largest inclusive value of the Unicodes scalar value ranges. - utf8_max = 0x10FFFF -) +// utf8_max is the largest inclusive value of the Unicodes scalar value ranges. +const utf8_max = 0x10FFFF // Decoder decode special sequences in a tree of TOML `ast.Value`'s. pub struct Decoder { diff --git a/vlib/toml/parser/parser.v b/vlib/toml/parser/parser.v index 53039f635f..95dd3e426d 100644 --- a/vlib/toml/parser/parser.v +++ b/vlib/toml/parser/parser.v @@ -10,12 +10,10 @@ import toml.util import toml.token import toml.scanner -pub const ( - all_formatting = [token.Kind.whitespace, .tab, .cr, .nl] - space_formatting = [token.Kind.whitespace, .tab] - keys_and_space_formatting = [token.Kind.whitespace, .tab, .minus, .bare, .quoted, .boolean, - .number, .underscore] -) +pub const all_formatting = [token.Kind.whitespace, .tab, .cr, .nl] +pub const space_formatting = [token.Kind.whitespace, .tab] +pub const keys_and_space_formatting = [token.Kind.whitespace, .tab, .minus, .bare, .quoted, .boolean, + .number, .underscore] type DottedKey = []string diff --git a/vlib/toml/scanner/scanner.v b/vlib/toml/scanner/scanner.v index 7b0a9cc0b9..1db90cee38 100644 --- a/vlib/toml/scanner/scanner.v +++ b/vlib/toml/scanner/scanner.v @@ -7,10 +7,8 @@ import toml.input import toml.token import toml.util -pub const ( - digit_extras = [`_`, `.`, `x`, `o`, `b`, `e`, `E`] - end_of_text = u32(~0) -) +pub const digit_extras = [`_`, `.`, `x`, `o`, `b`, `e`, `E`] +pub const end_of_text = u32(~0) // Scanner contains the necessary fields for the state of the scan process. // the task the scanner does is also referred to as "lexing" or "tokenizing". diff --git a/vlib/toml/tests/alexcrichton_toml_rs_test.v b/vlib/toml/tests/alexcrichton_toml_rs_test.v index 4c803517a1..4c9304e65d 100644 --- a/vlib/toml/tests/alexcrichton_toml_rs_test.v +++ b/vlib/toml/tests/alexcrichton_toml_rs_test.v @@ -9,37 +9,36 @@ const hide_oks = os.getenv('VTEST_HIDE_OK') == '1' // The actual tests and data can be obtained by doing: // `git clone --depth 1 https://github.com/alexcrichton/toml-rs.git vlib/toml/tests/testdata/alexcrichton/toml-test` // See also the CI toml tests -const ( - // Kept for easier handling of future updates to the tests - valid_exceptions = [ - 'valid/example-v0.3.0.toml', - 'valid/example-v0.4.0.toml', - 'valid/datetime-truncate.toml', // Not considered valid since RFC 3339 doesn't permit > 6 ms digits ?? - ] - invalid_exceptions = []string{} +// Kept for easier handling of future updates to the tests +const valid_exceptions = [ + 'valid/example-v0.3.0.toml', + 'valid/example-v0.4.0.toml', + 'valid/datetime-truncate.toml', // Not considered valid since RFC 3339 doesn't permit > 6 ms digits ?? +] +const invalid_exceptions = []string{} - valid_value_exceptions = [ - // These have correct values, and should've passed, but the format of arrays is *mixed* in the JSON ?? - 'valid/datetime-truncate.toml', - 'valid/example2.toml', - 'valid/example-v0.4.0.toml', - 'valid/example-v0.3.0.toml', - ] +const valid_value_exceptions = [ + // These have correct values, and should've passed, but the format of arrays is *mixed* in the JSON ?? + 'valid/datetime-truncate.toml', + 'valid/example2.toml', + 'valid/example-v0.4.0.toml', + 'valid/example-v0.3.0.toml', +] - // These have correct values, and should've passed as-is, but the format of arrays changes in the JSON ?? - // We account for that here - use_type_2_arrays = [ - 'valid/table-array-implicit.toml', - 'valid/table-array-many.toml', - 'valid/table-array-one.toml', - 'valid/table-array-nest.toml', - 'valid/table-array-nest-no-keys.toml', - ] - tests_folder = os.join_path('test-suite', 'tests') - jq = os.find_abs_path_of_executable('jq') or { '' } - compare_work_dir_root = os.join_path(os.vtmp_dir(), 'toml', 'alexcrichton') - // From: https://stackoverflow.com/a/38266731/1904615 - jq_normalize = r'# Apply f to composite entities recursively using keys[], and to atoms +// These have correct values, and should've passed as-is, but the format of arrays changes in the JSON ?? +// We account for that here +const use_type_2_arrays = [ + 'valid/table-array-implicit.toml', + 'valid/table-array-many.toml', + 'valid/table-array-one.toml', + 'valid/table-array-nest.toml', + 'valid/table-array-nest-no-keys.toml', +] +const tests_folder = os.join_path('test-suite', 'tests') +const jq = os.find_abs_path_of_executable('jq') or { '' } +const compare_work_dir_root = os.join_path(os.vtmp_dir(), 'toml', 'alexcrichton') +// From: https://stackoverflow.com/a/38266731/1904615 +const jq_normalize = r'# Apply f to composite entities recursively using keys[], and to atoms def sorted_walk(f): . as $in | if type == "object" then @@ -52,7 +51,6 @@ def sorted_walk(f): def normalize: sorted_walk(if type == "array" then sort else . end); normalize' -) fn run(args []string) !string { res := os.execute(args.join(' ')) diff --git a/vlib/toml/tests/array_of_tables_1_level_test.v b/vlib/toml/tests/array_of_tables_1_level_test.v index 971db6fb3e..e3c9e3f7f1 100644 --- a/vlib/toml/tests/array_of_tables_1_level_test.v +++ b/vlib/toml/tests/array_of_tables_1_level_test.v @@ -2,8 +2,7 @@ import os import toml import toml.to -const ( - toml_table_text = ' +const toml_table_text = ' [[products]] name = "Hammer" sku = 738594937 @@ -15,7 +14,6 @@ name = "Nail" sku = 284758393 color = "gray"' -) fn test_tables() { mut toml_doc := toml.parse_text(toml_table_text) or { panic(err) } diff --git a/vlib/toml/tests/array_of_tables_2_level_test.v b/vlib/toml/tests/array_of_tables_2_level_test.v index b8fa0a7a28..cc1d4af0f5 100644 --- a/vlib/toml/tests/array_of_tables_2_level_test.v +++ b/vlib/toml/tests/array_of_tables_2_level_test.v @@ -2,8 +2,7 @@ import os import toml import toml.to -const ( - toml_text = '[[albums]] +const toml_text = '[[albums]] name = "Born to Run" [[albums.songs]] @@ -20,7 +19,6 @@ name = "Born in the USA" [[albums.songs]] name = "Dancing in the Dark"' -) const fprefix = os.join_path(os.dir(@FILE), 'testdata', os.file_name(@FILE).all_before_last('.')) diff --git a/vlib/toml/tests/array_of_tables_array_test.v b/vlib/toml/tests/array_of_tables_array_test.v index 32671dc000..a4861c2b95 100644 --- a/vlib/toml/tests/array_of_tables_array_test.v +++ b/vlib/toml/tests/array_of_tables_array_test.v @@ -2,8 +2,7 @@ import os import toml import toml.to -const ( - toml_text = '[[a]] +const toml_text = '[[a]] [[a.b]] [a.b.c] d = "val0" @@ -11,7 +10,6 @@ const ( [a.b.c] d = "val1" ' -) fn test_nested_array_of_tables() { mut toml_doc := toml.parse_text(toml_text) or { panic(err) } diff --git a/vlib/toml/tests/burntsushi_toml_test.v b/vlib/toml/tests/burntsushi_toml_test.v index 63436258c5..59e2862ec4 100644 --- a/vlib/toml/tests/burntsushi_toml_test.v +++ b/vlib/toml/tests/burntsushi_toml_test.v @@ -12,26 +12,25 @@ const hide_oks = os.getenv('VTEST_HIDE_OK') == '1' // `cd vlib/toml/tests/testdata` // `git clone --depth 1 https://github.com/BurntSushi/toml-test.git burntsushi/toml-test` // See also the CI toml tests -const ( - // Kept for easier handling of future updates to the tests - valid_exceptions = [ - 'comment/everywhere.toml', - ] - invalid_exceptions = [ - 'datetime/hour-over.toml', - 'datetime/mday-under.toml', - 'datetime/minute-over.toml', - 'datetime/month-under.toml', - 'datetime/second-over.toml', - ] - valid_value_exceptions = []string{} - // BUG with string interpolation of '${i64(-9223372036854775808)}') see below for workaround - //'integer/long.toml', // TODO https://github.com/vlang/v/issues/9507 +// Kept for easier handling of future updates to the tests +const valid_exceptions = [ + 'comment/everywhere.toml', +] +const invalid_exceptions = [ + 'datetime/hour-over.toml', + 'datetime/mday-under.toml', + 'datetime/minute-over.toml', + 'datetime/month-under.toml', + 'datetime/second-over.toml', +] +const valid_value_exceptions = []string{} +// BUG with string interpolation of '${i64(-9223372036854775808)}') see below for workaround +//'integer/long.toml', // TODO https://github.com/vlang/v/issues/9507 - jq = os.find_abs_path_of_executable('jq') or { '' } - compare_work_dir_root = os.join_path(os.vtmp_dir(), 'toml', 'burntsushi') - // From: https://stackoverflow.com/a/38266731/1904615 - jq_normalize = r'# Apply f to composite entities recursively using keys[], and to atoms +const jq = os.find_abs_path_of_executable('jq') or { '' } +const compare_work_dir_root = os.join_path(os.vtmp_dir(), 'toml', 'burntsushi') +// From: https://stackoverflow.com/a/38266731/1904615 +const jq_normalize = r'# Apply f to composite entities recursively using keys[], and to atoms def sorted_walk(f): . as $in | if type == "object" then @@ -44,7 +43,6 @@ def sorted_walk(f): def normalize: sorted_walk(if type == "array" then sort else . end); normalize' -) fn run(args []string) !string { res := os.execute(args.join(' ')) diff --git a/vlib/toml/tests/iarna_toml_spec_test.v b/vlib/toml/tests/iarna_toml_spec_test.v index 3de8a4ee43..d8a3326bce 100644 --- a/vlib/toml/tests/iarna_toml_spec_test.v +++ b/vlib/toml/tests/iarna_toml_spec_test.v @@ -17,35 +17,34 @@ const do_yaml_conversion = os.getenv('VTEST_TOML_DO_YAML_CONVERSION') == '1' // The actual tests and data can be obtained by doing: // `git clone --depth 1 https://github.com/iarna/toml-spec-tests.git vlib/toml/tests/testdata/iarna/toml-test` // See also the CI toml tests -const ( - // Kept for easier handling of future updates to the tests - valid_exceptions = []string{} - invalid_exceptions = []string{} +// Kept for easier handling of future updates to the tests +const valid_exceptions = []string{} +const invalid_exceptions = []string{} - valid_value_exceptions = [ - 'values/spec-date-time-3.toml', - 'values/spec-date-time-4.toml', - 'values/spec-readme-example.toml', - 'values/spec-date-time-6.toml', - 'values/spec-date-time-5.toml', - 'values/spec-date-time-1.toml', - 'values/spec-date-time-2.toml', - 'values/qa-table-inline-nested-1000.toml', - 'values/qa-array-inline-nested-1000.toml', - ] +const valid_value_exceptions = [ + 'values/spec-date-time-3.toml', + 'values/spec-date-time-4.toml', + 'values/spec-readme-example.toml', + 'values/spec-date-time-6.toml', + 'values/spec-date-time-5.toml', + 'values/spec-date-time-1.toml', + 'values/spec-date-time-2.toml', + 'values/qa-table-inline-nested-1000.toml', + 'values/qa-array-inline-nested-1000.toml', +] - yaml_value_exceptions = [ - 'values/spec-float-5.toml', // YAML: "1e6", V: 1000000 - 'values/spec-float-9.toml', // YAML: "-0e0", V: 0 - 'values/spec-float-6.toml', // YAML: "-2E-2", V: -0.02 - 'values/spec-float-4.toml', // YAML: "5e+22", V: 50000000000000004000000 - ] +const yaml_value_exceptions = [ + 'values/spec-float-5.toml', // YAML: "1e6", V: 1000000 + 'values/spec-float-9.toml', // YAML: "-0e0", V: 0 + 'values/spec-float-6.toml', // YAML: "-2E-2", V: -0.02 + 'values/spec-float-4.toml', // YAML: "5e+22", V: 50000000000000004000000 +] - jq = os.find_abs_path_of_executable('jq') or { '' } - python = os.find_abs_path_of_executable('python') or { '' } - compare_work_dir_root = os.join_path(os.vtmp_dir(), 'toml', 'iarna') - // From: https://stackoverflow.com/a/38266731/1904615 - jq_normalize = r'# Apply f to composite entities recursively using keys[], and to atoms +const jq = os.find_abs_path_of_executable('jq') or { '' } +const python = os.find_abs_path_of_executable('python') or { '' } +const compare_work_dir_root = os.join_path(os.vtmp_dir(), 'toml', 'iarna') +// From: https://stackoverflow.com/a/38266731/1904615 +const jq_normalize = r'# Apply f to composite entities recursively using keys[], and to atoms def sorted_walk(f): . as $in | if type == "object" then @@ -58,7 +57,6 @@ def sorted_walk(f): def normalize: sorted_walk(if type == "array" then sort else . end); normalize' -) fn run(args []string) !string { res := os.execute(args.join(' ')) diff --git a/vlib/toml/tests/strings_test.v b/vlib/toml/tests/strings_test.v index 76548de0ac..2e4242da21 100644 --- a/vlib/toml/tests/strings_test.v +++ b/vlib/toml/tests/strings_test.v @@ -1,8 +1,7 @@ import os import toml -const ( - toml_multiline_text_1 = 'multi1 = """one""" +const toml_multiline_text_1 = 'multi1 = """one""" multi2 = """one two""" multi3 = """ @@ -15,7 +14,8 @@ two three four """' - toml_multiline_text_2 = "multi1 = '''one''' + +const toml_multiline_text_2 = "multi1 = '''one''' multi2 = '''one two''' multi3 = ''' @@ -28,9 +28,9 @@ two three four '''" - toml_unicode_escapes = r'short = "\u03B4" + +const toml_unicode_escapes = r'short = "\u03B4" long = "\U000003B4"' -) fn test_multiline_strings() { mut toml_doc := toml.parse_text(toml_multiline_text_1) or { panic(err) } diff --git a/vlib/toml/tests/table_test.v b/vlib/toml/tests/table_test.v index c10d6a1167..cc9408dbd9 100644 --- a/vlib/toml/tests/table_test.v +++ b/vlib/toml/tests/table_test.v @@ -1,7 +1,6 @@ import toml -const ( - toml_table_text = 'inline = {a.b = 42} +const toml_table_text = 'inline = {a.b = 42} many.dots.here.dot.dot.dot = {a.b.c = 1, a.b.d = 2} @@ -24,7 +23,6 @@ T = {a.b=1} [[arr]] t = {a.b=2} T = {a.b=2}' -) fn test_tables() { mut toml_doc := toml.parse_text(toml_table_text) or { panic(err) } diff --git a/vlib/toml/tests/toml_bom_test.v b/vlib/toml/tests/toml_bom_test.v index fba1dd706d..908df9df07 100644 --- a/vlib/toml/tests/toml_bom_test.v +++ b/vlib/toml/tests/toml_bom_test.v @@ -7,14 +7,12 @@ const empty_toml_document = toml.Doc{ ast: &ast.Root(unsafe { nil }) } -const ( - toml_text_with_utf8_bom = os.read_file(os.real_path(os.join_path(os.dir(@FILE), 'testdata', - 'toml_with_utf8_bom' + '.toml'))) or { panic(err) } - toml_text_with_utf16_bom = os.read_file(os.real_path(os.join_path(os.dir(@FILE), 'testdata', - 'toml_with_utf16_bom' + '.toml'))) or { panic(err) } - toml_text_with_utf32_bom = os.read_file(os.real_path(os.join_path(os.dir(@FILE), 'testdata', - 'toml_with_utf32_bom' + '.toml'))) or { panic(err) } -) +const toml_text_with_utf8_bom = os.read_file(os.real_path(os.join_path(os.dir(@FILE), + 'testdata', 'toml_with_utf8_bom' + '.toml'))) or { panic(err) } +const toml_text_with_utf16_bom = os.read_file(os.real_path(os.join_path(os.dir(@FILE), + 'testdata', 'toml_with_utf16_bom' + '.toml'))) or { panic(err) } +const toml_text_with_utf32_bom = os.read_file(os.real_path(os.join_path(os.dir(@FILE), + 'testdata', 'toml_with_utf32_bom' + '.toml'))) or { panic(err) } fn test_toml_with_bom() { toml_doc := toml.parse_text(toml_text_with_utf8_bom) or { panic(err) } diff --git a/vlib/toml/tests/value_query_test.v b/vlib/toml/tests/value_query_test.v index b7d6d76bea..82bb7137be 100644 --- a/vlib/toml/tests/value_query_test.v +++ b/vlib/toml/tests/value_query_test.v @@ -1,8 +1,7 @@ import toml import strconv -const ( - toml_text = ' +const toml_text = ' modules = [ "ui", "toml" ] errors = [] @@ -38,7 +37,7 @@ colors = [ ] ' - toml_text_2 = " +const toml_text_2 = " [defaults] run.flags = ['-f 1'] @@ -47,7 +46,6 @@ colors = [ 'RUN_TIME' = 5 'TEST_PATH' = '/tmp/test' " -) fn test_value_query_in_array() { toml_doc := toml.parse_text(toml_text) or { panic(err) } diff --git a/vlib/v/ast/ast.v b/vlib/v/ast/ast.v index 32c8794141..f885e9b408 100644 --- a/vlib/v/ast/ast.v +++ b/vlib/v/ast/ast.v @@ -183,11 +183,9 @@ pub: pos token.Pos } -pub const ( - empty_expr = Expr(EmptyExpr(0)) - empty_stmt = Stmt(EmptyStmt{}) - empty_node = Node(EmptyNode{}) -) +pub const empty_expr = Expr(EmptyExpr(0)) +pub const empty_stmt = Stmt(EmptyStmt{}) +pub const empty_node = Node(EmptyNode{}) // `{stmts}` or `unsafe {stmts}` pub struct Block { @@ -1633,89 +1631,84 @@ pub mut: expr Expr // (a) } -pub const ( - // reference: https://en.wikipedia.org/wiki/X86#/media/File:Table_of_x86_Registers_svg.svg - // map register size -> register name - x86_no_number_register_list = { - 8: ['al', 'ah', 'bl', 'bh', 'cl', 'ch', 'dl', 'dh', 'bpl', 'sil', 'dil', 'spl'] - 16: ['ax', 'bx', 'cx', 'dx', 'bp', 'si', 'di', 'sp', // segment registers - 'cs', 'ss', 'ds', 'es', 'fs', 'gs', 'flags', 'ip', // task registers - 'gdtr', 'idtr', 'tr', 'ldtr', // CSR register 'msw', /* FP core registers */ 'cw', 'sw', 'tw', 'fp_ip', 'fp_dp', 'fp_cs', - 'fp_ds', 'fp_opc'] - 32: [ - 'eax', - 'ebx', - 'ecx', - 'edx', - 'ebp', - 'esi', - 'edi', - 'esp', - 'eflags', - 'eip', // CSR register - 'mxcsr', // 32-bit FP core registers 'fp_dp', 'fp_ip' (TODO: why are there duplicates?) - ] - 64: ['rax', 'rbx', 'rcx', 'rdx', 'rbp', 'rsi', 'rdi', 'rsp', 'rflags', 'rip'] +// reference: https://en.wikipedia.org/wiki/X86#/media/File:Table_of_x86_Registers_svg.svg +// map register size -> register name +pub const x86_no_number_register_list = { + 8: ['al', 'ah', 'bl', 'bh', 'cl', 'ch', 'dl', 'dh', 'bpl', 'sil', 'dil', 'spl'] + 16: ['ax', 'bx', 'cx', 'dx', 'bp', 'si', 'di', 'sp', // segment registers + 'cs', 'ss', 'ds', 'es', 'fs', 'gs', 'flags', 'ip', // task registers + 'gdtr', 'idtr', 'tr', 'ldtr', // CSR register 'msw', /* FP core registers */ 'cw', 'sw', 'tw', 'fp_ip', 'fp_dp', 'fp_cs', + 'fp_ds', 'fp_opc'] + 32: [ + 'eax', + 'ebx', + 'ecx', + 'edx', + 'ebp', + 'esi', + 'edi', + 'esp', + 'eflags', + 'eip', // CSR register + 'mxcsr', // 32-bit FP core registers 'fp_dp', 'fp_ip' (TODO: why are there duplicates?) + ] + 64: ['rax', 'rbx', 'rcx', 'rdx', 'rbp', 'rsi', 'rdi', 'rsp', 'rflags', 'rip'] +} +// no comments because maps do not support comments +// r#*: gp registers added in 64-bit extensions, can only be from 8-15 actually +// *mm#: vector/simd registers +// st#: floating point numbers +// cr#: control/status registers +// dr#: debug registers +pub const x86_with_number_register_list = { + 8: { + 'r#b': 16 } - // no comments because maps do not support comments - // r#*: gp registers added in 64-bit extensions, can only be from 8-15 actually - // *mm#: vector/simd registers - // st#: floating point numbers - // cr#: control/status registers - // dr#: debug registers - x86_with_number_register_list = { - 8: { - 'r#b': 16 - } - 16: { - 'r#w': 16 - } - 32: { - 'r#d': 16 - } - 64: { - 'r#': 16 - 'mm#': 16 - 'cr#': 16 - 'dr#': 16 - } - 80: { - 'st#': 16 - } - 128: { - 'xmm#': 32 - } - 256: { - 'ymm#': 32 - } - 512: { - 'zmm#': 32 - } + 16: { + 'r#w': 16 } -) + 32: { + 'r#d': 16 + } + 64: { + 'r#': 16 + 'mm#': 16 + 'cr#': 16 + 'dr#': 16 + } + 80: { + 'st#': 16 + } + 128: { + 'xmm#': 32 + } + 256: { + 'ymm#': 32 + } + 512: { + 'zmm#': 32 + } +} // TODO: saved priviled registers for arm -pub const ( - arm_no_number_register_list = ['fp', // aka r11 - 'ip', // not instruction pointer: aka r12 - 'sp', // aka r13 - 'lr', // aka r14 - 'pc', // this is instruction pointer ('program counter'): aka r15 - ] // 'cpsr' and 'apsr' are special flags registers, but cannot be referred to directly - arm_with_number_register_list = { - 'r#': 16 - } -) +pub const arm_no_number_register_list = ['fp', // aka r11 + 'ip', // not instruction pointer: aka r12 + 'sp', // aka r13 + 'lr', // aka r14 + 'pc', // this is instruction pointer ('program counter'): aka r15 +] // 'cpsr' and 'apsr' are special flags registers, but cannot be referred to directly -pub const ( - riscv_no_number_register_list = ['zero', 'ra', 'sp', 'gp', 'tp'] - riscv_with_number_register_list = { - 'x#': 32 - 't#': 3 - 's#': 12 - 'a#': 8 - } -) +pub const arm_with_number_register_list = { + 'r#': 16 +} + +pub const riscv_no_number_register_list = ['zero', 'ra', 'sp', 'gp', 'tp'] +pub const riscv_with_number_register_list = { + 'x#': 32 + 't#': 3 + 's#': 12 + 'a#': 8 +} // `assert a == 0, 'a is zero'` @[minify] diff --git a/vlib/v/ast/cflags_test.v b/vlib/v/ast/cflags_test.v index 51e29c9267..db203013f8 100644 --- a/vlib/v/ast/cflags_test.v +++ b/vlib/v/ast/cflags_test.v @@ -1,13 +1,11 @@ import v.ast import v.cflag -const ( - module_name = 'main' - cdefines = []string{} - no_name = '' - no_flag = '' - no_os = '' -) +const module_name = 'main' +const cdefines = []string{} +const no_name = '' +const no_flag = '' +const no_os = '' fn test_parse_valid_cflags() { mut t := ast.new_table() diff --git a/vlib/v/ast/comptime_valid_idents.v b/vlib/v/ast/comptime_valid_idents.v index 71741a8b7c..dac7d9e933 100644 --- a/vlib/v/ast/comptime_valid_idents.v +++ b/vlib/v/ast/comptime_valid_idents.v @@ -1,19 +1,18 @@ module ast -pub const ( - valid_comptime_if_os = ['windows', 'ios', 'macos', 'mach', 'darwin', 'hpux', 'gnu', - 'qnx', 'linux', 'freebsd', 'openbsd', 'netbsd', 'bsd', 'dragonfly', 'android', 'termux', - 'solaris', 'haiku', 'serenity', 'vinix', 'plan9'] - valid_comptime_if_compilers = ['gcc', 'tinyc', 'clang', 'mingw', 'msvc', 'cplusplus'] - valid_comptime_if_platforms = ['amd64', 'i386', 'aarch64', 'arm64', 'arm32', 'rv64', 'rv32'] - valid_comptime_if_cpu_features = ['x64', 'x32', 'little_endian', 'big_endian'] - valid_comptime_if_other = ['apk', 'js', 'debug', 'prod', 'test', 'glibc', 'prealloc', - 'no_bounds_checking', 'freestanding', 'threads', 'js_node', 'js_browser', 'js_freestanding', - 'interpreter', 'es5', 'profile', 'wasm32', 'wasm32_emscripten', 'wasm32_wasi', 'fast_math', - 'native'] - valid_comptime_not_user_defined = all_valid_comptime_idents() - valid_comptime_compression_types = ['none', 'zlib'] -) +pub const valid_comptime_if_os = ['windows', 'ios', 'macos', 'mach', 'darwin', 'hpux', 'gnu', 'qnx', + 'linux', 'freebsd', 'openbsd', 'netbsd', 'bsd', 'dragonfly', 'android', 'termux', 'solaris', + 'haiku', 'serenity', 'vinix', 'plan9'] +pub const valid_comptime_if_compilers = ['gcc', 'tinyc', 'clang', 'mingw', 'msvc', 'cplusplus'] +pub const valid_comptime_if_platforms = ['amd64', 'i386', 'aarch64', 'arm64', 'arm32', 'rv64', + 'rv32'] +pub const valid_comptime_if_cpu_features = ['x64', 'x32', 'little_endian', 'big_endian'] +pub const valid_comptime_if_other = ['apk', 'js', 'debug', 'prod', 'test', 'glibc', 'prealloc', + 'no_bounds_checking', 'freestanding', 'threads', 'js_node', 'js_browser', 'js_freestanding', + 'interpreter', 'es5', 'profile', 'wasm32', 'wasm32_emscripten', 'wasm32_wasi', 'fast_math', + 'native'] +pub const valid_comptime_not_user_defined = all_valid_comptime_idents() +pub const valid_comptime_compression_types = ['none', 'zlib'] fn all_valid_comptime_idents() []string { mut res := []string{} diff --git a/vlib/v/ast/table.v b/vlib/v/ast/table.v index d3354e9867..6cff4978a2 100644 --- a/vlib/v/ast/table.v +++ b/vlib/v/ast/table.v @@ -75,11 +75,9 @@ pub fn (mut t Table) free() { } } -pub const ( - invalid_type_idx = -1 - fn_type_escape_seq = [' ', '', '(', '_', ')', ''] - map_cname_escape_seq = ['[', '_T_', ', ', '_', ']', ''] -) +pub const invalid_type_idx = -1 +pub const fn_type_escape_seq = [' ', '', '(', '_', ')', ''] +pub const map_cname_escape_seq = ['[', '_T_', ', ', '_', ']', ''] pub type FnPanicHandler = fn (&Table, string) diff --git a/vlib/v/ast/types.v b/vlib/v/ast/types.v index e0b0582c17..14394be001 100644 --- a/vlib/v/ast/types.v +++ b/vlib/v/ast/types.v @@ -567,39 +567,37 @@ pub fn (typ Type) is_bool() bool { return typ.idx() == ast.bool_type_idx } -pub const ( - void_type_idx = 1 - voidptr_type_idx = 2 - byteptr_type_idx = 3 - charptr_type_idx = 4 - i8_type_idx = 5 - i16_type_idx = 6 - i32_type_idx = 7 - int_type_idx = 8 - i64_type_idx = 9 - isize_type_idx = 10 - u8_type_idx = 11 - u16_type_idx = 12 - u32_type_idx = 13 - u64_type_idx = 14 - usize_type_idx = 15 - f32_type_idx = 16 - f64_type_idx = 17 - char_type_idx = 18 - bool_type_idx = 19 - none_type_idx = 20 - string_type_idx = 21 - rune_type_idx = 22 - array_type_idx = 23 - map_type_idx = 24 - chan_type_idx = 25 - any_type_idx = 26 - float_literal_type_idx = 27 - int_literal_type_idx = 28 - thread_type_idx = 29 - error_type_idx = 30 - nil_type_idx = 31 -) +pub const void_type_idx = 1 +pub const voidptr_type_idx = 2 +pub const byteptr_type_idx = 3 +pub const charptr_type_idx = 4 +pub const i8_type_idx = 5 +pub const i16_type_idx = 6 +pub const i32_type_idx = 7 +pub const int_type_idx = 8 +pub const i64_type_idx = 9 +pub const isize_type_idx = 10 +pub const u8_type_idx = 11 +pub const u16_type_idx = 12 +pub const u32_type_idx = 13 +pub const u64_type_idx = 14 +pub const usize_type_idx = 15 +pub const f32_type_idx = 16 +pub const f64_type_idx = 17 +pub const char_type_idx = 18 +pub const bool_type_idx = 19 +pub const none_type_idx = 20 +pub const string_type_idx = 21 +pub const rune_type_idx = 22 +pub const array_type_idx = 23 +pub const map_type_idx = 24 +pub const chan_type_idx = 25 +pub const any_type_idx = 26 +pub const float_literal_type_idx = 27 +pub const int_literal_type_idx = 28 +pub const thread_type_idx = 29 +pub const error_type_idx = 30 +pub const nil_type_idx = 31 // Note: builtin_type_names must be in the same order as the idx consts above pub const builtin_type_names = ['void', 'voidptr', 'byteptr', 'charptr', 'i8', 'i16', 'int', 'i64', @@ -609,63 +607,60 @@ pub const builtin_type_names = ['void', 'voidptr', 'byteptr', 'charptr', 'i8', ' pub const builtin_type_names_matcher = token.new_keywords_matcher_from_array_trie(builtin_type_names) -pub const ( - integer_type_idxs = [i8_type_idx, i16_type_idx, int_type_idx, i64_type_idx, u8_type_idx, - u16_type_idx, u32_type_idx, u64_type_idx, isize_type_idx, usize_type_idx, - int_literal_type_idx, rune_type_idx, i32_type_idx] - signed_integer_type_idxs = [char_type_idx, i8_type_idx, i16_type_idx, int_type_idx, - i64_type_idx, i32_type_idx, isize_type_idx] - unsigned_integer_type_idxs = [u8_type_idx, u16_type_idx, u32_type_idx, u64_type_idx, - usize_type_idx] - // C will promote any type smaller than int to int in an expression - int_promoted_type_idxs = [char_type_idx, i8_type_idx, i16_type_idx, u8_type_idx, u16_type_idx] - float_type_idxs = [f32_type_idx, f64_type_idx, float_literal_type_idx] - number_type_idxs = [i8_type_idx, i16_type_idx, int_type_idx, i32_type_idx, i64_type_idx, - u8_type_idx, char_type_idx, u16_type_idx, u32_type_idx, u64_type_idx, isize_type_idx, - usize_type_idx, f32_type_idx, f64_type_idx, int_literal_type_idx, float_literal_type_idx, - rune_type_idx] - pointer_type_idxs = [voidptr_type_idx, byteptr_type_idx, charptr_type_idx, nil_type_idx] -) +pub const integer_type_idxs = [i8_type_idx, i16_type_idx, int_type_idx, i64_type_idx, u8_type_idx, + u16_type_idx, u32_type_idx, u64_type_idx, isize_type_idx, usize_type_idx, int_literal_type_idx, + rune_type_idx, i32_type_idx] +pub const signed_integer_type_idxs = [char_type_idx, i8_type_idx, i16_type_idx, int_type_idx, + i64_type_idx, i32_type_idx, isize_type_idx] +pub const unsigned_integer_type_idxs = [u8_type_idx, u16_type_idx, u32_type_idx, u64_type_idx, + usize_type_idx] +// C will promote any type smaller than int to int in an expression +pub const int_promoted_type_idxs = [char_type_idx, i8_type_idx, i16_type_idx, u8_type_idx, + u16_type_idx] +pub const float_type_idxs = [f32_type_idx, f64_type_idx, float_literal_type_idx] +pub const number_type_idxs = [i8_type_idx, i16_type_idx, int_type_idx, i32_type_idx, i64_type_idx, + u8_type_idx, char_type_idx, u16_type_idx, u32_type_idx, u64_type_idx, isize_type_idx, + usize_type_idx, f32_type_idx, f64_type_idx, int_literal_type_idx, float_literal_type_idx, + rune_type_idx] +pub const pointer_type_idxs = [voidptr_type_idx, byteptr_type_idx, charptr_type_idx, nil_type_idx] -pub const ( - void_type = new_type(void_type_idx) - ovoid_type = new_type(void_type_idx).set_flag(.option) // the return type of `fn ()?` - rvoid_type = new_type(void_type_idx).set_flag(.result) // the return type of `fn () !` - voidptr_type = new_type(voidptr_type_idx) - byteptr_type = new_type(byteptr_type_idx) - charptr_type = new_type(charptr_type_idx) - i8_type = new_type(i8_type_idx) - i16_type = new_type(i16_type_idx) - i32_type = new_type(i32_type_idx) - int_type = new_type(int_type_idx) - i64_type = new_type(i64_type_idx) - isize_type = new_type(isize_type_idx) - u8_type = new_type(u8_type_idx) - u16_type = new_type(u16_type_idx) - u32_type = new_type(u32_type_idx) - u64_type = new_type(u64_type_idx) - usize_type = new_type(usize_type_idx) - f32_type = new_type(f32_type_idx) - f64_type = new_type(f64_type_idx) - char_type = new_type(char_type_idx) - bool_type = new_type(bool_type_idx) - none_type = new_type(none_type_idx) - string_type = new_type(string_type_idx) - rune_type = new_type(rune_type_idx) - array_type = new_type(array_type_idx) - map_type = new_type(map_type_idx) - chan_type = new_type(chan_type_idx) - any_type = new_type(any_type_idx) - float_literal_type = new_type(float_literal_type_idx) - int_literal_type = new_type(int_literal_type_idx) - thread_type = new_type(thread_type_idx) - error_type = new_type(error_type_idx) - charptr_types = new_charptr_types() - byteptr_types = new_byteptr_types() - voidptr_types = new_voidptr_types() - cptr_types = merge_types(voidptr_types, byteptr_types, charptr_types) - nil_type = new_type(nil_type_idx) -) +pub const void_type = new_type(void_type_idx) +pub const ovoid_type = new_type(void_type_idx).set_flag(.option) // the return type of `fn ()?` +pub const rvoid_type = new_type(void_type_idx).set_flag(.result) // the return type of `fn () !` +pub const voidptr_type = new_type(voidptr_type_idx) +pub const byteptr_type = new_type(byteptr_type_idx) +pub const charptr_type = new_type(charptr_type_idx) +pub const i8_type = new_type(i8_type_idx) +pub const i16_type = new_type(i16_type_idx) +pub const i32_type = new_type(i32_type_idx) +pub const int_type = new_type(int_type_idx) +pub const i64_type = new_type(i64_type_idx) +pub const isize_type = new_type(isize_type_idx) +pub const u8_type = new_type(u8_type_idx) +pub const u16_type = new_type(u16_type_idx) +pub const u32_type = new_type(u32_type_idx) +pub const u64_type = new_type(u64_type_idx) +pub const usize_type = new_type(usize_type_idx) +pub const f32_type = new_type(f32_type_idx) +pub const f64_type = new_type(f64_type_idx) +pub const char_type = new_type(char_type_idx) +pub const bool_type = new_type(bool_type_idx) +pub const none_type = new_type(none_type_idx) +pub const string_type = new_type(string_type_idx) +pub const rune_type = new_type(rune_type_idx) +pub const array_type = new_type(array_type_idx) +pub const map_type = new_type(map_type_idx) +pub const chan_type = new_type(chan_type_idx) +pub const any_type = new_type(any_type_idx) +pub const float_literal_type = new_type(float_literal_type_idx) +pub const int_literal_type = new_type(int_literal_type_idx) +pub const thread_type = new_type(thread_type_idx) +pub const error_type = new_type(error_type_idx) +pub const charptr_types = new_charptr_types() +pub const byteptr_types = new_byteptr_types() +pub const voidptr_types = new_voidptr_types() +pub const cptr_types = merge_types(voidptr_types, byteptr_types, charptr_types) +pub const nil_type = new_type(nil_type_idx) fn new_charptr_types() []Type { return [ast.charptr_type, new_type(ast.char_type_idx).set_nr_muls(1)] diff --git a/vlib/v/builder/builder_test.v b/vlib/v/builder/builder_test.v index 913eaa00ad..57a875d206 100644 --- a/vlib/v/builder/builder_test.v +++ b/vlib/v/builder/builder_test.v @@ -2,10 +2,8 @@ module main import os -const ( - vexe = @VEXE - test_path = os.join_path(os.vtmp_dir(), 'run_check') -) +const vexe = @VEXE +const test_path = os.join_path(os.vtmp_dir(), 'run_check') fn testsuite_begin() { os.mkdir_all(test_path) or {} diff --git a/vlib/v/builder/cc.v b/vlib/v/builder/cc.v index 2c6401dfa0..7286ba0dc9 100644 --- a/vlib/v/builder/cc.v +++ b/vlib/v/builder/cc.v @@ -10,12 +10,10 @@ import v.util import v.vcache import term -const ( - c_std = 'c99' - c_std_gnu = 'gnu99' - cpp_std = 'c++17' - cpp_std_gnu = 'gnu++17' -) +const c_std = 'c99' +const c_std_gnu = 'gnu99' +const cpp_std = 'c++17' +const cpp_std_gnu = 'gnu++17' const c_verror_message_marker = 'VERROR_MESSAGE ' diff --git a/vlib/v/builder/msvc_windows.v b/vlib/v/builder/msvc_windows.v index abd3ddaeba..692b35edd7 100644 --- a/vlib/v/builder/msvc_windows.v +++ b/vlib/v/builder/msvc_windows.v @@ -14,12 +14,10 @@ import v.cflag type RegKey = voidptr // Taken from the windows SDK -const ( - hkey_local_machine = RegKey(0x80000002) - key_query_value = (0x0001) - key_wow64_32key = (0x0200) - key_enumerate_sub_keys = (0x0008) -) +const hkey_local_machine = RegKey(0x80000002) +const key_query_value = (0x0001) +const key_wow64_32key = (0x0200) +const key_enumerate_sub_keys = (0x0008) // Given a root key look for one of the subkeys in 'versions' and get the path fn find_windows_kit_internal(key RegKey, versions []string) !string { diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 7cdf77cee1..34e439cc34 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -13,32 +13,29 @@ import v.errors import v.pkgconfig import v.transformer -const ( - int_min = int(0x80000000) - int_max = int(0x7FFFFFFF) - // prevent stack overflows by restricting too deep recursion: - expr_level_cutoff_limit = 40 - stmt_level_cutoff_limit = 40 - iface_level_cutoff_limit = 100 - generic_fn_cutoff_limit_per_fn = 10_000 // how many times post_process_generic_fns, can visit the same function before bailing out - generic_fn_postprocess_iterations_cutoff_limit = 1000_000 // how many times the compiler will try to resolve all remaining generic functions -) +const int_min = int(0x80000000) +const int_max = int(0x7FFFFFFF) +// prevent stack overflows by restricting too deep recursion: +const expr_level_cutoff_limit = 40 +const stmt_level_cutoff_limit = 40 +const iface_level_cutoff_limit = 100 +const generic_fn_cutoff_limit_per_fn = 10_000 // how many times post_process_generic_fns, can visit the same function before bailing out -pub const ( - // array_builtin_methods contains a list of all methods on array, that return other typed arrays, - // i.e. that act as *pseudogeneric* methods, that need compiler support, so that the types of the results - // are properly checked. - // Note that methods that do not return anything, or that return known types, are not listed here, since they are just ordinary non generic methods. - array_builtin_methods = ['filter', 'clone', 'repeat', 'reverse', 'map', 'slice', 'sort', - 'sorted', 'sorted_with_compare', 'contains', 'index', 'wait', 'any', 'all', 'first', 'last', - 'pop', 'delete'] - array_builtin_methods_chk = token.new_keywords_matcher_from_array_trie(array_builtin_methods) - // TODO: remove `byte` from this list when it is no longer supported - reserved_type_names = ['byte', 'bool', 'char', 'i8', 'i16', 'int', 'i64', 'u8', 'u16', - 'u32', 'u64', 'f32', 'f64', 'map', 'string', 'rune', 'usize', 'isize', 'voidptr', 'thread'] - reserved_type_names_chk = token.new_keywords_matcher_from_array_trie(reserved_type_names) - vroot_is_deprecated_message = '@VROOT is deprecated, use @VMODROOT or @VEXEROOT instead' -) +const generic_fn_postprocess_iterations_cutoff_limit = 1000_000 + +// array_builtin_methods contains a list of all methods on array, that return other typed arrays, +// i.e. that act as *pseudogeneric* methods, that need compiler support, so that the types of the results +// are properly checked. +// Note that methods that do not return anything, or that return known types, are not listed here, since they are just ordinary non generic methods. +pub const array_builtin_methods = ['filter', 'clone', 'repeat', 'reverse', 'map', 'slice', 'sort', + 'sorted', 'sorted_with_compare', 'contains', 'index', 'wait', 'any', 'all', 'first', 'last', + 'pop', 'delete'] +pub const array_builtin_methods_chk = token.new_keywords_matcher_from_array_trie(array_builtin_methods) +// TODO: remove `byte` from this list when it is no longer supported +pub const reserved_type_names = ['byte', 'bool', 'char', 'i8', 'i16', 'int', 'i64', 'u8', 'u16', + 'u32', 'u64', 'f32', 'f64', 'map', 'string', 'rune', 'usize', 'isize', 'voidptr', 'thread'] +pub const reserved_type_names_chk = token.new_keywords_matcher_from_array_trie(reserved_type_names) +pub const vroot_is_deprecated_message = '@VROOT is deprecated, use @VMODROOT or @VEXEROOT instead' @[heap; minify] pub struct Checker { diff --git a/vlib/v/doc/utils.v b/vlib/v/doc/utils.v index f824e0ebbd..4ffb24bb6a 100644 --- a/vlib/v/doc/utils.v +++ b/vlib/v/doc/utils.v @@ -4,10 +4,8 @@ import strings import v.ast import v.token -const ( - highlight_keys = ['note:', 'fixme:', 'todo:'] - horizontal_rule_chars = ['-', '=', '*', '_', '~'] -) +const highlight_keys = ['note:', 'fixme:', 'todo:'] +const horizontal_rule_chars = ['-', '=', '*', '_', '~'] // merge_comments merges all the comment contents into a single text. pub fn merge_comments(comments []ast.Comment) string { diff --git a/vlib/v/embed_file/embed_file.v b/vlib/v/embed_file/embed_file.v index 27dae64258..1f578018b5 100644 --- a/vlib/v/embed_file/embed_file.v +++ b/vlib/v/embed_file/embed_file.v @@ -2,9 +2,7 @@ module embed_file import os -pub const ( - is_used = 1 -) +pub const is_used = 1 // EmbedFileData encapsulates functionality for the `$embed_file()` compile time call. pub struct EmbedFileData { diff --git a/vlib/v/eval/gen/infix_gen.v b/vlib/v/eval/gen/infix_gen.v index 29cb174ec1..75c8cdf81d 100644 --- a/vlib/v/eval/gen/infix_gen.v +++ b/vlib/v/eval/gen/infix_gen.v @@ -4,33 +4,33 @@ module main import strings import os -const ( - header = '[generated] +const header = '[generated] module eval import v.token import v.ast fn(e Eval)infix_expr(left Object,right Object,op token.Kind,expecting ast.Type)Object{match op{' - footer = "else{e.error('unknown infix expression: \$op')}}return empty // should e.error before this anyway + +const footer = "else{e.error('unknown infix expression: \$op')}}return empty // should e.error before this anyway } " - uk_expect_footer = "else{e.error('unknown infix expectation: \${e.table.sym(expecting).str()}')}}" - comparison = { - 'gt': '>' - 'lt': '<' - 'eq': '==' - 'ne': '!=' - } - math_ops = { - 'plus': '+' - 'minus': '-' - 'mul': '*' - 'div': '/' - 'right_shift': '>>' - 'left_shift': '<<' - } - compound_types = ['Int', 'Uint', 'Float'] - literal_types = ['i64', 'f64'] -) + +const uk_expect_footer = "else{e.error('unknown infix expectation: \${e.table.sym(expecting).str()}')}}" +const comparison = { + 'gt': '>' + 'lt': '<' + 'eq': '==' + 'ne': '!=' +} +const math_ops = { + 'plus': '+' + 'minus': '-' + 'mul': '*' + 'div': '/' + 'right_shift': '>>' + 'left_shift': '<<' +} +const compound_types = ['Int', 'Uint', 'Float'] +const literal_types = ['i64', 'f64'] fn main() { mut b := strings.new_builder(124000) diff --git a/vlib/v/fmt/comments.v b/vlib/v/fmt/comments.v index effbeca50e..9440d5a935 100644 --- a/vlib/v/fmt/comments.v +++ b/vlib/v/fmt/comments.v @@ -52,7 +52,7 @@ pub fn (mut f Fmt) comment(node ast.Comment, options CommentsOptions) { } out_s += s } - if !is_separate_line && f.indent > 0 { + if !is_separate_line { // && f.indent > 0 { f.remove_new_line() // delete the generated \n f.write(' ') } diff --git a/vlib/v/fmt/fmt.v b/vlib/v/fmt/fmt.v index 1953eabca3..af2a4aa301 100644 --- a/vlib/v/fmt/fmt.v +++ b/vlib/v/fmt/fmt.v @@ -8,11 +8,10 @@ import v.ast import v.util import v.pref -const ( - bs = '\\' - // when to break a line depending on the penalty - max_len = [0, 35, 60, 85, 93, 100] -) +const bs = '\\' + +// when to break a line depending on the penalty +const max_len = [0, 35, 60, 85, 93, 100] @[minify] pub struct Fmt { @@ -891,57 +890,30 @@ mut: } pub fn (mut f Fmt) const_decl(node ast.ConstDecl) { - f.attrs(node.attrs) - if node.is_pub { - f.write('pub ') - } if node.fields.len == 0 && node.pos.line_nr == node.pos.last_line { - f.writeln('const ()\n') + // remove "const()" return } + + f.attrs(node.attrs) + if !node.is_block { + if node.is_pub { + f.write('pub ') + } + } f.inside_const = true defer { f.inside_const = false } - f.write('const ') - mut align_infos := []ValAlignInfo{} - if node.is_block { - f.writeln('(') - mut info := ValAlignInfo{} - for i, field in node.fields { - if field.name.len > info.max { - info.max = field.name.len - } - if !expr_is_single_line(field.expr) { - is_ternary := field.expr is ast.IfExpr && field.expr.branches.len == 2 - && field.expr.has_else - && branch_is_single_line((field.expr as ast.IfExpr).branches[0]) - && branch_is_single_line((field.expr as ast.IfExpr).branches[1]) - && (field.expr.is_expr || f.is_assign || f.inside_const - || f.is_struct_init || f.single_line_fields) - if !is_ternary || field.name.len + field.expr.str().len > fmt.max_len.last() { - info.last_idx = i - align_infos << info - info = ValAlignInfo{} - } - } - } - info.last_idx = node.fields.len - align_infos << info - f.indent++ - } else { - align_infos << ValAlignInfo{0, 1} + if !node.is_block { + f.write('const ') } mut prev_field := if node.fields.len > 0 { ast.Node(node.fields[0]) } else { ast.Node(ast.NodeError{}) } - mut align_idx := 0 - for i, field in node.fields { - if i > align_infos[align_idx].last_idx { - align_idx++ - } + for _, field in node.fields { if field.comments.len > 0 { if f.should_insert_newline_before_node(ast.Expr(field.comments[0]), prev_field) { f.writeln('') @@ -953,8 +925,14 @@ pub fn (mut f Fmt) const_decl(node ast.ConstDecl) { f.writeln('') } name := field.name.after('.') + if node.is_block { + // const() blocks are deprecated, prepend "const" before each value + if node.is_pub { + f.write('pub ') + } + f.write('const ') + } f.write('${name} ') - f.write(strings.repeat(` `, align_infos[align_idx].max - field.name.len)) f.write('= ') f.expr(field.expr) f.comments(field.end_comments, same_line: true) @@ -971,18 +949,7 @@ pub fn (mut f Fmt) const_decl(node ast.ConstDecl) { prev_field = field } - if node.is_block { - f.comments_after_last_field(node.end_comments) - } else if node.end_comments.len == 0 { - // If no single line comments after the const expr is present - f.writeln('') - } - if node.is_block { - f.indent-- - f.writeln(')\n') - } else { - f.writeln('') - } + f.writeln('') } pub fn (mut f Fmt) defer_stmt(node ast.DeferStmt) { diff --git a/vlib/v/fmt/fmt_keep_test.v b/vlib/v/fmt/fmt_keep_test.v index ef6d7ec217..e5f73d7b60 100644 --- a/vlib/v/fmt/fmt_keep_test.v +++ b/vlib/v/fmt/fmt_keep_test.v @@ -11,15 +11,13 @@ import v.pref import v.util.diff import v.util.vtest -const ( - error_missing_vexe = 1 - error_failed_tests = 2 - b2v_keep_path = os.join_path('vlib', 'v', 'fmt', 'tests', 'bin2v_keep.vv') - fpref = &pref.Preferences{ - is_fmt: true - } - vexe = os.getenv('VEXE') -) +const error_missing_vexe = 1 +const error_failed_tests = 2 +const b2v_keep_path = os.join_path('vlib', 'v', 'fmt', 'tests', 'bin2v_keep.vv') +const fpref = &pref.Preferences{ + is_fmt: true +} +const vexe = os.getenv('VEXE') fn test_fmt() { fmt_message := 'checking that v fmt keeps already formatted files *unchanged*' diff --git a/vlib/v/fmt/fmt_test.v b/vlib/v/fmt/fmt_test.v index 116c8771f9..bc222fe8ed 100644 --- a/vlib/v/fmt/fmt_test.v +++ b/vlib/v/fmt/fmt_test.v @@ -10,13 +10,11 @@ import v.parser import v.pref import v.util.diff -const ( - error_missing_vexe = 1 - error_failed_tests = 2 - fpref = &pref.Preferences{ - is_fmt: true - } -) +const error_missing_vexe = 1 +const error_failed_tests = 2 +const fpref = &pref.Preferences{ + is_fmt: true +} fn test_fmt() { fmt_message := 'vfmt tests' diff --git a/vlib/v/fmt/fmt_vlib_test.v b/vlib/v/fmt/fmt_vlib_test.v index e77dd02118..2ad562753c 100644 --- a/vlib/v/fmt/fmt_vlib_test.v +++ b/vlib/v/fmt/fmt_vlib_test.v @@ -10,13 +10,11 @@ import v.parser import v.pref import v.util.diff -const ( - error_missing_vexe = 1 - error_failed_tests = 2 - fpref = &pref.Preferences{ - is_fmt: true - } -) +const error_missing_vexe = 1 +const error_failed_tests = 2 +const fpref = &pref.Preferences{ + is_fmt: true +} fn test_vlib_fmt() { $if !vfmt_everything ? { diff --git a/vlib/v/fmt/tests/array_init_comment_ending_keep.vv b/vlib/v/fmt/tests/array_init_comment_ending_keep.vv index d4f3dd1dd4..3accfcf936 100644 --- a/vlib/v/fmt/tests/array_init_comment_ending_keep.vv +++ b/vlib/v/fmt/tests/array_init_comment_ending_keep.vv @@ -1,21 +1,19 @@ import net.http -const ( - write_set_cookie_tests = [ - ReadSetCookiesTestCase{ - header: { - 'Set-Cookie': ['special-7=","'] - } - cookies: [&http.Cookie{ - name: 'special-7' - value: ',' - raw: 'special-8=","' - }] - }, - // (bradfitz): users have reported seeing this in the - // wild, but do browsers handle it? RFC 6265 just says "don't - // do that" (section 3) and then never mentions header folding - // again. - // Header{"Set-Cookie": ["ASP.NET_SessionId=foo; path=/; HttpOnly, .ASPXAUTH=7E3AA; expires=Wed, 07-Mar-2012 14:25:06 GMT; path=/; HttpOnly"]}, - ] -) +const write_set_cookie_tests = [ + ReadSetCookiesTestCase{ + header: { + 'Set-Cookie': ['special-7=","'] + } + cookies: [&http.Cookie{ + name: 'special-7' + value: ',' + raw: 'special-8=","' + }] + }, + // (bradfitz): users have reported seeing this in the + // wild, but do browsers handle it? RFC 6265 just says "don't + // do that" (section 3) and then never mentions header folding + // again. + // Header{"Set-Cookie": ["ASP.NET_SessionId=foo; path=/; HttpOnly, .ASPXAUTH=7E3AA; expires=Wed, 07-Mar-2012 14:25:06 GMT; path=/; HttpOnly"]}, +] diff --git a/vlib/v/fmt/tests/chan_ops_keep.vv b/vlib/v/fmt/tests/chan_ops_keep.vv index ef045228bd..87ccf7f6fe 100644 --- a/vlib/v/fmt/tests/chan_ops_keep.vv +++ b/vlib/v/fmt/tests/chan_ops_keep.vv @@ -1,8 +1,6 @@ import sync -const ( - num_iterations = 10000 -) +const num_iterations = 10000 struct St { a int diff --git a/vlib/v/fmt/tests/consts_expected.vv b/vlib/v/fmt/tests/consts_expected.vv index b97e49df67..a28d6f45d1 100644 --- a/vlib/v/fmt/tests/consts_expected.vv +++ b/vlib/v/fmt/tests/consts_expected.vv @@ -1,35 +1,29 @@ -const ( - // pi - // pi - pi = 3.14 - // phi - // phi - // phi - phi = 1.618 - // Euler's constant - eulers = 2.7182 - supported_platforms = ['windows', 'macos', 'linux', 'freebsd', 'openbsd', 'netbsd', 'dragonfly', - 'android', 'js', 'solaris', 'haiku'] - one_line_supported = ['windows', 'macos', 'linux', 'freebsd', 'openbsd', 'netbsd', 'dragonfly', - 'android', 'js', 'solaris', 'haiku'] - another_const = ['a', 'b', 'c', 'd', 'e', 'f'] - multiline_const = [ - 'first line', - 'second line', - 'third line', - 'fourth line', - ] -) +// pi +// pi +const pi = 3.14 +// phi +// phi +// phi +const phi = 1.618 +// Euler's constant +const eulers = 2.7182 +const supported_platforms = ['windows', 'macos', 'linux', 'freebsd', 'openbsd', 'netbsd', 'dragonfly', + 'android', 'js', 'solaris', 'haiku'] +const one_line_supported = ['windows', 'macos', 'linux', 'freebsd', 'openbsd', 'netbsd', 'dragonfly', + 'android', 'js', 'solaris', 'haiku'] +const another_const = ['a', 'b', 'c', 'd', 'e', 'f'] +const multiline_const = [ + 'first line', + 'second line', + 'third line', + 'fourth line', +] -const ( - i_am_a_very_long_constant_name_so_i_stand_alone_and_my_length_is_over_90_characters = [ - 'testforit', - ] -) +const i_am_a_very_long_constant_name_so_i_stand_alone_and_my_length_is_over_90_characters = [ + 'testforit', +] -pub const ( - i_am_pub_const = true -) +pub const i_am_pub_const = true fn main() { a := [ diff --git a/vlib/v/fmt/tests/consts_keep.vv b/vlib/v/fmt/tests/consts_keep.vv index c505ad7da6..d7e72a2fbd 100644 --- a/vlib/v/fmt/tests/consts_keep.vv +++ b/vlib/v/fmt/tests/consts_keep.vv @@ -1,27 +1,22 @@ const font = $embed_file('../assets/fonts/RobotoMono-Regular.ttf') -const ( - test_alignment = 123 - foo = Foo{ - f: 'foo' - } - spam = 456 - egg = 'lorem ipsum' - spameggs = true -) +const test_alignment = 123 +const foo = Foo{ + f: 'foo' +} +const spam = 456 +const egg = 'lorem ipsum' +const spameggs = true -const ( - bar = 'A string +const bar = 'A string spanning multiple lines' - baz = 'short' - some_long_name = MyStruct{ - x: 42 - } -) -const ( - a = 123 - abc = 123 - b = 123 -) +const baz = 'short' +const some_long_name = MyStruct{ + x: 42 +} + +const a = 123 +const abc = 123 +const b = 123 diff --git a/vlib/v/fmt/tests/consts_with_comments_keep.vv b/vlib/v/fmt/tests/consts_with_comments_keep.vv index aed4eec418..a716ea24b4 100644 --- a/vlib/v/fmt/tests/consts_with_comments_keep.vv +++ b/vlib/v/fmt/tests/consts_with_comments_keep.vv @@ -1,7 +1,6 @@ -const ( - fsm_state_array = ['init', 'state_a', 'state_b', 'state_c', 'exit'] // use as a first half key for map see fsm_state_ev_fn, the same order as in enum FSM_state - fsm_event_array = ['ev1', 'ev2', 'ev3', 'ev4', 'ev5'] // use as a second half key for map see fsm_state_ev_fn, the same order as in enum FSM_event -) +const fsm_state_array = ['init', 'state_a', 'state_b', 'state_c', 'exit'] // use as a first half key for map see fsm_state_ev_fn, the same order as in enum FSM_state + +const fsm_event_array = ['ev1', 'ev2', 'ev3', 'ev4', 'ev5'] // use as a second half key for map see fsm_state_ev_fn, the same order as in enum FSM_event // Keep const one = 1 // Keep diff --git a/vlib/v/fmt/tests/consts_with_embedded_comments_expected.vv b/vlib/v/fmt/tests/consts_with_embedded_comments_expected.vv index 65c3282a72..2604679381 100644 --- a/vlib/v/fmt/tests/consts_with_embedded_comments_expected.vv +++ b/vlib/v/fmt/tests/consts_with_embedded_comments_expected.vv @@ -1,7 +1,5 @@ import gx -const ( - color = gx.rgb(50, 90, 110) // gx.rgb(167,236,82) -) +const color = gx.rgb(50, 90, 110) // gx.rgb(167,236,82) fn main() {} diff --git a/vlib/v/fmt/tests/consts_with_or_block_keep.vv b/vlib/v/fmt/tests/consts_with_or_block_keep.vv index 9327c47a0b..3240c632bd 100644 --- a/vlib/v/fmt/tests/consts_with_or_block_keep.vv +++ b/vlib/v/fmt/tests/consts_with_or_block_keep.vv @@ -1,13 +1,11 @@ import os -const ( - exe = os.find_abs_path_of_executable('my_exe') or { - eprintln('skipping test, since `my_exe` is missing') - exit(0) - } - exe_quoted = os.quoted_path(os.find_abs_path_of_executable('my_exe') or { - eprintln('skipping test, since `my_exe` is missing') - exit(0) - }) - single_line_test_path = os.join_path(os.vtmp_dir(), 'my_test_path') -) +const exe = os.find_abs_path_of_executable('my_exe') or { + eprintln('skipping test, since `my_exe` is missing') + exit(0) +} +const exe_quoted = os.quoted_path(os.find_abs_path_of_executable('my_exe') or { + eprintln('skipping test, since `my_exe` is missing') + exit(0) +}) +const single_line_test_path = os.join_path(os.vtmp_dir(), 'my_test_path') diff --git a/vlib/v/fmt/tests/do_not_change_type_names_that_just_happen_to_have_the_module_as_a_substring_keep.vv b/vlib/v/fmt/tests/do_not_change_type_names_that_just_happen_to_have_the_module_as_a_substring_keep.vv index 8f6103dd8b..ea7a1054fd 100644 --- a/vlib/v/fmt/tests/do_not_change_type_names_that_just_happen_to_have_the_module_as_a_substring_keep.vv +++ b/vlib/v/fmt/tests/do_not_change_type_names_that_just_happen_to_have_the_module_as_a_substring_keep.vv @@ -47,14 +47,12 @@ pub struct DecompressParams { verify_checksum bool = true } -pub const ( - reserved_bits = 0b1110_0000 - ftext = 0b0000_0001 - fextra = 0b0000_0100 - fname = 0b0000_1000 - fcomment = 0b0001_0000 - fhcrc = 0b0000_0010 -) +pub const reserved_bits = 0b1110_0000 +pub const ftext = 0b0000_0001 +pub const fextra = 0b0000_0100 +pub const fname = 0b0000_1000 +pub const fcomment = 0b0001_0000 +pub const fhcrc = 0b0000_0010 const min_header_length = 18 diff --git a/vlib/v/fmt/tests/empty_curlies_and_parens_keep.vv b/vlib/v/fmt/tests/empty_curlies_and_parens_keep.vv index 30e4420672..aedafe412e 100644 --- a/vlib/v/fmt/tests/empty_curlies_and_parens_keep.vv +++ b/vlib/v/fmt/tests/empty_curlies_and_parens_keep.vv @@ -1,8 +1,3 @@ -const () - -const ( -) - struct Bar {} struct Bar2 { diff --git a/vlib/v/fmt/tests/empty_lines_keep.vv b/vlib/v/fmt/tests/empty_lines_keep.vv index d62ca129ef..af26e03440 100644 --- a/vlib/v/fmt/tests/empty_lines_keep.vv +++ b/vlib/v/fmt/tests/empty_lines_keep.vv @@ -5,27 +5,25 @@ type Node2 = Expr | string type MyInt = int // Keep empty lines in const blocks -const ( - _ = SomeStruct{ - val: 'Multiline field exprs should cause no problems' - } - _ = 1 +const _ = SomeStruct{ + val: 'Multiline field exprs should cause no problems' +} +const _ = 1 - _ = 'Keep this empty line before' - // Comment before a field - _ = 2 +const _ = 'Keep this empty line before' +// Comment before a field +const _ = 2 - // The empty line above should stay too - _ = 3 +// The empty line above should stay too +const _ = 3 - // This comment doesn't really belong anywhere +// This comment doesn't really belong anywhere - _ = 'A multiline string with a StringInterLiteral... +const _ = 'A multiline string with a StringInterLiteral... ${foo} ...and the ending brace on a newline had a wrong pos.last_line. ' - _ = 4 -) +const _ = 4 fn keep_single_empty_line() { println('a') diff --git a/vlib/v/fmt/tests/if_ternary_expected.vv b/vlib/v/fmt/tests/if_ternary_expected.vv index 769434b255..1f08ea4e57 100644 --- a/vlib/v/fmt/tests/if_ternary_expected.vv +++ b/vlib/v/fmt/tests/if_ternary_expected.vv @@ -1,25 +1,21 @@ -const ( - spacing_error = if true { true } else { false } - // Multiline result should not align with the next multiline result. - too_long_line = if b.no_cstep { - 'TMP1/${b.nexpected_steps:1d}' - } else { - '${b.cstep:1d}/${b.nexpected_steps:1d}' - } - too_many_branches = if true { - true - } else if true { - true - } else { - false - } -) +const spacing_error = if true { true } else { false } +// Multiline result should not align with the next multiline result. +const too_long_line = if b.no_cstep { + 'TMP1/${b.nexpected_steps:1d}' +} else { + '${b.cstep:1d}/${b.nexpected_steps:1d}' +} +const too_many_branches = if true { + true +} else if true { + true +} else { + false +} -const ( - align = if true { 'a' } else { 'b' } - some_longer_variable = 'foo' - another_var = 'bar' -) +const align = if true { 'a' } else { 'b' } +const some_longer_variable = 'foo' +const another_var = 'bar' fn main() { // This line is too long diff --git a/vlib/v/fmt/tests/import_duplicate_expected.vv b/vlib/v/fmt/tests/import_duplicate_expected.vv index 5769710c0f..3d93a303e9 100644 --- a/vlib/v/fmt/tests/import_duplicate_expected.vv +++ b/vlib/v/fmt/tests/import_duplicate_expected.vv @@ -1,9 +1,7 @@ import math import os -const ( - mypi = math.pi -) +const mypi = math.pi fn main() { println(os.path_separator) diff --git a/vlib/v/fmt/tests/import_duplicate_input.vv b/vlib/v/fmt/tests/import_duplicate_input.vv index 0c11afe4a2..1d26de88cd 100644 --- a/vlib/v/fmt/tests/import_duplicate_input.vv +++ b/vlib/v/fmt/tests/import_duplicate_input.vv @@ -2,9 +2,7 @@ import math import os import math -const ( - mypi = math.pi -) +const mypi = math.pi fn main() { println(os.path_separator) diff --git a/vlib/v/fmt/tests/maps_expected.vv b/vlib/v/fmt/tests/maps_expected.vv index 4d939fd839..78450b5f55 100644 --- a/vlib/v/fmt/tests/maps_expected.vv +++ b/vlib/v/fmt/tests/maps_expected.vv @@ -1,12 +1,10 @@ -const ( - reserved_types = { - 'i8': true - 'i16': true - 'int': true - 'i64': true - 'i128': true - } -) +const reserved_types = { + 'i8': true + 'i16': true + 'int': true + 'i64': true + 'i128': true +} numbers := { 'one': 1 diff --git a/vlib/v/fmt/tests/shared_expected.vv b/vlib/v/fmt/tests/shared_expected.vv index 23332f078b..af966efb79 100644 --- a/vlib/v/fmt/tests/shared_expected.vv +++ b/vlib/v/fmt/tests/shared_expected.vv @@ -45,11 +45,9 @@ fn k() { println(v) } -const ( - reads_per_thread = 30 - read_threads = 10 - writes = 5 -) +const reads_per_thread = 30 +const read_threads = 10 +const writes = 5 fn test_shared_lock() { // object with separate read/write lock diff --git a/vlib/v/fmt/tests/symbol_registration_keep.vv b/vlib/v/fmt/tests/symbol_registration_keep.vv index c9fdb5d828..fc1df248ff 100644 --- a/vlib/v/fmt/tests/symbol_registration_keep.vv +++ b/vlib/v/fmt/tests/symbol_registration_keep.vv @@ -2,12 +2,10 @@ module analyzer import os -const ( - mut_struct_keyword = 'mut:' - pub_struct_keyword = 'pub:' - pub_mut_struct_keyword = 'pub mut:' - global_struct_keyword = '__global:' -) +const mut_struct_keyword = 'mut:' +const pub_struct_keyword = 'pub:' +const pub_mut_struct_keyword = 'pub mut:' +const global_struct_keyword = '__global:' struct SymbolRegistration { mut: diff --git a/vlib/v/fmt/tests/type_ptr_keep.vv b/vlib/v/fmt/tests/type_ptr_keep.vv index 338b54e26e..aad14ecbb2 100644 --- a/vlib/v/fmt/tests/type_ptr_keep.vv +++ b/vlib/v/fmt/tests/type_ptr_keep.vv @@ -1,9 +1,7 @@ -const ( - x = &Test{} - y = []&Test{} - xx = &&Test{} - yy = []&&Test{} -) +const x = &Test{} +const y = []&Test{} +const xx = &&Test{} +const yy = []&&Test{} fn test_type_ptr() { _ := &Test{} diff --git a/vlib/v/gen/c/auto_str_methods.v b/vlib/v/gen/c/auto_str_methods.v index 97868bffca..de09f3c9c4 100644 --- a/vlib/v/gen/c/auto_str_methods.v +++ b/vlib/v/gen/c/auto_str_methods.v @@ -6,11 +6,9 @@ import v.ast import v.util import strings -const ( - // BUG: this const is not released from the memory! use a const for now - // si_s_code = "0x" + int(StrIntpType.si_s).hex() // code for a simple string - si_s_code = '0xfe10' -) +// BUG: this const is not released from the memory! use a const for now +// si_s_code = "0x" + int(StrIntpType.si_s).hex() // code for a simple string +const si_s_code = '0xfe10' fn (mut g Gen) gen_str_default(sym ast.TypeSymbol, styp string, str_fn_name string) { $if trace_autostr ? { diff --git a/vlib/v/gen/c/cgen.v b/vlib/v/gen/c/cgen.v index e8fb813e56..4c24d71c63 100644 --- a/vlib/v/gen/c/cgen.v +++ b/vlib/v/gen/c/cgen.v @@ -14,26 +14,24 @@ import v.util.version import v.depgraph import sync.pool -const ( - // Note: some of the words in c_reserved, are not reserved in C, but are - // in C++, or have special meaning in V, thus need escaping too. `small` - // should not be needed, but see: - // https://stackoverflow.com/questions/5874215/what-is-rpcndr-h - c_reserved = ['array', 'auto', 'bool', 'break', 'calloc', 'case', 'char', 'class', 'complex', - 'const', 'continue', 'default', 'delete', 'do', 'double', 'else', 'enum', 'error', 'exit', - 'export', 'extern', 'false', 'float', 'for', 'free', 'goto', 'if', 'inline', 'int', 'link', - 'long', 'malloc', 'namespace', 'new', 'nil', 'panic', 'register', 'restrict', 'return', - 'short', 'signed', 'sizeof', 'static', 'string', 'struct', 'switch', 'typedef', 'typename', - 'union', 'unix', 'unsigned', 'void', 'volatile', 'while', 'template', 'true', 'small', - 'stdout', 'stdin', 'stderr', 'far', 'near', 'huge', 'requires'] - c_reserved_chk = token.new_keywords_matcher_from_array_trie(c_reserved) - // same order as in token.Kind - cmp_str = ['eq', 'ne', 'gt', 'lt', 'ge', 'le'] - // when operands are switched - cmp_rev = ['eq', 'ne', 'lt', 'gt', 'le', 'ge'] - result_name = '_result' - option_name = '_option' -) +// Note: some of the words in c_reserved, are not reserved in C, but are +// in C++, or have special meaning in V, thus need escaping too. `small` +// should not be needed, but see: +// https://stackoverflow.com/questions/5874215/what-is-rpcndr-h +const c_reserved = ['array', 'auto', 'bool', 'break', 'calloc', 'case', 'char', 'class', 'complex', + 'const', 'continue', 'default', 'delete', 'do', 'double', 'else', 'enum', 'error', 'exit', + 'export', 'extern', 'false', 'float', 'for', 'free', 'goto', 'if', 'inline', 'int', 'link', + 'long', 'malloc', 'namespace', 'new', 'nil', 'panic', 'register', 'restrict', 'return', 'short', + 'signed', 'sizeof', 'static', 'string', 'struct', 'switch', 'typedef', 'typename', 'union', + 'unix', 'unsigned', 'void', 'volatile', 'while', 'template', 'true', 'small', 'stdout', 'stdin', + 'stderr', 'far', 'near', 'huge', 'requires'] +const c_reserved_chk = token.new_keywords_matcher_from_array_trie(c_reserved) +// same order as in token.Kind +const cmp_str = ['eq', 'ne', 'gt', 'lt', 'ge', 'le'] +// when operands are switched +const cmp_rev = ['eq', 'ne', 'lt', 'gt', 'le', 'ge'] +const result_name = '_result' +const option_name = '_option' fn string_array_to_map(a []string) map[string]bool { mut res := map[string]bool{} @@ -5938,9 +5936,7 @@ fn (mut g Gen) write_init_function() { } } -const ( - builtins = ['string', 'array', 'DenseArray', 'map', 'Error', 'IError', option_name, result_name] -) +const builtins = ['string', 'array', 'DenseArray', 'map', 'Error', 'IError', option_name, result_name] fn (mut g Gen) write_builtin_types() { if g.pref.no_builtin { diff --git a/vlib/v/gen/c/live.v b/vlib/v/gen/c/live.v index c93de15a5e..e570fe1256 100644 --- a/vlib/v/gen/c/live.v +++ b/vlib/v/gen/c/live.v @@ -54,18 +54,17 @@ fn (mut g Gen) generate_hotcode_reloader_code() { } } -const ( - posix_hotcode_definitions_1 = ' +const posix_hotcode_definitions_1 = ' void v_bind_live_symbols(void* live_lib){ @LOAD_FNS@ } ' - windows_hotcode_definitions_1 = ' + +const windows_hotcode_definitions_1 = ' void v_bind_live_symbols(void* live_lib){ @LOAD_FNS@ } ' -) fn (mut g Gen) generate_hotcode_reloading_main_caller() { if !g.pref.is_livemain { diff --git a/vlib/v/gen/js/array.v b/vlib/v/gen/js/array.v index b40e7feee4..9795383647 100644 --- a/vlib/v/gen/js/array.v +++ b/vlib/v/gen/js/array.v @@ -3,15 +3,13 @@ module js import v.ast import strings -const ( - special_array_methods = [ - 'sort', - 'insert', - 'prepend', - 'index', - 'contains', - ] -) +const special_array_methods = [ + 'sort', + 'insert', + 'prepend', + 'index', + 'contains', +] fn (mut g JsGen) gen_array_index_method(left_type ast.Type) string { unwrap_left_type := g.unwrap_generic(left_type) diff --git a/vlib/v/gen/js/auto_str_methods.v b/vlib/v/gen/js/auto_str_methods.v index ee44b53d85..0255d5fdd0 100644 --- a/vlib/v/gen/js/auto_str_methods.v +++ b/vlib/v/gen/js/auto_str_methods.v @@ -176,11 +176,9 @@ pub fn data_str(x StrIntpType) string { } } -const ( - // BUG: this const is not released from the memory! use a const for now - // si_s_code = "0x" + int(StrIntpType.si_s).hex() // code for a simple string - si_s_code = '0xfe10' -) +// BUG: this const is not released from the memory! use a const for now +// si_s_code = "0x" + int(StrIntpType.si_s).hex() // code for a simple string +const si_s_code = '0xfe10' fn should_use_indent_func(kind ast.Kind) bool { return kind in [.struct_, .alias, .array, .array_fixed, .map, .sum_type, .interface_] diff --git a/vlib/v/gen/js/js.v b/vlib/v/gen/js/js.v index c618670add..f8747c0c94 100644 --- a/vlib/v/gen/js/js.v +++ b/vlib/v/gen/js/js.v @@ -9,21 +9,19 @@ import v.depgraph import encoding.base64 import v.gen.js.sourcemap -const ( - // https://ecma-international.org/ecma-262/#sec-reserved-words - js_reserved = ['await', 'break', 'case', 'catch', 'class', 'const', 'continue', 'debugger', - 'default', 'delete', 'do', 'else', 'enum', 'export', 'extends', 'finally', 'for', 'function', - 'if', 'implements', 'import', 'in', 'instanceof', 'interface', 'let', 'new', 'package', - 'private', 'protected', 'public', 'return', 'static', 'super', 'switch', 'this', 'throw', - 'try', 'typeof', 'var', 'void', 'while', 'with', 'yield', 'Number', 'String', 'Boolean', - 'Array', 'Map', 'document', 'Promise'] - // used to generate type structs - v_types = ['i8', 'i16', 'int', 'i64', 'u8', 'u16', 'u32', 'u64', 'f32', 'f64', - 'int_literal', 'float_literal', 'bool', 'string', 'map', 'array', 'rune', 'any', 'voidptr'] - shallow_equatables = [ast.Kind.i8, .i16, .int, .i64, .u8, .u16, .u32, .u64, .f32, .f64, - .int_literal, .float_literal, .bool, .string] - option_name = '_option' -) +// https://ecma-international.org/ecma-262/#sec-reserved-words +const js_reserved = ['await', 'break', 'case', 'catch', 'class', 'const', 'continue', 'debugger', + 'default', 'delete', 'do', 'else', 'enum', 'export', 'extends', 'finally', 'for', 'function', + 'if', 'implements', 'import', 'in', 'instanceof', 'interface', 'let', 'new', 'package', 'private', + 'protected', 'public', 'return', 'static', 'super', 'switch', 'this', 'throw', 'try', 'typeof', + 'var', 'void', 'while', 'with', 'yield', 'Number', 'String', 'Boolean', 'Array', 'Map', + 'document', 'Promise'] +// used to generate type structs +const v_types = ['i8', 'i16', 'int', 'i64', 'u8', 'u16', 'u32', 'u64', 'f32', 'f64', 'int_literal', + 'float_literal', 'bool', 'string', 'map', 'array', 'rune', 'any', 'voidptr'] +const shallow_equatables = [ast.Kind.i8, .i16, .int, .i64, .u8, .u16, .u32, .u64, .f32, .f64, + .int_literal, .float_literal, .bool, .string] +const option_name = '_option' struct SourcemapHelper { src_path string diff --git a/vlib/v/gen/js/jsgen_test.v b/vlib/v/gen/js/jsgen_test.v index cd1ece548f..d5ddf10cf6 100644 --- a/vlib/v/gen/js/jsgen_test.v +++ b/vlib/v/gen/js/jsgen_test.v @@ -1,11 +1,9 @@ import os -const ( - test_dir = os.join_path('vlib', 'v', 'gen', 'js', 'tests') - output_dir = os.join_path(os.vtmp_dir(), '_js_tests/') - v_options = '-b js -w' - node_options = '' -) +const test_dir = os.join_path('vlib', 'v', 'gen', 'js', 'tests') +const output_dir = os.join_path(os.vtmp_dir(), '_js_tests/') +const v_options = '-b js -w' +const node_options = '' fn testsuite_end() { os.rmdir_all(output_dir) or {} diff --git a/vlib/v/gen/js/sourcemap/source_map.v b/vlib/v/gen/js/sourcemap/source_map.v index 4e0da1a1da..b5f465f82c 100644 --- a/vlib/v/gen/js/sourcemap/source_map.v +++ b/vlib/v/gen/js/sourcemap/source_map.v @@ -4,9 +4,7 @@ import io import os import x.json2 -const ( - source_map_version = 3 -) +const source_map_version = 3 type SourceMapJson = map[string]json2.Any diff --git a/vlib/v/gen/js/sourcemap/vlq/vlq.v b/vlib/v/gen/js/sourcemap/vlq/vlq.v index e26aa54708..0831297ddf 100644 --- a/vlib/v/gen/js/sourcemap/vlq/vlq.v +++ b/vlib/v/gen/js/sourcemap/vlq/vlq.v @@ -2,29 +2,27 @@ module vlq import io -const ( - shift = u8(5) - mask = u8((1 << shift) - 1) - continued = u8(1 << shift) - max_i64 = u64(9223372036854775807) +const shift = u8(5) +const mask = u8((1 << shift) - 1) +const continued = u8(1 << shift) +const max_i64 = u64(9223372036854775807) - // index start is: byte - vlq.enc_char_special_plus - enc_index = [62, 0, 0, 0, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 0, 0, 0, 0, 0, 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51]! +// index start is: byte - vlq.enc_char_special_plus +const enc_index = [62, 0, 0, 0, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 0, 0, 0, 0, 0, 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51]! - enc_table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' +const enc_table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' - enc_char_start_au = 65 - enc_char_end_zu = 90 - enc_char_start_al = 97 - enc_char_end_zl = 122 - enc_char_start_zero = 48 - enc_char_end_nine = 57 - enc_char_special_plus = 43 - enc_char_special_slash = 47 -) +const enc_char_start_au = 65 +const enc_char_end_zu = 90 +const enc_char_start_al = 97 +const enc_char_end_zl = 122 +const enc_char_start_zero = 48 +const enc_char_end_nine = 57 +const enc_char_special_plus = 43 +const enc_char_special_slash = 47 @[inline] fn abs64(x i64) u64 { diff --git a/vlib/v/gen/js/temp_fast_deep_equal.v b/vlib/v/gen/js/temp_fast_deep_equal.v index a0566b97cb..7d678f9631 100644 --- a/vlib/v/gen/js/temp_fast_deep_equal.v +++ b/vlib/v/gen/js/temp_fast_deep_equal.v @@ -1,8 +1,7 @@ module js // TODO: Fix msvc bug that's preventing $embed_file('fast_deep_equal.js') -const ( - fast_deep_eq_fn = "// https://www.npmjs.com/package/fast-deep-equal - 3/3/2021 +const fast_deep_eq_fn = "// https://www.npmjs.com/package/fast-deep-equal - 3/3/2021 const envHasBigInt64Array = typeof BigInt64Array !== 'undefined'; function vEq(a, b) { if (a === b) return true; @@ -89,4 +88,3 @@ return 0; } " -) diff --git a/vlib/v/gen/js/tests/hello/hello.v b/vlib/v/gen/js/tests/hello/hello.v index 356cf399cb..304c46d218 100644 --- a/vlib/v/gen/js/tests/hello/hello.v +++ b/vlib/v/gen/js/tests/hello/hello.v @@ -2,9 +2,7 @@ module hello import v.gen.js.tests.hello.hello1 -pub const ( - hello = 'Hello' -) +pub const hello = 'Hello' pub struct Aaa { pub mut: diff --git a/vlib/v/gen/js/tests/js.v b/vlib/v/gen/js/tests/js.v index 4cc43d02f6..7e966780cf 100644 --- a/vlib/v/gen/js/tests/js.v +++ b/vlib/v/gen/js/tests/js.v @@ -1,10 +1,8 @@ import v.gen.js.tests.hello as hl import v.gen.js.tests.hello.hello1 as hl1 -const ( - i_am_a_const = 21214 - super = 'amazing keyword' -) +const i_am_a_const = 21214 +const super = 'amazing keyword' struct Foo { mut: diff --git a/vlib/v/gen/js/tests/life.v b/vlib/v/gen/js/tests/life.v index a89da5aeb3..3dd42d9a99 100644 --- a/vlib/v/gen/js/tests/life.v +++ b/vlib/v/gen/js/tests/life.v @@ -2,10 +2,8 @@ fn clear() { JS.console.clear() } -const ( - w = 30 - h = 30 -) +const w = 30 +const h = 30 fn get(game [][]bool, x int, y int) bool { if y < 0 || x < 0 { diff --git a/vlib/v/gen/native/amd64.v b/vlib/v/gen/native/amd64.v index 3154f184de..9bd84f1df7 100644 --- a/vlib/v/gen/native/amd64.v +++ b/vlib/v/gen/native/amd64.v @@ -88,17 +88,15 @@ struct Amd64RegisterOption { ssereg Amd64SSERegister = Amd64SSERegister.xmm0 } -const ( - amd64_system_v_call_regs = [Amd64Register.rdi, .rsi, .rdx, .rcx, .r8, .r9] - amd64_system_v_call_sseregs = [Amd64SSERegister.xmm0, .xmm1, .xmm2, .xmm3, .xmm4, .xmm5, .xmm6, - .xmm7] +const amd64_system_v_call_regs = [Amd64Register.rdi, .rsi, .rdx, .rcx, .r8, .r9] +const amd64_system_v_call_sseregs = [Amd64SSERegister.xmm0, .xmm1, .xmm2, .xmm3, .xmm4, .xmm5, + .xmm6, .xmm7] - // reference: https://learn.microsoft.com/en-us/cpp/build/x64-calling-convention?view=msvc-170#parameter-passing - amd64_windows_call_regs = [Amd64Register.rcx, .rdx, .r8, .r9] - amd64_windows_call_sseregs = [Amd64SSERegister.xmm0, .xmm1, .xmm2, .xmm3] +// reference: https://learn.microsoft.com/en-us/cpp/build/x64-calling-convention?view=msvc-170#parameter-passing +const amd64_windows_call_regs = [Amd64Register.rcx, .rdx, .r8, .r9] +const amd64_windows_call_sseregs = [Amd64SSERegister.xmm0, .xmm1, .xmm2, .xmm3] - amd64_cpuregs = ['eax', 'ecx', 'edx', 'ebx', 'esp', 'ebp', 'esi', 'edi'] -) +const amd64_cpuregs = ['eax', 'ecx', 'edx', 'ebx', 'esp', 'ebp', 'esi', 'edi'] fn amd64_get_call_regs(os pref.OS) []Amd64Register { return match os { diff --git a/vlib/v/gen/native/dos.v b/vlib/v/gen/native/dos.v index 572a07d0cf..4738e4d68f 100644 --- a/vlib/v/gen/native/dos.v +++ b/vlib/v/gen/native/dos.v @@ -3,10 +3,8 @@ // that can be found in the LICENSE file. module native -const ( - dos_header_size = 0x40 - dos_header_lfanew_offset = 0x3c -) +const dos_header_size = 0x40 +const dos_header_lfanew_offset = 0x3c pub fn (mut g Gen) gen_dos_header() { dos_header := [ diff --git a/vlib/v/gen/native/elf.v b/vlib/v/gen/native/elf.v index fdc6d9688f..8cac169575 100644 --- a/vlib/v/gen/native/elf.v +++ b/vlib/v/gen/native/elf.v @@ -5,131 +5,127 @@ module native import os -const ( - elf_class32 = 1 - elf_class64 = 2 +const elf_class32 = 1 +const elf_class64 = 2 - elf_data_le = 1 - elf_data_be = 2 +const elf_data_le = 1 +const elf_data_be = 2 - elf_version = 1 - elf_abiversion = 0 +const elf_version = 1 +const elf_abiversion = 0 - // elf type - elf_type_none = 0 - elf_type_rel = 1 - elf_type_exec = 2 - elf_type_dyn = 3 - elf_type_core = 4 +// elf type +const elf_type_none = 0 +const elf_type_rel = 1 +const elf_type_exec = 2 +const elf_type_dyn = 3 +const elf_type_core = 4 - elf_amd64 = 0x3e - elf_arm64 = 0xb7 +const elf_amd64 = 0x3e +const elf_arm64 = 0xb7 - elf_osabi_none = 0 - elf_osabi_hpux = 1 - elf_osabi_netbsd = 2 - elf_osabi_linux = 3 - elf_osabi_freebsd = 9 +const elf_osabi_none = 0 +const elf_osabi_hpux = 1 +const elf_osabi_netbsd = 2 +const elf_osabi_linux = 3 +const elf_osabi_freebsd = 9 - elf_header_size = 0x40 - elf_phentry_size = 0x38 +const elf_header_size = 0x40 +const elf_phentry_size = 0x38 - // elf program header type - elf_pt_null = 0 - elf_pt_load = 1 - elf_pt_dynamic = 2 - elf_pt_interp = 3 - elf_pt_note = 4 - elf_pt_shlib = 5 - elf_pt_phdr = 6 - elf_pt_tls = 7 +// elf program header type +const elf_pt_null = 0 +const elf_pt_load = 1 +const elf_pt_dynamic = 2 +const elf_pt_interp = 3 +const elf_pt_note = 4 +const elf_pt_shlib = 5 +const elf_pt_phdr = 6 +const elf_pt_tls = 7 - // offset of e_entry field in the elf header - elf_e_entry_offset = 24 +// offset of e_entry field in the elf header +const elf_e_entry_offset = 24 - // alignment of program headers - elf_p_align = 0x1000 +// alignment of program headers +const elf_p_align = 0x1000 - // elf section header size - elf_shentry_size = 0x40 +// elf section header size +const elf_shentry_size = 0x40 - // elf section type - elf_sht_null = 0x00 - elf_sht_progbits = 0x01 - elf_sht_symtab = 0x02 - elf_sht_strtab = 0x03 - elf_sht_rela = 0x04 - elf_sht_hash = 0x05 - elf_sht_dynamic = 0x06 - elf_sht_note = 0x07 - elf_sht_nobits = 0x08 - elf_sht_rel = 0x09 - elf_sht_shlib = 0x0a - elf_sht_dynsym = 0x0b +// elf section type +const elf_sht_null = 0x00 +const elf_sht_progbits = 0x01 +const elf_sht_symtab = 0x02 +const elf_sht_strtab = 0x03 +const elf_sht_rela = 0x04 +const elf_sht_hash = 0x05 +const elf_sht_dynamic = 0x06 +const elf_sht_note = 0x07 +const elf_sht_nobits = 0x08 +const elf_sht_rel = 0x09 +const elf_sht_shlib = 0x0a +const elf_sht_dynsym = 0x0b - // elf section flags - elf_shf_write = u64(0x01) - elf_shf_alloc = u64(0x02) - elf_shf_execinstr = u64(0x04) - elf_shf_merge = u64(0x10) - elf_sht_strings = u64(0x20) - elf_shf_info_link = u64(0x40) - elf_shf_link_order = u64(0x80) - elf_shf_os_nonconforming = u64(0x100) - elf_shf_groub = u64(0x200) - elf_shf_tls = u64(0x400) +// elf section flags +const elf_shf_write = u64(0x01) +const elf_shf_alloc = u64(0x02) +const elf_shf_execinstr = u64(0x04) +const elf_shf_merge = u64(0x10) +const elf_sht_strings = u64(0x20) +const elf_shf_info_link = u64(0x40) +const elf_shf_link_order = u64(0x80) +const elf_shf_os_nonconforming = u64(0x100) +const elf_shf_groub = u64(0x200) +const elf_shf_tls = u64(0x400) - // elf symbol tables - elf_symtab_size = 0x18 - elf_dynamic_size = 0x10 - elf_rela_size = 0x18 - elf_rel_size = 0x10 - elf_sh_symtab_entsize = elf_symtab_size - elf_sh_symtab_align = 8 +// elf symbol tables +const elf_symtab_size = 0x18 +const elf_dynamic_size = 0x10 +const elf_rela_size = 0x18 +const elf_rel_size = 0x10 +const elf_sh_symtab_entsize = elf_symtab_size +const elf_sh_symtab_align = 8 - // elf symbol binding - elf_stb_local = u8(0) - elf_stb_global = u8(1) +// elf symbol binding +const elf_stb_local = u8(0) +const elf_stb_global = u8(1) - // elf symbol types - elf_stt_notype = u8(0) - elf_stt_object = u8(1) - elf_stt_func = u8(2) - elf_stt_section = u8(3) - elf_stt_file = u8(4) +// elf symbol types +const elf_stt_notype = u8(0) +const elf_stt_object = u8(1) +const elf_stt_func = u8(2) +const elf_stt_section = u8(3) +const elf_stt_file = u8(4) - // elf symbol visibility - elf_stv_default = i8(0) +// elf symbol visibility +const elf_stv_default = i8(0) - // elf relocation types - elf_r_amd64_none = 0 - elf_r_amd64_64 = 1 - elf_r_amd64_pc32 = 2 - elf_r_amd64_got32 = 3 - elf_r_amd64_plt32 = 4 - elf_r_amd64_copy = 5 - elf_r_amd64_glob_dat = 6 - elf_r_amd64_jump_slot = 7 - elf_r_amd64_relative = 8 - elf_r_amd64_gotpcrel = 9 - elf_r_amd64_32 = 10 - elf_r_amd64_32s = 11 - elf_r_amd64_16 = 12 - elf_r_amd64_pc16 = 13 - elf_r_amd64_8 = 14 - elf_r_amd64_pc8 = 15 - elf_r_amd64_pc64 = 24 - elf_r_amd64_gotoff64 = 25 - elf_r_amd64_gotpc32 = 26 - elf_r_amd64_size32 = 32 - elf_r_amd64_size64 = 33 - elf_r_amd64_gotpcrelx = 0x29 -) +// elf relocation types +const elf_r_amd64_none = 0 +const elf_r_amd64_64 = 1 +const elf_r_amd64_pc32 = 2 +const elf_r_amd64_got32 = 3 +const elf_r_amd64_plt32 = 4 +const elf_r_amd64_copy = 5 +const elf_r_amd64_glob_dat = 6 +const elf_r_amd64_jump_slot = 7 +const elf_r_amd64_relative = 8 +const elf_r_amd64_gotpcrel = 9 +const elf_r_amd64_32 = 10 +const elf_r_amd64_32s = 11 +const elf_r_amd64_16 = 12 +const elf_r_amd64_pc16 = 13 +const elf_r_amd64_8 = 14 +const elf_r_amd64_pc8 = 15 +const elf_r_amd64_pc64 = 24 +const elf_r_amd64_gotoff64 = 25 +const elf_r_amd64_gotpc32 = 26 +const elf_r_amd64_size32 = 32 +const elf_r_amd64_size64 = 33 +const elf_r_amd64_gotpcrelx = 0x29 -const ( - segment_start = 0x400000 - placeholder = 0 -) +const segment_start = 0x400000 +const placeholder = 0 struct ElfHeader { mut: diff --git a/vlib/v/gen/native/macho.v b/vlib/v/gen/native/macho.v index 52a39166bb..5cb168f87e 100644 --- a/vlib/v/gen/native/macho.v +++ b/vlib/v/gen/native/macho.v @@ -3,26 +3,24 @@ // that can be found in the LICENSE file. module native -const ( - s_attr_some_instructions = 0x0400 - s_attr_pure_instructions = u32(0x80000000) - s_attr_ext_reloc = 0x0200 - s_attr_loc_reloc = 0x0100 - macho_symcmd_size = 0x18 - macho_d_size = 0x50 - mh_object = 1 - mh_execute = 2 - lc_dyld_chained_fixups = u32(0x80000034) - lc_dyld_exports_trie = u32(0x80000033) - lc_dyld_info_only = u32(0x80000022) - lc_dysymtab = 0xb - lc_load_dylib = 0xc - lc_load_dylinker = 0xe - lc_main = u32(0x80000028) - lc_segment_64 = 0x19 - lc_symtab = 0x2 - base_addr = i64(0x1_0000_0000) -) +const s_attr_some_instructions = 0x0400 +const s_attr_pure_instructions = u32(0x80000000) +const s_attr_ext_reloc = 0x0200 +const s_attr_loc_reloc = 0x0100 +const macho_symcmd_size = 0x18 +const macho_d_size = 0x50 +const mh_object = 1 +const mh_execute = 2 +const lc_dyld_chained_fixups = u32(0x80000034) +const lc_dyld_exports_trie = u32(0x80000033) +const lc_dyld_info_only = u32(0x80000022) +const lc_dysymtab = 0xb +const lc_load_dylib = 0xc +const lc_load_dylinker = 0xe +const lc_main = u32(0x80000028) +const lc_segment_64 = 0x19 +const lc_symtab = 0x2 +const base_addr = i64(0x1_0000_0000) struct Symbol { str_entry i32 diff --git a/vlib/v/gen/native/pe.v b/vlib/v/gen/native/pe.v index 96acd37afc..757652efb2 100644 --- a/vlib/v/gen/native/pe.v +++ b/vlib/v/gen/native/pe.v @@ -14,68 +14,68 @@ enum PeCharacteristics { executable_image = 0x2f } -const ( - image_base = i64(0x400000) +const image_base = i64(0x400000) - pe_section_align = 0x1000 - pe_file_align = 0x0200 +const pe_section_align = 0x1000 +const pe_file_align = 0x0200 - pe_coff_hdr_size = 0x18 - pe_opt_hdr_size = 0xf0 - pe32_plus_opt_hdr_size = 0x70 - pe_header_size = pe_file_align - pe_section_header_size = 0x28 - pe_stack_size = 0x200000 // gcc default on windows - pe_heap_size = 0x100000 // gcc default on windows - // tcc defaults - pe_major_linker_version = 6 - pe_minor_linker_version = 0 - pe_major_os_version = 4 - pe_minor_os_version = 0 - pe_major_subsystem_version = 4 - pe_minor_subsystem_version = 0 +const pe_coff_hdr_size = 0x18 +const pe_opt_hdr_size = 0xf0 +const pe32_plus_opt_hdr_size = 0x70 +const pe_header_size = pe_file_align +const pe_section_header_size = 0x28 +const pe_stack_size = 0x200000 // gcc default on windows - pe_header_machine_offset = 4 - pe_number_of_sections_offset = 6 +const pe_heap_size = 0x100000 // gcc default on windows - pe_num_data_dirs = 0x10 +// tcc defaults +const pe_major_linker_version = 6 +const pe_minor_linker_version = 0 +const pe_major_os_version = 4 +const pe_minor_os_version = 0 +const pe_major_subsystem_version = 4 +const pe_minor_subsystem_version = 0 - dos_stub_end = 0x80 - optdr_location = 0x98 +const pe_header_machine_offset = 4 +const pe_number_of_sections_offset = 6 - // reference: https://learn.microsoft.com/en-us/windows/win32/debug/pe-format?redirectedfrom=MSDN#section-flags - pe_scn_type_no_pad = 0x00000008 - pe_scn_cnt_code = 0x00000020 - pe_scn_cnt_initialized_data = 0x00000040 - pe_scn_cnt_uninitialized_data = 0x00000080 - pe_scn_lnk_info = 0x00000200 - pe_scn_lnk_remove = 0x00000400 - pe_scn_lnk_comdat = 0x00001000 - pe_scn_gprel = 0x00008000 - pe_scn_lnk_nreloc_ovfl = 0x01000000 - pe_scn_mem_discardable = 0x02000000 - pe_scn_mem_not_cached = 0x04000000 - pe_scn_mem_not_paged = 0x08000000 - pe_scn_mem_shared = 0x10000000 - pe_scn_mem_execute = 0x20000000 - pe_scn_mem_read = 0x40000000 - pe_scn_mem_write = i32(u32(0x80000000)) - // obj files only: - pe_scn_align_1bytes = 0x00100000 - pe_scn_align_2bytes = 0x00200000 - pe_scn_align_4bytes = 0x00300000 - pe_scn_align_8bytes = 0x00400000 - pe_scn_align_16bytes = 0x00500000 - pe_scn_align_32bytes = 0x00600000 - pe_scn_align_64bytes = 0x00700000 - pe_scn_align_128bytes = 0x00800000 - pe_scn_align_256bytes = 0x00900000 - pe_scn_align_512bytes = 0x00a00000 - pe_scn_align_1024bytes = 0x00b00000 - pe_scn_align_2048bytes = 0x00c00000 - pe_scn_align_4096bytes = 0x00d00000 - pe_scn_align_8192bytes = 0x00e00000 -) +const pe_num_data_dirs = 0x10 + +const dos_stub_end = 0x80 +const optdr_location = 0x98 + +// reference: https://learn.microsoft.com/en-us/windows/win32/debug/pe-format?redirectedfrom=MSDN#section-flags +const pe_scn_type_no_pad = 0x00000008 +const pe_scn_cnt_code = 0x00000020 +const pe_scn_cnt_initialized_data = 0x00000040 +const pe_scn_cnt_uninitialized_data = 0x00000080 +const pe_scn_lnk_info = 0x00000200 +const pe_scn_lnk_remove = 0x00000400 +const pe_scn_lnk_comdat = 0x00001000 +const pe_scn_gprel = 0x00008000 +const pe_scn_lnk_nreloc_ovfl = 0x01000000 +const pe_scn_mem_discardable = 0x02000000 +const pe_scn_mem_not_cached = 0x04000000 +const pe_scn_mem_not_paged = 0x08000000 +const pe_scn_mem_shared = 0x10000000 +const pe_scn_mem_execute = 0x20000000 +const pe_scn_mem_read = 0x40000000 +const pe_scn_mem_write = i32(u32(0x80000000)) +// obj files only: +const pe_scn_align_1bytes = 0x00100000 +const pe_scn_align_2bytes = 0x00200000 +const pe_scn_align_4bytes = 0x00300000 +const pe_scn_align_8bytes = 0x00400000 +const pe_scn_align_16bytes = 0x00500000 +const pe_scn_align_32bytes = 0x00600000 +const pe_scn_align_64bytes = 0x00700000 +const pe_scn_align_128bytes = 0x00800000 +const pe_scn_align_256bytes = 0x00900000 +const pe_scn_align_512bytes = 0x00a00000 +const pe_scn_align_1024bytes = 0x00b00000 +const pe_scn_align_2048bytes = 0x00c00000 +const pe_scn_align_4096bytes = 0x00d00000 +const pe_scn_align_8192bytes = 0x00e00000 enum PeMachine as u16 { i386 = 0x014c diff --git a/vlib/v/gen/native/readdll.c.v b/vlib/v/gen/native/readdll.c.v index 19c8042288..96c63ec646 100644 --- a/vlib/v/gen/native/readdll.c.v +++ b/vlib/v/gen/native/readdll.c.v @@ -7,11 +7,9 @@ import maps import os import encoding.binary -const ( - pe_dword_size = 4 - pe_export_data_dir_index = 0 - pe_export_directory_size = 0x28 -) +const pe_dword_size = 4 +const pe_export_data_dir_index = 0 +const pe_export_directory_size = 0x28 struct SystemDll { name string diff --git a/vlib/v/live/live_test.v b/vlib/v/live/live_test.v index 4cd45368b3..788fb4b8db 100644 --- a/vlib/v/live/live_test.v +++ b/vlib/v/live/live_test.v @@ -31,20 +31,18 @@ not very flaky way. TODO: Cleanup this when/if v has better process control/communication primitives. */ -const ( - vexe = os.getenv('VEXE') - vtmp_folder = os.join_path(os.vtmp_dir(), 'tests', 'live') - main_source_file = os.join_path(vtmp_folder, 'main.v') - tmp_file = os.join_path(vtmp_folder, 'mymodule', 'generated_live_module.tmp') - source_file = os.join_path(vtmp_folder, 'mymodule', 'mymodule.v') - genexe_file = os.join_path(vtmp_folder, 'generated_live_program') - output_file = os.join_path(vtmp_folder, 'generated_live_program.output.txt') - res_original_file = os.join_path(vtmp_folder, 'ORIGINAL.txt') - res_changed_file = os.join_path(vtmp_folder, 'CHANGED.txt') - res_another_file = os.join_path(vtmp_folder, 'ANOTHER.txt') - res_stop_file = os.join_path(vtmp_folder, 'STOP.txt') - live_program_source = get_source_template() -) +const vexe = os.getenv('VEXE') +const vtmp_folder = os.join_path(os.vtmp_dir(), 'tests', 'live') +const main_source_file = os.join_path(vtmp_folder, 'main.v') +const tmp_file = os.join_path(vtmp_folder, 'mymodule', 'generated_live_module.tmp') +const source_file = os.join_path(vtmp_folder, 'mymodule', 'mymodule.v') +const genexe_file = os.join_path(vtmp_folder, 'generated_live_program') +const output_file = os.join_path(vtmp_folder, 'generated_live_program.output.txt') +const res_original_file = os.join_path(vtmp_folder, 'ORIGINAL.txt') +const res_changed_file = os.join_path(vtmp_folder, 'CHANGED.txt') +const res_another_file = os.join_path(vtmp_folder, 'ANOTHER.txt') +const res_stop_file = os.join_path(vtmp_folder, 'STOP.txt') +const live_program_source = get_source_template() fn get_source_template() string { src := os.read_file(os.join_path(os.dir(@FILE), 'live_test_template.vv')) or { panic(err) } diff --git a/vlib/v/live/sharedlib/live_sharedlib.v b/vlib/v/live/sharedlib/live_sharedlib.v index 6ae965df73..b9a600ec6d 100644 --- a/vlib/v/live/sharedlib/live_sharedlib.v +++ b/vlib/v/live/sharedlib/live_sharedlib.v @@ -2,6 +2,4 @@ module sharedlib import v.live -pub const ( - is_used = live.is_used + 1 -) +pub const is_used = live.is_used + 1 diff --git a/vlib/v/parser/comptime.v b/vlib/v/parser/comptime.v index a80edc3a2e..abaaa6b8fb 100644 --- a/vlib/v/parser/comptime.v +++ b/vlib/v/parser/comptime.v @@ -8,12 +8,10 @@ import v.ast import v.pref import v.token -const ( - supported_comptime_calls = ['html', 'tmpl', 'env', 'embed_file', 'pkgconfig', 'compile_error', - 'compile_warn', 'res'] - comptime_types = ['map', 'array', 'array_dynamic', 'array_fixed', 'int', 'float', - 'struct', 'interface', 'enum', 'sumtype', 'alias', 'function', 'option'] -) +const supported_comptime_calls = ['html', 'tmpl', 'env', 'embed_file', 'pkgconfig', 'compile_error', + 'compile_warn', 'res'] +const comptime_types = ['map', 'array', 'array_dynamic', 'array_fixed', 'int', 'float', 'struct', + 'interface', 'enum', 'sumtype', 'alias', 'function', 'option'] fn (mut p Parser) parse_comptime_type() ast.ComptimeType { pos := p.tok.pos() diff --git a/vlib/v/pkgconfig/pkgconfig.v b/vlib/v/pkgconfig/pkgconfig.v index 644fb39e57..8c6fec43b2 100644 --- a/vlib/v/pkgconfig/pkgconfig.v +++ b/vlib/v/pkgconfig/pkgconfig.v @@ -3,23 +3,21 @@ module pkgconfig import semver import os -const ( - default_paths = [ - '/usr/local/lib/x86_64-linux-gnu/pkgconfig', - '/usr/local/lib64/pkgconfig', - '/usr/local/lib/pkgconfig', - '/usr/local/share/pkgconfig', - '/usr/lib/x86_64-linux-gnu/pkgconfig', - '/usr/lib/aarch64-linux-gnu/pkgconfig', - '/usr/lib64/pkgconfig', - '/usr/lib/pkgconfig', - '/usr/share/pkgconfig', - '/opt/homebrew/lib/pkgconfig', // Brew on macOS - '/usr/local/libdata/pkgconfig', // FreeBSD - '/usr/lib/i386-linux-gnu/pkgconfig', // Debian 32bit - ] - version = '0.3.3' -) +const default_paths = [ + '/usr/local/lib/x86_64-linux-gnu/pkgconfig', + '/usr/local/lib64/pkgconfig', + '/usr/local/lib/pkgconfig', + '/usr/local/share/pkgconfig', + '/usr/lib/x86_64-linux-gnu/pkgconfig', + '/usr/lib/aarch64-linux-gnu/pkgconfig', + '/usr/lib64/pkgconfig', + '/usr/lib/pkgconfig', + '/usr/share/pkgconfig', + '/opt/homebrew/lib/pkgconfig', // Brew on macOS + '/usr/local/libdata/pkgconfig', // FreeBSD + '/usr/lib/i386-linux-gnu/pkgconfig', // Debian 32bit +] +const version = '0.3.3' pub struct Options { pub: diff --git a/vlib/v/pref/options_test.v b/vlib/v/pref/options_test.v index cea74a57b6..cbc1214320 100644 --- a/vlib/v/pref/options_test.v +++ b/vlib/v/pref/options_test.v @@ -3,10 +3,8 @@ import os import time -const ( - vexe = @VEXE - tfolder = os.join_path(os.vtmp_dir(), 'custom_compile') -) +const vexe = @VEXE +const tfolder = os.join_path(os.vtmp_dir(), 'custom_compile') fn testsuite_begin() { os.mkdir_all(tfolder) or {} diff --git a/vlib/v/preludes/embed_file/embed_file.v b/vlib/v/preludes/embed_file/embed_file.v index afe0eb10bb..86042ed116 100644 --- a/vlib/v/preludes/embed_file/embed_file.v +++ b/vlib/v/preludes/embed_file/embed_file.v @@ -4,6 +4,4 @@ module embed_file // in both the main executable, and in the shared library. import v.embed_file -const ( - no_warning_embed_file_is_used = embed_file.is_used -) +const no_warning_embed_file_is_used = embed_file.is_used diff --git a/vlib/v/preludes/live.v b/vlib/v/preludes/live.v index 41de533ce3..429aa6a989 100644 --- a/vlib/v/preludes/live.v +++ b/vlib/v/preludes/live.v @@ -4,6 +4,4 @@ module main // in both the main executable, and in the shared library. import v.live -const ( - no_warning_live_is_used = live.is_used -) +const no_warning_live_is_used = live.is_used diff --git a/vlib/v/preludes/live_main.v b/vlib/v/preludes/live_main.v index 131cde237a..22e13c667f 100644 --- a/vlib/v/preludes/live_main.v +++ b/vlib/v/preludes/live_main.v @@ -4,6 +4,4 @@ module main // but only for the main executable. import v.live.executable -const ( - no_warning_live_executable_is_used = executable.is_used -) +const no_warning_live_executable_is_used = executable.is_used diff --git a/vlib/v/preludes/live_shared.v b/vlib/v/preludes/live_shared.v index cce973ae07..266f2604d5 100644 --- a/vlib/v/preludes/live_shared.v +++ b/vlib/v/preludes/live_shared.v @@ -4,6 +4,4 @@ module main // but only for the shared library. import v.live.sharedlib -const ( - no_warning_live_shared_is_used = sharedlib.is_used -) +const no_warning_live_shared_is_used = sharedlib.is_used diff --git a/vlib/v/preludes/tests_with_stats.v b/vlib/v/preludes/tests_with_stats.v index 158d160fb8..b7a263e830 100644 --- a/vlib/v/preludes/tests_with_stats.v +++ b/vlib/v/preludes/tests_with_stats.v @@ -10,9 +10,7 @@ module main import os import benchmark -const ( - inner_indent = ' ' -) +const inner_indent = ' ' struct BenchedTests { mut: diff --git a/vlib/v/scanner/scanner.v b/vlib/v/scanner/scanner.v index e90d790f14..d280215b18 100644 --- a/vlib/v/scanner/scanner.v +++ b/vlib/v/scanner/scanner.v @@ -13,15 +13,13 @@ import v.errors import v.ast import v.mathutil -const ( - single_quote = `'` - double_quote = `"` - // char used as number separator - num_sep = `_` - b_lf = 10 - b_cr = 13 - backslash = `\\` -) +const single_quote = `'` +const double_quote = `"` +// char used as number separator +const num_sep = `_` +const b_lf = 10 +const b_cr = 13 +const backslash = `\\` @[minify] pub struct Scanner { diff --git a/vlib/v/slow_tests/crun_mode/crun_test.v b/vlib/v/slow_tests/crun_mode/crun_test.v index 4ed2ced0a1..147df2f1d1 100644 --- a/vlib/v/slow_tests/crun_mode/crun_test.v +++ b/vlib/v/slow_tests/crun_mode/crun_test.v @@ -3,11 +3,9 @@ import os import time -const ( - vexe = os.getenv('VEXE') - crun_folder = os.join_path(os.vtmp_dir(), 'crun_folder') - vprogram_file = os.join_path(crun_folder, 'vprogram.vv') -) +const vexe = os.getenv('VEXE') +const crun_folder = os.join_path(os.vtmp_dir(), 'crun_folder') +const vprogram_file = os.join_path(crun_folder, 'vprogram.vv') fn testsuite_begin() { os.setenv('VCACHE', crun_folder, true) diff --git a/vlib/v/tests/as_cast_is_expr_sumtype_fn_result_test.v b/vlib/v/tests/as_cast_is_expr_sumtype_fn_result_test.v index e0fb8c2eb8..81808994bd 100644 --- a/vlib/v/tests/as_cast_is_expr_sumtype_fn_result_test.v +++ b/vlib/v/tests/as_cast_is_expr_sumtype_fn_result_test.v @@ -1,7 +1,5 @@ -const ( - str = 'abcdefghijklmnopqrstuvwxyz' - num = 1234567890 -) +const str = 'abcdefghijklmnopqrstuvwxyz' +const num = 1234567890 struct S1 { s1 string = str diff --git a/vlib/v/tests/assign_bitops_with_type_aliases_test.v b/vlib/v/tests/assign_bitops_with_type_aliases_test.v index 9f8e60e367..8bde4b4940 100644 --- a/vlib/v/tests/assign_bitops_with_type_aliases_test.v +++ b/vlib/v/tests/assign_bitops_with_type_aliases_test.v @@ -1,8 +1,6 @@ // see https://discordapp.com/channels/592103645835821068/592114487759470596/762271917293043762 -const ( - steamid_id_shift = 2 - steamid_id_mask = 0x04 -) +const steamid_id_shift = 2 +const steamid_id_mask = 0x04 type SteamId = u64 diff --git a/vlib/v/tests/autolock_array1_test.v b/vlib/v/tests/autolock_array1_test.v index b6aaea1cbf..dc9dc0676e 100644 --- a/vlib/v/tests/autolock_array1_test.v +++ b/vlib/v/tests/autolock_array1_test.v @@ -1,8 +1,6 @@ import time -const ( - iterations_per_thread = 100000 -) +const iterations_per_thread = 100000 fn add_elements(shared foo []int, n int) { for _ in 0 .. iterations_per_thread { diff --git a/vlib/v/tests/autolock_array2_test.v b/vlib/v/tests/autolock_array2_test.v index 25e6d1131b..e212de8f66 100644 --- a/vlib/v/tests/autolock_array2_test.v +++ b/vlib/v/tests/autolock_array2_test.v @@ -1,8 +1,6 @@ import sync -const ( - iterations_per_thread2 = 100000 -) +const iterations_per_thread2 = 100000 fn inc_elements(shared foo []int, n int, mut sem sync.Semaphore) { for _ in 0 .. iterations_per_thread2 { diff --git a/vlib/v/tests/bench/gcboehm/GC_bench.v b/vlib/v/tests/bench/gcboehm/GC_bench.v index 6aca90b557..31a7160824 100644 --- a/vlib/v/tests/bench/gcboehm/GC_bench.v +++ b/vlib/v/tests/bench/gcboehm/GC_bench.v @@ -18,11 +18,9 @@ mut: nxt []&PtrObj } -const ( - log2n = 11 - n = 1 << log2n - n4 = f64(u64(1) << (4 * log2n)) -) +const log2n = 11 +const n = 1 << log2n +const n4 = f64(u64(1) << (4 * log2n)) fn waste_mem() { mut objs := PtrPtrObj{ diff --git a/vlib/v/tests/bench/math_big_gcd/bench_euclid.v b/vlib/v/tests/bench/math_big_gcd/bench_euclid.v index ac652f1e5c..eb63466633 100644 --- a/vlib/v/tests/bench/math_big_gcd/bench_euclid.v +++ b/vlib/v/tests/bench/math_big_gcd/bench_euclid.v @@ -19,10 +19,8 @@ interface TestDataI { type GCDSet = PrimeSet type Clocks = map[string]benchmark.Benchmark -const ( - empty_set = GCDSet{'1', '1', '1'} - with_dots = false -) +const empty_set = GCDSet{'1', '1', '1'} +const with_dots = false fn main() { fp := os.join_path(@VROOT, prime.toml_path) diff --git a/vlib/v/tests/blank_ident_test.v b/vlib/v/tests/blank_ident_test.v index f07c113def..790a82f1ad 100644 --- a/vlib/v/tests/blank_ident_test.v +++ b/vlib/v/tests/blank_ident_test.v @@ -114,11 +114,9 @@ fn test_nested_for_in_array_both() { } } -const ( - m = { - 'key': 'value' - } -) +const m = { + 'key': 'value' +} fn test_for_in_map_key() { for _, v in m { diff --git a/vlib/v/tests/break_in_lock_test.v b/vlib/v/tests/break_in_lock_test.v index 539ed1fb69..05448242e6 100644 --- a/vlib/v/tests/break_in_lock_test.v +++ b/vlib/v/tests/break_in_lock_test.v @@ -5,10 +5,9 @@ mut: b string } -const ( - run_time = time.millisecond * 500 // must be big enough to ensure threads have started - sleep_time = time.millisecond * 2000 // some tolerance added -) +const run_time = time.millisecond * 500 // must be big enough to ensure threads have started + +const sleep_time = time.millisecond * 2000 fn test_return_lock() { start := time.now() diff --git a/vlib/v/tests/closure_generator_test.v b/vlib/v/tests/closure_generator_test.v index 094037a881..0f9af29778 100644 --- a/vlib/v/tests/closure_generator_test.v +++ b/vlib/v/tests/closure_generator_test.v @@ -1,11 +1,9 @@ import strings import os -const ( - max_params = get_max_params() - all_param_names = []string{len: max_params, init: '${`a` + index}'} - all_param_values = []string{len: max_params, init: '${index + 1}'} -) +const max_params = get_max_params() +const all_param_names = []string{len: max_params, init: '${`a` + index}'} +const all_param_values = []string{len: max_params, init: '${index + 1}'} fn get_max_params() int { $if macos { diff --git a/vlib/v/tests/comptime_const_def_test.v b/vlib/v/tests/comptime_const_def_test.v index d9bf9916d3..553a6f07b7 100644 --- a/vlib/v/tests/comptime_const_def_test.v +++ b/vlib/v/tests/comptime_const_def_test.v @@ -1,10 +1,8 @@ -const ( - buf_size = $if true { - 2 - } $else { - 1 - } -) +const buf_size = $if true { + 2 +} $else { + 1 +} fn test_main() { mut buf := [buf_size]u8{} diff --git a/vlib/v/tests/comptime_if_expr_test.v b/vlib/v/tests/comptime_if_expr_test.v index fff4f61011..efee06c438 100644 --- a/vlib/v/tests/comptime_if_expr_test.v +++ b/vlib/v/tests/comptime_if_expr_test.v @@ -1,7 +1,5 @@ -const ( - version = 123 - disable_opt_features = true -) +const version = 123 +const disable_opt_features = true // Note: the `unknown_fn()` calls are here on purpose, to make sure that anything // that doesn't match a compile-time condition is not even parsed. diff --git a/vlib/v/tests/const_array_init_order_test.v b/vlib/v/tests/const_array_init_order_test.v index 07cf98c995..8261fcd11f 100644 --- a/vlib/v/tests/const_array_init_order_test.v +++ b/vlib/v/tests/const_array_init_order_test.v @@ -1,8 +1,6 @@ -const ( - cst3 = [[[cst1, cst2]]] - cst1 = [11] - cst2 = [22] -) +const cst3 = [[[cst1, cst2]]] +const cst1 = [11] +const cst2 = [22] fn test_const_array_init_order() { println(cst3) diff --git a/vlib/v/tests/const_as_enum_value_test.v b/vlib/v/tests/const_as_enum_value_test.v index 8b2fa103af..eb34107965 100644 --- a/vlib/v/tests/const_as_enum_value_test.v +++ b/vlib/v/tests/const_as_enum_value_test.v @@ -1,7 +1,5 @@ -const ( - first_const = 1000 - second_const = 2000 -) +const first_const = 1000 +const second_const = 2000 enum Test { example = first_const diff --git a/vlib/v/tests/const_call_expr_order_test.v b/vlib/v/tests/const_call_expr_order_test.v index b0f5664e57..c5b40b5deb 100644 --- a/vlib/v/tests/const_call_expr_order_test.v +++ b/vlib/v/tests/const_call_expr_order_test.v @@ -1,11 +1,9 @@ import os -const ( - shdc_exe_name = 'sokol-shdc.exe' - tool_name = os.file_name(os.executable()) - cache_dir = os.join_path(os.cache_dir(), 'v', tool_name) - shdc = shdc_exe() -) +const shdc_exe_name = 'sokol-shdc.exe' +const tool_name = os.file_name(os.executable()) +const cache_dir = os.join_path(os.cache_dir(), 'v', tool_name) +const shdc = shdc_exe() fn test_const_call_expr_order() { dump(cache_dir) diff --git a/vlib/v/tests/const_can_use_options_results_test.v b/vlib/v/tests/const_can_use_options_results_test.v index 026915d521..9c2bf5b5eb 100644 --- a/vlib/v/tests/const_can_use_options_results_test.v +++ b/vlib/v/tests/const_can_use_options_results_test.v @@ -1,7 +1,5 @@ -const ( - aaa = iopt()? - bbb = sopt()! -) +const aaa = iopt()? +const bbb = sopt()! fn iopt() ?int { return 1234 diff --git a/vlib/v/tests/const_embed_test.v b/vlib/v/tests/const_embed_test.v index b7bbddf18f..eb4da42f40 100644 --- a/vlib/v/tests/const_embed_test.v +++ b/vlib/v/tests/const_embed_test.v @@ -1,8 +1,6 @@ import math -const ( - max_float = math.max_f32 -) +const max_float = math.max_f32 fn test_const_embed() { println(max_float) diff --git a/vlib/v/tests/const_fixed_array_of_reference_value_test.v b/vlib/v/tests/const_fixed_array_of_reference_value_test.v index 4054801de0..133f78d48e 100644 --- a/vlib/v/tests/const_fixed_array_of_reference_value_test.v +++ b/vlib/v/tests/const_fixed_array_of_reference_value_test.v @@ -1,8 +1,6 @@ -const ( - foo = u32(1) - bar = u32(2) - weapon_keys = [&foo, &bar]! -) +const foo = u32(1) +const bar = u32(2) +const weapon_keys = [&foo, &bar]! fn test_const_fixed_array_of_ref_value() { assert weapon_keys[0] == &foo diff --git a/vlib/v/tests/const_from_comptime_if_expr_test.v b/vlib/v/tests/const_from_comptime_if_expr_test.v index c3612837cb..a6d9f242a2 100644 --- a/vlib/v/tests/const_from_comptime_if_expr_test.v +++ b/vlib/v/tests/const_from_comptime_if_expr_test.v @@ -1,12 +1,10 @@ import term -const ( - color = $if windows { - term.bright_cyan('WINDOWS') - } $else { - term.bright_green('UNIX') - } -) +const color = $if windows { + term.bright_cyan('WINDOWS') +} $else { + term.bright_green('UNIX') +} fn test_const_from_comptime_if_expr() { salutation := 'hello' diff --git a/vlib/v/tests/const_function_call_init_order_test.v b/vlib/v/tests/const_function_call_init_order_test.v index e22a3bf463..ef16b49fb0 100644 --- a/vlib/v/tests/const_function_call_init_order_test.v +++ b/vlib/v/tests/const_function_call_init_order_test.v @@ -1,11 +1,9 @@ import os -const ( - shdc_exe_name = 'sokol-shdc.exe' - tool_name = os.file_name(os.executable()) - cache_dir = os.join_path(os.cache_dir(), 'v', tool_name) - shdc = shdc_exe() -) +const shdc_exe_name = 'sokol-shdc.exe' +const tool_name = os.file_name(os.executable()) +const cache_dir = os.join_path(os.cache_dir(), 'v', tool_name) +const shdc = shdc_exe() fn shdc_exe() string { return os.join_path(cache_dir, shdc_exe_name) diff --git a/vlib/v/tests/const_init_order_test.v b/vlib/v/tests/const_init_order_test.v index 3e77d9fe14..42ab9bbce2 100644 --- a/vlib/v/tests/const_init_order_test.v +++ b/vlib/v/tests/const_init_order_test.v @@ -1,9 +1,7 @@ import os import rand -const ( - my_random_letter_const = u8(65) + (rand.u8() % 26) -) +const my_random_letter_const = u8(65) + (rand.u8() % 26) fn test_rand_is_initialized_before_main() { eprintln('random letter: ${my_random_letter_const.str()} | ASCII code: ${my_random_letter_const}') @@ -12,10 +10,8 @@ fn test_rand_is_initialized_before_main() { // -const ( - last_constant = fn_that_calls_a_method_on_a_constant() - a_constant = os.join_path(@VROOT, 'a') -) +const last_constant = fn_that_calls_a_method_on_a_constant() +const a_constant = os.join_path(@VROOT, 'a') fn fn_that_calls_a_method_on_a_constant() string { return a_constant.replace('\\', '/') diff --git a/vlib/v/tests/const_test.v b/vlib/v/tests/const_test.v index cb1408ebfb..325ca451e7 100644 --- a/vlib/v/tests/const_test.v +++ b/vlib/v/tests/const_test.v @@ -1,10 +1,8 @@ -pub const ( - a = b - ccc = a + b - b = 1 - d = (e / 2) + 7 - e = 9 -) +pub const a = b +pub const ccc = a + b +pub const b = 1 +pub const d = (e / 2) + 7 +pub const e = 9 pub const x = 10 @@ -30,10 +28,8 @@ fn foo_decode(name string) !Foo { return Foo{name} } -pub const ( - def = foo_decode('baz') or { Foo{} } - bar = foo_decode('bar')! -) +pub const def = foo_decode('baz') or { Foo{} } +pub const bar = foo_decode('bar')! fn test_opt_const() { assert def.name == 'foo' @@ -41,11 +37,9 @@ fn test_opt_const() { } // const with expressions that compile to multiple C statements -pub const ( - abc = [1, 2, 3].map(it * it) - ghi = [1, 2, 3, 4, 5].filter(it % 2 == 0) - jkl = [`a`, `b`, `c`].contains(`d`) -) +pub const abc = [1, 2, 3].map(it * it) +pub const ghi = [1, 2, 3, 4, 5].filter(it % 2 == 0) +pub const jkl = [`a`, `b`, `c`].contains(`d`) fn test_multistmt_const() { assert abc[2] == 9 diff --git a/vlib/v/tests/constant_array_size_test.v b/vlib/v/tests/constant_array_size_test.v index 6a372808d9..47e56cd296 100644 --- a/vlib/v/tests/constant_array_size_test.v +++ b/vlib/v/tests/constant_array_size_test.v @@ -1,8 +1,6 @@ -const ( - c_a_s = 1 - c_b_s = 1 + 1 - c_c_s = c_b_s + 1 // this should be also fold by transformer since it's a constant -) +const c_a_s = 1 +const c_b_s = 1 + 1 +const c_c_s = c_b_s + 1 fn test_consant_array_size() { mut a := [c_a_s]int{} diff --git a/vlib/v/tests/create_dll/create_win_dll.c.v b/vlib/v/tests/create_dll/create_win_dll.c.v index eda77f9a47..eedd0e0c79 100644 --- a/vlib/v/tests/create_dll/create_win_dll.c.v +++ b/vlib/v/tests/create_dll/create_win_dll.c.v @@ -3,10 +3,8 @@ module test fn C._vinit(int, voidptr) fn C.GC_INIT() -const ( - foo = 1 - bar = (foo << 5) + 9 -) +const foo = 1 +const bar = (foo << 5) + 9 @[export: Tatltuae] pub fn test_tatltuae() int { diff --git a/vlib/v/tests/enum_hex_test.v b/vlib/v/tests/enum_hex_test.v index c41aa83dca..9c3b95f40b 100644 --- a/vlib/v/tests/enum_hex_test.v +++ b/vlib/v/tests/enum_hex_test.v @@ -10,11 +10,9 @@ enum WDecimal { c = 256 } -const ( - ca = 1 - cb = 16 - cc = 256 -) +const ca = 1 +const cb = 16 +const cc = 256 fn test_enum_hex() { assert ca == int(WDecimal.a) diff --git a/vlib/v/tests/fixed_array_const_size_test.v b/vlib/v/tests/fixed_array_const_size_test.v index 01a0b99929..f9787c9d3f 100644 --- a/vlib/v/tests/fixed_array_const_size_test.v +++ b/vlib/v/tests/fixed_array_const_size_test.v @@ -1,9 +1,7 @@ -const ( - size = 5 - u64_size = u64(5) - int_size = int(1) - infix_cast_size = int(100 / 50) -) +const size = 5 +const u64_size = u64(5) +const int_size = int(1) +const infix_cast_size = int(100 / 50) struct Foo { bar [size]u8 @@ -55,10 +53,8 @@ fn test_int_const_used_as_fixed_array_size() { assert aa.len == 10_000 } -const ( - rows = 2 - cols = 3 -) +const rows = 2 +const cols = 3 struct Matrix1 { data [rows * cols]int diff --git a/vlib/v/tests/fn_literal_type_test.v b/vlib/v/tests/fn_literal_type_test.v index 370b7a44c4..a6f3dcdb8a 100644 --- a/vlib/v/tests/fn_literal_type_test.v +++ b/vlib/v/tests/fn_literal_type_test.v @@ -6,10 +6,8 @@ struct User { name string } -const ( - const_users_offset = 1 - const_users_offset2 = 1 -) +const const_users_offset = 1 +const const_users_offset2 = 1 fn test_orm() { db := sqlite.connect(':memory:') or { panic(err) } diff --git a/vlib/v/tests/for_in_mut_iterator_val_test.v b/vlib/v/tests/for_in_mut_iterator_val_test.v index 5932259fe5..52fae82d4b 100644 --- a/vlib/v/tests/for_in_mut_iterator_val_test.v +++ b/vlib/v/tests/for_in_mut_iterator_val_test.v @@ -1,13 +1,11 @@ -const ( - packets = { - 0: &Packet{ - pid: 2 - } - 1: &Packet{ - pid: 1 - } +const packets = { + 0: &Packet{ + pid: 2 } -) + 1: &Packet{ + pid: 1 + } +} struct Packet { pid int diff --git a/vlib/v/tests/for_loops_test.v b/vlib/v/tests/for_loops_test.v index 146a5ff130..bfb143fee0 100644 --- a/vlib/v/tests/for_loops_test.v +++ b/vlib/v/tests/for_loops_test.v @@ -1,6 +1,4 @@ -const ( - nums = [1, 2, 3] -) +const nums = [1, 2, 3] fn test_for_char_in() { mut sum := 0 diff --git a/vlib/v/tests/generics_struct_inst_method_call_test.v b/vlib/v/tests/generics_struct_inst_method_call_test.v index a387b003c2..8f89b93054 100644 --- a/vlib/v/tests/generics_struct_inst_method_call_test.v +++ b/vlib/v/tests/generics_struct_inst_method_call_test.v @@ -5,10 +5,8 @@ fn test_generics_struct_inst_method_call() { assert r1 } -const ( - tp_lft = V2d[f32]{20} - bt_rigt = V2d[f32]{650} -) +const tp_lft = V2d[f32]{20} +const bt_rigt = V2d[f32]{650} struct V2d[T] { mut: diff --git a/vlib/v/tests/generics_struct_parent_has_str_to_string_test.v b/vlib/v/tests/generics_struct_parent_has_str_to_string_test.v index 76c84216f4..57f88c6347 100644 --- a/vlib/v/tests/generics_struct_parent_has_str_to_string_test.v +++ b/vlib/v/tests/generics_struct_parent_has_str_to_string_test.v @@ -1,9 +1,7 @@ import datatypes -const ( - w = 64 - h = 32 -) +const w = 64 +const h = 32 interface Display { mut: diff --git a/vlib/v/tests/generics_with_recursive_generics_fn_test.v b/vlib/v/tests/generics_with_recursive_generics_fn_test.v index fb81f73d05..613f939f58 100644 --- a/vlib/v/tests/generics_with_recursive_generics_fn_test.v +++ b/vlib/v/tests/generics_with_recursive_generics_fn_test.v @@ -1,9 +1,8 @@ import rand -const ( - gen_len = 1000 // how many random numbers to generate - gen_max = 10000 // max of the generated numbers -) +const gen_len = 1000 // how many random numbers to generate + +const gen_max = 10000 fn test_generics_with_recursive_generics_fn() { mut arr := []int{} diff --git a/vlib/v/tests/map_key_expr_test.v b/vlib/v/tests/map_key_expr_test.v index cea8041dcf..4b1a2a8f93 100644 --- a/vlib/v/tests/map_key_expr_test.v +++ b/vlib/v/tests/map_key_expr_test.v @@ -1,11 +1,9 @@ -const ( - alpha = 'a' - beta = 'b' - m = { - alpha: 'Alpha' - beta: 'Beta' - } -) +const alpha = 'a' +const beta = 'b' +const m = { + alpha: 'Alpha' + beta: 'Beta' +} fn test_const_keys() { assert m[alpha] == 'Alpha' @@ -17,12 +15,10 @@ enum Enum { b } -const ( - m2 = { - Enum.a.str(): 'first' - Enum.b.str(): 'second' - } -) +const m2 = { + Enum.a.str(): 'first' + Enum.b.str(): 'second' +} fn test_method_call() { assert m2.keys() == ['a', 'b'] diff --git a/vlib/v/tests/match_const_range_test.v b/vlib/v/tests/match_const_range_test.v index b31e7802d7..cc9088e339 100644 --- a/vlib/v/tests/match_const_range_test.v +++ b/vlib/v/tests/match_const_range_test.v @@ -1,17 +1,15 @@ -const ( - start = 1 - start_2 = 4 - end = 3 - end_2 = 8 - // - start_rune = `a` - start_2_rune = `d` - end_rune = `c` - end_2_rune = `i` - // - start_cast_expr = u16(1) - end_cast_expr = u16(5) -) +const start = 1 +const start_2 = 4 +const end = 3 +const end_2 = 8 +// +const start_rune = `a` +const start_2_rune = `d` +const end_rune = `c` +const end_2_rune = `i` +// +const start_cast_expr = u16(1) +const end_cast_expr = u16(5) fn test_match_int_const_ranges() { mut results := []int{} diff --git a/vlib/v/tests/match_sumtype_var_shadow_and_as_test.v b/vlib/v/tests/match_sumtype_var_shadow_and_as_test.v index eaf9b12df1..33f9e34250 100644 --- a/vlib/v/tests/match_sumtype_var_shadow_and_as_test.v +++ b/vlib/v/tests/match_sumtype_var_shadow_and_as_test.v @@ -8,14 +8,12 @@ struct Dog { type Animal = Cat | Dog -const ( - cat = Cat{ - name: 'cat' - } - dog = Dog{ - name: 'dog' - } -) +const cat = Cat{ + name: 'cat' +} +const dog = Dog{ + name: 'dog' +} fn test_shadow() { mut animal := Animal{} diff --git a/vlib/v/tests/match_test.v b/vlib/v/tests/match_test.v index 8e069472f6..8695035c80 100644 --- a/vlib/v/tests/match_test.v +++ b/vlib/v/tests/match_test.v @@ -242,9 +242,7 @@ fn test_sub_expression() { assert c } -const ( - one = 'one' -) +const one = 'one' fn test_match_constant_string() { match one { diff --git a/vlib/v/tests/modules/geometry/geometry.v b/vlib/v/tests/modules/geometry/geometry.v index d239f47900..cdb423ca80 100644 --- a/vlib/v/tests/modules/geometry/geometry.v +++ b/vlib/v/tests/modules/geometry/geometry.v @@ -1,8 +1,6 @@ module geometry -const ( - module_name = 'geometry' -) +const module_name = 'geometry' pub enum Shape { circle diff --git a/vlib/v/tests/reliability/semaphore_wait.v b/vlib/v/tests/reliability/semaphore_wait.v index 1969307e5e..7811c32e4b 100644 --- a/vlib/v/tests/reliability/semaphore_wait.v +++ b/vlib/v/tests/reliability/semaphore_wait.v @@ -42,11 +42,9 @@ mut: nxt []&PtrObj } -const ( - log2n = 9 - n = 1 << log2n - n4 = f64(u64(1) << (4 * log2n)) -) +const log2n = 9 +const n = 1 << log2n +const n4 = f64(u64(1) << (4 * log2n)) fn waste_mem() { mut objs := PtrPtrObj{ diff --git a/vlib/v/tests/run_v_code_from_stdin_test.v b/vlib/v/tests/run_v_code_from_stdin_test.v index 40d2be3e0e..a26a437a92 100644 --- a/vlib/v/tests/run_v_code_from_stdin_test.v +++ b/vlib/v/tests/run_v_code_from_stdin_test.v @@ -1,10 +1,8 @@ import os -const ( - vexe = os.getenv('VEXE') - turn_off_vcolors = os.setenv('VCOLORS', 'never', true) - vtmp_folder = os.join_path(os.vtmp_dir(), 'tests', 'run_v_code') -) +const vexe = os.getenv('VEXE') +const turn_off_vcolors = os.setenv('VCOLORS', 'never', true) +const vtmp_folder = os.join_path(os.vtmp_dir(), 'tests', 'run_v_code') fn test_vexe_is_set() { assert vexe != '' diff --git a/vlib/v/tests/semaphore_test.v b/vlib/v/tests/semaphore_test.v index 3a491c7ed9..12f9647fdd 100644 --- a/vlib/v/tests/semaphore_test.v +++ b/vlib/v/tests/semaphore_test.v @@ -1,8 +1,6 @@ import sync -const ( - signals_per_thread = 100000 -) +const signals_per_thread = 100000 fn send_signals(mut sem sync.Semaphore, mut sem_end sync.Semaphore) { for _ in 0 .. signals_per_thread { diff --git a/vlib/v/tests/shared_lock_3_test.v b/vlib/v/tests/shared_lock_3_test.v index be7df6e4ed..d3ecbb4db3 100644 --- a/vlib/v/tests/shared_lock_3_test.v +++ b/vlib/v/tests/shared_lock_3_test.v @@ -17,11 +17,9 @@ fn f(shared x St, shared z St) { } } -const ( - reads_per_thread = 30 - read_threads = 10 - writes = 5 -) +const reads_per_thread = 30 +const read_threads = 10 +const writes = 5 fn test_shared_lock() { // object with separate read/write lock diff --git a/vlib/v/tests/shared_lock_4_test.v b/vlib/v/tests/shared_lock_4_test.v index 2997bfef15..73ad14fcee 100644 --- a/vlib/v/tests/shared_lock_4_test.v +++ b/vlib/v/tests/shared_lock_4_test.v @@ -17,11 +17,9 @@ fn (shared x St) f(shared z St) { } } -const ( - reads_per_thread = 30 - read_threads = 10 - writes = 5 -) +const reads_per_thread = 30 +const read_threads = 10 +const writes = 5 fn test_shared_lock() { // object with separate read/write lock diff --git a/vlib/v/tests/static_arrays_using_const_for_size_test.v b/vlib/v/tests/static_arrays_using_const_for_size_test.v index c8b0bd9d60..213ae01570 100644 --- a/vlib/v/tests/static_arrays_using_const_for_size_test.v +++ b/vlib/v/tests/static_arrays_using_const_for_size_test.v @@ -1,6 +1,4 @@ -const ( - sbuffer_size = 10 -) +const sbuffer_size = 10 fn test_hardcoded_static_arr() { myints := [10]int{} diff --git a/vlib/v/tests/struct_test.v b/vlib/v/tests/struct_test.v index 5c6dc46764..12077e3909 100644 --- a/vlib/v/tests/struct_test.v +++ b/vlib/v/tests/struct_test.v @@ -186,11 +186,9 @@ fn test_assoc_with_vars() { assert merged2.b == 200 } -const ( - const_def = Def{ - a: 100 - } -) +const const_def = Def{ + a: 100 +} fn test_assoc_with_constants() { println(1) diff --git a/vlib/v/tests/unsigned_right_shift_test.v b/vlib/v/tests/unsigned_right_shift_test.v index aff0eba90f..b64df5890b 100644 --- a/vlib/v/tests/unsigned_right_shift_test.v +++ b/vlib/v/tests/unsigned_right_shift_test.v @@ -1,10 +1,8 @@ const answer_u64 = u64(9223372036854775805) -const ( - answer_u32 = u32(2147483645) - answer_u16 = u16(32765) - answer_u8 = u8(125) -) +const answer_u32 = u32(2147483645) +const answer_u16 = u16(32765) +const answer_u8 = u8(125) fn test_unsigned_right_shift_expr_isize_usize() { $if x32 { diff --git a/vlib/v/token/token.v b/vlib/v/token/token.v index 079bddde74..f9340bd62d 100644 --- a/vlib/v/token/token.v +++ b/vlib/v/token/token.v @@ -182,19 +182,17 @@ pub enum AtKind { location } -pub const ( - assign_tokens = [Kind.assign, .plus_assign, .minus_assign, .mult_assign, .div_assign, - .xor_assign, .mod_assign, .or_assign, .and_assign, .right_shift_assign, .left_shift_assign, - .unsigned_right_shift_assign] +pub const assign_tokens = [Kind.assign, .plus_assign, .minus_assign, .mult_assign, .div_assign, + .xor_assign, .mod_assign, .or_assign, .and_assign, .right_shift_assign, .left_shift_assign, + .unsigned_right_shift_assign] - valid_at_tokens = ['@VROOT', '@VMODROOT', '@VEXEROOT', '@FN', '@METHOD', '@MOD', '@STRUCT', - '@VEXE', '@FILE', '@LINE', '@COLUMN', '@VHASH', '@VCURRENTHASH', '@VMOD_FILE', '@FILE_LINE', - '@LOCATION'] +pub const valid_at_tokens = ['@VROOT', '@VMODROOT', '@VEXEROOT', '@FN', '@METHOD', '@MOD', '@STRUCT', + '@VEXE', '@FILE', '@LINE', '@COLUMN', '@VHASH', '@VCURRENTHASH', '@VMOD_FILE', '@FILE_LINE', + '@LOCATION'] - token_str = build_token_str() +pub const token_str = build_token_str() - keywords = build_keys() -) +pub const keywords = build_keys() pub const scanner_matcher = new_keywords_matcher_trie[Kind](keywords) diff --git a/vlib/v/util/errors.v b/vlib/v/util/errors.v index dc9e1a72fc..51ae079948 100644 --- a/vlib/v/util/errors.v +++ b/vlib/v/util/errors.v @@ -19,18 +19,14 @@ import v.mathutil as mu // v itself. // error_context_before - how many lines of source context to print before the pointer line // error_context_after - ^^^ same, but after -const ( - error_context_before = 2 - error_context_after = 2 -) +const error_context_before = 2 +const error_context_after = 2 // emanager.support_color - should the error and other messages // have ANSI terminal escape color codes in them. // By default, v tries to autodetect, if the terminal supports colors. // Use -color and -nocolor options to override the detection decision. -pub const ( - emanager = new_error_manager() -) +pub const emanager = new_error_manager() pub struct EManager { mut: diff --git a/vlib/v/util/util.v b/vlib/v/util/util.v index 4386f01202..5c2926451d 100644 --- a/vlib/v/util/util.v +++ b/vlib/v/util/util.v @@ -11,32 +11,27 @@ import v.util.recompilation import runtime // math.bits is needed by strconv.ftoa -pub const ( - builtin_module_parts = ['math.bits', 'strconv', 'dlmalloc', 'strconv.ftoa', 'strings', 'builtin'] - bundle_modules = ['clipboard', 'fontstash', 'gg', 'gx', 'sokol', 'szip', 'ui'] -) +pub const builtin_module_parts = ['math.bits', 'strconv', 'dlmalloc', 'strconv.ftoa', 'strings', + 'builtin'] +pub const bundle_modules = ['clipboard', 'fontstash', 'gg', 'gx', 'sokol', 'szip', 'ui'] -pub const ( - external_module_dependencies_for_tool = { - 'vdoc': ['markdown'] - } -) +pub const external_module_dependencies_for_tool = { + 'vdoc': ['markdown'] +} -const ( - const_tabs = [ - '', - '\t', - '\t\t', - '\t\t\t', - '\t\t\t\t', - '\t\t\t\t\t', - '\t\t\t\t\t\t', - '\t\t\t\t\t\t\t', - '\t\t\t\t\t\t\t\t', - '\t\t\t\t\t\t\t\t\t', - '\t\t\t\t\t\t\t\t\t\t', - ] -) +const const_tabs = [ + '', + '\t', + '\t\t', + '\t\t\t', + '\t\t\t\t', + '\t\t\t\t\t', + '\t\t\t\t\t\t', + '\t\t\t\t\t\t\t', + '\t\t\t\t\t\t\t\t', + '\t\t\t\t\t\t\t\t\t', + '\t\t\t\t\t\t\t\t\t\t', +] pub const nr_jobs = runtime.nr_jobs() @@ -443,9 +438,7 @@ pub fn no_dots(s string) string { return s.replace('.', '__') } -const ( - map_prefix = 'map[string]' -) +const map_prefix = 'map[string]' // no_cur_mod - removes cur_mod. prefix from typename, // but *only* when it is at the start, i.e.: diff --git a/vlib/v2/ast/ast.v b/vlib/v2/ast/ast.v index a640953926..b0c670c044 100644 --- a/vlib/v2/ast/ast.v +++ b/vlib/v2/ast/ast.v @@ -5,10 +5,8 @@ module ast import v2.token -pub const ( - empty_expr = Expr(EmptyExpr(0)) - empty_stmt = Stmt(EmptyStmt(0)) -) +pub const empty_expr = Expr(EmptyExpr(0)) +pub const empty_stmt = Stmt(EmptyStmt(0)) type EmptyExpr = u8 type EmptyStmt = u8 diff --git a/vlib/v2/gen/v/gen.v b/vlib/v2/gen/v/gen.v index e276d0537f..3444ff21c8 100644 --- a/vlib/v2/gen/v/gen.v +++ b/vlib/v2/gen/v/gen.v @@ -8,10 +8,8 @@ import v2.pref import strings import time -const ( - // tabs = build_tabs(16) - tabs = build_tabs(24) -) +// tabs = build_tabs(16) +const tabs = build_tabs(24) struct Gen { pref &pref.Preferences diff --git a/vlib/v2/types/universe.v b/vlib/v2/types/universe.v index 74a7e4b431..5f01e3a7ec 100644 --- a/vlib/v2/types/universe.v +++ b/vlib/v2/types/universe.v @@ -7,101 +7,99 @@ module types // __global universe = init_universe() const universe = init_universe() -const ( - // primitives - bool_ = Primitive{ - props: .boolean +// primitives +const bool_ = Primitive{ + props: .boolean +} +const i8_ = Primitive{ + props: .integer + size: 8 +} +const i16_ = Primitive{ + props: .integer + size: 16 +} +const i32_ = Primitive{ + props: .integer + size: 32 +} +// TODO: represent platform specific size +// will this be calculated at compile time? +const int_ = Primitive{ + props: .integer + // size: 32 +} +const i64_ = Primitive{ + props: .integer + size: 64 +} +const u8_ = Primitive{ + props: .integer | .unsigned + size: 8 +} +// byte_ = Primitive{props: .integer | .unsigned, size: 8} +const byte_ = Alias{ + name: 'byte' + base_type: u8_ +} +const u16_ = Primitive{ + props: .integer | .unsigned + size: 16 +} +const u32_ = Primitive{ + props: .integer | .unsigned + size: 32 +} +const u64_ = Primitive{ + props: .integer | .unsigned + size: 64 +} +const f32_ = Primitive{ + props: .float + size: 32 +} +const f64_ = Primitive{ + props: .float + size: 64 +} +// complex / non primitives +const string_ = String(0) +const chan_ = Channel{} +const char_ = Char(0) +const isize_ = ISize(0) +const usize_ = USize(0) +const rune_ = Rune(0) +const void_ = Void(0) +const nil_ = Nil(0) +const none_ = None(0) +const byteptr_ = Alias{ + name: 'byteptr' + base_type: Pointer{ + base_type: byte_ } - i8_ = Primitive{ - props: .integer - size: 8 +} +const charptr_ = Alias{ + name: 'charptr' + base_type: Pointer{ + base_type: char_ } - i16_ = Primitive{ - props: .integer - size: 16 +} +const voidptr_ = Alias{ + name: 'voidptr' + base_type: Pointer{ + base_type: void_ } - i32_ = Primitive{ - props: .integer - size: 32 - } - // TODO: represent platform specific size - // will this be calculated at compile time? - int_ = Primitive{ - props: .integer - // size: 32 - } - i64_ = Primitive{ - props: .integer - size: 64 - } - u8_ = Primitive{ - props: .integer | .unsigned - size: 8 - } - // byte_ = Primitive{props: .integer | .unsigned, size: 8} - byte_ = Alias{ - name: 'byte' - base_type: u8_ - } - u16_ = Primitive{ - props: .integer | .unsigned - size: 16 - } - u32_ = Primitive{ - props: .integer | .unsigned - size: 32 - } - u64_ = Primitive{ - props: .integer | .unsigned - size: 64 - } - f32_ = Primitive{ - props: .float - size: 32 - } - f64_ = Primitive{ - props: .float - size: 64 - } - // complex / non primitives - string_ = String(0) - chan_ = Channel{} - char_ = Char(0) - isize_ = ISize(0) - usize_ = USize(0) - rune_ = Rune(0) - void_ = Void(0) - nil_ = Nil(0) - none_ = None(0) - byteptr_ = Alias{ - name: 'byteptr' - base_type: Pointer{ - base_type: byte_ - } - } - charptr_ = Alias{ - name: 'charptr' - base_type: Pointer{ - base_type: char_ - } - } - voidptr_ = Alias{ - name: 'voidptr' - base_type: Pointer{ - base_type: void_ - } - } - int_literal_ = Primitive{ - props: .untyped | .integer - } - float_literal_ = Primitive{ - props: .untyped | .float - } - // int_literal_ = IntLiteral(0) - // float_literal_ = FloatLiteral(0) - // TODO: is this what thread should be? - thread_ = Thread{} -) +} +const int_literal_ = Primitive{ + props: .untyped | .integer +} +const float_literal_ = Primitive{ + props: .untyped | .float +} +// int_literal_ = IntLiteral(0) +// float_literal_ = FloatLiteral(0) +// TODO: is this what thread should be? +const thread_ = Thread{} pub fn init_universe() &Scope { // universe scope diff --git a/vlib/vweb/assets/assets.v b/vlib/vweb/assets/assets.v index 6d43a244c6..df363633b5 100644 --- a/vlib/vweb/assets/assets.v +++ b/vlib/vweb/assets/assets.v @@ -6,9 +6,7 @@ import os import time import crypto.md5 -const ( - unknown_asset_type_error = 'vweb.assets: unknown asset type' -) +const unknown_asset_type_error = 'vweb.assets: unknown asset type' pub struct AssetManager { mut: diff --git a/vlib/vweb/csrf/csrf_test.v b/vlib/vweb/csrf/csrf_test.v index da972494ee..84781c14f6 100644 --- a/vlib/vweb/csrf/csrf_test.v +++ b/vlib/vweb/csrf/csrf_test.v @@ -5,25 +5,23 @@ import vweb import vweb.csrf import os -const ( - sport = 12385 - localserver = '127.0.0.1:${sport}' - exit_after_time = 12000 // milliseconds +const sport = 12385 +const localserver = '127.0.0.1:${sport}' +const exit_after_time = 12000 // milliseconds - session_id_cookie_name = 'session_id' - csrf_config = &csrf.CsrfConfig{ - secret: 'my-256bit-secret' - allowed_hosts: ['*'] - session_cookie: session_id_cookie_name - } +const session_id_cookie_name = 'session_id' +const csrf_config = &csrf.CsrfConfig{ + secret: 'my-256bit-secret' + allowed_hosts: ['*'] + session_cookie: session_id_cookie_name +} - allowed_origin = 'example.com' - csrf_config_origin = &csrf.CsrfConfig{ - secret: 'my-256bit-secret' - allowed_hosts: [allowed_origin] - session_cookie: session_id_cookie_name - } -) +const allowed_origin = 'example.com' +const csrf_config_origin = &csrf.CsrfConfig{ + secret: 'my-256bit-secret' + allowed_hosts: [allowed_origin] + session_cookie: session_id_cookie_name +} // Test CSRF functions // ===================================== diff --git a/vlib/vweb/tests/controller_test.v b/vlib/vweb/tests/controller_test.v index 2201132c74..0dee5f308e 100644 --- a/vlib/vweb/tests/controller_test.v +++ b/vlib/vweb/tests/controller_test.v @@ -2,18 +2,17 @@ import os import time import net.http -const ( - sport = 12382 - sport2 = 12383 - localserver = '127.0.0.1:${sport}' - exit_after_time = 12000 // milliseconds - vexe = os.getenv('VEXE') - vweb_logfile = os.getenv('VWEB_LOGFILE') - vroot = os.dir(vexe) - serverexe = os.join_path(os.cache_dir(), 'controller_test_server.exe') - tcp_r_timeout = 30 * time.second - tcp_w_timeout = 30 * time.second -) +const sport = 12382 +const sport2 = 12383 +const localserver = '127.0.0.1:${sport}' +const exit_after_time = 12000 // milliseconds + +const vexe = os.getenv('VEXE') +const vweb_logfile = os.getenv('VWEB_LOGFILE') +const vroot = os.dir(vexe) +const serverexe = os.join_path(os.cache_dir(), 'controller_test_server.exe') +const tcp_r_timeout = 30 * time.second +const tcp_w_timeout = 30 * time.second // setup of vweb webserver fn testsuite_begin() { diff --git a/vlib/vweb/tests/middleware_test.v b/vlib/vweb/tests/middleware_test.v index fd5fde19f5..cf26b83304 100644 --- a/vlib/vweb/tests/middleware_test.v +++ b/vlib/vweb/tests/middleware_test.v @@ -5,17 +5,16 @@ import net import net.http import io -const ( - sport = 12381 - localserver = '127.0.0.1:${sport}' - exit_after_time = 12000 // milliseconds - vexe = os.getenv('VEXE') - vweb_logfile = os.getenv('VWEB_LOGFILE') - vroot = os.dir(vexe) - serverexe = os.join_path(os.cache_dir(), 'middleware_test_server.exe') - tcp_r_timeout = 30 * time.second - tcp_w_timeout = 30 * time.second -) +const sport = 12381 +const localserver = '127.0.0.1:${sport}' +const exit_after_time = 12000 // milliseconds + +const vexe = os.getenv('VEXE') +const vweb_logfile = os.getenv('VWEB_LOGFILE') +const vroot = os.dir(vexe) +const serverexe = os.join_path(os.cache_dir(), 'middleware_test_server.exe') +const tcp_r_timeout = 30 * time.second +const tcp_w_timeout = 30 * time.second // setup of vweb webserver fn testsuite_begin() { diff --git a/vlib/vweb/tests/vweb_test.v b/vlib/vweb/tests/vweb_test.v index 977a758046..4d82c7fb12 100644 --- a/vlib/vweb/tests/vweb_test.v +++ b/vlib/vweb/tests/vweb_test.v @@ -5,17 +5,16 @@ import net import net.http import io -const ( - sport = 12380 - localserver = '127.0.0.1:${sport}' - exit_after_time = 12000 // milliseconds - vexe = os.getenv('VEXE') - vweb_logfile = os.getenv('VWEB_LOGFILE') - vroot = os.dir(vexe) - serverexe = os.join_path(os.cache_dir(), 'vweb_test_server.exe') - tcp_r_timeout = 30 * time.second - tcp_w_timeout = 30 * time.second -) +const sport = 12380 +const localserver = '127.0.0.1:${sport}' +const exit_after_time = 12000 // milliseconds + +const vexe = os.getenv('VEXE') +const vweb_logfile = os.getenv('VWEB_LOGFILE') +const vroot = os.dir(vexe) +const serverexe = os.join_path(os.cache_dir(), 'vweb_test_server.exe') +const tcp_r_timeout = 30 * time.second +const tcp_w_timeout = 30 * time.second // setup of vweb webserver fn testsuite_begin() { diff --git a/vlib/vweb/tests/vweb_test_server.v b/vlib/vweb/tests/vweb_test_server.v index c29432d214..627e929d9b 100644 --- a/vlib/vweb/tests/vweb_test_server.v +++ b/vlib/vweb/tests/vweb_test_server.v @@ -4,9 +4,7 @@ import os import vweb import time -const ( - known_users = ['bilbo', 'kent'] -) +const known_users = ['bilbo', 'kent'] struct App { vweb.Context diff --git a/vlib/vweb/vweb.v b/vlib/vweb/vweb.v index f82654a394..a54d6a246e 100644 --- a/vlib/vweb/vweb.v +++ b/vlib/vweb/vweb.v @@ -22,126 +22,124 @@ pub type RawHtml = string @[noinit] pub struct Result {} -pub const ( - methods_with_form = [http.Method.post, .put, .patch] - headers_close = http.new_custom_header_from_map({ - 'Server': 'VWeb' - http.CommonHeader.connection.str(): 'close' - }) or { panic('should never fail') } +pub const methods_with_form = [http.Method.post, .put, .patch] +pub const headers_close = http.new_custom_header_from_map({ + 'Server': 'VWeb' + http.CommonHeader.connection.str(): 'close' +}) or { panic('should never fail') } - http_302 = http.new_response( - status: .found - body: '302 Found' - header: headers_close - ) - http_400 = http.new_response( - status: .bad_request - body: '400 Bad Request' - header: http.new_header( - key: .content_type - value: 'text/plain' - ).join(headers_close) - ) - http_404 = http.new_response( - status: .not_found - body: '404 Not Found' - header: http.new_header( - key: .content_type - value: 'text/plain' - ).join(headers_close) - ) - http_500 = http.new_response( - status: .internal_server_error - body: '500 Internal Server Error' - header: http.new_header( - key: .content_type - value: 'text/plain' - ).join(headers_close) - ) - mime_types = { - '.aac': 'audio/aac' - '.abw': 'application/x-abiword' - '.arc': 'application/x-freearc' - '.avi': 'video/x-msvideo' - '.azw': 'application/vnd.amazon.ebook' - '.bin': 'application/octet-stream' - '.bmp': 'image/bmp' - '.bz': 'application/x-bzip' - '.bz2': 'application/x-bzip2' - '.cda': 'application/x-cdf' - '.csh': 'application/x-csh' - '.css': 'text/css' - '.csv': 'text/csv' - '.doc': 'application/msword' - '.docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' - '.eot': 'application/vnd.ms-fontobject' - '.epub': 'application/epub+zip' - '.gz': 'application/gzip' - '.gif': 'image/gif' - '.htm': 'text/html' - '.html': 'text/html' - '.ico': 'image/vnd.microsoft.icon' - '.ics': 'text/calendar' - '.jar': 'application/java-archive' - '.jpeg': 'image/jpeg' - '.jpg': 'image/jpeg' - '.js': 'text/javascript' - '.json': 'application/json' - '.jsonld': 'application/ld+json' - '.md': 'text/markdown' - '.mid': 'audio/midi audio/x-midi' - '.midi': 'audio/midi audio/x-midi' - '.mjs': 'text/javascript' - '.mp3': 'audio/mpeg' - '.mp4': 'video/mp4' - '.mpeg': 'video/mpeg' - '.mpkg': 'application/vnd.apple.installer+xml' - '.odp': 'application/vnd.oasis.opendocument.presentation' - '.ods': 'application/vnd.oasis.opendocument.spreadsheet' - '.odt': 'application/vnd.oasis.opendocument.text' - '.oga': 'audio/ogg' - '.ogv': 'video/ogg' - '.ogx': 'application/ogg' - '.opus': 'audio/opus' - '.otf': 'font/otf' - '.png': 'image/png' - '.pdf': 'application/pdf' - '.php': 'application/x-httpd-php' - '.ppt': 'application/vnd.ms-powerpoint' - '.pptx': 'application/vnd.openxmlformats-officedocument.presentationml.presentation' - '.rar': 'application/vnd.rar' - '.rtf': 'application/rtf' - '.sh': 'application/x-sh' - '.svg': 'image/svg+xml' - '.swf': 'application/x-shockwave-flash' - '.tar': 'application/x-tar' - '.toml': 'application/toml' - '.tif': 'image/tiff' - '.tiff': 'image/tiff' - '.ts': 'video/mp2t' - '.ttf': 'font/ttf' - '.txt': 'text/plain' - '.vsd': 'application/vnd.visio' - '.wasm': 'application/wasm' - '.wav': 'audio/wav' - '.weba': 'audio/webm' - '.webm': 'video/webm' - '.webp': 'image/webp' - '.woff': 'font/woff' - '.woff2': 'font/woff2' - '.xhtml': 'application/xhtml+xml' - '.xls': 'application/vnd.ms-excel' - '.xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' - '.xml': 'application/xml' - '.xul': 'application/vnd.mozilla.xul+xml' - '.zip': 'application/zip' - '.3gp': 'video/3gpp' - '.3g2': 'video/3gpp2' - '.7z': 'application/x-7z-compressed' - } - max_http_post_size = 1024 * 1024 - default_port = 8080 +pub const http_302 = http.new_response( + status: .found + body: '302 Found' + header: headers_close ) +pub const http_400 = http.new_response( + status: .bad_request + body: '400 Bad Request' + header: http.new_header( + key: .content_type + value: 'text/plain' + ).join(headers_close) +) +pub const http_404 = http.new_response( + status: .not_found + body: '404 Not Found' + header: http.new_header( + key: .content_type + value: 'text/plain' + ).join(headers_close) +) +pub const http_500 = http.new_response( + status: .internal_server_error + body: '500 Internal Server Error' + header: http.new_header( + key: .content_type + value: 'text/plain' + ).join(headers_close) +) +pub const mime_types = { + '.aac': 'audio/aac' + '.abw': 'application/x-abiword' + '.arc': 'application/x-freearc' + '.avi': 'video/x-msvideo' + '.azw': 'application/vnd.amazon.ebook' + '.bin': 'application/octet-stream' + '.bmp': 'image/bmp' + '.bz': 'application/x-bzip' + '.bz2': 'application/x-bzip2' + '.cda': 'application/x-cdf' + '.csh': 'application/x-csh' + '.css': 'text/css' + '.csv': 'text/csv' + '.doc': 'application/msword' + '.docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' + '.eot': 'application/vnd.ms-fontobject' + '.epub': 'application/epub+zip' + '.gz': 'application/gzip' + '.gif': 'image/gif' + '.htm': 'text/html' + '.html': 'text/html' + '.ico': 'image/vnd.microsoft.icon' + '.ics': 'text/calendar' + '.jar': 'application/java-archive' + '.jpeg': 'image/jpeg' + '.jpg': 'image/jpeg' + '.js': 'text/javascript' + '.json': 'application/json' + '.jsonld': 'application/ld+json' + '.md': 'text/markdown' + '.mid': 'audio/midi audio/x-midi' + '.midi': 'audio/midi audio/x-midi' + '.mjs': 'text/javascript' + '.mp3': 'audio/mpeg' + '.mp4': 'video/mp4' + '.mpeg': 'video/mpeg' + '.mpkg': 'application/vnd.apple.installer+xml' + '.odp': 'application/vnd.oasis.opendocument.presentation' + '.ods': 'application/vnd.oasis.opendocument.spreadsheet' + '.odt': 'application/vnd.oasis.opendocument.text' + '.oga': 'audio/ogg' + '.ogv': 'video/ogg' + '.ogx': 'application/ogg' + '.opus': 'audio/opus' + '.otf': 'font/otf' + '.png': 'image/png' + '.pdf': 'application/pdf' + '.php': 'application/x-httpd-php' + '.ppt': 'application/vnd.ms-powerpoint' + '.pptx': 'application/vnd.openxmlformats-officedocument.presentationml.presentation' + '.rar': 'application/vnd.rar' + '.rtf': 'application/rtf' + '.sh': 'application/x-sh' + '.svg': 'image/svg+xml' + '.swf': 'application/x-shockwave-flash' + '.tar': 'application/x-tar' + '.toml': 'application/toml' + '.tif': 'image/tiff' + '.tiff': 'image/tiff' + '.ts': 'video/mp2t' + '.ttf': 'font/ttf' + '.txt': 'text/plain' + '.vsd': 'application/vnd.visio' + '.wasm': 'application/wasm' + '.wav': 'audio/wav' + '.weba': 'audio/webm' + '.webm': 'video/webm' + '.webp': 'image/webp' + '.woff': 'font/woff' + '.woff2': 'font/woff2' + '.xhtml': 'application/xhtml+xml' + '.xls': 'application/vnd.ms-excel' + '.xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' + '.xml': 'application/xml' + '.xul': 'application/vnd.mozilla.xul+xml' + '.zip': 'application/zip' + '.3gp': 'video/3gpp' + '.3g2': 'video/3gpp2' + '.7z': 'application/x-7z-compressed' +} +pub const max_http_post_size = 1024 * 1024 +pub const default_port = 8080 // The Context struct represents the Context which hold the HTTP request and response. // It has fields for the query, form, files. diff --git a/vlib/x/json2/any_test.v b/vlib/x/json2/any_test.v index 7a475c38fa..644c104bf1 100644 --- a/vlib/x/json2/any_test.v +++ b/vlib/x/json2/any_test.v @@ -1,20 +1,18 @@ import x.json2 as json -const ( - sample_data = { - 'int': json.Any(int(1)) - 'i64': json.Any(i64(128)) - 'f32': json.Any(f32(2.0)) - 'f64': json.Any(f64(1.283)) - 'bool': json.Any(false) - 'str': json.Any('test') - 'null': json.Any(json.null) - 'arr': json.Any([json.Any('lol')]) - 'obj': json.Any({ - 'foo': json.Any(10) - }) - } -) +const sample_data = { + 'int': json.Any(int(1)) + 'i64': json.Any(i64(128)) + 'f32': json.Any(f32(2.0)) + 'f64': json.Any(f64(1.283)) + 'bool': json.Any(false) + 'str': json.Any('test') + 'null': json.Any(json.null) + 'arr': json.Any([json.Any('lol')]) + 'obj': json.Any({ + 'foo': json.Any(10) + }) +} fn is_null(f json.Any) bool { match f { diff --git a/vlib/x/json2/scanner.v b/vlib/x/json2/scanner.v index 8fb82a58ed..a24220c129 100644 --- a/vlib/x/json2/scanner.v +++ b/vlib/x/json2/scanner.v @@ -42,31 +42,29 @@ pub fn (t Token) full_col() int { return t.col + t.lit.len } -const ( - // list of characters commonly used in JSON. - char_list = [`{`, `}`, `[`, `]`, `,`, `:`] - // list of newlines to check when moving to a new position. - newlines = [`\r`, `\n`, `\t`] - // list of escapable that needs to be escaped inside a JSON string. - // double quotes and forward slashes are excluded intentionally since - // they have their own separate checks for it in order to pass the - // JSON test suite (https://github.com/nst/JSONTestSuite/). - important_escapable_chars = [`\b`, `\f`, `\n`, `\r`, `\t`] - // list of valid unicode escapes aside from \u{4-hex digits} - valid_unicode_escapes = [`b`, `f`, `n`, `r`, `t`, `\\`, `"`, `/`] - // used for transforming escapes into valid unicode (eg. n => \n) - unicode_transform_escapes = { - 98: `\b` - 102: `\f` - 110: `\n` - 114: `\r` - 116: `\t` - 92: `\\` - 34: `"` - 47: `/` - } - exp_signs = [u8(`-`), `+`] -) +// list of characters commonly used in JSON. +const char_list = [`{`, `}`, `[`, `]`, `,`, `:`] +// list of newlines to check when moving to a new position. +const newlines = [`\r`, `\n`, `\t`] +// list of escapable that needs to be escaped inside a JSON string. +// double quotes and forward slashes are excluded intentionally since +// they have their own separate checks for it in order to pass the +// JSON test suite (https://github.com/nst/JSONTestSuite/). +const important_escapable_chars = [`\b`, `\f`, `\n`, `\r`, `\t`] +// list of valid unicode escapes aside from \u{4-hex digits} +const valid_unicode_escapes = [`b`, `f`, `n`, `r`, `t`, `\\`, `"`, `/`] +// used for transforming escapes into valid unicode (eg. n => \n) +const unicode_transform_escapes = { + 98: `\b` + 102: `\f` + 110: `\n` + 114: `\r` + 116: `\t` + 92: `\\` + 34: `"` + 47: `/` +} +const exp_signs = [u8(`-`), `+`] // move_pos proceeds to the next position. fn (mut s Scanner) move() { diff --git a/vlib/x/ttf/ttf.v b/vlib/x/ttf/ttf.v index f2cdc00e47..42b483d482 100644 --- a/vlib/x/ttf/ttf.v +++ b/vlib/x/ttf/ttf.v @@ -130,10 +130,9 @@ mut: } // type of glyph -const ( - g_type_simple = u16(1) // simple type - g_type_complex = u16(2) // compound type -) +const g_type_simple = u16(1) // simple type + +const g_type_complex = u16(2) pub struct Glyph { pub mut: @@ -348,14 +347,12 @@ pub fn (mut tf TTF_File) read_glyph(index u16) Glyph { return tmp_glyph } -const ( - tfk_on_curve = 1 - tfk_x_is_byte = 2 - tfk_y_is_byte = 4 - tfk_repeat = 8 - tfk_x_delta = 16 - tfk_y_delta = 32 -) +const tfk_on_curve = 1 +const tfk_x_is_byte = 2 +const tfk_y_is_byte = 4 +const tfk_repeat = 8 +const tfk_x_delta = 16 +const tfk_y_delta = 32 fn (mut tf TTF_File) read_simple_glyph(mut in_glyph Glyph) { if in_glyph.number_of_contours == 0 { @@ -446,19 +443,17 @@ fn (mut tf TTF_File) read_simple_glyph(mut in_glyph Glyph) { in_glyph.valid_glyph = true } -const ( - tfkc_arg_1_and_2_are_words = 1 - tfkc_args_are_xy_values = 2 - tfkc_round_xy_to_grid = 4 - tfkc_we_have_a_scale = 8 - // reserved = 16 - tfkc_more_components = 32 - tfkc_we_have_an_x_and_y_scale = 64 - tfkc_we_have_a_two_by_two = 128 - tfkc_we_have_instructions = 256 - tfkc_use_my_metrics = 512 - tfkc_overlap_component = 1024 -) +const tfkc_arg_1_and_2_are_words = 1 +const tfkc_args_are_xy_values = 2 +const tfkc_round_xy_to_grid = 4 +const tfkc_we_have_a_scale = 8 +// reserved = 16 +const tfkc_more_components = 32 +const tfkc_we_have_an_x_and_y_scale = 64 +const tfkc_we_have_a_two_by_two = 128 +const tfkc_we_have_instructions = 256 +const tfkc_use_my_metrics = 512 +const tfkc_overlap_component = 1024 struct Component { mut: