mirror of
https://github.com/vlang/v.git
synced 2025-09-10 07:47:20 -04:00
help: make find vlib/v/help/ -name *.txt |xargs v check-md
pass as well
This commit is contained in:
parent
29b035bd01
commit
30dbda6e65
@ -34,13 +34,18 @@ see also `v help build`.
|
|||||||
slightly (~10% for gcc), but sometimes provides better error diagnosis.
|
slightly (~10% for gcc), but sometimes provides better error diagnosis.
|
||||||
|
|
||||||
-cmain <MainFunctionName>
|
-cmain <MainFunctionName>
|
||||||
Useful with framework like code, that uses macros to re-define `main`, like SDL2 does for example.
|
Useful with framework like code, that uses macros to re-define `main`,
|
||||||
|
like SDL2 does for example.
|
||||||
With that option, V will always generate:
|
With that option, V will always generate:
|
||||||
`int MainFunctionName(int ___argc, char** ___argv) {` , for the program entry point function, *no matter* the OS.
|
`int MainFunctionName(int ___argc, char** ___argv) {`
|
||||||
|
... for the program entry point function, *no matter* the OS.
|
||||||
Without it, on non Windows systems, it will generate:
|
Without it, on non Windows systems, it will generate:
|
||||||
`int main(int ___argc, char** ___argv) {`
|
`int main(int ___argc, char** ___argv) {`
|
||||||
... and on Windows, it will generate:
|
... and on Windows, it will generate:
|
||||||
a) `int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, LPWSTR cmd_line, int show_cmd){`
|
a) `int WINAPI wWinMain( HINSTANCE instance,
|
||||||
|
HINSTANCE prev_instance,
|
||||||
|
LPWSTR cmd_line,
|
||||||
|
int show_cmd){`
|
||||||
when you are compiling applications that `import gg`.
|
when you are compiling applications that `import gg`.
|
||||||
... or it will generate:
|
... or it will generate:
|
||||||
b) `int wmain(int ___argc, wchar_t* ___argv[], wchar_t* ___envp[]){`
|
b) `int wmain(int ___argc, wchar_t* ___argv[], wchar_t* ___envp[]){`
|
||||||
@ -61,10 +66,12 @@ see also `v help build`.
|
|||||||
bare_eprint(buf &byte, len u64)
|
bare_eprint(buf &byte, len u64)
|
||||||
Print len characters from the buffer pointed to by buf to stderr.
|
Print len characters from the buffer pointed to by buf to stderr.
|
||||||
bare_panic(msg string)
|
bare_panic(msg string)
|
||||||
Print "V panic: " + msg, along with an optional backtrace and/or the V commit hash, and then exit.
|
Print "V panic: " + msg, along with an optional backtrace
|
||||||
|
and/or the V commit hash, and then exit.
|
||||||
[export: 'malloc']
|
[export: 'malloc']
|
||||||
__malloc(n usize) &C.void
|
__malloc(n usize) &C.void
|
||||||
Allocates n bytes of memory and returns the pointer to the first byte
|
Allocates n bytes of memory and returns the pointer to the first
|
||||||
|
byte.
|
||||||
[export: 'free']
|
[export: 'free']
|
||||||
__free(ptr &C.void)
|
__free(ptr &C.void)
|
||||||
Free the block of memory ptr allocated by malloc.
|
Free the block of memory ptr allocated by malloc.
|
||||||
@ -222,7 +229,8 @@ see also `v help build`.
|
|||||||
|
|
||||||
-no-preludes
|
-no-preludes
|
||||||
Prevents V from generating a prelude in generated .c files, useful for freestanding targets
|
Prevents V from generating a prelude in generated .c files, useful for freestanding targets
|
||||||
where eg. you replace C standard library with your own, or some definitions/headers break something.
|
where eg. you replace C standard library with your own, or some definitions/headers
|
||||||
|
break something.
|
||||||
|
|
||||||
-custom-prelude <path>
|
-custom-prelude <path>
|
||||||
Useful for similar use-case as above option, except it replaces V-generated prelude with
|
Useful for similar use-case as above option, except it replaces V-generated prelude with
|
||||||
|
@ -15,7 +15,8 @@ pick another:
|
|||||||
For more general build help, see also `v help build`.
|
For more general build help, see also `v help build`.
|
||||||
|
|
||||||
# Interfacing the Javascript Backend code generation, passing options to it:
|
# Interfacing the Javascript Backend code generation, passing options to it:
|
||||||
-es5 Compile V to ES5 compatible code possibly shrinking output. Note that this flag might limit some types capabilities.
|
-es5 Compile V to ES5 compatible code possibly shrinking output.
|
||||||
|
Note that this flag might limit some types capabilities.
|
||||||
-prod
|
-prod
|
||||||
Do not create any JS Doc comments
|
Do not create any JS Doc comments
|
||||||
|
|
||||||
|
@ -20,10 +20,13 @@ For more general build help, see also `v help build`.
|
|||||||
Change the target WebAssembly execution environment that V compiles for.
|
Change the target WebAssembly execution environment that V compiles for.
|
||||||
|
|
||||||
The `wasi` target is the default execution environment.
|
The `wasi` target is the default execution environment.
|
||||||
When targeting WASI, the generated WebAssembly module can be run in a variety of environments that support the WASI specification.
|
When targeting WASI, the generated WebAssembly module can be run in a variety
|
||||||
WASI provides a standardized interface to interact with the host operating system, allowing WebAssembly modules to perform tasks like file I/O, networking, and more.
|
of environments that support the WASI specification.
|
||||||
|
WASI provides a standardized interface to interact with the host operating system,
|
||||||
|
allowing WebAssembly modules to perform tasks like file I/O, networking, and more.
|
||||||
The specific version of the WASI specification targeted by V is 'wasi_snapshot_preview1'.
|
The specific version of the WASI specification targeted by V is 'wasi_snapshot_preview1'.
|
||||||
|
|
||||||
The `browser` target is an experimental environment that compiles for a stripped down builtin, for use in browsers.
|
The `browser` target is an experimental environment that compiles for a stripped down
|
||||||
The produced WebAssembly module will have functions exported that are `pub` and inside the `module main`.
|
builtin, for use in browsers. The produced WebAssembly module will have functions
|
||||||
See `examples/wasm/mandelbrot` for an example.
|
exported that are `pub` and inside the `module main`. See `examples/wasm/mandelbrot`
|
||||||
|
for an example.
|
||||||
|
@ -39,13 +39,16 @@ NB: the build flags are shared with the run command too:
|
|||||||
Current list of supported backends:
|
Current list of supported backends:
|
||||||
* `c` (default) - V outputs C source code, which is then passed to a C compiler.
|
* `c` (default) - V outputs C source code, which is then passed to a C compiler.
|
||||||
* `go` - V outputs Go source code, which is then passed to a Go compiler.
|
* `go` - V outputs Go source code, which is then passed to a Go compiler.
|
||||||
* `interpret` - V will interpret the V program directly, instead of compiling it first. Same as `v interpret file.v`.
|
* `interpret` - V will interpret the V program directly, instead of compiling it first.
|
||||||
|
Same as `v interpret file.v`.
|
||||||
* `js` - V outputs JS source code which can be passed to NodeJS to be ran.
|
* `js` - V outputs JS source code which can be passed to NodeJS to be ran.
|
||||||
* `js_browser` - V outputs JS source code ready for the browser.
|
* `js_browser` - V outputs JS source code ready for the browser.
|
||||||
* `js_node` - V outputs JS source code to run with nodejs.
|
* `js_node` - V outputs JS source code to run with nodejs.
|
||||||
* `js_freestanding` - V outputs JS source code with no hard runtime dependency.
|
* `js_freestanding` - V outputs JS source code with no hard runtime dependency.
|
||||||
* `native` - V outputs a native executable directly (see -arch x64|arm64 and -os linux|macos) (EXPERIMENTAL).
|
* `native` - V outputs a native executable directly.
|
||||||
* `wasm` - V outputs a WebAssembly module directly (see -os wasi|browser) (EXPERIMENTAL).
|
(see -arch x64|arm64 and -os linux|macos) (EXPERIMENTAL).
|
||||||
|
* `wasm` - V outputs a WebAssembly module directly
|
||||||
|
(see -os wasi|browser) (EXPERIMENTAL).
|
||||||
|
|
||||||
-d <flag>[=<value>], -define <flag>[=<value>]
|
-d <flag>[=<value>], -define <flag>[=<value>]
|
||||||
Define the provided flag.
|
Define the provided flag.
|
||||||
@ -111,7 +114,8 @@ NB: the build flags are shared with the run command too:
|
|||||||
|
|
||||||
NB: You can also select specific functions for profiling. For example:
|
NB: You can also select specific functions for profiling. For example:
|
||||||
v -profile-fns println,i64_str -profile - run examples/hanoi.v
|
v -profile-fns println,i64_str -profile - run examples/hanoi.v
|
||||||
In this case, the profile counters will be updated only for them, *and* for the functions that they call.
|
In this case, the profile counters will be updated only for them,
|
||||||
|
*and* for the functions that they call.
|
||||||
The profile result (after the program finishes), will look similar to this:
|
The profile result (after the program finishes), will look similar to this:
|
||||||
127 0.721ms 5680ns println
|
127 0.721ms 5680ns println
|
||||||
127 0.693ms 5456ns _writeln_to_fd
|
127 0.693ms 5456ns _writeln_to_fd
|
||||||
|
@ -7,7 +7,8 @@ Commonly Used Commands:
|
|||||||
fmt Formats the given V source files or recursively formats all files in the directory,
|
fmt Formats the given V source files or recursively formats all files in the directory,
|
||||||
then prints their formatted source to stdout.
|
then prints their formatted source to stdout.
|
||||||
|
|
||||||
missdoc Prints all V functions in .v files under PATH/, that do not yet have documentation comments.
|
missdoc Prints all V functions in .v files under PATH/, that do not yet have documentation
|
||||||
|
comments.
|
||||||
|
|
||||||
repl Run the V REPL
|
repl Run the V REPL
|
||||||
|
|
||||||
|
@ -2,7 +2,8 @@ Other less frequently used commands supported by V include:
|
|||||||
|
|
||||||
ast Generate a json representation of the AST for a given .v file.
|
ast Generate a json representation of the AST for a given .v file.
|
||||||
|
|
||||||
bug Post an issue on the V's issue tracker, including the failing program, and some diagnostic information.
|
bug Post an issue on the V's issue tracker, including the failing program,
|
||||||
|
and some diagnostic information.
|
||||||
|
|
||||||
bin2v Convert a binary file to a v source file,
|
bin2v Convert a binary file to a v source file,
|
||||||
that can be later embedded in a module or program.
|
that can be later embedded in a module or program.
|
||||||
@ -42,4 +43,5 @@ Other less frequently used commands supported by V include:
|
|||||||
test-self Test if V is working properly by running all tests, including the compiler ones.
|
test-self Test if V is working properly by running all tests, including the compiler ones.
|
||||||
NB: this can take 1-2 minutes to run.
|
NB: this can take 1-2 minutes to run.
|
||||||
|
|
||||||
wipe-cache Remove the V cache folder. Useful for cleaning the cache, and guaranteeing a clean build.
|
wipe-cache Remove the V cache folder. Useful for cleaning the cache, and guaranteeing a
|
||||||
|
clean build.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user