const (
emanager = new_error_manager()
)
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.
const (
v_version = '0.2.2'
)
const (
builtin_module_parts = ['math.bits', 'strconv', 'strconv.ftoa', 'hash', 'strings', 'builtin']
bundle_modules = ['clipboard', 'fontstash', 'gg', 'gx', 'sokol', 'szip', 'ui']
)
math.bits is needed by strconv.ftoa
const (
external_module_dependencies_for_tool = {
'vdoc': ['markdown']
}
)
fn args_quote_paths(args []string) string
fn bold(msg string) string
fn cescaped_path(s string) string
fn check_module_is_installed(modulename string, is_verbose bool) ?bool
fn color_compare_files(diff_cmd string, file1 string, file2 string) string
fn color_compare_strings(diff_cmd string, expected string, found string) string
fn contains_capital(s string) bool
fn ensure_modules_for_all_tools_are_installed(is_verbose bool)
fn filepath_pos_to_source_and_column(filepath string, pos token.Position) (string, int)
fn find_working_diff_command() ?string
iterates through a list of known diff cli commands and returns it with basic options
fn formatted_error(kind string, omsg string, filepath string, pos token.Position) string
formatted_error - kind
may be 'error' or 'warn'
fn full_hash() string
fn full_v_version(is_verbose bool) string
full_v_version() returns the full version of the V compiler
fn get_vtmp_folder() string
fn githash(should_get_from_filesystem bool) string
githash(x) returns the current git commit hash. When x is false, it is very fast - it just returns a predefined C constant. When x is true, it tries to get the current commit hash, by parsing the relevant files in the .git/ folder, or if that is not possible for example when using a V from a V binary release, that does not have .git/ defaults to getting the predefined C constant again. NB: githash(true) must be called only when v detects that it builds itself. For all other programs, githash(false) should be used.
fn good_type_name(s string) bool
HTTPRequest bad HttpRequest good
fn imax(a int, b int) int
fn imin(a int, b int) int
fn is_func_char(c byte) bool
fn is_generic_type_name(name string) bool
is_generic_type_name returns true if the current token is a generic type name.
fn is_name_char(c byte) bool
fn is_nl(c byte) bool
fn join_env_vflags_and_os_args() []string
fn launch_tool(is_verbose bool, tool_name string, args []string)
launch_tool - starts a V tool in a separate process, passing it the args
. All V tools are located in the cmd/tools folder, in files or folders prefixed by the letter v
, followed by the tool name, i.e. cmd/tools/vdoc/
or cmd/tools/vpm.v
. The folder variant is suitable for larger and more complex tools, like v doc
, because it provides you the ability to split their source in separate .v files, organized by topic, as well as have resources like static css/text/js files, that the tools can use. launch_tool uses a timestamp based detection mechanism, so that after v self
, each tool will be recompiled too, before it is used, which guarantees that it would be up to date with V itself. That mechanism can be disabled by package managers by creating/touching a small cmd/tools/.disable_autorecompilation
file, OR by changing the timestamps of all executables in cmd/tools to be < 1024 seconds (in unix time).
fn mod_path_to_full_name(mod string, path string) ?string
TODO: * properly define module location / v.mod rules * if possible split this function in two, one which gets the parent module path and another which turns it into the full name * create shared logic between these fns and builder.find_module_path
fn new_error_manager() &EManager
fn new_suggestion(wanted string, possibilities []string) Suggestion
fn new_timers(should_print bool) &Timers
fn no_cur_mod(typename string, cur_mod string) string
no_cur_mod - removes cur_mod. prefix from typename, but only when it is at the start, i.e.: no_cur_mod('vproto.Abdcdef', 'proto') == 'vproto.Abdcdef' even though proto. is a substring
fn no_dots(s string) string
fn path_of_executable(path string) string
fn prepare_tool_when_needed(source_name string)
fn qualify_import(pref &pref.Preferences, mod string, file_path string) string
fn qualify_module(mod string, file_path string) string
fn quote_path(s string) string
fn read_file(file_path string) ?string
fn recompile_file(vexe string, file string)
fn replace_op(s string) string
fn resolve_vroot(str string, dir string) ?string
fn set_vroot_folder(vroot_path string)
fn short_module_name(name string) string
fn should_bundle_module(mod string) bool
fn should_recompile_tool(vexe string, tool_source string, tool_name string, tool_exe string) bool
NB: should_recompile_tool/4 compares unix timestamps that have 1 second resolution That means that a tool can get recompiled twice, if called in short succession. TODO: use a nanosecond mtime timestamp, if available.
fn skip_bom(file_content string) string
fn smart_quote(str string, raw bool) string
fn source_context(kind string, source string, column int, pos token.Position) []string
fn strip_main_name(name string) string
fn strip_mod_name(name string) string
fn verror(kind string, s string)
fn vhash() string
vhash() returns the build string C.V_COMMIT_HASH . See cmd/tools/gen_vc.v .
fn vlines_escape_path(path string, ccompiler string) string
fn (mut s Suggestion) add(val string)
fn (mut s Suggestion) add_many(many []string)
fn (mut s Suggestion) sort()
fn (s Suggestion) say(msg string) string
struct EManager {
mut:
support_color bool
}
fn (e &EManager) set_support_color(b bool)
struct Timers {
pub mut:
swatches map[string]time.StopWatch
should_print bool
}
fn (mut t Timers) start(name string)
fn (mut t Timers) measure(name string) i64
fn (mut t Timers) message(name string) string
fn (mut t Timers) show(label string)
fn (mut t Timers) dump_all()