Skip to content

Commit

Permalink
fmt: fix alignment of enumeration types
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyi98 committed Aug 6, 2024
1 parent ddb6685 commit 81b04db
Show file tree
Hide file tree
Showing 48 changed files with 507 additions and 476 deletions.
8 changes: 4 additions & 4 deletions cmd/tools/modules/testing/output.v
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import time

pub enum MessageKind {
compile_begin // sent right before *each* _test.v file compilation, the resulting status is not known yet, but the _test.v file itself is
compile_end // sent right after *each* _test.v file compilation, the message contains the output of that compilation
cmd_begin // sent right before *each* _test.v file execution, the resulting status is not known yet, but the _test.v file itself is
cmd_end // sent right after *each* _test.v file execution, the message contains the output of that execution
compile_end // sent right after *each* _test.v file compilation, the message contains the output of that compilation
cmd_begin // sent right before *each* _test.v file execution, the resulting status is not known yet, but the _test.v file itself is
cmd_end // sent right after *each* _test.v file execution, the message contains the output of that execution
//
ok // success of a _test.v file
ok // success of a _test.v file
fail // failed _test.v file, one or more assertions failed
skip // the _test.v file was skipped for some reason
info // a generic information message, detailing the actions of the `v test` program (some tests could be repeated for example, and the details are sent with an .info status)
Expand Down
14 changes: 7 additions & 7 deletions cmd/tools/vrepl.v
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ enum FnType {
}

enum DeclType {
include_ // #include ...
const_ // const ...
type_ // type ...
enum_ // enum ...
fn_ // fn ...
struct_ // struct ...
include_ // #include ...
const_ // const ...
type_ // type ...
enum_ // enum ...
fn_ // fn ...
struct_ // struct ...
interface_ // interface ...
stmt_ // statement
stmt_ // statement
}

fn new_repl(folder string) Repl {
Expand Down
4 changes: 2 additions & 2 deletions cmd/tools/vtest.v
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ pub fn (mut ctx Context) should_test_dir(path string, backend string) ([]string,
}

enum ShouldTestStatus {
test // do test, print OK or FAIL, depending on if it passes
skip // print SKIP for the test
test // do test, print OK or FAIL, depending on if it passes
skip // print SKIP for the test
ignore // just ignore the file, so it will not be printed at all in the list of tests
}

Expand Down
6 changes: 3 additions & 3 deletions examples/viewer/file_scan.v
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ import os
*
******************************************************************************/
enum Item_type {
file = 0
file = 0
folder
// archive format
zip = 16
zip = 16
archive_file
// graphic format, MUST stay after the other types!!
bmp = 32
bmp = 32
jpg
png
gif
Expand Down
4 changes: 2 additions & 2 deletions vlib/builtin/array.v
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ pub:
pub enum ArrayFlags {
noslices // when <<, `.noslices` will free the old data block immediately (you have to be sure, that there are *no slices* to that specific array). TODO: integrate with reference counting/compiler support for the static cases.
noshrink // when `.noslices` and `.noshrink` are *both set*, .delete(x) will NOT allocate new memory and free the old. It will just move the elements in place, and adjust .len.
nogrow // the array will never be allowed to grow past `.cap`. set `.nogrow` and `.noshrink` for a truly fixed heap array
nofree // `.data` will never be freed
nogrow // the array will never be allowed to grow past `.cap`. set `.nogrow` and `.noshrink` for a truly fixed heap array
nofree // `.data` will never be freed
}

// Internal function, used by V (`nums := []int`)
Expand Down
6 changes: 3 additions & 3 deletions vlib/builtin/builtin.v
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ pub:
}

pub enum AttributeKind {
plain // [name]
string // ['name']
number // [123]
plain // [name]
string // ['name']
number // [123]
comptime_define // [if name]
}

Expand Down
80 changes: 40 additions & 40 deletions vlib/compress/zstd/zstd.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pub enum ZSTD_cParameter {
// to default. Setting this will however eventually dynamically impact the compression
// parameters which have not been manually set. The manually set
// ones will 'stick'.
zstd_c_compression_level = 100
zstd_c_compression_level = 100
// Advanced compression parameters :
// It's possible to pin down compression parameters to some specific values.
// In which case, these values are no longer dynamically selected by the compressor
Expand All @@ -79,14 +79,14 @@ pub enum ZSTD_cParameter {
// Special: value 0 means "use default windowLog".
// Note: Using a windowLog greater than ZSTD_WINDOWLOG_LIMIT_DEFAULT
// requires explicitly allowing such size at streaming decompression stage.
zstd_c_window_log = 101
zstd_c_window_log = 101
// Size of the initial probe table, as a power of 2.
// Resulting memory usage is (1 << (hashLog+2)).
// Must be clamped between ZSTD_HASHLOG_MIN and ZSTD_HASHLOG_MAX.
// Larger tables improve compression ratio of strategies <= dFast,
// and improve speed of strategies > dFast.
// Special: value 0 means "use default hashLog".
zstd_c_hash_log = 102
zstd_c_hash_log = 102
// Size of the multi-probe search table, as a power of 2.
// Resulting memory usage is (1 << (chainLog+2)).
// Must be clamped between ZSTD_CHAINLOG_MIN and ZSTD_CHAINLOG_MAX.
Expand All @@ -95,12 +95,12 @@ pub enum ZSTD_cParameter {
// It's still useful when using "dfast" strategy,
// in which case it defines a secondary probe table.
// Special: value 0 means "use default chainLog".
zstd_c_chain_log = 103
zstd_c_chain_log = 103
// Number of search attempts, as a power of 2.
// More attempts result in better and slower compression.
// This parameter is useless for "fast" and "dFast" strategies.
// Special: value 0 means "use default searchLog".
zstd_c_search_log = 104
zstd_c_search_log = 104
// Minimum size of searched matches.
// Note that Zstandard can still find matches of smaller size,
// it just tweaks its search algorithm to look for this size and larger.
Expand All @@ -109,7 +109,7 @@ pub enum ZSTD_cParameter {
// Note that currently, for all strategies < btopt, effective minimum is 4.
// , for all strategies > fast, effective maximum is 6.
// Special: value 0 means "use default minMatchLength".
zstd_c_min_match = 105
zstd_c_min_match = 105
// Impact of this field depends on strategy.
// For strategies btopt, btultra & btultra2:
// Length of Match considered "good enough" to stop search.
Expand All @@ -118,12 +118,12 @@ pub enum ZSTD_cParameter {
// Distance between match sampling.
// Larger values make compression faster, and weaker.
// Special: value 0 means "use default targetLength".
zstd_c_target_length = 106
zstd_c_target_length = 106
// See ZSTD_strategy enum definition.
// The higher the value of selected strategy, the more complex it is,
// resulting in stronger and slower compression.
// Special: value 0 means "use default strategy".
zstd_c_strategy = 107
zstd_c_strategy = 107
// LDM mode parameters
// Enable long distance matching.
// This parameter is designed to improve compression ratio
Expand All @@ -140,34 +140,34 @@ pub enum ZSTD_cParameter {
// Must be clamped between ZSTD_HASHLOG_MIN and ZSTD_HASHLOG_MAX
// default: windowlog - 7.
// Special: value 0 means "automatically determine hashlog".
zstd_c_ldm_hash_log = 161
zstd_c_ldm_hash_log = 161
// Minimum match size for long distance matcher.
// Larger/too small values usually decrease compression ratio.
// Must be clamped between ZSTD_LDM_MINMATCH_MIN and ZSTD_LDM_MINMATCH_MAX.
// Special: value 0 means "use default value" (default: 64).
zstd_c_ldm_min_match = 162
zstd_c_ldm_min_match = 162
// log size of each bucket in the ldm hash table for collision resolution.
// Larger values improve collision resolution but decrease compression speed.
// The maximum value is ZSTD_LDM_BUCKETSIZELOG_MAX.
// Special: value 0 means "use default value" (default: 3).
zstd_c_ldm_bucket_size_log = 163
zstd_c_ldm_bucket_size_log = 163
// Frequency of inserting/looking up entries into the LDM hash table.
// Must be clamped between 0 and (ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN).
// Default is MAX(0, (windowLog - ldmHashLog)), optimizing hash table usage.
// Larger values improve compression speed.
// Deviating far from default value will likely result in a compression ratio decrease.
// Special: value 0 means "automatically determine hashRateLog".
zstd_c_ldm_hash_rate_log = 164
zstd_c_ldm_hash_rate_log = 164
// frame parameters
// Content size will be written into frame header _whenever known_ (default:1)
// Content size must be known at the beginning of compression.
// This is automatically the case when using ZSTD_compress2(),
// For streaming scenarios, content size must be provided with ZSTD_CCtx_setPledgedSrcSize()
zstd_c_content_size_flag = 200
zstd_c_content_size_flag = 200
// A 32-bits checksum of content is written at end of frame (default:0)
zstd_c_checksum_flag = 201
zstd_c_checksum_flag = 201
// When applicable, dictionary's ID is written into frame header (default:1)
zstd_c_dict_id_flag = 202
zstd_c_dict_id_flag = 202
// multi-threading parameters
// These parameters are only active if multi-threading is enabled (compiled with build macro ZSTD_MULTITHREAD).
// Otherwise, trying to set any other value than default (0) will be a no-op and return an error.
Expand All @@ -183,13 +183,13 @@ pub enum ZSTD_cParameter {
// More workers improve speed, but also increase memory usage.
// Default value is `0`, aka "single-threaded mode" : no worker is spawned,
// compression is performed inside Caller's thread, and all invocations are blocking
zstd_c_nb_workers = 400
zstd_c_nb_workers = 400
// Size of a compression job. This value is enforced only when nbWorkers >= 1.
// Each compression job is completed in parallel, so this value can indirectly impact the nb of active threads.
// 0 means default, which is dynamically determined based on compression parameters.
// Job size must be a minimum of overlap size, or ZSTDMT_JOBSIZE_MIN (= 512 KB), whichever is largest.
// The minimum size is automatically and transparently enforced.
zstd_c_job_size = 401
zstd_c_job_size = 401
// Control the overlap size, as a fraction of window size.
// The overlap size is an amount of data reloaded from previous job at the beginning of a new job.
// It helps preserve compression ratio, while each job is compressed in parallel.
Expand All @@ -202,7 +202,7 @@ pub enum ZSTD_cParameter {
// Each intermediate rank increases/decreases load size by a factor 2 :
// 9: full window; 8: w/2; 7: w/4; 6: w/8; 5:w/16; 4: w/32; 3:w/64; 2:w/128; 1:no overlap; 0:default
// default value varies between 6 and 9, depending on strategy
zstd_c_overlap_log = 402
zstd_c_overlap_log = 402
// note : additional experimental parameters are also available
// within the experimental section of the API.
// At the time of this writing, they include :
Expand All @@ -227,25 +227,25 @@ pub enum ZSTD_cParameter {
// note : never ever use experimentalParam? names directly;
// also, the enums values themselves are unstable and can still change.
//
zstd_c_experimental_param1 = 500
zstd_c_experimental_param2 = 10
zstd_c_experimental_param3 = 1000
zstd_c_experimental_param4 = 1001
zstd_c_experimental_param5 = 1002
zstd_c_experimental_param6 = 1003
zstd_c_experimental_param7 = 1004
zstd_c_experimental_param8 = 1005
zstd_c_experimental_param9 = 1006
zstd_c_experimental_param10 = 1007
zstd_c_experimental_param11 = 1008
zstd_c_experimental_param12 = 1009
zstd_c_experimental_param13 = 1010
zstd_c_experimental_param14 = 1011
zstd_c_experimental_param15 = 1012
zstd_c_experimental_param16 = 1013
zstd_c_experimental_param17 = 1014
zstd_c_experimental_param18 = 1015
zstd_c_experimental_param19 = 1016
zstd_c_experimental_param1 = 500
zstd_c_experimental_param2 = 10
zstd_c_experimental_param3 = 1000
zstd_c_experimental_param4 = 1001
zstd_c_experimental_param5 = 1002
zstd_c_experimental_param6 = 1003
zstd_c_experimental_param7 = 1004
zstd_c_experimental_param8 = 1005
zstd_c_experimental_param9 = 1006
zstd_c_experimental_param10 = 1007
zstd_c_experimental_param11 = 1008
zstd_c_experimental_param12 = 1009
zstd_c_experimental_param13 = 1010
zstd_c_experimental_param14 = 1011
zstd_c_experimental_param15 = 1012
zstd_c_experimental_param16 = 1013
zstd_c_experimental_param17 = 1014
zstd_c_experimental_param18 = 1015
zstd_c_experimental_param19 = 1016
}

pub struct ZSTD_bounds {
Expand Down Expand Up @@ -274,7 +274,7 @@ pub enum ZSTD_dParameter {
// This parameter is only useful in streaming mode, since no internal buffer is allocated in single-pass mode.
// By default, a decompression context accepts window sizes <= (1 << ZSTD_WINDOWLOG_LIMIT_DEFAULT).
// Special: value 0 means "use default maximum windowLog".
zstd_d_window_log_max = 100
zstd_d_window_log_max = 100
// note : additional experimental parameters are also available
// within the experimental section of the API.
// At the time of this writing, they include :
Expand Down Expand Up @@ -321,13 +321,13 @@ pub enum ZSTD_EndDirective {
// it creates (at least) one new block, that can be decoded immediately on reception;
// frame will continue: any future data can still reference previously compressed data, improving compression.
// note : multithreaded compression will block to flush as much output as possible.
zstd_e_flush = 1
zstd_e_flush = 1
// flush any remaining data _and_ close current frame.
// note that frame is only closed after compressed data is fully flushed (return value == 0).
// After that point, any additional data starts a new frame.
// note : each frame is independent (does not reference any content from previous frame).
// note : multithreaded compression will block to flush as much output as possible.
zstd_e_end = 2
zstd_e_end = 2
}

fn C.ZSTD_compressStream2(voidptr, &ZSTD_outBuffer, &ZSTD_inBuffer, ZSTD_EndDirective) usize
Expand Down
2 changes: 1 addition & 1 deletion vlib/db/mysql/enums.v
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub enum FieldType {
type_timestamp2
type_datetime2
type_time2
type_json = 245
type_json = 245
type_newdecimal
type_enum
type_set
Expand Down
40 changes: 20 additions & 20 deletions vlib/db/pg/pg.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -80,34 +80,34 @@ pub struct C.PGresult {}
pub struct C.PGconn {}

pub enum ConnStatusType {
ok = C.CONNECTION_OK
bad = C.CONNECTION_BAD
ok = C.CONNECTION_OK
bad = C.CONNECTION_BAD
// Non-blocking mode only below here
// The existence of these should never be relied upon - they should only be used for user feedback or similar purposes.
started = C.CONNECTION_STARTED // Waiting for connection to be made.
made = C.CONNECTION_MADE // Connection OK; waiting to send.
started = C.CONNECTION_STARTED // Waiting for connection to be made.
made = C.CONNECTION_MADE // Connection OK; waiting to send.
awaiting_response = C.CONNECTION_AWAITING_RESPONSE // Waiting for a response from the postmaster.
auth_ok = C.CONNECTION_AUTH_OK // Received authentication; waiting for backend startup.
setenv = C.CONNECTION_SETENV // Negotiating environment.
ssl_startup = C.CONNECTION_SSL_STARTUP // Negotiating SSL.
needed = C.CONNECTION_NEEDED // Internal state: connect() needed . Available in PG 8
check_writable = C.CONNECTION_CHECK_WRITABLE // Check if we could make a writable connection. Available since PG 10
consume = C.CONNECTION_CONSUME // Wait for any pending message and consume them. Available since PG 10
gss_startup = C.CONNECTION_GSS_STARTUP // Negotiating GSSAPI; available since PG 12
auth_ok = C.CONNECTION_AUTH_OK // Received authentication; waiting for backend startup.
setenv = C.CONNECTION_SETENV // Negotiating environment.
ssl_startup = C.CONNECTION_SSL_STARTUP // Negotiating SSL.
needed = C.CONNECTION_NEEDED // Internal state: connect() needed . Available in PG 8
check_writable = C.CONNECTION_CHECK_WRITABLE // Check if we could make a writable connection. Available since PG 10
consume = C.CONNECTION_CONSUME // Wait for any pending message and consume them. Available since PG 10
gss_startup = C.CONNECTION_GSS_STARTUP // Negotiating GSSAPI; available since PG 12
}

@[typedef]
pub enum ExecStatusType {
empty_query = C.PGRES_EMPTY_QUERY // empty query string was executed
command_ok = C.PGRES_COMMAND_OK // a query command that doesn't return anything was executed properly by the backend
tuples_ok = C.PGRES_TUPLES_OK // a query command that returns tuples was executed properly by the backend, PGresult contains the result tuples
copy_out = C.PGRES_COPY_OUT // Copy Out data transfer in progress
copy_in = C.PGRES_COPY_IN // Copy In data transfer in progress
bad_response = C.PGRES_BAD_RESPONSE // an unexpected response was recv'd from the backend
empty_query = C.PGRES_EMPTY_QUERY // empty query string was executed
command_ok = C.PGRES_COMMAND_OK // a query command that doesn't return anything was executed properly by the backend
tuples_ok = C.PGRES_TUPLES_OK // a query command that returns tuples was executed properly by the backend, PGresult contains the result tuples
copy_out = C.PGRES_COPY_OUT // Copy Out data transfer in progress
copy_in = C.PGRES_COPY_IN // Copy In data transfer in progress
bad_response = C.PGRES_BAD_RESPONSE // an unexpected response was recv'd from the backend
nonfatal_error = C.PGRES_NONFATAL_ERROR // notice or warning message
fatal_error = C.PGRES_FATAL_ERROR // query failed
copy_both = C.PGRES_COPY_BOTH // Copy In/Out data transfer in progress
single_tuple = C.PGRES_SINGLE_TUPLE // single tuple from larger resultset
fatal_error = C.PGRES_FATAL_ERROR // query failed
copy_both = C.PGRES_COPY_BOTH // Copy In/Out data transfer in progress
single_tuple = C.PGRES_SINGLE_TUPLE // single tuple from larger resultset
}

//
Expand Down
10 changes: 5 additions & 5 deletions vlib/flag/flag_to.v
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ struct FlagContext {
}

pub enum Style {
short // Posix short only, allows multiple shorts -def is `-d -e -f` and "sticky" arguments e.g.: `-ofoo` = `-o foo`
long // GNU style long option *only*. E.g.: `--name` or `--name=value`
short // Posix short only, allows multiple shorts -def is `-d -e -f` and "sticky" arguments e.g.: `-ofoo` = `-o foo`
long // GNU style long option *only*. E.g.: `--name` or `--name=value`
short_long // extends `posix` style shorts with GNU style long options: `--flag` or `--name=value`
v // V style flags as found in flags for the `v` compiler. Single flag denote `-` followed by string identifier e.g.: `-verbose`, `-name value`, `-v`, `-n value` or `-d ident=value`
go_flag // GO `flag` module style. Single flag denote `-` followed by string identifier e.g.: `-verbose`, `-name value`, `-v` or `-n value` and both long `--name value` and GNU long `--name=value`
cmd_exe // `cmd.exe` style flags. Single flag denote `/` followed by lower- or upper-case character
v // V style flags as found in flags for the `v` compiler. Single flag denote `-` followed by string identifier e.g.: `-verbose`, `-name value`, `-v`, `-n value` or `-d ident=value`
go_flag // GO `flag` module style. Single flag denote `-` followed by string identifier e.g.: `-verbose`, `-name value`, `-v` or `-n value` and both long `--name value` and GNU long `--name=value`
cmd_exe // `cmd.exe` style flags. Single flag denote `/` followed by lower- or upper-case character
}

struct StructInfo {
Expand Down
Loading

0 comments on commit 81b04db

Please sign in to comment.