mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
fmt: fix and simplify align of struct fields (#21995)
This commit is contained in:
parent
576a0abcc7
commit
ddb6685d8a
139 changed files with 553 additions and 519 deletions
|
@ -155,18 +155,18 @@ jobs:
|
||||||
echo "Build v-analyzer release"
|
echo "Build v-analyzer release"
|
||||||
v build.vsh release
|
v build.vsh release
|
||||||
|
|
||||||
- name: Format vlang/v-analyzer
|
# - name: Format vlang/v-analyzer
|
||||||
if: ${{ !cancelled() && steps.build.outcome == 'success' }}
|
# if: ${{ !cancelled() && steps.build.outcome == 'success' }}
|
||||||
run: |
|
# run: |
|
||||||
cd /tmp/v-analyzer
|
# cd /tmp/v-analyzer
|
||||||
set +e
|
# set +e
|
||||||
v fmt -c .
|
# v fmt -c .
|
||||||
exit_code=$?
|
# exit_code=$?
|
||||||
if [[ $exit_code -ne 0 && $exit_code -ne 5 ]]; then
|
# if [[ $exit_code -ne 0 && $exit_code -ne 5 ]]; then
|
||||||
# Don't fail if there are only internal errors (exit code 5).
|
# # Don't fail if there are only internal errors (exit code 5).
|
||||||
v fmt -diff .
|
# v fmt -diff .
|
||||||
exit 1
|
# exit 1
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
- name: Build vlang/go2v
|
- name: Build vlang/go2v
|
||||||
if: ${{ !cancelled() && steps.build.outcome == 'success' && matrix.os != 'macos-14' }}
|
if: ${{ !cancelled() && steps.build.outcome == 'success' && matrix.os != 'macos-14' }}
|
||||||
|
|
|
@ -87,9 +87,9 @@ pub mut:
|
||||||
show_stats bool
|
show_stats bool
|
||||||
show_asserts bool
|
show_asserts bool
|
||||||
progress_mode 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
|
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
|
failed_cmds shared []string
|
||||||
reporter Reporter = Reporter(NormalReporter{})
|
reporter Reporter = Reporter(NormalReporter{})
|
||||||
hash string // used as part of the name of the temporary directory created for tests, to ease cleanup
|
hash string // used as part of the name of the temporary directory created for tests, to ease cleanup
|
||||||
|
|
|
@ -121,8 +121,8 @@ pub fn clone_or_pull(remote_git_url string, local_worktree_path string) {
|
||||||
|
|
||||||
pub struct VGitContext {
|
pub struct VGitContext {
|
||||||
pub:
|
pub:
|
||||||
cc string = 'cc' // what compiler to use
|
cc string = 'cc' // what compiler to use
|
||||||
workdir string = '/tmp' // the base working folder
|
workdir string = '/tmp' // the base working folder
|
||||||
commit_v string = 'master' // the commit-ish that needs to be prepared
|
commit_v string = 'master' // the commit-ish that needs to be prepared
|
||||||
path_v string // where is the local working copy v repo
|
path_v string // where is the local working copy v repo
|
||||||
path_vc string // where is the local working copy vc repo
|
path_vc string // where is the local working copy vc repo
|
||||||
|
|
|
@ -35,11 +35,11 @@ mut:
|
||||||
path_vc string // the full path to the vc folder inside workdir.
|
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
|
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.
|
cc string = 'cc' // the C compiler to use for bootstrapping.
|
||||||
cleanup bool // should the tool run a cleanup first
|
cleanup bool // should the tool run a cleanup first
|
||||||
use_cache bool // use local cached copies for --vrepo and --vcrepo in
|
use_cache bool // use local cached copies for --vrepo and --vcrepo in
|
||||||
fresh_tcc bool // do use `make fresh_tcc`
|
fresh_tcc bool // do use `make fresh_tcc`
|
||||||
is_bisect bool // bisect mode; usage: `cmd/tools/oldv -b -c './v run bug.v'`
|
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
|
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() {
|
fn (mut c Context) compile_oldv_if_needed() {
|
||||||
|
|
|
@ -26,7 +26,7 @@ mut:
|
||||||
meta map[string]MetaData // aggregated meta data, read from all .json files
|
meta map[string]MetaData // aggregated meta data, read from all .json files
|
||||||
all_lines_per_file map[string][]int // aggregated by load_meta
|
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
|
lines_per_file map[string]map[int]int // incremented by process_target, based on each .csv file
|
||||||
processed_points u64
|
processed_points u64
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ enum VCS {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct VCSInfo {
|
struct VCSInfo {
|
||||||
dir string @[required]
|
dir string @[required]
|
||||||
args struct {
|
args struct {
|
||||||
install string @[required]
|
install string @[required]
|
||||||
version string @[required] // flag to specify a version, added to install.
|
version string @[required] // flag to specify a version, added to install.
|
||||||
|
|
|
@ -23,20 +23,20 @@ mut:
|
||||||
folder string // the folder in which the repl will write its temporary source files
|
folder string // the folder in which the repl will write its temporary source files
|
||||||
last_output string // the last repl output
|
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
|
alias map[string]string // all the alias used in the import
|
||||||
includes []string // all the #include statements
|
includes []string // all the #include statements
|
||||||
functions []string // all the user function declarations
|
functions []string // all the user function declarations
|
||||||
functions_name []string // all the user function names
|
functions_name []string // all the user function names
|
||||||
structs []string // all the struct definitions
|
structs []string // all the struct definitions
|
||||||
enums []string // all the enum definitions
|
enums []string // all the enum definitions
|
||||||
consts []string // all the const definitions
|
consts []string // all the const definitions
|
||||||
types []string // all the type definitions
|
types []string // all the type definitions
|
||||||
interfaces []string // all the interface definitions
|
interfaces []string // all the interface definitions
|
||||||
lines []string // all the other lines/statements
|
lines []string // all the other lines/statements
|
||||||
temp_lines []string // all the temporary expressions/printlns
|
temp_lines []string // all the temporary expressions/printlns
|
||||||
vstartup_lines []string // lines in the `VSTARTUP` file
|
vstartup_lines []string // lines in the `VSTARTUP` file
|
||||||
eval_func_lines []string // same line of the `VSTARTUP` file, but used to test fn type
|
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
|
const is_stdin_a_pipe = os.is_atty(0) == 0
|
||||||
|
|
|
@ -74,10 +74,10 @@ mut:
|
||||||
errmsg string
|
errmsg string
|
||||||
rmfile string
|
rmfile string
|
||||||
runcmd RunCommandKind = .system
|
runcmd RunCommandKind = .system
|
||||||
expect string = expect_nothing
|
expect string = expect_nothing
|
||||||
starts_with string = starts_with_nothing
|
starts_with string = starts_with_nothing
|
||||||
ends_with string = ends_with_nothing
|
ends_with string = ends_with_nothing
|
||||||
contains string = contains_nothing
|
contains string = contains_nothing
|
||||||
output string
|
output string
|
||||||
before_cb FnCheck = unsafe { nil }
|
before_cb FnCheck = unsafe { nil }
|
||||||
after_cb FnCheck = unsafe { nil }
|
after_cb FnCheck = unsafe { nil }
|
||||||
|
|
|
@ -28,7 +28,7 @@ pub mut:
|
||||||
kind ErrorKind @[required]
|
kind ErrorKind @[required]
|
||||||
pub:
|
pub:
|
||||||
// General message
|
// General message
|
||||||
message string @[required]
|
message string @[required]
|
||||||
details string // Details about how to resolve or fix the situation
|
details string // Details about how to resolve or fix the situation
|
||||||
file_path string // file where the error have origin
|
file_path string // file where the error have origin
|
||||||
pos token.Pos // position in the file
|
pos token.Pos // position in the file
|
||||||
|
|
|
@ -5136,7 +5136,7 @@ import db.sqlite
|
||||||
// sets a custom table name. Default is struct name (case-sensitive)
|
// sets a custom table name. Default is struct name (case-sensitive)
|
||||||
@[table: 'customers']
|
@[table: 'customers']
|
||||||
struct Customer {
|
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
|
name string
|
||||||
nr_orders int
|
nr_orders int
|
||||||
country ?string
|
country ?string
|
||||||
|
|
|
@ -11,9 +11,9 @@ const show_state = os.getenv('VERBOSE') != ''
|
||||||
|
|
||||||
struct BFState {
|
struct BFState {
|
||||||
mut:
|
mut:
|
||||||
pc u16 // program counter (PC) register
|
pc u16 // program counter (PC) register
|
||||||
address u16 // a 16-bit address register, serving as an index to the memory below
|
address u16 // a 16-bit address register, serving as an index to the memory below
|
||||||
program string // the BF program
|
program string // the BF program
|
||||||
memory []u8 = []u8{len: 65536} // we have 2^16 bytes of memory
|
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 `[`.
|
targets map[int]int // a mapping for the program address of a `[` to its corresponding `]`, and from a `]` to its corresponding opening `[`.
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ struct App {
|
||||||
mut:
|
mut:
|
||||||
gg &gg.Context = unsafe { nil }
|
gg &gg.Context = unsafe { nil }
|
||||||
draw_flag bool = true
|
draw_flag bool = true
|
||||||
dpi_scale f32 = 1.0
|
dpi_scale f32 = 1.0
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_frame(mut app App) {
|
fn on_frame(mut app App) {
|
||||||
|
|
|
@ -33,9 +33,9 @@ const pg_db = os.getenv_opt('PGDATABASE') or { 'test' }
|
||||||
|
|
||||||
@[table: 'modules']
|
@[table: 'modules']
|
||||||
struct Module {
|
struct Module {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
name string
|
name string
|
||||||
nr_downloads int @[sql: u64]
|
nr_downloads int @[sql: u64]
|
||||||
creator User
|
creator User
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,13 +48,13 @@ struct User {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Parent {
|
struct Parent {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
name string
|
name string
|
||||||
children []Child @[fkey: 'parent_id']
|
children []Child @[fkey: 'parent_id']
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Child {
|
struct Child {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
parent_id int
|
parent_id int
|
||||||
name string
|
name string
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,13 @@ import term.ui as tui
|
||||||
import flag
|
import flag
|
||||||
|
|
||||||
struct DocTest {
|
struct DocTest {
|
||||||
show_version bool @[short: v; xdoc: 'Show version and exit']
|
show_version bool @[short: v; xdoc: 'Show version and exit']
|
||||||
debug_level int @[long: debug; short: d; xdoc: 'Debug level']
|
debug_level int @[long: debug; short: d; xdoc: 'Debug level']
|
||||||
level f32 @[only: l; xdoc: 'Do not show this']
|
level f32 @[only: l; xdoc: 'Do not show this']
|
||||||
example string
|
example string
|
||||||
square bool
|
square bool
|
||||||
multi int @[only: m; repeats]
|
multi int @[only: m; repeats]
|
||||||
wroom []int @[short: w]
|
wroom []int @[short: w]
|
||||||
the_limit string
|
the_limit string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,13 +4,13 @@ import flag
|
||||||
@[name: 'flag_layout_editor']
|
@[name: 'flag_layout_editor']
|
||||||
@[version: '1.0']
|
@[version: '1.0']
|
||||||
struct DocTest {
|
struct DocTest {
|
||||||
show_version bool @[short: v; xdoc: 'Show version and exit']
|
show_version bool @[short: v; xdoc: 'Show version and exit']
|
||||||
debug_level int @[long: debug; short: d; xdoc: 'Debug level']
|
debug_level int @[long: debug; short: d; xdoc: 'Debug level']
|
||||||
level f32 @[only: l; xdoc: 'Do not show this']
|
level f32 @[only: l; xdoc: 'Do not show this']
|
||||||
example string
|
example string
|
||||||
square bool
|
square bool
|
||||||
multi int @[only: m; repeats]
|
multi int @[only: m; repeats]
|
||||||
wroom []int @[short: w]
|
wroom []int @[short: w]
|
||||||
the_limit string
|
the_limit string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
struct App {
|
||||||
mut:
|
mut:
|
||||||
gg &gg.Context = unsafe { nil }
|
gg &gg.Context = unsafe { nil }
|
||||||
steps int = 30
|
steps int = 30
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import v.util.version
|
||||||
@[table: 'benchmark']
|
@[table: 'benchmark']
|
||||||
struct Task {
|
struct Task {
|
||||||
mut:
|
mut:
|
||||||
id u32 @[primary; serial; sql: serial]
|
id u32 @[primary; serial; sql: serial]
|
||||||
title string
|
title string
|
||||||
status string
|
status string
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ struct App {
|
||||||
@[table: 'benchmark']
|
@[table: 'benchmark']
|
||||||
struct Task {
|
struct Task {
|
||||||
mut:
|
mut:
|
||||||
id u32 @[primary; serial; sql: serial]
|
id u32 @[primary; serial; sql: serial]
|
||||||
title string
|
title string
|
||||||
status string
|
status string
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ pub mut:
|
||||||
mat_map map[string]int // mapping material name to its material index
|
mat_map map[string]int // mapping material name to its material index
|
||||||
texture map[string]gfx.Image // GPU loaded texture map
|
texture map[string]gfx.Image // GPU loaded texture map
|
||||||
sampler map[string]gfx.Sampler // GPU loaded sampler
|
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
|
rend_data []Render_data // render data used for the rendering
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@ import sokol.audio
|
||||||
|
|
||||||
struct AppState {
|
struct AppState {
|
||||||
mut:
|
mut:
|
||||||
frame_0 int // offset of the current audio frames, relative to the start of the music
|
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
|
frames [2048]f32 // a copy of the last rendered audio frames
|
||||||
gg &gg.Context = unsafe { nil } // used for drawing
|
gg &gg.Context = unsafe { nil } // used for drawing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,8 +98,8 @@ mut:
|
||||||
secondary_color_idx int = 28
|
secondary_color_idx int = 28
|
||||||
bg_color ui.Color = ui.Color{0, 0, 0}
|
bg_color ui.Color = ui.Color{0, 0, 0}
|
||||||
drawing [][]ui.Color = [][]ui.Color{len: h, init: []ui.Color{len: w}}
|
drawing [][]ui.Color = [][]ui.Color{len: h, init: []ui.Color{len: w}}
|
||||||
size int = 1
|
size int = 1
|
||||||
should_redraw bool = true
|
should_redraw bool = true
|
||||||
is_dragging bool
|
is_dragging bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -245,7 +245,7 @@ mut:
|
||||||
}
|
}
|
||||||
captured bool
|
captured bool
|
||||||
color termui.Color = grey
|
color termui.Color = grey
|
||||||
app &App = unsafe { nil }
|
app &App = unsafe { nil }
|
||||||
}
|
}
|
||||||
|
|
||||||
// randomize spawn the rat in a new spot within the playable field
|
// randomize spawn the rat in a new spot within the playable field
|
||||||
|
|
|
@ -90,7 +90,7 @@ mut:
|
||||||
show_help_flag bool
|
show_help_flag bool
|
||||||
// zip container
|
// zip container
|
||||||
zip &szip.Zip = unsafe { nil } // pointer to the szip structure
|
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
|
// memory buffer
|
||||||
mem_buf voidptr // buffer used to load items from files/containers
|
mem_buf voidptr // buffer used to load items from files/containers
|
||||||
mem_buf_size int // size of the buffer
|
mem_buf_size int // size of the buffer
|
||||||
|
|
|
@ -2,7 +2,7 @@ module main
|
||||||
|
|
||||||
@[table: 'products']
|
@[table: 'products']
|
||||||
struct Product {
|
struct Product {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
user_id int
|
user_id int
|
||||||
name string @[sql_type: 'TEXT']
|
name string @[sql_type: 'TEXT']
|
||||||
created_at string @[default: 'CURRENT_TIMESTAMP']
|
created_at string @[default: 'CURRENT_TIMESTAMP']
|
||||||
|
|
|
@ -3,9 +3,9 @@ module main
|
||||||
@[table: 'users']
|
@[table: 'users']
|
||||||
pub struct User {
|
pub struct User {
|
||||||
mut:
|
mut:
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
username string @[sql_type: 'TEXT'; unique]
|
username string @[sql_type: 'TEXT'; unique]
|
||||||
password string @[sql_type: 'TEXT']
|
password string @[sql_type: 'TEXT']
|
||||||
active bool
|
active bool
|
||||||
products []Product @[fkey: 'user_id']
|
products []Product @[fkey: 'user_id']
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ struct Todo {
|
||||||
pub mut:
|
pub mut:
|
||||||
// `id` is the primary field. The attribute `sql: serial` acts like AUTO INCREMENT in sql.
|
// `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.
|
// 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
|
name string
|
||||||
completed bool
|
completed bool
|
||||||
created time.Time
|
created time.Time
|
||||||
|
|
|
@ -234,7 +234,7 @@ Create a new file `article.v`:
|
||||||
module main
|
module main
|
||||||
|
|
||||||
struct Article {
|
struct Article {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
title string
|
title string
|
||||||
text string
|
text string
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
module main
|
module main
|
||||||
|
|
||||||
struct Article {
|
struct Article {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
title string
|
title string
|
||||||
text string
|
text string
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ struct VMemoryBlock {
|
||||||
mut:
|
mut:
|
||||||
id int
|
id int
|
||||||
cap isize
|
cap isize
|
||||||
start &u8 = 0
|
start &u8 = 0
|
||||||
previous &VMemoryBlock = 0
|
previous &VMemoryBlock = 0
|
||||||
remaining isize
|
remaining isize
|
||||||
current &u8 = 0
|
current &u8 = 0
|
||||||
|
|
|
@ -21,9 +21,9 @@ pub mut:
|
||||||
pre_execute FnCommandCallback = unsafe { nil }
|
pre_execute FnCommandCallback = unsafe { nil }
|
||||||
execute FnCommandCallback = unsafe { nil }
|
execute FnCommandCallback = unsafe { nil }
|
||||||
post_execute FnCommandCallback = unsafe { nil }
|
post_execute FnCommandCallback = unsafe { nil }
|
||||||
disable_help bool @[deprecated: 'use defaults.help 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_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_version bool @[deprecated: 'use defaults.version instead'; deprecated_after: '2024-06-31']
|
||||||
disable_flags bool
|
disable_flags bool
|
||||||
sort_flags bool
|
sort_flags bool
|
||||||
sort_commands bool
|
sort_commands bool
|
||||||
|
|
|
@ -392,8 +392,8 @@ pub fn default_c_level() int {
|
||||||
pub struct CompressParams {
|
pub struct CompressParams {
|
||||||
pub:
|
pub:
|
||||||
compression_level int // 1~22
|
compression_level int // 1~22
|
||||||
nb_threads int = 1 // how many threads will be spawned to compress in parallel
|
nb_threads int = 1 // how many threads will be spawned to compress in parallel
|
||||||
checksum_flag bool = true
|
checksum_flag bool = true
|
||||||
strategy ZSTD_strategy = ZSTD_strategy.zstd_default
|
strategy ZSTD_strategy = ZSTD_strategy.zstd_default
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ struct TestCustomSqlType {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TestCustomWrongSqlType {
|
struct TestCustomWrongSqlType {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
custom string
|
custom string
|
||||||
custom1 string @[sql_type: 'VARCHAR']
|
custom1 string @[sql_type: 'VARCHAR']
|
||||||
custom2 string @[sql_type: 'money']
|
custom2 string @[sql_type: 'money']
|
||||||
|
@ -22,7 +22,7 @@ struct TestCustomWrongSqlType {
|
||||||
|
|
||||||
struct TestTimeType {
|
struct TestTimeType {
|
||||||
mut:
|
mut:
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
username string
|
username string
|
||||||
created_at time.Time @[sql_type: 'DATETIME']
|
created_at time.Time @[sql_type: 'DATETIME']
|
||||||
updated_at string @[sql_type: 'DATETIME']
|
updated_at string @[sql_type: 'DATETIME']
|
||||||
|
|
|
@ -13,7 +13,7 @@ struct TestCustomSqlType {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TestCustomWrongSqlType {
|
struct TestCustomWrongSqlType {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
custom string
|
custom string
|
||||||
custom1 string @[sql_type: 'VARCHAR']
|
custom1 string @[sql_type: 'VARCHAR']
|
||||||
custom2 string @[sql_type: 'money']
|
custom2 string @[sql_type: 'money']
|
||||||
|
@ -22,7 +22,7 @@ struct TestCustomWrongSqlType {
|
||||||
|
|
||||||
struct TestTimeType {
|
struct TestTimeType {
|
||||||
mut:
|
mut:
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
username string
|
username string
|
||||||
created_at time.Time @[sql_type: 'TIMESTAMP']
|
created_at time.Time @[sql_type: 'TIMESTAMP']
|
||||||
updated_at string @[sql_type: 'TIMESTAMP']
|
updated_at string @[sql_type: 'TIMESTAMP']
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
import db.sqlite
|
import db.sqlite
|
||||||
|
|
||||||
struct Parent {
|
struct Parent {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
name string
|
name string
|
||||||
children []Child @[fkey: 'parent_id']
|
children []Child @[fkey: 'parent_id']
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Child {
|
struct Child {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
name string
|
name string
|
||||||
parent_id int
|
parent_id int
|
||||||
babies []Baby @[fkey: 'child_id']
|
babies []Baby @[fkey: 'child_id']
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Baby {
|
struct Baby {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
name string
|
name string
|
||||||
child_id int
|
child_id int
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ pub struct C.sqlite3_stmt {
|
||||||
@[heap]
|
@[heap]
|
||||||
pub struct Stmt {
|
pub struct Stmt {
|
||||||
stmt &C.sqlite3_stmt = unsafe { nil }
|
stmt &C.sqlite3_stmt = unsafe { nil }
|
||||||
db &DB = unsafe { nil }
|
db &DB = unsafe { nil }
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SQLError {
|
struct SQLError {
|
||||||
|
|
|
@ -3,18 +3,18 @@ import db.sqlite
|
||||||
import time
|
import time
|
||||||
|
|
||||||
struct TestCustomSqlType {
|
struct TestCustomSqlType {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
custom string @[sql_type: 'INTEGER']
|
custom string @[sql_type: 'INTEGER']
|
||||||
custom1 string @[sql_type: 'TEXT']
|
custom1 string @[sql_type: 'TEXT']
|
||||||
custom2 string @[sql_type: 'REAL']
|
custom2 string @[sql_type: 'REAL']
|
||||||
custom3 string @[sql_type: 'NUMERIC']
|
custom3 string @[sql_type: 'NUMERIC']
|
||||||
custom4 string
|
custom4 string
|
||||||
custom5 int
|
custom5 int
|
||||||
custom6 time.Time
|
custom6 time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TestDefaultAttribute {
|
struct TestDefaultAttribute {
|
||||||
id string @[primary; sql: serial]
|
id string @[primary; sql: serial]
|
||||||
name string
|
name string
|
||||||
created_at ?string @[default: 'CURRENT_TIME']
|
created_at ?string @[default: 'CURRENT_TIME']
|
||||||
created_at1 ?string @[default: 'CURRENT_DATE']
|
created_at1 ?string @[default: 'CURRENT_DATE']
|
||||||
|
|
|
@ -4,7 +4,7 @@ type Connection = sqlite.DB
|
||||||
|
|
||||||
struct User {
|
struct User {
|
||||||
pub:
|
pub:
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
name string
|
name string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,9 +52,9 @@ pub type Sqlite3_vfs = C.sqlite3_vfs
|
||||||
pub struct C.sqlite3_vfs {
|
pub struct C.sqlite3_vfs {
|
||||||
pub mut:
|
pub mut:
|
||||||
// version 1 and later fields
|
// version 1 and later fields
|
||||||
iVersion int // Structure version number (currently 3)
|
iVersion int // Structure version number (currently 3)
|
||||||
szOsFile int // Size of subclassed sqlite3_file
|
szOsFile int // Size of subclassed sqlite3_file
|
||||||
mxPathname int // Maximum file pathname length
|
mxPathname int // Maximum file pathname length
|
||||||
pNext &Sqlite3_vfs // Next registered VFS
|
pNext &Sqlite3_vfs // Next registered VFS
|
||||||
zName &char // Name of this virtual file system
|
zName &char // Name of this virtual file system
|
||||||
pAppData voidptr // Pointer to application-specific data
|
pAppData voidptr // Pointer to application-specific data
|
||||||
|
|
|
@ -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.
|
// Why not `interface?` Interfaces require memory allocation so it is simpler to pass a struct.
|
||||||
pub struct Allocator {
|
pub struct Allocator {
|
||||||
pub:
|
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 }
|
remap fn (voidptr, voidptr, usize, usize, bool) voidptr = unsafe { nil }
|
||||||
free_part fn (voidptr, voidptr, usize, usize) bool = unsafe { nil }
|
free_part fn (voidptr, voidptr, usize, usize) bool = unsafe { nil }
|
||||||
free_ fn (voidptr, voidptr, usize) bool = unsafe { nil }
|
free_ fn (voidptr, voidptr, usize) bool = unsafe { nil }
|
||||||
can_release_part fn (voidptr, u32) bool = unsafe { nil }
|
can_release_part fn (voidptr, u32) bool = unsafe { nil }
|
||||||
allocates_zeros fn (voidptr) 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
|
page_size fn (voidptr) usize = unsafe { nil } // not a constant field because some platforms might have different page sizes depending on configs
|
||||||
|
|
|
@ -56,16 +56,16 @@ pub mut:
|
||||||
|
|
||||||
end_line u8 = `\n`
|
end_line u8 = `\n`
|
||||||
end_line_len int = csv.endline_cr_len // size of the endline rune \n = 1, \r\n = 2
|
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 u8 = `,` // comma is the default separator
|
||||||
separator_len int = 1 // size of the separator rune
|
separator_len int = 1 // size of the separator rune
|
||||||
quote u8 = `"` // double quote is the standard quote char
|
quote u8 = `"` // double quote is the standard quote char
|
||||||
quote_remove bool // if true clear the cell from the quotes
|
quote_remove bool // if true clear the cell from the quotes
|
||||||
comment u8 = `#` // every line that start with the quote char is ignored
|
comment u8 = `#` // every line that start with the quote char is ignored
|
||||||
|
|
||||||
default_cell string = '*' // return this string if out of the csv boundaries
|
default_cell string = '*' // return this string if out of the csv boundaries
|
||||||
empty_cell string = '#' // retunrn this if empty cell
|
empty_cell string = '#' // retunrn this if empty cell
|
||||||
// ram buffer
|
// 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 voidptr // buffer used to load chars from file
|
||||||
mem_buf_size i64 // size of the buffer
|
mem_buf_size i64 // size of the buffer
|
||||||
mem_buf_start i64 = -1 // start index in the file of the read buffer
|
mem_buf_start i64 = -1 // start index in the file of the read buffer
|
||||||
|
@ -74,7 +74,7 @@ pub mut:
|
||||||
csv_map [][]i64
|
csv_map [][]i64
|
||||||
// header
|
// header
|
||||||
header_row int = -1 // row index of the header in the csv_map
|
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
|
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
|
default_cell string = '*' // return this string if out of the csv boundaries
|
||||||
empty_cell string // return this string if empty cell
|
empty_cell string // return this string if empty cell
|
||||||
end_line_len int = csv.endline_cr_len // size of the endline rune
|
end_line_len int = csv.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
|
||||||
quote_remove bool // if true clear the cell from the quotes
|
quote_remove bool // if true clear the cell from the quotes
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
|
|
@ -25,7 +25,7 @@ pub:
|
||||||
default_cell string = '*' // return this string if out of the csv boundaries
|
default_cell string = '*' // return this string if out of the csv boundaries
|
||||||
empty_cell string // return this string if empty cell
|
empty_cell string // return this string if empty cell
|
||||||
end_line_len int = endline_cr_len // size of the endline rune
|
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 {
|
pub struct SequentialReader {
|
||||||
|
@ -41,16 +41,16 @@ pub mut:
|
||||||
|
|
||||||
end_line u8 = `\n`
|
end_line u8 = `\n`
|
||||||
end_line_len int = endline_cr_len // size of the endline rune \n = 1, \r\n = 2
|
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 u8 = `,` // comma is the default separator
|
||||||
separator_len int = 1 // size of the separator rune
|
separator_len int = 1 // size of the separator rune
|
||||||
quote u8 = `"` // double quote is the standard quote char
|
quote u8 = `"` // double quote is the standard quote char
|
||||||
|
|
||||||
comment u8 = `#` // every line that start with the quote char is ignored
|
comment u8 = `#` // every line that start with the quote char is ignored
|
||||||
|
|
||||||
default_cell string = '*' // return this string if out of the csv boundaries
|
default_cell string = '*' // return this string if out of the csv boundaries
|
||||||
empty_cell string = '#' // retunrn this if empty cell
|
empty_cell string = '#' // retunrn this if empty cell
|
||||||
// ram buffer
|
// 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 voidptr // buffer used to load chars from file
|
||||||
mem_buf_size i64 // size of the buffer
|
mem_buf_size i64 // size of the buffer
|
||||||
mem_buf_start i64 = -1 // start index in the file of the read buffer
|
mem_buf_start i64 = -1 // start index in the file of the read buffer
|
||||||
|
|
|
@ -17,7 +17,7 @@ pub:
|
||||||
// other XML nodes, CDATA, plain text, or comments.
|
// other XML nodes, CDATA, plain text, or comments.
|
||||||
pub struct XMLNode {
|
pub struct XMLNode {
|
||||||
pub:
|
pub:
|
||||||
name string @[required]
|
name string @[required]
|
||||||
attributes map[string]string
|
attributes map[string]string
|
||||||
children []XMLNodeContents
|
children []XMLNodeContents
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ pub:
|
||||||
|
|
||||||
pub struct DocumentType {
|
pub struct DocumentType {
|
||||||
pub:
|
pub:
|
||||||
name string @[required]
|
name string @[required]
|
||||||
dtd DTDInfo
|
dtd DTDInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,9 +42,9 @@ import os
|
||||||
@[version: '1.2.3']
|
@[version: '1.2.3']
|
||||||
@[name: 'app']
|
@[name: 'app']
|
||||||
struct Config {
|
struct Config {
|
||||||
show_version bool @[short: v; xdoc: 'Show version and exit']
|
show_version bool @[short: v; xdoc: 'Show version and exit']
|
||||||
debug_level int @[long: debug; short: d; xdoc: 'Debug level']
|
debug_level int @[long: debug; short: d; xdoc: 'Debug level']
|
||||||
level f32 @[only: l; xdoc: 'This doc text is overwritten']
|
level f32 @[only: l; xdoc: 'This doc text is overwritten']
|
||||||
example string
|
example string
|
||||||
square bool
|
square bool
|
||||||
show_help bool @[long: help; short: h]
|
show_help bool @[long: help; short: h]
|
||||||
|
|
|
@ -15,8 +15,8 @@ struct Config {
|
||||||
paths []string @[tail]
|
paths []string @[tail]
|
||||||
not_mapped string = 'not changed'
|
not_mapped string = 'not changed'
|
||||||
e bool
|
e bool
|
||||||
b bool @[long: Dev; only: d]
|
b bool @[long: Dev; only: d]
|
||||||
u string @[short: c]
|
u string @[short: c]
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_cmd_exe() {
|
fn test_cmd_exe() {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
module flag
|
module flag
|
||||||
|
|
||||||
struct FlagData {
|
struct FlagData {
|
||||||
raw string @[required]
|
raw string @[required]
|
||||||
field_name string @[required]
|
field_name string @[required]
|
||||||
delimiter string
|
delimiter string
|
||||||
name string
|
name string
|
||||||
arg ?string
|
arg ?string
|
||||||
|
@ -28,7 +28,7 @@ pub enum Style {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct StructInfo {
|
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
|
attrs map[string]string // collection of `@[x: y]` sat on the struct, read via reflection
|
||||||
fields map[string]StructField
|
fields map[string]StructField
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ fn (sf StructField) shortest_match_name() ?string {
|
||||||
@[params]
|
@[params]
|
||||||
pub struct ParseConfig {
|
pub struct ParseConfig {
|
||||||
pub:
|
pub:
|
||||||
delimiter string = '-' // delimiter used for flags
|
delimiter string = '-' // delimiter used for flags
|
||||||
style Style = .short_long // expected flag style
|
style Style = .short_long // expected flag style
|
||||||
stop ?string // single, usually '--', string that stops parsing flags/options
|
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
|
skip u16 // skip this amount in the input argument array, usually `1` for skipping executable or subcmd entry
|
||||||
|
@ -81,7 +81,7 @@ pub:
|
||||||
@[params]
|
@[params]
|
||||||
pub struct DocConfig {
|
pub struct DocConfig {
|
||||||
pub:
|
pub:
|
||||||
delimiter string = '-' // delimiter used for flags
|
delimiter string = '-' // delimiter used for flags
|
||||||
style Style = .short_long // expected flag style
|
style Style = .short_long // expected flag style
|
||||||
pub mut:
|
pub mut:
|
||||||
name string // application name
|
name string // application name
|
||||||
|
|
|
@ -153,13 +153,13 @@ Footer content'
|
||||||
@[name: 'flag_to_doc_test']
|
@[name: 'flag_to_doc_test']
|
||||||
@[version: '1.0']
|
@[version: '1.0']
|
||||||
struct DocTest {
|
struct DocTest {
|
||||||
show_version bool @[short: v; xdoc: 'Show version and exit']
|
show_version bool @[short: v; xdoc: 'Show version and exit']
|
||||||
debug_level int @[long: debug; short: d; xdoc: 'Debug level']
|
debug_level int @[long: debug; short: d; xdoc: 'Debug level']
|
||||||
level f32 @[only: l; xdoc: 'Override this doc string']
|
level f32 @[only: l; xdoc: 'Override this doc string']
|
||||||
example string
|
example string
|
||||||
square bool
|
square bool
|
||||||
multi int @[only: m; repeats]
|
multi int @[only: m; repeats]
|
||||||
wroom []int @[short: w]
|
wroom []int @[short: w]
|
||||||
the_limit string
|
the_limit string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,9 @@ struct Config {
|
||||||
device []string @[short: d]
|
device []string @[short: d]
|
||||||
paths []string @[tail]
|
paths []string @[tail]
|
||||||
amount int = 1
|
amount int = 1
|
||||||
verbosity int @[repeats; short: v]
|
verbosity int @[repeats; short: v]
|
||||||
show_version bool @[long: version]
|
show_version bool @[long: version]
|
||||||
no_long_beef bool @[only: n]
|
no_long_beef bool @[only: n]
|
||||||
}
|
}
|
||||||
|
|
||||||
struct LongConfig {
|
struct LongConfig {
|
||||||
|
@ -39,7 +39,7 @@ struct LongConfig {
|
||||||
some_test string = 'abc' @[long: test]
|
some_test string = 'abc' @[long: test]
|
||||||
path string @[tail]
|
path string @[tail]
|
||||||
amount int = 1
|
amount int = 1
|
||||||
show_version bool @[long: version]
|
show_version bool @[long: version]
|
||||||
}
|
}
|
||||||
|
|
||||||
struct IgnoreConfig {
|
struct IgnoreConfig {
|
||||||
|
|
|
@ -9,9 +9,9 @@ const exe_and_go_flag_args_with_tail = ['/path/to/exe', '-version', '--flag', '-
|
||||||
struct Prefs {
|
struct Prefs {
|
||||||
flag bool
|
flag bool
|
||||||
flag_value string
|
flag_value string
|
||||||
version bool @[short: v]
|
version bool @[short: v]
|
||||||
is_live bool @[long: live]
|
is_live bool @[long: live]
|
||||||
is_done bool @[long: done]
|
is_done bool @[long: done]
|
||||||
test string
|
test string
|
||||||
defines []string @[long: define; short: d]
|
defines []string @[long: define; short: d]
|
||||||
tail []string @[tail]
|
tail []string @[tail]
|
||||||
|
|
|
@ -21,8 +21,8 @@ struct Config {
|
||||||
verbosity int @[repeats; short: v]
|
verbosity int @[repeats; short: v]
|
||||||
not_mapped string = 'not changed'
|
not_mapped string = 'not changed'
|
||||||
x bool
|
x bool
|
||||||
b bool @[only: y]
|
b bool @[only: y]
|
||||||
u int @[short: z]
|
u int @[short: z]
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_pure_posix_short() {
|
fn test_pure_posix_short() {
|
||||||
|
|
|
@ -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']
|
'-done', '-d', 'two', '-live', 'run', '/path/to']
|
||||||
|
|
||||||
struct Prefs {
|
struct Prefs {
|
||||||
version bool @[short: v]
|
version bool @[short: v]
|
||||||
is_live bool @[long: live]
|
is_live bool @[long: live]
|
||||||
is_done bool @[long: done]
|
is_done bool @[long: done]
|
||||||
test string
|
test string
|
||||||
defines []string @[long: define; short: d]
|
defines []string @[long: define; short: d]
|
||||||
tail []string @[tail]
|
tail []string @[tail]
|
||||||
|
|
|
@ -84,28 +84,28 @@ pub:
|
||||||
resized_fn FNEvent = unsafe { nil } // Called once when the window has changed its size.
|
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.
|
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
|
// 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
|
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)
|
swap_interval int = 1 // 1 = 60fps, 2 = 30fps etc. The preferred swap interval (ignored on some platforms)
|
||||||
// ved needs this
|
// ved needs this
|
||||||
// init_text bool
|
// init_text bool
|
||||||
font_path string
|
font_path string
|
||||||
custom_bold_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 for embedding
|
||||||
font_bytes_normal []u8
|
font_bytes_normal []u8
|
||||||
font_bytes_bold []u8
|
font_bytes_bold []u8
|
||||||
font_bytes_mono []u8
|
font_bytes_mono []u8
|
||||||
font_bytes_italic []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
|
// drag&drop
|
||||||
enable_dragndrop bool // enable file dropping (drag'n'drop), default is false
|
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)
|
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_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]
|
@[heap]
|
||||||
|
@ -179,8 +179,8 @@ pub mut:
|
||||||
scroll_x int
|
scroll_x int
|
||||||
scroll_y int
|
scroll_y int
|
||||||
//
|
//
|
||||||
key_modifiers Modifier // the current key modifiers
|
key_modifiers Modifier // the current key modifiers
|
||||||
key_repeat bool // whether the pressed key was an autorepeated one
|
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 [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,
|
pressed_keys_edge [key_code_max]bool // true when the previous state of pressed_keys,
|
||||||
// *before* the current event was different
|
// *before* the current event was different
|
||||||
|
|
|
@ -249,9 +249,9 @@ pub:
|
||||||
font_bytes_italic []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
|
// drag&drop
|
||||||
enable_dragndrop bool // enable file dropping (drag'n'drop), default is false
|
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)
|
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
|
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
|
scale f32 = 1.0
|
||||||
width int
|
width int
|
||||||
height int
|
height int
|
||||||
window JS.Window @[noinit]
|
window JS.Window @[noinit]
|
||||||
config Config
|
config Config
|
||||||
user_data voidptr
|
user_data voidptr
|
||||||
ui_mode bool
|
ui_mode bool
|
||||||
|
@ -285,8 +285,8 @@ pub mut:
|
||||||
scroll_x int
|
scroll_x int
|
||||||
scroll_y int
|
scroll_y int
|
||||||
//
|
//
|
||||||
key_modifiers Modifier // the current key modifiers
|
key_modifiers Modifier // the current key modifiers
|
||||||
key_repeat bool // whether the pressed key was an autorepeated one
|
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 [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,
|
pressed_keys_edge [key_code_max]bool // true when the previous state of pressed_keys,
|
||||||
context JS.CanvasRenderingContext2D @[noinit]
|
context JS.CanvasRenderingContext2D @[noinit]
|
||||||
|
|
|
@ -29,7 +29,7 @@ pub struct PenConfig {
|
||||||
pub:
|
pub:
|
||||||
color gx.Color
|
color gx.Color
|
||||||
line_type PenLineType = .solid
|
line_type PenLineType = .solid
|
||||||
thickness int = 1
|
thickness int = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Size {
|
pub struct Size {
|
||||||
|
|
|
@ -279,8 +279,8 @@ pub:
|
||||||
wrap_v gfx.Wrap = .clamp_to_edge
|
wrap_v gfx.Wrap = .clamp_to_edge
|
||||||
min_filter gfx.Filter = .linear
|
min_filter gfx.Filter = .linear
|
||||||
mag_filter gfx.Filter = .linear
|
mag_filter gfx.Filter = .linear
|
||||||
num_mipmaps int = 1
|
num_mipmaps int = 1
|
||||||
num_slices int = 1
|
num_slices int = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw_image_with_config takes in a config that details how the
|
// draw_image_with_config takes in a config that details how the
|
||||||
|
|
|
@ -14,7 +14,7 @@ pub mut:
|
||||||
img_id int
|
img_id int
|
||||||
img_rect Rect // defines the size and position on image when rendering to the screen
|
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
|
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
|
z f32
|
||||||
color gx.Color = gx.white
|
color gx.Color = gx.white
|
||||||
effect ImageEffect = .alpha
|
effect ImageEffect = .alpha
|
||||||
|
|
|
@ -171,8 +171,8 @@ pub:
|
||||||
y int
|
y int
|
||||||
text string
|
text string
|
||||||
|
|
||||||
color Color = gx.black
|
color Color = gx.black
|
||||||
size int = 16
|
size int = 16
|
||||||
align gx.HorizontalAlign = .left
|
align gx.HorizontalAlign = .left
|
||||||
vertical_align gx.VerticalAlign = .top
|
vertical_align gx.VerticalAlign = .top
|
||||||
max_width int
|
max_width int
|
||||||
|
|
|
@ -7,8 +7,8 @@ pub const align_right = HorizontalAlign.right
|
||||||
@[params]
|
@[params]
|
||||||
pub struct TextCfg {
|
pub struct TextCfg {
|
||||||
pub:
|
pub:
|
||||||
color Color = black
|
color Color = black
|
||||||
size int = 16
|
size int = 16
|
||||||
align HorizontalAlign = .left
|
align HorizontalAlign = .left
|
||||||
vertical_align VerticalAlign = .top
|
vertical_align VerticalAlign = .top
|
||||||
max_width int
|
max_width int
|
||||||
|
|
|
@ -19,7 +19,7 @@ pub struct BufferedReaderConfig {
|
||||||
pub:
|
pub:
|
||||||
reader Reader
|
reader Reader
|
||||||
cap int = 128 * 1024 // large for fast reading of big(ish) files
|
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.
|
// BufferedReadLineConfig are options that can be given to the read_line() function.
|
||||||
|
|
|
@ -22,11 +22,11 @@ enum JobTitle {
|
||||||
struct Employee {
|
struct Employee {
|
||||||
mut:
|
mut:
|
||||||
name string
|
name string
|
||||||
family string @[json: '-'] // this field will be skipped
|
family string @[json: '-'] // this field will be skipped
|
||||||
age int
|
age int
|
||||||
salary f32
|
salary f32
|
||||||
title JobTitle @[json: 'ETitle'] // the key for this field will be 'ETitle', not 'title'
|
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]
|
// TODO: document @[raw]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@ struct PostTag {
|
||||||
id string
|
id string
|
||||||
parent ?&PostTag
|
parent ?&PostTag
|
||||||
visibility string
|
visibility string
|
||||||
created_at string @[json: 'createdAt']
|
created_at string @[json: 'createdAt']
|
||||||
metadata string @[raw]
|
metadata string @[raw]
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_main() {
|
fn test_main() {
|
||||||
|
|
|
@ -9,7 +9,7 @@ pub:
|
||||||
skip ?int
|
skip ?int
|
||||||
fields ?[]string // This breaks the compiler when encoding to JSON
|
fields ?[]string // This breaks the compiler when encoding to JSON
|
||||||
conflicts ?bool
|
conflicts ?bool
|
||||||
read_quorum ?int @[json: r]
|
read_quorum ?int @[json: r]
|
||||||
update ?bool
|
update ?bool
|
||||||
stable ?bool
|
stable ?bool
|
||||||
stale ?string
|
stale ?string
|
||||||
|
|
|
@ -449,7 +449,7 @@ fn test_pretty() {
|
||||||
|
|
||||||
struct Foo3 {
|
struct Foo3 {
|
||||||
name string
|
name string
|
||||||
age int @[omitempty]
|
age int @[omitempty]
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_omit_empty() {
|
fn test_omit_empty() {
|
||||||
|
|
|
@ -34,7 +34,7 @@ mut:
|
||||||
time_format TimeFormat
|
time_format TimeFormat
|
||||||
custom_time_format string = 'MMMM Do YY N kk:mm:ss A' // timestamp with custom format
|
custom_time_format string = 'MMMM Do YY N kk:mm:ss A' // timestamp with custom format
|
||||||
short_tag bool
|
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:
|
pub mut:
|
||||||
output_file_name string // log output to this file
|
output_file_name string // log output to this file
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,10 +10,10 @@ import net.http.mime
|
||||||
@[params]
|
@[params]
|
||||||
pub struct StaticServeParams {
|
pub struct StaticServeParams {
|
||||||
pub mut:
|
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
|
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.
|
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.
|
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()'`
|
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
|
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
|
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
|
shutdown_after time.Duration = time.infinite // after this time has passed, the webserver will gracefully shutdown on its own
|
||||||
|
|
|
@ -31,7 +31,7 @@ pub mut:
|
||||||
cert_key string // the path to a key.pem file, containing private keys for the client certificate(s)
|
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
|
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
|
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
|
// callbacks to allow custom reporting code to run, while the request is running, and to implement streaming
|
||||||
on_redirect RequestRedirectFn = unsafe { nil }
|
on_redirect RequestRedirectFn = unsafe { nil }
|
||||||
on_progress RequestProgressFn = unsafe { nil }
|
on_progress RequestProgressFn = unsafe { nil }
|
||||||
|
|
|
@ -44,7 +44,7 @@ pub mut:
|
||||||
cert_key string
|
cert_key string
|
||||||
in_memory_verification bool // if true, verify, cert, and cert_key are read from memory, not from a file
|
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
|
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
|
// callbacks to allow custom reporting code to run, while the request is running, and to implement streaming
|
||||||
on_redirect RequestRedirectFn = unsafe { nil }
|
on_redirect RequestRedirectFn = unsafe { nil }
|
||||||
on_progress RequestProgressFn = unsafe { nil }
|
on_progress RequestProgressFn = unsafe { nil }
|
||||||
|
|
|
@ -29,14 +29,14 @@ pub struct Server {
|
||||||
mut:
|
mut:
|
||||||
state ServerStatus = .closed
|
state ServerStatus = .closed
|
||||||
pub mut:
|
pub mut:
|
||||||
addr string = ':${http.default_server_port}'
|
addr string = ':${http.default_server_port}'
|
||||||
port int = http.default_server_port @[deprecated: 'use addr']
|
port int = http.default_server_port @[deprecated: 'use addr']
|
||||||
handler Handler = DebugHandler{}
|
handler Handler = DebugHandler{}
|
||||||
read_timeout time.Duration = 30 * time.second
|
read_timeout time.Duration = 30 * time.second
|
||||||
write_timeout time.Duration = 30 * time.second
|
write_timeout time.Duration = 30 * time.second
|
||||||
accept_timeout time.Duration = 30 * time.second
|
accept_timeout time.Duration = 30 * time.second
|
||||||
pool_channel_slots int = 1024
|
pool_channel_slots int = 1024
|
||||||
worker_num int = runtime.nr_jobs()
|
worker_num int = runtime.nr_jobs()
|
||||||
listener net.TcpListener
|
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.
|
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 struct WaitTillRunningParams {
|
||||||
pub:
|
pub:
|
||||||
max_retries int = 100 // how many times to check for the status, for each single s.wait_till_running() call
|
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
|
// wait_till_running allows you to synchronise your calling (main) thread, with the state of the server
|
||||||
|
|
|
@ -317,14 +317,14 @@ fn escape(s string, mode EncodingMode) string {
|
||||||
pub struct URL {
|
pub struct URL {
|
||||||
pub mut:
|
pub mut:
|
||||||
scheme string
|
scheme string
|
||||||
opaque string // encoded opaque data
|
opaque string // encoded opaque data
|
||||||
user &Userinfo = unsafe { nil } // username and password information
|
user &Userinfo = unsafe { nil } // username and password information
|
||||||
host string // host or host:port
|
host string // host or host:port
|
||||||
path string // path (relative paths may omit leading slash)
|
path string // path (relative paths may omit leading slash)
|
||||||
raw_path string // encoded path hint (see escaped_path method)
|
raw_path string // encoded path hint (see escaped_path method)
|
||||||
force_query bool // append a query ('?') even if raw_query is empty
|
force_query bool // append a query ('?') even if raw_query is empty
|
||||||
raw_query string // encoded query values, without '?'
|
raw_query string // encoded query values, without '?'
|
||||||
fragment string // fragment for references, without '#'
|
fragment string // fragment for references, without '#'
|
||||||
}
|
}
|
||||||
|
|
||||||
// debug returns a string representation of *ALL* the fields of the given URL
|
// debug returns a string representation of *ALL* the fields of the given URL
|
||||||
|
|
|
@ -24,8 +24,8 @@ pub struct Client {
|
||||||
is_server bool
|
is_server bool
|
||||||
mut:
|
mut:
|
||||||
ssl_conn &ssl.SSLConn = unsafe { nil } // secure connection used when wss is used
|
ssl_conn &ssl.SSLConn = unsafe { nil } // secure connection used when wss is used
|
||||||
flags []Flag // flags used in handshake
|
flags []Flag // flags used in handshake
|
||||||
fragments []Fragment // current fragments
|
fragments []Fragment // current fragments
|
||||||
message_callbacks []MessageEventHandler // all callbacks on_message
|
message_callbacks []MessageEventHandler // all callbacks on_message
|
||||||
error_callbacks []ErrorEventHandler // all callbacks on_error
|
error_callbacks []ErrorEventHandler // all callbacks on_error
|
||||||
open_callbacks []OpenEventHandler // all callbacks on_open
|
open_callbacks []OpenEventHandler // all callbacks on_open
|
||||||
|
@ -37,10 +37,10 @@ pub:
|
||||||
read_timeout i64
|
read_timeout i64
|
||||||
write_timeout i64
|
write_timeout i64
|
||||||
pub mut:
|
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
|
conn &net.TcpConn = unsafe { nil } // underlying TCP socket connection
|
||||||
nonce_size int = 16 // size of nounce used for masking
|
nonce_size int = 16 // size of nounce used for masking
|
||||||
panic_on_callback bool // set to true of callbacks can panic
|
panic_on_callback bool // set to true of callbacks can panic
|
||||||
client_state shared ClientState // current state of connection
|
client_state shared ClientState // current state of connection
|
||||||
// logger used to log messages
|
// logger used to log messages
|
||||||
logger &log.Logger = default_logger
|
logger &log.Logger = default_logger
|
||||||
|
@ -83,8 +83,8 @@ pub enum OPCode {
|
||||||
@[params]
|
@[params]
|
||||||
pub struct ClientOpt {
|
pub struct ClientOpt {
|
||||||
pub:
|
pub:
|
||||||
read_timeout i64 = 30 * time.second
|
read_timeout i64 = 30 * time.second
|
||||||
write_timeout i64 = 30 * time.second
|
write_timeout i64 = 30 * time.second
|
||||||
logger &log.Logger = default_logger
|
logger &log.Logger = default_logger
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import rand
|
||||||
|
|
||||||
pub struct ServerState {
|
pub struct ServerState {
|
||||||
mut:
|
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
|
state State = .closed // current state of connection
|
||||||
pub mut:
|
pub mut:
|
||||||
clients map[string]&ServerClient // clients connected to this server
|
clients map[string]&ServerClient // clients connected to this server
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import db.sqlite
|
import db.sqlite
|
||||||
|
|
||||||
struct User {
|
struct User {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
name string
|
name string
|
||||||
country string
|
country string
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import db.sqlite
|
import db.sqlite
|
||||||
|
|
||||||
struct Person {
|
struct Person {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
age int
|
age int
|
||||||
brothers []Brother @[fkey: 'person_id']
|
brothers []Brother @[fkey: 'person_id']
|
||||||
sisters []Sister @[fkey: 'person_id']
|
sisters []Sister @[fkey: 'person_id']
|
||||||
|
@ -11,13 +11,13 @@ struct Person {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Brother {
|
struct Brother {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
person_id int
|
person_id int
|
||||||
name string
|
name string
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Sister {
|
struct Sister {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
person_id int
|
person_id int
|
||||||
name string
|
name string
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import db.sqlite
|
import db.sqlite
|
||||||
|
|
||||||
struct User {
|
struct User {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
name string
|
name string
|
||||||
age int
|
age int
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import db.sqlite
|
||||||
|
|
||||||
@[table: 'bad_table']
|
@[table: 'bad_table']
|
||||||
struct Bad {
|
struct Bad {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
link string
|
link string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import db.sqlite
|
||||||
import rand
|
import rand
|
||||||
|
|
||||||
struct Parent {
|
struct Parent {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
name string
|
name string
|
||||||
children []Child @[fkey: 'parent_id']
|
children []Child @[fkey: 'parent_id']
|
||||||
notes []Note @[fkey: 'owner_id']
|
notes []Note @[fkey: 'owner_id']
|
||||||
|
@ -12,14 +12,14 @@ struct Parent {
|
||||||
|
|
||||||
struct Child {
|
struct Child {
|
||||||
mut:
|
mut:
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
parent_id int
|
parent_id int
|
||||||
name string
|
name string
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Note {
|
struct Note {
|
||||||
mut:
|
mut:
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
owner_id int
|
owner_id int
|
||||||
text string
|
text string
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ struct Entity {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct EntityWithFloatPrimary {
|
struct EntityWithFloatPrimary {
|
||||||
id f64 @[primary]
|
id f64 @[primary]
|
||||||
name string
|
name string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,7 +398,7 @@ fn test_orm_insert_with_child_element_and_no_table() {
|
||||||
|
|
||||||
@[table: 'customers']
|
@[table: 'customers']
|
||||||
struct Customer {
|
struct Customer {
|
||||||
id i64 @[primary; sql: serial]
|
id i64 @[primary; sql: serial]
|
||||||
name string
|
name string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import db.sqlite
|
||||||
import orm
|
import orm
|
||||||
|
|
||||||
struct User {
|
struct User {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
name string
|
name string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import db.sqlite
|
import db.sqlite
|
||||||
|
|
||||||
struct User {
|
struct User {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
name string
|
name string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import db.sqlite
|
import db.sqlite
|
||||||
|
|
||||||
struct User {
|
struct User {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
name string
|
name string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ fn (db MockDB) last_id() int {
|
||||||
@[table: 'foo']
|
@[table: 'foo']
|
||||||
struct Foo {
|
struct Foo {
|
||||||
mut:
|
mut:
|
||||||
id u64 @[primary; sql: serial]
|
id u64 @[primary; sql: serial]
|
||||||
a string
|
a string
|
||||||
// b string [default: '"yes"']
|
// b string [default: '"yes"']
|
||||||
c ?string
|
c ?string
|
||||||
|
@ -222,7 +222,7 @@ fn test_option_struct_fields_and_none() {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Bar {
|
struct Bar {
|
||||||
id u64 @[primary; sql: serial]
|
id u64 @[primary; sql: serial]
|
||||||
name ?string
|
name ?string
|
||||||
age int
|
age int
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,16 +5,16 @@ import time
|
||||||
|
|
||||||
@[table: 'foos']
|
@[table: 'foos']
|
||||||
struct Foo {
|
struct Foo {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
name string
|
name string
|
||||||
created_at time.Time @[default: 'CURRENT_TIME']
|
created_at time.Time @[default: 'CURRENT_TIME']
|
||||||
updated_at ?string @[sql_type: 'TIMESTAMP']
|
updated_at ?string @[sql_type: 'TIMESTAMP']
|
||||||
deleted_at ?time.Time
|
deleted_at ?time.Time
|
||||||
children []Child @[fkey: 'parent_id']
|
children []Child @[fkey: 'parent_id']
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Child {
|
struct Child {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
parent_id int
|
parent_id int
|
||||||
name string
|
name string
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ struct Boat {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Color {
|
struct Color {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
hex string
|
hex string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
import db.sqlite
|
import db.sqlite
|
||||||
|
|
||||||
struct Account {
|
struct Account {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
name string
|
name string
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Note {
|
struct Note {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
content string
|
content string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import db.sqlite
|
import db.sqlite
|
||||||
|
|
||||||
struct User {
|
struct User {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
name string
|
name string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import db.sqlite
|
||||||
const offset_const = 2
|
const offset_const = 2
|
||||||
|
|
||||||
struct Module {
|
struct Module {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
name string
|
name string
|
||||||
nr_downloads int
|
nr_downloads int
|
||||||
test_id u64
|
test_id u64
|
||||||
|
@ -18,9 +18,9 @@ struct Module {
|
||||||
|
|
||||||
@[table: 'userlist']
|
@[table: 'userlist']
|
||||||
struct User {
|
struct User {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
age int
|
age int
|
||||||
name string @[sql: 'username']
|
name string @[sql: 'username']
|
||||||
is_customer bool
|
is_customer bool
|
||||||
skipped_string string @[skip]
|
skipped_string string @[skip]
|
||||||
skipped_string2 string @[sql: '-']
|
skipped_string2 string @[sql: '-']
|
||||||
|
@ -33,7 +33,7 @@ struct Foo {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TestTime {
|
struct TestTime {
|
||||||
id int @[primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
create time.Time
|
create time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,8 @@ pub enum AssetMode {
|
||||||
pub struct C.ANativeActivity {
|
pub struct C.ANativeActivity {
|
||||||
pub:
|
pub:
|
||||||
assetManager &AssetManager = unsafe { nil } // Pointer to the Asset Manager instance for the application.
|
assetManager &AssetManager = unsafe { nil } // Pointer to the Asset Manager instance for the application.
|
||||||
clazz voidptr // (jobject) The NativeActivity object handle.
|
clazz voidptr // (jobject) The NativeActivity object handle.
|
||||||
env voidptr // (JNIEnv *) JNI context for the main thread of the app.
|
env voidptr // (JNIEnv *) JNI context for the main thread of the app.
|
||||||
externalDataPath &char // Path to this application's external (removable/mountable) data directory.
|
externalDataPath &char // Path to this application's external (removable/mountable) data directory.
|
||||||
instance voidptr // This is the native instance of the application.
|
instance voidptr // This is the native instance of the application.
|
||||||
internalDataPath &char // Path to this application's internal data directory.
|
internalDataPath &char // Path to this application's internal data directory.
|
||||||
|
|
|
@ -18,13 +18,13 @@ pub enum ProcessState {
|
||||||
@[heap]
|
@[heap]
|
||||||
pub struct Process {
|
pub struct Process {
|
||||||
pub mut:
|
pub mut:
|
||||||
filename string // the process's command file path
|
filename string // the process's command file path
|
||||||
pid int // the PID of the process
|
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
|
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
|
status ProcessState = .not_started // the current status of the process
|
||||||
err string // if the process fails, contains the reason why
|
err string // if the process fails, contains the reason why
|
||||||
args []string // the arguments that the command takes
|
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.
|
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_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')
|
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()
|
use_stdio_ctl bool // when true, then you can use p.stdin_write(), p.stdout_slurp() and p.stderr_slurp()
|
||||||
|
|
|
@ -44,15 +44,15 @@ pub mut:
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub:
|
pub:
|
||||||
port int = 8080
|
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
|
err_cb fn (voidptr, picohttpparser.Request, mut picohttpparser.Response, IError) = default_error_callback
|
||||||
raw_cb fn (mut Picoev, int, int) = unsafe { nil }
|
raw_cb fn (mut Picoev, int, int) = unsafe { nil }
|
||||||
user_data voidptr = unsafe { nil }
|
user_data voidptr = unsafe { nil }
|
||||||
timeout_secs int = 8
|
timeout_secs int = 8
|
||||||
max_headers int = 100
|
max_headers int = 100
|
||||||
max_read int = 4096
|
max_read int = 4096
|
||||||
max_write int = 8192
|
max_write int = 8192
|
||||||
family net.AddrFamily = .ip6
|
family net.AddrFamily = .ip6
|
||||||
host string
|
host string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ pub:
|
||||||
// Contains event loop, file descriptor table, timeouts, buffers, and configuration.
|
// Contains event loop, file descriptor table, timeouts, buffers, and configuration.
|
||||||
@[heap]
|
@[heap]
|
||||||
pub struct Picoev {
|
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
|
error_callback fn (voidptr, picohttpparser.Request, mut picohttpparser.Response, IError) = default_error_callback
|
||||||
raw_callback fn (mut Picoev, int, int) = unsafe { nil }
|
raw_callback fn (mut Picoev, int, int) = unsafe { nil }
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ pub struct Picoev {
|
||||||
max_write int = 8192
|
max_write int = 8192
|
||||||
|
|
||||||
err_cb fn (voidptr, picohttpparser.Request, mut picohttpparser.Response, IError) = default_error_callback @[deprecated: 'use `error_callback` instead']
|
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:
|
mut:
|
||||||
loop &LoopType = unsafe { nil }
|
loop &LoopType = unsafe { nil }
|
||||||
file_descriptors [max_fds]&Target
|
file_descriptors [max_fds]&Target
|
||||||
|
|
|
@ -23,8 +23,8 @@ pub struct Readline {
|
||||||
pub mut:
|
pub mut:
|
||||||
is_raw bool
|
is_raw bool
|
||||||
orig_termios termios.Termios // Linux
|
orig_termios termios.Termios // Linux
|
||||||
current []rune // Line being edited
|
current []rune // Line being edited
|
||||||
cursor int // Cursor position
|
cursor int // Cursor position
|
||||||
overwrite bool
|
overwrite bool
|
||||||
cursor_row_offset int
|
cursor_row_offset int
|
||||||
prompt string
|
prompt string
|
||||||
|
|
|
@ -295,7 +295,7 @@ pub mut:
|
||||||
prog_len int // regex program len
|
prog_len int // regex program len
|
||||||
// char classes storage
|
// char classes storage
|
||||||
cc []CharClass // char class list
|
cc []CharClass // char class list
|
||||||
cc_index int // index
|
cc_index int // index
|
||||||
// groups
|
// groups
|
||||||
group_count int // number of groups in this regex struct
|
group_count int // number of groups in this regex struct
|
||||||
groups []int // groups index results
|
groups []int // groups index results
|
||||||
|
@ -314,7 +314,7 @@ pub mut:
|
||||||
// flags
|
// flags
|
||||||
flag int // flag for optional parameters
|
flag int // flag for optional parameters
|
||||||
// Debug/log
|
// 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
|
log_func FnLog = simple_log // log function, can be customized by the user
|
||||||
query string // query string
|
query string // query string
|
||||||
}
|
}
|
||||||
|
@ -375,7 +375,7 @@ fn (mut re RE) reset_src() {
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
struct BslsStruct {
|
struct BslsStruct {
|
||||||
ch rune // meta char
|
ch rune // meta char
|
||||||
validator FnValidator = unsafe { nil } // validator function pointer
|
validator FnValidator = unsafe { nil } // validator function pointer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -525,9 +525,9 @@ const cc_end = 4
|
||||||
|
|
||||||
struct CharClass {
|
struct CharClass {
|
||||||
mut:
|
mut:
|
||||||
cc_type int // type of cc token
|
cc_type int // type of cc token
|
||||||
ch0 rune // first char of the interval a-b a in this case
|
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
|
ch1 rune // second char of the interval a-b b in this case
|
||||||
validator FnValidator = unsafe { nil } // validator function pointer
|
validator FnValidator = unsafe { nil } // validator function pointer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1812,7 +1812,7 @@ pub mut:
|
||||||
first_match int = -1 // index of the first match
|
first_match int = -1 // index of the first match
|
||||||
pc int = -1 // program counter
|
pc int = -1 // program counter
|
||||||
i int = -1 // source string index
|
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
|
last_dot_pc int = -1 // last dot chat pc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,9 +45,9 @@ pub:
|
||||||
// fail_cb fn (&u8) = unsafe { nil }
|
// fail_cb fn (&u8) = unsafe { nil }
|
||||||
|
|
||||||
user_data voidptr // these are the user-provided callbacks with user data
|
user_data voidptr // these are the user-provided callbacks with user data
|
||||||
init_userdata_cb fn (voidptr) = unsafe { nil }
|
init_userdata_cb fn (voidptr) = unsafe { nil }
|
||||||
frame_userdata_cb fn (voidptr) = unsafe { nil }
|
frame_userdata_cb fn (voidptr) = unsafe { nil }
|
||||||
cleanup_userdata_cb fn (voidptr) = unsafe { nil }
|
cleanup_userdata_cb fn (voidptr) = unsafe { nil }
|
||||||
event_userdata_cb fn (&Event, voidptr) = unsafe { nil }
|
event_userdata_cb fn (&Event, voidptr) = unsafe { nil }
|
||||||
// fail_userdata_cb fn (&char, voidptr) = unsafe { nil }
|
// fail_userdata_cb fn (&char, voidptr) = unsafe { nil }
|
||||||
|
|
||||||
|
@ -89,25 +89,25 @@ pub type Desc = C.sapp_desc
|
||||||
@[typedef]
|
@[typedef]
|
||||||
pub struct C.sapp_event {
|
pub struct C.sapp_event {
|
||||||
pub:
|
pub:
|
||||||
frame_count u64 // current frame counter, always valid, useful for checking if two events were issued in the same frame
|
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
|
@type EventType // the event type, always valid
|
||||||
key_code KeyCode // the virtual key code, only valid in KEY_UP, KEY_DOWN
|
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
|
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
|
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
|
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_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_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_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_dx f32 // relative horizontal mouse movement since last frame, always valid
|
||||||
mouse_dy f32 // relative vertical 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_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
|
scroll_y f32 // vertical mouse wheel scroll distance, valid in MOUSE_SCROLL events
|
||||||
num_touches int // number of valid items in the touches[] array
|
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
|
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_width int // current window- and framebuffer width in pixels, always valid
|
||||||
window_height int // current window- and framebuffer height in pixels, always valid
|
window_height int // current window- and framebuffer height in pixels, always valid
|
||||||
framebuffer_width int // = window_width * dpi_scale
|
framebuffer_width int // = window_width * dpi_scale
|
||||||
framebuffer_height int // = window_height * dpi_scale
|
framebuffer_height int // = window_height * dpi_scale
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type Event = C.sapp_event
|
pub type Event = C.sapp_event
|
||||||
|
|
|
@ -14,8 +14,8 @@ pub:
|
||||||
@[typedef]
|
@[typedef]
|
||||||
pub struct C.sfons_desc_t {
|
pub struct C.sfons_desc_t {
|
||||||
pub:
|
pub:
|
||||||
width int // initial width 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)
|
height int // initial height of font atlas texture (default: 512, must be power of 2)
|
||||||
allocator C.sfons_allocator_t // optional memory allocation overrides
|
allocator C.sfons_allocator_t // optional memory allocation overrides
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@ pub type ContextDesc = C.sgl_context_desc_t
|
||||||
|
|
||||||
@[typedef]
|
@[typedef]
|
||||||
pub struct C.sgl_context_desc_t {
|
pub struct C.sgl_context_desc_t {
|
||||||
max_vertices int // default: 64k
|
max_vertices int // default: 64k
|
||||||
max_commands int // default: 16k
|
max_commands int // default: 16k
|
||||||
color_format gfx.PixelFormat // C.sg_pixel_format
|
color_format gfx.PixelFormat // C.sg_pixel_format
|
||||||
depth_format gfx.PixelFormat // C.sg_pixel_format
|
depth_format gfx.PixelFormat // C.sg_pixel_format
|
||||||
sample_count int
|
sample_count int
|
||||||
|
@ -38,10 +38,10 @@ pub type Desc = C.sgl_desc_t
|
||||||
@[typedef]
|
@[typedef]
|
||||||
pub struct C.sgl_desc_t {
|
pub struct C.sgl_desc_t {
|
||||||
pub:
|
pub:
|
||||||
max_vertices int // size for vertex buffer
|
max_vertices int // size for vertex buffer
|
||||||
max_commands int // size of uniform- and command-buffers
|
max_commands int // size of uniform- and command-buffers
|
||||||
context_pool_size int // max number of contexts (including default context), default: 4
|
context_pool_size int // max number of contexts (including default context), default: 4
|
||||||
pipeline_pool_size int // size of internal pipeline pool, default: 64
|
pipeline_pool_size int // size of internal pipeline pool, default: 64
|
||||||
color_format gfx.PixelFormat // C.sg_pixel_format
|
color_format gfx.PixelFormat // C.sg_pixel_format
|
||||||
depth_format gfx.PixelFormat // C.sg_pixel_format
|
depth_format gfx.PixelFormat // C.sg_pixel_format
|
||||||
sample_count int
|
sample_count int
|
||||||
|
|
|
@ -79,10 +79,10 @@ Single format functions
|
||||||
pub struct BF_param {
|
pub struct BF_param {
|
||||||
pub mut:
|
pub mut:
|
||||||
pad_ch u8 = u8(` `) // padding char
|
pad_ch u8 = u8(` `) // padding char
|
||||||
len0 int = -1 // default len for whole the number or string
|
len0 int = -1 // default len for whole the number or string
|
||||||
len1 int = 6 // number of decimal digits, if needed
|
len1 int = 6 // number of decimal digits, if needed
|
||||||
positive bool = true // mandatory: the sign of the number passed
|
positive bool = true // mandatory: the sign of the number passed
|
||||||
sign_flag bool // flag for print sign as prefix in padding
|
sign_flag bool // flag for print sign as prefix in padding
|
||||||
align Align_text = .right // alignment of the string
|
align Align_text = .right // alignment of the string
|
||||||
allign Align_text = .right @[deprecated: 'use align instead'; deprecated_after: '2023-11-30']
|
allign Align_text = .right @[deprecated: 'use align instead'; deprecated_after: '2023-11-30']
|
||||||
rm_tail_zero bool // remove the tail zeros from floats
|
rm_tail_zero bool // remove the tail zeros from floats
|
||||||
|
|
|
@ -42,7 +42,7 @@ mut: // atomic
|
||||||
read_adr C.atomic_uintptr_t // if != NULL an obj can be read from here without wait
|
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_read C.atomic_uintptr_t // used to identify origin of writesem
|
||||||
adr_written C.atomic_uintptr_t // used to identify origin of readsem
|
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
|
read_avail u32
|
||||||
buf_elem_write_idx u32
|
buf_elem_write_idx u32
|
||||||
buf_elem_read_idx u32
|
buf_elem_read_idx u32
|
||||||
|
|
|
@ -75,8 +75,8 @@ mut:
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub:
|
pub:
|
||||||
scanner &scanner.Scanner = unsafe { nil }
|
scanner &scanner.Scanner = unsafe { nil }
|
||||||
run_checks bool = true
|
run_checks bool = true
|
||||||
decode_values bool = true
|
decode_values bool = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// new_parser returns a new, stack allocated, `Parser`.
|
// new_parser returns a new, stack allocated, `Parser`.
|
||||||
|
|
|
@ -389,7 +389,7 @@ pub:
|
||||||
pub mut:
|
pub mut:
|
||||||
fields []ConstField // all the const fields in the `const (...)` block
|
fields []ConstField // all the const fields in the `const (...)` block
|
||||||
end_comments []Comment // comments that after last const field
|
end_comments []Comment // comments that after last const field
|
||||||
is_block bool // const() block
|
is_block bool // const() block
|
||||||
}
|
}
|
||||||
|
|
||||||
@[minify]
|
@[minify]
|
||||||
|
@ -528,7 +528,7 @@ pub struct AnonFn {
|
||||||
pub mut:
|
pub mut:
|
||||||
decl FnDecl
|
decl FnDecl
|
||||||
inherited_vars []Param
|
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
|
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 Type
|
||||||
return_type_pos token.Pos // `string` in `fn (u User) name() string` position
|
return_type_pos token.Pos // `string` in `fn (u User) name() string` position
|
||||||
has_return bool
|
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
|
ninstances int // 0 for generic functions with no concrete instances
|
||||||
has_await bool // 'true' if this function uses JS.await
|
has_await bool // 'true' if this function uses JS.await
|
||||||
|
|
||||||
|
@ -665,7 +665,7 @@ pub mut:
|
||||||
is_conditional bool // true for `[if abc]fn(){}`
|
is_conditional bool // true for `[if abc]fn(){}`
|
||||||
ctdefine_idx int // the index of the attribute, containing the compile time define [if mytag]
|
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_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 {
|
fn (f &Fn) method_equals(o &Fn) bool {
|
||||||
|
@ -855,8 +855,8 @@ pub mut:
|
||||||
// [11, 12, 13] <- cast order (smartcasts)
|
// [11, 12, 13] <- cast order (smartcasts)
|
||||||
// 12 <- the current casted type (typ)
|
// 12 <- the current casted type (typ)
|
||||||
pos token.Pos
|
pos token.Pos
|
||||||
is_used bool // whether the local variable was used in other expressions
|
is_used bool // whether the local variable was used in other expressions
|
||||||
is_changed bool // to detect mutable vars that are never changed
|
is_changed bool // to detect mutable vars that are never changed
|
||||||
ct_type_var ComptimeVarKind // comptime variable type
|
ct_type_var ComptimeVarKind // comptime variable type
|
||||||
// (for setting the position after the or block for autofree)
|
// (for setting the position after the or block for autofree)
|
||||||
is_or bool // `x := foo() or { ... }`
|
is_or bool // `x := foo() or { ... }`
|
||||||
|
|
|
@ -30,14 +30,14 @@ pub mut:
|
||||||
used_fns map[string]bool // filled in by the checker, when pref.skip_unused = true;
|
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_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_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_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_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_handler FnPanicHandler = default_table_panic_handler
|
||||||
panic_userdata voidptr = unsafe { nil } // can be used to pass arbitrary data to panic_handler;
|
panic_userdata voidptr = unsafe { nil } // can be used to pass arbitrary data to panic_handler;
|
||||||
panic_npanics int
|
panic_npanics int
|
||||||
cur_fn &FnDecl = unsafe { nil } // previously stored in Checker.cur_fn and Gen.cur_fn
|
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>
|
cur_concrete_types []Type // current concrete types, e.g. <int, string>
|
||||||
gostmts int // how many `go` statements there were in the parsed files.
|
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 {`
|
// When table.gostmts > 0, __VTHREADS__ is defined, which can be checked with `$if threads {`
|
||||||
enum_decls map[string]EnumDecl
|
enum_decls map[string]EnumDecl
|
||||||
module_deprecated map[string]bool
|
module_deprecated map[string]bool
|
||||||
|
|
|
@ -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 .`
|
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
|
module_path string
|
||||||
pub mut:
|
pub mut:
|
||||||
checker &checker.Checker = unsafe { nil }
|
checker &checker.Checker = unsafe { nil }
|
||||||
transformer &transformer.Transformer = unsafe { nil }
|
transformer &transformer.Transformer = unsafe { nil }
|
||||||
out_name_c string
|
out_name_c string
|
||||||
out_name_js 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_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`
|
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`
|
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
|
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`
|
executable_exists bool // if the executable already exists, don't remove new executable after `v run`
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_builder(pref_ &pref.Preferences) Builder {
|
pub fn new_builder(pref_ &pref.Preferences) Builder {
|
||||||
|
|
|
@ -27,9 +27,9 @@ struct Mapper {
|
||||||
mut:
|
mut:
|
||||||
pref &pref.Preferences = unsafe { nil }
|
pref &pref.Preferences = unsafe { nil }
|
||||||
table &ast.Table = unsafe { nil }
|
table &ast.Table = unsafe { nil }
|
||||||
file &ast.File = unsafe { nil }
|
file &ast.File = unsafe { nil }
|
||||||
node &ast.Node = unsafe { nil }
|
node &ast.Node = unsafe { nil }
|
||||||
fn_decl &ast.FnDecl = unsafe { nil }
|
fn_decl &ast.FnDecl = unsafe { nil }
|
||||||
caller_name string
|
caller_name string
|
||||||
dot_caller_name string
|
dot_caller_name string
|
||||||
is_caller_used bool
|
is_caller_used bool
|
||||||
|
|
|
@ -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.
|
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_type ast.Type
|
||||||
expected_or_type ast.Type // fn() or { 'this type' } eg. string. expected or block 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
|
expected_expr_type ast.Type // if/match is_expr: expected_type
|
||||||
mod string // current module name
|
mod string // current module name
|
||||||
const_var &ast.ConstField = unsafe { nil } // the current constant, when checking const declarations
|
const_var &ast.ConstField = unsafe { nil } // the current constant, when checking const declarations
|
||||||
const_deps []string
|
const_deps []string
|
||||||
const_names []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_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
|
// doing_line_path string // same, but stores the path being parsed
|
||||||
is_index_assign bool
|
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
|
goto_labels map[string]ast.GotoLabel // to check for unused goto labels
|
||||||
enum_data_type ast.Type
|
enum_data_type ast.Type
|
||||||
field_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
Loading…
Add table
Add a link
Reference in a new issue