fmt: fix and simplify align of struct fields (#21995)

This commit is contained in:
yuyi 2024-08-06 01:23:39 +08:00 committed by GitHub
parent 576a0abcc7
commit ddb6685d8a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
139 changed files with 553 additions and 519 deletions

View file

@ -155,18 +155,18 @@ jobs:
echo "Build v-analyzer release"
v build.vsh release
- name: Format vlang/v-analyzer
if: ${{ !cancelled() && steps.build.outcome == 'success' }}
run: |
cd /tmp/v-analyzer
set +e
v fmt -c .
exit_code=$?
if [[ $exit_code -ne 0 && $exit_code -ne 5 ]]; then
# Don't fail if there are only internal errors (exit code 5).
v fmt -diff .
exit 1
fi
# - name: Format vlang/v-analyzer
# if: ${{ !cancelled() && steps.build.outcome == 'success' }}
# run: |
# cd /tmp/v-analyzer
# set +e
# v fmt -c .
# exit_code=$?
# if [[ $exit_code -ne 0 && $exit_code -ne 5 ]]; then
# # Don't fail if there are only internal errors (exit code 5).
# v fmt -diff .
# exit 1
# fi
- name: Build vlang/go2v
if: ${{ !cancelled() && steps.build.outcome == 'success' && matrix.os != 'macos-14' }}

View file

@ -87,9 +87,9 @@ pub mut:
show_stats bool
show_asserts bool
progress_mode bool
root_relative bool // used by CI runs, so that the output is stable everywhere
root_relative bool // used by CI runs, so that the output is stable everywhere
nmessages chan LogMessage // many publishers, single consumer/printer
nmessage_idx int // currently printed message index
nmessage_idx int // currently printed message index
failed_cmds shared []string
reporter Reporter = Reporter(NormalReporter{})
hash string // used as part of the name of the temporary directory created for tests, to ease cleanup

View file

@ -121,8 +121,8 @@ pub fn clone_or_pull(remote_git_url string, local_worktree_path string) {
pub struct VGitContext {
pub:
cc string = 'cc' // what compiler to use
workdir string = '/tmp' // the base working folder
cc string = 'cc' // what compiler to use
workdir string = '/tmp' // the base working folder
commit_v string = 'master' // the commit-ish that needs to be prepared
path_v string // where is the local working copy v repo
path_vc string // where is the local working copy vc repo

View file

@ -35,11 +35,11 @@ mut:
path_vc string // the full path to the vc folder inside workdir.
cmd_to_run string // the command that you want to run *in* the oldv repo
cc string = 'cc' // the C compiler to use for bootstrapping.
cleanup bool // should the tool run a cleanup first
use_cache bool // use local cached copies for --vrepo and --vcrepo in
fresh_tcc bool // do use `make fresh_tcc`
is_bisect bool // bisect mode; usage: `cmd/tools/oldv -b -c './v run bug.v'`
show_vccommit bool // show the V and VC commits, corresponding to the V commit-ish, that can be used to build V
cleanup bool // should the tool run a cleanup first
use_cache bool // use local cached copies for --vrepo and --vcrepo in
fresh_tcc bool // do use `make fresh_tcc`
is_bisect bool // bisect mode; usage: `cmd/tools/oldv -b -c './v run bug.v'`
show_vccommit bool // show the V and VC commits, corresponding to the V commit-ish, that can be used to build V
}
fn (mut c Context) compile_oldv_if_needed() {

View file

@ -26,7 +26,7 @@ mut:
meta map[string]MetaData // aggregated meta data, read from all .json files
all_lines_per_file map[string][]int // aggregated by load_meta
//
counters map[string]u64 // incremented by process_target, based on each .csv file
counters map[string]u64 // incremented by process_target, based on each .csv file
lines_per_file map[string]map[int]int // incremented by process_target, based on each .csv file
processed_points u64
}

View file

@ -10,7 +10,7 @@ enum VCS {
}
struct VCSInfo {
dir string @[required]
dir string @[required]
args struct {
install string @[required]
version string @[required] // flag to specify a version, added to install.

View file

@ -23,20 +23,20 @@ mut:
folder string // the folder in which the repl will write its temporary source files
last_output string // the last repl output
//
modules []string // all the import modules
modules []string // all the import modules
alias map[string]string // all the alias used in the import
includes []string // all the #include statements
functions []string // all the user function declarations
functions_name []string // all the user function names
structs []string // all the struct definitions
enums []string // all the enum definitions
consts []string // all the const definitions
types []string // all the type definitions
interfaces []string // all the interface definitions
lines []string // all the other lines/statements
temp_lines []string // all the temporary expressions/printlns
vstartup_lines []string // lines in the `VSTARTUP` file
eval_func_lines []string // same line of the `VSTARTUP` file, but used to test fn type
includes []string // all the #include statements
functions []string // all the user function declarations
functions_name []string // all the user function names
structs []string // all the struct definitions
enums []string // all the enum definitions
consts []string // all the const definitions
types []string // all the type definitions
interfaces []string // all the interface definitions
lines []string // all the other lines/statements
temp_lines []string // all the temporary expressions/printlns
vstartup_lines []string // lines in the `VSTARTUP` file
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

View file

@ -74,10 +74,10 @@ mut:
errmsg string
rmfile string
runcmd RunCommandKind = .system
expect string = expect_nothing
starts_with string = starts_with_nothing
ends_with string = ends_with_nothing
contains string = contains_nothing
expect string = expect_nothing
starts_with string = starts_with_nothing
ends_with string = ends_with_nothing
contains string = contains_nothing
output string
before_cb FnCheck = unsafe { nil }
after_cb FnCheck = unsafe { nil }

View file

@ -28,7 +28,7 @@ pub mut:
kind ErrorKind @[required]
pub:
// General message
message string @[required]
message string @[required]
details string // Details about how to resolve or fix the situation
file_path string // file where the error have origin
pos token.Pos // position in the file

View file

@ -5136,7 +5136,7 @@ import db.sqlite
// sets a custom table name. Default is struct name (case-sensitive)
@[table: 'customers']
struct Customer {
id int @[primary; sql: serial] // a field named `id` of integer type must be the first field
id int @[primary; sql: serial] // a field named `id` of integer type must be the first field
name string
nr_orders int
country ?string
@ -7895,4 +7895,4 @@ Assignment Operators
&= |= ^=
>>= <<= >>>=
&&= ||=
```
```

View file

@ -11,9 +11,9 @@ const show_state = os.getenv('VERBOSE') != ''
struct BFState {
mut:
pc u16 // program counter (PC) register
address u16 // a 16-bit address register, serving as an index to the memory below
program string // the BF program
pc u16 // program counter (PC) register
address u16 // a 16-bit address register, serving as an index to the memory below
program string // the BF program
memory []u8 = []u8{len: 65536} // we have 2^16 bytes of memory
targets map[int]int // a mapping for the program address of a `[` to its corresponding `]`, and from a `]` to its corresponding opening `[`.
}

View file

@ -42,7 +42,7 @@ struct App {
mut:
gg &gg.Context = unsafe { nil }
draw_flag bool = true
dpi_scale f32 = 1.0
dpi_scale f32 = 1.0
}
fn on_frame(mut app App) {

View file

@ -33,9 +33,9 @@ const pg_db = os.getenv_opt('PGDATABASE') or { 'test' }
@[table: 'modules']
struct Module {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
name string
nr_downloads int @[sql: u64]
nr_downloads int @[sql: u64]
creator User
}
@ -48,13 +48,13 @@ struct User {
}
struct Parent {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
name string
children []Child @[fkey: 'parent_id']
}
struct Child {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
parent_id int
name string
}

View file

@ -2,13 +2,13 @@ import term.ui as tui
import flag
struct DocTest {
show_version bool @[short: v; xdoc: 'Show version and exit']
debug_level int @[long: debug; short: d; xdoc: 'Debug level']
level f32 @[only: l; xdoc: 'Do not show this']
show_version bool @[short: v; xdoc: 'Show version and exit']
debug_level int @[long: debug; short: d; xdoc: 'Debug level']
level f32 @[only: l; xdoc: 'Do not show this']
example string
square bool
multi int @[only: m; repeats]
wroom []int @[short: w]
multi int @[only: m; repeats]
wroom []int @[short: w]
the_limit string
}

View file

@ -4,13 +4,13 @@ import flag
@[name: 'flag_layout_editor']
@[version: '1.0']
struct DocTest {
show_version bool @[short: v; xdoc: 'Show version and exit']
debug_level int @[long: debug; short: d; xdoc: 'Debug level']
level f32 @[only: l; xdoc: 'Do not show this']
show_version bool @[short: v; xdoc: 'Show version and exit']
debug_level int @[long: debug; short: d; xdoc: 'Debug level']
level f32 @[only: l; xdoc: 'Do not show this']
example string
square bool
multi int @[only: m; repeats]
wroom []int @[short: w]
multi int @[only: m; repeats]
wroom []int @[short: w]
the_limit string
}

View file

@ -8,7 +8,7 @@ const points = [f32(200.0), 200.0, 200.0, 100.0, 400.0, 100.0, 400.0, 300.0]
struct App {
mut:
gg &gg.Context = unsafe { nil }
steps int = 30
steps int = 30
}
fn main() {

View file

@ -11,7 +11,7 @@ import v.util.version
@[table: 'benchmark']
struct Task {
mut:
id u32 @[primary; serial; sql: serial]
id u32 @[primary; serial; sql: serial]
title string
status string
}

View file

@ -11,7 +11,7 @@ struct App {
@[table: 'benchmark']
struct Task {
mut:
id u32 @[primary; serial; sql: serial]
id u32 @[primary; serial; sql: serial]
title string
status string
}

View file

@ -53,7 +53,7 @@ pub mut:
mat_map map[string]int // mapping material name to its material index
texture map[string]gfx.Image // GPU loaded texture map
sampler map[string]gfx.Sampler // GPU loaded sampler
material_file string // .mtl file name for the .obj
material_file string // .mtl file name for the .obj
rend_data []Render_data // render data used for the rendering

View file

@ -3,8 +3,8 @@ import sokol.audio
struct AppState {
mut:
frame_0 int // offset of the current audio frames, relative to the start of the music
frames [2048]f32 // a copy of the last rendered audio frames
frame_0 int // offset of the current audio frames, relative to the start of the music
frames [2048]f32 // a copy of the last rendered audio frames
gg &gg.Context = unsafe { nil } // used for drawing
}

View file

@ -98,8 +98,8 @@ mut:
secondary_color_idx int = 28
bg_color ui.Color = ui.Color{0, 0, 0}
drawing [][]ui.Color = [][]ui.Color{len: h, init: []ui.Color{len: w}}
size int = 1
should_redraw bool = true
size int = 1
should_redraw bool = true
is_dragging bool
}

View file

@ -245,7 +245,7 @@ mut:
}
captured bool
color termui.Color = grey
app &App = unsafe { nil }
app &App = unsafe { nil }
}
// randomize spawn the rat in a new spot within the playable field

View file

@ -90,7 +90,7 @@ mut:
show_help_flag bool
// zip container
zip &szip.Zip = unsafe { nil } // pointer to the szip structure
zip_index int = -1 // index of the zip container item
zip_index int = -1 // index of the zip container item
// memory buffer
mem_buf voidptr // buffer used to load items from files/containers
mem_buf_size int // size of the buffer

View file

@ -2,7 +2,7 @@ module main
@[table: 'products']
struct Product {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
user_id int
name string @[sql_type: 'TEXT']
created_at string @[default: 'CURRENT_TIMESTAMP']

View file

@ -3,9 +3,9 @@ module main
@[table: 'users']
pub struct User {
mut:
id int @[primary; sql: serial]
username string @[sql_type: 'TEXT'; unique]
password string @[sql_type: 'TEXT']
id int @[primary; sql: serial]
username string @[sql_type: 'TEXT'; unique]
password string @[sql_type: 'TEXT']
active bool
products []Product @[fkey: 'user_id']
}

View file

@ -13,7 +13,7 @@ struct Todo {
pub mut:
// `id` is the primary field. The attribute `sql: serial` acts like AUTO INCREMENT in sql.
// You can use this attribute if you want a unique id for each row.
id int @[primary; sql: serial]
id int @[primary; sql: serial]
name string
completed bool
created time.Time

View file

@ -234,7 +234,7 @@ Create a new file `article.v`:
module main
struct Article {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
title string
text string
}

View file

@ -1,7 +1,7 @@
module main
struct Article {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
title string
text string
}

View file

@ -22,7 +22,7 @@ struct VMemoryBlock {
mut:
id int
cap isize
start &u8 = 0
start &u8 = 0
previous &VMemoryBlock = 0
remaining isize
current &u8 = 0

View file

@ -21,9 +21,9 @@ pub mut:
pre_execute FnCommandCallback = unsafe { nil }
execute FnCommandCallback = unsafe { nil }
post_execute FnCommandCallback = unsafe { nil }
disable_help bool @[deprecated: 'use defaults.help instead'; deprecated_after: '2024-06-31']
disable_man bool @[deprecated: 'use defaults.man instead'; deprecated_after: '2024-06-31']
disable_version bool @[deprecated: 'use defaults.version instead'; deprecated_after: '2024-06-31']
disable_help bool @[deprecated: 'use defaults.help instead'; deprecated_after: '2024-06-31']
disable_man bool @[deprecated: 'use defaults.man instead'; deprecated_after: '2024-06-31']
disable_version bool @[deprecated: 'use defaults.version instead'; deprecated_after: '2024-06-31']
disable_flags bool
sort_flags bool
sort_commands bool

View file

@ -392,8 +392,8 @@ pub fn default_c_level() int {
pub struct CompressParams {
pub:
compression_level int // 1~22
nb_threads int = 1 // how many threads will be spawned to compress in parallel
checksum_flag bool = true
nb_threads int = 1 // how many threads will be spawned to compress in parallel
checksum_flag bool = true
strategy ZSTD_strategy = ZSTD_strategy.zstd_default
}

View file

@ -13,7 +13,7 @@ struct TestCustomSqlType {
}
struct TestCustomWrongSqlType {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
custom string
custom1 string @[sql_type: 'VARCHAR']
custom2 string @[sql_type: 'money']
@ -22,7 +22,7 @@ struct TestCustomWrongSqlType {
struct TestTimeType {
mut:
id int @[primary; sql: serial]
id int @[primary; sql: serial]
username string
created_at time.Time @[sql_type: 'DATETIME']
updated_at string @[sql_type: 'DATETIME']

View file

@ -13,7 +13,7 @@ struct TestCustomSqlType {
}
struct TestCustomWrongSqlType {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
custom string
custom1 string @[sql_type: 'VARCHAR']
custom2 string @[sql_type: 'money']
@ -22,7 +22,7 @@ struct TestCustomWrongSqlType {
struct TestTimeType {
mut:
id int @[primary; sql: serial]
id int @[primary; sql: serial]
username string
created_at time.Time @[sql_type: 'TIMESTAMP']
updated_at string @[sql_type: 'TIMESTAMP']

View file

@ -1,20 +1,20 @@
import db.sqlite
struct Parent {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
name string
children []Child @[fkey: 'parent_id']
}
struct Child {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
name string
parent_id int
babies []Baby @[fkey: 'child_id']
}
struct Baby {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
name string
child_id int
}

View file

@ -59,7 +59,7 @@ pub struct C.sqlite3_stmt {
@[heap]
pub struct Stmt {
stmt &C.sqlite3_stmt = unsafe { nil }
db &DB = unsafe { nil }
db &DB = unsafe { nil }
}
struct SQLError {

View file

@ -3,18 +3,18 @@ import db.sqlite
import time
struct TestCustomSqlType {
id int @[primary; sql: serial]
custom string @[sql_type: 'INTEGER']
custom1 string @[sql_type: 'TEXT']
custom2 string @[sql_type: 'REAL']
custom3 string @[sql_type: 'NUMERIC']
id int @[primary; sql: serial]
custom string @[sql_type: 'INTEGER']
custom1 string @[sql_type: 'TEXT']
custom2 string @[sql_type: 'REAL']
custom3 string @[sql_type: 'NUMERIC']
custom4 string
custom5 int
custom6 time.Time
}
struct TestDefaultAttribute {
id string @[primary; sql: serial]
id string @[primary; sql: serial]
name string
created_at ?string @[default: 'CURRENT_TIME']
created_at1 ?string @[default: 'CURRENT_DATE']

View file

@ -4,7 +4,7 @@ type Connection = sqlite.DB
struct User {
pub:
id int @[primary; sql: serial]
id int @[primary; sql: serial]
name string
}

View file

@ -52,9 +52,9 @@ pub type Sqlite3_vfs = C.sqlite3_vfs
pub struct C.sqlite3_vfs {
pub mut:
// version 1 and later fields
iVersion int // Structure version number (currently 3)
szOsFile int // Size of subclassed sqlite3_file
mxPathname int // Maximum file pathname length
iVersion int // Structure version number (currently 3)
szOsFile int // Size of subclassed sqlite3_file
mxPathname int // Maximum file pathname length
pNext &Sqlite3_vfs // Next registered VFS
zName &char // Name of this virtual file system
pAppData voidptr // Pointer to application-specific data

View file

@ -206,10 +206,10 @@ fn overhead_for(c &Chunk) usize {
// Why not `interface?` Interfaces require memory allocation so it is simpler to pass a struct.
pub struct Allocator {
pub:
alloc fn (voidptr, usize) (voidptr, usize, u32) = unsafe { nil }
alloc fn (voidptr, usize) (voidptr, usize, u32) = unsafe { nil }
remap fn (voidptr, voidptr, usize, usize, bool) voidptr = unsafe { nil }
free_part fn (voidptr, voidptr, usize, usize) bool = unsafe { nil }
free_ fn (voidptr, voidptr, usize) bool = unsafe { nil }
free_part fn (voidptr, voidptr, usize, usize) bool = unsafe { nil }
free_ fn (voidptr, voidptr, usize) bool = unsafe { nil }
can_release_part fn (voidptr, u32) bool = unsafe { nil }
allocates_zeros fn (voidptr) bool = unsafe { nil }
page_size fn (voidptr) usize = unsafe { nil } // not a constant field because some platforms might have different page sizes depending on configs

View file

@ -56,16 +56,16 @@ pub mut:
end_line u8 = `\n`
end_line_len int = csv.endline_cr_len // size of the endline rune \n = 1, \r\n = 2
separator u8 = `,` // comma is the default separator
separator_len int = 1 // size of the separator rune
quote u8 = `"` // double quote is the standard quote char
separator u8 = `,` // comma is the default separator
separator_len int = 1 // size of the separator rune
quote u8 = `"` // double quote is the standard quote char
quote_remove bool // if true clear the cell from the quotes
comment u8 = `#` // every line that start with the quote char is ignored
default_cell string = '*' // return this string if out of the csv boundaries
empty_cell string = '#' // retunrn this if empty cell
// ram buffer
mem_buf_type u32 // buffer type 0=File,1=RAM
mem_buf_type u32 // buffer type 0=File,1=RAM
mem_buf voidptr // buffer used to load chars from file
mem_buf_size i64 // size of the buffer
mem_buf_start i64 = -1 // start index in the file of the read buffer
@ -74,7 +74,7 @@ pub mut:
csv_map [][]i64
// header
header_row int = -1 // row index of the header in the csv_map
header_list []HeaderItem // list of the header item
header_list []HeaderItem // list of the header item
header_map map[string]int // map from header label to column index
}
@ -92,8 +92,8 @@ pub:
default_cell string = '*' // return this string if out of the csv boundaries
empty_cell string // return this string if empty cell
end_line_len int = csv.endline_cr_len // size of the endline rune
quote u8 = `"` // double quote is the standard quote char
quote_remove bool // if true clear the cell from the quotes
quote u8 = `"` // double quote is the standard quote char
quote_remove bool // if true clear the cell from the quotes
}
/******************************************************************************

View file

@ -25,7 +25,7 @@ pub:
default_cell string = '*' // return this string if out of the csv boundaries
empty_cell string // return this string if empty cell
end_line_len int = endline_cr_len // size of the endline rune
quote u8 = `"` // double quote is the standard quote char
quote u8 = `"` // double quote is the standard quote char
}
pub struct SequentialReader {
@ -41,16 +41,16 @@ pub mut:
end_line u8 = `\n`
end_line_len int = endline_cr_len // size of the endline rune \n = 1, \r\n = 2
separator u8 = `,` // comma is the default separator
separator_len int = 1 // size of the separator rune
quote u8 = `"` // double quote is the standard quote char
separator u8 = `,` // comma is the default separator
separator_len int = 1 // size of the separator rune
quote u8 = `"` // double quote is the standard quote char
comment u8 = `#` // every line that start with the quote char is ignored
default_cell string = '*' // return this string if out of the csv boundaries
empty_cell string = '#' // retunrn this if empty cell
// ram buffer
mem_buf_type u32 // buffer type 0=File,1=RAM
mem_buf_type u32 // buffer type 0=File,1=RAM
mem_buf voidptr // buffer used to load chars from file
mem_buf_size i64 // size of the buffer
mem_buf_start i64 = -1 // start index in the file of the read buffer

View file

@ -17,7 +17,7 @@ pub:
// other XML nodes, CDATA, plain text, or comments.
pub struct XMLNode {
pub:
name string @[required]
name string @[required]
attributes map[string]string
children []XMLNodeContents
}
@ -56,7 +56,7 @@ pub:
pub struct DocumentType {
pub:
name string @[required]
name string @[required]
dtd DTDInfo
}

View file

@ -42,9 +42,9 @@ import os
@[version: '1.2.3']
@[name: 'app']
struct Config {
show_version bool @[short: v; xdoc: 'Show version and exit']
debug_level int @[long: debug; short: d; xdoc: 'Debug level']
level f32 @[only: l; xdoc: 'This doc text is overwritten']
show_version bool @[short: v; xdoc: 'Show version and exit']
debug_level int @[long: debug; short: d; xdoc: 'Debug level']
level f32 @[only: l; xdoc: 'This doc text is overwritten']
example string
square bool
show_help bool @[long: help; short: h]

View file

@ -15,8 +15,8 @@ struct Config {
paths []string @[tail]
not_mapped string = 'not changed'
e bool
b bool @[long: Dev; only: d]
u string @[short: c]
b bool @[long: Dev; only: d]
u string @[short: c]
}
fn test_cmd_exe() {

View file

@ -1,8 +1,8 @@
module flag
struct FlagData {
raw string @[required]
field_name string @[required]
raw string @[required]
field_name string @[required]
delimiter string
name string
arg ?string
@ -28,7 +28,7 @@ pub enum Style {
}
struct StructInfo {
name string // name of the struct itself
name string // name of the struct itself
attrs map[string]string // collection of `@[x: y]` sat on the struct, read via reflection
fields map[string]StructField
}
@ -72,7 +72,7 @@ fn (sf StructField) shortest_match_name() ?string {
@[params]
pub struct ParseConfig {
pub:
delimiter string = '-' // delimiter used for flags
delimiter string = '-' // delimiter used for flags
style Style = .short_long // expected flag style
stop ?string // single, usually '--', string that stops parsing flags/options
skip u16 // skip this amount in the input argument array, usually `1` for skipping executable or subcmd entry
@ -81,7 +81,7 @@ pub:
@[params]
pub struct DocConfig {
pub:
delimiter string = '-' // delimiter used for flags
delimiter string = '-' // delimiter used for flags
style Style = .short_long // expected flag style
pub mut:
name string // application name

View file

@ -153,13 +153,13 @@ Footer content'
@[name: 'flag_to_doc_test']
@[version: '1.0']
struct DocTest {
show_version bool @[short: v; xdoc: 'Show version and exit']
debug_level int @[long: debug; short: d; xdoc: 'Debug level']
level f32 @[only: l; xdoc: 'Override this doc string']
show_version bool @[short: v; xdoc: 'Show version and exit']
debug_level int @[long: debug; short: d; xdoc: 'Debug level']
level f32 @[only: l; xdoc: 'Override this doc string']
example string
square bool
multi int @[only: m; repeats]
wroom []int @[short: w]
multi int @[only: m; repeats]
wroom []int @[short: w]
the_limit string
}

View file

@ -28,9 +28,9 @@ struct Config {
device []string @[short: d]
paths []string @[tail]
amount int = 1
verbosity int @[repeats; short: v]
show_version bool @[long: version]
no_long_beef bool @[only: n]
verbosity int @[repeats; short: v]
show_version bool @[long: version]
no_long_beef bool @[only: n]
}
struct LongConfig {
@ -39,7 +39,7 @@ struct LongConfig {
some_test string = 'abc' @[long: test]
path string @[tail]
amount int = 1
show_version bool @[long: version]
show_version bool @[long: version]
}
struct IgnoreConfig {

View file

@ -9,9 +9,9 @@ const exe_and_go_flag_args_with_tail = ['/path/to/exe', '-version', '--flag', '-
struct Prefs {
flag bool
flag_value string
version bool @[short: v]
is_live bool @[long: live]
is_done bool @[long: done]
version bool @[short: v]
is_live bool @[long: live]
is_done bool @[long: done]
test string
defines []string @[long: define; short: d]
tail []string @[tail]

View file

@ -21,8 +21,8 @@ struct Config {
verbosity int @[repeats; short: v]
not_mapped string = 'not changed'
x bool
b bool @[only: y]
u int @[short: z]
b bool @[only: y]
u int @[short: z]
}
fn test_pure_posix_short() {

View file

@ -7,9 +7,9 @@ const exe_and_v_args_with_tail = ['/path/to/exe', '-version', '-d', 'ident=val',
'-done', '-d', 'two', '-live', 'run', '/path/to']
struct Prefs {
version bool @[short: v]
is_live bool @[long: live]
is_done bool @[long: done]
version bool @[short: v]
is_live bool @[long: live]
is_done bool @[long: done]
test string
defines []string @[long: define; short: d]
tail []string @[tail]

View file

@ -84,28 +84,28 @@ pub:
resized_fn FNEvent = unsafe { nil } // Called once when the window has changed its size.
scroll_fn FNEvent = unsafe { nil } // Called while the user is scrolling. The direction of scrolling is indicated by either 1 or -1.
// wait_events bool // set this to true for UIs, to save power
fullscreen bool // set this to true, if you want your window to start in fullscreen mode (suitable for games/demos/screensavers)
fullscreen bool // set this to true, if you want your window to start in fullscreen mode (suitable for games/demos/screensavers)
scale f32 = 1.0
sample_count int // bigger values usually have performance impact, but can produce smoother/antialiased lines, if you draw lines or polygons (2 is usually good enough)
sample_count int // bigger values usually have performance impact, but can produce smoother/antialiased lines, if you draw lines or polygons (2 is usually good enough)
swap_interval int = 1 // 1 = 60fps, 2 = 30fps etc. The preferred swap interval (ignored on some platforms)
// ved needs this
// init_text bool
font_path string
custom_bold_font_path string
ui_mode bool // refreshes only on events to save CPU usage
ui_mode bool // refreshes only on events to save CPU usage
// font bytes for embedding
font_bytes_normal []u8
font_bytes_bold []u8
font_bytes_mono []u8
font_bytes_italic []u8
native_rendering bool // Cocoa on macOS/iOS, GDI+ on Windows
native_rendering bool // Cocoa on macOS/iOS, GDI+ on Windows
// drag&drop
enable_dragndrop bool // enable file dropping (drag'n'drop), default is false
max_dropped_files int = 1 // max number of dropped files to process (default: 1)
max_dropped_files int = 1 // max number of dropped files to process (default: 1)
max_dropped_file_path_length int = 2048 // max length in bytes of a dropped UTF-8 file path (default: 2048)
//
min_width int // desired minimum width of the window
min_height int // desired minimum height of the window
min_height int // desired minimum height of the window
}
@[heap]
@ -179,8 +179,8 @@ pub mut:
scroll_x int
scroll_y int
//
key_modifiers Modifier // the current key modifiers
key_repeat bool // whether the pressed key was an autorepeated one
key_modifiers Modifier // the current key modifiers
key_repeat bool // whether the pressed key was an autorepeated one
pressed_keys [key_code_max]bool // an array representing all currently pressed keys
pressed_keys_edge [key_code_max]bool // true when the previous state of pressed_keys,
// *before* the current event was different

View file

@ -249,9 +249,9 @@ pub:
font_bytes_italic []u8
native_rendering bool // Cocoa on macOS/iOS, GDI+ on Windows
// drag&drop
enable_dragndrop bool // enable file dropping (drag'n'drop), default is false
max_dropped_files int = 1 // max number of dropped files to process (default: 1)
max_dropped_file_path_length int = 2048 // max length in bytes of a dropped UTF-8 file path (default: 2048)
enable_dragndrop bool // enable file dropping (drag'n'drop), default is false
max_dropped_files int = 1 // max number of dropped files to process (default: 1)
max_dropped_file_path_length int = 2048 // max length in bytes of a dropped UTF-8 file path (default: 2048)
html5_canvas_name string = 'canvas' // the id/name of the canvas element, that will be used to render GG apps
}
@ -271,7 +271,7 @@ pub mut:
scale f32 = 1.0
width int
height int
window JS.Window @[noinit]
window JS.Window @[noinit]
config Config
user_data voidptr
ui_mode bool
@ -285,8 +285,8 @@ pub mut:
scroll_x int
scroll_y int
//
key_modifiers Modifier // the current key modifiers
key_repeat bool // whether the pressed key was an autorepeated one
key_modifiers Modifier // the current key modifiers
key_repeat bool // whether the pressed key was an autorepeated one
pressed_keys [key_code_max]bool // an array representing all currently pressed keys
pressed_keys_edge [key_code_max]bool // true when the previous state of pressed_keys,
context JS.CanvasRenderingContext2D @[noinit]

View file

@ -29,7 +29,7 @@ pub struct PenConfig {
pub:
color gx.Color
line_type PenLineType = .solid
thickness int = 1
thickness int = 1
}
pub struct Size {

View file

@ -279,8 +279,8 @@ pub:
wrap_v gfx.Wrap = .clamp_to_edge
min_filter gfx.Filter = .linear
mag_filter gfx.Filter = .linear
num_mipmaps int = 1
num_slices int = 1
num_mipmaps int = 1
num_slices int = 1
}
// draw_image_with_config takes in a config that details how the

View file

@ -14,7 +14,7 @@ pub mut:
img_id int
img_rect Rect // defines the size and position on image when rendering to the screen
part_rect Rect // defines the size and position of part of the image to use when rendering
rotate f32 @[deprecated: 'use `rotation` instead of `rotate`'; deprecated_after: '2024-07-30']
rotate f32 @[deprecated: 'use `rotation` instead of `rotate`'; deprecated_after: '2024-07-30']
z f32
color gx.Color = gx.white
effect ImageEffect = .alpha

View file

@ -171,8 +171,8 @@ pub:
y int
text string
color Color = gx.black
size int = 16
color Color = gx.black
size int = 16
align gx.HorizontalAlign = .left
vertical_align gx.VerticalAlign = .top
max_width int

View file

@ -7,8 +7,8 @@ pub const align_right = HorizontalAlign.right
@[params]
pub struct TextCfg {
pub:
color Color = black
size int = 16
color Color = black
size int = 16
align HorizontalAlign = .left
vertical_align VerticalAlign = .top
max_width int

View file

@ -19,7 +19,7 @@ pub struct BufferedReaderConfig {
pub:
reader Reader
cap int = 128 * 1024 // large for fast reading of big(ish) files
retries int = 2 // how many times to retry before assuming the stream ended
retries int = 2 // how many times to retry before assuming the stream ended
}
// BufferedReadLineConfig are options that can be given to the read_line() function.

View file

@ -22,11 +22,11 @@ enum JobTitle {
struct Employee {
mut:
name string
family string @[json: '-'] // this field will be skipped
family string @[json: '-'] // this field will be skipped
age int
salary f32
title JobTitle @[json: 'ETitle'] // the key for this field will be 'ETitle', not 'title'
notes string @[omitempty] // the JSON property is not created if the string is equal to '' (an empty string).
notes string @[omitempty] // the JSON property is not created if the string is equal to '' (an empty string).
// TODO: document @[raw]
}

View file

@ -4,8 +4,8 @@ struct PostTag {
id string
parent ?&PostTag
visibility string
created_at string @[json: 'createdAt']
metadata string @[raw]
created_at string @[json: 'createdAt']
metadata string @[raw]
}
fn test_main() {

View file

@ -9,7 +9,7 @@ pub:
skip ?int
fields ?[]string // This breaks the compiler when encoding to JSON
conflicts ?bool
read_quorum ?int @[json: r]
read_quorum ?int @[json: r]
update ?bool
stable ?bool
stale ?string

View file

@ -449,7 +449,7 @@ fn test_pretty() {
struct Foo3 {
name string
age int @[omitempty]
age int @[omitempty]
}
fn test_omit_empty() {

View file

@ -34,7 +34,7 @@ mut:
time_format TimeFormat
custom_time_format string = 'MMMM Do YY N kk:mm:ss A' // timestamp with custom format
short_tag bool
always_flush bool // flush after every single .fatal(), .error(), .warn(), .info(), .debug() call
always_flush bool // flush after every single .fatal(), .error(), .warn(), .info(), .debug() call
pub mut:
output_file_name string // log output to this file
}

View file

@ -10,10 +10,10 @@ import net.http.mime
@[params]
pub struct StaticServeParams {
pub mut:
folder string = '.' // the folder, that will be used as a base for serving all static resources; If it was /tmp, then: http://localhost:4001/x.txt => /tmp/x.txt
index_file string = 'index.html' // A request for http://localhost:4001/ will map to index.html, if that file is present.
auto_index bool = true // when an index_file is *not* present, a request for http://localhost:4001/ will list automatically all files in the folder.
filter_myexe bool = true // whether to filter the name of the static file executable from the automatic folder listings for / . Useful with `v -e 'import net.http.file; file.serve()'`
folder string = '.' // the folder, that will be used as a base for serving all static resources; If it was /tmp, then: http://localhost:4001/x.txt => /tmp/x.txt
index_file string = 'index.html' // A request for http://localhost:4001/ will map to index.html, if that file is present.
auto_index bool = true // when an index_file is *not* present, a request for http://localhost:4001/ will list automatically all files in the folder.
filter_myexe bool = true // whether to filter the name of the static file executable from the automatic folder listings for / . Useful with `v -e 'import net.http.file; file.serve()'`
on string = 'localhost:4001' // on which address:port to listen for http requests
workers int = runtime.nr_jobs() // how many worker threads to use for serving the responses, by default it is limited to the number of available cores; can be controlled with setting VJOBS
shutdown_after time.Duration = time.infinite // after this time has passed, the webserver will gracefully shutdown on its own

View file

@ -31,7 +31,7 @@ pub mut:
cert_key string // the path to a key.pem file, containing private keys for the client certificate(s)
in_memory_verification bool // if true, verify, cert, and cert_key are read from memory, not from a file
allow_redirect bool = true // whether to allow redirect
max_retries int = 5 // maximum number of retries required when an underlying socket error occurs
max_retries int = 5 // maximum number of retries required when an underlying socket error occurs
// callbacks to allow custom reporting code to run, while the request is running, and to implement streaming
on_redirect RequestRedirectFn = unsafe { nil }
on_progress RequestProgressFn = unsafe { nil }

View file

@ -44,7 +44,7 @@ pub mut:
cert_key string
in_memory_verification bool // if true, verify, cert, and cert_key are read from memory, not from a file
allow_redirect bool = true // whether to allow redirect
max_retries int = 5 // maximum number of retries required when an underlying socket error occurs
max_retries int = 5 // maximum number of retries required when an underlying socket error occurs
// callbacks to allow custom reporting code to run, while the request is running, and to implement streaming
on_redirect RequestRedirectFn = unsafe { nil }
on_progress RequestProgressFn = unsafe { nil }

View file

@ -29,14 +29,14 @@ pub struct Server {
mut:
state ServerStatus = .closed
pub mut:
addr string = ':${http.default_server_port}'
port int = http.default_server_port @[deprecated: 'use addr']
addr string = ':${http.default_server_port}'
port int = http.default_server_port @[deprecated: 'use addr']
handler Handler = DebugHandler{}
read_timeout time.Duration = 30 * time.second
write_timeout time.Duration = 30 * time.second
accept_timeout time.Duration = 30 * time.second
pool_channel_slots int = 1024
worker_num int = runtime.nr_jobs()
pool_channel_slots int = 1024
worker_num int = runtime.nr_jobs()
listener net.TcpListener
//
on_running fn (mut s Server) = unsafe { nil } // Blocking cb. If set, ran by the web server on transitions to its .running state.
@ -145,7 +145,7 @@ pub fn (s &Server) status() ServerStatus {
pub struct WaitTillRunningParams {
pub:
max_retries int = 100 // how many times to check for the status, for each single s.wait_till_running() call
retry_period_ms int = 10 // how much time to wait between each check for the status, in milliseconds
retry_period_ms int = 10 // how much time to wait between each check for the status, in milliseconds
}
// wait_till_running allows you to synchronise your calling (main) thread, with the state of the server

View file

@ -317,14 +317,14 @@ fn escape(s string, mode EncodingMode) string {
pub struct URL {
pub mut:
scheme string
opaque string // encoded opaque data
opaque string // encoded opaque data
user &Userinfo = unsafe { nil } // username and password information
host string // host or host:port
path string // path (relative paths may omit leading slash)
raw_path string // encoded path hint (see escaped_path method)
force_query bool // append a query ('?') even if raw_query is empty
raw_query string // encoded query values, without '?'
fragment string // fragment for references, without '#'
host string // host or host:port
path string // path (relative paths may omit leading slash)
raw_path string // encoded path hint (see escaped_path method)
force_query bool // append a query ('?') even if raw_query is empty
raw_query string // encoded query values, without '?'
fragment string // fragment for references, without '#'
}
// debug returns a string representation of *ALL* the fields of the given URL

View file

@ -24,8 +24,8 @@ pub struct Client {
is_server bool
mut:
ssl_conn &ssl.SSLConn = unsafe { nil } // secure connection used when wss is used
flags []Flag // flags used in handshake
fragments []Fragment // current fragments
flags []Flag // flags used in handshake
fragments []Fragment // current fragments
message_callbacks []MessageEventHandler // all callbacks on_message
error_callbacks []ErrorEventHandler // all callbacks on_error
open_callbacks []OpenEventHandler // all callbacks on_open
@ -37,10 +37,10 @@ pub:
read_timeout i64
write_timeout i64
pub mut:
header http.Header // headers that will be passed when connecting
header http.Header // headers that will be passed when connecting
conn &net.TcpConn = unsafe { nil } // underlying TCP socket connection
nonce_size int = 16 // size of nounce used for masking
panic_on_callback bool // set to true of callbacks can panic
nonce_size int = 16 // size of nounce used for masking
panic_on_callback bool // set to true of callbacks can panic
client_state shared ClientState // current state of connection
// logger used to log messages
logger &log.Logger = default_logger
@ -83,8 +83,8 @@ pub enum OPCode {
@[params]
pub struct ClientOpt {
pub:
read_timeout i64 = 30 * time.second
write_timeout i64 = 30 * time.second
read_timeout i64 = 30 * time.second
write_timeout i64 = 30 * time.second
logger &log.Logger = default_logger
}

View file

@ -8,7 +8,7 @@ import rand
pub struct ServerState {
mut:
ping_interval int = 30 // interval for sending ping to clients (seconds)
ping_interval int = 30 // interval for sending ping to clients (seconds)
state State = .closed // current state of connection
pub mut:
clients map[string]&ServerClient // clients connected to this server

View file

@ -3,7 +3,7 @@
import db.sqlite
struct User {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
name string
country string
}

View file

@ -3,7 +3,7 @@
import db.sqlite
struct Person {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
age int
brothers []Brother @[fkey: 'person_id']
sisters []Sister @[fkey: 'person_id']
@ -11,13 +11,13 @@ struct Person {
}
struct Brother {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
person_id int
name string
}
struct Sister {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
person_id int
name string
}

View file

@ -3,7 +3,7 @@
import db.sqlite
struct User {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
name string
age int
}

View file

@ -4,7 +4,7 @@ import db.sqlite
@[table: 'bad_table']
struct Bad {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
link string
}

View file

@ -4,7 +4,7 @@ import db.sqlite
import rand
struct Parent {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
name string
children []Child @[fkey: 'parent_id']
notes []Note @[fkey: 'owner_id']
@ -12,14 +12,14 @@ struct Parent {
struct Child {
mut:
id int @[primary; sql: serial]
id int @[primary; sql: serial]
parent_id int
name string
}
struct Note {
mut:
id int @[primary; sql: serial]
id int @[primary; sql: serial]
owner_id int
text string
}
@ -52,7 +52,7 @@ struct Entity {
}
struct EntityWithFloatPrimary {
id f64 @[primary]
id f64 @[primary]
name string
}
@ -398,7 +398,7 @@ fn test_orm_insert_with_child_element_and_no_table() {
@[table: 'customers']
struct Customer {
id i64 @[primary; sql: serial]
id i64 @[primary; sql: serial]
name string
}

View file

@ -4,7 +4,7 @@ import db.sqlite
import orm
struct User {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
name string
}

View file

@ -3,7 +3,7 @@
import db.sqlite
struct User {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
name string
}

View file

@ -3,7 +3,7 @@
import db.sqlite
struct User {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
name string
}

View file

@ -101,7 +101,7 @@ fn (db MockDB) last_id() int {
@[table: 'foo']
struct Foo {
mut:
id u64 @[primary; sql: serial]
id u64 @[primary; sql: serial]
a string
// b string [default: '"yes"']
c ?string
@ -222,7 +222,7 @@ fn test_option_struct_fields_and_none() {
}
struct Bar {
id u64 @[primary; sql: serial]
id u64 @[primary; sql: serial]
name ?string
age int
}

View file

@ -5,16 +5,16 @@ import time
@[table: 'foos']
struct Foo {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
name string
created_at time.Time @[default: 'CURRENT_TIME']
updated_at ?string @[sql_type: 'TIMESTAMP']
created_at time.Time @[default: 'CURRENT_TIME']
updated_at ?string @[sql_type: 'TIMESTAMP']
deleted_at ?time.Time
children []Child @[fkey: 'parent_id']
children []Child @[fkey: 'parent_id']
}
struct Child {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
parent_id int
name string
}

View file

@ -10,7 +10,7 @@ struct Boat {
}
struct Color {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
hex string
}

View file

@ -3,12 +3,12 @@
import db.sqlite
struct Account {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
name string
}
struct Note {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
content string
}

View file

@ -3,7 +3,7 @@
import db.sqlite
struct User {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
name string
}

View file

@ -8,7 +8,7 @@ import db.sqlite
const offset_const = 2
struct Module {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
name string
nr_downloads int
test_id u64
@ -18,9 +18,9 @@ struct Module {
@[table: 'userlist']
struct User {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
age int
name string @[sql: 'username']
name string @[sql: 'username']
is_customer bool
skipped_string string @[skip]
skipped_string2 string @[sql: '-']
@ -33,7 +33,7 @@ struct Foo {
}
struct TestTime {
id int @[primary; sql: serial]
id int @[primary; sql: serial]
create time.Time
}

View file

@ -15,8 +15,8 @@ pub enum AssetMode {
pub struct C.ANativeActivity {
pub:
assetManager &AssetManager = unsafe { nil } // Pointer to the Asset Manager instance for the application.
clazz voidptr // (jobject) The NativeActivity object handle.
env voidptr // (JNIEnv *) JNI context for the main thread of the app.
clazz voidptr // (jobject) The NativeActivity object handle.
env voidptr // (JNIEnv *) JNI context for the main thread of the app.
externalDataPath &char // Path to this application's external (removable/mountable) data directory.
instance voidptr // This is the native instance of the application.
internalDataPath &char // Path to this application's internal data directory.

View file

@ -18,13 +18,13 @@ pub enum ProcessState {
@[heap]
pub struct Process {
pub mut:
filename string // the process's command file path
pid int // the PID of the process
code int = -1 // the exit code of the process, != -1 *only* when status is .exited *and* the process was not aborted
filename string // the process's command file path
pid int // the PID of the process
code int = -1 // the exit code of the process, != -1 *only* when status is .exited *and* the process was not aborted
status ProcessState = .not_started // the current status of the process
err string // if the process fails, contains the reason why
args []string // the arguments that the command takes
work_folder string // the initial working folder of the process. When '', reuse the same folder as the parent process.
err string // if the process fails, contains the reason why
args []string // the arguments that the command takes
work_folder string // the initial working folder of the process. When '', reuse the same folder as the parent process.
env_is_custom bool // true, when the environment was customized with .set_environment
env []string // the environment with which the process was started (list of 'var=val')
use_stdio_ctl bool // when true, then you can use p.stdin_write(), p.stdout_slurp() and p.stderr_slurp()

View file

@ -44,15 +44,15 @@ pub mut:
pub struct Config {
pub:
port int = 8080
cb fn (voidptr, picohttpparser.Request, mut picohttpparser.Response) = unsafe { nil }
cb fn (voidptr, picohttpparser.Request, mut picohttpparser.Response) = unsafe { nil }
err_cb fn (voidptr, picohttpparser.Request, mut picohttpparser.Response, IError) = default_error_callback
raw_cb fn (mut Picoev, int, int) = unsafe { nil }
user_data voidptr = unsafe { nil }
timeout_secs int = 8
max_headers int = 100
max_read int = 4096
max_write int = 8192
family net.AddrFamily = .ip6
user_data voidptr = unsafe { nil }
timeout_secs int = 8
max_headers int = 100
max_read int = 4096
max_write int = 8192
family net.AddrFamily = .ip6
host string
}
@ -60,7 +60,7 @@ pub:
// Contains event loop, file descriptor table, timeouts, buffers, and configuration.
@[heap]
pub struct Picoev {
cb fn (voidptr, picohttpparser.Request, mut picohttpparser.Response) = unsafe { nil }
cb fn (voidptr, picohttpparser.Request, mut picohttpparser.Response) = unsafe { nil }
error_callback fn (voidptr, picohttpparser.Request, mut picohttpparser.Response, IError) = default_error_callback
raw_callback fn (mut Picoev, int, int) = unsafe { nil }
@ -70,7 +70,7 @@ pub struct Picoev {
max_write int = 8192
err_cb fn (voidptr, picohttpparser.Request, mut picohttpparser.Response, IError) = default_error_callback @[deprecated: 'use `error_callback` instead']
raw_cb fn (mut Picoev, int, int) = unsafe { nil } @[deprecated: 'use `raw_callback` instead']
raw_cb fn (mut Picoev, int, int) = unsafe { nil } @[deprecated: 'use `raw_callback` instead']
mut:
loop &LoopType = unsafe { nil }
file_descriptors [max_fds]&Target

View file

@ -23,8 +23,8 @@ pub struct Readline {
pub mut:
is_raw bool
orig_termios termios.Termios // Linux
current []rune // Line being edited
cursor int // Cursor position
current []rune // Line being edited
cursor int // Cursor position
overwrite bool
cursor_row_offset int
prompt string

View file

@ -295,7 +295,7 @@ pub mut:
prog_len int // regex program len
// char classes storage
cc []CharClass // char class list
cc_index int // index
cc_index int // index
// groups
group_count int // number of groups in this regex struct
groups []int // groups index results
@ -314,7 +314,7 @@ pub mut:
// flags
flag int // flag for optional parameters
// Debug/log
debug int // enable in order to have the unroll of the code 0 = NO_DEBUG, 1 = LIGHT 2 = VERBOSE
debug int // enable in order to have the unroll of the code 0 = NO_DEBUG, 1 = LIGHT 2 = VERBOSE
log_func FnLog = simple_log // log function, can be customized by the user
query string // query string
}
@ -375,7 +375,7 @@ fn (mut re RE) reset_src() {
*
******************************************************************************/
struct BslsStruct {
ch rune // meta char
ch rune // meta char
validator FnValidator = unsafe { nil } // validator function pointer
}
@ -525,9 +525,9 @@ const cc_end = 4
struct CharClass {
mut:
cc_type int // type of cc token
ch0 rune // first char of the interval a-b a in this case
ch1 rune // second char of the interval a-b b in this case
cc_type int // type of cc token
ch0 rune // first char of the interval a-b a in this case
ch1 rune // second char of the interval a-b b in this case
validator FnValidator = unsafe { nil } // validator function pointer
}
@ -1812,7 +1812,7 @@ pub mut:
first_match int = -1 // index of the first match
pc int = -1 // program counter
i int = -1 // source string index
char_len int // last char legth
char_len int // last char legth
last_dot_pc int = -1 // last dot chat pc
}

View file

@ -45,9 +45,9 @@ pub:
// fail_cb fn (&u8) = unsafe { nil }
user_data voidptr // these are the user-provided callbacks with user data
init_userdata_cb fn (voidptr) = unsafe { nil }
frame_userdata_cb fn (voidptr) = unsafe { nil }
cleanup_userdata_cb fn (voidptr) = unsafe { nil }
init_userdata_cb fn (voidptr) = unsafe { nil }
frame_userdata_cb fn (voidptr) = unsafe { nil }
cleanup_userdata_cb fn (voidptr) = unsafe { nil }
event_userdata_cb fn (&Event, voidptr) = unsafe { nil }
// fail_userdata_cb fn (&char, voidptr) = unsafe { nil }
@ -89,25 +89,25 @@ pub type Desc = C.sapp_desc
@[typedef]
pub struct C.sapp_event {
pub:
frame_count u64 // current frame counter, always valid, useful for checking if two events were issued in the same frame
@type EventType // the event type, always valid
key_code KeyCode // the virtual key code, only valid in KEY_UP, KEY_DOWN
char_code u32 // the UTF-32 character code, only valid in CHAR events
key_repeat bool // true if this is a key-repeat event, valid in KEY_UP, KEY_DOWN and CHAR
modifiers u32 // current modifier keys, valid in all key-, char- and mouse-events
mouse_button MouseButton // mouse button that was pressed or released, valid in MOUSE_DOWN, MOUSE_UP
mouse_x f32 // current horizontal mouse position in pixels, always valid except during mouse lock
mouse_y f32 // current vertical mouse position in pixels, always valid except during mouse lock
mouse_dx f32 // relative horizontal mouse movement since last frame, always valid
mouse_dy f32 // relative vertical mouse movement since last frame, always valid
scroll_x f32 // horizontal mouse wheel scroll distance, valid in MOUSE_SCROLL events
scroll_y f32 // vertical mouse wheel scroll distance, valid in MOUSE_SCROLL events
num_touches int // number of valid items in the touches[] array
frame_count u64 // current frame counter, always valid, useful for checking if two events were issued in the same frame
@type EventType // the event type, always valid
key_code KeyCode // the virtual key code, only valid in KEY_UP, KEY_DOWN
char_code u32 // the UTF-32 character code, only valid in CHAR events
key_repeat bool // true if this is a key-repeat event, valid in KEY_UP, KEY_DOWN and CHAR
modifiers u32 // current modifier keys, valid in all key-, char- and mouse-events
mouse_button MouseButton // mouse button that was pressed or released, valid in MOUSE_DOWN, MOUSE_UP
mouse_x f32 // current horizontal mouse position in pixels, always valid except during mouse lock
mouse_y f32 // current vertical mouse position in pixels, always valid except during mouse lock
mouse_dx f32 // relative horizontal mouse movement since last frame, always valid
mouse_dy f32 // relative vertical mouse movement since last frame, always valid
scroll_x f32 // horizontal mouse wheel scroll distance, valid in MOUSE_SCROLL events
scroll_y f32 // vertical mouse wheel scroll distance, valid in MOUSE_SCROLL events
num_touches int // number of valid items in the touches[] array
touches [max_touchpoints]TouchPoint // current touch points, valid in TOUCHES_BEGIN, TOUCHES_MOVED, TOUCHES_ENDED
window_width int // current window- and framebuffer width in pixels, always valid
window_height int // current window- and framebuffer height in pixels, always valid
framebuffer_width int // = window_width * dpi_scale
framebuffer_height int // = window_height * dpi_scale
window_width int // current window- and framebuffer width in pixels, always valid
window_height int // current window- and framebuffer height in pixels, always valid
framebuffer_width int // = window_width * dpi_scale
framebuffer_height int // = window_height * dpi_scale
}
pub type Event = C.sapp_event

View file

@ -14,8 +14,8 @@ pub:
@[typedef]
pub struct C.sfons_desc_t {
pub:
width int // initial width of font atlas texture (default: 512, must be power of 2)
height int // initial height of font atlas texture (default: 512, must be power of 2)
width int // initial width of font atlas texture (default: 512, must be power of 2)
height int // initial height of font atlas texture (default: 512, must be power of 2)
allocator C.sfons_allocator_t // optional memory allocation overrides
}

View file

@ -26,8 +26,8 @@ pub type ContextDesc = C.sgl_context_desc_t
@[typedef]
pub struct C.sgl_context_desc_t {
max_vertices int // default: 64k
max_commands int // default: 16k
max_vertices int // default: 64k
max_commands int // default: 16k
color_format gfx.PixelFormat // C.sg_pixel_format
depth_format gfx.PixelFormat // C.sg_pixel_format
sample_count int
@ -38,10 +38,10 @@ pub type Desc = C.sgl_desc_t
@[typedef]
pub struct C.sgl_desc_t {
pub:
max_vertices int // size for vertex buffer
max_commands int // size of uniform- and command-buffers
context_pool_size int // max number of contexts (including default context), default: 4
pipeline_pool_size int // size of internal pipeline pool, default: 64
max_vertices int // size for vertex buffer
max_commands int // size of uniform- and command-buffers
context_pool_size int // max number of contexts (including default context), default: 4
pipeline_pool_size int // size of internal pipeline pool, default: 64
color_format gfx.PixelFormat // C.sg_pixel_format
depth_format gfx.PixelFormat // C.sg_pixel_format
sample_count int

View file

@ -79,10 +79,10 @@ Single format functions
pub struct BF_param {
pub mut:
pad_ch u8 = u8(` `) // padding char
len0 int = -1 // default len for whole the number or string
len1 int = 6 // number of decimal digits, if needed
positive bool = true // mandatory: the sign of the number passed
sign_flag bool // flag for print sign as prefix in padding
len0 int = -1 // default len for whole the number or string
len1 int = 6 // number of decimal digits, if needed
positive bool = true // mandatory: the sign of the number passed
sign_flag bool // flag for print sign as prefix in padding
align Align_text = .right // alignment of the string
allign Align_text = .right @[deprecated: 'use align instead'; deprecated_after: '2023-11-30']
rm_tail_zero bool // remove the tail zeros from floats

View file

@ -42,7 +42,7 @@ mut: // atomic
read_adr C.atomic_uintptr_t // if != NULL an obj can be read from here without wait
adr_read C.atomic_uintptr_t // used to identify origin of writesem
adr_written C.atomic_uintptr_t // used to identify origin of readsem
write_free u32 // for queue state
write_free u32 // for queue state
read_avail u32
buf_elem_write_idx u32
buf_elem_read_idx u32

View file

@ -75,8 +75,8 @@ mut:
pub struct Config {
pub:
scanner &scanner.Scanner = unsafe { nil }
run_checks bool = true
decode_values bool = true
run_checks bool = true
decode_values bool = true
}
// new_parser returns a new, stack allocated, `Parser`.

View file

@ -389,7 +389,7 @@ pub:
pub mut:
fields []ConstField // all the const fields in the `const (...)` block
end_comments []Comment // comments that after last const field
is_block bool // const() block
is_block bool // const() block
}
@[minify]
@ -528,7 +528,7 @@ pub struct AnonFn {
pub mut:
decl FnDecl
inherited_vars []Param
typ Type // the type of anonymous fn. Both .typ and .decl.name are auto generated
typ Type // the type of anonymous fn. Both .typ and .decl.name are auto generated
has_gen map[string]bool // a map of the names of all generic anon functions, generated from it
}
@ -583,7 +583,7 @@ pub mut:
return_type Type
return_type_pos token.Pos // `string` in `fn (u User) name() string` position
has_return bool
should_be_skipped bool // true, when -skip-unused could not find any usages of that function, starting from main + other known used functions
should_be_skipped bool // true, when -skip-unused could not find any usages of that function, starting from main + other known used functions
ninstances int // 0 for generic functions with no concrete instances
has_await bool // 'true' if this function uses JS.await
@ -665,7 +665,7 @@ pub mut:
is_conditional bool // true for `[if abc]fn(){}`
ctdefine_idx int // the index of the attribute, containing the compile time define [if mytag]
from_embedded_type Type // for interface only, fn from the embedded interface
from_embeded_type Type @[deprecated: 'use from_embedded_type instead'; deprecated_after: '2024-03-31']
from_embeded_type Type @[deprecated: 'use from_embedded_type instead'; deprecated_after: '2024-03-31']
}
fn (f &Fn) method_equals(o &Fn) bool {
@ -855,8 +855,8 @@ pub mut:
// [11, 12, 13] <- cast order (smartcasts)
// 12 <- the current casted type (typ)
pos token.Pos
is_used bool // whether the local variable was used in other expressions
is_changed bool // to detect mutable vars that are never changed
is_used bool // whether the local variable was used in other expressions
is_changed bool // to detect mutable vars that are never changed
ct_type_var ComptimeVarKind // comptime variable type
// (for setting the position after the or block for autofree)
is_or bool // `x := foo() or { ... }`

View file

@ -30,14 +30,14 @@ pub mut:
used_fns map[string]bool // filled in by the checker, when pref.skip_unused = true;
used_consts map[string]bool // filled in by the checker, when pref.skip_unused = true;
used_globals map[string]bool // filled in by the checker, when pref.skip_unused = true;
used_vweb_types []Type // vweb context types, filled in by checker, when pref.skip_unused = true;
used_maps int // how many times maps were used, filled in by checker, when pref.skip_unused = true;
used_vweb_types []Type // vweb context types, filled in by checker, when pref.skip_unused = true;
used_maps int // how many times maps were used, filled in by checker, when pref.skip_unused = true;
panic_handler FnPanicHandler = default_table_panic_handler
panic_userdata voidptr = unsafe { nil } // can be used to pass arbitrary data to panic_handler;
panic_npanics int
cur_fn &FnDecl = unsafe { nil } // previously stored in Checker.cur_fn and Gen.cur_fn
cur_concrete_types []Type // current concrete types, e.g. <int, string>
gostmts int // how many `go` statements there were in the parsed files.
cur_concrete_types []Type // current concrete types, e.g. <int, string>
gostmts int // how many `go` statements there were in the parsed files.
// When table.gostmts > 0, __VTHREADS__ is defined, which can be checked with `$if threads {`
enum_decls map[string]EnumDecl
module_deprecated map[string]bool

View file

@ -20,7 +20,7 @@ pub:
compiled_dir string // contains os.real_path() of the dir of the final file being compiled, or the dir itself when doing `v .`
module_path string
pub mut:
checker &checker.Checker = unsafe { nil }
checker &checker.Checker = unsafe { nil }
transformer &transformer.Transformer = unsafe { nil }
out_name_c string
out_name_js string
@ -42,8 +42,8 @@ pub mut:
mod_invalidates_paths map[string][]string // changes in mod `os`, invalidate only .v files, that do `import os`
mod_invalidates_mods map[string][]string // changes in mod `os`, force invalidation of mods, that do `import os`
path_invalidates_mods map[string][]string // changes in a .v file from `os`, invalidates `os`
crun_cache_keys []string // target executable + top level source files; filled in by Builder.should_rebuild
executable_exists bool // if the executable already exists, don't remove new executable after `v run`
crun_cache_keys []string // target executable + top level source files; filled in by Builder.should_rebuild
executable_exists bool // if the executable already exists, don't remove new executable after `v run`
}
pub fn new_builder(pref_ &pref.Preferences) Builder {

View file

@ -27,9 +27,9 @@ struct Mapper {
mut:
pref &pref.Preferences = unsafe { nil }
table &ast.Table = unsafe { nil }
file &ast.File = unsafe { nil }
node &ast.Node = unsafe { nil }
fn_decl &ast.FnDecl = unsafe { nil }
file &ast.File = unsafe { nil }
node &ast.Node = unsafe { nil }
fn_decl &ast.FnDecl = unsafe { nil }
caller_name string
dot_caller_name string
is_caller_used bool

View file

@ -59,9 +59,9 @@ pub mut:
should_abort bool // when too many errors/warnings/notices are accumulated, .should_abort becomes true. It is checked in statement/expression loops, so the checker can return early, instead of wasting time.
//
expected_type ast.Type
expected_or_type ast.Type // fn() or { 'this type' } eg. string. expected or block type
expected_expr_type ast.Type // if/match is_expr: expected_type
mod string // current module name
expected_or_type ast.Type // fn() or { 'this type' } eg. string. expected or block type
expected_expr_type ast.Type // if/match is_expr: expected_type
mod string // current module name
const_var &ast.ConstField = unsafe { nil } // the current constant, when checking const declarations
const_deps []string
const_names []string
@ -128,7 +128,7 @@ mut:
// doing_line_info int // a quick single file run when called with v -line-info (contains line nr to inspect)
// doing_line_path string // same, but stores the path being parsed
is_index_assign bool
comptime_call_pos int // needed for correctly checking use before decl for templates
comptime_call_pos int // needed for correctly checking use before decl for templates
goto_labels map[string]ast.GotoLabel // to check for unused goto labels
enum_data_type ast.Type
field_data_type ast.Type

Some files were not shown because too many files have changed in this diff Show more