From bd289d32fd63d0ecdf53c534a8114c445983a40f Mon Sep 17 00:00:00 2001 From: vbot Date: Fri, 29 Apr 2022 20:44:11 +0000 Subject: [PATCH] [v:master] 9b1f7f5e9 - doc: suggest a basic auto-reload setup (#14216) --- v.c | 7387 +++++++++++++++++++++++++++++++++++++----------------- v_win.c | 7504 ++++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 10266 insertions(+), 4625 deletions(-) diff --git a/v.c b/v.c index 64dbd3e..562293d 100644 --- a/v.c +++ b/v.c @@ -1,11 +1,11 @@ -#define V_COMMIT_HASH "b7f2ef78b" +#define V_COMMIT_HASH "9b1f7f5e9" #ifndef V_COMMIT_HASH - #define V_COMMIT_HASH "b81f06e36" + #define V_COMMIT_HASH "b7f2ef78b" #endif #ifndef V_CURRENT_COMMIT_HASH - #define V_CURRENT_COMMIT_HASH "b7f2ef7" + #define V_CURRENT_COMMIT_HASH "9b1f7f5" #endif // V comptime_definitions: @@ -66,6 +66,8 @@ typedef struct multi_return_string_string_string_string multi_return_string_stri typedef struct multi_return_int_string_string_string multi_return_int_string_string_string; typedef struct multi_return_Array_string_Array_string_Array_bool multi_return_Array_string_Array_string_Array_bool; typedef struct multi_return_u64_string multi_return_u64_string; +typedef struct multi_return_i64_i64_i64 multi_return_i64_i64_i64; +typedef struct multi_return_f64_f64 multi_return_f64_f64; // END_multi_return_typedefs typedef struct strconv__BF_param strconv__BF_param; @@ -114,10 +116,6 @@ typedef struct v__token__KeywordsMatcher v__token__KeywordsMatcher; typedef struct v__token__WIndex v__token__WIndex; typedef struct v__token__Pos v__token__Pos; typedef struct v__token__Token v__token__Token; -typedef struct time__TimeParseError time__TimeParseError; -typedef struct time__StopWatchOptions time__StopWatchOptions; -typedef struct time__StopWatch time__StopWatch; -typedef struct time__Time time__Time; typedef struct v__dotgraph__DotGraph v__dotgraph__DotGraph; typedef struct v__dotgraph__NewNodeConfig v__dotgraph__NewNodeConfig; typedef struct v__dotgraph__NewEdgeConfig v__dotgraph__NewEdgeConfig; @@ -149,11 +147,17 @@ typedef struct v__depgraph__DepGraph v__depgraph__DepGraph; typedef struct v__depgraph__OrderedDepMap v__depgraph__OrderedDepMap; typedef struct v__depgraph__NodeNames v__depgraph__NodeNames; typedef struct v__cflag__CFlag v__cflag__CFlag; +typedef struct math__DigitParams math__DigitParams; +typedef struct math__ChebSeries math__ChebSeries; typedef struct v__pkgconfig__Main v__pkgconfig__Main; typedef struct v__pkgconfig__MainOptions v__pkgconfig__MainOptions; typedef struct v__pkgconfig__Options v__pkgconfig__Options; typedef struct v__pkgconfig__PkgConfig v__pkgconfig__PkgConfig; typedef struct v__vet__Error v__vet__Error; +typedef struct time__TimeParseError time__TimeParseError; +typedef struct time__StopWatchOptions time__StopWatchOptions; +typedef struct time__StopWatch time__StopWatch; +typedef struct time__Time time__Time; typedef struct rand__config__PRNGConfigStruct rand__config__PRNGConfigStruct; typedef struct rand__wyrand__WyRandRNG rand__wyrand__WyRandRNG; typedef struct rand__ShuffleConfigStruct rand__ShuffleConfigStruct; @@ -347,9 +351,6 @@ typedef struct Option_Array_string Option_Array_string; typedef struct Option_bool Option_bool; typedef struct Option_os__SignalHandler Option_os__SignalHandler; typedef struct Option_v__token__Kind Option_v__token__Kind; -typedef struct Option_time__Time Option_time__Time; -typedef struct Option_multi_return_int_int_int Option_multi_return_int_int_int; -typedef struct Option_multi_return_int_int_int_int_i64_bool Option_multi_return_int_int_int_int_i64_bool; typedef struct Option_flag__Flag Option_flag__Flag; typedef struct Option_semver__Range Option_semver__Range; typedef struct Option_semver__Version Option_semver__Version; @@ -360,6 +361,9 @@ typedef struct Option_v__vmod__Manifest Option_v__vmod__Manifest; typedef struct Option_multi_return_Array_string_int Option_multi_return_Array_string_int; typedef struct Option_v__pkgconfig__PkgConfig_ptr Option_v__pkgconfig__PkgConfig_ptr; typedef struct Option_v__pkgconfig__Main_ptr Option_v__pkgconfig__Main_ptr; +typedef struct Option_time__Time Option_time__Time; +typedef struct Option_multi_return_int_int_int Option_multi_return_int_int_int; +typedef struct Option_multi_return_int_int_int_int_i64_bool Option_multi_return_int_int_int_int_i64_bool; typedef struct Option_u32 Option_u32; typedef struct Option_f32 Option_f32; typedef struct Option_v__pref__OS Option_v__pref__OS; @@ -556,6 +560,7 @@ static inline bool _us64_lt(uint64_t a, int64_t b) { return a < INT64_MAX && (in #endif #ifdef __TINYC__ + #define _Atomic volatile #undef EMPTY_STRUCT_DECLARATION #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad #undef EMPTY_ARRAY_OF_ELEMS @@ -1178,48 +1183,6 @@ static inline uint64_t wy2u0k(uint64_t r, uint64_t k){ _wymum(&r,&k); return k; - - -// added by module `time`, file: time.c.v:6: - -#if defined(__has_include) - -#if __has_include() -#include -#else -#error VERROR_MESSAGE Header file , needed for module `time` was not found. Please install the corresponding development headers. -#endif - -#else -#include -#endif - - - - - -// added by module `time`, file: time_nix.c.v:6: - -#if defined(__has_include) - -#if __has_include() -#include -#else -#error VERROR_MESSAGE Header file , needed for module `time` was not found. Please install the corresponding development headers. -#endif - -#else -#include -#endif - - - - - -// added by module `time`, file: time_nix.c.v:7: -#include - - #if defined(_WIN32) // inserted by module `sync.stdatomic`, file: 1.declarations.c.v:8: /* @@ -2067,6 +2030,66 @@ static inline unsigned char atomic_fetch_xor_byte(unsigned char* x, unsigned cha +// added by module `math`, file: math.c.v:6: + +#if defined(__has_include) + +#if __has_include() +#include +#else +#error VERROR_MESSAGE Header file , needed for module `math` was not found. Please install the corresponding development headers. +#endif + +#else +#include +#endif + + + + + +// added by module `time`, file: time.c.v:6: + +#if defined(__has_include) + +#if __has_include() +#include +#else +#error VERROR_MESSAGE Header file , needed for module `time` was not found. Please install the corresponding development headers. +#endif + +#else +#include +#endif + + + + + +// added by module `time`, file: time_nix.c.v:6: + +#if defined(__has_include) + +#if __has_include() +#include +#else +#error VERROR_MESSAGE Header file , needed for module `time` was not found. Please install the corresponding development headers. +#endif + +#else +#include +#endif + + + + + +// added by module `time`, file: time_nix.c.v:7: +#include + + + + // added by module `sync`, file: sync_default.c.v:14: #if defined(__has_include) @@ -2370,38 +2393,6 @@ typedef enum { v__token__Precedence__index, // +10 } v__token__Precedence; -typedef enum { - time__FormatTime__hhmm12, // - time__FormatTime__hhmm24, // +1 - time__FormatTime__hhmmss12, // +2 - time__FormatTime__hhmmss24, // +3 - time__FormatTime__hhmmss24_milli, // +4 - time__FormatTime__hhmmss24_micro, // +5 - time__FormatTime__no_time, // +6 -} time__FormatTime; - -typedef enum { - time__FormatDate__ddmmyy, // - time__FormatDate__ddmmyyyy, // +1 - time__FormatDate__mmddyy, // +2 - time__FormatDate__mmddyyyy, // +3 - time__FormatDate__mmmd, // +4 - time__FormatDate__mmmdd, // +5 - time__FormatDate__mmmddyy, // +6 - time__FormatDate__mmmddyyyy, // +7 - time__FormatDate__no_date, // +8 - time__FormatDate__yyyymmdd, // +9 - time__FormatDate__yymmdd, // +10 -} time__FormatDate; - -typedef enum { - time__FormatDelimiter__dot, // - time__FormatDelimiter__hyphen, // +1 - time__FormatDelimiter__slash, // +2 - time__FormatDelimiter__space, // +3 - time__FormatDelimiter__no_delimiter, // +4 -} time__FormatDelimiter; - typedef enum { semver__Operator__gt, // semver__Operator__lt, // +1 @@ -2456,6 +2447,38 @@ typedef enum { v__vet__ErrorType__trailing_space, // +2 } v__vet__ErrorType; +typedef enum { + time__FormatTime__hhmm12, // + time__FormatTime__hhmm24, // +1 + time__FormatTime__hhmmss12, // +2 + time__FormatTime__hhmmss24, // +3 + time__FormatTime__hhmmss24_milli, // +4 + time__FormatTime__hhmmss24_micro, // +5 + time__FormatTime__no_time, // +6 +} time__FormatTime; + +typedef enum { + time__FormatDate__ddmmyy, // + time__FormatDate__ddmmyyyy, // +1 + time__FormatDate__mmddyy, // +2 + time__FormatDate__mmddyyyy, // +3 + time__FormatDate__mmmd, // +4 + time__FormatDate__mmmdd, // +5 + time__FormatDate__mmmddyy, // +6 + time__FormatDate__mmmddyyyy, // +7 + time__FormatDate__no_date, // +8 + time__FormatDate__yyyymmdd, // +9 + time__FormatDate__yymmdd, // +10 +} time__FormatDate; + +typedef enum { + time__FormatDelimiter__dot, // + time__FormatDelimiter__hyphen, // +1 + time__FormatDelimiter__slash, // +2 + time__FormatDelimiter__space, // +3 + time__FormatDelimiter__no_delimiter, // +4 +} time__FormatDelimiter; + typedef enum { v__pref__OS___auto, // v__pref__OS__ios, // +1 @@ -2748,12 +2771,12 @@ struct IError { os__FileNotOpenedError* _os__FileNotOpenedError; os__SizeOfTypeIs0Error* _os__SizeOfTypeIs0Error; os__ExecutableNotFoundError* _os__ExecutableNotFoundError; - time__TimeParseError* _time__TimeParseError; flag__UnkownFlagError* _flag__UnkownFlagError; flag__ArgsCountError* _flag__ArgsCountError; semver__InvalidComparatorFormatError* _semver__InvalidComparatorFormatError; semver__EmptyInputError* _semver__EmptyInputError; semver__InvalidVersionFormatError* _semver__InvalidVersionFormatError; + time__TimeParseError* _time__TimeParseError; v__gen__c__UnsupportedAssertCtempTransform* _v__gen__c__UnsupportedAssertCtempTransform; }; int _typ; @@ -2931,12 +2954,12 @@ typedef map Map_int_bool; typedef array Array_v__gen__c__ProfileCounterMeta; typedef array Array_v__ast__InfixExpr; typedef array Array_v__ast__TypeSymbol; +typedef array Array_f64; typedef array Array_v__token__Token; typedef array Array_sync__Channel_ptr; typedef array Array_sync__Direction; typedef array Array_sync__Subscription; typedef array Array_flag__Flag; -typedef array Array_f64; typedef array Array_semver__Comparator; typedef array Array_semver__ComparatorSet; typedef u8 Array_fixed_u8_5 [5]; @@ -3873,6 +3896,7 @@ struct v__ast__Table { Map_string_string mdeprecated_msg; Map_string_time__Time mdeprecated_after; Map_string_bool builtin_pub_fns; + int pointer_size; }; @@ -4406,6 +4430,22 @@ struct v__gen__c__GenSafeIntegerCfg { +struct math__DigitParams { + int base; + bool reverse; +}; + + + +struct math__ChebSeries { + Array_f64 c; + int order; + f64 a; + f64 b; +}; + + + struct v__pkgconfig__MainOptions { bool modversion; bool description; @@ -4696,6 +4736,7 @@ struct v__pref__Preferences { int message_limit; bool nofloat; int checker_match_exhaustive_cutoff_limit; + int thread_stack_size; }; @@ -6018,6 +6059,7 @@ struct v__ast__File { bool is_test; bool is_generated; bool is_translated; + int idx; string path; string path_base; v__ast__Scope* scope; @@ -6069,6 +6111,7 @@ struct v__ast__FnDecl { bool is_direct_arr; Array_v__ast__Attr attrs; int ctdefine_idx; + int idx; Array_v__ast__Param params; Array_v__ast__Stmt stmts; Array_v__ast__DeferStmt defer_stmts; @@ -6705,6 +6748,17 @@ struct multi_return_u64_string { string arg1; }; +struct multi_return_i64_i64_i64 { + i64 arg0; + i64 arg1; + i64 arg2; +}; + +struct multi_return_f64_f64 { + f64 arg0; + f64 arg1; +}; + // END_multi_return_structs @@ -6828,24 +6882,6 @@ struct Option_v__token__Kind { byte data[sizeof(v__token__Kind) > 0 ? sizeof(v__token__Kind) : 1]; }; -struct Option_time__Time { - byte state; - IError err; - byte data[sizeof(time__Time) > 0 ? sizeof(time__Time) : 1]; -}; - -struct Option_multi_return_int_int_int { - byte state; - IError err; - byte data[sizeof(multi_return_int_int_int) > 0 ? sizeof(multi_return_int_int_int) : 1]; -}; - -struct Option_multi_return_int_int_int_int_i64_bool { - byte state; - IError err; - byte data[sizeof(multi_return_int_int_int_int_i64_bool) > 0 ? sizeof(multi_return_int_int_int_int_i64_bool) : 1]; -}; - struct Option_flag__Flag { byte state; IError err; @@ -6906,6 +6942,24 @@ struct Option_v__pkgconfig__Main_ptr { byte data[sizeof(v__pkgconfig__Main*) > 0 ? sizeof(v__pkgconfig__Main*) : 1]; }; +struct Option_time__Time { + byte state; + IError err; + byte data[sizeof(time__Time) > 0 ? sizeof(time__Time) : 1]; +}; + +struct Option_multi_return_int_int_int { + byte state; + IError err; + byte data[sizeof(multi_return_int_int_int) > 0 ? sizeof(multi_return_int_int_int) : 1]; +}; + +struct Option_multi_return_int_int_int_int_i64_bool { + byte state; + IError err; + byte data[sizeof(multi_return_int_int_int_int_i64_bool) > 0 ? sizeof(multi_return_int_int_int_int_i64_bool) : 1]; +}; + struct Option_u32 { byte state; IError err; @@ -7636,6 +7690,7 @@ string u8_vstring_literal(u8* bp); string u8_vstring_literal_with_len(u8* bp, int len); string char_vstring_literal(char* cp); string char_vstring_literal_with_len(char* cp, int len); +int string_len_utf8(string s); VV_LOCAL_SYMBOL string string_clone_static(string a); string string_clone(string a); string string_replace_once(string s, string rep, string with); @@ -7772,10 +7827,10 @@ int utf8_char_len(u8 b); string utf32_to_str(u32 code); string utf32_to_str_no_malloc(u32 code, u8* buf); int utf32_decode_to_buffer(u32 code, u8* buf); +int utf8_str_len(string s); int string_utf32_code(string _rune); Option_rune Array_u8_utf8_to_utf32(Array_u8 _bytes); VV_LOCAL_SYMBOL int utf8_len(u8 c); -int utf8_str_len(string s); int utf8_str_visible_length(string s); bool ArrayFlags_is_empty(ArrayFlags* e); bool ArrayFlags_has(ArrayFlags* e, ArrayFlags flag); @@ -8103,113 +8158,6 @@ string v__token__kind_to_string(v__token__Kind k); Option_v__token__Kind v__token__kind_from_string(string s); int v__mathutil__min_T_int(int a, int b); int v__mathutil__max_T_int(int a, int b); -i64 time__portable_timegm(struct tm* t); -int time__days_from_civil(int oy, int m, int d); -string time__Time_format(time__Time t); -string time__Time_format_ss(time__Time t); -string time__Time_format_ss_milli(time__Time t); -string time__Time_format_ss_micro(time__Time t); -string time__Time_hhmm(time__Time t); -string time__Time_hhmmss(time__Time t); -string time__Time_hhmm12(time__Time t); -string time__Time_ymmdd(time__Time t); -string time__Time_ddmmy(time__Time t); -string time__Time_md(time__Time t); -string time__Time_clean(time__Time t); -string time__Time_clean12(time__Time t); -string time__Time_get_fmt_time_str(time__Time t, time__FormatTime fmt_time); -string time__Time_get_fmt_date_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatDate fmt_date); -string time__Time_get_fmt_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatTime fmt_time, time__FormatDate fmt_date); -string time__Time_utc_string(time__Time t); -bool time__Time__eq(time__Time t1, time__Time t2); -bool time__Time__lt(time__Time t1, time__Time t2); -time__Duration time__Time__minus(time__Time lhs, time__Time rhs); -Option_time__Time time__parse_rfc3339(string s); -Option_time__Time time__parse(string s); -Option_time__Time time__parse_iso8601(string s); -Option_time__Time time__parse_rfc2822(string s); -VV_LOCAL_SYMBOL Option_multi_return_int_int_int time__parse_iso8601_date(string s); -VV_LOCAL_SYMBOL Option_multi_return_int_int_int_int_i64_bool time__parse_iso8601_time(string s); -string time__TimeParseError_msg(time__TimeParseError err); -VV_LOCAL_SYMBOL IError time__error_invalid_time(int code); -time__StopWatch time__new_stopwatch(time__StopWatchOptions opts); -void time__StopWatch_start(time__StopWatch* t); -void time__StopWatch_restart(time__StopWatch* t); -void time__StopWatch_stop(time__StopWatch* t); -void time__StopWatch_pause(time__StopWatch* t); -time__Duration time__StopWatch_elapsed(time__StopWatch t); -time__Time time__now(void); -time__Time time__utc(void); -time__Time time__new_time(time__Time t); -i64 time__ticks(void); -string time__Time_str(time__Time t); -VV_LOCAL_SYMBOL time__Time time__convert_ctime(struct tm t, int microsecond); -string time__Time_strftime(time__Time t, string fmt); -string _const_time__days_string; // a string literal, inited later -Array_int _const_time__month_days; // inited later -string _const_time__months_string; // a string literal, inited later -i64 _const_time__absolute_zero_year; // inited later -#define _const_time__seconds_per_minute 60 -#define _const_time__seconds_per_hour 3600 -#define _const_time__seconds_per_day 86400 -#define _const_time__seconds_per_week 604800 -#define _const_time__days_per_400_years 146097 -#define _const_time__days_per_100_years 36524 -#define _const_time__days_per_4_years 1461 -Array_int _const_time__days_before; // inited later -Array_string _const_time__long_days; // inited later -string time__Time_smonth(time__Time* t); -i64 time__Time_unix_time(time__Time* t); -i64 time__Time_unix_time_milli(time__Time* t); -time__Time time__Time_add(time__Time* t, time__Duration d); -time__Time time__Time_add_seconds(time__Time* t, int seconds); -time__Time time__Time_add_days(time__Time* t, int days); -time__Duration time__since(time__Time t); -string time__Time_relative(time__Time* t); -string time__Time_relative_short(time__Time* t); -int time__day_of_week(int y, int m, int d); -int time__Time_day_of_week(time__Time* t); -string time__Time_weekday_str(time__Time* t); -string time__Time_long_weekday_str(time__Time* t); -bool time__is_leap_year(int year); -Option_int time__days_in_month(int month, int year); -string time__Time_debug(time__Time* t); -time__Duration _const_time__nanosecond; // inited later -time__Duration _const_time__microsecond; // inited later -time__Duration _const_time__millisecond; // inited later -time__Duration _const_time__second; // inited later -time__Duration _const_time__minute; // inited later -time__Duration _const_time__hour; // inited later -time__Duration _const_time__infinite; // inited later -i64 time__Duration_nanoseconds(time__Duration d); -i64 time__Duration_microseconds(time__Duration d); -i64 time__Duration_milliseconds(time__Duration d); -f64 time__Duration_seconds(time__Duration d); -f64 time__Duration_minutes(time__Duration d); -f64 time__Duration_hours(time__Duration d); -string time__Duration_str(time__Duration d); -int time__offset(void); -VV_LOCAL_SYMBOL u64 time__sys_mono_now_darwin(void); -time__Time time__darwin_now(void); -time__Time time__solaris_now(void); -time__Time time__darwin_utc(void); -time__Time time__solaris_utc(void); -VV_LOCAL_SYMBOL i64 time__make_unix_time(struct tm t); -time__Time time__Time_local(time__Time* t); -u64 time__sys_mono_now(void); -VV_LOCAL_SYMBOL u64 time__vpc_now(void); -VV_LOCAL_SYMBOL time__Time time__linux_now(void); -VV_LOCAL_SYMBOL time__Time time__linux_utc(void); -time__Time time__win_now(void); -time__Time time__win_utc(void); -struct timespec time__Duration_timespec(time__Duration d); -struct timespec time__zero_timespec(void); -void time__sleep(time__Duration duration); -int time__Duration_sys_milliseconds(time__Duration d); -time__Time time__unix(i64 abs); -time__Time time__unix2(i64 abs, int microsecond); -VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_date_from_offset(i64 day_offset_); -VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_time_from_offset(i64 second_offset_); void v__dotgraph__start_digraph(void); VV_LOCAL_SYMBOL void anon_fn_eb34f0b759dade77__82(void); v__dotgraph__DotGraph* v__dotgraph__new(string name, string label, string color); @@ -8249,6 +8197,58 @@ u32 hash__fnv1a__sum32_bytes(u8* data, int data_len); u64 hash__fnv1a__sum64_string(string data); u64 hash__fnv1a__sum64(Array_u8 data); u64 hash__fnv1a__sum64_bytes(u8* data, int data_len); +f64 _const_math__internal__f64_epsilon = 2.220446049250313e-16; // precomputed +f64 _const_math__internal__sqrt_f64_epsilon = 3.725290298461914e-09; // precomputed +f64 _const_math__internal__root3_f64_epsilon = 6.055454452393343e-06; // precomputed +f64 _const_math__internal__root4_f64_epsilon = 0.0001220703125; // precomputed +f64 _const_math__internal__root5_f64_epsilon = 0.000740095979741405; // precomputed +f64 _const_math__internal__root6_f64_epsilon = 0.002460783300575925; // precomputed +f64 _const_math__internal__log_f64_epsilon = -36.04365338911715; // precomputed +f64 _const_math__internal__f64_min = 2.2250738585072014e-308; // precomputed +f64 _const_math__internal__sqrt_f64_min = 3.7291703656001034e-155; // precomputed +f64 _const_math__internal__root3_f64_min = 2.8126442852362996e-103; // precomputed +f64 _const_math__internal__root4_f64_min = 1.221338669755462e-77; // precomputed +f64 _const_math__internal__root5_f64_min = 2.9476022969691763e-62; // precomputed +f64 _const_math__internal__root6_f64_min = 5.303436890579822e-52; // precomputed +f64 _const_math__internal__log_f64_min = -708.3964185322641; // precomputed +f64 _const_math__internal__f64_max = 1.7976931348623157e+308; // precomputed +f64 _const_math__internal__sqrt_f64_max = 1.3407807929942596e+154; // precomputed +f64 _const_math__internal__root3_f64_max = 5.64380309412229e+102; // precomputed +f64 _const_math__internal__root4_f64_max = 1.157920892373162e+77; // precomputed +f64 _const_math__internal__root5_f64_max = 4.4765466227572707e+61; // precomputed +f64 _const_math__internal__root6_f64_max = 2.3756689782295612e+51; // precomputed +f64 _const_math__internal__log_f64_max = 709.782712893384; // precomputed +f64 _const_math__internal__f32_epsilon = 1.1920928955078125e-07; // precomputed +f64 _const_math__internal__sqrt_f32_epsilon = 0.00034526698300124393; // precomputed +f64 _const_math__internal__root3_f32_epsilon = 0.00492156660115185; // precomputed +f64 _const_math__internal__root4_f32_epsilon = 0.018581361171917516; // precomputed +f64 _const_math__internal__root5_f32_epsilon = 0.04123462221165294; // precomputed +f64 _const_math__internal__root6_f32_epsilon = 0.07015387801933583; // precomputed +f64 _const_math__internal__log_f32_epsilon = -15.942385152878742; // precomputed +f64 _const_math__internal__f32_min = 2.938735877055719e-39; // precomputed +f64 _const_math__internal__sqrt_f32_min = 2.710505431213761e-20; // precomputed +f64 _const_math__internal__root3_f32_min = 2.273736754432324e-13; // precomputed +f64 _const_math__internal__root4_f32_min = 3.2927225399135965e-10; // precomputed +f64 _const_math__internal__root5_f32_min = 2.5944428542140822e-08; // precomputed +f64 _const_math__internal__root6_f32_min = 4.768371582031254e-07; // precomputed +f64 _const_math__internal__log_f32_min = -87.3365447505531; // precomputed +f64 _const_math__internal__f32_max = 3.4028234663852886e+38; // precomputed +f64 _const_math__internal__sqrt_f32_max = 1.844674352395373e+19; // precomputed +f64 _const_math__internal__root3_f32_max = 6.981463519622324e+12; // precomputed +f64 _const_math__internal__root4_f32_max = 4.2949672319999986e+09; // precomputed +f64 _const_math__internal__root5_f32_max = 5.085900785596004e+07; // precomputed +f64 _const_math__internal__root6_f32_max = 2.642245923380775e+06; // precomputed +f64 _const_math__internal__log_f32_max = 88.72283905206835; // precomputed +f64 _const_math__internal__sflt_epsilon = 0.00048828125; // precomputed +f64 _const_math__internal__sqrt_sflt_epsilon = 0.02209708691207961; // precomputed +f64 _const_math__internal__root3_sflt_epsilon = 0.07874506561842959; // precomputed +f64 _const_math__internal__root4_sflt_epsilon = 0.14865088937534013; // precomputed +f64 _const_math__internal__root5_sflt_epsilon = 0.217637640824031; // precomputed +f64 _const_math__internal__root6_sflt_epsilon = 0.28061551207734325; // precomputed +f64 _const_math__internal__log_sflt_epsilon = -7.6246189861593985; // precomputed +#define _const_math__internal__max_int_fact_arg 170 +f64 _const_math__internal__max_f64_fact_arg = 171.; // precomputed +f64 _const_math__internal__max_long_f64_fact_arg = 1755.5; // precomputed VV_LOCAL_SYMBOL string flag__UnkownFlagError_msg(flag__UnkownFlagError err); VV_LOCAL_SYMBOL string flag__ArgsCountError_msg(flag__ArgsCountError err); VV_LOCAL_SYMBOL void flag__Flag_free(flag__Flag* f); @@ -8452,10 +8452,6 @@ Option_string v__vcache__CacheManager_exists(v__vcache__CacheManager* cm, string Option_string v__vcache__CacheManager_save(v__vcache__CacheManager* cm, string postfix, string key, string content); Option_string v__vcache__CacheManager_load(v__vcache__CacheManager* cm, string postfix, string key); VV_LOCAL_SYMBOL int v__vcache__mypid(void); -Option_string v__util__diff__find_working_diff_command(void); -VV_LOCAL_SYMBOL bool v__util__diff__opendiff_exists(void); -string v__util__diff__color_compare_files(string diff_cmd, string file1, string file2); -string v__util__diff__color_compare_strings(string diff_cmd, string unique_prefix, string expected, string found); string _const_v__vmod__err_label; // a string literal, inited later Option_v__vmod__Manifest v__vmod__from_file(string vmod_path); Option_v__vmod__Manifest v__vmod__decode(string contents); @@ -8509,6 +8505,262 @@ Array_string Array_v__cflag__CFlag_c_options_after_target(Array_v__cflag__CFlag Array_string Array_v__cflag__CFlag_c_options_without_object_files(Array_v__cflag__CFlag cflags); Array_string Array_v__cflag__CFlag_c_options_only_object_files(Array_v__cflag__CFlag cflags); multi_return_Array_string_Array_string_Array_string Array_v__cflag__CFlag_defines_others_libs(Array_v__cflag__CFlag cflags); +f64 math__fabs(f64 x); +u64 _const_math__uvnan = 9221120237041090561U; // precomputed +u64 _const_math__uvinf = 9218868437227405312U; // precomputed +u64 _const_math__uvneginf = 18442240474082181120U; // precomputed +u64 _const_math__uvone = 4607182418800017408U; // precomputed +#define _const_math__mask 2047 +#define _const_math__shift 52 +#define _const_math__bias 1023 +u64 _const_math__normalize_smallest_mask = 4503599627370496U; // precomputed +u64 _const_math__sign_mask = 9223372036854775808U; // precomputed +u64 _const_math__frac_mask = 4503599627370495U; // precomputed +f64 math__inf(int sign); +f64 math__nan(void); +bool math__is_nan(f64 f); +bool math__is_inf(f64 f, int sign); +bool math__is_finite(f64 f); +multi_return_f64_int math__normalize(f64 x); +f64 math__cbrt(f64 a); +f64 _const_math__e = 2.718281828459045; // precomputed +f64 _const_math__pi = 3.141592653589793; // precomputed +f64 _const_math__pi_2; // inited later +f64 _const_math__pi_4; // inited later +f64 _const_math__phi = 1.618033988749895; // precomputed +f64 _const_math__tau = 6.283185307179586; // precomputed +f64 _const_math__sqrt2 = 1.4142135623730951; // precomputed +f64 _const_math__sqrt_e = 1.6487212707001282; // precomputed +f64 _const_math__sqrt_pi = 1.772453850905516; // precomputed +f64 _const_math__sqrt_tau = 2.5066282746310007; // precomputed +f64 _const_math__sqrt_phi = 1.272019649514069; // precomputed +f64 _const_math__ln2 = 0.6931471805599453; // precomputed +f64 _const_math__log2_e; // inited later +f64 _const_math__ln10 = 2.302585092994046; // precomputed +f64 _const_math__log10_e; // inited later +f64 _const_math__max_f32 = 3.4028234663852886e+38; // precomputed +f64 _const_math__smallest_non_zero_f32 = 3.503246160812043e-46; // precomputed +f64 _const_math__max_f64 = 1.7976931348623157e+308; // precomputed +f64 _const_math__smallest_non_zero_f64 = 0; // precomputed +#define _const_math__max_i8 127 +#define _const_math__min_i8 -128 +#define _const_math__max_i16 32767 +#define _const_math__min_i16 -32768 +#define _const_math__max_i32 2147483647 +#define _const_math__min_i32 -2147483648 +i64 _const_math__min_i64; // inited later +i64 _const_math__max_i64; // inited later +#define _const_math__max_u8 255 +#define _const_math__max_u16 65535 +u32 _const_math__max_u32 = 4294967295; // precomputed +u64 _const_math__max_u64 = 18446744073709551615U; // precomputed +f64 math__mod(f64 x, f64 y); +f64 math__fmod(f64 x, f64 y); +i64 math__gcd(i64 a_, i64 b_); +multi_return_i64_i64_i64 math__egcd(i64 a, i64 b); +i64 math__lcm(i64 a, i64 b); +f64 _const_math__erx = 0.8450629115104675; // precomputed +f64 _const_math__efx = 0.1283791670955126; // precomputed +f64 _const_math__efx8 = 1.0270333367641007; // precomputed +f64 _const_math__pp0 = 0.12837916709551256; // precomputed +f64 _const_math__pp1 = -0.3250421072470015; // precomputed +f64 _const_math__pp2 = -0.02848174957559851; // precomputed +f64 _const_math__pp3 = -0.005770270296489442; // precomputed +f64 _const_math__pp4 = -2.3763016656650163e-05; // precomputed +f64 _const_math__qq1 = 0.39791722395915535; // precomputed +f64 _const_math__qq2 = 0.0650222499887673; // precomputed +f64 _const_math__qq3 = 0.005081306281875766; // precomputed +f64 _const_math__qq4 = 0.00013249473800432164; // precomputed +f64 _const_math__qq5 = -3.960228278775368e-06; // precomputed +f64 _const_math__pa0 = -0.0023621185607526594; // precomputed +f64 _const_math__pa1 = 0.41485611868374833; // precomputed +f64 _const_math__pa2 = -0.3722078760357013; // precomputed +f64 _const_math__pa3 = 0.31834661990116175; // precomputed +f64 _const_math__pa4 = -0.11089469428239668; // precomputed +f64 _const_math__pa5 = 0.035478304325618236; // precomputed +f64 _const_math__pa6 = -0.002166375594868791; // precomputed +f64 _const_math__qa1 = 0.10642088040084423; // precomputed +f64 _const_math__qa2 = 0.540397917702171; // precomputed +f64 _const_math__qa3 = 0.07182865441419627; // precomputed +f64 _const_math__qa4 = 0.12617121980876164; // precomputed +f64 _const_math__qa5 = 0.01363708391202905; // precomputed +f64 _const_math__qa6 = 0.011984499846799107; // precomputed +f64 _const_math__ra0 = -0.009864944034847148; // precomputed +f64 _const_math__ra1 = -0.6938585727071818; // precomputed +f64 _const_math__ra2 = -10.558626225323291; // precomputed +f64 _const_math__ra3 = -62.375332450326006; // precomputed +f64 _const_math__ra4 = -162.39666946257347; // precomputed +f64 _const_math__ra5 = -184.60509290671104; // precomputed +f64 _const_math__ra6 = -81.2874355063066; // precomputed +f64 _const_math__ra7 = -9.814329344169145; // precomputed +f64 _const_math__sa1 = 19.651271667439257; // precomputed +f64 _const_math__sa2 = 137.65775414351904; // precomputed +f64 _const_math__sa3 = 434.56587747522923; // precomputed +f64 _const_math__sa4 = 645.3872717332679; // precomputed +f64 _const_math__sa5 = 429.00814002756783; // precomputed +f64 _const_math__sa6 = 108.63500554177944; // precomputed +f64 _const_math__sa7 = 6.570249770319282; // precomputed +f64 _const_math__sa8 = -0.0604244152148581; // precomputed +f64 _const_math__rb0 = -0.0098649429247001; // precomputed +f64 _const_math__rb1 = -0.799283237680523; // precomputed +f64 _const_math__rb2 = -17.757954917754752; // precomputed +f64 _const_math__rb3 = -160.63638485582192; // precomputed +f64 _const_math__rb4 = -637.5664433683896; // precomputed +f64 _const_math__rb5 = -1025.0951316110772; // precomputed +f64 _const_math__rb6 = -483.5191916086514; // precomputed +f64 _const_math__sb1 = 30.33806074348246; // precomputed +f64 _const_math__sb2 = 325.7925129965739; // precomputed +f64 _const_math__sb3 = 1536.729586084437; // precomputed +f64 _const_math__sb4 = 3199.8582195085955; // precomputed +f64 _const_math__sb5 = 2553.0504064331644; // precomputed +f64 _const_math__sb6 = 474.52854120695537; // precomputed +f64 _const_math__sb7 = -22.44095244658582; // precomputed +f64 math__erf(f64 a); +f64 math__erfc(f64 a); +f64 _const_math__f64_max_exp = 1024.; // precomputed +f64 _const_math__f64_min_exp = -1021.; // precomputed +f64 _const_math__threshold = 709.782712893384; // precomputed +f64 _const_math__ln2_x56 = 38.816242111356935; // precomputed +f64 _const_math__ln2_halfx3 = 1.0397207708399179; // precomputed +f64 _const_math__ln2_half = 0.34657359027997264; // precomputed +f64 _const_math__ln2hi = 0.6931471803691238; // precomputed +f64 _const_math__ln2lo = 1.9082149292705877e-10; // precomputed +f64 _const_math__inv_ln2 = 1.4426950408889634; // precomputed +f64 _const_math__expm1_q1 = -0.03333333333333313; // precomputed +f64 _const_math__expm1_q2 = 0.0015873015872548146; // precomputed +f64 _const_math__expm1_q3 = -7.93650757867488e-05; // precomputed +f64 _const_math__expm1_q4 = 4.008217827329362e-06; // precomputed +f64 _const_math__expm1_q5 = -2.0109921818362437e-07; // precomputed +f64 math__exp(f64 x); +f64 math__exp2(f64 x); +f64 math__ldexp(f64 frac, int exp); +multi_return_f64_int math__frexp(f64 x); +f64 math__expm1(f64 x); +VV_LOCAL_SYMBOL f64 math__expmulti(f64 hi, f64 lo, int k); +f64 math__factorial(f64 n); +f64 math__log_factorial(f64 n); +VV_LOCAL_SYMBOL f64 math__log_factorial_asymptotic_expansion(int n); +i64 math__factoriali(int n); +f64 _const_math__log_sqrt_2pi = 0.9189385332046728; // precomputed +Array_f64 _const_math__bernoulli; // inited later +Array_f64 _const_math__factorials_table; // inited later +Array_f64 _const_math__log_factorials_table; // inited later +f64 math__floor(f64 x); +f64 math__ceil(f64 x); +f64 math__trunc(f64 x); +f64 math__round(f64 x); +f64 math__round_to_even(f64 x); +VV_LOCAL_SYMBOL multi_return_f64_f64 math__stirling(f64 x); +f64 math__gamma(f64 a); +f64 math__log_gamma(f64 x); +multi_return_f64_int math__log_gamma_sign(f64 a); +VV_LOCAL_SYMBOL f64 math__sin_pi(f64 x_); +Array_f64 _const_math__gamma_p; // inited later +Array_f64 _const_math__gamma_q; // inited later +Array_f64 _const_math__gamma_s; // inited later +Array_f64 _const_math__lgamma_a; // inited later +Array_f64 _const_math__lgamma_r; // inited later +Array_f64 _const_math__lgamma_s; // inited later +Array_f64 _const_math__lgamma_t; // inited later +Array_f64 _const_math__lgamma_u; // inited later +Array_f64 _const_math__lgamma_v; // inited later +Array_f64 _const_math__lgamma_w; // inited later +f64 math__hypot(f64 x, f64 y); +f64 math__acosh(f64 x); +f64 math__asinh(f64 x); +f64 math__atanh(f64 x); +f64 _const_math__morebits = 6.123233995736766e-17; // precomputed +f64 _const_math__tan3pio8 = 2.414213562373095; // precomputed +VV_LOCAL_SYMBOL f64 math__xatan(f64 x); +VV_LOCAL_SYMBOL f64 math__satan(f64 x); +f64 math__atan(f64 x); +f64 math__atan2(f64 y, f64 x); +f64 math__asin(f64 x_); +f64 math__acos(f64 x); +f64 math__log_n(f64 x, f64 b); +f64 math__log10(f64 x); +f64 math__log2(f64 x); +f64 math__log1p(f64 x); +f64 math__log_b(f64 x); +int math__ilog_b(f64 x); +VV_LOCAL_SYMBOL int math__ilog_b_(f64 x_); +f64 math__log(f64 a); +f64 math__aprox_sin(f64 a); +f64 math__aprox_cos(f64 a); +f64 math__copysign(f64 x, f64 y); +f64 math__degrees(f64 radians); +Array_int math__digits(i64 num, math__DigitParams params); +int math__count_digits(i64 number); +multi_return_f64_f64 math__minmax(f64 a, f64 b); +f64 math__clamp(f64 x, f64 a, f64 b); +f64 math__sign(f64 n); +int math__signi(f64 n); +f64 math__radians(f64 degrees); +bool math__signbit(f64 x); +bool math__tolerance(f64 a, f64 b, f64 tol); +bool math__close(f64 a, f64 b); +bool math__veryclose(f64 a, f64 b); +bool math__alike(f64 a, f64 b); +VV_LOCAL_SYMBOL bool math__is_odd_int(f64 x); +VV_LOCAL_SYMBOL bool math__is_neg_int(f64 x); +int math__min_T_int(int a, int b); +f64 math__abs_T_f64(f64 a); +f64 _const_math__modf_maxpowtwo = 4.503599627370496e+15; // precomputed +multi_return_f64_f64 math__modf(f64 f); +f32 math__nextafter32(f32 x, f32 y); +f64 math__nextafter(f64 x, f64 y); +VV_LOCAL_SYMBOL f64 math__poly_n_eval(Array_f64 c, int n, f64 x); +VV_LOCAL_SYMBOL f64 math__poly_n_1_eval(Array_f64 c, int n, f64 x); +VV_LOCAL_SYMBOL f64 math__poly_eval(Array_f64 c, f64 x); +VV_LOCAL_SYMBOL f64 math__poly_1_eval(Array_f64 c, f64 x); +VV_LOCAL_SYMBOL multi_return_f64_f64 math__ChebSeries_eval_e(math__ChebSeries cs, f64 x); +f32 math__powf(f32 a, f32 b); +Array_f64 _const_math__pow10tab; // inited later +Array_f64 _const_math__pow10postab32; // inited later +Array_f64 _const_math__pow10negtab32; // inited later +f32 math__pure_v_but_overriden_by_c_powf(f32 a, f32 b); +f64 math__pow10(int n); +i64 math__powi(i64 a, i64 b); +f64 math__pow(f64 x, f64 y); +f64 math__q_rsqrt(f64 x); +f64 math__scalbn(f64 x, int n_); +f32 math__cosf(f32 a); +f32 math__sinf(f32 a); +Array_f64 _const_math__sin_data; // inited later +math__ChebSeries _const_math__sin_cs; // inited later +Array_f64 _const_math__cos_data; // inited later +math__ChebSeries _const_math__cos_cs; // inited later +f64 math__sin(f64 x); +f64 math__cos(f64 x); +f32 math__pure_v_but_overriden_by_c_cosf(f32 a); +f32 math__pure_v_but_overriden_by_c_sinf(f32 a); +multi_return_f64_f64 math__sincos(f64 x); +f64 math__sinh(f64 x_); +f64 math__cosh(f64 x); +f32 math__sqrtf(f32 a); +f64 math__sqrt(f64 a); +f32 math__pure_v_but_overriden_by_c_sqrtf(f32 a); +i64 math__sqrti(i64 a); +f32 math__tanf(f32 a); +Array_f64 _const_math__tan_p; // inited later +Array_f64 _const_math__tan_q; // inited later +f64 _const_math__tan_dp1 = 0.7853981554508209; // precomputed +f64 _const_math__tan_dp2 = 7.946627356147928e-09; // precomputed +f64 _const_math__tan_dp3 = 3.061616997868383e-17; // precomputed +f64 _const_math__tan_lossth = 1.073741824e+09; // precomputed +f64 math__tan(f64 a); +f32 math__pure_v_but_overriden_by_c_tanf(f32 a); +f64 math__cot(f64 a); +Array_f64 _const_math__tanh_p; // inited later +Array_f64 _const_math__tanh_q; // inited later +f64 math__tanh(f64 x); +u32 math__f32_bits(f32 f); +f32 math__f32_from_bits(u32 b); +u64 math__f64_bits(f64 f); +f64 math__f64_from_bits(u64 b); +f64 math__with_set_low_word(f64 f, u32 lo); +f64 math__with_set_high_word(f64 f, u32 hi); +u32 math__get_high_word(f64 f); VV_LOCAL_SYMBOL Option_string v__pkgconfig__desc(string mod); Option_v__pkgconfig__Main_ptr v__pkgconfig__main(Array_string args); VV_LOCAL_SYMBOL int compare_16330786295575367509_string(string* a, string* b) { @@ -8536,16 +8788,133 @@ VV_LOCAL_SYMBOL void v__pkgconfig__PkgConfig_add_path(v__pkgconfig__PkgConfig* p VV_LOCAL_SYMBOL void v__pkgconfig__PkgConfig_load_paths(v__pkgconfig__PkgConfig* pc); Option_v__pkgconfig__PkgConfig_ptr v__pkgconfig__load(string pkgname, v__pkgconfig__Options options); Array_string v__pkgconfig__list(void); -VV_LOCAL_SYMBOL u32 rand__seed__nr_next(u32 prev); -Array_u32 rand__seed__time_seed_array(int count); -u32 rand__seed__time_seed_32(void); -u64 rand__seed__time_seed_64(void); int runtime__nr_jobs(void); bool runtime__is_32bit(void); bool runtime__is_64bit(void); bool runtime__is_little_endian(void); bool runtime__is_big_endian(void); int runtime__nr_cpus(void); +i64 time__portable_timegm(struct tm* t); +int time__days_from_civil(int oy, int m, int d); +string time__Time_format(time__Time t); +string time__Time_format_ss(time__Time t); +string time__Time_format_ss_milli(time__Time t); +string time__Time_format_ss_micro(time__Time t); +string time__Time_hhmm(time__Time t); +string time__Time_hhmmss(time__Time t); +string time__Time_hhmm12(time__Time t); +string time__Time_ymmdd(time__Time t); +string time__Time_ddmmy(time__Time t); +string time__Time_md(time__Time t); +VV_LOCAL_SYMBOL string time__ordinal_suffix(int n); +Array_string _const_time__tokens_2; // inited later +Array_string _const_time__tokens_3; // inited later +Array_string _const_time__tokens_4; // inited later +string time__Time_custom_format(time__Time t, string s); +string time__Time_clean(time__Time t); +string time__Time_clean12(time__Time t); +string time__Time_get_fmt_time_str(time__Time t, time__FormatTime fmt_time); +string time__Time_get_fmt_date_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatDate fmt_date); +string time__Time_get_fmt_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatTime fmt_time, time__FormatDate fmt_date); +string time__Time_utc_string(time__Time t); +bool time__Time__eq(time__Time t1, time__Time t2); +bool time__Time__lt(time__Time t1, time__Time t2); +time__Duration time__Time__minus(time__Time lhs, time__Time rhs); +Option_time__Time time__parse_rfc3339(string s); +Option_time__Time time__parse(string s); +Option_time__Time time__parse_iso8601(string s); +Option_time__Time time__parse_rfc2822(string s); +VV_LOCAL_SYMBOL Option_multi_return_int_int_int time__parse_iso8601_date(string s); +VV_LOCAL_SYMBOL Option_multi_return_int_int_int_int_i64_bool time__parse_iso8601_time(string s); +string time__TimeParseError_msg(time__TimeParseError err); +VV_LOCAL_SYMBOL IError time__error_invalid_time(int code); +time__StopWatch time__new_stopwatch(time__StopWatchOptions opts); +void time__StopWatch_start(time__StopWatch* t); +void time__StopWatch_restart(time__StopWatch* t); +void time__StopWatch_stop(time__StopWatch* t); +void time__StopWatch_pause(time__StopWatch* t); +time__Duration time__StopWatch_elapsed(time__StopWatch t); +time__Time time__now(void); +time__Time time__utc(void); +time__Time time__new_time(time__Time t); +i64 time__ticks(void); +string time__Time_str(time__Time t); +VV_LOCAL_SYMBOL time__Time time__convert_ctime(struct tm t, int microsecond); +string time__Time_strftime(time__Time t, string fmt); +string _const_time__days_string; // a string literal, inited later +Array_string _const_time__long_days; // inited later +Array_int _const_time__month_days; // inited later +string _const_time__months_string; // a string literal, inited later +Array_string _const_time__long_months; // inited later +i64 _const_time__absolute_zero_year; // inited later +#define _const_time__seconds_per_minute 60 +#define _const_time__seconds_per_hour 3600 +#define _const_time__seconds_per_day 86400 +#define _const_time__seconds_per_week 604800 +#define _const_time__days_per_400_years 146097 +#define _const_time__days_per_100_years 36524 +#define _const_time__days_per_4_years 1461 +Array_int _const_time__days_before; // inited later +string time__Time_smonth(time__Time* t); +i64 time__Time_unix_time(time__Time* t); +i64 time__Time_unix_time_milli(time__Time* t); +time__Time time__Time_add(time__Time* t, time__Duration d); +time__Time time__Time_add_seconds(time__Time* t, int seconds); +time__Time time__Time_add_days(time__Time* t, int days); +time__Duration time__since(time__Time t); +string time__Time_relative(time__Time* t); +string time__Time_relative_short(time__Time* t); +int time__day_of_week(int y, int m, int d); +int time__Time_day_of_week(time__Time* t); +string time__Time_weekday_str(time__Time* t); +string time__Time_long_weekday_str(time__Time* t); +bool time__is_leap_year(int year); +Option_int time__days_in_month(int month, int year); +string time__Time_debug(time__Time* t); +time__Duration _const_time__nanosecond; // inited later +time__Duration _const_time__microsecond; // inited later +time__Duration _const_time__millisecond; // inited later +time__Duration _const_time__second; // inited later +time__Duration _const_time__minute; // inited later +time__Duration _const_time__hour; // inited later +time__Duration _const_time__infinite; // inited later +i64 time__Duration_nanoseconds(time__Duration d); +i64 time__Duration_microseconds(time__Duration d); +i64 time__Duration_milliseconds(time__Duration d); +f64 time__Duration_seconds(time__Duration d); +f64 time__Duration_minutes(time__Duration d); +f64 time__Duration_hours(time__Duration d); +string time__Duration_str(time__Duration d); +int time__offset(void); +VV_LOCAL_SYMBOL u64 time__sys_mono_now_darwin(void); +time__Time time__darwin_now(void); +time__Time time__solaris_now(void); +time__Time time__darwin_utc(void); +time__Time time__solaris_utc(void); +VV_LOCAL_SYMBOL i64 time__make_unix_time(struct tm t); +time__Time time__Time_local(time__Time* t); +u64 time__sys_mono_now(void); +VV_LOCAL_SYMBOL u64 time__vpc_now(void); +VV_LOCAL_SYMBOL time__Time time__linux_now(void); +VV_LOCAL_SYMBOL time__Time time__linux_utc(void); +time__Time time__win_now(void); +time__Time time__win_utc(void); +struct timespec time__Duration_timespec(time__Duration d); +struct timespec time__zero_timespec(void); +void time__sleep(time__Duration duration); +int time__Duration_sys_milliseconds(time__Duration d); +time__Time time__unix(i64 abs); +time__Time time__unix2(i64 abs, int microsecond); +VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_date_from_offset(i64 day_offset_); +VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_time_from_offset(i64 second_offset_); +Option_string v__util__diff__find_working_diff_command(void); +VV_LOCAL_SYMBOL bool v__util__diff__opendiff_exists(void); +string v__util__diff__color_compare_files(string diff_cmd, string file1, string file2); +string v__util__diff__color_compare_strings(string diff_cmd, string unique_prefix, string expected, string found); +VV_LOCAL_SYMBOL u32 rand__seed__nr_next(u32 prev); +Array_u32 rand__seed__time_seed_array(int count); +u32 rand__seed__time_seed_32(void); +u64 rand__seed__time_seed_64(void); u64 _const_rand__wyrand__wyp0 = 11562461410679940143U; // precomputed u64 _const_rand__wyrand__wyp1 = 16646288086500911323U; // precomputed #define _const_rand__wyrand__seed_len 2 @@ -8875,6 +9244,7 @@ Option_void v__ast__Stmt_check_c_expr(v__ast__Stmt stmt); v__token__Pos v__ast__Node_pos(v__ast__Node node); Array_v__ast__Node v__ast__Node_children(v__ast__Node node); void v__ast__IndexExpr_recursive_mapset_is_setter(v__ast__IndexExpr* lx, bool val); +void v__ast__IndexExpr_recursive_arraymap_set_is_setter(v__ast__IndexExpr* lx); Map_string_v__ast__ScopeObject v__ast__all_registers(v__ast__Table* t, v__pref__Arch arch); VV_LOCAL_SYMBOL Map_string_v__ast__ScopeObject v__ast__gen_all_registers(v__ast__Table* t, Array_string without_numbers, Map_string_int with_numbers, int bit_size); bool v__ast__Expr_is_literal(v__ast__Expr expr); @@ -9168,6 +9538,8 @@ bool v__ast__TypeSymbol_is_string(v__ast__TypeSymbol* t); bool v__ast__TypeSymbol_is_number(v__ast__TypeSymbol* t); bool v__ast__TypeSymbol_is_primitive(v__ast__TypeSymbol* t); bool v__ast__TypeSymbol_is_builtin(v__ast__TypeSymbol* t); +int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ); +VV_LOCAL_SYMBOL int v__ast__round_up(int n, int multiple); string v__ast__Kind_str(v__ast__Kind k); string Array_v__ast__Kind_str(Array_v__ast__Kind kinds); string v__ast__Table_type_to_str(v__ast__Table* t, v__ast__Type typ); @@ -9207,7 +9579,6 @@ Option_void v__checker__Checker_check_expected(v__checker__Checker* c, v__ast__T VV_LOCAL_SYMBOL string v__checker__Checker_expected_msg(v__checker__Checker* c, v__ast__Type got, v__ast__Type expected); bool v__checker__Checker_symmetric_check(v__checker__Checker* c, v__ast__Type left, v__ast__Type right); void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__Fn func, v__ast__CallExpr* node); -int v__checker__Checker_sizeof_integer(v__checker__Checker* c, v__ast__Type a); int _const_v__checker__int_min; // inited later int _const_v__checker__int_max = 2147483647; // precomputed #define _const_v__checker__expr_level_cutoff_limit 40 @@ -10177,18 +10548,18 @@ static IError I_os__SizeOfTypeIs0Error_to_Interface_IError(os__SizeOfTypeIs0Erro const int _IError_os__SizeOfTypeIs0Error_index = 4; static IError I_os__ExecutableNotFoundError_to_Interface_IError(os__ExecutableNotFoundError* x); const int _IError_os__ExecutableNotFoundError_index = 5; -static IError I_time__TimeParseError_to_Interface_IError(time__TimeParseError* x); -const int _IError_time__TimeParseError_index = 6; static IError I_flag__UnkownFlagError_to_Interface_IError(flag__UnkownFlagError* x); -const int _IError_flag__UnkownFlagError_index = 7; +const int _IError_flag__UnkownFlagError_index = 6; static IError I_flag__ArgsCountError_to_Interface_IError(flag__ArgsCountError* x); -const int _IError_flag__ArgsCountError_index = 8; +const int _IError_flag__ArgsCountError_index = 7; static IError I_semver__InvalidComparatorFormatError_to_Interface_IError(semver__InvalidComparatorFormatError* x); -const int _IError_semver__InvalidComparatorFormatError_index = 9; +const int _IError_semver__InvalidComparatorFormatError_index = 8; static IError I_semver__EmptyInputError_to_Interface_IError(semver__EmptyInputError* x); -const int _IError_semver__EmptyInputError_index = 10; +const int _IError_semver__EmptyInputError_index = 9; static IError I_semver__InvalidVersionFormatError_to_Interface_IError(semver__InvalidVersionFormatError* x); -const int _IError_semver__InvalidVersionFormatError_index = 11; +const int _IError_semver__InvalidVersionFormatError_index = 10; +static IError I_time__TimeParseError_to_Interface_IError(time__TimeParseError* x); +const int _IError_time__TimeParseError_index = 11; static IError I_v__gen__c__UnsupportedAssertCtempTransform_to_Interface_IError(v__gen__c__UnsupportedAssertCtempTransform* x); const int _IError_v__gen__c__UnsupportedAssertCtempTransform_index = 12; // ^^^ number of types for interface IError: 13 @@ -10230,12 +10601,6 @@ static inline string os__ExecutableNotFoundError_msg_Interface_IError_method_wra static inline int os__ExecutableNotFoundError_code_Interface_IError_method_wrapper(os__ExecutableNotFoundError* err) { return Error_code(err->Error); } -static inline string time__TimeParseError_msg_Interface_IError_method_wrapper(time__TimeParseError* err) { - return time__TimeParseError_msg(*err); -} -static inline int time__TimeParseError_code_Interface_IError_method_wrapper(time__TimeParseError* err) { - return Error_code(err->Error); -} static inline string flag__UnkownFlagError_msg_Interface_IError_method_wrapper(flag__UnkownFlagError* err) { return flag__UnkownFlagError_msg(*err); } @@ -10266,6 +10631,12 @@ static inline string semver__InvalidVersionFormatError_msg_Interface_IError_meth static inline int semver__InvalidVersionFormatError_code_Interface_IError_method_wrapper(semver__InvalidVersionFormatError* err) { return Error_code(err->Error); } +static inline string time__TimeParseError_msg_Interface_IError_method_wrapper(time__TimeParseError* err) { + return time__TimeParseError_msg(*err); +} +static inline int time__TimeParseError_code_Interface_IError_method_wrapper(time__TimeParseError* err) { + return Error_code(err->Error); +} static inline string v__gen__c__UnsupportedAssertCtempTransform_msg_Interface_IError_method_wrapper(v__gen__c__UnsupportedAssertCtempTransform* err) { return Error_msg(err->Error); } @@ -10303,10 +10674,6 @@ struct _IError_interface_methods IError_name_table[13] = { ._method_msg = (void*) os__ExecutableNotFoundError_msg_Interface_IError_method_wrapper, ._method_code = (void*) os__ExecutableNotFoundError_code_Interface_IError_method_wrapper, }, - { - ._method_msg = (void*) time__TimeParseError_msg_Interface_IError_method_wrapper, - ._method_code = (void*) time__TimeParseError_code_Interface_IError_method_wrapper, - }, { ._method_msg = (void*) flag__UnkownFlagError_msg_Interface_IError_method_wrapper, ._method_code = (void*) flag__UnkownFlagError_code_Interface_IError_method_wrapper, @@ -10327,6 +10694,10 @@ struct _IError_interface_methods IError_name_table[13] = { ._method_msg = (void*) semver__InvalidVersionFormatError_msg_Interface_IError_method_wrapper, ._method_code = (void*) semver__InvalidVersionFormatError_code_Interface_IError_method_wrapper, }, + { + ._method_msg = (void*) time__TimeParseError_msg_Interface_IError_method_wrapper, + ._method_code = (void*) time__TimeParseError_code_Interface_IError_method_wrapper, + }, { ._method_msg = (void*) v__gen__c__UnsupportedAssertCtempTransform_msg_Interface_IError_method_wrapper, ._method_code = (void*) v__gen__c__UnsupportedAssertCtempTransform_code_Interface_IError_method_wrapper, @@ -10394,16 +10765,6 @@ static inline IError I_os__ExecutableNotFoundError_to_Interface_IError(os__Execu }; } -// Casting functions for converting "time__TimeParseError" to interface "IError" -static inline IError I_time__TimeParseError_to_Interface_IError(time__TimeParseError* x) { - return (IError) { - ._time__TimeParseError = x, - ._typ = _IError_time__TimeParseError_index, - .msg = (string*)((char*)x), - .code = (int*)((char*)x + __offsetof_ptr(x, time__TimeParseError, code)), - }; -} - // Casting functions for converting "flag__UnkownFlagError" to interface "IError" static inline IError I_flag__UnkownFlagError_to_Interface_IError(flag__UnkownFlagError* x) { return (IError) { @@ -10454,6 +10815,16 @@ static inline IError I_semver__InvalidVersionFormatError_to_Interface_IError(sem }; } +// Casting functions for converting "time__TimeParseError" to interface "IError" +static inline IError I_time__TimeParseError_to_Interface_IError(time__TimeParseError* x) { + return (IError) { + ._time__TimeParseError = x, + ._typ = _IError_time__TimeParseError_index, + .msg = (string*)((char*)x), + .code = (int*)((char*)x + __offsetof_ptr(x, time__TimeParseError, code)), + }; +} + // Casting functions for converting "v__gen__c__UnsupportedAssertCtempTransform" to interface "IError" static inline IError I_v__gen__c__UnsupportedAssertCtempTransform_to_Interface_IError(v__gen__c__UnsupportedAssertCtempTransform* x) { return (IError) { @@ -10647,8 +11018,6 @@ void vinit_string_literals(void){ _const_si_g64_code = _SLIT("0xfe0f"); _const_os__path_separator = _SLIT("/"); _const_os__path_delimiter = _SLIT(":"); - _const_time__days_string = _SLIT("MonTueWedThuFriSatSun"); - _const_time__months_string = _SLIT("JanFebMarAprMayJunJulAugSepOctNovDec"); _const_flag__space = _SLIT(" "); _const_flag__underline = _SLIT("-----------------------------------------------"); _const_semver__comparator_sep = _SLIT(" "); @@ -10659,6 +11028,8 @@ void vinit_string_literals(void){ _const_v__vmod__err_label = _SLIT("vmod:"); _const_v__cflag__fexisting_literal = _SLIT("$first_existing"); _const_v__pkgconfig__version = _SLIT("0.3.2"); + _const_time__days_string = _SLIT("MonTueWedThuFriSatSun"); + _const_time__months_string = _SLIT("JanFebMarAprMayJunJulAugSepOctNovDec"); _const_rand__ulid_encoding = _SLIT("0123456789ABCDEFGHJKMNPQRSTVWXYZ"); _const_rand__english_letters = _SLIT("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); _const_rand__hex_chars = _SLIT("abcdef0123456789"); @@ -10672,7 +11043,7 @@ void vinit_string_literals(void){ _const_v__gen__c__c_commit_hash_default = _SLIT("\n#ifndef V_COMMIT_HASH\n\011#define V_COMMIT_HASH \"@@@\"\n#endif\n"); _const_v__gen__c__c_current_commit_hash_default = _SLIT("\n#ifndef V_CURRENT_COMMIT_HASH\n\011#define V_CURRENT_COMMIT_HASH \"@@@\"\n#endif\n"); _const_v__gen__c__c_concurrency_helpers = _SLIT("\ntypedef struct __shared_map __shared_map;\nstruct __shared_map {\n\011sync__RwMutex mtx;\n\011map val;\n};\nstatic inline voidptr __dup_shared_map(voidptr src, int sz) {\n\011__shared_map* dest = memdup(src, sz);\n\011sync__RwMutex_init(&dest->mtx);\n\011return dest;\n}\ntypedef struct __shared_array __shared_array;\nstruct __shared_array {\n\011sync__RwMutex mtx;\n\011array val;\n};\nstatic inline voidptr __dup_shared_array(voidptr src, int sz) {\n\011__shared_array* dest = memdup(src, sz);\n\011sync__RwMutex_init(&dest->mtx);\n\011return dest;\n}\nstatic inline void __sort_ptr(uintptr_t a[], bool b[], int l) {\n\011for (int i=1; i0 && a[j-1] > ins) {\n\011\011\011a[j] = a[j-1];\n\011\011\011b[j] = b[j-1];\n\011\011\011j--;\n\011\011}\n\011\011a[j] = ins;\n\011\011b[j] = insb;\n\011}\n}\n"); - _const_v__gen__c__c_common_macros = _SLIT("\n#define EMPTY_VARG_INITIALIZATION 0\n#define EMPTY_STRUCT_INITIALIZATION 0\n#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n// Due to a tcc bug, the length of an array needs to be specified, but GCC crashes if it is...\n#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[])\n#define TCCSKIP(x) x\n\n#define __NOINLINE __attribute__((noinline))\n#define __IRQHANDLER __attribute__((interrupt))\n\n#define __V_architecture 0\n#if defined(__x86_64__)\n\011#define __V_amd64 1\n\011#undef __V_architecture\n\011#define __V_architecture 1\n#endif\n\n#if defined(__aarch64__) || defined(__arm64__)\n\011#define __V_arm64 1\n\011#undef __V_architecture\n\011#define __V_architecture 2\n#endif\n\n// Using just __GNUC__ for detecting gcc, is not reliable because other compilers define it too:\n#ifdef __GNUC__\n\011#define __V_GCC__\n#endif\n#ifdef __TINYC__\n\011#undef __V_GCC__\n#endif\n#ifdef __cplusplus\n\011#undef __V_GCC__\n#endif\n#ifdef __clang__\n\011#undef __V_GCC__\n#endif\n#ifdef _MSC_VER\n\011#undef __V_GCC__\n\011#undef EMPTY_STRUCT_INITIALIZATION\n\011#define EMPTY_STRUCT_INITIALIZATION 0\n#endif\n\n#ifdef __TINYC__\n\011#undef EMPTY_STRUCT_DECLARATION\n\011#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n\011#undef EMPTY_ARRAY_OF_ELEMS\n\011#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[n])\n\011#undef __NOINLINE\n\011#undef __IRQHANDLER\n\011// tcc does not support inlining at all\n\011#define __NOINLINE\n\011#define __IRQHANDLER\n\011#undef TCCSKIP\n\011#define TCCSKIP(x)\n\011// #include \n\011#ifndef _WIN32\n\011\011#include \n\011\011int tcc_backtrace(const char *fmt, ...);\n\011#endif\n#endif\n\n// Use __offsetof_ptr instead of __offset_of, when you *do* have a valid pointer, to avoid UB:\n#ifndef __offsetof_ptr\n\011#define __offsetof_ptr(ptr,PTYPE,FIELDNAME) ((size_t)((byte *)&((PTYPE *)ptr)->FIELDNAME - (byte *)ptr))\n#endif\n\n// for __offset_of\n#ifndef __offsetof\n\011#define __offsetof(PTYPE,FIELDNAME) ((size_t)((char *)&((PTYPE *)0)->FIELDNAME - (char *)0))\n#endif\n\n// returns the number of CPU registers that TYPE takes up\n#define _REG_WIDTH(T) (((sizeof(T) + sizeof(void*) - 1) & ~(sizeof(void*) - 1)) / sizeof(void*))\n// parameters of size <= 2 registers are spilled across those two registers; larger types are passed as one pointer to some stack location\n#define _REG_WIDTH_BOUNDED(T) (_REG_WIDTH(T) <= 2 ? _REG_WIDTH(T) : 1)\n\n#define OPTION_CAST(x) (x)\n\n#ifndef V64_PRINTFORMAT\n\011#ifdef PRIx64\n\011\011#define V64_PRINTFORMAT \"0x%\"PRIx64\n\011#elif defined(__WIN32__)\n\011\011#define V64_PRINTFORMAT \"0x%I64x\"\n\011#elif defined(__linux__) && defined(__LP64__)\n\011\011#define V64_PRINTFORMAT \"0x%lx\"\n\011#else\n\011\011#define V64_PRINTFORMAT \"0x%llx\"\n\011#endif\n#endif\n\n#if defined(_WIN32) || defined(__CYGWIN__)\n\011#define VV_EXPORTED_SYMBOL extern __declspec(dllexport)\n\011#define VV_LOCAL_SYMBOL static\n#else\n\011// 4 < gcc < 5 is used by some older Ubuntu LTS and Centos versions,\n\011// and does not support __has_attribute(visibility) ...\n\011#ifndef __has_attribute\n\011\011#define __has_attribute(x) 0 // Compatibility with non-clang compilers.\n\011#endif\n\011#if (defined(__GNUC__) && (__GNUC__ >= 4)) || (defined(__clang__) && __has_attribute(visibility))\n\011\011#ifdef ARM\n\011\011\011#define VV_EXPORTED_SYMBOL extern __attribute__((externally_visible,visibility(\"default\")))\n\011\011#else\n\011\011\011#define VV_EXPORTED_SYMBOL extern __attribute__((visibility(\"default\")))\n\011\011#endif\n\011\011#if defined(__clang__) && (defined(_VUSECACHE) || defined(_VBUILDMODULE))\n\011\011\011#define VV_LOCAL_SYMBOL static\n\011\011#else\n\011\011\011#define VV_LOCAL_SYMBOL __attribute__ ((visibility (\"hidden\")))\n\011\011#endif\n\011#else\n\011\011#define VV_EXPORTED_SYMBOL extern\n\011\011#define VV_LOCAL_SYMBOL static\n\011#endif\n#endif\n\n#ifdef __cplusplus\n\011#include \n\011#define _MOV std::move\n#else\n\011#define _MOV\n#endif\n\n// tcc does not support has_include properly yet, turn it off completely\n#if defined(__TINYC__) && defined(__has_include)\n#undef __has_include\n#endif\n\n\n#if !defined(VWEAK)\n\011#define VWEAK __attribute__((weak))\n\011#ifdef _MSC_VER\n\011\011#undef VWEAK\n\011\011#define VWEAK\n\011#endif\n#endif\n\n#if !defined(VNORETURN)\n\011#if defined(__TINYC__)\n\011\011#include \n\011\011#define VNORETURN noreturn\n\011#endif\n\011# if !defined(__TINYC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L\n\011# define VNORETURN _Noreturn\n\011# elif defined(__GNUC__) && __GNUC__ >= 2\n\011# define VNORETURN __attribute__((noreturn))\n\011# endif\n\011#ifndef VNORETURN\n\011\011#define VNORETURN\n\011#endif\n#endif\n\n#if !defined(VUNREACHABLE)\n\011#if defined(__GNUC__) && !defined(__clang__)\n\011\011#define V_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__)\n\011\011#if (V_GCC_VERSION >= 40500L)\n\011\011\011#define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n\011\011#endif\n\011#endif\n\011#if defined(__clang__) && defined(__has_builtin)\n\011\011#if __has_builtin(__builtin_unreachable)\n\011\011\011#define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n\011\011#endif\n\011#endif\n\011#ifndef VUNREACHABLE\n\011\011#define VUNREACHABLE() do { } while (0)\n\011#endif\n\011#if defined(__FreeBSD__) && defined(__TINYC__)\n\011\011#define VUNREACHABLE() do { } while (0)\n\011#endif\n#endif\n\n//likely and unlikely macros\n#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n\011#define _likely_(x) __builtin_expect(x,1)\n\011#define _unlikely_(x) __builtin_expect(x,0)\n#else\n\011#define _likely_(x) (x)\n\011#define _unlikely_(x) (x)\n#endif\n\n"); + _const_v__gen__c__c_common_macros = _SLIT("\n#define EMPTY_VARG_INITIALIZATION 0\n#define EMPTY_STRUCT_INITIALIZATION 0\n#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n// Due to a tcc bug, the length of an array needs to be specified, but GCC crashes if it is...\n#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[])\n#define TCCSKIP(x) x\n\n#define __NOINLINE __attribute__((noinline))\n#define __IRQHANDLER __attribute__((interrupt))\n\n#define __V_architecture 0\n#if defined(__x86_64__)\n\011#define __V_amd64 1\n\011#undef __V_architecture\n\011#define __V_architecture 1\n#endif\n\n#if defined(__aarch64__) || defined(__arm64__)\n\011#define __V_arm64 1\n\011#undef __V_architecture\n\011#define __V_architecture 2\n#endif\n\n// Using just __GNUC__ for detecting gcc, is not reliable because other compilers define it too:\n#ifdef __GNUC__\n\011#define __V_GCC__\n#endif\n#ifdef __TINYC__\n\011#undef __V_GCC__\n#endif\n#ifdef __cplusplus\n\011#undef __V_GCC__\n#endif\n#ifdef __clang__\n\011#undef __V_GCC__\n#endif\n#ifdef _MSC_VER\n\011#undef __V_GCC__\n\011#undef EMPTY_STRUCT_INITIALIZATION\n\011#define EMPTY_STRUCT_INITIALIZATION 0\n#endif\n\n#ifdef __TINYC__\n\011#define _Atomic volatile\n\011#undef EMPTY_STRUCT_DECLARATION\n\011#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n\011#undef EMPTY_ARRAY_OF_ELEMS\n\011#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[n])\n\011#undef __NOINLINE\n\011#undef __IRQHANDLER\n\011// tcc does not support inlining at all\n\011#define __NOINLINE\n\011#define __IRQHANDLER\n\011#undef TCCSKIP\n\011#define TCCSKIP(x)\n\011// #include \n\011#ifndef _WIN32\n\011\011#include \n\011\011int tcc_backtrace(const char *fmt, ...);\n\011#endif\n#endif\n\n// Use __offsetof_ptr instead of __offset_of, when you *do* have a valid pointer, to avoid UB:\n#ifndef __offsetof_ptr\n\011#define __offsetof_ptr(ptr,PTYPE,FIELDNAME) ((size_t)((byte *)&((PTYPE *)ptr)->FIELDNAME - (byte *)ptr))\n#endif\n\n// for __offset_of\n#ifndef __offsetof\n\011#define __offsetof(PTYPE,FIELDNAME) ((size_t)((char *)&((PTYPE *)0)->FIELDNAME - (char *)0))\n#endif\n\n// returns the number of CPU registers that TYPE takes up\n#define _REG_WIDTH(T) (((sizeof(T) + sizeof(void*) - 1) & ~(sizeof(void*) - 1)) / sizeof(void*))\n// parameters of size <= 2 registers are spilled across those two registers; larger types are passed as one pointer to some stack location\n#define _REG_WIDTH_BOUNDED(T) (_REG_WIDTH(T) <= 2 ? _REG_WIDTH(T) : 1)\n\n#define OPTION_CAST(x) (x)\n\n#ifndef V64_PRINTFORMAT\n\011#ifdef PRIx64\n\011\011#define V64_PRINTFORMAT \"0x%\"PRIx64\n\011#elif defined(__WIN32__)\n\011\011#define V64_PRINTFORMAT \"0x%I64x\"\n\011#elif defined(__linux__) && defined(__LP64__)\n\011\011#define V64_PRINTFORMAT \"0x%lx\"\n\011#else\n\011\011#define V64_PRINTFORMAT \"0x%llx\"\n\011#endif\n#endif\n\n#if defined(_WIN32) || defined(__CYGWIN__)\n\011#define VV_EXPORTED_SYMBOL extern __declspec(dllexport)\n\011#define VV_LOCAL_SYMBOL static\n#else\n\011// 4 < gcc < 5 is used by some older Ubuntu LTS and Centos versions,\n\011// and does not support __has_attribute(visibility) ...\n\011#ifndef __has_attribute\n\011\011#define __has_attribute(x) 0 // Compatibility with non-clang compilers.\n\011#endif\n\011#if (defined(__GNUC__) && (__GNUC__ >= 4)) || (defined(__clang__) && __has_attribute(visibility))\n\011\011#ifdef ARM\n\011\011\011#define VV_EXPORTED_SYMBOL extern __attribute__((externally_visible,visibility(\"default\")))\n\011\011#else\n\011\011\011#define VV_EXPORTED_SYMBOL extern __attribute__((visibility(\"default\")))\n\011\011#endif\n\011\011#if defined(__clang__) && (defined(_VUSECACHE) || defined(_VBUILDMODULE))\n\011\011\011#define VV_LOCAL_SYMBOL static\n\011\011#else\n\011\011\011#define VV_LOCAL_SYMBOL __attribute__ ((visibility (\"hidden\")))\n\011\011#endif\n\011#else\n\011\011#define VV_EXPORTED_SYMBOL extern\n\011\011#define VV_LOCAL_SYMBOL static\n\011#endif\n#endif\n\n#ifdef __cplusplus\n\011#include \n\011#define _MOV std::move\n#else\n\011#define _MOV\n#endif\n\n// tcc does not support has_include properly yet, turn it off completely\n#if defined(__TINYC__) && defined(__has_include)\n#undef __has_include\n#endif\n\n\n#if !defined(VWEAK)\n\011#define VWEAK __attribute__((weak))\n\011#ifdef _MSC_VER\n\011\011#undef VWEAK\n\011\011#define VWEAK\n\011#endif\n#endif\n\n#if !defined(VNORETURN)\n\011#if defined(__TINYC__)\n\011\011#include \n\011\011#define VNORETURN noreturn\n\011#endif\n\011# if !defined(__TINYC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L\n\011# define VNORETURN _Noreturn\n\011# elif defined(__GNUC__) && __GNUC__ >= 2\n\011# define VNORETURN __attribute__((noreturn))\n\011# endif\n\011#ifndef VNORETURN\n\011\011#define VNORETURN\n\011#endif\n#endif\n\n#if !defined(VUNREACHABLE)\n\011#if defined(__GNUC__) && !defined(__clang__)\n\011\011#define V_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__)\n\011\011#if (V_GCC_VERSION >= 40500L)\n\011\011\011#define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n\011\011#endif\n\011#endif\n\011#if defined(__clang__) && defined(__has_builtin)\n\011\011#if __has_builtin(__builtin_unreachable)\n\011\011\011#define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n\011\011#endif\n\011#endif\n\011#ifndef VUNREACHABLE\n\011\011#define VUNREACHABLE() do { } while (0)\n\011#endif\n\011#if defined(__FreeBSD__) && defined(__TINYC__)\n\011\011#define VUNREACHABLE() do { } while (0)\n\011#endif\n#endif\n\n//likely and unlikely macros\n#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n\011#define _likely_(x) __builtin_expect(x,1)\n\011#define _unlikely_(x) __builtin_expect(x,0)\n#else\n\011#define _likely_(x) (x)\n\011#define _unlikely_(x) (x)\n#endif\n\n"); _const_v__gen__c__c_unsigned_comparison_functions = _SLIT("\n// unsigned/signed comparisons\nstatic inline bool _us32_gt(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a > b; }\nstatic inline bool _us32_ge(uint32_t a, int32_t b) { return a >= INT32_MAX || (int32_t)a >= b; }\nstatic inline bool _us32_eq(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a == b; }\nstatic inline bool _us32_ne(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a != b; }\nstatic inline bool _us32_le(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a <= b; }\nstatic inline bool _us32_lt(uint32_t a, int32_t b) { return a < INT32_MAX && (int32_t)a < b; }\nstatic inline bool _us64_gt(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a > b; }\nstatic inline bool _us64_ge(uint64_t a, int64_t b) { return a >= INT64_MAX || (int64_t)a >= b; }\nstatic inline bool _us64_eq(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a == b; }\nstatic inline bool _us64_ne(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a != b; }\nstatic inline bool _us64_le(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a <= b; }\nstatic inline bool _us64_lt(uint64_t a, int64_t b) { return a < INT64_MAX && (int64_t)a < b; }\n"); _const_v__gen__c__c_helper_macros = _SLIT("//============================== HELPER C MACROS =============================*/\n// _SLIT0 is used as NULL string for literal arguments\n// `\"\" s` is used to enforce a string literal argument\n#define _SLIT0 (string){.str=(byteptr)(\"\"), .len=0, .is_lit=1}\n#define _SLIT(s) ((string){.str=(byteptr)(\"\" s), .len=(sizeof(s)-1), .is_lit=1})\n#define _SLEN(s, n) ((string){.str=(byteptr)(\"\" s), .len=n, .is_lit=1})\n\n// take the address of an rvalue\n#define ADDR(type, expr) (&((type[]){expr}[0]))\n\n// copy something to the heap\n#define HEAP(type, expr) ((type*)memdup((void*)&((type[]){expr}[0]), sizeof(type)))\n#define HEAP_noscan(type, expr) ((type*)memdup_noscan((void*)&((type[]){expr}[0]), sizeof(type)))\n\n#define _PUSH_MANY(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many(arr, tmp.data, tmp.len);}\n#define _PUSH_MANY_noscan(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many_noscan(arr, tmp.data, tmp.len);}\n"); _const_v__gen__c__c_builtin_types = _SLIT("\n//================================== builtin types ================================*/\ntypedef int64_t i64;\ntypedef int16_t i16;\ntypedef int8_t i8;\ntypedef uint64_t u64;\ntypedef uint32_t u32;\ntypedef uint8_t u8;\ntypedef uint16_t u16;\n//typedef uint8_t byte;\ntypedef uint32_t rune;\ntypedef size_t usize;\ntypedef ptrdiff_t isize;\n#ifndef VNOFLOAT\ntypedef float f32;\ntypedef double f64;\n#else\ntypedef int32_t f32;\ntypedef int64_t f64;\n#endif\ntypedef int64_t int_literal;\n#ifndef VNOFLOAT\ntypedef double float_literal;\n#else\ntypedef int64_t float_literal;\n#endif\ntypedef unsigned char* byteptr;\ntypedef void* voidptr;\ntypedef char* charptr;\ntypedef u8 array_fixed_byte_300 [300];\n\ntypedef struct sync__Channel* chan;\n\n#ifndef __cplusplus\n\011#ifndef bool\n\011\011#ifdef CUSTOM_DEFINE_4bytebool\n\011\011\011typedef int bool;\n\011\011#else\n\011\011\011typedef u8 bool;\n\011\011#endif\n\011\011#define true 1\n\011\011#define false 0\n\011#endif\n#endif\n\ntypedef u64 (*MapHashFn)(voidptr);\ntypedef bool (*MapEqFn)(voidptr, voidptr);\ntypedef void (*MapCloneFn)(voidptr, voidptr);\ntypedef void (*MapFreeFn)(voidptr);\n"); @@ -12724,12 +13095,12 @@ static char * v_typeof_interface_IError(int sidx) { /* IError */ if (sidx == _IError_os__FileNotOpenedError_index) return "os.FileNotOpenedError"; if (sidx == _IError_os__SizeOfTypeIs0Error_index) return "os.SizeOfTypeIs0Error"; if (sidx == _IError_os__ExecutableNotFoundError_index) return "os.ExecutableNotFoundError"; - if (sidx == _IError_time__TimeParseError_index) return "time.TimeParseError"; if (sidx == _IError_flag__UnkownFlagError_index) return "flag.UnkownFlagError"; if (sidx == _IError_flag__ArgsCountError_index) return "flag.ArgsCountError"; if (sidx == _IError_semver__InvalidComparatorFormatError_index) return "semver.InvalidComparatorFormatError"; if (sidx == _IError_semver__EmptyInputError_index) return "semver.EmptyInputError"; if (sidx == _IError_semver__InvalidVersionFormatError_index) return "semver.InvalidVersionFormatError"; + if (sidx == _IError_time__TimeParseError_index) return "time.TimeParseError"; if (sidx == _IError_v__gen__c__UnsupportedAssertCtempTransform_index) return "v.gen.c.UnsupportedAssertCtempTransform"; return "unknown IError"; } @@ -12741,12 +13112,12 @@ static int v_typeof_interface_idx_IError(int sidx) { /* IError */ if (sidx == _IError_os__FileNotOpenedError_index) return 65647; if (sidx == _IError_os__SizeOfTypeIs0Error_index) return 65648; if (sidx == _IError_os__ExecutableNotFoundError_index) return 65661; + if (sidx == _IError_flag__UnkownFlagError_index) return 66095; + if (sidx == _IError_flag__ArgsCountError_index) return 66096; + if (sidx == _IError_semver__InvalidComparatorFormatError_index) return 66106; + if (sidx == _IError_semver__EmptyInputError_index) return 66108; + if (sidx == _IError_semver__InvalidVersionFormatError_index) return 66109; if (sidx == _IError_time__TimeParseError_index) return 220; - if (sidx == _IError_flag__UnkownFlagError_index) return 66090; - if (sidx == _IError_flag__ArgsCountError_index) return 66091; - if (sidx == _IError_semver__InvalidComparatorFormatError_index) return 66102; - if (sidx == _IError_semver__EmptyInputError_index) return 66104; - if (sidx == _IError_semver__InvalidVersionFormatError_index) return 66105; if (sidx == _IError_v__gen__c__UnsupportedAssertCtempTransform_index) return 498; return 29; } @@ -13182,9 +13553,9 @@ static char * v_typeof_interface_v__ast__walker__Visitor(int sidx) { /* v.ast.wa } static int v_typeof_interface_idx_v__ast__walker__Visitor(int sidx) { /* v.ast.walker.Visitor */ - if (sidx == _v__ast__walker__Visitor_v__ast__walker__Inspector_index) return 528; + if (sidx == _v__ast__walker__Visitor_v__ast__walker__Inspector_index) return 533; if (sidx == _v__ast__walker__Visitor_v__callgraph__Mapper_index) return 66022; - return 526; + return 531; } // << typeof() support for sum types @@ -20369,6 +20740,17 @@ string char_vstring_literal_with_len(char* cp, int len) { return ((string){.str = ((u8*)(cp)), .len = len, .is_lit = 1}); } +int string_len_utf8(string s) { + int l = 0; + int i = 0; + for (;;) { + if (!(i < s.len)) break; + l++; + i += (((0xe5000000 >> (((s.str[i] >> 3) & 0x1e))) & 3)) + 1; + } + return l; +} + VV_LOCAL_SYMBOL string string_clone_static(string a) { return string_clone(a); } @@ -22787,6 +23169,19 @@ int utf32_decode_to_buffer(u32 code, u8* buf) { return 0; } +// Attr: [deprecated] +// Attr: [deprecated_after] +int utf8_str_len(string s) { + int l = 0; + int i = 0; + for (;;) { + if (!(i < s.len)) break; + l++; + i += (((0xe5000000 >> (((s.str[i] >> 3) & 0x1e))) & 3)) + 1; + } + return l; +} + int string_utf32_code(string _rune) { Option_rune _t2 = Array_u8_utf8_to_utf32(string_bytes(_rune)); if (_t2.state != 0) { /*or block*/ @@ -22845,17 +23240,6 @@ VV_LOCAL_SYMBOL int utf8_len(u8 c) { return b; } -int utf8_str_len(string s) { - int l = 0; - int i = 0; - for (;;) { - if (!(i < s.len)) break; - l++; - i += (((0xe5000000 >> (((s.str[i] >> 3) & 0x1e))) & 3)) + 1; - } - return l; -} - int utf8_str_visible_length(string s) { int l = 0; int ul = 1; @@ -29212,1309 +29596,6 @@ inline int v__mathutil__max_T_int(int a, int b) { return _t1; } -i64 time__portable_timegm(struct tm* t) { - int year = t->tm_year + 1900; - int month = t->tm_mon; - if (month > 11) { - year += month / 12; - month %= 12; - } else if (month < 0) { - int years_diff = (11 - month) / 12; - year -= years_diff; - month += 12 * years_diff; - } - i64 days_since_1970 = ((i64)(time__days_from_civil(year, month + 1, t->tm_mday))); - i64 _t1 = 60 * (60 * (24 * days_since_1970 + t->tm_hour) + t->tm_min) + t->tm_sec; - return _t1; -} - -int time__days_from_civil(int oy, int m, int d) { - int y = (m <= 2 ? (oy - 1) : (oy)); - int era = y / 400; - int yoe = y - era * 400; - int doy = (153 * (m + ((m > 2 ? (-3) : (9)))) + 2) / 5 + d - 1; - int doe = yoe * 365 + yoe / 4 - yoe / 100 + doy; - int _t1 = era * 146097 + doe - 719468; - return _t1; -} - -string time__Time_format(time__Time t) { - string _t1 = time__Time_get_fmt_str(t, time__FormatDelimiter__hyphen, time__FormatTime__hhmm24, time__FormatDate__yyyymmdd); - return _t1; -} - -string time__Time_format_ss(time__Time t) { - string _t1 = time__Time_get_fmt_str(t, time__FormatDelimiter__hyphen, time__FormatTime__hhmmss24, time__FormatDate__yyyymmdd); - return _t1; -} - -string time__Time_format_ss_milli(time__Time t) { - string _t1 = time__Time_get_fmt_str(t, time__FormatDelimiter__hyphen, time__FormatTime__hhmmss24_milli, time__FormatDate__yyyymmdd); - return _t1; -} - -string time__Time_format_ss_micro(time__Time t) { - string _t1 = time__Time_get_fmt_str(t, time__FormatDelimiter__hyphen, time__FormatTime__hhmmss24_micro, time__FormatDate__yyyymmdd); - return _t1; -} - -string time__Time_hhmm(time__Time t) { - string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm24); - return _t1; -} - -string time__Time_hhmmss(time__Time t) { - string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmmss24); - return _t1; -} - -string time__Time_hhmm12(time__Time t) { - string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm12); - return _t1; -} - -string time__Time_ymmdd(time__Time t) { - string _t1 = time__Time_get_fmt_date_str(t, time__FormatDelimiter__hyphen, time__FormatDate__yyyymmdd); - return _t1; -} - -string time__Time_ddmmy(time__Time t) { - string _t1 = time__Time_get_fmt_date_str(t, time__FormatDelimiter__dot, time__FormatDate__ddmmyyyy); - return _t1; -} - -string time__Time_md(time__Time t) { - string _t1 = time__Time_get_fmt_date_str(t, time__FormatDelimiter__space, time__FormatDate__mmmd); - return _t1; -} - -string time__Time_clean(time__Time t) { - time__Time znow = time__now(); - if (t.month == znow.month && t.year == znow.year && t.day == znow.day) { - string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm24); - return _t1; - } - if (t.year == znow.year) { - string _t2 = time__Time_get_fmt_str(t, time__FormatDelimiter__space, time__FormatTime__hhmm24, time__FormatDate__mmmd); - return _t2; - } - string _t3 = time__Time_format(t); - return _t3; -} - -string time__Time_clean12(time__Time t) { - time__Time znow = time__now(); - if (t.month == znow.month && t.year == znow.year && t.day == znow.day) { - string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm12); - return _t1; - } - if (t.year == znow.year) { - string _t2 = time__Time_get_fmt_str(t, time__FormatDelimiter__space, time__FormatTime__hhmm12, time__FormatDate__mmmd); - return _t2; - } - string _t3 = time__Time_format(t); - return _t3; -} - -string time__Time_get_fmt_time_str(time__Time t, time__FormatTime fmt_time) { - if (fmt_time == time__FormatTime__no_time) { - string _t1 = _SLIT(""); - return _t1; - } - string tp = (t.hour > 11 ? (_SLIT("p.m.")) : (_SLIT("a.m."))); - int hour_ = (t.hour > 12 ? (t.hour - 12) : t.hour == 0 ? (12) : (t.hour)); - string _t3 = (string){.str=(byteptr)"", .is_lit=1}; - switch (fmt_time) { - case time__FormatTime__hhmm12: - { - _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe07, {.d_i32 = hour_}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(" "), 0xfe10, {.d_s = tp}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatTime__hhmm24: - { - _t3 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatTime__hhmmss12: - { - _t3 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, 0xfe07, {.d_i32 = hour_}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.second}}, {_SLIT(" "), 0xfe10, {.d_s = tp}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatTime__hhmmss24: - { - _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.second}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatTime__hhmmss24_milli: - { - _t3 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.second}}, {_SLIT("."), 0x8006fe27, {.d_i32 = (t.microsecond / 1000)}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatTime__hhmmss24_micro: - { - _t3 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.second}}, {_SLIT("."), 0x800cfe27, {.d_i32 = t.microsecond}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatTime__no_time: - default: - { - _t3 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown enumeration "), 0xfe10, {.d_s = time__FormatTime_str(fmt_time)}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - } - string _t2 = _t3; - return _t2; -} - -string time__Time_get_fmt_date_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatDate fmt_date) { - if (fmt_date == time__FormatDate__no_date) { - string _t1 = _SLIT(""); - return _t1; - } - string month = time__Time_smonth(&t); - string year = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = (t.year % 100)}}, {_SLIT0, 0, { .d_c = 0 }}})); - string _t2 = (string){.str=(byteptr)"", .is_lit=1}; - switch (fmt_date) { - case time__FormatDate__ddmmyy: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), 0xfe10, {.d_s = year}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__ddmmyyyy: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), 0x8008fe27, {.d_i32 = t.year}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__mmddyy: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), 0xfe10, {.d_s = year}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__mmddyyyy: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), 0x8008fe27, {.d_i32 = t.year}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__mmmd: - { - _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = month}}, {_SLIT("|"), 0xfe07, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__mmmdd: - { - _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__mmmddyy: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), 0xfe10, {.d_s = year}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__mmmddyyyy: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), 0x8008fe27, {.d_i32 = t.year}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__yyyymmdd: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0x8008fe27, {.d_i32 = t.year}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__yymmdd: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = year}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__no_date: - default: - { - _t2 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown enumeration "), 0xfe10, {.d_s = time__FormatDate_str(fmt_date)}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - } - string res = _t2; - string del = ((fmt_dlmtr == (time__FormatDelimiter__dot)) ? (_SLIT(".")) : (fmt_dlmtr == (time__FormatDelimiter__hyphen)) ? (_SLIT("-")) : (fmt_dlmtr == (time__FormatDelimiter__slash)) ? (_SLIT("/")) : (fmt_dlmtr == (time__FormatDelimiter__space)) ? (_SLIT(" ")) : (_SLIT(""))); - res = string_replace(res, _SLIT("|"), del); - string _t3 = res; - return _t3; -} - -string time__Time_get_fmt_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatTime fmt_time, time__FormatDate fmt_date) { - if (fmt_date == time__FormatDate__no_date) { - if (fmt_time == time__FormatTime__no_time) { - string _t1 = _SLIT(""); - return _t1; - } else { - string _t2 = time__Time_get_fmt_time_str(t, fmt_time); - return _t2; - } - } else { - if (fmt_time != time__FormatTime__no_time) { - string dstr = time__Time_get_fmt_date_str(t, fmt_dlmtr, fmt_date); - string tstr = time__Time_get_fmt_time_str(t, fmt_time); - string _t3 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = dstr}}, {_SLIT(" "), 0xfe10, {.d_s = tstr}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t3; - } else { - string _t4 = time__Time_get_fmt_date_str(t, fmt_dlmtr, fmt_date); - return _t4; - } - } - return (string){.str=(byteptr)"", .is_lit=1}; -} - -string time__Time_utc_string(time__Time t) { - string day_str = time__Time_weekday_str(&t); - string month_str = time__Time_smonth(&t); - string utc_string = str_intp(8, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = day_str}}, {_SLIT(", "), 0xfe07, {.d_i32 = t.day}}, {_SLIT(" "), 0xfe10, {.d_s = month_str}}, {_SLIT(" "), 0xfe07, {.d_i32 = t.year}}, {_SLIT(" "), 0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.second}}, {_SLIT(" UTC"), 0, { .d_c = 0 }}})); - string _t1 = utc_string; - return _t1; -} - -// Attr: [inline] -inline bool time__Time__eq(time__Time t1, time__Time t2) { - bool _t1 = t1._v_unix == t2._v_unix && t1.microsecond == t2.microsecond; - return _t1; -} - -// Attr: [inline] -inline bool time__Time__lt(time__Time t1, time__Time t2) { - bool _t1 = t1._v_unix < t2._v_unix || (t1._v_unix == t2._v_unix && t1.microsecond < t2.microsecond); - return _t1; -} - -// Attr: [inline] -inline time__Duration time__Time__minus(time__Time lhs, time__Time rhs) { - i64 lhs_micro = lhs._v_unix * 1000000 + lhs.microsecond; - i64 rhs_micro = rhs._v_unix * 1000000 + rhs.microsecond; - time__Duration _t1 = (lhs_micro - rhs_micro) * _const_time__microsecond; - return _t1; -} - -Option_time__Time time__parse_rfc3339(string s) { - if ((s).len == 0) { - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - string sn = string_replace_each(s, new_array_from_c_array(4, 4, sizeof(string), _MOV((string[4]){_SLIT("t"), _SLIT("T"), _SLIT("z"), _SLIT("Z")}))); - Option_time__Time _t2 = time__parse_iso8601(sn); - if (_t2.state != 0) { /*or block*/ - IError err = _t2.err; - *(time__Time*) _t2.data = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - } - - time__Time t = (*(time__Time*)_t2.data); - if (!time__Time__eq(t, ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}))) { - Option_time__Time _t3; - opt_ok(&(time__Time[]) { t }, (Option*)(&_t3), sizeof(time__Time)); - return _t3; - } - Option_int _t4 = string_index(sn, _SLIT("T")); - if (_t4.state != 0) { /*or block*/ - IError err = _t4.err; - *(int*) _t4.data = -1; - } - - int t_i = (*(int*)_t4.data); - Array_string parts = (t_i != -1 ? (new_array_from_c_array(2, 2, sizeof(string), _MOV((string[2]){string_clone(string_substr(sn, 0, t_i)), string_clone(string_substr(sn, t_i + 1, (sn).len))}))) : (string_split(sn, _SLIT(" ")))); - if (!string_contains_any((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT(" Z")) && string_contains((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT("-"))) { - Option_multi_return_int_int_int _t5 = time__parse_iso8601_date(sn); - if (_t5.state != 0) { /*or block*/ - Option_time__Time _t6; - memcpy(&_t6, &_t5, sizeof(Option)); - return _t6; - } - - multi_return_int_int_int mr_1001 = (*(multi_return_int_int_int*)_t5.data); - int year = mr_1001.arg0; - int month = mr_1001.arg1; - int day = mr_1001.arg2; - t = time__new_time(((time__Time){.year = year,.month = month,.day = day,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,})); - Option_time__Time _t7; - opt_ok(&(time__Time[]) { t }, (Option*)(&_t7), sizeof(time__Time)); - return _t7; - } - if (!string_contains((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT("-")) && string_contains((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT(":"))) { - int hour_ = 0; - int minute_ = 0; - int second_ = 0; - int microsecond_ = 0; - i64 unix_offset = ((i64)(0)); - bool is_local_time = true; - Option_multi_return_int_int_int_int_i64_bool _t8 = time__parse_iso8601_time((*(string*)/*ee elem_sym */array_get(parts, 0))); - if (_t8.state != 0) { /*or block*/ - Option_time__Time _t9; - memcpy(&_t9, &_t8, sizeof(Option)); - return _t9; - } - - multi_return_int_int_int_int_i64_bool mr_1384 = (*(multi_return_int_int_int_int_i64_bool*)_t8.data); - hour_ = mr_1384.arg0; - minute_ = mr_1384.arg1; - second_ = mr_1384.arg2; - microsecond_ = mr_1384.arg3; - unix_offset = mr_1384.arg4; - is_local_time = mr_1384.arg5; - t = time__new_time(((time__Time){.year = 0,.month = 0,.day = 0,.hour = hour_,.minute = minute_,.second = second_,.microsecond = microsecond_,._v_unix = 0,.is_local = 0,})); - if (is_local_time) { - Option_time__Time _t10; - opt_ok(&(time__Time[]) { t }, (Option*)(&_t10), sizeof(time__Time)); - return _t10; - } - i64 unix_time = t._v_unix; - if (unix_offset < 0) { - unix_time -= (-unix_offset); - } else if (unix_offset > 0) { - unix_time += unix_offset; - } - t = time__unix2(((i64)(unix_time)), t.microsecond); - Option_time__Time _t11; - opt_ok(&(time__Time[]) { t }, (Option*)(&_t11), sizeof(time__Time)); - return _t11; - } - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(9), .data={EMPTY_STRUCT_INITIALIZATION} }; -} - -Option_time__Time time__parse(string s) { - if ((s).len == 0) { - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - Option_int _t2 = string_index(s, _SLIT(" ")); - if (_t2.state != 0) { /*or block*/ - IError err = _t2.err; - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(1), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - - int pos = (*(int*)_t2.data); - string symd = string_substr(s, 0, pos); - Array_string ymd = string_split(symd, _SLIT("-")); - if (ymd.len != 3) { - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(2), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - string shms = string_substr(s, pos, (s).len); - Array_string hms = string_split(shms, _SLIT(":")); - string hour_ = string_substr((*(string*)/*ee elem_sym */array_get(hms, 0)), 1, ((*(string*)/*ee elem_sym */array_get(hms, 0))).len); - string minute_ = (*(string*)/*ee elem_sym */array_get(hms, 1)); - string second_ = (*(string*)/*ee elem_sym */array_get(hms, 2)); - int iyear = string_int((*(string*)/*ee elem_sym */array_get(ymd, 0))); - int imonth = string_int((*(string*)/*ee elem_sym */array_get(ymd, 1))); - int iday = string_int((*(string*)/*ee elem_sym */array_get(ymd, 2))); - int ihour = string_int(hour_); - int iminute = string_int(minute_); - int isecond = string_int(second_); - if (iyear > 9999 || iyear < -9999) { - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(3), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (imonth > 12 || imonth < 1) { - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(4), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (iday > 31 || iday < 1) { - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(5), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (ihour > 23 || ihour < 0) { - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(6), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (iminute > 59 || iminute < 0) { - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(7), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (isecond > 59 || isecond < 0) { - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(8), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - time__Time res = time__new_time(((time__Time){ - .year = iyear, - .month = imonth, - .day = iday, - .hour = ihour, - .minute = iminute, - .second = isecond, - .microsecond = 0, - ._v_unix = 0, - .is_local = 0, - })); - Option_time__Time _t11; - opt_ok(&(time__Time[]) { res }, (Option*)(&_t11), sizeof(time__Time)); - return _t11; -} - -Option_time__Time time__parse_iso8601(string s) { - if ((s).len == 0) { - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - Option_int _t2 = string_index(s, _SLIT("T")); - if (_t2.state != 0) { /*or block*/ - IError err = _t2.err; - *(int*) _t2.data = -1; - } - - int t_i = (*(int*)_t2.data); - Array_string parts = (t_i != -1 ? (new_array_from_c_array(2, 2, sizeof(string), _MOV((string[2]){string_clone(string_substr(s, 0, t_i)), string_clone(string_substr(s, t_i + 1, (s).len))}))) : (string_split(s, _SLIT(" ")))); - if (!(parts.len == 1 || parts.len == 2)) { - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(12), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - Option_multi_return_int_int_int _t4 = time__parse_iso8601_date((*(string*)/*ee elem_sym */array_get(parts, 0))); - if (_t4.state != 0) { /*or block*/ - Option_time__Time _t5; - memcpy(&_t5, &_t4, sizeof(Option)); - return _t5; - } - - multi_return_int_int_int mr_3646 = (*(multi_return_int_int_int*)_t4.data); - int year = mr_3646.arg0; - int month = mr_3646.arg1; - int day = mr_3646.arg2; - int hour_ = 0; - int minute_ = 0; - int second_ = 0; - int microsecond_ = 0; - i64 unix_offset = ((i64)(0)); - bool is_local_time = true; - if (parts.len == 2) { - Option_multi_return_int_int_int_int_i64_bool _t6 = time__parse_iso8601_time((*(string*)/*ee elem_sym */array_get(parts, 1))); - if (_t6.state != 0) { /*or block*/ - Option_time__Time _t7; - memcpy(&_t7, &_t6, sizeof(Option)); - return _t7; - } - - multi_return_int_int_int_int_i64_bool mr_3888 = (*(multi_return_int_int_int_int_i64_bool*)_t6.data); - hour_ = mr_3888.arg0; - minute_ = mr_3888.arg1; - second_ = mr_3888.arg2; - microsecond_ = mr_3888.arg3; - unix_offset = mr_3888.arg4; - is_local_time = mr_3888.arg5; - } - time__Time t = time__new_time(((time__Time){ - .year = year, - .month = month, - .day = day, - .hour = hour_, - .minute = minute_, - .second = second_, - .microsecond = microsecond_, - ._v_unix = 0, - .is_local = 0, - })); - if (is_local_time) { - Option_time__Time _t8; - opt_ok(&(time__Time[]) { t }, (Option*)(&_t8), sizeof(time__Time)); - return _t8; - } - i64 unix_time = t._v_unix; - if (unix_offset < 0) { - unix_time -= (-unix_offset); - } else if (unix_offset > 0) { - unix_time += unix_offset; - } - t = time__unix2(((i64)(unix_time)), t.microsecond); - Option_time__Time _t9; - opt_ok(&(time__Time[]) { t }, (Option*)(&_t9), sizeof(time__Time)); - return _t9; -} - -Option_time__Time time__parse_rfc2822(string s) { - if ((s).len == 0) { - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - Array_string fields = string_split(s, _SLIT(" ")); - if (fields.len < 5) { - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(1), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - Option_int _t3 = string_index(_const_time__months_string, (*(string*)/*ee elem_sym */array_get(fields, 2))); - if (_t3.state != 0) { /*or block*/ - IError err = _t3.err; - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(2), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - - int pos = (*(int*)_t3.data); - int mm = pos / 3 + 1; - { // Unsafe block - u8* tmstr = malloc_noscan(s.len * 2); - int count = snprintf(((char*)(tmstr)), (s.len * 2), "%s-%02d-%s %s", (*(string*)/*ee elem_sym */array_get(fields, 3)).str, mm, (*(string*)/*ee elem_sym */array_get(fields, 1)).str, (*(string*)/*ee elem_sym */array_get(fields, 4)).str); - Option_time__Time _t5 = time__parse(tos(tmstr, count)); - return _t5; - } - return (Option_time__Time){0}; -} - -VV_LOCAL_SYMBOL Option_multi_return_int_int_int time__parse_iso8601_date(string s) { - int year = 0; - int month = 0; - int day = 0; - u8 dummy = ((u8)(0)); - int count = sscanf(((char*)(s.str)), "%4d-%2d-%2d%c", &year, &month, &day, &dummy); - if (count != 3) { - return (Option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(10), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (year > 9999) { - return (Option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(13), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (month > 12) { - return (Option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(14), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (day > 31) { - return (Option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(15), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - Option_multi_return_int_int_int _t5; - opt_ok(&(multi_return_int_int_int/*X*/[]) { (multi_return_int_int_int){.arg0=year, .arg1=month, .arg2=day} }, (Option*)(&_t5), sizeof(multi_return_int_int_int)); - return _t5; -} - -VV_LOCAL_SYMBOL Option_multi_return_int_int_int_int_i64_bool time__parse_iso8601_time(string s) { - int hour_ = 0; - int minute_ = 0; - int second_ = 0; - int microsecond_ = 0; - rune plus_min_z = 'a'; - int offset_hour = 0; - int offset_minute = 0; - int count = sscanf(((char*)(s.str)), "%2d:%2d:%2d.%6d%c%2d:%2d", &hour_, &minute_, &second_, µsecond_, ((char*)(&plus_min_z)), &offset_hour, &offset_minute); - if (count < 4) { - count = sscanf(((char*)(s.str)), "%2d:%2d:%2d%c%2d:%2d", &hour_, &minute_, &second_, ((char*)(&plus_min_z)), &offset_hour, &offset_minute); - count++; - } - if (count < 4) { - return (Option_multi_return_int_int_int_int_i64_bool){ .state=2, .err=time__error_invalid_time(10), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - bool is_local_time = plus_min_z == 'a' && count == 4; - bool is_utc = plus_min_z == 'Z' && count == 5; - if (!(count == 7 || is_local_time || is_utc)) { - return (Option_multi_return_int_int_int_int_i64_bool){ .state=2, .err=time__error_invalid_time(11), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (plus_min_z != '+' && plus_min_z != '-' && !is_utc && !is_local_time) { - return (Option_multi_return_int_int_int_int_i64_bool){ .state=2, .err=time__error_invalid_time(12), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - int unix_offset = 0; - if (offset_hour > 0) { - unix_offset += 3600 * offset_hour; - } - if (offset_minute > 0) { - unix_offset += 60 * offset_minute; - } - if (plus_min_z == '+') { - unix_offset *= -1; - } - Option_multi_return_int_int_int_int_i64_bool _t4; - opt_ok(&(multi_return_int_int_int_int_i64_bool/*X*/[]) { (multi_return_int_int_int_int_i64_bool){.arg0=hour_, .arg1=minute_, .arg2=second_, .arg3=microsecond_, .arg4=unix_offset, .arg5=is_local_time} }, (Option*)(&_t4), sizeof(multi_return_int_int_int_int_i64_bool)); - return _t4; -} - -string time__TimeParseError_msg(time__TimeParseError err) { - string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("Invalid time format code: "), 0xfe07, {.d_i32 = err.code}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t1; -} - -VV_LOCAL_SYMBOL IError time__error_invalid_time(int code) { - IError _t1 = I_time__TimeParseError_to_Interface_IError(((time__TimeParseError*)memdup(&(time__TimeParseError){.Error = ((Error){EMPTY_STRUCT_INITIALIZATION}),.code = code,}, sizeof(time__TimeParseError)))); - return _t1; -} - -time__StopWatch time__new_stopwatch(time__StopWatchOptions opts) { - u64 initial = ((u64)(0U)); - if (opts.auto_start) { - initial = time__sys_mono_now(); - } - time__StopWatch _t1 = ((time__StopWatch){.elapsed = 0U,.start = initial,.end = 0U,}); - return _t1; -} - -void time__StopWatch_start(time__StopWatch* t) { - t->start = time__sys_mono_now(); - t->end = 0U; -} - -void time__StopWatch_restart(time__StopWatch* t) { - t->start = time__sys_mono_now(); - t->end = 0U; - t->elapsed = 0U; -} - -void time__StopWatch_stop(time__StopWatch* t) { - t->end = time__sys_mono_now(); -} - -void time__StopWatch_pause(time__StopWatch* t) { - if (t->start > 0U) { - if (t->end == 0U) { - t->elapsed += time__sys_mono_now() - t->start; - } else { - t->elapsed += t->end - t->start; - } - } - t->start = 0U; -} - -time__Duration time__StopWatch_elapsed(time__StopWatch t) { - if (t.start > 0U) { - if (t.end == 0U) { - time__Duration _t1 = ((((i64)(time__sys_mono_now() - t.start + t.elapsed)))); - return _t1; - } else { - time__Duration _t2 = ((((i64)(t.end - t.start + t.elapsed)))); - return _t2; - } - } - time__Duration _t3 = ((((i64)(t.elapsed)))); - return _t3; -} - -time__Time time__now(void) { - #if defined(__APPLE__) - { - time__Time _t1 = time__darwin_now(); - return _t1; - } - #endif - #if defined(_WIN32) - { - time__Time _t2 = time__win_now(); - return _t2; - } - #endif - #if defined(__sun) - { - time__Time _t3 = time__solaris_now(); - return _t3; - } - #endif - #if defined(__linux__) || defined(__ANDROID__) - { - time__Time _t4 = time__linux_now(); - return _t4; - } - #endif - time_t t = time(0); - struct tm* now = localtime(&t); - time__Time _t5 = time__convert_ctime(*now, 0); - return _t5; -} - -time__Time time__utc(void) { - #if defined(__APPLE__) - { - time__Time _t1 = time__darwin_utc(); - return _t1; - } - #endif - #if defined(_WIN32) - { - time__Time _t2 = time__win_utc(); - return _t2; - } - #endif - #if defined(__sun) - { - time__Time _t3 = time__solaris_utc(); - return _t3; - } - #endif - #if defined(__linux__) || defined(__ANDROID__) - { - time__Time _t4 = time__linux_utc(); - return _t4; - } - #endif - time_t t = time(0); - time(&t); - time__Time _t5 = time__unix2(((i64)(t)), 0); - return _t5; -} - -time__Time time__new_time(time__Time t) { - if (t._v_unix != 0) { - time__Time _t1 = t; - return _t1; - } - struct tm tt = ((struct tm){ - .tm_sec = t.second, - .tm_min = t.minute, - .tm_hour = t.hour, - .tm_mday = t.day, - .tm_mon = t.month - 1, - .tm_year = t.year - 1900, - .tm_wday = 0, - .tm_yday = 0, - .tm_isdst = 0, - }); - i64 utime = time__make_unix_time(tt); - time__Time _t2 = ((time__Time){t.year,t.month,t.day,t.hour,t.minute,t.second,t.microsecond,._v_unix = utime,t.is_local,}); - return _t2; -} - -i64 time__ticks(void) { - #if defined(_WIN32) - { - i64 _t1 = GetTickCount(); - return _t1; - } - #else - { - struct timeval ts = ((struct timeval){.tv_sec = 0,.tv_usec = 0,}); - gettimeofday(&ts, 0); - i64 _t2 = ((i64)(ts.tv_sec * ((u64)(1000U)) + (ts.tv_usec / ((u64)(1000U))))); - return _t2; - } - #endif - return 0; -} - -string time__Time_str(time__Time t) { - string _t1 = time__Time_format_ss(t); - return _t1; -} - -VV_LOCAL_SYMBOL time__Time time__convert_ctime(struct tm t, int microsecond) { - time__Time _t1 = ((time__Time){ - .year = t.tm_year + 1900, - .month = t.tm_mon + 1, - .day = t.tm_mday, - .hour = t.tm_hour, - .minute = t.tm_min, - .second = t.tm_sec, - .microsecond = microsecond, - ._v_unix = time__make_unix_time(t), - .is_local = true, - }); - return _t1; -} - -string time__Time_strftime(time__Time t, string fmt) { - struct tm* tm = ((struct tm*)memdup(&(struct tm){.tm_sec = 0,.tm_min = 0,.tm_hour = 0,.tm_mday = 0,.tm_mon = 0,.tm_year = 0,.tm_wday = 0,.tm_yday = 0,.tm_isdst = 0,}, sizeof(struct tm))); - #if defined(_WIN32) - { - tm = gmtime(((voidptr)(&t._v_unix))); - } - #else - { - gmtime_r(((voidptr)(&t._v_unix)), tm); - } - #endif - Array_fixed_C__char_1024 buf = {0}; - char* fmt_c = ((char*)(fmt.str)); - strftime(&buf[0], ((size_t)(sizeof(Array_fixed_C__char_1024))), fmt_c, tm); - string _t1 = cstring_to_vstring(((char*)(&buf[0]))); - return _t1; -} - -string time__Time_smonth(time__Time* t) { - if (t->month <= 0 || t->month > 12) { - string _t1 = _SLIT("---"); - return _t1; - } - int i = t->month - 1; - string _t2 = string_substr(_const_time__months_string, i * 3, (i + 1) * 3); - return _t2; -} - -// Attr: [inline] -inline i64 time__Time_unix_time(time__Time* t) { - i64 _t1 = t->_v_unix; - return _t1; -} - -// Attr: [inline] -inline i64 time__Time_unix_time_milli(time__Time* t) { - i64 _t1 = t->_v_unix * 1000 + (t->microsecond / 1000); - return _t1; -} - -time__Time time__Time_add(time__Time* t, time__Duration d) { - i64 microseconds = ((i64)(t->_v_unix)) * 1000000 + t->microsecond + time__Duration_microseconds(d); - i64 _v_unix = microseconds / 1000000; - i64 micro = microseconds % 1000000; - time__Time _t1 = time__unix2(_v_unix, ((int)(micro))); - return _t1; -} - -time__Time time__Time_add_seconds(time__Time* t, int seconds) { - time__Time _t1 = time__Time_add(t, seconds * _const_time__second); - return _t1; -} - -time__Time time__Time_add_days(time__Time* t, int days) { - time__Time _t1 = time__Time_add(t, days * 24 * _const_time__hour); - return _t1; -} - -time__Duration time__since(time__Time t) { - time__Duration _t1 = time__Time__minus(time__now(), t); - return _t1; -} - -string time__Time_relative(time__Time* t) { - time__Time znow = time__now(); - i64 secs = znow._v_unix - t->_v_unix; - if (secs <= 30) { - string _t1 = _SLIT("now"); - return _t1; - } - if (secs < 60) { - string _t2 = _SLIT("1m"); - return _t2; - } - if (secs < 3600) { - i64 m = secs / 60; - if (m == 1) { - string _t3 = _SLIT("1 minute ago"); - return _t3; - } - string _t4 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = m}}, {_SLIT(" minutes ago"), 0, { .d_c = 0 }}})); - return _t4; - } - if (secs < 86400) { - i64 h = secs / 3600; - if (h == 1) { - string _t5 = _SLIT("1 hour ago"); - return _t5; - } - string _t6 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = h}}, {_SLIT(" hours ago"), 0, { .d_c = 0 }}})); - return _t6; - } - if (secs < 432000) { - i64 d = secs / 3600 / 24; - if (d == 1) { - string _t7 = _SLIT("1 day ago"); - return _t7; - } - string _t8 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = d}}, {_SLIT(" days ago"), 0, { .d_c = 0 }}})); - return _t8; - } - if (secs > 864000000) { - string _t9 = _SLIT(""); - return _t9; - } - string _t10 = time__Time_md(/*rec*/*t); - return _t10; -} - -string time__Time_relative_short(time__Time* t) { - time__Time znow = time__now(); - i64 secs = znow._v_unix - t->_v_unix; - if (secs <= 30) { - string _t1 = _SLIT("now"); - return _t1; - } - if (secs < 60) { - string _t2 = _SLIT("1m"); - return _t2; - } - if (secs < 3600) { - string _t3 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = secs / 60}}, {_SLIT("m"), 0, { .d_c = 0 }}})); - return _t3; - } - if (secs < 86400) { - string _t4 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = secs / 3600}}, {_SLIT("h"), 0, { .d_c = 0 }}})); - return _t4; - } - if (secs < 432000) { - string _t5 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = secs / 3600 / 24}}, {_SLIT("d"), 0, { .d_c = 0 }}})); - return _t5; - } - if (secs > 864000000) { - string _t6 = _SLIT(""); - return _t6; - } - string _t7 = time__Time_md(/*rec*/*t); - return _t7; -} - -int time__day_of_week(int y, int m, int d) { - Array_int t = new_array_from_c_array(12, 12, sizeof(int), _MOV((int[12]){ - 0, 3, 2, 5, 0, 3, 5, 1, 4, - 6, 2, 4})); - int sy = y; - if (m < 3) { - sy = sy - 1; - } - int _t1 = (sy + sy / 4 - sy / 100 + sy / 400 + (*(int*)/*ee elem_sym */array_get(t, m - 1)) + d - 1) % 7 + 1; - return _t1; -} - -int time__Time_day_of_week(time__Time* t) { - int _t1 = time__day_of_week(t->year, t->month, t->day); - return _t1; -} - -string time__Time_weekday_str(time__Time* t) { - int i = time__Time_day_of_week(t) - 1; - string _t1 = string_substr(_const_time__days_string, i * 3, (i + 1) * 3); - return _t1; -} - -string time__Time_long_weekday_str(time__Time* t) { - int i = time__Time_day_of_week(t) - 1; - string _t1 = (*(string*)/*ee elem_sym */array_get(_const_time__long_days, i)); - return _t1; -} - -bool time__is_leap_year(int year) { - bool _t1 = (year % 4 == 0) && (year % 100 != 0 || year % 400 == 0); - return _t1; -} - -Option_int time__days_in_month(int month, int year) { - if (month > 12 || month < 1) { - return (Option_int){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("Invalid month: "), 0xfe07, {.d_i32 = month}}, {_SLIT0, 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - int extra = (month == 2 && time__is_leap_year(year) ? (1) : (0)); - int res = (*(int*)/*ee elem_sym */array_get(_const_time__month_days, month - 1)) + extra; - Option_int _t2; - opt_ok(&(int[]) { res }, (Option*)(&_t2), sizeof(int)); - return _t2; -} - -string time__Time_debug(time__Time* t) { - string _t1 = str_intp(9, _MOV((StrIntpData[]){{_SLIT("Time{ year: "), 0x8008fe27, {.d_i32 = t->year}}, {_SLIT(" month: "), 0x8004fe27, {.d_i32 = t->month}}, {_SLIT(" day: "), 0x8004fe27, {.d_i32 = t->day}}, {_SLIT(" hour: "), 0x8004fe27, {.d_i32 = t->hour}}, {_SLIT(" minute: "), 0x8004fe27, {.d_i32 = t->minute}}, {_SLIT(" second: "), 0x8004fe27, {.d_i32 = t->second}}, {_SLIT(" microsecond: "), 0x800cfe27, {.d_i32 = t->microsecond}}, {_SLIT(" unix: "), 0x800efe29, {.d_i64 = t->_v_unix}}, {_SLIT(" }"), 0, { .d_c = 0 }}})); - return _t1; -} - -// TypeDecl -i64 time__Duration_nanoseconds(time__Duration d) { - i64 _t1 = ((i64)(d)); - return _t1; -} - -i64 time__Duration_microseconds(time__Duration d) { - i64 _t1 = ((i64)(d)) / 1000; - return _t1; -} - -i64 time__Duration_milliseconds(time__Duration d) { - i64 _t1 = ((i64)(d)) / 1000000; - return _t1; -} - -f64 time__Duration_seconds(time__Duration d) { - i64 sec = d / _const_time__second; - i64 nsec = d % _const_time__second; - f64 _t1 = ((f64)(sec)) + ((f64)(nsec)) / 1e9; - return _t1; -} - -f64 time__Duration_minutes(time__Duration d) { - i64 min = d / _const_time__minute; - i64 nsec = d % _const_time__minute; - f64 _t1 = ((f64)(min)) + ((f64)(nsec)) / (60 * 1e9); - return _t1; -} - -f64 time__Duration_hours(time__Duration d) { - i64 hr = d / _const_time__hour; - i64 nsec = d % _const_time__hour; - f64 _t1 = ((f64)(hr)) + ((f64)(nsec)) / (3600 * 1e9); - return _t1; -} - -string time__Duration_str(time__Duration d) { - if (time__Duration_alias_eq(d, _const_time__infinite)) { - string _t1 = _SLIT("inf"); - return _t1; - } - i64 t = ((i64)(d)); - i64 hr = t / _const_time__hour; - t -= hr * _const_time__hour; - i64 min = t / _const_time__minute; - t -= min * _const_time__minute; - i64 sec = t / _const_time__second; - t -= sec * _const_time__second; - i64 ms = t / _const_time__millisecond; - t -= ms * _const_time__millisecond; - i64 us = t / _const_time__microsecond; - t -= us * _const_time__microsecond; - i64 ns = t; - if (hr > 0) { - string _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = hr}}, {_SLIT(":"), 0x8004fe29, {.d_i64 = min}}, {_SLIT(":"), 0x8004fe29, {.d_i64 = sec}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t2; - } - if (min > 0) { - string _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = min}}, {_SLIT(":"), 0x8004fe29, {.d_i64 = sec}}, {_SLIT("."), 0x8006fe29, {.d_i64 = ms}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t3; - } - if (sec > 0) { - string _t4 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = sec}}, {_SLIT("."), 0x8006fe29, {.d_i64 = ms}}, {_SLIT("s"), 0, { .d_c = 0 }}})); - return _t4; - } - if (ms > 0) { - string _t5 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = ms}}, {_SLIT("."), 0x8006fe29, {.d_i64 = us}}, {_SLIT("ms"), 0, { .d_c = 0 }}})); - return _t5; - } - if (us > 0) { - string _t6 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = us}}, {_SLIT("."), 0x8006fe29, {.d_i64 = ns}}, {_SLIT("us"), 0, { .d_c = 0 }}})); - return _t6; - } - string _t7 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = ns}}, {_SLIT("ns"), 0, { .d_c = 0 }}})); - return _t7; -} - -int time__offset(void) { - time__Time t = time__utc(); - time__Time local = time__Time_local(&t); - int _t1 = ((int)(local._v_unix - t._v_unix)); - return _t1; -} - -VV_LOCAL_SYMBOL u64 time__sys_mono_now_darwin(void) { - u64 _t1 = 0U; - return _t1; -} - -time__Time time__darwin_now(void) { - time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - return _t1; -} - -time__Time time__solaris_now(void) { - time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - return _t1; -} - -time__Time time__darwin_utc(void) { - time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - return _t1; -} - -time__Time time__solaris_utc(void) { - time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - return _t1; -} - -VV_LOCAL_SYMBOL i64 time__make_unix_time(struct tm t) { - i64 _t1 = ((i64)(timegm(&t))); - return _t1; -} - -time__Time time__Time_local(time__Time* t) { - if (t->is_local) { - time__Time _t1 = *t; - return _t1; - } - struct tm loc_tm = ((struct tm){.tm_sec = 0,.tm_min = 0,.tm_hour = 0,.tm_mday = 0,.tm_mon = 0,.tm_year = 0,.tm_wday = 0,.tm_yday = 0,.tm_isdst = 0,}); - localtime_r(((voidptr)(&t->_v_unix)), &loc_tm); - time__Time _t2 = time__convert_ctime(loc_tm, t->microsecond); - return _t2; -} - -u64 time__sys_mono_now(void) { - #if defined(__APPLE__) - { - u64 _t1 = time__sys_mono_now_darwin(); - return _t1; - } - #else - { - struct timespec ts = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); - clock_gettime(CLOCK_MONOTONIC, &ts); - u64 _t2 = ((u64)(ts.tv_sec)) * 1000000000U + ((u64)(ts.tv_nsec)); - return _t2; - } - #endif - return 0; -} - -// Attr: [inline] -inline VV_LOCAL_SYMBOL u64 time__vpc_now(void) { - struct timespec ts = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); - clock_gettime(CLOCK_MONOTONIC, &ts); - u64 _t1 = ((u64)(ts.tv_sec)) * 1000000000U + ((u64)(ts.tv_nsec)); - return _t1; -} - -VV_LOCAL_SYMBOL time__Time time__linux_now(void) { - struct timespec ts = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); - clock_gettime(CLOCK_REALTIME, &ts); - struct tm loc_tm = ((struct tm){.tm_sec = 0,.tm_min = 0,.tm_hour = 0,.tm_mday = 0,.tm_mon = 0,.tm_year = 0,.tm_wday = 0,.tm_yday = 0,.tm_isdst = 0,}); - localtime_r(((voidptr)(&ts.tv_sec)), &loc_tm); - time__Time _t1 = time__convert_ctime(loc_tm, ((int)(ts.tv_nsec / 1000))); - return _t1; -} - -VV_LOCAL_SYMBOL time__Time time__linux_utc(void) { - struct timespec ts = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); - clock_gettime(CLOCK_REALTIME, &ts); - time__Time _t1 = time__unix2(((i64)(ts.tv_sec)), ((int)(ts.tv_nsec / 1000))); - return _t1; -} - -time__Time time__win_now(void) { - time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - return _t1; -} - -time__Time time__win_utc(void) { - time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - return _t1; -} - -struct timespec time__Duration_timespec(time__Duration d) { - struct timespec ts = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); - clock_gettime(CLOCK_REALTIME, &ts); - i64 d_sec = d / _const_time__second; - i64 d_nsec = d % _const_time__second; - ts.tv_sec += d_sec; - ts.tv_nsec += d_nsec; - if (ts.tv_nsec > ((i64)(_const_time__second))) { - ts.tv_nsec -= ((i64)(_const_time__second)); - ts.tv_sec++; - } - struct timespec _t1 = ts; - return _t1; -} - -struct timespec time__zero_timespec(void) { - struct timespec ts = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); - struct timespec _t1 = ts; - return _t1; -} - -void time__sleep(time__Duration duration) { - struct timespec req = ((struct timespec){.tv_sec = duration / _const_time__second,.tv_nsec = duration % _const_time__second,}); - struct timespec rem = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); - for (;;) { - if (!(nanosleep(&req, &rem) < 0)) break; - if (errno == EINTR) { - req = rem; - } else { - break; - } - } -} - -int time__Duration_sys_milliseconds(time__Duration d) { - if (d > INT32_MAX * _const_time__millisecond) { - int _t1 = -1; - return _t1; - } else if (d <= 0) { - int _t2 = 0; - return _t2; - } else { - int _t3 = ((int)(d / _const_time__millisecond)); - return _t3; - } - return 0; -} - -time__Time time__unix(i64 abs) { - i64 day_offset = abs / _const_time__seconds_per_day; - if (abs % _const_time__seconds_per_day < 0) { - day_offset--; - } - multi_return_int_int_int mr_472 = time__calculate_date_from_offset(day_offset); - int year = mr_472.arg0; - int month = mr_472.arg1; - int day = mr_472.arg2; - multi_return_int_int_int mr_528 = time__calculate_time_from_offset(abs % _const_time__seconds_per_day); - int hr = mr_528.arg0; - int min = mr_528.arg1; - int sec = mr_528.arg2; - time__Time _t1 = ((time__Time){ - .year = year, - .month = month, - .day = day, - .hour = hr, - .minute = min, - .second = sec, - .microsecond = 0, - ._v_unix = abs, - .is_local = 0, - }); - return _t1; -} - -time__Time time__unix2(i64 abs, int microsecond) { - i64 day_offset = abs / _const_time__seconds_per_day; - if (abs % _const_time__seconds_per_day < 0) { - day_offset--; - } - multi_return_int_int_int mr_1020 = time__calculate_date_from_offset(day_offset); - int year = mr_1020.arg0; - int month = mr_1020.arg1; - int day = mr_1020.arg2; - multi_return_int_int_int mr_1076 = time__calculate_time_from_offset(abs % _const_time__seconds_per_day); - int hr = mr_1076.arg0; - int min = mr_1076.arg1; - int sec = mr_1076.arg2; - time__Time _t1 = ((time__Time){ - .year = year, - .month = month, - .day = day, - .hour = hr, - .minute = min, - .second = sec, - .microsecond = microsecond, - ._v_unix = abs, - .is_local = 0, - }); - return _t1; -} - -VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_date_from_offset(i64 day_offset_) { - i64 day_offset = day_offset_; - int year = 2001; - day_offset -= 11323; - year += ((int)(day_offset / _const_time__days_per_400_years)) * 400; - day_offset %= _const_time__days_per_400_years; - if (day_offset == _const_time__days_per_100_years * 4) { - year += 300; - day_offset -= _const_time__days_per_100_years * 3; - } else { - year += ((int)(day_offset / _const_time__days_per_100_years)) * 100; - day_offset %= _const_time__days_per_100_years; - } - if (day_offset == _const_time__days_per_4_years * 25) { - year += 96; - day_offset -= _const_time__days_per_4_years * 24; - } else { - year += ((int)(day_offset / _const_time__days_per_4_years)) * 4; - day_offset %= _const_time__days_per_4_years; - } - if (day_offset == 1460) { - year += 3; - day_offset -= 1095; - } else { - year += ((int)(day_offset / 365)); - day_offset %= 365; - } - if (day_offset < 0) { - year--; - if (time__is_leap_year(year)) { - day_offset += 366; - } else { - day_offset += 365; - } - } - if (time__is_leap_year(year)) { - if (day_offset > 59) { - day_offset--; - } else if (day_offset == 59) { - return (multi_return_int_int_int){.arg0=year, .arg1=2, .arg2=29}; - } - } - i64 estimated_month = day_offset / 31; - for (;;) { - if (!(day_offset >= (*(int*)/*ee elem_sym */array_get(_const_time__days_before, estimated_month + 1)))) break; - estimated_month++; - } - for (;;) { - if (!(day_offset < (*(int*)/*ee elem_sym */array_get(_const_time__days_before, estimated_month)))) break; - if (estimated_month == 0) { - break; - } - estimated_month--; - } - day_offset -= (*(int*)/*ee elem_sym */array_get(_const_time__days_before, estimated_month)); - return (multi_return_int_int_int){.arg0=year, .arg1=((int)(estimated_month + 1)), .arg2=((int)(day_offset + 1))}; -} - -VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_time_from_offset(i64 second_offset_) { - i64 second_offset = second_offset_; - if (second_offset < 0) { - second_offset += _const_time__seconds_per_day; - } - i64 hour_ = second_offset / _const_time__seconds_per_hour; - second_offset %= _const_time__seconds_per_hour; - i64 min = second_offset / _const_time__seconds_per_minute; - second_offset %= _const_time__seconds_per_minute; - return (multi_return_int_int_int){.arg0=((int)(hour_)), .arg1=((int)(min)), .arg2=((int)(second_offset))}; -} - void v__dotgraph__start_digraph(void) { println(_SLIT("digraph G {")); atexit((voidptr) anon_fn_eb34f0b759dade77__82); @@ -32894,121 +31975,6 @@ VV_LOCAL_SYMBOL int v__vcache__mypid(void) { return _t1; } -Option_string v__util__diff__find_working_diff_command(void) { - string env_difftool = os__getenv(_SLIT("VDIFF_TOOL")); - string env_diffopts = os__getenv(_SLIT("VDIFF_OPTIONS")); - if ((env_difftool).len != 0) { - Option_string _t1; - opt_ok(&(string[]) { str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = env_difftool}}, {_SLIT(" "), 0xfe10, {.d_s = env_diffopts}}, {_SLIT0, 0, { .d_c = 0 }}})) }, (Option*)(&_t1), sizeof(string)); - return _t1; - } - Array_string known_diff_tools = __new_array_with_default(0, 0, sizeof(string), 0); - if (env_difftool.len > 0) { - array_push((array*)&known_diff_tools, _MOV((string[]){ string_clone(env_difftool) })); - } - _PUSH_MANY(&known_diff_tools, (new_array_from_c_array(8, 8, sizeof(string), _MOV((string[8]){_SLIT("colordiff"), _SLIT("gdiff"), _SLIT("diff"), _SLIT("colordiff.exe"), _SLIT("diff.exe"), _SLIT("opendiff"), _SLIT("code"), _SLIT("code.cmd")}))), _t3, Array_string); - for (int _t4 = 0; _t4 < known_diff_tools.len; ++_t4) { - string diffcmd = ((string*)known_diff_tools.data)[_t4]; - if (string__eq(diffcmd, _SLIT("opendiff"))) { - if (v__util__diff__opendiff_exists()) { - Option_string _t5; - opt_ok(&(string[]) { diffcmd }, (Option*)(&_t5), sizeof(string)); - return _t5; - } - continue; - } - os__Result p = os__execute( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = diffcmd}}, {_SLIT(" --version"), 0, { .d_c = 0 }}}))); - if (p.exit_code < 0) { - continue; - } - if (p.exit_code == 127 && string__eq(diffcmd, env_difftool)) { - return (Option_string){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("could not find specified VDIFF_TOOL "), 0xfe10, {.d_s = diffcmd}}, {_SLIT0, 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (p.exit_code == 0) { - if (string__eq(diffcmd, _SLIT("code")) || string__eq(diffcmd, _SLIT("code.cmd"))) { - Option_string _t7; - opt_ok(&(string[]) { str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = diffcmd}}, {_SLIT(" "), 0xfe10, {.d_s = env_diffopts}}, {_SLIT(" -d"), 0, { .d_c = 0 }}})) }, (Option*)(&_t7), sizeof(string)); - return _t7; - } - Option_string _t8; - opt_ok(&(string[]) { str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = diffcmd}}, {_SLIT(" "), 0xfe10, {.d_s = env_diffopts}}, {_SLIT0, 0, { .d_c = 0 }}})) }, (Option*)(&_t8), sizeof(string)); - return _t8; - } - } - return (Option_string){ .state=2, .err=_v_error(_SLIT("No working \"diff\" command found")), .data={EMPTY_STRUCT_INITIALIZATION} }; -} - -VV_LOCAL_SYMBOL bool v__util__diff__opendiff_exists(void) { - os__Result o = os__execute(_SLIT("opendiff")); - if (o.exit_code < 0) { - bool _t1 = false; - return _t1; - } - if (o.exit_code == 1) { - if (string_contains(o.output, _SLIT("too few arguments"))) { - bool _t2 = true; - return _t2; - } - } - bool _t3 = false; - return _t3; -} - -string v__util__diff__color_compare_files(string diff_cmd, string file1, string file2) { - if ((diff_cmd).len != 0) { - string full_cmd = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = diff_cmd}}, {_SLIT(" --minimal --text --unified=2 --show-function-line=\"fn \" "), 0xfe10, {.d_s = os__quoted_path(file1)}}, {_SLIT(" "), 0xfe10, {.d_s = os__quoted_path(file2)}}, {_SLIT(" "), 0, { .d_c = 0 }}})); - os__Result x = os__execute(full_cmd); - if (x.exit_code < 0) { - string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("comparison command: `"), 0xfe10, {.d_s = full_cmd}}, {_SLIT("` not found"), 0, { .d_c = 0 }}})); - return _t1; - } - string _t2 = string_trim_right(x.output, _SLIT("\r\n")); - return _t2; - } - string _t3 = _SLIT(""); - return _t3; -} - -string v__util__diff__color_compare_strings(string diff_cmd, string unique_prefix, string expected, string found) { - string cdir = os__join_path_single(os__cache_dir(), unique_prefix); - Option_bool _t1 = os__mkdir(cdir); - if (_t1.state != 0) { /*or block*/ - IError err = _t1.err; - } - - (*(bool*)_t1.data); - u64 ctime = time__sys_mono_now(); - string e_file = os__join_path_single(cdir, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe08, {.d_u64 = ctime}}, {_SLIT(".expected.txt"), 0, { .d_c = 0 }}}))); - string f_file = os__join_path_single(cdir, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe08, {.d_u64 = ctime}}, {_SLIT(".found.txt"), 0, { .d_c = 0 }}}))); - Option_void _t2 = os__write_file(e_file, expected); - if (_t2.state != 0 && _t2.err._typ != _IError_None___index) { - IError err = _t2.err; - _v_panic(IError_str(err)); - VUNREACHABLE(); - ; - } - - ; - Option_void _t3 = os__write_file(f_file, found); - if (_t3.state != 0 && _t3.err._typ != _IError_None___index) { - IError err = _t3.err; - _v_panic(IError_str(err)); - VUNREACHABLE(); - ; - } - - ; - string res = v__util__diff__color_compare_files(diff_cmd, e_file, f_file); - Option_void _t4 = os__rmdir_all(cdir); - if (_t4.state != 0 && _t4.err._typ != _IError_None___index) { - IError err = _t4.err; - } - - ; - string _t5 = res; - return _t5; -} - Option_v__vmod__Manifest v__vmod__from_file(string vmod_path) { if (!os__exists(vmod_path)) { return (Option_v__vmod__Manifest){ .state=2, .err=_v_error(_SLIT("v.mod: v.mod file not found.")), .data={EMPTY_STRUCT_INITIALIZATION} }; @@ -33820,6 +32786,2023 @@ multi_return_Array_string_Array_string_Array_string Array_v__cflag__CFlag_define return (multi_return_Array_string_Array_string_Array_string){.arg0=defines, .arg1=others, .arg2=libs}; } +// Attr: [deprecated] +f64 math__fabs(f64 x) { + if (x > 0.0) { + return x; + } + return -x; +} + +f64 math__inf(int sign) { + u64 v = (sign >= 0 ? (_const_math__uvinf) : (_const_math__uvneginf)); + return math__f64_from_bits(v); +} + +f64 math__nan(void) { + return math__f64_from_bits(_const_math__uvnan); +} + +bool math__is_nan(f64 f) { + return f != f; +} + +bool math__is_inf(f64 f, int sign) { + return (sign >= 0 && f > _const_math__max_f64) || (sign <= 0 && f < -_const_math__max_f64); +} + +bool math__is_finite(f64 f) { + return !math__is_nan(f) && !math__is_inf(f, 0); +} + +multi_return_f64_int math__normalize(f64 x) { + f64 smallest_normal = 2.2250738585072014e-308; + if (math__abs_T_f64(x) < smallest_normal) { + return (multi_return_f64_int){.arg0=x * _const_math__normalize_smallest_mask, .arg1=-52}; + } + return (multi_return_f64_int){.arg0=x, .arg1=0}; +} + +f64 math__cbrt(f64 a) { + f64 x = a; + int b1 = 715094163; + int b2 = 696219795; + f64 c = 5.42857142857142815906e-01; + f64 d = -7.05306122448979611050e-01; + f64 e_ = 1.41428571428571436819e+00; + f64 f = 1.60714285714285720630e+00; + f64 g = 3.57142857142857150787e-01; + f64 smallest_normal = 2.22507385850720138309e-308; + if (x == 0.0 || math__is_nan(x) || math__is_inf(x, 0)) { + return x; + } + bool sign = false; + if (x < 0) { + x = -x; + sign = true; + } + f64 t = math__f64_from_bits(math__f64_bits(x) / ((u64)(3 + (((u64)(b1)) << 32U)))); + if (x < smallest_normal) { + t = ((f64)(((u64)(1U)) << 54U)); + t *= x; + t = math__f64_from_bits(math__f64_bits(t) / ((u64)(3 + (((u64)(b2)) << 32U)))); + } + f64 r = t * t / x; + f64 s = c + r * t; + t *= g + f / (s + e_ + d / s); + t = math__f64_from_bits((math__f64_bits(t) & (((u64)(0xffffffffcU)) << 28U)) + (((u64)(1U)) << 30U)); + s = t * t; + r = x / s; + f64 w = t + t; + r = (r - t) / (w + r); + t = t + t * r; + if (sign) { + t = -t; + } + return t; +} + +f64 math__mod(f64 x, f64 y) { + return math__fmod(x, y); +} + +f64 math__fmod(f64 x, f64 y) { + if (y == 0 || math__is_inf(x, 0) || math__is_nan(x) || math__is_nan(y)) { + return math__nan(); + } + f64 abs_y = math__abs_T_f64(y); + multi_return_f64_int mr_594 = math__frexp(abs_y); + f64 abs_y_fr = mr_594.arg0; + int abs_y_exp = mr_594.arg1; + f64 r = x; + if (x < 0) { + r = -x; + } + for (;;) { + if (!(r >= abs_y)) break; + multi_return_f64_int mr_680 = math__frexp(r); + f64 rfr = mr_680.arg0; + int rexp = mr_680.arg1; + if (rfr < abs_y_fr) { + rexp = rexp - 1; + } + r = r - math__ldexp(abs_y, rexp - abs_y_exp); + } + if (x < 0) { + r = -r; + } + return r; +} + +i64 math__gcd(i64 a_, i64 b_) { + i64 a = a_; + i64 b = b_; + if (a < 0) { + a = -a; + } + if (b < 0) { + b = -b; + } + for (;;) { + if (!(b != 0)) break; + a %= b; + if (a == 0) { + return b; + } + b %= a; + } + return a; +} + +multi_return_i64_i64_i64 math__egcd(i64 a, i64 b) { + i64 old_r = a; + i64 r = b; + i64 old_s = ((i64)(1)); + i64 s = ((i64)(0)); + i64 old_t = ((i64)(0)); + i64 t = ((i64)(1)); + for (;;) { + if (!(r != 0)) break; + i64 quot = old_r / r; + i64 _var_1339 = old_r; + i64 _var_1346 = r; + old_r = _var_1346; + r = _var_1339%_var_1346; + i64 _var_1365 = old_s; + i64 _var_1372 = s; + old_s = _var_1372; + s = _var_1365-quot*_var_1372; + i64 _var_1398 = old_t; + i64 _var_1405 = t; + old_t = _var_1405; + t = _var_1398-quot*_var_1405; + } + return (multi_return_i64_i64_i64){.arg0=(old_r < 0 ? (-old_r) : (old_r)), .arg1=old_s, .arg2=old_t}; +} + +i64 math__lcm(i64 a, i64 b) { + if (a == 0) { + return a; + } + i64 res = a * (b / math__gcd(b, a)); + if (res < 0) { + return -res; + } + return res; +} + +f64 math__erf(f64 a) { + f64 x = a; + f64 very_tiny = 2.848094538889218e-306; + f64 small_ = 1.0 / ((f64)(((u64)(1U)) << 28U)); + if (math__is_nan(x)) { + return math__nan(); + } + if (math__is_inf(x, 1)) { + return 1.0; + } + if (math__is_inf(x, -1)) { + return ((f64)(-1)); + } + bool sign = false; + if (x < 0) { + x = -x; + sign = true; + } + if (x < 0.84375) { + f64 temp = 0.0; + if (x < small_) { + if (x < very_tiny) { + temp = 0.125 * (8.0 * x + _const_math__efx8 * x); + } else { + temp = x + _const_math__efx * x; + } + } else { + f64 z = x * x; + f64 r = _const_math__pp0 + z * (_const_math__pp1 + z * (_const_math__pp2 + z * (_const_math__pp3 + z * _const_math__pp4))); + f64 s_ = 1.0 + z * (_const_math__qq1 + z * (_const_math__qq2 + z * (_const_math__qq3 + z * (_const_math__qq4 + z * _const_math__qq5)))); + f64 y = r / s_; + temp = x + x * y; + } + if (sign) { + return -temp; + } + return temp; + } + if (x < 1.25) { + f64 s_ = x - 1; + f64 p = _const_math__pa0 + s_ * (_const_math__pa1 + s_ * (_const_math__pa2 + s_ * (_const_math__pa3 + s_ * (_const_math__pa4 + s_ * (_const_math__pa5 + s_ * _const_math__pa6))))); + f64 q = 1.0 + s_ * (_const_math__qa1 + s_ * (_const_math__qa2 + s_ * (_const_math__qa3 + s_ * (_const_math__qa4 + s_ * (_const_math__qa5 + s_ * _const_math__qa6))))); + if (sign) { + return -_const_math__erx - p / q; + } + return _const_math__erx + p / q; + } + if (x >= 6) { + if (sign) { + return -1; + } + return 1.0; + } + f64 s_ = 1.0 / (x * x); + f64 r = 0.0; + f64 s = 0.0; + if (x < 2.857143) { + r = _const_math__ra0 + s_ * (_const_math__ra1 + s_ * (_const_math__ra2 + s_ * (_const_math__ra3 + s_ * (_const_math__ra4 + s_ * (_const_math__ra5 + s_ * (_const_math__ra6 + s_ * _const_math__ra7)))))); + s = 1.0 + s_ * (_const_math__sa1 + s_ * (_const_math__sa2 + s_ * (_const_math__sa3 + s_ * (_const_math__sa4 + s_ * (_const_math__sa5 + s_ * (_const_math__sa6 + s_ * (_const_math__sa7 + s_ * _const_math__sa8))))))); + } else { + r = _const_math__rb0 + s_ * (_const_math__rb1 + s_ * (_const_math__rb2 + s_ * (_const_math__rb3 + s_ * (_const_math__rb4 + s_ * (_const_math__rb5 + s_ * _const_math__rb6))))); + s = 1.0 + s_ * (_const_math__sb1 + s_ * (_const_math__sb2 + s_ * (_const_math__sb3 + s_ * (_const_math__sb4 + s_ * (_const_math__sb5 + s_ * (_const_math__sb6 + s_ * _const_math__sb7)))))); + } + f64 z = math__f64_from_bits((math__f64_bits(x) & 0xffffffff00000000U)); + f64 r_ = math__exp(-z * z - 0.5625) * math__exp((z - x) * (z + x) + r / s); + if (sign) { + return r_ / x - 1.0; + } + return 1.0 - r_ / x; +} + +f64 math__erfc(f64 a) { + f64 x = a; + f64 tiny = 1.0 / ((f64)(((u64)(1U)) << 56U)); + if (math__is_nan(x)) { + return math__nan(); + } + if (math__is_inf(x, 1)) { + return 0.0; + } + if (math__is_inf(x, -1)) { + return 2.0; + } + bool sign = false; + if (x < 0) { + x = -x; + sign = true; + } + if (x < 0.84375) { + f64 temp = 0.0; + if (x < tiny) { + temp = x; + } else { + f64 z = x * x; + f64 r = _const_math__pp0 + z * (_const_math__pp1 + z * (_const_math__pp2 + z * (_const_math__pp3 + z * _const_math__pp4))); + f64 s_ = 1.0 + z * (_const_math__qq1 + z * (_const_math__qq2 + z * (_const_math__qq3 + z * (_const_math__qq4 + z * _const_math__qq5)))); + f64 y = r / s_; + if (x < 0.25) { + temp = x + x * y; + } else { + temp = 0.5 + (x * y + (x - 0.5)); + } + } + if (sign) { + return 1.0 + temp; + } + return 1.0 - temp; + } + if (x < 1.25) { + f64 s_ = x - 1; + f64 p = _const_math__pa0 + s_ * (_const_math__pa1 + s_ * (_const_math__pa2 + s_ * (_const_math__pa3 + s_ * (_const_math__pa4 + s_ * (_const_math__pa5 + s_ * _const_math__pa6))))); + f64 q = 1.0 + s_ * (_const_math__qa1 + s_ * (_const_math__qa2 + s_ * (_const_math__qa3 + s_ * (_const_math__qa4 + s_ * (_const_math__qa5 + s_ * _const_math__qa6))))); + if (sign) { + return 1.0 + _const_math__erx + p / q; + } + return 1.0 - _const_math__erx - p / q; + } + if (x < 28) { + f64 s_ = 1.0 / (x * x); + f64 r = 0.0; + f64 s = 0.0; + if (x < 2.857143) { + r = _const_math__ra0 + s_ * (_const_math__ra1 + s_ * (_const_math__ra2 + s_ * (_const_math__ra3 + s_ * (_const_math__ra4 + s_ * (_const_math__ra5 + s_ * (_const_math__ra6 + s_ * _const_math__ra7)))))); + s = 1.0 + s_ * (_const_math__sa1 + s_ * (_const_math__sa2 + s_ * (_const_math__sa3 + s_ * (_const_math__sa4 + s_ * (_const_math__sa5 + s_ * (_const_math__sa6 + s_ * (_const_math__sa7 + s_ * _const_math__sa8))))))); + } else { + if (sign && x > 6) { + return 2.0; + } + r = _const_math__rb0 + s_ * (_const_math__rb1 + s_ * (_const_math__rb2 + s_ * (_const_math__rb3 + s_ * (_const_math__rb4 + s_ * (_const_math__rb5 + s_ * _const_math__rb6))))); + s = 1.0 + s_ * (_const_math__sb1 + s_ * (_const_math__sb2 + s_ * (_const_math__sb3 + s_ * (_const_math__sb4 + s_ * (_const_math__sb5 + s_ * (_const_math__sb6 + s_ * _const_math__sb7)))))); + } + f64 z = math__f64_from_bits((math__f64_bits(x) & 0xffffffff00000000U)); + f64 r_ = math__exp(-z * z - 0.5625) * math__exp((z - x) * (z + x) + r / s); + if (sign) { + return 2.0 - r_ / x; + } + return r_ / x; + } + if (sign) { + return 2.0; + } + return 0.0; +} + +f64 math__exp(f64 x) { + f64 log2e = 1.44269504088896338700e+00; + f64 overflow = 7.09782712893383973096e+02; + f64 underflow = -7.45133219101941108420e+02; + f64 near_zero = 1.0 / (268435456); + if (math__is_nan(x) || math__is_inf(x, 1)) { + return x; + } + if (math__is_inf(x, -1)) { + return 0.0; + } + if (x > overflow) { + return math__inf(1); + } + if (x < underflow) { + return 0.0; + } + if (-near_zero < x && x < near_zero) { + return 1.0 + x; + } + int k = 0; + if (x < 0) { + k = ((int)(log2e * x - 0.5)); + } + if (x > 0) { + k = ((int)(log2e * x + 0.5)); + } + f64 hi = x - ((f64)(k)) * _const_math__ln2hi; + f64 lo = ((f64)(k)) * _const_math__ln2lo; + return math__expmulti(hi, lo, k); +} + +f64 math__exp2(f64 x) { + f64 overflow = 1.0239999999999999e+03; + f64 underflow = -1.0740e+03; + if (math__is_nan(x) || math__is_inf(x, 1)) { + return x; + } + if (math__is_inf(x, -1)) { + return 0; + } + if (x > overflow) { + return math__inf(1); + } + if (x < underflow) { + return 0; + } + int k = 0; + if (x > 0) { + k = ((int)(x + 0.5)); + } + if (x < 0) { + k = ((int)(x - 0.5)); + } + f64 t = x - ((f64)(k)); + f64 hi = t * _const_math__ln2hi; + f64 lo = -t * _const_math__ln2lo; + return math__expmulti(hi, lo, k); +} + +f64 math__ldexp(f64 frac, int exp) { + return math__scalbn(frac, exp); +} + +multi_return_f64_int math__frexp(f64 x) { + u64 y = math__f64_bits(x); + int ee = ((int)(((y >> 52U) & 0x7ffU))); + if (ee == 0) { + if (x != 0.0) { + f64 x1p64 = math__f64_from_bits(((u64)(0x43f0000000000000U))); + multi_return_f64_int mr_3352 = math__frexp(x * x1p64); + f64 z = mr_3352.arg0; + int e_ = mr_3352.arg1; + return (multi_return_f64_int){.arg0=z, .arg1=e_ - 64}; + } + return (multi_return_f64_int){.arg0=x, .arg1=0}; + } else if (ee == 0x7ff) { + return (multi_return_f64_int){.arg0=x, .arg1=0}; + } + int e_ = ee - 0x3fe; + y &= ((u64)(0x800fffffffffffffU)); + y |= ((u64)(0x3fe0000000000000U)); + return (multi_return_f64_int){.arg0=math__f64_from_bits(y), .arg1=e_}; +} + +f64 math__expm1(f64 x) { + if (math__is_inf(x, 1) || math__is_nan(x)) { + return x; + } + if (math__is_inf(x, -1)) { + return ((f64)(-1)); + } + if (math__abs_T_f64(x) < _const_math__ln2) { + f64 i = 1.0; + f64 sum = x; + f64 term = x / 1.0; + i++; + term *= x / ((f64)(i)); + sum += term; + for (;;) { + if (!(math__abs_T_f64(term) > math__abs_T_f64(sum) * _const_math__internal__f64_epsilon)) break; + i++; + term *= x / ((f64)(i)); + sum += term; + } + return sum; + } else { + return math__exp(x) - 1; + } + return 0; +} + +VV_LOCAL_SYMBOL f64 math__expmulti(f64 hi, f64 lo, int k) { + f64 exp_p1 = 1.66666666666666657415e-01; + f64 exp_p2 = -2.77777777770155933842e-03; + f64 exp_p3 = 6.61375632143793436117e-05; + f64 exp_p4 = -1.65339022054652515390e-06; + f64 exp_p5 = 4.13813679705723846039e-08; + f64 r = hi - lo; + f64 t = r * r; + f64 c = r - t * (exp_p1 + t * (exp_p2 + t * (exp_p3 + t * (exp_p4 + t * exp_p5)))); + f64 y = 1 - ((lo - (r * c) / (2 - c)) - hi); + return math__ldexp(y, k); +} + +f64 math__factorial(f64 n) { + if (n >= _const_math__factorials_table.len) { + return _const_math__max_f64; + } + if (n == ((f64)(((i64)(n)))) && n >= 0.0) { + return (*(f64*)/*ee elem_sym */array_get(_const_math__factorials_table, ((i64)(n)))); + } + return math__gamma(n + 1.0); +} + +f64 math__log_factorial(f64 n) { + if (n < 0) { + return -_const_math__max_f64; + } + if (n != ((f64)(((i64)(n))))) { + return math__log_gamma(n + 1); + } else if (n < _const_math__log_factorials_table.len) { + return (*(f64*)/*ee elem_sym */array_get(_const_math__log_factorials_table, ((i64)(n)))); + } + return math__log_factorial_asymptotic_expansion(((int)(n))); +} + +VV_LOCAL_SYMBOL f64 math__log_factorial_asymptotic_expansion(int n) { + int m = 6; + Array_f64 term = __new_array_with_default(0, 0, sizeof(f64), 0); + f64 xx = ((f64)((n + 1) * (n + 1))); + f64 xj = ((f64)(n + 1)); + f64 log_factorial = _const_math__log_sqrt_2pi - xj + (xj - 0.5) * math__log(xj); + int i = 0; + for (i = 0; i < m; i++) { + array_push((array*)&term, _MOV((f64[]){ (*(f64*)/*ee elem_sym */array_get(_const_math__bernoulli, i)) / xj })); + xj *= xx; + } + f64 sum = (*(f64*)/*ee elem_sym */array_get(term, m - 1)); + for (i = m - 2; i >= 0; i--) { + if (math__abs_T_f64(sum) <= math__abs_T_f64((*(f64*)/*ee elem_sym */array_get(term, i)))) { + break; + } + sum = (*(f64*)/*ee elem_sym */array_get(term, i)); + } + for (;;) { + if (!(i >= 0)) break; + sum += (*(f64*)/*ee elem_sym */array_get(term, i)); + i--; + } + return log_factorial + sum; +} + +i64 math__factoriali(int n) { + if (n <= 0) { + return ((i64)(1)); + } + if (n < 21) { + return ((i64)((*(f64*)/*ee elem_sym */array_get(_const_math__factorials_table, n)))); + } + return ((i64)(-1)); +} + +f64 math__floor(f64 x) { + if (x == 0 || math__is_nan(x) || math__is_inf(x, 0)) { + return x; + } + if (x < 0) { + multi_return_f64_f64 mr_280 = math__modf(-x); + f64 d = mr_280.arg0; + f64 fract = mr_280.arg1; + if (fract != 0.0) { + d = d + 1; + } + return -d; + } + multi_return_f64_f64 mr_350 = math__modf(x); + f64 d = mr_350.arg0; + return d; +} + +f64 math__ceil(f64 x) { + return -math__floor(-x); +} + +f64 math__trunc(f64 x) { + if (x == 0 || math__is_nan(x) || math__is_inf(x, 0)) { + return x; + } + multi_return_f64_f64 mr_793 = math__modf(x); + f64 d = mr_793.arg0; + return d; +} + +f64 math__round(f64 x) { + if (x == 0 || math__is_nan(x) || math__is_inf(x, 0)) { + return x; + } + f64 y = math__floor(x); + f64 r = x - y; + if (r > 0.5) { + { // Unsafe block + goto rndup; + } + } + if (r == 0.5) { + r = y - 2.0 * math__floor(0.5 * y); + if (r == 1.0) { + rndup: {} + y += 1.0; + } + } + return y; +} + +f64 math__round_to_even(f64 x) { + u64 bits = math__f64_bits(x); + u64 e_ = ((bits >> _const_math__shift) & _const_math__mask); + if (e_ >= _const_math__bias) { + u64 half_minus_ulp = ((u64)(((u64)(1U)) << (_const_math__shift - 1))) - 1U; + e_ -= ((u64)(_const_math__bias)); + bits += (half_minus_ulp + ((bits >> (_const_math__shift - e_)) & 1U)) >> e_; + bits &= _const_math__frac_mask >> e_; + bits ^= _const_math__frac_mask >> e_; + } else if (e_ == _const_math__bias - 1 && (bits & _const_math__frac_mask) != 0U) { + bits = ((bits & _const_math__sign_mask) | _const_math__uvone); + } else { + bits &= _const_math__sign_mask; + } + return math__f64_from_bits(bits); +} + +VV_LOCAL_SYMBOL multi_return_f64_f64 math__stirling(f64 x) { + if (x > 200) { + return (multi_return_f64_f64){.arg0=math__inf(1), .arg1=1.0}; + } + f64 sqrt_two_pi = 2.506628274631000502417; + f64 max_stirling = 143.01608; + f64 w = 1.0 / x; + w = 1.0 + w * (((((*(f64*)/*ee elem_sym */array_get(_const_math__gamma_s, 0)) * w + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_s, 1))) * w + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_s, 2))) * w + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_s, 3))) * w + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_s, 4))); + f64 y1 = math__exp(x); + f64 y2 = 1.0; + if (x > max_stirling) { + f64 v = math__pow(x, 0.5 * x - 0.25); + f64 y1_ = y1; + y1 = v; + y2 = v / y1_; + } else { + y1 = math__pow(x, x - 0.5) / y1; + } + return (multi_return_f64_f64){.arg0=y1, .arg1=((f64)(sqrt_two_pi)) * w * y2}; +} + +f64 math__gamma(f64 a) { + f64 x = a; + f64 euler = 0.57721566490153286060651209008240243104215933593992; + if (math__is_neg_int(x) || math__is_inf(x, -1) || math__is_nan(x)) { + return math__nan(); + } + if (math__is_inf(x, 1)) { + return math__inf(1); + } + if (x == 0.0) { + return math__copysign(math__inf(1), x); + } + f64 q = math__abs_T_f64(x); + f64 p = math__floor(q); + if (q > 33) { + if (x >= 0) { + multi_return_f64_f64 mr_1482 = math__stirling(x); + f64 y1 = mr_1482.arg0; + f64 y2 = mr_1482.arg1; + return y1 * y2; + } + int signgam = 1; + i64 ip = ((i64)(p)); + if (((ip & 1)) == 0) { + signgam = -1; + } + f64 z = q - p; + if (z > 0.5) { + p = p + 1; + z = q - p; + } + z = q * math__sin(_const_math__pi * z); + if (z == 0) { + return math__inf(signgam); + } + multi_return_f64_f64 mr_1927 = math__stirling(q); + f64 sq1 = mr_1927.arg0; + f64 sq2 = mr_1927.arg1; + f64 absz = math__abs_T_f64(z); + f64 d = absz * sq1 * sq2; + if (math__is_inf(d, 0)) { + z = _const_math__pi / absz / sq1 / sq2; + } else { + z = _const_math__pi / d; + } + return ((f64)(signgam)) * z; + } + f64 z = 1.0; + for (;;) { + if (!(x >= 3)) break; + x = x - 1; + z = z * x; + } + for (;;) { + if (!(x < 0)) break; + if (x > -1e-09) { + { // Unsafe block + goto _v_small; + } + } + z = z / x; + x = x + 1; + } + for (;;) { + if (!(x < 2)) break; + if (x < 1e-09) { + { // Unsafe block + goto _v_small; + } + } + z = z / x; + x = x + 1; + } + if (x == 2) { + return z; + } + x = x - 2; + p = (((((x * (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 0)) + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 1))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 2))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 3))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 4))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 5))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 6)); + q = ((((((x * (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 0)) + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 1))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 2))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 3))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 4))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 5))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 6))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 7)); + if (true) { + return z * p / q; + } + _v_small: {} + if (x == 0) { + return math__inf(1); + } + return z / ((1.0 + euler * x) * x); +} + +f64 math__log_gamma(f64 x) { + multi_return_f64_int mr_3045 = math__log_gamma_sign(x); + f64 y = mr_3045.arg0; + return y; +} + +multi_return_f64_int math__log_gamma_sign(f64 a) { + f64 x = a; + f64 ymin = 1.461632144968362245; + f64 tiny = math__exp2(-70); + f64 two52 = math__exp2(52); + f64 two58 = math__exp2(58); + f64 tc = 1.46163214496836224576e+00; + f64 tf = -1.21486290535849611461e-01; + f64 tt = -3.63867699703950536541e-18; + int sign = 1; + if (math__is_nan(x)) { + return (multi_return_f64_int){.arg0=x, .arg1=sign}; + } + if (math__is_inf(x, 1)) { + return (multi_return_f64_int){.arg0=x, .arg1=sign}; + } + if (x == 0.0) { + return (multi_return_f64_int){.arg0=math__inf(1), .arg1=sign}; + } + bool neg = false; + if (x < 0) { + x = -x; + neg = true; + } + if (x < tiny) { + if (neg) { + sign = -1; + } + return (multi_return_f64_int){.arg0=-math__log(x), .arg1=sign}; + } + f64 nadj = 0.0; + if (neg) { + if (x >= two52) { + return (multi_return_f64_int){.arg0=math__inf(1), .arg1=sign}; + } + f64 t = math__sin_pi(x); + if (t == 0) { + return (multi_return_f64_int){.arg0=math__inf(1), .arg1=sign}; + } + nadj = math__log(_const_math__pi / math__abs_T_f64(t * x)); + if (t < 0) { + sign = -1; + } + } + f64 lgamma = 0.0; + if (x == 1 || x == 2) { + return (multi_return_f64_int){.arg0=0.0, .arg1=sign}; + } else if (x < 2) { + f64 y = 0.0; + int i = 0; + if (x <= 0.9) { + lgamma = -math__log(x); + if (x >= (ymin - 1 + 0.27)) { + y = 1.0 - x; + i = 0; + } else if (x >= (ymin - 1 - 0.27)) { + y = x - (tc - 1); + i = 1; + } else { + y = x; + i = 2; + } + } else { + lgamma = 0; + if (x >= (ymin + 0.27)) { + y = ((f64)(2)) - x; + i = 0; + } else if (x >= (ymin - 0.27)) { + y = x - tc; + i = 1; + } else { + y = x - 1; + i = 2; + } + } + if (i == 0) { + f64 z = y * y; + f64 gamma_p1 = (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 0)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 2)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 4)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 6)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 8)) + z * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 10)))))); + f64 gamma_p2 = z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 1)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 3)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 5)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 7)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 9)) + z * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 11))))))); + f64 p = y * gamma_p1 + gamma_p2; + lgamma += (p - 0.5 * y); + } else if (i == 1) { + f64 z = y * y; + f64 w = z * y; + f64 gamma_p1 = (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 0)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 3)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 6)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 9)) + w * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 12))))); + f64 gamma_p2 = (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 1)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 4)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 7)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 10)) + w * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 13))))); + f64 gamma_p3 = (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 2)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 5)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 8)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 11)) + w * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 14))))); + f64 p = z * gamma_p1 - (tt - w * (gamma_p2 + y * gamma_p3)); + lgamma += (tf + p); + } else if (i == 2) { + f64 gamma_p1 = y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_u, 0)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_u, 1)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_u, 2)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_u, 3)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_u, 4)) + y * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_u, 5))))))); + f64 gamma_p2 = 1.0 + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_v, 1)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_v, 2)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_v, 3)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_v, 4)) + y * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_v, 5)))))); + lgamma += (-0.5 * y + gamma_p1 / gamma_p2); + } + } else if (x < 8) { + int i = ((int)(x)); + f64 y = x - ((f64)(i)); + f64 p = y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 0)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 1)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 2)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 3)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 4)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 5)) + y * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 6)))))))); + f64 q = 1.0 + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_r, 1)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_r, 2)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_r, 3)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_r, 4)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_r, 5)) + y * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_r, 6))))))); + lgamma = 0.5 * y + p / q; + f64 z = 1.0; + if (i == 7) { + z *= (y + 6); + z *= (y + 5); + z *= (y + 4); + z *= (y + 3); + z *= (y + 2); + lgamma += math__log(z); + } else if (i == 6) { + z *= (y + 5); + z *= (y + 4); + z *= (y + 3); + z *= (y + 2); + lgamma += math__log(z); + } else if (i == 5) { + z *= (y + 4); + z *= (y + 3); + z *= (y + 2); + lgamma += math__log(z); + } else if (i == 4) { + z *= (y + 3); + z *= (y + 2); + lgamma += math__log(z); + } else if (i == 3) { + z *= (y + 2); + lgamma += math__log(z); + } + } else if (x < two58) { + f64 t = math__log(x); + f64 z = 1.0 / x; + f64 y = z * z; + f64 w = (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 0)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 1)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 2)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 3)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 4)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 5)) + y * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 6))))))); + lgamma = (x - 0.5) * (t - 1.0) + w; + } else { + lgamma = x * (math__log(x) - 1.0); + } + if (neg) { + lgamma = nadj - lgamma; + } + return (multi_return_f64_int){.arg0=lgamma, .arg1=sign}; +} + +VV_LOCAL_SYMBOL f64 math__sin_pi(f64 x_) { + f64 x = x_; + f64 two52 = math__exp2(52); + f64 two53 = math__exp2(53); + if (x < 0.25) { + return -math__sin(_const_math__pi * x); + } + f64 z = math__floor(x); + int n = 0; + if (z != x) { + x = math__mod(x, 2); + n = ((int)(x * 4)); + } else { + if (x >= two53) { + x = 0; + n = 0; + } else { + if (x < two52) { + z = x + two52; + } + n = (1 & ((int)(math__f64_bits(z)))); + x = ((f64)(n)); + n <<= 2; + } + } + if (n == 0) { + x = math__sin(_const_math__pi * x); + } else if (n == 1 || n == 2) { + x = math__cos(_const_math__pi * (0.5 - x)); + } else if (n == 3 || n == 4) { + x = math__sin(_const_math__pi * (1.0 - x)); + } else if (n == 5 || n == 6) { + x = -math__cos(_const_math__pi * (x - 1.5)); + } else { + x = math__sin(_const_math__pi * (x - 2)); + } + return -x; +} + +f64 math__hypot(f64 x, f64 y) { + if (math__is_inf(x, 0) || math__is_inf(y, 0)) { + return math__inf(1); + } + if (math__is_nan(x) || math__is_nan(y)) { + return math__nan(); + } + f64 result = 0.0; + if (x != 0.0 || y != 0.0) { + f64 abs_x = math__abs_T_f64(x); + f64 abs_y = math__abs_T_f64(y); + multi_return_f64_f64 mr_240 = math__minmax(abs_x, abs_y); + f64 min = mr_240.arg0; + f64 max = mr_240.arg1; + f64 rat = min / max; + f64 root_term = math__sqrt(1.0 + rat * rat); + if (max < _const_math__max_f64 / root_term) { + result = max * root_term; + } else { + _v_panic(_SLIT("overflow in hypot_e function")); + VUNREACHABLE(); + } + } + return result; +} + +f64 math__acosh(f64 x) { + if (x == 0.0) { + return 0.0; + } else if (x > 1.0 / _const_math__internal__sqrt_f64_epsilon) { + return math__log(x) + _const_math__pi * 2; + } else if (x > 2.0) { + return math__log(2.0 * x - 1.0 / (math__sqrt(x * x - 1.0) + x)); + } else if (x > 1.0) { + f64 t = x - 1.0; + return math__log1p(t + math__sqrt(2.0 * t + t * t)); + } else if (x == 1.0) { + return 0.0; + } else { + return math__nan(); + } + return 0; +} + +f64 math__asinh(f64 x) { + f64 a = math__abs_T_f64(x); + f64 s = (x < 0 ? (-1.0) : (1.0)); + if (a > 1.0 / _const_math__internal__sqrt_f64_epsilon) { + return s * (math__log(a) + _const_math__pi * 2.0); + } else if (a > 2.0) { + return s * math__log(2.0 * a + 1.0 / (a + math__sqrt(a * a + 1.0))); + } else if (a > _const_math__internal__sqrt_f64_epsilon) { + f64 a2 = a * a; + return s * math__log1p(a + a2 / (1.0 + math__sqrt(1.0 + a2))); + } else { + return x; + } + return 0; +} + +f64 math__atanh(f64 x) { + f64 a = math__abs_T_f64(x); + f64 s = (x < 0 ? (-1.0) : (1.0)); + if (a > 1.0) { + return math__nan(); + } else if (a == 1.0) { + return (x < 0 ? (math__inf(-1)) : (math__inf(1))); + } else if (a >= 0.5) { + return s * 0.5 * math__log1p(2.0 * a / (1.0 - a)); + } else if (a > _const_math__internal__f64_epsilon) { + return s * 0.5 * math__log1p(2.0 * a + 2.0 * a * a / (1.0 - a)); + } else { + return x; + } + return 0; +} + +// Attr: [inline] +inline VV_LOCAL_SYMBOL f64 math__xatan(f64 x) { + f64 xatan_p0 = -8.750608600031904122785e-01; + f64 xatan_p1 = -1.615753718733365076637e+01; + f64 xatan_p2 = -7.500855792314704667340e+01; + f64 xatan_p3 = -1.228866684490136173410e+02; + f64 xatan_p4 = -6.485021904942025371773e+01; + f64 xatan_q0 = 2.485846490142306297962e+01; + f64 xatan_q1 = 1.650270098316988542046e+02; + f64 xatan_q2 = 4.328810604912902668951e+02; + f64 xatan_q3 = 4.853903996359136964868e+02; + f64 xatan_q4 = 1.945506571482613964425e+02; + f64 z = x * x; + z = z * ((((xatan_p0 * z + xatan_p1) * z + xatan_p2) * z + xatan_p3) * z + xatan_p4) / (((((z + xatan_q0) * z + xatan_q1) * z + xatan_q2) * z + xatan_q3) * z + xatan_q4); + z = x * z + x; + return z; +} + +// Attr: [inline] +inline VV_LOCAL_SYMBOL f64 math__satan(f64 x) { + if (x <= 0.66) { + return math__xatan(x); + } + if (x > _const_math__tan3pio8) { + return _const_math__pi / 2.0 - math__xatan(1.0 / x) + ((f64)(_const_math__morebits)); + } + return _const_math__pi / 4 + math__xatan((x - 1.0) / (x + 1.0)) + 0.5 * ((f64)(_const_math__morebits)); +} + +f64 math__atan(f64 x) { + if (x == 0) { + return x; + } + if (x > 0) { + return math__satan(x); + } + return -math__satan(-x); +} + +f64 math__atan2(f64 y, f64 x) { + if (math__is_nan(y) || math__is_nan(x)) { + return math__nan(); + } + if (y == 0.0) { + if (x >= 0 && !math__signbit(x)) { + return math__copysign(0, y); + } + return math__copysign(_const_math__pi, y); + } + if (x == 0.0) { + return math__copysign(_const_math__pi / 2.0, y); + } + if (math__is_inf(x, 0)) { + if (math__is_inf(x, 1)) { + if (math__is_inf(y, 0)) { + return math__copysign(_const_math__pi / 4, y); + } + return math__copysign(0, y); + } + if (math__is_inf(y, 0)) { + return math__copysign(3.0 * _const_math__pi / 4.0, y); + } + return math__copysign(_const_math__pi, y); + } + if (math__is_inf(y, 0)) { + return math__copysign(_const_math__pi / 2.0, y); + } + f64 q = math__atan(y / x); + if (x < 0) { + if (q <= 0) { + return q + _const_math__pi; + } + return q - _const_math__pi; + } + return q; +} + +f64 math__asin(f64 x_) { + f64 x = x_; + if (x == 0.0) { + return x; + } + bool sign = false; + if (x < 0.0) { + x = -x; + sign = true; + } + if (x > 1.0) { + return math__nan(); + } + f64 temp = math__sqrt(1.0 - x * x); + if (x > 0.7) { + temp = _const_math__pi / 2.0 - math__satan(temp / x); + } else { + temp = math__satan(x / temp); + } + if (sign) { + temp = -temp; + } + return temp; +} + +// Attr: [inline] +inline f64 math__acos(f64 x) { + if ((x < -1.0) || (x > 1.0)) { + return math__nan(); + } + if (x > 0.5) { + return ((f64)(2.0)) * math__asin(math__sqrt(0.5 - 0.5 * x)); + } + f64 z = _const_math__pi / ((f64)(4.0)) - math__asin(x); + z = z + _const_math__morebits; + z = z + _const_math__pi / ((f64)(4.0)); + return z; +} + +f64 math__log_n(f64 x, f64 b) { + f64 y = math__log(x); + f64 z = math__log(b); + return y / z; +} + +f64 math__log10(f64 x) { + return math__log(x) * (1.0 / _const_math__ln10); +} + +f64 math__log2(f64 x) { + multi_return_f64_int mr_364 = math__frexp(x); + f64 frac = mr_364.arg0; + int exp = mr_364.arg1; + if (frac == 0.5) { + return ((f64)(exp - 1)); + } + return math__log(frac) * (1.0 / _const_math__ln2) + ((f64)(exp)); +} + +f64 math__log1p(f64 x) { + f64 y = 1.0 + x; + f64 z = y - 1.0; + return math__log(y) - (z - x) / y; +} + +f64 math__log_b(f64 x) { + if (x == 0) { + return math__inf(-1); + } + if (math__is_inf(x, 0)) { + return math__inf(1); + } + if (math__is_nan(x)) { + return x; + } + return ((f64)(math__ilog_b_(x))); +} + +int math__ilog_b(f64 x) { + if (x == 0) { + return _const_math__min_i32; + } + if (math__is_nan(x)) { + return _const_math__max_i32; + } + if (math__is_inf(x, 0)) { + return _const_math__max_i32; + } + return math__ilog_b_(x); +} + +VV_LOCAL_SYMBOL int math__ilog_b_(f64 x_) { + multi_return_f64_int mr_1424 = math__normalize(x_); + f64 x = mr_1424.arg0; + int exp = mr_1424.arg1; + return ((int)(((math__f64_bits(x) >> _const_math__shift) & _const_math__mask))) - _const_math__bias + exp; +} + +f64 math__log(f64 a) { + f64 ln2_hi = 6.93147180369123816490e-01; + f64 ln2_lo = 1.90821492927058770002e-10; + f64 l1 = 6.666666666666735130e-01; + f64 l2 = 3.999999999940941908e-01; + f64 l3 = 2.857142874366239149e-01; + f64 l4 = 2.222219843214978396e-01; + f64 l5 = 1.818357216161805012e-01; + f64 l6 = 1.531383769920937332e-01; + f64 l7 = 1.479819860511658591e-01; + f64 x = a; + if (math__is_nan(x) || math__is_inf(x, 1)) { + return x; + } else if (x < 0) { + return math__nan(); + } else if (x == 0) { + return math__inf(-1); + } + multi_return_f64_int mr_4006 = math__frexp(x); + f64 f1 = mr_4006.arg0; + int ki = mr_4006.arg1; + if (f1 < _const_math__sqrt2 / 2) { + f1 *= 2; + ki--; + } + f64 f = f1 - 1; + f64 k = ((f64)(ki)); + f64 s = f / (2 + f); + f64 s2 = s * s; + f64 s4 = s2 * s2; + f64 t1 = s2 * (l1 + s4 * (l3 + s4 * (l5 + s4 * l7))); + f64 t2 = s4 * (l2 + s4 * (l4 + s4 * l6)); + f64 r = t1 + t2; + f64 hfsq = 0.5 * f * f; + return k * ln2_hi - ((hfsq - (s * (hfsq + r) + k * ln2_lo)) - f); +} + +#if defined(_WIN32) + #if defined(__TINYC__) +#endif +#else +#endif +f64 math__aprox_sin(f64 a) { + f64 a0 = 1.91059300966915117e-31; + f64 a1 = 1.00086760103908896; + f64 a2 = -1.21276126894734565e-2; + f64 a3 = -1.38078780785773762e-1; + f64 a4 = -2.67353392911981221e-2; + f64 a5 = 2.08026600266304389e-2; + f64 a6 = -3.03996055049204407e-3; + f64 a7 = 1.38235642404333740e-4; + return a0 + a * (a1 + a * (a2 + a * (a3 + a * (a4 + a * (a5 + a * (a6 + a * a7)))))); +} + +f64 math__aprox_cos(f64 a) { + f64 a0 = 9.9995999154986614e-1; + f64 a1 = 1.2548995793001028e-3; + f64 a2 = -5.0648546280678015e-1; + f64 a3 = 1.2942246466519995e-2; + f64 a4 = 2.8668384702547972e-2; + f64 a5 = 7.3726485210586547e-3; + f64 a6 = -3.8510875386947414e-3; + f64 a7 = 4.7196604604366623e-4; + f64 a8 = -1.8776444013090451e-5; + return a0 + a * (a1 + a * (a2 + a * (a3 + a * (a4 + a * (a5 + a * (a6 + a * (a7 + a * a8))))))); +} + +// Attr: [inline] +inline f64 math__copysign(f64 x, f64 y) { + return math__f64_from_bits((((math__f64_bits(x) & ~_const_math__sign_mask)) | ((math__f64_bits(y) & _const_math__sign_mask)))); +} + +// Attr: [inline] +inline f64 math__degrees(f64 radians) { + return radians * (180.0 / _const_math__pi); +} + +Array_int math__digits(i64 num, math__DigitParams params) { + int b = params.base; + if (b < 2) { + _v_panic( str_intp(2, _MOV((StrIntpData[]){{_SLIT("digits: Cannot find digits of n with base "), 0xfe07, {.d_i32 = b}}, {_SLIT0, 0, { .d_c = 0 }}}))); + VUNREACHABLE(); + } + i64 n = num; + int sign = 1; + if (n < 0) { + sign = -1; + n = -n; + } + Array_int res = __new_array_with_default(0, 0, sizeof(int), 0); + if (n == 0) { + array_push((array*)&res, _MOV((int[]){ 0 })); + return res; + } + for (;;) { + if (!(n != 0)) break; + i64 next_n = n / b; + array_push((array*)&res, _MOV((int[]){ ((int)(n - next_n * b)) })); + n = next_n; + } + if (sign == -1) { + (*(int*)array_get(res, res.len - 1)) *= sign; + } + if (params.reverse) { + res = array_reverse(res); + } + return res; +} + +int math__count_digits(i64 number) { + i64 n = number; + if (n == 0) { + return 1; + } + int c = 0; + for (;;) { + if (!(n != 0)) break; + n = n / 10; + c++; + } + return c; +} + +multi_return_f64_f64 math__minmax(f64 a, f64 b) { + if (a < b) { + return (multi_return_f64_f64){.arg0=a, .arg1=b}; + } + return (multi_return_f64_f64){.arg0=b, .arg1=a}; +} + +// Attr: [inline] +inline f64 math__clamp(f64 x, f64 a, f64 b) { + if (x < a) { + return a; + } + if (x > b) { + return b; + } + return x; +} + +// Attr: [inline] +inline f64 math__sign(f64 n) { + if (math__is_nan(n)) { + return math__nan(); + } + return math__copysign(1.0, n); +} + +// Attr: [inline] +inline int math__signi(f64 n) { + return ((int)(math__copysign(1.0, n))); +} + +// Attr: [inline] +inline f64 math__radians(f64 degrees) { + return degrees * (_const_math__pi / 180.0); +} + +// Attr: [inline] +inline bool math__signbit(f64 x) { + return (math__f64_bits(x) & _const_math__sign_mask) != 0U; +} + +bool math__tolerance(f64 a, f64 b, f64 tol) { + f64 ee = tol; + if (a == b) { + return true; + } + f64 d = a - b; + if (d < 0) { + d = -d; + } + if (b != 0) { + ee = ee * b; + if (ee < 0) { + ee = -ee; + } + } + return d < ee; +} + +bool math__close(f64 a, f64 b) { + return math__tolerance(a, b, 1e-14); +} + +bool math__veryclose(f64 a, f64 b) { + return math__tolerance(a, b, 4e-16); +} + +bool math__alike(f64 a, f64 b) { + if (math__is_nan(a) && math__is_nan(b)) { + return true; + } else if (a == b) { + return math__signbit(a) == math__signbit(b); + } + return false; +} + +VV_LOCAL_SYMBOL bool math__is_odd_int(f64 x) { + multi_return_f64_f64 mr_4654 = math__modf(x); + f64 xi = mr_4654.arg0; + f64 xf = mr_4654.arg1; + return xf == 0 && ((((i64)(xi)) & 1)) == 1; +} + +VV_LOCAL_SYMBOL bool math__is_neg_int(f64 x) { + if (x < 0) { + multi_return_f64_f64 mr_4754 = math__modf(x); + f64 xf = mr_4754.arg1; + return xf == 0; + } + return false; +} + +// Attr: [inline] +inline int math__min_T_int(int a, int b) { + return (a < b ? (a) : (b)); +} + +// Attr: [inline] +inline f64 math__abs_T_f64(f64 a) { + return (a < 0 ? (-a) : (a)); +} + +multi_return_f64_f64 math__modf(f64 f) { + f64 abs_f = math__abs_T_f64(f); + f64 i = 0.0; + if (abs_f >= _const_math__modf_maxpowtwo) { + i = f; + } else { + i = abs_f + _const_math__modf_maxpowtwo; + i -= _const_math__modf_maxpowtwo; + for (;;) { + if (!(i > abs_f)) break; + i -= 1.0; + } + if (f < 0.0) { + i = -i; + } + } + return (multi_return_f64_f64){.arg0=i, .arg1=f - i}; +} + +f32 math__nextafter32(f32 x, f32 y) { + f32 r = ((f32)(0.0)); + if (math__is_nan(((f64)(x))) || math__is_nan(((f64)(y)))) { + r = ((f32)(math__nan())); + } else if (x == y) { + r = x; + } else if (x == 0) { + r = ((f32)(math__copysign(((f64)(math__f32_from_bits(1U))), ((f64)(y))))); + } else if ((y > x) == (x > 0)) { + r = math__f32_from_bits(math__f32_bits(x) + 1U); + } else { + r = math__f32_from_bits(math__f32_bits(x) - 1U); + } + return r; +} + +f64 math__nextafter(f64 x, f64 y) { + f64 r = 0.0; + if (math__is_nan(x) || math__is_nan(y)) { + r = math__nan(); + } else if (x == y) { + r = x; + } else if (x == 0) { + r = math__copysign(math__f64_from_bits(1U), y); + } else if ((y > x) == (x > 0)) { + r = math__f64_from_bits(math__f64_bits(x) + 1U); + } else { + r = math__f64_from_bits(math__f64_bits(x) - 1U); + } + return r; +} + +VV_LOCAL_SYMBOL f64 math__poly_n_eval(Array_f64 c, int n, f64 x) { + if (c.len == 0) { + _v_panic(_SLIT("coeficients can not be empty")); + VUNREACHABLE(); + } + int len = ((int)(math__min_T_int(c.len, n))); + f64 ans = (*(f64*)/*ee elem_sym */array_get(c, len - 1)); + Array_f64 _t1 = array_slice(c, 0, len - 1); + for (int _t2 = 0; _t2 < _t1.len; ++_t2) { + f64 e = ((f64*)_t1.data)[_t2]; + ans = e + x * ans; + } + return ans; +} + +VV_LOCAL_SYMBOL f64 math__poly_n_1_eval(Array_f64 c, int n, f64 x) { + if (c.len == 0) { + _v_panic(_SLIT("coeficients can not be empty")); + VUNREACHABLE(); + } + int len = ((int)(math__min_T_int(c.len, n))) - 1; + f64 ans = (*(f64*)/*ee elem_sym */array_get(c, len - 1)); + Array_f64 _t1 = array_slice(c, 0, len - 1); + for (int _t2 = 0; _t2 < _t1.len; ++_t2) { + f64 e = ((f64*)_t1.data)[_t2]; + ans = e + x * ans; + } + return ans; +} + +// Attr: [inline] +inline VV_LOCAL_SYMBOL f64 math__poly_eval(Array_f64 c, f64 x) { + return math__poly_n_eval(c, c.len, x); +} + +// Attr: [inline] +inline VV_LOCAL_SYMBOL f64 math__poly_1_eval(Array_f64 c, f64 x) { + return math__poly_n_1_eval(c, c.len, x); +} + +VV_LOCAL_SYMBOL multi_return_f64_f64 math__ChebSeries_eval_e(math__ChebSeries cs, f64 x) { + f64 d = 0.0; + f64 dd = 0.0; + f64 y = (2.0 * x - cs.a - cs.b) / (cs.b - cs.a); + f64 y2 = 2.0 * y; + f64 e_ = 0.0; + f64 temp = 0.0; + for (int j = cs.order; j >= 1; j--) { + temp = d; + d = y2 * d - dd + (*(f64*)/*ee elem_sym */array_get(cs.c, j)); + e_ += math__abs_T_f64(y2 * temp) + math__abs_T_f64(dd) + math__abs_T_f64((*(f64*)/*ee elem_sym */array_get(cs.c, j))); + dd = temp; + } + temp = d; + d = y * d - dd + 0.5 * (*(f64*)/*ee elem_sym */array_get(cs.c, 0)); + e_ += math__abs_T_f64(y * temp) + math__abs_T_f64(dd) + 0.5 * math__abs_T_f64((*(f64*)/*ee elem_sym */array_get(cs.c, 0))); + return (multi_return_f64_f64){.arg0=d, .arg1=((f64)(_const_math__internal__f64_epsilon)) * e_ + math__abs_T_f64((*(f64*)/*ee elem_sym */array_get(cs.c, cs.order)))}; +} + +// Attr: [inline] +inline f32 math__powf(f32 a, f32 b) { + return powf(a, b); +} + +// Attr: [inline] +inline f32 math__pure_v_but_overriden_by_c_powf(f32 a, f32 b) { + return ((f32)(math__pow(a, b))); +} + +f64 math__pow10(int n) { + if (0 <= n && n <= 308) { + return (*(f64*)/*ee elem_sym */array_get(_const_math__pow10postab32, ((u32)(n)) / 32U)) * (*(f64*)/*ee elem_sym */array_get(_const_math__pow10tab, ((u32)(n)) % 32U)); + } + if (-323 <= n && n <= 0) { + return (*(f64*)/*ee elem_sym */array_get(_const_math__pow10negtab32, ((u32)(-n)) / 32U)) / (*(f64*)/*ee elem_sym */array_get(_const_math__pow10tab, ((u32)(-n)) % 32U)); + } + if (n > 0) { + return math__inf(1); + } + return 0.0; +} + +i64 math__powi(i64 a, i64 b) { + i64 b_ = b; + i64 p = a; + i64 v = ((i64)(1)); + if (b_ < 0) { + if (a == 0) { + return -1; + } + return (a * a != 1 ? (0) : ((((b_ & 1)) > 0 ? (a) : (1)))); + } + for (; b_ > 0; ) { + if ((b_ & 1) > 0) { + v *= p; + } + p *= p; + b_ >>= 1; + } + return v; +} + +f64 math__pow(f64 x, f64 y) { + if (y == 0 || x == 1) { + return 1; + } else if (y == 1) { + return x; + } else if (math__is_nan(x) || math__is_nan(y)) { + return math__nan(); + } else if (x == 0) { + if (y < 0) { + if (math__is_odd_int(y)) { + return math__copysign(math__inf(1), x); + } + return math__inf(1); + } else if (y > 0) { + if (math__is_odd_int(y)) { + return x; + } + return 0; + } + } else if (math__is_inf(y, 0)) { + if (x == -1) { + return 1; + } else if ((math__abs_T_f64(x) < 1) == math__is_inf(y, 1)) { + return 0; + } else { + return math__inf(1); + } + } else if (math__is_inf(x, 0)) { + if (math__is_inf(x, -1)) { + return math__pow(1 / x, -y); + } + if (y < 0) { + return 0; + } else if (y > 0) { + return math__inf(1); + } + } else if (y == 0.5) { + return math__sqrt(x); + } else if (y == -0.5) { + return 1 / math__sqrt(x); + } + multi_return_f64_f64 mr_2400 = math__modf(math__abs_T_f64(y)); + f64 yi = mr_2400.arg0; + f64 yf = mr_2400.arg1; + if (yf != 0 && x < 0) { + return math__nan(); + } + if (yi >= (((u64)(1U)) << 63U)) { + if (x == -1) { + return 1; + } else if ((math__abs_T_f64(x) < 1) == (y > 0)) { + return 0; + } else { + return math__inf(1); + } + } + f64 a1 = 1.0; + int ae = 0; + if (yf != 0) { + if (yf > 0.5) { + yf--; + yi++; + } + a1 = math__exp(yf * math__log(x)); + } + multi_return_f64_int mr_3038 = math__frexp(x); + f64 x1 = mr_3038.arg0; + int xe = mr_3038.arg1; + for (i64 i = ((i64)(yi)); i != 0; i >>= 1) { + if (xe < ((int)(((u32)(((u32)(-1)) << 12U)))) || 4096 < xe) { + ae += xe; + break; + } + if ((i & 1) == 1) { + a1 *= x1; + ae += xe; + } + x1 *= x1; + xe <<= 1; + if (x1 < .5) { + x1 += x1; + xe--; + } + } + if (y < 0) { + a1 = 1 / a1; + ae = -ae; + } + return math__ldexp(a1, ae); +} + +// Attr: [inline] +inline f64 math__q_rsqrt(f64 x) { + f64 x_half = 0.5 * x; + i64 i = ((i64)(math__f64_bits(x))); + i = 0x5fe6eb50c7b537a9 - (i >> 1); + f64 j = math__f64_from_bits(((u64)(i))); + j *= (1.5 - x_half * j * j); + j *= (1.5 - x_half * j * j); + return j; +} + +f64 math__scalbn(f64 x, int n_) { + int n = n_; + f64 x1p1023 = math__f64_from_bits(((u64)(0x7fe0000000000000U))); + f64 x1p53 = math__f64_from_bits(((u64)(0x4340000000000000U))); + f64 x1p_1022 = math__f64_from_bits(((u64)(0x0010000000000000U))); + f64 y = x; + if (n > 1023) { + y *= x1p1023; + n -= 1023; + if (n > 1023) { + y *= x1p1023; + n -= 1023; + if (n > 1023) { + n = 1023; + } + } + } else if (n < -1022) { + y *= x1p_1022 * x1p53; + n += 969; + if (n < -1022) { + y *= x1p_1022 * x1p53; + n += 969; + if (n < -1022) { + n = -1022; + } + } + } + return y * math__f64_from_bits(((u64)((0x3ff + n))) << 52U); +} + +// Attr: [inline] +inline f32 math__cosf(f32 a) { + return cosf(a); +} + +// Attr: [inline] +inline f32 math__sinf(f32 a) { + return sinf(a); +} + +f64 math__sin(f64 x) { + f64 p1 = 7.85398125648498535156e-1; + f64 p2 = 3.77489470793079817668e-8; + f64 p3 = 2.69515142907905952645e-15; + int sgn_x = (x < 0 ? (-1) : (1)); + f64 abs_x = math__abs_T_f64(x); + if (abs_x < _const_math__internal__root4_f64_epsilon) { + f64 x2 = x * x; + return x * (1.0 - x2 / 6.0); + } else { + int sgn_result = sgn_x; + f64 y = math__floor(abs_x / (0.25 * _const_math__pi)); + int octant = ((int)(y - math__ldexp(math__floor(math__ldexp(y, -3)), 3))); + if (((octant & 1)) == 1) { + octant++; + octant &= 7; + y += 1.0; + } + if (octant > 3) { + octant -= 4; + sgn_result = -sgn_result; + } + f64 z = ((abs_x - y * p1) - y * p2) - y * p3; + f64 result = 0.0; + if (octant == 0) { + f64 t = 8.0 * math__abs_T_f64(z) / _const_math__pi - 1.0; + multi_return_f64_f64 mr_1676 = math__ChebSeries_eval_e(_const_math__sin_cs, t); + f64 sin_cs_val = mr_1676.arg0; + result = z * (1.0 + z * z * sin_cs_val); + } else { + f64 t = 8.0 * math__abs_T_f64(z) / _const_math__pi - 1.0; + multi_return_f64_f64 mr_1804 = math__ChebSeries_eval_e(_const_math__cos_cs, t); + f64 cos_cs_val = mr_1804.arg0; + result = 1.0 - 0.5 * z * z * (1.0 - z * z * cos_cs_val); + } + result *= sgn_result; + return result; + } + return 0; +} + +f64 math__cos(f64 x) { + f64 p1 = 7.85398125648498535156e-1; + f64 p2 = 3.77489470793079817668e-8; + f64 p3 = 2.69515142907905952645e-15; + f64 abs_x = math__abs_T_f64(x); + if (abs_x < _const_math__internal__root4_f64_epsilon) { + f64 x2 = x * x; + return 1.0 - 0.5 * x2; + } else { + int sgn_result = 1; + f64 y = math__floor(abs_x / (0.25 * _const_math__pi)); + int octant = ((int)(y - math__ldexp(math__floor(math__ldexp(y, -3)), 3))); + if (((octant & 1)) == 1) { + octant++; + octant &= 7; + y += 1.0; + } + if (octant > 3) { + octant -= 4; + sgn_result = -sgn_result; + } + if (octant > 1) { + sgn_result = -sgn_result; + } + f64 z = ((abs_x - y * p1) - y * p2) - y * p3; + f64 result = 0.0; + if (octant == 0) { + f64 t = 8.0 * math__abs_T_f64(z) / _const_math__pi - 1.0; + multi_return_f64_f64 mr_2597 = math__ChebSeries_eval_e(_const_math__cos_cs, t); + f64 cos_cs_val = mr_2597.arg0; + result = 1.0 - 0.5 * z * z * (1.0 - z * z * cos_cs_val); + } else { + f64 t = 8.0 * math__abs_T_f64(z) / _const_math__pi - 1.0; + multi_return_f64_f64 mr_2741 = math__ChebSeries_eval_e(_const_math__sin_cs, t); + f64 sin_cs_val = mr_2741.arg0; + result = z * (1.0 + z * z * sin_cs_val); + } + result *= sgn_result; + return result; + } + return 0; +} + +// Attr: [inline] +inline f32 math__pure_v_but_overriden_by_c_cosf(f32 a) { + return ((f32)(math__cos(a))); +} + +// Attr: [inline] +inline f32 math__pure_v_but_overriden_by_c_sinf(f32 a) { + return ((f32)(math__sin(a))); +} + +multi_return_f64_f64 math__sincos(f64 x) { + f64 p1 = 7.85398125648498535156e-1; + f64 p2 = 3.77489470793079817668e-8; + f64 p3 = 2.69515142907905952645e-15; + int sgn_x = (x < 0 ? (-1) : (1)); + f64 abs_x = math__abs_T_f64(x); + if (abs_x < _const_math__internal__root4_f64_epsilon) { + f64 x2 = x * x; + return (multi_return_f64_f64){.arg0=x * (1.0 - x2 / 6.0), .arg1=1.0 - 0.5 * x2}; + } else { + int sgn_result_sin = sgn_x; + int sgn_result_cos = 1; + f64 y = math__floor(abs_x / (0.25 * _const_math__pi)); + int octant = ((int)(y - math__ldexp(math__floor(math__ldexp(y, -3)), 3))); + if (((octant & 1)) == 1) { + octant++; + octant &= 7; + y += 1.0; + } + if (octant > 3) { + octant -= 4; + sgn_result_sin = -sgn_result_sin; + sgn_result_cos = -sgn_result_cos; + } + sgn_result_cos = (octant > 1 ? (-sgn_result_cos) : (sgn_result_cos)); + f64 z = ((abs_x - y * p1) - y * p2) - y * p3; + f64 t = 8.0 * math__abs_T_f64(z) / _const_math__pi - 1.0; + multi_return_f64_f64 mr_3838 = math__ChebSeries_eval_e(_const_math__sin_cs, t); + f64 sin_cs_val = mr_3838.arg0; + multi_return_f64_f64 mr_3879 = math__ChebSeries_eval_e(_const_math__cos_cs, t); + f64 cos_cs_val = mr_3879.arg0; + f64 result_sin = 0.0; + f64 result_cos = 0.0; + if (octant == 0) { + result_sin = z * (1.0 + z * z * sin_cs_val); + result_cos = 1.0 - 0.5 * z * z * (1.0 - z * z * cos_cs_val); + } else { + result_sin = 1.0 - 0.5 * z * z * (1.0 - z * z * cos_cs_val); + result_cos = z * (1.0 + z * z * sin_cs_val); + } + result_sin *= sgn_result_sin; + result_cos *= sgn_result_cos; + return (multi_return_f64_f64){.arg0=result_sin, .arg1=result_cos}; + } + return (multi_return_f64_f64){0}; +} + +f64 math__sinh(f64 x_) { + f64 x = x_; + f64 p0 = -0.6307673640497716991184787251e+6; + f64 p1 = -0.8991272022039509355398013511e+5; + f64 p2 = -0.2894211355989563807284660366e+4; + f64 p3 = -0.2630563213397497062819489e+2; + f64 q0 = -0.6307673640497716991212077277e+6; + f64 q1 = 0.1521517378790019070696485176e+5; + f64 q2 = -0.173678953558233699533450911e+3; + bool sign = false; + if (x < 0) { + x = -x; + sign = true; + } + f64 temp = 0.0; + if (x > 21) { + temp = math__exp(x) * 0.5; + } else if (x > 0.5) { + f64 ex = math__exp(x); + temp = (ex - 1.0 / ex) * 0.5; + } else { + f64 sq = x * x; + temp = (((p3 * sq + p2) * sq + p1) * sq + p0) * x; + temp = temp / (((sq + q2) * sq + q1) * sq + q0); + } + if (sign) { + temp = -temp; + } + return temp; +} + +f64 math__cosh(f64 x) { + f64 abs_x = math__abs_T_f64(x); + if (abs_x > 21) { + return math__exp(abs_x) * 0.5; + } + f64 ex = math__exp(abs_x); + return (ex + 1.0 / ex) * 0.5; +} + +// Attr: [inline] +inline f32 math__sqrtf(f32 a) { + return sqrtf(a); +} + +// Attr: [inline] +inline f64 math__sqrt(f64 a) { + f64 x = a; + if (x == 0.0 || math__is_nan(x) || math__is_inf(x, 1)) { + return x; + } + if (x < 0.0) { + return math__nan(); + } + multi_return_f64_int mr_258 = math__frexp(x); + f64 z = mr_258.arg0; + int ex = mr_258.arg1; + f64 w = x; + x = 4.173075996388649989089e-1 + 5.9016206709064458299663e-1 * z; + if (((ex & 1)) != 0) { + x *= _const_math__sqrt2; + } + x = math__ldexp(x, ex >> 1); + x = 0.5 * (x + w / x); + x = 0.5 * (x + w / x); + x = 0.5 * (x + w / x); + return x; +} + +// Attr: [inline] +inline f32 math__pure_v_but_overriden_by_c_sqrtf(f32 a) { + return ((f32)(math__sqrt(a))); +} + +i64 math__sqrti(i64 a) { + i64 x = a; + i64 q = ((i64)(1)); + i64 r = ((i64)(0)); + for (; q <= x; ) { + q <<= 2; + } + for (; q > 1; ) { + q >>= 2; + i64 t = x - r - q; + r >>= 1; + if (t >= 0) { + x = t; + r += q; + } + } + return r; +} + +// Attr: [inline] +inline f32 math__tanf(f32 a) { + return tanf(a); +} + +f64 math__tan(f64 a) { + f64 x = a; + if (x == 0.0 || math__is_nan(x)) { + return x; + } + if (math__is_inf(x, 0)) { + return math__nan(); + } + int sign = 1; + if (x < 0) { + x = -x; + sign = -1; + } + if (x > _const_math__tan_lossth) { + return 0.0; + } + f64 y = math__floor(x * 4.0 / _const_math__pi); + f64 z = math__ldexp(y, -3); + z = math__floor(z); + z = y - math__ldexp(z, 3); + int octant = ((int)(z)); + if (((octant & 1)) == 1) { + octant++; + y += 1.0; + } + z = ((x - y * _const_math__tan_dp1) - y * _const_math__tan_dp2) - y * _const_math__tan_dp3; + f64 zz = z * z; + if (zz > 1.0e-14) { + y = z + z * (zz * ((((*(f64*)/*ee elem_sym */array_get(_const_math__tan_p, 0)) * zz) + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_p, 1))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_p, 2))) / ((((zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 1))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 2))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 3))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 4)))); + } else { + y = z; + } + if (((octant & 2)) == 2) { + y = -1.0 / y; + } + if (sign < 0) { + y = -y; + } + return y; +} + +// Attr: [inline] +inline f32 math__pure_v_but_overriden_by_c_tanf(f32 a) { + return ((f32)(math__tan(a))); +} + +f64 math__cot(f64 a) { + f64 x = a; + if (x == 0.0) { + return math__inf(1); + } + int sign = 1; + if (x < 0) { + x = -x; + sign = -1; + } + if (x > _const_math__tan_lossth) { + return 0.0; + } + f64 y = math__floor(x * 4.0 / _const_math__pi); + f64 z = math__ldexp(y, -3); + z = math__floor(z); + z = y - math__ldexp(z, 3); + int octant = ((int)(z)); + if (((octant & 1)) == 1) { + octant++; + y += 1.0; + } + z = ((x - y * _const_math__tan_dp1) - y * _const_math__tan_dp2) - y * _const_math__tan_dp3; + f64 zz = z * z; + if (zz > 1.0e-14) { + y = z + z * (zz * ((((*(f64*)/*ee elem_sym */array_get(_const_math__tan_p, 0)) * zz) + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_p, 1))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_p, 2))) / ((((zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 1))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 2))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 3))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 4)))); + } else { + y = z; + } + if (((octant & 2)) == 2) { + y = -y; + } else { + y = 1.0 / y; + } + if (sign < 0) { + y = -y; + } + return y; +} + +f64 math__tanh(f64 x) { + f64 maxlog = 8.8029691931113054295988e+01; + f64 z = math__abs_T_f64(x); + if (z > 0.5 * maxlog) { + if (x < 0) { + return ((f64)(-1)); + } + return 1.0; + } else if (z >= 0.625) { + f64 s = math__exp(2.0 * z); + z = 1.0 - 2.0 / (s + 1.0); + if (x < 0) { + z = -z; + } + } else { + if (x == 0) { + return x; + } + f64 s = x * x; + z = x + x * s * (((*(f64*)/*ee elem_sym */array_get(_const_math__tanh_p, 0)) * s + (*(f64*)/*ee elem_sym */array_get(_const_math__tanh_p, 1))) * s + (*(f64*)/*ee elem_sym */array_get(_const_math__tanh_p, 2))) / (((s + (*(f64*)/*ee elem_sym */array_get(_const_math__tanh_q, 0))) * s + (*(f64*)/*ee elem_sym */array_get(_const_math__tanh_q, 1))) * s + (*(f64*)/*ee elem_sym */array_get(_const_math__tanh_q, 2))); + } + return z; +} + +u32 math__f32_bits(f32 f) { + u32 p = *((u32*)(&f)); + return p; +} + +f32 math__f32_from_bits(u32 b) { + f32 p = *((f32*)(&b)); + return p; +} + +u64 math__f64_bits(f64 f) { + u64 p = *((u64*)(&f)); + return p; +} + +f64 math__f64_from_bits(u64 b) { + f64 p = *((f64*)(&b)); + return p; +} + +f64 math__with_set_low_word(f64 f, u32 lo) { + u64 tmp = math__f64_bits(f); + tmp &= 0xffffffff00000000U; + tmp |= ((u64)(lo)); + return math__f64_from_bits(tmp); +} + +f64 math__with_set_high_word(f64 f, u32 hi) { + u64 tmp = math__f64_bits(f); + tmp &= 0x00000000ffffffffU; + tmp |= ((u64)(hi)) << 32U; + return math__f64_from_bits(tmp); +} + +u32 math__get_high_word(f64 f) { + return ((u32)(math__f64_bits(f) >> 32U)); +} + VV_LOCAL_SYMBOL Option_string v__pkgconfig__desc(string mod) { v__pkgconfig__Options options = ((v__pkgconfig__Options){.path = (string){.str=(byteptr)"", .is_lit=1},.debug = 0,.norecurse = 0,.only_description = true,.use_default_paths = true,}); Option_v__pkgconfig__PkgConfig_ptr _t1 = v__pkgconfig__load(mod, options); @@ -34375,44 +35358,6 @@ Array_string v__pkgconfig__list(void) { return _t5; } -// Attr: [inline] -inline VV_LOCAL_SYMBOL u32 rand__seed__nr_next(u32 prev) { - u32 _t1 = prev * 1664525U + 1013904223U; - return _t1; -} - -Array_u32 rand__seed__time_seed_array(int count) { - u64 ctime = time__sys_mono_now(); - u32 seed = ((u32)((ctime >> 32U ^ ((ctime & 0x00000000FFFFFFFFU))))); - Array_u32 seed_data = __new_array_with_default(0, count, sizeof(u32), 0); - for (int _t1 = 0; _t1 < count; ++_t1) { - seed = rand__seed__nr_next(seed); - array_push((array*)&seed_data, _MOV((u32[]){ rand__seed__nr_next(seed) })); - } - Array_u32 _t3 = seed_data; - return _t3; -} - -// Attr: [manualfree] -u32 rand__seed__time_seed_32(void) { - Array_u32 sa = rand__seed__time_seed_array(1); - u32 res = (*(u32*)/*ee elem_sym */array_get(sa, 0)); - array_free(&sa); - u32 _t1 = res; - return _t1; -} - -// Attr: [manualfree] -u64 rand__seed__time_seed_64(void) { - Array_u32 seed_data = rand__seed__time_seed_array(2); - u64 lower = ((u64)((*(u32*)/*ee elem_sym */array_get(seed_data, 0)))); - u64 upper = ((u64)((*(u32*)/*ee elem_sym */array_get(seed_data, 1)))); - array_free(&seed_data); - u64 res = (lower | (upper << 32U)); - u64 _t1 = res; - return _t1; -} - int runtime__nr_jobs(void) { int cpus = runtime__nr_cpus() - 1; int vjobs = string_int(os__getenv(_SLIT("VJOBS"))); @@ -34476,6 +35421,1664 @@ int runtime__nr_cpus(void) { return _t1; } +i64 time__portable_timegm(struct tm* t) { + int year = t->tm_year + 1900; + int month = t->tm_mon; + if (month > 11) { + year += month / 12; + month %= 12; + } else if (month < 0) { + int years_diff = (11 - month) / 12; + year -= years_diff; + month += 12 * years_diff; + } + i64 days_since_1970 = ((i64)(time__days_from_civil(year, month + 1, t->tm_mday))); + i64 _t1 = 60 * (60 * (24 * days_since_1970 + t->tm_hour) + t->tm_min) + t->tm_sec; + return _t1; +} + +int time__days_from_civil(int oy, int m, int d) { + int y = (m <= 2 ? (oy - 1) : (oy)); + int era = y / 400; + int yoe = y - era * 400; + int doy = (153 * (m + ((m > 2 ? (-3) : (9)))) + 2) / 5 + d - 1; + int doe = yoe * 365 + yoe / 4 - yoe / 100 + doy; + int _t1 = era * 146097 + doe - 719468; + return _t1; +} + +string time__Time_format(time__Time t) { + string _t1 = time__Time_get_fmt_str(t, time__FormatDelimiter__hyphen, time__FormatTime__hhmm24, time__FormatDate__yyyymmdd); + return _t1; +} + +string time__Time_format_ss(time__Time t) { + string _t1 = time__Time_get_fmt_str(t, time__FormatDelimiter__hyphen, time__FormatTime__hhmmss24, time__FormatDate__yyyymmdd); + return _t1; +} + +string time__Time_format_ss_milli(time__Time t) { + string _t1 = time__Time_get_fmt_str(t, time__FormatDelimiter__hyphen, time__FormatTime__hhmmss24_milli, time__FormatDate__yyyymmdd); + return _t1; +} + +string time__Time_format_ss_micro(time__Time t) { + string _t1 = time__Time_get_fmt_str(t, time__FormatDelimiter__hyphen, time__FormatTime__hhmmss24_micro, time__FormatDate__yyyymmdd); + return _t1; +} + +string time__Time_hhmm(time__Time t) { + string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm24); + return _t1; +} + +string time__Time_hhmmss(time__Time t) { + string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmmss24); + return _t1; +} + +string time__Time_hhmm12(time__Time t) { + string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm12); + return _t1; +} + +string time__Time_ymmdd(time__Time t) { + string _t1 = time__Time_get_fmt_date_str(t, time__FormatDelimiter__hyphen, time__FormatDate__yyyymmdd); + return _t1; +} + +string time__Time_ddmmy(time__Time t) { + string _t1 = time__Time_get_fmt_date_str(t, time__FormatDelimiter__dot, time__FormatDate__ddmmyyyy); + return _t1; +} + +string time__Time_md(time__Time t) { + string _t1 = time__Time_get_fmt_date_str(t, time__FormatDelimiter__space, time__FormatDate__mmmd); + return _t1; +} + +VV_LOCAL_SYMBOL string time__ordinal_suffix(int n) { + if (n > 3 && n < 21) { + string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe07, {.d_i32 = n}}, {_SLIT("th"), 0, { .d_c = 0 }}})); + return _t1; + } + int _t2 = n % 10; + + if (_t2 == (1)) { + string _t3 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe07, {.d_i32 = n}}, {_SLIT("st"), 0, { .d_c = 0 }}})); + return _t3; + } + else if (_t2 == (2)) { + string _t4 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe07, {.d_i32 = n}}, {_SLIT("nd"), 0, { .d_c = 0 }}})); + return _t4; + } + else if (_t2 == (3)) { + string _t5 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe07, {.d_i32 = n}}, {_SLIT("rd"), 0, { .d_c = 0 }}})); + return _t5; + } + else { + string _t6 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe07, {.d_i32 = n}}, {_SLIT("th"), 0, { .d_c = 0 }}})); + return _t6; + }; + return (string){.str=(byteptr)"", .is_lit=1}; +} + +string time__Time_custom_format(time__Time t, string s) { + Array_string tokens = __new_array_with_default(0, 0, sizeof(string), 0); + for (int i = 0; i < s.len; ) { + for (int j = 4; j > 0; j--) { + if (i > s.len - j) { + continue; + } + if (j == 1 || (j == 2 && Array_string_contains(_const_time__tokens_2, string_substr(s, i, i + j))) || (j == 3 && Array_string_contains(_const_time__tokens_3, string_substr(s, i, i + j))) || (j == 4 && Array_string_contains(_const_time__tokens_4, string_substr(s, i, i + j)))) { + array_push((array*)&tokens, _MOV((string[]){ string_clone(string_substr(s, i, i + j)) })); + i += (j - 1); + break; + } + } + i++; + } + strings__Builder sb = strings__new_builder(128); + for (int _t2 = 0; _t2 < tokens.len; ++_t2) { + string token = ((string*)tokens.data)[_t2]; + + if (string__eq(token, _SLIT("M"))) { + strings__Builder_write_string(&sb, int_str(t.month)); + } + else if (string__eq(token, _SLIT("MM"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.month}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("Mo"))) { + strings__Builder_write_string(&sb, time__ordinal_suffix(t.month)); + } + else if (string__eq(token, _SLIT("MMM"))) { + strings__Builder_write_string(&sb, string_substr((*(string*)/*ee elem_sym */array_get(_const_time__long_months, t.month - 1)), 0, 3)); + } + else if (string__eq(token, _SLIT("MMMM"))) { + strings__Builder_write_string(&sb, (*(string*)/*ee elem_sym */array_get(_const_time__long_months, t.month - 1))); + } + else if (string__eq(token, _SLIT("D"))) { + strings__Builder_write_string(&sb, int_str(t.day)); + } + else if (string__eq(token, _SLIT("DD"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("Do"))) { + strings__Builder_write_string(&sb, time__ordinal_suffix(t.day)); + } + else if (string__eq(token, _SLIT("DDD"))) { + strings__Builder_write_string(&sb, int_str((t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]))); + } + else if (string__eq(token, _SLIT("DDDD"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8006fe27, {.d_i32 = t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("DDDo"))) { + strings__Builder_write_string(&sb, time__ordinal_suffix(t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0])); + } + else if (string__eq(token, _SLIT("d"))) { + strings__Builder_write_string(&sb, int_str(time__Time_day_of_week(&t))); + } + else if (string__eq(token, _SLIT("dd"))) { + strings__Builder_write_string(&sb, string_substr((*(string*)/*ee elem_sym */array_get(_const_time__long_days, time__Time_day_of_week(&t) - 1)), 0, 2)); + } + else if (string__eq(token, _SLIT("ddd"))) { + strings__Builder_write_string(&sb, string_substr((*(string*)/*ee elem_sym */array_get(_const_time__long_days, time__Time_day_of_week(&t) - 1)), 0, 3)); + } + else if (string__eq(token, _SLIT("dddd"))) { + strings__Builder_write_string(&sb, (*(string*)/*ee elem_sym */array_get(_const_time__long_days, time__Time_day_of_week(&t) - 1))); + } + else if (string__eq(token, _SLIT("YY"))) { + strings__Builder_write_string(&sb, string_substr(int_str(t.year), 2, 4)); + } + else if (string__eq(token, _SLIT("YYYY"))) { + strings__Builder_write_string(&sb, int_str(t.year)); + } + else if (string__eq(token, _SLIT("H"))) { + strings__Builder_write_string(&sb, int_str(t.hour)); + } + else if (string__eq(token, _SLIT("HH"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.hour}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("h"))) { + strings__Builder_write_string(&sb, int_str((t.hour % 12))); + } + else if (string__eq(token, _SLIT("hh"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = (t.hour % 12)}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("m"))) { + strings__Builder_write_string(&sb, int_str(t.minute)); + } + else if (string__eq(token, _SLIT("mm"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("s"))) { + strings__Builder_write_string(&sb, int_str(t.second)); + } + else if (string__eq(token, _SLIT("ss"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.second}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("k"))) { + strings__Builder_write_string(&sb, int_str((t.hour + 1))); + } + else if (string__eq(token, _SLIT("kk"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = (t.hour + 1)}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("w"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x1000f, {.d_f64 = math__ceil((t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]) / 7)}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("ww"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8005002f, {.d_f64 = math__ceil((t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]) / 7)}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("wo"))) { + strings__Builder_write_string(&sb, time__ordinal_suffix(((int)(math__ceil((t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]) / 7))))); + } + else if (string__eq(token, _SLIT("Q"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe07, {.d_i32 = (t.month % 4) + 1}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("QQ"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = (t.month % 4) + 1}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("Qo"))) { + strings__Builder_write_string(&sb, time__ordinal_suffix((t.month % 4) + 1)); + } + else if (string__eq(token, _SLIT("c"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe07, {.d_i32 = time__Time_day_of_week(&t) + 1}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("N"))) { + strings__Builder_write_string(&sb, _SLIT("AD")); + } + else if (string__eq(token, _SLIT("NN"))) { + strings__Builder_write_string(&sb, _SLIT("Anno Domini")); + } + else if (string__eq(token, _SLIT("Z"))) { + int hours = time__offset() / _const_time__seconds_per_hour; + if (hours >= 0) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("+"), 0xfe07, {.d_i32 = hours}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } else { + hours = -hours; + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("-"), 0xfe07, {.d_i32 = hours}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + } + else if (string__eq(token, _SLIT("ZZ"))) { + int hours = time__offset() / _const_time__seconds_per_hour; + if (hours >= 0) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("+"), 0x8004fe27, {.d_i32 = hours}}, {_SLIT("00"), 0, { .d_c = 0 }}}))); + } else { + hours = -hours; + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("-"), 0x8004fe27, {.d_i32 = hours}}, {_SLIT("00"), 0, { .d_c = 0 }}}))); + } + } + else if (string__eq(token, _SLIT("ZZZ"))) { + int hours = time__offset() / _const_time__seconds_per_hour; + if (hours >= 0) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("+"), 0x8004fe27, {.d_i32 = hours}}, {_SLIT(":00"), 0, { .d_c = 0 }}}))); + } else { + hours = -hours; + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("-"), 0x8004fe27, {.d_i32 = hours}}, {_SLIT(":00"), 0, { .d_c = 0 }}}))); + } + } + else if (string__eq(token, _SLIT("a"))) { + if (t.hour > 12) { + strings__Builder_write_string(&sb, _SLIT("pm")); + } else { + strings__Builder_write_string(&sb, _SLIT("am")); + } + } + else if (string__eq(token, _SLIT("A"))) { + if (t.hour > 12) { + strings__Builder_write_string(&sb, _SLIT("PM")); + } else { + strings__Builder_write_string(&sb, _SLIT("AM")); + } + } + else { + strings__Builder_write_string(&sb, token); + }; + } + string _t3 = strings__Builder_str(&sb); + return _t3; +} + +string time__Time_clean(time__Time t) { + time__Time znow = time__now(); + if (t.month == znow.month && t.year == znow.year && t.day == znow.day) { + string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm24); + return _t1; + } + if (t.year == znow.year) { + string _t2 = time__Time_get_fmt_str(t, time__FormatDelimiter__space, time__FormatTime__hhmm24, time__FormatDate__mmmd); + return _t2; + } + string _t3 = time__Time_format(t); + return _t3; +} + +string time__Time_clean12(time__Time t) { + time__Time znow = time__now(); + if (t.month == znow.month && t.year == znow.year && t.day == znow.day) { + string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm12); + return _t1; + } + if (t.year == znow.year) { + string _t2 = time__Time_get_fmt_str(t, time__FormatDelimiter__space, time__FormatTime__hhmm12, time__FormatDate__mmmd); + return _t2; + } + string _t3 = time__Time_format(t); + return _t3; +} + +string time__Time_get_fmt_time_str(time__Time t, time__FormatTime fmt_time) { + if (fmt_time == time__FormatTime__no_time) { + string _t1 = _SLIT(""); + return _t1; + } + string tp = (t.hour > 11 ? (_SLIT("p.m.")) : (_SLIT("a.m."))); + int hour_ = (t.hour > 12 ? (t.hour - 12) : t.hour == 0 ? (12) : (t.hour)); + string _t3 = (string){.str=(byteptr)"", .is_lit=1}; + switch (fmt_time) { + case time__FormatTime__hhmm12: + { + _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe07, {.d_i32 = hour_}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(" "), 0xfe10, {.d_s = tp}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatTime__hhmm24: + { + _t3 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatTime__hhmmss12: + { + _t3 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, 0xfe07, {.d_i32 = hour_}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.second}}, {_SLIT(" "), 0xfe10, {.d_s = tp}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatTime__hhmmss24: + { + _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.second}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatTime__hhmmss24_milli: + { + _t3 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.second}}, {_SLIT("."), 0x8006fe27, {.d_i32 = (t.microsecond / 1000)}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatTime__hhmmss24_micro: + { + _t3 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.second}}, {_SLIT("."), 0x800cfe27, {.d_i32 = t.microsecond}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatTime__no_time: + default: + { + _t3 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown enumeration "), 0xfe10, {.d_s = time__FormatTime_str(fmt_time)}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + } + string _t2 = _t3; + return _t2; +} + +string time__Time_get_fmt_date_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatDate fmt_date) { + if (fmt_date == time__FormatDate__no_date) { + string _t1 = _SLIT(""); + return _t1; + } + string month = time__Time_smonth(&t); + string year = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = (t.year % 100)}}, {_SLIT0, 0, { .d_c = 0 }}})); + string _t2 = (string){.str=(byteptr)"", .is_lit=1}; + switch (fmt_date) { + case time__FormatDate__ddmmyy: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), 0xfe10, {.d_s = year}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__ddmmyyyy: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), 0x8008fe27, {.d_i32 = t.year}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__mmddyy: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), 0xfe10, {.d_s = year}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__mmddyyyy: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), 0x8008fe27, {.d_i32 = t.year}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__mmmd: + { + _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = month}}, {_SLIT("|"), 0xfe07, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__mmmdd: + { + _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__mmmddyy: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), 0xfe10, {.d_s = year}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__mmmddyyyy: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), 0x8008fe27, {.d_i32 = t.year}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__yyyymmdd: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0x8008fe27, {.d_i32 = t.year}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__yymmdd: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = year}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__no_date: + default: + { + _t2 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown enumeration "), 0xfe10, {.d_s = time__FormatDate_str(fmt_date)}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + } + string res = _t2; + string del = ((fmt_dlmtr == (time__FormatDelimiter__dot)) ? (_SLIT(".")) : (fmt_dlmtr == (time__FormatDelimiter__hyphen)) ? (_SLIT("-")) : (fmt_dlmtr == (time__FormatDelimiter__slash)) ? (_SLIT("/")) : (fmt_dlmtr == (time__FormatDelimiter__space)) ? (_SLIT(" ")) : (_SLIT(""))); + res = string_replace(res, _SLIT("|"), del); + string _t3 = res; + return _t3; +} + +string time__Time_get_fmt_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatTime fmt_time, time__FormatDate fmt_date) { + if (fmt_date == time__FormatDate__no_date) { + if (fmt_time == time__FormatTime__no_time) { + string _t1 = _SLIT(""); + return _t1; + } else { + string _t2 = time__Time_get_fmt_time_str(t, fmt_time); + return _t2; + } + } else { + if (fmt_time != time__FormatTime__no_time) { + string dstr = time__Time_get_fmt_date_str(t, fmt_dlmtr, fmt_date); + string tstr = time__Time_get_fmt_time_str(t, fmt_time); + string _t3 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = dstr}}, {_SLIT(" "), 0xfe10, {.d_s = tstr}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t3; + } else { + string _t4 = time__Time_get_fmt_date_str(t, fmt_dlmtr, fmt_date); + return _t4; + } + } + return (string){.str=(byteptr)"", .is_lit=1}; +} + +string time__Time_utc_string(time__Time t) { + string day_str = time__Time_weekday_str(&t); + string month_str = time__Time_smonth(&t); + string utc_string = str_intp(8, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = day_str}}, {_SLIT(", "), 0xfe07, {.d_i32 = t.day}}, {_SLIT(" "), 0xfe10, {.d_s = month_str}}, {_SLIT(" "), 0xfe07, {.d_i32 = t.year}}, {_SLIT(" "), 0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.second}}, {_SLIT(" UTC"), 0, { .d_c = 0 }}})); + string _t1 = utc_string; + return _t1; +} + +// Attr: [inline] +inline bool time__Time__eq(time__Time t1, time__Time t2) { + bool _t1 = t1._v_unix == t2._v_unix && t1.microsecond == t2.microsecond; + return _t1; +} + +// Attr: [inline] +inline bool time__Time__lt(time__Time t1, time__Time t2) { + bool _t1 = t1._v_unix < t2._v_unix || (t1._v_unix == t2._v_unix && t1.microsecond < t2.microsecond); + return _t1; +} + +// Attr: [inline] +inline time__Duration time__Time__minus(time__Time lhs, time__Time rhs) { + i64 lhs_micro = lhs._v_unix * 1000000 + lhs.microsecond; + i64 rhs_micro = rhs._v_unix * 1000000 + rhs.microsecond; + time__Duration _t1 = (lhs_micro - rhs_micro) * _const_time__microsecond; + return _t1; +} + +Option_time__Time time__parse_rfc3339(string s) { + if ((s).len == 0) { + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + string sn = string_replace_each(s, new_array_from_c_array(4, 4, sizeof(string), _MOV((string[4]){_SLIT("t"), _SLIT("T"), _SLIT("z"), _SLIT("Z")}))); + Option_time__Time _t2 = time__parse_iso8601(sn); + if (_t2.state != 0) { /*or block*/ + IError err = _t2.err; + *(time__Time*) _t2.data = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + } + + time__Time t = (*(time__Time*)_t2.data); + if (!time__Time__eq(t, ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}))) { + Option_time__Time _t3; + opt_ok(&(time__Time[]) { t }, (Option*)(&_t3), sizeof(time__Time)); + return _t3; + } + Option_int _t4 = string_index(sn, _SLIT("T")); + if (_t4.state != 0) { /*or block*/ + IError err = _t4.err; + *(int*) _t4.data = -1; + } + + int t_i = (*(int*)_t4.data); + Array_string parts = (t_i != -1 ? (new_array_from_c_array(2, 2, sizeof(string), _MOV((string[2]){string_clone(string_substr(sn, 0, t_i)), string_clone(string_substr(sn, t_i + 1, (sn).len))}))) : (string_split(sn, _SLIT(" ")))); + if (!string_contains_any((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT(" Z")) && string_contains((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT("-"))) { + Option_multi_return_int_int_int _t5 = time__parse_iso8601_date(sn); + if (_t5.state != 0) { /*or block*/ + Option_time__Time _t6; + memcpy(&_t6, &_t5, sizeof(Option)); + return _t6; + } + + multi_return_int_int_int mr_1001 = (*(multi_return_int_int_int*)_t5.data); + int year = mr_1001.arg0; + int month = mr_1001.arg1; + int day = mr_1001.arg2; + t = time__new_time(((time__Time){.year = year,.month = month,.day = day,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,})); + Option_time__Time _t7; + opt_ok(&(time__Time[]) { t }, (Option*)(&_t7), sizeof(time__Time)); + return _t7; + } + if (!string_contains((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT("-")) && string_contains((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT(":"))) { + int hour_ = 0; + int minute_ = 0; + int second_ = 0; + int microsecond_ = 0; + i64 unix_offset = ((i64)(0)); + bool is_local_time = true; + Option_multi_return_int_int_int_int_i64_bool _t8 = time__parse_iso8601_time((*(string*)/*ee elem_sym */array_get(parts, 0))); + if (_t8.state != 0) { /*or block*/ + Option_time__Time _t9; + memcpy(&_t9, &_t8, sizeof(Option)); + return _t9; + } + + multi_return_int_int_int_int_i64_bool mr_1384 = (*(multi_return_int_int_int_int_i64_bool*)_t8.data); + hour_ = mr_1384.arg0; + minute_ = mr_1384.arg1; + second_ = mr_1384.arg2; + microsecond_ = mr_1384.arg3; + unix_offset = mr_1384.arg4; + is_local_time = mr_1384.arg5; + t = time__new_time(((time__Time){.year = 0,.month = 0,.day = 0,.hour = hour_,.minute = minute_,.second = second_,.microsecond = microsecond_,._v_unix = 0,.is_local = 0,})); + if (is_local_time) { + Option_time__Time _t10; + opt_ok(&(time__Time[]) { t }, (Option*)(&_t10), sizeof(time__Time)); + return _t10; + } + i64 unix_time = t._v_unix; + if (unix_offset < 0) { + unix_time -= (-unix_offset); + } else if (unix_offset > 0) { + unix_time += unix_offset; + } + t = time__unix2(((i64)(unix_time)), t.microsecond); + Option_time__Time _t11; + opt_ok(&(time__Time[]) { t }, (Option*)(&_t11), sizeof(time__Time)); + return _t11; + } + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(9), .data={EMPTY_STRUCT_INITIALIZATION} }; +} + +Option_time__Time time__parse(string s) { + if ((s).len == 0) { + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + Option_int _t2 = string_index(s, _SLIT(" ")); + if (_t2.state != 0) { /*or block*/ + IError err = _t2.err; + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(1), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + + int pos = (*(int*)_t2.data); + string symd = string_substr(s, 0, pos); + Array_string ymd = string_split(symd, _SLIT("-")); + if (ymd.len != 3) { + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(2), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + string shms = string_substr(s, pos, (s).len); + Array_string hms = string_split(shms, _SLIT(":")); + string hour_ = string_substr((*(string*)/*ee elem_sym */array_get(hms, 0)), 1, ((*(string*)/*ee elem_sym */array_get(hms, 0))).len); + string minute_ = (*(string*)/*ee elem_sym */array_get(hms, 1)); + string second_ = (*(string*)/*ee elem_sym */array_get(hms, 2)); + int iyear = string_int((*(string*)/*ee elem_sym */array_get(ymd, 0))); + int imonth = string_int((*(string*)/*ee elem_sym */array_get(ymd, 1))); + int iday = string_int((*(string*)/*ee elem_sym */array_get(ymd, 2))); + int ihour = string_int(hour_); + int iminute = string_int(minute_); + int isecond = string_int(second_); + if (iyear > 9999 || iyear < -9999) { + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(3), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (imonth > 12 || imonth < 1) { + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(4), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (iday > 31 || iday < 1) { + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(5), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (ihour > 23 || ihour < 0) { + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(6), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (iminute > 59 || iminute < 0) { + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(7), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (isecond > 59 || isecond < 0) { + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(8), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + time__Time res = time__new_time(((time__Time){ + .year = iyear, + .month = imonth, + .day = iday, + .hour = ihour, + .minute = iminute, + .second = isecond, + .microsecond = 0, + ._v_unix = 0, + .is_local = 0, + })); + Option_time__Time _t11; + opt_ok(&(time__Time[]) { res }, (Option*)(&_t11), sizeof(time__Time)); + return _t11; +} + +Option_time__Time time__parse_iso8601(string s) { + if ((s).len == 0) { + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + Option_int _t2 = string_index(s, _SLIT("T")); + if (_t2.state != 0) { /*or block*/ + IError err = _t2.err; + *(int*) _t2.data = -1; + } + + int t_i = (*(int*)_t2.data); + Array_string parts = (t_i != -1 ? (new_array_from_c_array(2, 2, sizeof(string), _MOV((string[2]){string_clone(string_substr(s, 0, t_i)), string_clone(string_substr(s, t_i + 1, (s).len))}))) : (string_split(s, _SLIT(" ")))); + if (!(parts.len == 1 || parts.len == 2)) { + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(12), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + Option_multi_return_int_int_int _t4 = time__parse_iso8601_date((*(string*)/*ee elem_sym */array_get(parts, 0))); + if (_t4.state != 0) { /*or block*/ + Option_time__Time _t5; + memcpy(&_t5, &_t4, sizeof(Option)); + return _t5; + } + + multi_return_int_int_int mr_3646 = (*(multi_return_int_int_int*)_t4.data); + int year = mr_3646.arg0; + int month = mr_3646.arg1; + int day = mr_3646.arg2; + int hour_ = 0; + int minute_ = 0; + int second_ = 0; + int microsecond_ = 0; + i64 unix_offset = ((i64)(0)); + bool is_local_time = true; + if (parts.len == 2) { + Option_multi_return_int_int_int_int_i64_bool _t6 = time__parse_iso8601_time((*(string*)/*ee elem_sym */array_get(parts, 1))); + if (_t6.state != 0) { /*or block*/ + Option_time__Time _t7; + memcpy(&_t7, &_t6, sizeof(Option)); + return _t7; + } + + multi_return_int_int_int_int_i64_bool mr_3888 = (*(multi_return_int_int_int_int_i64_bool*)_t6.data); + hour_ = mr_3888.arg0; + minute_ = mr_3888.arg1; + second_ = mr_3888.arg2; + microsecond_ = mr_3888.arg3; + unix_offset = mr_3888.arg4; + is_local_time = mr_3888.arg5; + } + time__Time t = time__new_time(((time__Time){ + .year = year, + .month = month, + .day = day, + .hour = hour_, + .minute = minute_, + .second = second_, + .microsecond = microsecond_, + ._v_unix = 0, + .is_local = 0, + })); + if (is_local_time) { + Option_time__Time _t8; + opt_ok(&(time__Time[]) { t }, (Option*)(&_t8), sizeof(time__Time)); + return _t8; + } + i64 unix_time = t._v_unix; + if (unix_offset < 0) { + unix_time -= (-unix_offset); + } else if (unix_offset > 0) { + unix_time += unix_offset; + } + t = time__unix2(((i64)(unix_time)), t.microsecond); + Option_time__Time _t9; + opt_ok(&(time__Time[]) { t }, (Option*)(&_t9), sizeof(time__Time)); + return _t9; +} + +Option_time__Time time__parse_rfc2822(string s) { + if ((s).len == 0) { + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + Array_string fields = string_split(s, _SLIT(" ")); + if (fields.len < 5) { + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(1), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + Option_int _t3 = string_index(_const_time__months_string, (*(string*)/*ee elem_sym */array_get(fields, 2))); + if (_t3.state != 0) { /*or block*/ + IError err = _t3.err; + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(2), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + + int pos = (*(int*)_t3.data); + int mm = pos / 3 + 1; + { // Unsafe block + u8* tmstr = malloc_noscan(s.len * 2); + int count = snprintf(((char*)(tmstr)), (s.len * 2), "%s-%02d-%s %s", (*(string*)/*ee elem_sym */array_get(fields, 3)).str, mm, (*(string*)/*ee elem_sym */array_get(fields, 1)).str, (*(string*)/*ee elem_sym */array_get(fields, 4)).str); + Option_time__Time _t5 = time__parse(tos(tmstr, count)); + return _t5; + } + return (Option_time__Time){0}; +} + +VV_LOCAL_SYMBOL Option_multi_return_int_int_int time__parse_iso8601_date(string s) { + int year = 0; + int month = 0; + int day = 0; + u8 dummy = ((u8)(0)); + int count = sscanf(((char*)(s.str)), "%4d-%2d-%2d%c", &year, &month, &day, &dummy); + if (count != 3) { + return (Option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(10), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (year > 9999) { + return (Option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(13), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (month > 12) { + return (Option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(14), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (day > 31) { + return (Option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(15), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + Option_multi_return_int_int_int _t5; + opt_ok(&(multi_return_int_int_int/*X*/[]) { (multi_return_int_int_int){.arg0=year, .arg1=month, .arg2=day} }, (Option*)(&_t5), sizeof(multi_return_int_int_int)); + return _t5; +} + +VV_LOCAL_SYMBOL Option_multi_return_int_int_int_int_i64_bool time__parse_iso8601_time(string s) { + int hour_ = 0; + int minute_ = 0; + int second_ = 0; + int microsecond_ = 0; + rune plus_min_z = 'a'; + int offset_hour = 0; + int offset_minute = 0; + int count = sscanf(((char*)(s.str)), "%2d:%2d:%2d.%6d%c%2d:%2d", &hour_, &minute_, &second_, µsecond_, ((char*)(&plus_min_z)), &offset_hour, &offset_minute); + if (count < 4) { + count = sscanf(((char*)(s.str)), "%2d:%2d:%2d%c%2d:%2d", &hour_, &minute_, &second_, ((char*)(&plus_min_z)), &offset_hour, &offset_minute); + count++; + } + if (count < 4) { + return (Option_multi_return_int_int_int_int_i64_bool){ .state=2, .err=time__error_invalid_time(10), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + bool is_local_time = plus_min_z == 'a' && count == 4; + bool is_utc = plus_min_z == 'Z' && count == 5; + if (!(count == 7 || is_local_time || is_utc)) { + return (Option_multi_return_int_int_int_int_i64_bool){ .state=2, .err=time__error_invalid_time(11), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (plus_min_z != '+' && plus_min_z != '-' && !is_utc && !is_local_time) { + return (Option_multi_return_int_int_int_int_i64_bool){ .state=2, .err=time__error_invalid_time(12), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + int unix_offset = 0; + if (offset_hour > 0) { + unix_offset += 3600 * offset_hour; + } + if (offset_minute > 0) { + unix_offset += 60 * offset_minute; + } + if (plus_min_z == '+') { + unix_offset *= -1; + } + Option_multi_return_int_int_int_int_i64_bool _t4; + opt_ok(&(multi_return_int_int_int_int_i64_bool/*X*/[]) { (multi_return_int_int_int_int_i64_bool){.arg0=hour_, .arg1=minute_, .arg2=second_, .arg3=microsecond_, .arg4=unix_offset, .arg5=is_local_time} }, (Option*)(&_t4), sizeof(multi_return_int_int_int_int_i64_bool)); + return _t4; +} + +string time__TimeParseError_msg(time__TimeParseError err) { + string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("Invalid time format code: "), 0xfe07, {.d_i32 = err.code}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t1; +} + +VV_LOCAL_SYMBOL IError time__error_invalid_time(int code) { + IError _t1 = I_time__TimeParseError_to_Interface_IError(((time__TimeParseError*)memdup(&(time__TimeParseError){.Error = ((Error){EMPTY_STRUCT_INITIALIZATION}),.code = code,}, sizeof(time__TimeParseError)))); + return _t1; +} + +time__StopWatch time__new_stopwatch(time__StopWatchOptions opts) { + u64 initial = ((u64)(0U)); + if (opts.auto_start) { + initial = time__sys_mono_now(); + } + time__StopWatch _t1 = ((time__StopWatch){.elapsed = 0U,.start = initial,.end = 0U,}); + return _t1; +} + +void time__StopWatch_start(time__StopWatch* t) { + t->start = time__sys_mono_now(); + t->end = 0U; +} + +void time__StopWatch_restart(time__StopWatch* t) { + t->start = time__sys_mono_now(); + t->end = 0U; + t->elapsed = 0U; +} + +void time__StopWatch_stop(time__StopWatch* t) { + t->end = time__sys_mono_now(); +} + +void time__StopWatch_pause(time__StopWatch* t) { + if (t->start > 0U) { + if (t->end == 0U) { + t->elapsed += time__sys_mono_now() - t->start; + } else { + t->elapsed += t->end - t->start; + } + } + t->start = 0U; +} + +time__Duration time__StopWatch_elapsed(time__StopWatch t) { + if (t.start > 0U) { + if (t.end == 0U) { + time__Duration _t1 = ((((i64)(time__sys_mono_now() - t.start + t.elapsed)))); + return _t1; + } else { + time__Duration _t2 = ((((i64)(t.end - t.start + t.elapsed)))); + return _t2; + } + } + time__Duration _t3 = ((((i64)(t.elapsed)))); + return _t3; +} + +time__Time time__now(void) { + #if defined(__APPLE__) + { + time__Time _t1 = time__darwin_now(); + return _t1; + } + #endif + #if defined(_WIN32) + { + time__Time _t2 = time__win_now(); + return _t2; + } + #endif + #if defined(__sun) + { + time__Time _t3 = time__solaris_now(); + return _t3; + } + #endif + #if defined(__linux__) || defined(__ANDROID__) + { + time__Time _t4 = time__linux_now(); + return _t4; + } + #endif + time_t t = time(0); + struct tm* now = localtime(&t); + time__Time _t5 = time__convert_ctime(*now, 0); + return _t5; +} + +time__Time time__utc(void) { + #if defined(__APPLE__) + { + time__Time _t1 = time__darwin_utc(); + return _t1; + } + #endif + #if defined(_WIN32) + { + time__Time _t2 = time__win_utc(); + return _t2; + } + #endif + #if defined(__sun) + { + time__Time _t3 = time__solaris_utc(); + return _t3; + } + #endif + #if defined(__linux__) || defined(__ANDROID__) + { + time__Time _t4 = time__linux_utc(); + return _t4; + } + #endif + time_t t = time(0); + time(&t); + time__Time _t5 = time__unix2(((i64)(t)), 0); + return _t5; +} + +time__Time time__new_time(time__Time t) { + if (t._v_unix != 0) { + time__Time _t1 = t; + return _t1; + } + struct tm tt = ((struct tm){ + .tm_sec = t.second, + .tm_min = t.minute, + .tm_hour = t.hour, + .tm_mday = t.day, + .tm_mon = t.month - 1, + .tm_year = t.year - 1900, + .tm_wday = 0, + .tm_yday = 0, + .tm_isdst = 0, + }); + i64 utime = time__make_unix_time(tt); + time__Time _t2 = ((time__Time){t.year,t.month,t.day,t.hour,t.minute,t.second,t.microsecond,._v_unix = utime,t.is_local,}); + return _t2; +} + +i64 time__ticks(void) { + #if defined(_WIN32) + { + i64 _t1 = GetTickCount(); + return _t1; + } + #else + { + struct timeval ts = ((struct timeval){.tv_sec = 0,.tv_usec = 0,}); + gettimeofday(&ts, 0); + i64 _t2 = ((i64)(ts.tv_sec * ((u64)(1000U)) + (ts.tv_usec / ((u64)(1000U))))); + return _t2; + } + #endif + return 0; +} + +string time__Time_str(time__Time t) { + string _t1 = time__Time_format_ss(t); + return _t1; +} + +VV_LOCAL_SYMBOL time__Time time__convert_ctime(struct tm t, int microsecond) { + time__Time _t1 = ((time__Time){ + .year = t.tm_year + 1900, + .month = t.tm_mon + 1, + .day = t.tm_mday, + .hour = t.tm_hour, + .minute = t.tm_min, + .second = t.tm_sec, + .microsecond = microsecond, + ._v_unix = time__make_unix_time(t), + .is_local = true, + }); + return _t1; +} + +string time__Time_strftime(time__Time t, string fmt) { + struct tm* tm = ((struct tm*)memdup(&(struct tm){.tm_sec = 0,.tm_min = 0,.tm_hour = 0,.tm_mday = 0,.tm_mon = 0,.tm_year = 0,.tm_wday = 0,.tm_yday = 0,.tm_isdst = 0,}, sizeof(struct tm))); + #if defined(_WIN32) + { + tm = gmtime(((voidptr)(&t._v_unix))); + } + #else + { + gmtime_r(((voidptr)(&t._v_unix)), tm); + } + #endif + Array_fixed_C__char_1024 buf = {0}; + char* fmt_c = ((char*)(fmt.str)); + strftime(&buf[0], ((size_t)(sizeof(Array_fixed_C__char_1024))), fmt_c, tm); + string _t1 = cstring_to_vstring(((char*)(&buf[0]))); + return _t1; +} + +string time__Time_smonth(time__Time* t) { + if (t->month <= 0 || t->month > 12) { + string _t1 = _SLIT("---"); + return _t1; + } + int i = t->month - 1; + string _t2 = string_substr(_const_time__months_string, i * 3, (i + 1) * 3); + return _t2; +} + +// Attr: [inline] +inline i64 time__Time_unix_time(time__Time* t) { + i64 _t1 = t->_v_unix; + return _t1; +} + +// Attr: [inline] +inline i64 time__Time_unix_time_milli(time__Time* t) { + i64 _t1 = t->_v_unix * 1000 + (t->microsecond / 1000); + return _t1; +} + +time__Time time__Time_add(time__Time* t, time__Duration d) { + i64 microseconds = ((i64)(t->_v_unix)) * 1000000 + t->microsecond + time__Duration_microseconds(d); + i64 _v_unix = microseconds / 1000000; + i64 micro = microseconds % 1000000; + time__Time _t1 = time__unix2(_v_unix, ((int)(micro))); + return _t1; +} + +time__Time time__Time_add_seconds(time__Time* t, int seconds) { + time__Time _t1 = time__Time_add(t, seconds * _const_time__second); + return _t1; +} + +time__Time time__Time_add_days(time__Time* t, int days) { + time__Time _t1 = time__Time_add(t, days * 24 * _const_time__hour); + return _t1; +} + +time__Duration time__since(time__Time t) { + time__Duration _t1 = time__Time__minus(time__now(), t); + return _t1; +} + +string time__Time_relative(time__Time* t) { + time__Time znow = time__now(); + i64 secs = znow._v_unix - t->_v_unix; + if (secs <= 30) { + string _t1 = _SLIT("now"); + return _t1; + } + if (secs < 60) { + string _t2 = _SLIT("1m"); + return _t2; + } + if (secs < 3600) { + i64 m = secs / 60; + if (m == 1) { + string _t3 = _SLIT("1 minute ago"); + return _t3; + } + string _t4 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = m}}, {_SLIT(" minutes ago"), 0, { .d_c = 0 }}})); + return _t4; + } + if (secs < 86400) { + i64 h = secs / 3600; + if (h == 1) { + string _t5 = _SLIT("1 hour ago"); + return _t5; + } + string _t6 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = h}}, {_SLIT(" hours ago"), 0, { .d_c = 0 }}})); + return _t6; + } + if (secs < 432000) { + i64 d = secs / 3600 / 24; + if (d == 1) { + string _t7 = _SLIT("1 day ago"); + return _t7; + } + string _t8 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = d}}, {_SLIT(" days ago"), 0, { .d_c = 0 }}})); + return _t8; + } + if (secs > 864000000) { + string _t9 = _SLIT(""); + return _t9; + } + string _t10 = time__Time_md(/*rec*/*t); + return _t10; +} + +string time__Time_relative_short(time__Time* t) { + time__Time znow = time__now(); + i64 secs = znow._v_unix - t->_v_unix; + if (secs <= 30) { + string _t1 = _SLIT("now"); + return _t1; + } + if (secs < 60) { + string _t2 = _SLIT("1m"); + return _t2; + } + if (secs < 3600) { + string _t3 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = secs / 60}}, {_SLIT("m"), 0, { .d_c = 0 }}})); + return _t3; + } + if (secs < 86400) { + string _t4 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = secs / 3600}}, {_SLIT("h"), 0, { .d_c = 0 }}})); + return _t4; + } + if (secs < 432000) { + string _t5 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = secs / 3600 / 24}}, {_SLIT("d"), 0, { .d_c = 0 }}})); + return _t5; + } + if (secs > 864000000) { + string _t6 = _SLIT(""); + return _t6; + } + string _t7 = time__Time_md(/*rec*/*t); + return _t7; +} + +int time__day_of_week(int y, int m, int d) { + Array_int t = new_array_from_c_array(12, 12, sizeof(int), _MOV((int[12]){ + 0, 3, 2, 5, 0, 3, 5, 1, 4, + 6, 2, 4})); + int sy = y; + if (m < 3) { + sy = sy - 1; + } + int _t1 = (sy + sy / 4 - sy / 100 + sy / 400 + (*(int*)/*ee elem_sym */array_get(t, m - 1)) + d - 1) % 7 + 1; + return _t1; +} + +int time__Time_day_of_week(time__Time* t) { + int _t1 = time__day_of_week(t->year, t->month, t->day); + return _t1; +} + +string time__Time_weekday_str(time__Time* t) { + int i = time__Time_day_of_week(t) - 1; + string _t1 = string_substr((*(string*)/*ee elem_sym */array_get(_const_time__long_days, i)), 0, 3); + return _t1; +} + +string time__Time_long_weekday_str(time__Time* t) { + int i = time__Time_day_of_week(t) - 1; + string _t1 = (*(string*)/*ee elem_sym */array_get(_const_time__long_days, i)); + return _t1; +} + +bool time__is_leap_year(int year) { + bool _t1 = (year % 4 == 0) && (year % 100 != 0 || year % 400 == 0); + return _t1; +} + +Option_int time__days_in_month(int month, int year) { + if (month > 12 || month < 1) { + return (Option_int){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("Invalid month: "), 0xfe07, {.d_i32 = month}}, {_SLIT0, 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + int extra = (month == 2 && time__is_leap_year(year) ? (1) : (0)); + int res = (*(int*)/*ee elem_sym */array_get(_const_time__month_days, month - 1)) + extra; + Option_int _t2; + opt_ok(&(int[]) { res }, (Option*)(&_t2), sizeof(int)); + return _t2; +} + +string time__Time_debug(time__Time* t) { + string _t1 = str_intp(9, _MOV((StrIntpData[]){{_SLIT("Time{ year: "), 0x8008fe27, {.d_i32 = t->year}}, {_SLIT(" month: "), 0x8004fe27, {.d_i32 = t->month}}, {_SLIT(" day: "), 0x8004fe27, {.d_i32 = t->day}}, {_SLIT(" hour: "), 0x8004fe27, {.d_i32 = t->hour}}, {_SLIT(" minute: "), 0x8004fe27, {.d_i32 = t->minute}}, {_SLIT(" second: "), 0x8004fe27, {.d_i32 = t->second}}, {_SLIT(" microsecond: "), 0x800cfe27, {.d_i32 = t->microsecond}}, {_SLIT(" unix: "), 0x800efe29, {.d_i64 = t->_v_unix}}, {_SLIT(" }"), 0, { .d_c = 0 }}})); + return _t1; +} + +// TypeDecl +i64 time__Duration_nanoseconds(time__Duration d) { + i64 _t1 = ((i64)(d)); + return _t1; +} + +i64 time__Duration_microseconds(time__Duration d) { + i64 _t1 = ((i64)(d)) / 1000; + return _t1; +} + +i64 time__Duration_milliseconds(time__Duration d) { + i64 _t1 = ((i64)(d)) / 1000000; + return _t1; +} + +f64 time__Duration_seconds(time__Duration d) { + i64 sec = d / _const_time__second; + i64 nsec = d % _const_time__second; + f64 _t1 = ((f64)(sec)) + ((f64)(nsec)) / 1e9; + return _t1; +} + +f64 time__Duration_minutes(time__Duration d) { + i64 min = d / _const_time__minute; + i64 nsec = d % _const_time__minute; + f64 _t1 = ((f64)(min)) + ((f64)(nsec)) / (60 * 1e9); + return _t1; +} + +f64 time__Duration_hours(time__Duration d) { + i64 hr = d / _const_time__hour; + i64 nsec = d % _const_time__hour; + f64 _t1 = ((f64)(hr)) + ((f64)(nsec)) / (3600 * 1e9); + return _t1; +} + +string time__Duration_str(time__Duration d) { + if (time__Duration_alias_eq(d, _const_time__infinite)) { + string _t1 = _SLIT("inf"); + return _t1; + } + i64 t = ((i64)(d)); + i64 hr = t / _const_time__hour; + t -= hr * _const_time__hour; + i64 min = t / _const_time__minute; + t -= min * _const_time__minute; + i64 sec = t / _const_time__second; + t -= sec * _const_time__second; + i64 ms = t / _const_time__millisecond; + t -= ms * _const_time__millisecond; + i64 us = t / _const_time__microsecond; + t -= us * _const_time__microsecond; + i64 ns = t; + if (hr > 0) { + string _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = hr}}, {_SLIT(":"), 0x8004fe29, {.d_i64 = min}}, {_SLIT(":"), 0x8004fe29, {.d_i64 = sec}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t2; + } + if (min > 0) { + string _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = min}}, {_SLIT(":"), 0x8004fe29, {.d_i64 = sec}}, {_SLIT("."), 0x8006fe29, {.d_i64 = ms}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t3; + } + if (sec > 0) { + string _t4 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = sec}}, {_SLIT("."), 0x8006fe29, {.d_i64 = ms}}, {_SLIT("s"), 0, { .d_c = 0 }}})); + return _t4; + } + if (ms > 0) { + string _t5 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = ms}}, {_SLIT("."), 0x8006fe29, {.d_i64 = us}}, {_SLIT("ms"), 0, { .d_c = 0 }}})); + return _t5; + } + if (us > 0) { + string _t6 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = us}}, {_SLIT("."), 0x8006fe29, {.d_i64 = ns}}, {_SLIT("us"), 0, { .d_c = 0 }}})); + return _t6; + } + string _t7 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = ns}}, {_SLIT("ns"), 0, { .d_c = 0 }}})); + return _t7; +} + +int time__offset(void) { + time__Time t = time__utc(); + time__Time local = time__Time_local(&t); + int _t1 = ((int)(local._v_unix - t._v_unix)); + return _t1; +} + +VV_LOCAL_SYMBOL u64 time__sys_mono_now_darwin(void) { + u64 _t1 = 0U; + return _t1; +} + +time__Time time__darwin_now(void) { + time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + return _t1; +} + +time__Time time__solaris_now(void) { + time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + return _t1; +} + +time__Time time__darwin_utc(void) { + time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + return _t1; +} + +time__Time time__solaris_utc(void) { + time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + return _t1; +} + +VV_LOCAL_SYMBOL i64 time__make_unix_time(struct tm t) { + i64 _t1 = ((i64)(timegm(&t))); + return _t1; +} + +time__Time time__Time_local(time__Time* t) { + if (t->is_local) { + time__Time _t1 = *t; + return _t1; + } + struct tm loc_tm = ((struct tm){.tm_sec = 0,.tm_min = 0,.tm_hour = 0,.tm_mday = 0,.tm_mon = 0,.tm_year = 0,.tm_wday = 0,.tm_yday = 0,.tm_isdst = 0,}); + localtime_r(((voidptr)(&t->_v_unix)), &loc_tm); + time__Time _t2 = time__convert_ctime(loc_tm, t->microsecond); + return _t2; +} + +u64 time__sys_mono_now(void) { + #if defined(__APPLE__) + { + u64 _t1 = time__sys_mono_now_darwin(); + return _t1; + } + #else + { + struct timespec ts = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); + clock_gettime(CLOCK_MONOTONIC, &ts); + u64 _t2 = ((u64)(ts.tv_sec)) * 1000000000U + ((u64)(ts.tv_nsec)); + return _t2; + } + #endif + return 0; +} + +// Attr: [inline] +inline VV_LOCAL_SYMBOL u64 time__vpc_now(void) { + struct timespec ts = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); + clock_gettime(CLOCK_MONOTONIC, &ts); + u64 _t1 = ((u64)(ts.tv_sec)) * 1000000000U + ((u64)(ts.tv_nsec)); + return _t1; +} + +VV_LOCAL_SYMBOL time__Time time__linux_now(void) { + struct timespec ts = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); + clock_gettime(CLOCK_REALTIME, &ts); + struct tm loc_tm = ((struct tm){.tm_sec = 0,.tm_min = 0,.tm_hour = 0,.tm_mday = 0,.tm_mon = 0,.tm_year = 0,.tm_wday = 0,.tm_yday = 0,.tm_isdst = 0,}); + localtime_r(((voidptr)(&ts.tv_sec)), &loc_tm); + time__Time _t1 = time__convert_ctime(loc_tm, ((int)(ts.tv_nsec / 1000))); + return _t1; +} + +VV_LOCAL_SYMBOL time__Time time__linux_utc(void) { + struct timespec ts = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); + clock_gettime(CLOCK_REALTIME, &ts); + time__Time _t1 = time__unix2(((i64)(ts.tv_sec)), ((int)(ts.tv_nsec / 1000))); + return _t1; +} + +time__Time time__win_now(void) { + time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + return _t1; +} + +time__Time time__win_utc(void) { + time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + return _t1; +} + +struct timespec time__Duration_timespec(time__Duration d) { + struct timespec ts = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); + clock_gettime(CLOCK_REALTIME, &ts); + i64 d_sec = d / _const_time__second; + i64 d_nsec = d % _const_time__second; + ts.tv_sec += d_sec; + ts.tv_nsec += d_nsec; + if (ts.tv_nsec > ((i64)(_const_time__second))) { + ts.tv_nsec -= ((i64)(_const_time__second)); + ts.tv_sec++; + } + struct timespec _t1 = ts; + return _t1; +} + +struct timespec time__zero_timespec(void) { + struct timespec ts = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); + struct timespec _t1 = ts; + return _t1; +} + +void time__sleep(time__Duration duration) { + struct timespec req = ((struct timespec){.tv_sec = duration / _const_time__second,.tv_nsec = duration % _const_time__second,}); + struct timespec rem = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); + for (;;) { + if (!(nanosleep(&req, &rem) < 0)) break; + if (errno == EINTR) { + req = rem; + } else { + break; + } + } +} + +int time__Duration_sys_milliseconds(time__Duration d) { + if (d > INT32_MAX * _const_time__millisecond) { + int _t1 = -1; + return _t1; + } else if (d <= 0) { + int _t2 = 0; + return _t2; + } else { + int _t3 = ((int)(d / _const_time__millisecond)); + return _t3; + } + return 0; +} + +time__Time time__unix(i64 abs) { + i64 day_offset = abs / _const_time__seconds_per_day; + if (abs % _const_time__seconds_per_day < 0) { + day_offset--; + } + multi_return_int_int_int mr_472 = time__calculate_date_from_offset(day_offset); + int year = mr_472.arg0; + int month = mr_472.arg1; + int day = mr_472.arg2; + multi_return_int_int_int mr_528 = time__calculate_time_from_offset(abs % _const_time__seconds_per_day); + int hr = mr_528.arg0; + int min = mr_528.arg1; + int sec = mr_528.arg2; + time__Time _t1 = ((time__Time){ + .year = year, + .month = month, + .day = day, + .hour = hr, + .minute = min, + .second = sec, + .microsecond = 0, + ._v_unix = abs, + .is_local = 0, + }); + return _t1; +} + +time__Time time__unix2(i64 abs, int microsecond) { + i64 day_offset = abs / _const_time__seconds_per_day; + if (abs % _const_time__seconds_per_day < 0) { + day_offset--; + } + multi_return_int_int_int mr_1020 = time__calculate_date_from_offset(day_offset); + int year = mr_1020.arg0; + int month = mr_1020.arg1; + int day = mr_1020.arg2; + multi_return_int_int_int mr_1076 = time__calculate_time_from_offset(abs % _const_time__seconds_per_day); + int hr = mr_1076.arg0; + int min = mr_1076.arg1; + int sec = mr_1076.arg2; + time__Time _t1 = ((time__Time){ + .year = year, + .month = month, + .day = day, + .hour = hr, + .minute = min, + .second = sec, + .microsecond = microsecond, + ._v_unix = abs, + .is_local = 0, + }); + return _t1; +} + +VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_date_from_offset(i64 day_offset_) { + i64 day_offset = day_offset_; + int year = 2001; + day_offset -= 11323; + year += ((int)(day_offset / _const_time__days_per_400_years)) * 400; + day_offset %= _const_time__days_per_400_years; + if (day_offset == _const_time__days_per_100_years * 4) { + year += 300; + day_offset -= _const_time__days_per_100_years * 3; + } else { + year += ((int)(day_offset / _const_time__days_per_100_years)) * 100; + day_offset %= _const_time__days_per_100_years; + } + if (day_offset == _const_time__days_per_4_years * 25) { + year += 96; + day_offset -= _const_time__days_per_4_years * 24; + } else { + year += ((int)(day_offset / _const_time__days_per_4_years)) * 4; + day_offset %= _const_time__days_per_4_years; + } + if (day_offset == 1460) { + year += 3; + day_offset -= 1095; + } else { + year += ((int)(day_offset / 365)); + day_offset %= 365; + } + if (day_offset < 0) { + year--; + if (time__is_leap_year(year)) { + day_offset += 366; + } else { + day_offset += 365; + } + } + if (time__is_leap_year(year)) { + if (day_offset > 59) { + day_offset--; + } else if (day_offset == 59) { + return (multi_return_int_int_int){.arg0=year, .arg1=2, .arg2=29}; + } + } + i64 estimated_month = day_offset / 31; + for (;;) { + if (!(day_offset >= (*(int*)/*ee elem_sym */array_get(_const_time__days_before, estimated_month + 1)))) break; + estimated_month++; + } + for (;;) { + if (!(day_offset < (*(int*)/*ee elem_sym */array_get(_const_time__days_before, estimated_month)))) break; + if (estimated_month == 0) { + break; + } + estimated_month--; + } + day_offset -= (*(int*)/*ee elem_sym */array_get(_const_time__days_before, estimated_month)); + return (multi_return_int_int_int){.arg0=year, .arg1=((int)(estimated_month + 1)), .arg2=((int)(day_offset + 1))}; +} + +VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_time_from_offset(i64 second_offset_) { + i64 second_offset = second_offset_; + if (second_offset < 0) { + second_offset += _const_time__seconds_per_day; + } + i64 hour_ = second_offset / _const_time__seconds_per_hour; + second_offset %= _const_time__seconds_per_hour; + i64 min = second_offset / _const_time__seconds_per_minute; + second_offset %= _const_time__seconds_per_minute; + return (multi_return_int_int_int){.arg0=((int)(hour_)), .arg1=((int)(min)), .arg2=((int)(second_offset))}; +} + +Option_string v__util__diff__find_working_diff_command(void) { + string env_difftool = os__getenv(_SLIT("VDIFF_TOOL")); + string env_diffopts = os__getenv(_SLIT("VDIFF_OPTIONS")); + if ((env_difftool).len != 0) { + Option_string _t1; + opt_ok(&(string[]) { str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = env_difftool}}, {_SLIT(" "), 0xfe10, {.d_s = env_diffopts}}, {_SLIT0, 0, { .d_c = 0 }}})) }, (Option*)(&_t1), sizeof(string)); + return _t1; + } + Array_string known_diff_tools = __new_array_with_default(0, 0, sizeof(string), 0); + if (env_difftool.len > 0) { + array_push((array*)&known_diff_tools, _MOV((string[]){ string_clone(env_difftool) })); + } + _PUSH_MANY(&known_diff_tools, (new_array_from_c_array(8, 8, sizeof(string), _MOV((string[8]){_SLIT("colordiff"), _SLIT("gdiff"), _SLIT("diff"), _SLIT("colordiff.exe"), _SLIT("diff.exe"), _SLIT("opendiff"), _SLIT("code"), _SLIT("code.cmd")}))), _t3, Array_string); + for (int _t4 = 0; _t4 < known_diff_tools.len; ++_t4) { + string diffcmd = ((string*)known_diff_tools.data)[_t4]; + if (string__eq(diffcmd, _SLIT("opendiff"))) { + if (v__util__diff__opendiff_exists()) { + Option_string _t5; + opt_ok(&(string[]) { diffcmd }, (Option*)(&_t5), sizeof(string)); + return _t5; + } + continue; + } + os__Result p = os__execute( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = diffcmd}}, {_SLIT(" --version"), 0, { .d_c = 0 }}}))); + if (p.exit_code < 0) { + continue; + } + if (p.exit_code == 127 && string__eq(diffcmd, env_difftool)) { + return (Option_string){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("could not find specified VDIFF_TOOL "), 0xfe10, {.d_s = diffcmd}}, {_SLIT0, 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (p.exit_code == 0) { + if (string__eq(diffcmd, _SLIT("code")) || string__eq(diffcmd, _SLIT("code.cmd"))) { + Option_string _t7; + opt_ok(&(string[]) { str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = diffcmd}}, {_SLIT(" "), 0xfe10, {.d_s = env_diffopts}}, {_SLIT(" -d"), 0, { .d_c = 0 }}})) }, (Option*)(&_t7), sizeof(string)); + return _t7; + } + Option_string _t8; + opt_ok(&(string[]) { str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = diffcmd}}, {_SLIT(" "), 0xfe10, {.d_s = env_diffopts}}, {_SLIT0, 0, { .d_c = 0 }}})) }, (Option*)(&_t8), sizeof(string)); + return _t8; + } + } + return (Option_string){ .state=2, .err=_v_error(_SLIT("No working \"diff\" command found")), .data={EMPTY_STRUCT_INITIALIZATION} }; +} + +VV_LOCAL_SYMBOL bool v__util__diff__opendiff_exists(void) { + os__Result o = os__execute(_SLIT("opendiff")); + if (o.exit_code < 0) { + bool _t1 = false; + return _t1; + } + if (o.exit_code == 1) { + if (string_contains(o.output, _SLIT("too few arguments"))) { + bool _t2 = true; + return _t2; + } + } + bool _t3 = false; + return _t3; +} + +string v__util__diff__color_compare_files(string diff_cmd, string file1, string file2) { + if ((diff_cmd).len != 0) { + string full_cmd = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = diff_cmd}}, {_SLIT(" --minimal --text --unified=2 --show-function-line=\"fn \" "), 0xfe10, {.d_s = os__quoted_path(file1)}}, {_SLIT(" "), 0xfe10, {.d_s = os__quoted_path(file2)}}, {_SLIT(" "), 0, { .d_c = 0 }}})); + os__Result x = os__execute(full_cmd); + if (x.exit_code < 0) { + string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("comparison command: `"), 0xfe10, {.d_s = full_cmd}}, {_SLIT("` not found"), 0, { .d_c = 0 }}})); + return _t1; + } + string _t2 = string_trim_right(x.output, _SLIT("\r\n")); + return _t2; + } + string _t3 = _SLIT(""); + return _t3; +} + +string v__util__diff__color_compare_strings(string diff_cmd, string unique_prefix, string expected, string found) { + string cdir = os__join_path_single(os__cache_dir(), unique_prefix); + Option_bool _t1 = os__mkdir(cdir); + if (_t1.state != 0) { /*or block*/ + IError err = _t1.err; + } + + (*(bool*)_t1.data); + u64 ctime = time__sys_mono_now(); + string e_file = os__join_path_single(cdir, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe08, {.d_u64 = ctime}}, {_SLIT(".expected.txt"), 0, { .d_c = 0 }}}))); + string f_file = os__join_path_single(cdir, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe08, {.d_u64 = ctime}}, {_SLIT(".found.txt"), 0, { .d_c = 0 }}}))); + Option_void _t2 = os__write_file(e_file, expected); + if (_t2.state != 0 && _t2.err._typ != _IError_None___index) { + IError err = _t2.err; + _v_panic(IError_str(err)); + VUNREACHABLE(); + ; + } + + ; + Option_void _t3 = os__write_file(f_file, found); + if (_t3.state != 0 && _t3.err._typ != _IError_None___index) { + IError err = _t3.err; + _v_panic(IError_str(err)); + VUNREACHABLE(); + ; + } + + ; + string res = v__util__diff__color_compare_files(diff_cmd, e_file, f_file); + Option_void _t4 = os__rmdir_all(cdir); + if (_t4.state != 0 && _t4.err._typ != _IError_None___index) { + IError err = _t4.err; + } + + ; + string _t5 = res; + return _t5; +} + +// Attr: [inline] +inline VV_LOCAL_SYMBOL u32 rand__seed__nr_next(u32 prev) { + u32 _t1 = prev * 1664525U + 1013904223U; + return _t1; +} + +Array_u32 rand__seed__time_seed_array(int count) { + u64 ctime = time__sys_mono_now(); + u32 seed = ((u32)((ctime >> 32U ^ ((ctime & 0x00000000FFFFFFFFU))))); + Array_u32 seed_data = __new_array_with_default(0, count, sizeof(u32), 0); + for (int _t1 = 0; _t1 < count; ++_t1) { + seed = rand__seed__nr_next(seed); + array_push((array*)&seed_data, _MOV((u32[]){ rand__seed__nr_next(seed) })); + } + Array_u32 _t3 = seed_data; + return _t3; +} + +// Attr: [manualfree] +u32 rand__seed__time_seed_32(void) { + Array_u32 sa = rand__seed__time_seed_array(1); + u32 res = (*(u32*)/*ee elem_sym */array_get(sa, 0)); + array_free(&sa); + u32 _t1 = res; + return _t1; +} + +// Attr: [manualfree] +u64 rand__seed__time_seed_64(void) { + Array_u32 seed_data = rand__seed__time_seed_array(2); + u64 lower = ((u64)((*(u32*)/*ee elem_sym */array_get(seed_data, 0)))); + u64 upper = ((u64)((*(u32*)/*ee elem_sym */array_get(seed_data, 1)))); + array_free(&seed_data); + u64 res = (lower | (upper << 32U)); + u64 _t1 = res; + return _t1; +} + void rand__wyrand__WyRandRNG_seed(rand__wyrand__WyRandRNG* rng, Array_u32 seed_data) { if (seed_data.len != 2) { eprintln(_SLIT("WyRandRNG needs 2 32-bit unsigned integers as the seed.")); @@ -35206,7 +37809,7 @@ string rand__ascii(int len) { } v__pref__Preferences* v__pref__new_preferences(void) { - v__pref__Preferences* p = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.os = 0,.backend = 0,.build_mode = 0,.arch = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.profile_no_inline = 0,.profile_fns = __new_array(0, 0, sizeof(string)),.translated = 0,.is_prod = 0,.obfuscate = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.use_cache = 0,.retry_compilation = true,.is_stats = 0,.cflags = (string){.str=(byteptr)"", .is_lit=1},.m64 = 0,.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.ccompiler_type = 0,.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_fmt = 0,.is_vet = 0,.is_bare = 0,.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.no_preludes = 0,.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.lookup_path = __new_array(0, 0, sizeof(string)),.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.use_color = 0,.no_parallel = 0,.is_vweb = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.is_ios_simulator = 0,.is_apk = 0,.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.is_help = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.is_cstrict = 0,.assert_failure_mode = 0,.message_limit = 100,.nofloat = 0,.checker_match_exhaustive_cutoff_limit = 12,}, sizeof(v__pref__Preferences))); + v__pref__Preferences* p = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.os = 0,.backend = 0,.build_mode = 0,.arch = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.profile_no_inline = 0,.profile_fns = __new_array(0, 0, sizeof(string)),.translated = 0,.is_prod = 0,.obfuscate = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.use_cache = 0,.retry_compilation = true,.is_stats = 0,.cflags = (string){.str=(byteptr)"", .is_lit=1},.m64 = 0,.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.ccompiler_type = 0,.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_fmt = 0,.is_vet = 0,.is_bare = 0,.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.no_preludes = 0,.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.lookup_path = __new_array(0, 0, sizeof(string)),.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.use_color = 0,.no_parallel = 0,.is_vweb = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.is_ios_simulator = 0,.is_apk = 0,.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.is_help = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.is_cstrict = 0,.assert_failure_mode = 0,.message_limit = 100,.nofloat = 0,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,}, sizeof(v__pref__Preferences))); v__pref__Preferences_fill_with_defaults(p); v__pref__Preferences* _t1 = p; return _t1; @@ -35281,7 +37884,7 @@ void v__pref__Preferences_fill_with_defaults(v__pref__Preferences* p) { } #endif } - string vhash = _SLIT("b81f06e36"); + string vhash = _SLIT("b7f2ef78b"); p->cache_manager = v__vcache__new_cache_manager(new_array_from_c_array(7, 7, sizeof(string), _MOV((string[7]){string_clone(vhash), str_intp(6, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = v__pref__Backend_str(p->backend)}}, {_SLIT(" | "), 0xfe10, {.d_s = v__pref__OS_str(p->os)}}, {_SLIT(" | "), 0xfe10, {.d_s = p->ccompiler}}, {_SLIT(" | "), 0xfe10, {.d_s = p->is_prod ? _SLIT("true") : _SLIT("false")}}, {_SLIT(" | "), 0xfe10, {.d_s = p->sanitize ? _SLIT("true") : _SLIT("false")}}, {_SLIT0, 0, { .d_c = 0 }}})), string_clone(string_trim_space(p->cflags)), string_clone(string_trim_space(p->third_party_option)), string_clone(Array_string_str(p->compile_defines_all)), string_clone(Array_string_str(p->compile_defines)), string_clone(Array_string_str(p->lookup_path))}))); if (string__eq(os__user_os(), _SLIT("windows"))) { p->use_cache = false; @@ -35817,7 +38420,7 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args(Array_string kn } multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors(Array_string known_external_commands, Array_string args, bool show_output) { - v__pref__Preferences* res = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.os = 0,.backend = 0,.build_mode = 0,.arch = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.profile_no_inline = 0,.profile_fns = __new_array(0, 0, sizeof(string)),.translated = 0,.is_prod = 0,.obfuscate = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.use_cache = 0,.retry_compilation = true,.is_stats = 0,.cflags = (string){.str=(byteptr)"", .is_lit=1},.m64 = 0,.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.ccompiler_type = 0,.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_fmt = 0,.is_vet = 0,.is_bare = 0,.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.no_preludes = 0,.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.lookup_path = __new_array(0, 0, sizeof(string)),.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.use_color = 0,.no_parallel = 0,.is_vweb = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.is_ios_simulator = 0,.is_apk = 0,.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.is_help = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.is_cstrict = 0,.assert_failure_mode = 0,.message_limit = 100,.nofloat = 0,.checker_match_exhaustive_cutoff_limit = 12,}, sizeof(v__pref__Preferences))); + v__pref__Preferences* res = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.os = 0,.backend = 0,.build_mode = 0,.arch = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.profile_no_inline = 0,.profile_fns = __new_array(0, 0, sizeof(string)),.translated = 0,.is_prod = 0,.obfuscate = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.use_cache = 0,.retry_compilation = true,.is_stats = 0,.cflags = (string){.str=(byteptr)"", .is_lit=1},.m64 = 0,.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.ccompiler_type = 0,.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_fmt = 0,.is_vet = 0,.is_bare = 0,.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.no_preludes = 0,.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.lookup_path = __new_array(0, 0, sizeof(string)),.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.use_color = 0,.no_parallel = 0,.is_vweb = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.is_ios_simulator = 0,.is_apk = 0,.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.is_help = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.is_cstrict = 0,.assert_failure_mode = 0,.message_limit = 100,.nofloat = 0,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,}, sizeof(v__pref__Preferences))); #if defined(TARGET_IS_64BIT) { res->m64 = true; @@ -36194,6 +38797,10 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors res->message_limit = string_int(os__cmdline__option(current_args, arg, _SLIT("5"))); i++; } + else if (string__eq(arg, _SLIT("-thread-stack-size"))) { + res->thread_stack_size = string_int(os__cmdline__option(current_args, arg, int_str(res->thread_stack_size))); + i++; + } else if (string__eq(arg, _SLIT("-cc"))) { res->ccompiler = os__cmdline__option(current_args, _SLIT("-cc"), _SLIT("cc")); array_push((array*)&res->build_options, _MOV((string[]){ string_clone( str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = arg}}, {_SLIT(" \""), 0xfe10, {.d_s = res->ccompiler}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); @@ -39310,7 +41917,10 @@ void sync__pool__PoolProcessor_work_on_pointers(sync__pool__PoolProcessor* pool, arg__t2->arg1 = pool; arg__t2->arg2 = i; pthread_t thread__t2; - int _t2_thr_res = pthread_create(&thread__t2, NULL, (void*)sync__pool__process_in_thread_thread_wrapper, arg__t2); + pthread_attr_t thread__t2_attributes; + pthread_attr_init(&thread__t2_attributes); + pthread_attr_setstacksize(&thread__t2_attributes, 8388608); + int _t2_thr_res = pthread_create(&thread__t2, &thread__t2_attributes, (void*)sync__pool__process_in_thread_thread_wrapper, arg__t2); if (_t2_thr_res) panic_error_number(tos3("`go sync__pool__process_in_thread()`: "), _t2_thr_res); pthread_detach(thread__t2); // end go @@ -40598,6 +43208,17 @@ void v__ast__IndexExpr_recursive_mapset_is_setter(v__ast__IndexExpr* lx, bool va } } +void v__ast__IndexExpr_recursive_arraymap_set_is_setter(v__ast__IndexExpr* lx) { + lx->is_setter = true; + if ((lx->left)._typ == 269 /* v.ast.IndexExpr */) { + v__ast__IndexExpr_recursive_arraymap_set_is_setter(&(*lx->left._v__ast__IndexExpr)); + } else if ((lx->left)._typ == 286 /* v.ast.SelectorExpr */) { + if (((*lx->left._v__ast__SelectorExpr).expr)._typ == 269 /* v.ast.IndexExpr */) { + v__ast__IndexExpr_recursive_arraymap_set_is_setter(&(*(*lx->left._v__ast__SelectorExpr).expr._v__ast__IndexExpr)); + } + } +} + Map_string_v__ast__ScopeObject v__ast__all_registers(v__ast__Table* t, v__pref__Arch arch) { Map_string_v__ast__ScopeObject res = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); switch (arch) { @@ -42599,7 +45220,7 @@ v__ast__FnDecl v__ast__FnDecl_new_method_with_receiver_type(v__ast__FnDecl* f, v v__ast__FnDecl _t1 = *new_method; return _t1; } - return (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}; + return (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}; } VV_LOCAL_SYMBOL bool v__ast__Param_equals(v__ast__Param* p, v__ast__Param* o) { @@ -42623,7 +45244,7 @@ VV_LOCAL_SYMBOL bool Array_v__ast__Param_equals(Array_v__ast__Param p, Array_v__ } v__ast__Table* v__ast__new_table(void) { - v__ast__Table* t = ((v__ast__Table*)memdup(&(v__ast__Table){.parsing_type = (string){.str=(byteptr)"", .is_lit=1},.type_symbols = __new_array(0, 0, sizeof(v__ast__TypeSymbol*)),.type_idxs = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.fns = new_map(sizeof(string), sizeof(v__ast__Fn), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.iface_types = new_map(sizeof(string), sizeof(Array_v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.dumps = new_map(sizeof(int), sizeof(string), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.imports = __new_array(0, 0, sizeof(string)),.modules = __new_array(0, 0, sizeof(string)),.global_scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = 0,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))),.cflags = __new_array(0, 0, sizeof(v__cflag__CFlag)),.redefined_fns = __new_array(0, 0, sizeof(string)),.fn_generic_types = new_map(sizeof(string), sizeof(Array_Array_v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.interfaces = new_map(sizeof(int), sizeof(v__ast__InterfaceDecl), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.cmod_prefix = (string){.str=(byteptr)"", .is_lit=1},.is_fmt = 0,.used_fns = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_consts = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_globals = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_vweb_types = __new_array(0, 0, sizeof(v__ast__Type)),.used_maps = 0,.panic_handler = v__ast__default_table_panic_handler,.panic_userdata = ((voidptr)(0)),.panic_npanics = 0,.cur_fn = 0,.cur_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.gostmts = 0,.enum_decls = new_map(sizeof(string), sizeof(v__ast__EnumDecl), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.mdeprecated_msg = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.mdeprecated_after = new_map(sizeof(string), sizeof(time__Time), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.builtin_pub_fns = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),}, sizeof(v__ast__Table))); + v__ast__Table* t = ((v__ast__Table*)memdup(&(v__ast__Table){.parsing_type = (string){.str=(byteptr)"", .is_lit=1},.type_symbols = __new_array(0, 0, sizeof(v__ast__TypeSymbol*)),.type_idxs = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.fns = new_map(sizeof(string), sizeof(v__ast__Fn), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.iface_types = new_map(sizeof(string), sizeof(Array_v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.dumps = new_map(sizeof(int), sizeof(string), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.imports = __new_array(0, 0, sizeof(string)),.modules = __new_array(0, 0, sizeof(string)),.global_scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = 0,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))),.cflags = __new_array(0, 0, sizeof(v__cflag__CFlag)),.redefined_fns = __new_array(0, 0, sizeof(string)),.fn_generic_types = new_map(sizeof(string), sizeof(Array_Array_v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.interfaces = new_map(sizeof(int), sizeof(v__ast__InterfaceDecl), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.cmod_prefix = (string){.str=(byteptr)"", .is_lit=1},.is_fmt = 0,.used_fns = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_consts = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_globals = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_vweb_types = __new_array(0, 0, sizeof(v__ast__Type)),.used_maps = 0,.panic_handler = v__ast__default_table_panic_handler,.panic_userdata = ((voidptr)(0)),.panic_npanics = 0,.cur_fn = 0,.cur_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.gostmts = 0,.enum_decls = new_map(sizeof(string), sizeof(v__ast__EnumDecl), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.mdeprecated_msg = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.mdeprecated_after = new_map(sizeof(string), sizeof(time__Time), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.builtin_pub_fns = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.pointer_size = 0,}, sizeof(v__ast__Table))); v__ast__Table_register_builtin_type_symbols(t); t->is_fmt = true; v__ast__set_global_table(t); @@ -42899,9 +45520,9 @@ Option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_from continue; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_12267 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t5.data); - v__ast__Fn method = mr_12267.arg0; - Array_v__ast__Type types = mr_12267.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_12290 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t5.data); + v__ast__Fn method = mr_12290.arg0; + Array_v__ast__Type types = mr_12290.arg1; array_push((array*)&found_methods, _MOV((v__ast__Fn[]){ method })); array_push((array*)&embed_of_found_methods, _MOV((v__ast__Type[]){ embed })); _PUSH_MANY(&embed_of_found_methods, (types), _t8, Array_v__ast__Type); @@ -42933,9 +45554,9 @@ Option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_from continue; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_12925 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t15.data); - v__ast__Fn method = mr_12925.arg0; - Array_v__ast__Type types = mr_12925.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_12948 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t15.data); + v__ast__Fn method = mr_12948.arg0; + Array_v__ast__Type types = mr_12948.arg1; array_push((array*)&found_methods, _MOV((v__ast__Fn[]){ method })); array_push((array*)&embed_of_found_methods, _MOV((v__ast__Type[]){ embed })); _PUSH_MANY(&embed_of_found_methods, (types), _t18, Array_v__ast__Type); @@ -42958,9 +45579,9 @@ Option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_from continue; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_13388 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t22.data); - v__ast__Fn method = mr_13388.arg0; - Array_v__ast__Type embed_types = mr_13388.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_13411 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t22.data); + v__ast__Fn method = mr_13411.arg0; + Array_v__ast__Type embed_types = mr_13411.arg1; if (embed_types.len != 0) { Option_multi_return_v__ast__Fn_Array_v__ast__Type _t23; opt_ok(&(multi_return_v__ast__Fn_Array_v__ast__Type/*X*/[]) { (multi_return_v__ast__Fn_Array_v__ast__Type){.arg0=method, .arg1=embed_types} }, (Option*)(&_t23), sizeof(multi_return_v__ast__Fn_Array_v__ast__Type)); @@ -42987,8 +45608,8 @@ Option_v__ast__Fn v__ast__Table_find_method_with_embeds(v__ast__Table* t, v__ast return (Option_v__ast__Fn){ .state=2, .err=first_err, .data={EMPTY_STRUCT_INITIALIZATION} }; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_13849 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t3.data); - v__ast__Fn func = mr_13849.arg0; + multi_return_v__ast__Fn_Array_v__ast__Type mr_13872 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t3.data); + v__ast__Fn func = mr_13872.arg0; Option_v__ast__Fn _t5; opt_ok(&(v__ast__Fn[]) { func }, (Option*)(&_t5), sizeof(v__ast__Fn)); return _t5; @@ -43151,9 +45772,9 @@ Option_multi_return_v__ast__StructField_Array_v__ast__Type v__ast__Table_find_fi continue; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_17096 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t5.data); - v__ast__StructField field = mr_17096.arg0; - Array_v__ast__Type types = mr_17096.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_17119 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t5.data); + v__ast__StructField field = mr_17119.arg0; + Array_v__ast__Type types = mr_17119.arg1; array_push((array*)&found_fields, _MOV((v__ast__StructField[]){ field })); array_push((array*)&embeds_of_found_fields, _MOV((v__ast__Type[]){ embed })); _PUSH_MANY(&embeds_of_found_fields, (types), _t8, Array_v__ast__Type); @@ -43176,9 +45797,9 @@ Option_multi_return_v__ast__StructField_Array_v__ast__Type v__ast__Table_find_fi continue; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_17549 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t12.data); - v__ast__StructField field = mr_17549.arg0; - Array_v__ast__Type embed_types = mr_17549.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_17572 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t12.data); + v__ast__StructField field = mr_17572.arg0; + Array_v__ast__Type embed_types = mr_17572.arg1; if (embed_types.len > 0) { Option_multi_return_v__ast__StructField_Array_v__ast__Type _t13; opt_ok(&(multi_return_v__ast__StructField_Array_v__ast__Type/*X*/[]) { (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=field, .arg1=embed_types} }, (Option*)(&_t13), sizeof(multi_return_v__ast__StructField_Array_v__ast__Type)); @@ -43209,8 +45830,8 @@ Option_v__ast__StructField v__ast__Table_find_field_with_embeds(v__ast__Table* t return (Option_v__ast__StructField){ .state=2, .err=first_err, .data={EMPTY_STRUCT_INITIALIZATION} }; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_18147 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t3.data); - v__ast__StructField field = mr_18147.arg0; + multi_return_v__ast__StructField_Array_v__ast__Type mr_18170 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t3.data); + v__ast__StructField field = mr_18170.arg0; Option_v__ast__StructField _t5; opt_ok(&(v__ast__StructField[]) { field }, (Option*)(&_t5), sizeof(v__ast__StructField)); return _t5; @@ -43740,9 +46361,9 @@ int v__ast__Table_find_or_register_multi_return(v__ast__Table* t, Array_v__ast__ for (int i = 0; i < mr_typs.len; ++i) { v__ast__Type mr_typ = ((v__ast__Type*)mr_typs.data)[i]; v__ast__TypeSymbol* mr_type_sym = v__ast__Table_sym(t, v__ast__mktyp(mr_typ)); - multi_return_string_string mr_31205 = (v__ast__Type_is_ptr(mr_typ) ? ((multi_return_string_string){.arg0=_SLIT("&"),.arg1=_SLIT("ref_")}) : ((multi_return_string_string){.arg0=_SLIT(""),.arg1=_SLIT("")})); - string ref = mr_31205.arg0; - string cref = mr_31205.arg1; + multi_return_string_string mr_31228 = (v__ast__Type_is_ptr(mr_typ) ? ((multi_return_string_string){.arg0=_SLIT("&"),.arg1=_SLIT("ref_")}) : ((multi_return_string_string){.arg0=_SLIT(""),.arg1=_SLIT("")})); + string ref = mr_31228.arg0; + string cref = mr_31228.arg1; name = /*f*/string__plus(name, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = ref}}, {_SLIT0, 0xfe10, {.d_s = mr_type_sym->name}}, {_SLIT0, 0, { .d_c = 0 }}}))); cname = /*f*/string__plus(cname, str_intp(3, _MOV((StrIntpData[]){{_SLIT("_"), 0xfe10, {.d_s = cref}}, {_SLIT0, 0xfe10, {.d_s = mr_type_sym->cname}}, {_SLIT0, 0, { .d_c = 0 }}}))); if (i < mr_typs.len - 1) { @@ -45755,6 +48376,182 @@ inline bool v__ast__TypeSymbol_is_builtin(v__ast__TypeSymbol* t) { return _t1; } +int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) { + if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__optional)) { + int _t1 = v__ast__Table_type_size(t, _const_v__ast__error_type_idx); + return _t1; + } + if (v__ast__Type_nr_muls(typ) > 0) { + int _t2 = t->pointer_size; + return _t2; + } + v__ast__TypeSymbol* sym = v__ast__Table_sym(t, typ); + switch (sym->kind) { + case v__ast__Kind__placeholder: + case v__ast__Kind__void: + case v__ast__Kind__none_: + { + int _t3 = 0; + return _t3; + break; + } + case v__ast__Kind__voidptr: + case v__ast__Kind__byteptr: + case v__ast__Kind__charptr: + case v__ast__Kind__function: + case v__ast__Kind__usize: + case v__ast__Kind__isize: + case v__ast__Kind__any: + case v__ast__Kind__thread: + case v__ast__Kind__chan: + { + int _t4 = t->pointer_size; + return _t4; + break; + } + case v__ast__Kind__i8: + case v__ast__Kind__u8: + case v__ast__Kind__char: + case v__ast__Kind__bool: + { + int _t5 = 1; + return _t5; + break; + } + case v__ast__Kind__i16: + case v__ast__Kind__u16: + { + int _t6 = 2; + return _t6; + break; + } + case v__ast__Kind__int: + case v__ast__Kind__u32: + case v__ast__Kind__rune: + case v__ast__Kind__f32: + case v__ast__Kind__enum_: + { + int _t7 = 4; + return _t7; + break; + } + case v__ast__Kind__i64: + case v__ast__Kind__u64: + case v__ast__Kind__int_literal: + case v__ast__Kind__f64: + case v__ast__Kind__float_literal: + { + int _t8 = 8; + return _t8; + break; + } + case v__ast__Kind__alias: + { + int _t9 = v__ast__Table_type_size(t, (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 431) /*expected idx: 431, name: v.ast.Alias */ ).parent_type); + return _t9; + break; + } + case v__ast__Kind__struct_: + case v__ast__Kind__string: + case v__ast__Kind__multi_return: + { + int max_alignment = 0; + int total_size = 0; + Array_v__ast__Type _t10; /* if prepend */ + if ((sym->info)._typ == 416 /* v.ast.Struct */) { + Array_v__ast__Type _t11 = {0}; + Array_v__ast__StructField _t11_orig = (*sym->info._v__ast__Struct).fields; + int _t11_len = _t11_orig.len; + _t11 = __new_array(0, _t11_len, sizeof(v__ast__Type)); + + for (int _t12 = 0; _t12 < _t11_len; ++_t12) { + v__ast__StructField it = ((v__ast__StructField*) _t11_orig.data)[_t12]; + v__ast__Type ti = it.typ; + array_push((array*)&_t11, &ti); + } + _t10 =_t11; + } else { + _t10 = (/* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 442) /*expected idx: 442, name: v.ast.MultiReturn */ ).types; + } + Array_v__ast__Type types = _t10; + for (int _t13 = 0; _t13 < types.len; ++_t13) { + v__ast__Type ftyp = ((v__ast__Type*)types.data)[_t13]; + int field_size = v__ast__Table_type_size(t, ftyp); + int alignment = (field_size > t->pointer_size ? (t->pointer_size) : (field_size)); + if (alignment > max_alignment) { + max_alignment = alignment; + } + total_size = v__ast__round_up(total_size, alignment) + field_size; + } + int _t14 = v__ast__round_up(total_size, max_alignment); + return _t14; + break; + } + case v__ast__Kind__sum_type: + case v__ast__Kind__interface_: + case v__ast__Kind__aggregate: + { + if (sym->info._typ == 435 /* v.ast.SumType */) { + int _t15 = ((*sym->info._v__ast__SumType).fields.len + 2) * t->pointer_size; + return _t15; + } + else if (sym->info._typ == 429 /* v.ast.Aggregate */) { + int _t16 = ((*sym->info._v__ast__Aggregate).fields.len + 2) * t->pointer_size; + return _t16; + } + else if (sym->info._typ == 434 /* v.ast.Interface */) { + int res = ((*sym->info._v__ast__Interface).fields.len + 2) * t->pointer_size; + for (int _t17 = 0; _t17 < (*sym->info._v__ast__Interface).embeds.len; ++_t17) { + v__ast__Type etyp = ((v__ast__Type*)(*sym->info._v__ast__Interface).embeds.data)[_t17]; + res += v__ast__Table_type_size(t, etyp) - 2 * t->pointer_size; + } + int _t18 = res; + return _t18; + } + + else { + int _t19 = 0; + return _t19; + } + ; + break; + } + case v__ast__Kind__array_fixed: + { + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 439) /*expected idx: 439, name: v.ast.ArrayFixed */ ; + int _t20 = info.size * v__ast__Table_type_size(t, info.elem_type); + return _t20; + break; + } + case v__ast__Kind__map: + { + int _t21 = (t->pointer_size == 8 ? (120) : (80)); + return _t21; + break; + } + case v__ast__Kind__array: + { + int _t22 = (t->pointer_size == 8 ? (32) : (24)); + return _t22; + break; + } + case v__ast__Kind__generic_inst: + { + int _t23 = 0; + return _t23; + break; + } + } + ; + return 0; +} + +// Attr: [inline] +inline VV_LOCAL_SYMBOL int v__ast__round_up(int n, int multiple) { + int _t1 = ((n + multiple - 1) & -multiple); + return _t1; +} + string v__ast__Kind_str(v__ast__Kind k) { string _t2 = (string){.str=(byteptr)"", .is_lit=1}; switch (k) { @@ -48266,44 +51063,6 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ } } -int v__checker__Checker_sizeof_integer(v__checker__Checker* c, v__ast__Type a) { - v__ast__Type t = (Array_int_contains(_const_v__ast__unsigned_integer_type_idxs, a) ? (v__ast__Type_flip_signedness(a)) : (a)); - int_literal _t1 = 0; - - if (t == (_const_v__ast__char_type_idx) || t == (_const_v__ast__i8_type_idx)) { - _t1 = 1; - } - else if (t == (_const_v__ast__i16_type_idx)) { - _t1 = 2; - } - else if (t == (_const_v__ast__int_type_idx)) { - _t1 = 4; - } - else if (t == (_const_v__ast__rune_type_idx)) { - _t1 = 4; - } - else if (t == (_const_v__ast__i64_type_idx)) { - _t1 = 8; - } - else if (t == (_const_v__ast__isize_type_idx)) { - _t1 = (c->pref->m64 ? (8) : (4)); - } - else if (t == (_const_v__ast__int_literal_type)) { - string s = v__ast__Table_type_to_str(c->table, a); - _v_panic( str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), 0xfe10, {.d_s = s}}, {_SLIT("` has unknown size"), 0, { .d_c = 0 }}}))); - VUNREACHABLE(); - _t1 = 0; - } - else { - string s = v__ast__Table_type_to_str(c->table, a); - _v_panic( str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), 0xfe10, {.d_s = s}}, {_SLIT("` is not an integer"), 0, { .d_c = 0 }}}))); - VUNREACHABLE(); - _t1 = 0; - }int r = _t1; - int _t2 = r; - return _t2; -} - VV_LOCAL_SYMBOL Array_string v__checker__all_valid_comptime_idents(void) { Array_string res = __new_array_with_default(0, 0, sizeof(string), 0); _PUSH_MANY(&res, (_const_v__checker__valid_comptime_if_os), _t1, Array_string); @@ -48322,7 +51081,7 @@ v__checker__Checker* v__checker__new_checker(v__ast__Table* table, v__pref__Pref timers_should_print = true; } #endif - v__checker__Checker* _t1 = ((v__checker__Checker*)memdup(&(v__checker__Checker){.pref = pref,.table = table,.file = 0,.nr_errors = 0,.nr_warnings = 0,.nr_notices = 0,.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.error_lines = __new_array(0, 0, sizeof(int)),.expected_type = 0,.expected_or_type = 0,.expected_expr_type = 0,.mod = (string){.str=(byteptr)"", .is_lit=1},.const_decl = (string){.str=(byteptr)"", .is_lit=1},.const_deps = __new_array(0, 0, sizeof(string)),.const_names = __new_array(0, 0, sizeof(string)),.global_names = __new_array(0, 0, sizeof(string)),.locked_names = __new_array(0, 0, sizeof(string)),.rlocked_names = __new_array(0, 0, sizeof(string)),.in_for_count = 0,.should_abort = 0,.returns = 0,.scope_returns = 0,.is_builtin_mod = 0,.is_just_builtin_mod = 0,.is_generated = 0,.inside_unsafe = 0,.inside_const = 0,.inside_anon_fn = 0,.inside_ref_lit = 0,.inside_defer = 0,.inside_fn_arg = 0,.inside_ct_attr = 0,.inside_comptime_for_field = 0,.skip_flags = 0,.fn_level = 0,.smartcast_mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.smartcast_cond_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.ct_cond_stack = __new_array(0, 0, sizeof(v__ast__Expr)),.stmt_level = 0,.files = __new_array(0, 0, sizeof(v__ast__File)),.expr_level = 0,.cur_orm_ts = (v__ast__TypeSymbol){.parent_idx = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.cname = (string){.str=(byteptr)"", .is_lit=1},.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.idx = 0,},.error_details = __new_array(0, 0, sizeof(string)),.vmod_file_content = (string){.str=(byteptr)"", .is_lit=1},.loop_label = (string){.str=(byteptr)"", .is_lit=1},.vweb_gen_types = __new_array(0, 0, sizeof(v__ast__Type)),.timers = v__util__new_timers(((v__util__TimerParams){.should_print = timers_should_print,.label = _SLIT("checker"),})),.comptime_fields_default_type = 0,.comptime_fields_type = new_map(sizeof(string), sizeof(v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.fn_scope = ((voidptr)(0)),.main_fn_decl_node = (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.match_exhaustive_cutoff_limit = pref->checker_match_exhaustive_cutoff_limit,.is_last_stmt = 0,.prevent_sum_type_unwrapping_once = 0,.using_new_err_struct = 0,.need_recheck_generic_fns = 0,.inside_sql = 0,.inside_selector_expr = 0,.inside_println_arg = 0,.inside_decl_rhs = 0,.inside_if_guard = 0,.comptime_call_pos = 0,}, sizeof(v__checker__Checker))); + v__checker__Checker* _t1 = ((v__checker__Checker*)memdup(&(v__checker__Checker){.pref = pref,.table = table,.file = 0,.nr_errors = 0,.nr_warnings = 0,.nr_notices = 0,.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.error_lines = __new_array(0, 0, sizeof(int)),.expected_type = 0,.expected_or_type = 0,.expected_expr_type = 0,.mod = (string){.str=(byteptr)"", .is_lit=1},.const_decl = (string){.str=(byteptr)"", .is_lit=1},.const_deps = __new_array(0, 0, sizeof(string)),.const_names = __new_array(0, 0, sizeof(string)),.global_names = __new_array(0, 0, sizeof(string)),.locked_names = __new_array(0, 0, sizeof(string)),.rlocked_names = __new_array(0, 0, sizeof(string)),.in_for_count = 0,.should_abort = 0,.returns = 0,.scope_returns = 0,.is_builtin_mod = 0,.is_just_builtin_mod = 0,.is_generated = 0,.inside_unsafe = 0,.inside_const = 0,.inside_anon_fn = 0,.inside_ref_lit = 0,.inside_defer = 0,.inside_fn_arg = 0,.inside_ct_attr = 0,.inside_comptime_for_field = 0,.skip_flags = 0,.fn_level = 0,.smartcast_mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.smartcast_cond_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.ct_cond_stack = __new_array(0, 0, sizeof(v__ast__Expr)),.stmt_level = 0,.files = __new_array(0, 0, sizeof(v__ast__File)),.expr_level = 0,.cur_orm_ts = (v__ast__TypeSymbol){.parent_idx = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.cname = (string){.str=(byteptr)"", .is_lit=1},.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.idx = 0,},.error_details = __new_array(0, 0, sizeof(string)),.vmod_file_content = (string){.str=(byteptr)"", .is_lit=1},.loop_label = (string){.str=(byteptr)"", .is_lit=1},.vweb_gen_types = __new_array(0, 0, sizeof(v__ast__Type)),.timers = v__util__new_timers(((v__util__TimerParams){.should_print = timers_should_print,.label = _SLIT("checker"),})),.comptime_fields_default_type = 0,.comptime_fields_type = new_map(sizeof(string), sizeof(v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.fn_scope = ((voidptr)(0)),.main_fn_decl_node = (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.match_exhaustive_cutoff_limit = pref->checker_match_exhaustive_cutoff_limit,.is_last_stmt = 0,.prevent_sum_type_unwrapping_once = 0,.using_new_err_struct = 0,.need_recheck_generic_fns = 0,.inside_sql = 0,.inside_selector_expr = 0,.inside_println_arg = 0,.inside_decl_rhs = 0,.inside_if_guard = 0,.comptime_call_pos = 0,}, sizeof(v__checker__Checker))); return _t1; } @@ -48516,6 +51275,7 @@ void v__checker__Checker_check_files(v__checker__Checker* c, Array_v__ast__File_ .is_direct_arr = 0, .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), .ctdefine_idx = -1, + .idx = 0, .params = __new_array(0, 0, sizeof(v__ast__Param)), .stmts = __new_array(0, 0, sizeof(v__ast__Stmt)), .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), @@ -48944,8 +51704,8 @@ v__ast__Type former_expected_type; v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("negative value cannot be compared with `"), 0xfe10, {.d_s = rt}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*node->left._v__ast__IntegerLiteral).pos); } } else if (is_left_type_signed != is_right_type_signed && left_type != _const_v__ast__int_literal_type_idx && right_type != _const_v__ast__int_literal_type_idx) { - int ls = v__checker__Checker_sizeof_integer(c, left_type); - int rs = v__checker__Checker_sizeof_integer(c, right_type); + int ls = v__ast__Table_type_size(c->table, left_type); + int rs = v__ast__Table_type_size(c->table, right_type); if ((is_left_type_signed && ls < rs) || (is_right_type_signed && rs < ls)) { string lt = v__ast__Table_sym(c->table, left_type)->name; string rt = v__ast__Table_sym(c->table, right_type)->name; @@ -49024,7 +51784,7 @@ v__ast__Type former_expected_type; if ((left_sym->info)._typ == 431 /* v.ast.Alias */ && (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 431) /*expected idx: 431, name: v.ast.Alias */ ).language != v__ast__Language__c && string__eq(c->mod, (*(string*)/*ee elem_sym */array_get(string_split(v__ast__Table_type_to_str(c->table, left_type), _SLIT(".")), 0))) && v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 431) /*expected idx: 431, name: v.ast.Alias */ ).parent_type))) { left_sym = v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 431) /*expected idx: 431, name: v.ast.Alias */ ).parent_type); } - if (c->pref->translated && (node->op == v__token__Kind__plus || node->op == v__token__Kind__minus || node->op == v__token__Kind__mul) && v__ast__Type_is_any_kind_of_pointer(left_type) && (v__ast__Type_is_any_kind_of_pointer(right_type) || v__ast__Type_is_int(right_type))) { + if (c->pref->translated && (node->op == v__token__Kind__plus || node->op == v__token__Kind__minus || node->op == v__token__Kind__mul) && v__ast__Type_is_any_kind_of_pointer(left_type) && v__ast__Type_is_any_kind_of_pointer(right_type)) { return_type = left_type; } else if (!c->pref->translated && left_sym->kind == v__ast__Kind__alias && (left_sym->info)._typ == 431 /* v.ast.Alias */ && !(v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 431) /*expected idx: 431, name: v.ast.Alias */ ).parent_type)))) { if (v__ast__TypeSymbol_has_method(left_sym, v__token__Kind_str(node->op))) { @@ -49065,7 +51825,7 @@ v__ast__Type former_expected_type; } } } - if (left_sym->kind == v__ast__Kind__array || left_sym->kind == v__ast__Kind__array_fixed || left_sym->kind == v__ast__Kind__map || left_sym->kind == v__ast__Kind__struct_) { + if (!c->pref->translated && (left_sym->kind == v__ast__Kind__array || left_sym->kind == v__ast__Kind__array_fixed || left_sym->kind == v__ast__Kind__map || left_sym->kind == v__ast__Kind__struct_)) { if (v__ast__TypeSymbol_has_method_with_generic_parent(left_sym, v__token__Kind_str(node->op))) { Option_v__ast__Fn _t7; if (_t7 = v__ast__TypeSymbol_find_method_with_generic_parent(left_sym, v__token__Kind_str(node->op)), _t7.state == 0) { @@ -49084,7 +51844,7 @@ v__ast__Type former_expected_type; v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("mismatched types `"), 0xfe10, {.d_s = left_name}}, {_SLIT("` and `"), 0xfe10, {.d_s = right_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), left_right_pos); } } - } else if (right_sym->kind == v__ast__Kind__array || right_sym->kind == v__ast__Kind__array_fixed || right_sym->kind == v__ast__Kind__map || right_sym->kind == v__ast__Kind__struct_) { + } else if (!c->pref->translated && (right_sym->kind == v__ast__Kind__array || right_sym->kind == v__ast__Kind__array_fixed || right_sym->kind == v__ast__Kind__map || right_sym->kind == v__ast__Kind__struct_)) { if (v__ast__TypeSymbol_has_method_with_generic_parent(right_sym, v__token__Kind_str(node->op))) { Option_v__ast__Fn _t8; if (_t8 = v__ast__TypeSymbol_find_method_with_generic_parent(right_sym, v__token__Kind_str(node->op)), _t8.state == 0) { @@ -49218,8 +51978,8 @@ v__ast__Type former_expected_type; v__checker__Checker_error(c, _SLIT("array append cannot be used in an expression"), node->pos); } v__checker__Checker_check_expr_opt_call(c, node->right, right_type); - multi_return_string_v__token__Pos mr_33947 = v__checker__Checker_fail_if_immutable(c, node->left); - node->auto_locked = mr_33947.arg0; + multi_return_string_v__token__Pos mr_33844 = v__checker__Checker_fail_if_immutable(c, node->left); + node->auto_locked = mr_33844.arg0; v__ast__Type left_value_type = v__ast__Table_value_type(c->table, v__checker__Checker_unwrap_generic(c, left_type)); v__ast__TypeSymbol* left_value_sym = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, left_value_type)); if (left_value_sym->kind == v__ast__Kind__interface_) { @@ -49241,12 +52001,12 @@ v__ast__Type former_expected_type; return _t10; } else if (left_value_sym->kind == v__ast__Kind__sum_type) { if (right_final->kind != v__ast__Kind__array) { - if (!v__ast__Table_is_sumtype_or_in_variant(c->table, left_value_type, right_type)) { + if (!v__ast__Table_is_sumtype_or_in_variant(c->table, left_value_type, v__ast__mktyp(right_type))) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot append `"), 0xfe10, {.d_s = right_sym->name}}, {_SLIT("` to `"), 0xfe10, {.d_s = left_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), right_pos); } } else { v__ast__Type right_value_type = v__ast__Table_value_type(c->table, right_type); - if (!v__ast__Table_is_sumtype_or_in_variant(c->table, left_value_type, right_value_type)) { + if (!v__ast__Table_is_sumtype_or_in_variant(c->table, left_value_type, v__ast__mktyp(right_value_type))) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot append `"), 0xfe10, {.d_s = right_sym->name}}, {_SLIT("` to `"), 0xfe10, {.d_s = left_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), right_pos); } } @@ -49655,19 +52415,19 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im if (v__ast__Type_has_flag(elem_type, v__ast__TypeFlag__shared_f)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("you have to create a handle and `lock` it to modify `shared` "), 0xfe10, {.d_s = kind}}, {_SLIT(" element"), 0, { .d_c = 0 }}})), v__token__Pos_extend(v__ast__Expr_pos((*expr._v__ast__IndexExpr).left), (*expr._v__ast__IndexExpr).pos)); } - multi_return_string_v__token__Pos mr_44323 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__IndexExpr).left); - to_lock = mr_44323.arg0; - pos = mr_44323.arg1; + multi_return_string_v__token__Pos mr_44242 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__IndexExpr).left); + to_lock = mr_44242.arg0; + pos = mr_44242.arg1; } else if (expr._typ == 281 /* v.ast.ParExpr */) { - multi_return_string_v__token__Pos mr_44392 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__ParExpr).expr); - to_lock = mr_44392.arg0; - pos = mr_44392.arg1; + multi_return_string_v__token__Pos mr_44311 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__ParExpr).expr); + to_lock = mr_44311.arg0; + pos = mr_44311.arg1; } else if (expr._typ == 283 /* v.ast.PrefixExpr */) { - multi_return_string_v__token__Pos mr_44464 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__PrefixExpr).right); - to_lock = mr_44464.arg0; - pos = mr_44464.arg1; + multi_return_string_v__token__Pos mr_44383 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__PrefixExpr).right); + to_lock = mr_44383.arg0; + pos = mr_44383.arg1; } else if (expr._typ == 286 /* v.ast.SelectorExpr */) { if ((*expr._v__ast__SelectorExpr).expr_type == 0) { @@ -49717,9 +52477,9 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im string type_str = v__ast__Table_type_to_str(c->table, (*expr._v__ast__SelectorExpr).expr_type); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("field `"), 0xfe10, {.d_s = (*expr._v__ast__SelectorExpr).field_name}}, {_SLIT("` of struct `"), 0xfe10, {.d_s = type_str}}, {_SLIT("` is immutable"), 0, { .d_c = 0 }}})), (*expr._v__ast__SelectorExpr).pos); } - multi_return_string_v__token__Pos mr_45928 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__SelectorExpr).expr); - to_lock = mr_45928.arg0; - pos = mr_45928.arg1; + multi_return_string_v__token__Pos mr_45847 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__SelectorExpr).expr); + to_lock = mr_45847.arg0; + pos = mr_45847.arg1; } if ((to_lock).len != 0) { explicit_lock_needed = true; @@ -49825,9 +52585,9 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im } else if (expr._typ == 252 /* v.ast.CallExpr */) { if (string__eq((*expr._v__ast__CallExpr).name, _SLIT("slice"))) { - multi_return_string_v__token__Pos mr_47751 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__CallExpr).left); - to_lock = mr_47751.arg0; - pos = mr_47751.arg1; + multi_return_string_v__token__Pos mr_47670 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__CallExpr).left); + to_lock = mr_47670.arg0; + pos = mr_47670.arg1; if ((to_lock).len != 0) { explicit_lock_needed = true; } @@ -50231,9 +52991,9 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t13.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_60952 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t13.data); - field = mr_60952.arg0; - embed_types = mr_60952.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_60871 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t13.data); + field = mr_60871.arg0; + embed_types = mr_60871.arg1; node->from_embed_types = embed_types; if (sym->kind == v__ast__Kind__aggregate || sym->kind == v__ast__Kind__sum_type) { unknown_field_msg = IError_name_table[err._typ]._method_msg(err._object); @@ -50267,9 +53027,9 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t15.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_61783 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t15.data); - field = mr_61783.arg0; - embed_types = mr_61783.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_61702 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t15.data); + field = mr_61702.arg0; + embed_types = mr_61702.arg1; node->from_embed_types = embed_types; } } @@ -52499,8 +55259,8 @@ v__ast__Type v__checker__Checker_postfix_expr(v__checker__Checker* c, v__ast__Po string typ_str = v__ast__Table_type_to_str(c->table, typ); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("invalid operation: "), 0xfe10, {.d_s = v__token__Kind_str(node->op)}}, {_SLIT(" (non-numeric type `"), 0xfe10, {.d_s = typ_str}}, {_SLIT("`)"), 0, { .d_c = 0 }}})), node->pos); } else { - multi_return_string_v__token__Pos mr_116016 = v__checker__Checker_fail_if_immutable(c, node->expr); - node->auto_locked = mr_116016.arg0; + multi_return_string_v__token__Pos mr_115935 = v__checker__Checker_fail_if_immutable(c, node->expr); + node->auto_locked = mr_115935.arg0; } v__ast__Type _t1 = typ; return _t1; @@ -53281,7 +56041,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_comptime_call(v__checker__Check if (node->is_vweb) { v__ast__FnDecl* save_cur_fn = c->table->cur_fn; v__pref__Preferences *pref_ = HEAP(v__pref__Preferences, (*c->pref)); - v__pref__Preferences* pref2 = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){(*(pref_)).os,(*(pref_)).backend,(*(pref_)).build_mode,(*(pref_)).arch,(*(pref_)).output_mode,(*(pref_)).is_verbose,(*(pref_)).is_test,(*(pref_)).is_script,(*(pref_)).is_vsh,(*(pref_)).is_livemain,(*(pref_)).is_liveshared,(*(pref_)).is_shared,(*(pref_)).is_o,(*(pref_)).is_prof,(*(pref_)).test_runner,(*(pref_)).profile_file,(*(pref_)).profile_no_inline,(*(pref_)).profile_fns,(*(pref_)).translated,(*(pref_)).is_prod,(*(pref_)).obfuscate,(*(pref_)).is_repl,(*(pref_)).is_run,(*(pref_)).is_debug,(*(pref_)).is_vlines,(*(pref_)).sanitize,(*(pref_)).sourcemap,(*(pref_)).sourcemap_inline,(*(pref_)).sourcemap_src_included,(*(pref_)).show_cc,(*(pref_)).show_c_output,(*(pref_)).show_callgraph,(*(pref_)).show_depgraph,(*(pref_)).dump_c_flags,(*(pref_)).use_cache,(*(pref_)).retry_compilation,(*(pref_)).is_stats,(*(pref_)).cflags,(*(pref_)).m64,(*(pref_)).ccompiler,(*(pref_)).ccompiler_type,(*(pref_)).third_party_option,(*(pref_)).building_v,(*(pref_)).autofree,(*(pref_)).compress,(*(pref_)).no_builtin,(*(pref_)).enable_globals,(*(pref_)).is_fmt,(*(pref_)).is_vet,(*(pref_)).is_bare,(*(pref_)).bare_builtin_dir,(*(pref_)).no_preludes,(*(pref_)).custom_prelude,(*(pref_)).lookup_path,(*(pref_)).output_cross_c,(*(pref_)).output_es5,(*(pref_)).prealloc,(*(pref_)).vroot,(*(pref_)).out_name_c,(*(pref_)).out_name,(*(pref_)).path,(*(pref_)).run_only,(*(pref_)).compile_defines,(*(pref_)).compile_defines_all,(*(pref_)).run_args,(*(pref_)).printfn_list,(*(pref_)).print_v_files,(*(pref_)).skip_running,(*(pref_)).skip_warnings,(*(pref_)).warn_impure_v,(*(pref_)).warns_are_errors,(*(pref_)).fatal_errors,(*(pref_)).reuse_tmpc,(*(pref_)).no_rsp,(*(pref_)).no_std,(*(pref_)).use_color,(*(pref_)).no_parallel,.is_vweb = true,(*(pref_)).only_check_syntax,(*(pref_)).check_only,(*(pref_)).experimental,(*(pref_)).skip_unused,(*(pref_)).show_timings,(*(pref_)).is_ios_simulator,(*(pref_)).is_apk,(*(pref_)).cleanup_files,(*(pref_)).build_options,(*(pref_)).cache_manager,(*(pref_)).is_help,(*(pref_)).gc_mode,(*(pref_)).is_cstrict,(*(pref_)).assert_failure_mode,(*(pref_)).message_limit,(*(pref_)).nofloat,(*(pref_)).checker_match_exhaustive_cutoff_limit,}, sizeof(v__pref__Preferences))); + v__pref__Preferences* pref2 = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){(*(pref_)).os,(*(pref_)).backend,(*(pref_)).build_mode,(*(pref_)).arch,(*(pref_)).output_mode,(*(pref_)).is_verbose,(*(pref_)).is_test,(*(pref_)).is_script,(*(pref_)).is_vsh,(*(pref_)).is_livemain,(*(pref_)).is_liveshared,(*(pref_)).is_shared,(*(pref_)).is_o,(*(pref_)).is_prof,(*(pref_)).test_runner,(*(pref_)).profile_file,(*(pref_)).profile_no_inline,(*(pref_)).profile_fns,(*(pref_)).translated,(*(pref_)).is_prod,(*(pref_)).obfuscate,(*(pref_)).is_repl,(*(pref_)).is_run,(*(pref_)).is_debug,(*(pref_)).is_vlines,(*(pref_)).sanitize,(*(pref_)).sourcemap,(*(pref_)).sourcemap_inline,(*(pref_)).sourcemap_src_included,(*(pref_)).show_cc,(*(pref_)).show_c_output,(*(pref_)).show_callgraph,(*(pref_)).show_depgraph,(*(pref_)).dump_c_flags,(*(pref_)).use_cache,(*(pref_)).retry_compilation,(*(pref_)).is_stats,(*(pref_)).cflags,(*(pref_)).m64,(*(pref_)).ccompiler,(*(pref_)).ccompiler_type,(*(pref_)).third_party_option,(*(pref_)).building_v,(*(pref_)).autofree,(*(pref_)).compress,(*(pref_)).no_builtin,(*(pref_)).enable_globals,(*(pref_)).is_fmt,(*(pref_)).is_vet,(*(pref_)).is_bare,(*(pref_)).bare_builtin_dir,(*(pref_)).no_preludes,(*(pref_)).custom_prelude,(*(pref_)).lookup_path,(*(pref_)).output_cross_c,(*(pref_)).output_es5,(*(pref_)).prealloc,(*(pref_)).vroot,(*(pref_)).out_name_c,(*(pref_)).out_name,(*(pref_)).path,(*(pref_)).run_only,(*(pref_)).compile_defines,(*(pref_)).compile_defines_all,(*(pref_)).run_args,(*(pref_)).printfn_list,(*(pref_)).print_v_files,(*(pref_)).skip_running,(*(pref_)).skip_warnings,(*(pref_)).warn_impure_v,(*(pref_)).warns_are_errors,(*(pref_)).fatal_errors,(*(pref_)).reuse_tmpc,(*(pref_)).no_rsp,(*(pref_)).no_std,(*(pref_)).use_color,(*(pref_)).no_parallel,.is_vweb = true,(*(pref_)).only_check_syntax,(*(pref_)).check_only,(*(pref_)).experimental,(*(pref_)).skip_unused,(*(pref_)).show_timings,(*(pref_)).is_ios_simulator,(*(pref_)).is_apk,(*(pref_)).cleanup_files,(*(pref_)).build_options,(*(pref_)).cache_manager,(*(pref_)).is_help,(*(pref_)).gc_mode,(*(pref_)).is_cstrict,(*(pref_)).assert_failure_mode,(*(pref_)).message_limit,(*(pref_)).nofloat,(*(pref_)).checker_match_exhaustive_cutoff_limit,(*(pref_)).thread_stack_size,}, sizeof(v__pref__Preferences))); v__checker__Checker* c2 = v__checker__new_checker(c->table, pref2); c2->comptime_call_pos = node->pos.pos; v__checker__Checker_check(c2, (voidptr)&/*qq*/node->vweb_tmpl); @@ -53379,248 +56139,189 @@ VV_LOCAL_SYMBOL Option_v__ast__ComptTimeConstValue v__checker__Checker_eval_comp return _t2; } else if (expr._typ == 287 /* v.ast.SizeOf */) { - v__ast__Type xtype = (*expr._v__ast__SizeOf).typ; - if (v__ast__Type_is_real_pointer(xtype)) { - if (c->pref->m64) { - Option_v__ast__ComptTimeConstValue _t3; - opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, (8))) }, (Option*)(&_t3), sizeof(v__ast__ComptTimeConstValue)); - return _t3; - } - Option_v__ast__ComptTimeConstValue _t4; - opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, (4))) }, (Option*)(&_t4), sizeof(v__ast__ComptTimeConstValue)); - return _t4; - } - if (((int)(xtype)) == v__ast__Type_idx(xtype)) { - - if (xtype == (_const_v__ast__char_type)) { - Option_v__ast__ComptTimeConstValue _t5; - opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, (1))) }, (Option*)(&_t5), sizeof(v__ast__ComptTimeConstValue)); - return _t5; - } - else if (xtype == (_const_v__ast__i8_type)) { - Option_v__ast__ComptTimeConstValue _t6; - opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, (1))) }, (Option*)(&_t6), sizeof(v__ast__ComptTimeConstValue)); - return _t6; - } - else if (xtype == (_const_v__ast__i16_type)) { - Option_v__ast__ComptTimeConstValue _t7; - opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, (2))) }, (Option*)(&_t7), sizeof(v__ast__ComptTimeConstValue)); - return _t7; - } - else if (xtype == (_const_v__ast__int_type)) { - Option_v__ast__ComptTimeConstValue _t8; - opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, (4))) }, (Option*)(&_t8), sizeof(v__ast__ComptTimeConstValue)); - return _t8; - } - else if (xtype == (_const_v__ast__i64_type)) { - Option_v__ast__ComptTimeConstValue _t9; - opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, (8))) }, (Option*)(&_t9), sizeof(v__ast__ComptTimeConstValue)); - return _t9; - } - else if (xtype == (_const_v__ast__byte_type)) { - Option_v__ast__ComptTimeConstValue _t10; - opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, (1))) }, (Option*)(&_t10), sizeof(v__ast__ComptTimeConstValue)); - return _t10; - } - else if (xtype == (_const_v__ast__u16_type)) { - Option_v__ast__ComptTimeConstValue _t11; - opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, (2))) }, (Option*)(&_t11), sizeof(v__ast__ComptTimeConstValue)); - return _t11; - } - else if (xtype == (_const_v__ast__u32_type)) { - Option_v__ast__ComptTimeConstValue _t12; - opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, (4))) }, (Option*)(&_t12), sizeof(v__ast__ComptTimeConstValue)); - return _t12; - } - else if (xtype == (_const_v__ast__u64_type)) { - Option_v__ast__ComptTimeConstValue _t13; - opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, (8))) }, (Option*)(&_t13), sizeof(v__ast__ComptTimeConstValue)); - return _t13; - } - else { - }; - } - return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; + Option_v__ast__ComptTimeConstValue _t3; + opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, (v__ast__Table_type_size(c->table, (*expr._v__ast__SizeOf).typ)))) }, (Option*)(&_t3), sizeof(v__ast__ComptTimeConstValue)); + return _t3; } else if (expr._typ == 264 /* v.ast.FloatLiteral */) { f64 x = string_f64((*expr._v__ast__FloatLiteral).val); - Option_v__ast__ComptTimeConstValue _t15; - opt_ok(&(v__ast__ComptTimeConstValue[]) { f64_to_sumtype_v__ast__ComptTimeConstValue(&x) }, (Option*)(&_t15), sizeof(v__ast__ComptTimeConstValue)); - return _t15; + Option_v__ast__ComptTimeConstValue _t4; + opt_ok(&(v__ast__ComptTimeConstValue[]) { f64_to_sumtype_v__ast__ComptTimeConstValue(&x) }, (Option*)(&_t4), sizeof(v__ast__ComptTimeConstValue)); + return _t4; } else if (expr._typ == 271 /* v.ast.IntegerLiteral */) { u64 x = string_u64((*expr._v__ast__IntegerLiteral).val); if (x > 9223372036854775807U) { - Option_v__ast__ComptTimeConstValue _t16; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(&x) }, (Option*)(&_t16), sizeof(v__ast__ComptTimeConstValue)); - return _t16; + Option_v__ast__ComptTimeConstValue _t5; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(&x) }, (Option*)(&_t5), sizeof(v__ast__ComptTimeConstValue)); + return _t5; } - Option_v__ast__ComptTimeConstValue _t17; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (string_i64((*expr._v__ast__IntegerLiteral).val)))) }, (Option*)(&_t17), sizeof(v__ast__ComptTimeConstValue)); - return _t17; + Option_v__ast__ComptTimeConstValue _t6; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (string_i64((*expr._v__ast__IntegerLiteral).val)))) }, (Option*)(&_t6), sizeof(v__ast__ComptTimeConstValue)); + return _t6; } else if (expr._typ == 290 /* v.ast.StringLiteral */) { - Option_v__ast__ComptTimeConstValue _t18; - opt_ok(&(v__ast__ComptTimeConstValue[]) { string_to_sumtype_v__ast__ComptTimeConstValue(ADDR(string, (v__util__smart_quote((*expr._v__ast__StringLiteral).val, (*expr._v__ast__StringLiteral).is_raw)))) }, (Option*)(&_t18), sizeof(v__ast__ComptTimeConstValue)); - return _t18; + Option_v__ast__ComptTimeConstValue _t7; + opt_ok(&(v__ast__ComptTimeConstValue[]) { string_to_sumtype_v__ast__ComptTimeConstValue(ADDR(string, (v__util__smart_quote((*expr._v__ast__StringLiteral).val, (*expr._v__ast__StringLiteral).is_raw)))) }, (Option*)(&_t7), sizeof(v__ast__ComptTimeConstValue)); + return _t7; } else if (expr._typ == 255 /* v.ast.CharLiteral */) { Array_rune runes = string_runes((*expr._v__ast__CharLiteral).val); if (runes.len > 0) { - Option_v__ast__ComptTimeConstValue _t19; - opt_ok(&(v__ast__ComptTimeConstValue[]) { rune_to_sumtype_v__ast__ComptTimeConstValue(&(*(rune*)/*ee elem_sym */array_get(runes, 0))) }, (Option*)(&_t19), sizeof(v__ast__ComptTimeConstValue)); - return _t19; + Option_v__ast__ComptTimeConstValue _t8; + opt_ok(&(v__ast__ComptTimeConstValue[]) { rune_to_sumtype_v__ast__ComptTimeConstValue(&(*(rune*)/*ee elem_sym */array_get(runes, 0))) }, (Option*)(&_t8), sizeof(v__ast__ComptTimeConstValue)); + return _t8; } return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } else if (expr._typ == 266 /* v.ast.Ident */) { if (((*expr._v__ast__Ident).obj)._typ == 322 /* v.ast.ConstField */) { - Option_v__ast__ComptTimeConstValue _t21 = v__checker__Checker_eval_comptime_const_expr(c, (*(*expr._v__ast__Ident).obj._v__ast__ConstField).expr, nlevel + 1); - return _t21; + Option_v__ast__ComptTimeConstValue _t10 = v__checker__Checker_eval_comptime_const_expr(c, (*(*expr._v__ast__Ident).obj._v__ast__ConstField).expr, nlevel + 1); + return _t10; } } else if (expr._typ == 253 /* v.ast.CastExpr */) { - Option_v__ast__ComptTimeConstValue _t22 = v__checker__Checker_eval_comptime_const_expr(c, (*expr._v__ast__CastExpr).expr, nlevel + 1); - if (_t22.state != 0) { /*or block*/ - IError err = _t22.err; + Option_v__ast__ComptTimeConstValue _t11 = v__checker__Checker_eval_comptime_const_expr(c, (*expr._v__ast__CastExpr).expr, nlevel + 1); + if (_t11.state != 0) { /*or block*/ + IError err = _t11.err; return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } - v__ast__ComptTimeConstValue cast_expr_value = (*(v__ast__ComptTimeConstValue*)_t22.data); + v__ast__ComptTimeConstValue cast_expr_value = (*(v__ast__ComptTimeConstValue*)_t11.data); if (v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__i8_type)) { - Option_i8 _t25 = v__ast__ComptTimeConstValue_i8(cast_expr_value); - if (_t25.state != 0) { /*or block*/ - IError err = _t25.err; + Option_i8 _t14 = v__ast__ComptTimeConstValue_i8(cast_expr_value); + if (_t14.state != 0) { /*or block*/ + IError err = _t14.err; return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } - Option_v__ast__ComptTimeConstValue _t24; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i8, ( (*(i8*)_t25.data)))) }, (Option*)(&_t24), sizeof(v__ast__ComptTimeConstValue)); - return _t24; + Option_v__ast__ComptTimeConstValue _t13; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i8, ( (*(i8*)_t14.data)))) }, (Option*)(&_t13), sizeof(v__ast__ComptTimeConstValue)); + return _t13; } if (v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__i16_type)) { - Option_i16 _t28 = v__ast__ComptTimeConstValue_i16(cast_expr_value); - if (_t28.state != 0) { /*or block*/ - IError err = _t28.err; + Option_i16 _t17 = v__ast__ComptTimeConstValue_i16(cast_expr_value); + if (_t17.state != 0) { /*or block*/ + IError err = _t17.err; return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } - Option_v__ast__ComptTimeConstValue _t27; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i16_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i16, ( (*(i16*)_t28.data)))) }, (Option*)(&_t27), sizeof(v__ast__ComptTimeConstValue)); - return _t27; + Option_v__ast__ComptTimeConstValue _t16; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i16_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i16, ( (*(i16*)_t17.data)))) }, (Option*)(&_t16), sizeof(v__ast__ComptTimeConstValue)); + return _t16; } if (v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__int_type)) { - Option_int _t31 = v__ast__ComptTimeConstValue_int(cast_expr_value); - if (_t31.state != 0) { /*or block*/ - IError err = _t31.err; + Option_int _t20 = v__ast__ComptTimeConstValue_int(cast_expr_value); + if (_t20.state != 0) { /*or block*/ + IError err = _t20.err; return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } - Option_v__ast__ComptTimeConstValue _t30; - opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, ( (*(int*)_t31.data)))) }, (Option*)(&_t30), sizeof(v__ast__ComptTimeConstValue)); - return _t30; + Option_v__ast__ComptTimeConstValue _t19; + opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, ( (*(int*)_t20.data)))) }, (Option*)(&_t19), sizeof(v__ast__ComptTimeConstValue)); + return _t19; } if (v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__i64_type)) { - Option_i64 _t34 = v__ast__ComptTimeConstValue_i64(cast_expr_value); - if (_t34.state != 0) { /*or block*/ - IError err = _t34.err; + Option_i64 _t23 = v__ast__ComptTimeConstValue_i64(cast_expr_value); + if (_t23.state != 0) { /*or block*/ + IError err = _t23.err; return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } - Option_v__ast__ComptTimeConstValue _t33; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ( (*(i64*)_t34.data)))) }, (Option*)(&_t33), sizeof(v__ast__ComptTimeConstValue)); - return _t33; + Option_v__ast__ComptTimeConstValue _t22; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ( (*(i64*)_t23.data)))) }, (Option*)(&_t22), sizeof(v__ast__ComptTimeConstValue)); + return _t22; } if (v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__byte_type)) { - Option_u8 _t37 = v__ast__ComptTimeConstValue_u8(cast_expr_value); - if (_t37.state != 0) { /*or block*/ - IError err = _t37.err; + Option_u8 _t26 = v__ast__ComptTimeConstValue_u8(cast_expr_value); + if (_t26.state != 0) { /*or block*/ + IError err = _t26.err; return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } - Option_v__ast__ComptTimeConstValue _t36; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ( (*(u8*)_t37.data)))) }, (Option*)(&_t36), sizeof(v__ast__ComptTimeConstValue)); - return _t36; + Option_v__ast__ComptTimeConstValue _t25; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ( (*(u8*)_t26.data)))) }, (Option*)(&_t25), sizeof(v__ast__ComptTimeConstValue)); + return _t25; } if (v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__u16_type)) { - Option_u16 _t40 = v__ast__ComptTimeConstValue_u16(cast_expr_value); - if (_t40.state != 0) { /*or block*/ - IError err = _t40.err; + Option_u16 _t29 = v__ast__ComptTimeConstValue_u16(cast_expr_value); + if (_t29.state != 0) { /*or block*/ + IError err = _t29.err; return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } - Option_v__ast__ComptTimeConstValue _t39; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u16_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u16, ( (*(u16*)_t40.data)))) }, (Option*)(&_t39), sizeof(v__ast__ComptTimeConstValue)); - return _t39; + Option_v__ast__ComptTimeConstValue _t28; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u16_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u16, ( (*(u16*)_t29.data)))) }, (Option*)(&_t28), sizeof(v__ast__ComptTimeConstValue)); + return _t28; } if (v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__u32_type)) { - Option_u32 _t43 = v__ast__ComptTimeConstValue_u32(cast_expr_value); - if (_t43.state != 0) { /*or block*/ - IError err = _t43.err; + Option_u32 _t32 = v__ast__ComptTimeConstValue_u32(cast_expr_value); + if (_t32.state != 0) { /*or block*/ + IError err = _t32.err; return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } - Option_v__ast__ComptTimeConstValue _t42; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u32_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u32, ( (*(u32*)_t43.data)))) }, (Option*)(&_t42), sizeof(v__ast__ComptTimeConstValue)); - return _t42; + Option_v__ast__ComptTimeConstValue _t31; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u32_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u32, ( (*(u32*)_t32.data)))) }, (Option*)(&_t31), sizeof(v__ast__ComptTimeConstValue)); + return _t31; } if (v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__u64_type)) { - Option_u64 _t46 = v__ast__ComptTimeConstValue_u64(cast_expr_value); - if (_t46.state != 0) { /*or block*/ - IError err = _t46.err; + Option_u64 _t35 = v__ast__ComptTimeConstValue_u64(cast_expr_value); + if (_t35.state != 0) { /*or block*/ + IError err = _t35.err; return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } - Option_v__ast__ComptTimeConstValue _t45; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ( (*(u64*)_t46.data)))) }, (Option*)(&_t45), sizeof(v__ast__ComptTimeConstValue)); - return _t45; + Option_v__ast__ComptTimeConstValue _t34; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ( (*(u64*)_t35.data)))) }, (Option*)(&_t34), sizeof(v__ast__ComptTimeConstValue)); + return _t34; } if (v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__f32_type)) { - Option_f32 _t49 = v__ast__ComptTimeConstValue_f32(cast_expr_value); - if (_t49.state != 0) { /*or block*/ - IError err = _t49.err; + Option_f32 _t38 = v__ast__ComptTimeConstValue_f32(cast_expr_value); + if (_t38.state != 0) { /*or block*/ + IError err = _t38.err; return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } - Option_v__ast__ComptTimeConstValue _t48; - opt_ok(&(v__ast__ComptTimeConstValue[]) { f32_to_sumtype_v__ast__ComptTimeConstValue(ADDR(f32, ( (*(f32*)_t49.data)))) }, (Option*)(&_t48), sizeof(v__ast__ComptTimeConstValue)); - return _t48; + Option_v__ast__ComptTimeConstValue _t37; + opt_ok(&(v__ast__ComptTimeConstValue[]) { f32_to_sumtype_v__ast__ComptTimeConstValue(ADDR(f32, ( (*(f32*)_t38.data)))) }, (Option*)(&_t37), sizeof(v__ast__ComptTimeConstValue)); + return _t37; } if (v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__f64_type)) { - Option_f64 _t52 = v__ast__ComptTimeConstValue_f64(cast_expr_value); - if (_t52.state != 0) { /*or block*/ - IError err = _t52.err; + Option_f64 _t41 = v__ast__ComptTimeConstValue_f64(cast_expr_value); + if (_t41.state != 0) { /*or block*/ + IError err = _t41.err; return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } - Option_v__ast__ComptTimeConstValue _t51; - opt_ok(&(v__ast__ComptTimeConstValue[]) { f64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(f64, ( (*(f64*)_t52.data)))) }, (Option*)(&_t51), sizeof(v__ast__ComptTimeConstValue)); - return _t51; + Option_v__ast__ComptTimeConstValue _t40; + opt_ok(&(v__ast__ComptTimeConstValue[]) { f64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(f64, ( (*(f64*)_t41.data)))) }, (Option*)(&_t40), sizeof(v__ast__ComptTimeConstValue)); + return _t40; } } else if (expr._typ == 270 /* v.ast.InfixExpr */) { - Option_v__ast__ComptTimeConstValue _t54 = v__checker__Checker_eval_comptime_const_expr(c, (*expr._v__ast__InfixExpr).left, nlevel + 1); - if (_t54.state != 0) { /*or block*/ - Option_v__ast__ComptTimeConstValue _t55; - memcpy(&_t55, &_t54, sizeof(Option)); - return _t55; + Option_v__ast__ComptTimeConstValue _t43 = v__checker__Checker_eval_comptime_const_expr(c, (*expr._v__ast__InfixExpr).left, nlevel + 1); + if (_t43.state != 0) { /*or block*/ + Option_v__ast__ComptTimeConstValue _t44; + memcpy(&_t44, &_t43, sizeof(Option)); + return _t44; } - v__ast__ComptTimeConstValue left = (*(v__ast__ComptTimeConstValue*)_t54.data); - Option_v__ast__ComptTimeConstValue _t56 = v__checker__Checker_eval_comptime_const_expr(c, (*expr._v__ast__InfixExpr).right, nlevel + 1); - if (_t56.state != 0) { /*or block*/ - Option_v__ast__ComptTimeConstValue _t57; - memcpy(&_t57, &_t56, sizeof(Option)); - return _t57; + v__ast__ComptTimeConstValue left = (*(v__ast__ComptTimeConstValue*)_t43.data); + Option_v__ast__ComptTimeConstValue _t45 = v__checker__Checker_eval_comptime_const_expr(c, (*expr._v__ast__InfixExpr).right, nlevel + 1); + if (_t45.state != 0) { /*or block*/ + Option_v__ast__ComptTimeConstValue _t46; + memcpy(&_t46, &_t45, sizeof(Option)); + return _t46; } - v__ast__ComptTimeConstValue right = (*(v__ast__ComptTimeConstValue*)_t56.data); + v__ast__ComptTimeConstValue right = (*(v__ast__ComptTimeConstValue*)_t45.data); if ((left)._typ == 20 /* string */ && (right)._typ == 20 /* string */) { if ((*expr._v__ast__InfixExpr).op == (v__token__Kind__plus)) { - Option_v__ast__ComptTimeConstValue _t58; - opt_ok(&(v__ast__ComptTimeConstValue[]) { string_to_sumtype_v__ast__ComptTimeConstValue(ADDR(string, (string__plus((*left._string), (*right._string))))) }, (Option*)(&_t58), sizeof(v__ast__ComptTimeConstValue)); - return _t58; + Option_v__ast__ComptTimeConstValue _t47; + opt_ok(&(v__ast__ComptTimeConstValue[]) { string_to_sumtype_v__ast__ComptTimeConstValue(ADDR(string, (string__plus((*left._string), (*right._string))))) }, (Option*)(&_t47), sizeof(v__ast__ComptTimeConstValue)); + return _t47; } else { return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; @@ -53629,79 +56330,79 @@ VV_LOCAL_SYMBOL Option_v__ast__ComptTimeConstValue v__checker__Checker_eval_comp switch ((*expr._v__ast__InfixExpr).op) { case v__token__Kind__plus: { - Option_v__ast__ComptTimeConstValue _t60; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._u64))) + ((i64)((*right._i64)))))) }, (Option*)(&_t60), sizeof(v__ast__ComptTimeConstValue)); - return _t60; + Option_v__ast__ComptTimeConstValue _t49; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._u64))) + ((i64)((*right._i64)))))) }, (Option*)(&_t49), sizeof(v__ast__ComptTimeConstValue)); + return _t49; break; } case v__token__Kind__minus: { - Option_v__ast__ComptTimeConstValue _t61; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._u64))) - ((i64)((*right._i64)))))) }, (Option*)(&_t61), sizeof(v__ast__ComptTimeConstValue)); - return _t61; + Option_v__ast__ComptTimeConstValue _t50; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._u64))) - ((i64)((*right._i64)))))) }, (Option*)(&_t50), sizeof(v__ast__ComptTimeConstValue)); + return _t50; break; } case v__token__Kind__mul: { - Option_v__ast__ComptTimeConstValue _t62; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._u64))) * ((i64)((*right._i64)))))) }, (Option*)(&_t62), sizeof(v__ast__ComptTimeConstValue)); - return _t62; + Option_v__ast__ComptTimeConstValue _t51; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._u64))) * ((i64)((*right._i64)))))) }, (Option*)(&_t51), sizeof(v__ast__ComptTimeConstValue)); + return _t51; break; } case v__token__Kind__div: { - Option_v__ast__ComptTimeConstValue _t63; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._u64))) / ((i64)((*right._i64)))))) }, (Option*)(&_t63), sizeof(v__ast__ComptTimeConstValue)); - return _t63; + Option_v__ast__ComptTimeConstValue _t52; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._u64))) / ((i64)((*right._i64)))))) }, (Option*)(&_t52), sizeof(v__ast__ComptTimeConstValue)); + return _t52; break; } case v__token__Kind__mod: { - Option_v__ast__ComptTimeConstValue _t64; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._u64))) % ((i64)((*right._i64)))))) }, (Option*)(&_t64), sizeof(v__ast__ComptTimeConstValue)); - return _t64; + Option_v__ast__ComptTimeConstValue _t53; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._u64))) % ((i64)((*right._i64)))))) }, (Option*)(&_t53), sizeof(v__ast__ComptTimeConstValue)); + return _t53; break; } case v__token__Kind__xor: { - Option_v__ast__ComptTimeConstValue _t65; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((((i64)((*left._u64))) ^ ((i64)((*right._i64))))))) }, (Option*)(&_t65), sizeof(v__ast__ComptTimeConstValue)); - return _t65; + Option_v__ast__ComptTimeConstValue _t54; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((((i64)((*left._u64))) ^ ((i64)((*right._i64))))))) }, (Option*)(&_t54), sizeof(v__ast__ComptTimeConstValue)); + return _t54; break; } case v__token__Kind__pipe: { - Option_v__ast__ComptTimeConstValue _t66; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((((i64)((*left._u64))) | ((i64)((*right._i64))))))) }, (Option*)(&_t66), sizeof(v__ast__ComptTimeConstValue)); - return _t66; + Option_v__ast__ComptTimeConstValue _t55; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((((i64)((*left._u64))) | ((i64)((*right._i64))))))) }, (Option*)(&_t55), sizeof(v__ast__ComptTimeConstValue)); + return _t55; break; } case v__token__Kind__amp: { - Option_v__ast__ComptTimeConstValue _t67; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((((i64)((*left._u64))) & ((i64)((*right._i64))))))) }, (Option*)(&_t67), sizeof(v__ast__ComptTimeConstValue)); - return _t67; + Option_v__ast__ComptTimeConstValue _t56; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((((i64)((*left._u64))) & ((i64)((*right._i64))))))) }, (Option*)(&_t56), sizeof(v__ast__ComptTimeConstValue)); + return _t56; break; } case v__token__Kind__left_shift: { - Option_v__ast__ComptTimeConstValue _t68; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)((*left._u64))) << ((i64)((*right._i64)))))))) }, (Option*)(&_t68), sizeof(v__ast__ComptTimeConstValue)); - return _t68; + Option_v__ast__ComptTimeConstValue _t57; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)((*left._u64))) << ((i64)((*right._i64)))))))) }, (Option*)(&_t57), sizeof(v__ast__ComptTimeConstValue)); + return _t57; break; } case v__token__Kind__right_shift: { - Option_v__ast__ComptTimeConstValue _t69; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)((*left._u64))) >> ((i64)((*right._i64)))))))) }, (Option*)(&_t69), sizeof(v__ast__ComptTimeConstValue)); - return _t69; + Option_v__ast__ComptTimeConstValue _t58; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)((*left._u64))) >> ((i64)((*right._i64)))))))) }, (Option*)(&_t58), sizeof(v__ast__ComptTimeConstValue)); + return _t58; break; } case v__token__Kind__unsigned_right_shift: { - Option_v__ast__ComptTimeConstValue _t70; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)(((u64)((*left._u64))))) >> ((i64)((*right._i64)))))))) }, (Option*)(&_t70), sizeof(v__ast__ComptTimeConstValue)); - return _t70; + Option_v__ast__ComptTimeConstValue _t59; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)(((u64)((*left._u64))))) >> ((i64)((*right._i64)))))))) }, (Option*)(&_t59), sizeof(v__ast__ComptTimeConstValue)); + return _t59; break; } case v__token__Kind__unknown: @@ -53819,79 +56520,79 @@ VV_LOCAL_SYMBOL Option_v__ast__ComptTimeConstValue v__checker__Checker_eval_comp switch ((*expr._v__ast__InfixExpr).op) { case v__token__Kind__plus: { - Option_v__ast__ComptTimeConstValue _t72; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._i64))) + ((i64)((*right._u64)))))) }, (Option*)(&_t72), sizeof(v__ast__ComptTimeConstValue)); - return _t72; + Option_v__ast__ComptTimeConstValue _t61; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._i64))) + ((i64)((*right._u64)))))) }, (Option*)(&_t61), sizeof(v__ast__ComptTimeConstValue)); + return _t61; break; } case v__token__Kind__minus: { - Option_v__ast__ComptTimeConstValue _t73; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._i64))) - ((i64)((*right._u64)))))) }, (Option*)(&_t73), sizeof(v__ast__ComptTimeConstValue)); - return _t73; + Option_v__ast__ComptTimeConstValue _t62; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._i64))) - ((i64)((*right._u64)))))) }, (Option*)(&_t62), sizeof(v__ast__ComptTimeConstValue)); + return _t62; break; } case v__token__Kind__mul: { - Option_v__ast__ComptTimeConstValue _t74; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._i64))) * ((i64)((*right._u64)))))) }, (Option*)(&_t74), sizeof(v__ast__ComptTimeConstValue)); - return _t74; + Option_v__ast__ComptTimeConstValue _t63; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._i64))) * ((i64)((*right._u64)))))) }, (Option*)(&_t63), sizeof(v__ast__ComptTimeConstValue)); + return _t63; break; } case v__token__Kind__div: { - Option_v__ast__ComptTimeConstValue _t75; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._i64))) / ((i64)((*right._u64)))))) }, (Option*)(&_t75), sizeof(v__ast__ComptTimeConstValue)); - return _t75; + Option_v__ast__ComptTimeConstValue _t64; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._i64))) / ((i64)((*right._u64)))))) }, (Option*)(&_t64), sizeof(v__ast__ComptTimeConstValue)); + return _t64; break; } case v__token__Kind__mod: { - Option_v__ast__ComptTimeConstValue _t76; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._i64))) % ((i64)((*right._u64)))))) }, (Option*)(&_t76), sizeof(v__ast__ComptTimeConstValue)); - return _t76; + Option_v__ast__ComptTimeConstValue _t65; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._i64))) % ((i64)((*right._u64)))))) }, (Option*)(&_t65), sizeof(v__ast__ComptTimeConstValue)); + return _t65; break; } case v__token__Kind__xor: { - Option_v__ast__ComptTimeConstValue _t77; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((((i64)((*left._i64))) ^ ((i64)((*right._u64))))))) }, (Option*)(&_t77), sizeof(v__ast__ComptTimeConstValue)); - return _t77; + Option_v__ast__ComptTimeConstValue _t66; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((((i64)((*left._i64))) ^ ((i64)((*right._u64))))))) }, (Option*)(&_t66), sizeof(v__ast__ComptTimeConstValue)); + return _t66; break; } case v__token__Kind__pipe: { - Option_v__ast__ComptTimeConstValue _t78; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((((i64)((*left._i64))) | ((i64)((*right._u64))))))) }, (Option*)(&_t78), sizeof(v__ast__ComptTimeConstValue)); - return _t78; + Option_v__ast__ComptTimeConstValue _t67; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((((i64)((*left._i64))) | ((i64)((*right._u64))))))) }, (Option*)(&_t67), sizeof(v__ast__ComptTimeConstValue)); + return _t67; break; } case v__token__Kind__amp: { - Option_v__ast__ComptTimeConstValue _t79; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((((i64)((*left._i64))) & ((i64)((*right._u64))))))) }, (Option*)(&_t79), sizeof(v__ast__ComptTimeConstValue)); - return _t79; + Option_v__ast__ComptTimeConstValue _t68; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((((i64)((*left._i64))) & ((i64)((*right._u64))))))) }, (Option*)(&_t68), sizeof(v__ast__ComptTimeConstValue)); + return _t68; break; } case v__token__Kind__left_shift: { - Option_v__ast__ComptTimeConstValue _t80; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)((*left._i64))) << ((i64)((*right._u64)))))))) }, (Option*)(&_t80), sizeof(v__ast__ComptTimeConstValue)); - return _t80; + Option_v__ast__ComptTimeConstValue _t69; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)((*left._i64))) << ((i64)((*right._u64)))))))) }, (Option*)(&_t69), sizeof(v__ast__ComptTimeConstValue)); + return _t69; break; } case v__token__Kind__right_shift: { - Option_v__ast__ComptTimeConstValue _t81; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)((*left._i64))) >> ((i64)((*right._u64)))))))) }, (Option*)(&_t81), sizeof(v__ast__ComptTimeConstValue)); - return _t81; + Option_v__ast__ComptTimeConstValue _t70; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)((*left._i64))) >> ((i64)((*right._u64)))))))) }, (Option*)(&_t70), sizeof(v__ast__ComptTimeConstValue)); + return _t70; break; } case v__token__Kind__unsigned_right_shift: { - Option_v__ast__ComptTimeConstValue _t82; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)(((u64)((*left._i64))))) >> ((i64)((*right._u64)))))))) }, (Option*)(&_t82), sizeof(v__ast__ComptTimeConstValue)); - return _t82; + Option_v__ast__ComptTimeConstValue _t71; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)(((u64)((*left._i64))))) >> ((i64)((*right._u64)))))))) }, (Option*)(&_t71), sizeof(v__ast__ComptTimeConstValue)); + return _t71; break; } case v__token__Kind__unknown: @@ -54009,79 +56710,79 @@ VV_LOCAL_SYMBOL Option_v__ast__ComptTimeConstValue v__checker__Checker_eval_comp switch ((*expr._v__ast__InfixExpr).op) { case v__token__Kind__plus: { - Option_v__ast__ComptTimeConstValue _t84; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) + (*right._u64)))) }, (Option*)(&_t84), sizeof(v__ast__ComptTimeConstValue)); - return _t84; + Option_v__ast__ComptTimeConstValue _t73; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) + (*right._u64)))) }, (Option*)(&_t73), sizeof(v__ast__ComptTimeConstValue)); + return _t73; break; } case v__token__Kind__minus: { - Option_v__ast__ComptTimeConstValue _t85; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) - (*right._u64)))) }, (Option*)(&_t85), sizeof(v__ast__ComptTimeConstValue)); - return _t85; + Option_v__ast__ComptTimeConstValue _t74; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) - (*right._u64)))) }, (Option*)(&_t74), sizeof(v__ast__ComptTimeConstValue)); + return _t74; break; } case v__token__Kind__mul: { - Option_v__ast__ComptTimeConstValue _t86; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) * (*right._u64)))) }, (Option*)(&_t86), sizeof(v__ast__ComptTimeConstValue)); - return _t86; + Option_v__ast__ComptTimeConstValue _t75; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) * (*right._u64)))) }, (Option*)(&_t75), sizeof(v__ast__ComptTimeConstValue)); + return _t75; break; } case v__token__Kind__div: { - Option_v__ast__ComptTimeConstValue _t87; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) / (*right._u64)))) }, (Option*)(&_t87), sizeof(v__ast__ComptTimeConstValue)); - return _t87; + Option_v__ast__ComptTimeConstValue _t76; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) / (*right._u64)))) }, (Option*)(&_t76), sizeof(v__ast__ComptTimeConstValue)); + return _t76; break; } case v__token__Kind__mod: { - Option_v__ast__ComptTimeConstValue _t88; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) % (*right._u64)))) }, (Option*)(&_t88), sizeof(v__ast__ComptTimeConstValue)); - return _t88; + Option_v__ast__ComptTimeConstValue _t77; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) % (*right._u64)))) }, (Option*)(&_t77), sizeof(v__ast__ComptTimeConstValue)); + return _t77; break; } case v__token__Kind__xor: { - Option_v__ast__ComptTimeConstValue _t89; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, (((*left._u64) ^ (*right._u64))))) }, (Option*)(&_t89), sizeof(v__ast__ComptTimeConstValue)); - return _t89; + Option_v__ast__ComptTimeConstValue _t78; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, (((*left._u64) ^ (*right._u64))))) }, (Option*)(&_t78), sizeof(v__ast__ComptTimeConstValue)); + return _t78; break; } case v__token__Kind__pipe: { - Option_v__ast__ComptTimeConstValue _t90; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, (((*left._u64) | (*right._u64))))) }, (Option*)(&_t90), sizeof(v__ast__ComptTimeConstValue)); - return _t90; + Option_v__ast__ComptTimeConstValue _t79; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, (((*left._u64) | (*right._u64))))) }, (Option*)(&_t79), sizeof(v__ast__ComptTimeConstValue)); + return _t79; break; } case v__token__Kind__amp: { - Option_v__ast__ComptTimeConstValue _t91; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, (((*left._u64) & (*right._u64))))) }, (Option*)(&_t91), sizeof(v__ast__ComptTimeConstValue)); - return _t91; + Option_v__ast__ComptTimeConstValue _t80; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, (((*left._u64) & (*right._u64))))) }, (Option*)(&_t80), sizeof(v__ast__ComptTimeConstValue)); + return _t80; break; } case v__token__Kind__left_shift: { - Option_v__ast__ComptTimeConstValue _t92; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) << (*right._u64)))) }, (Option*)(&_t92), sizeof(v__ast__ComptTimeConstValue)); - return _t92; + Option_v__ast__ComptTimeConstValue _t81; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) << (*right._u64)))) }, (Option*)(&_t81), sizeof(v__ast__ComptTimeConstValue)); + return _t81; break; } case v__token__Kind__right_shift: { - Option_v__ast__ComptTimeConstValue _t93; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) >> (*right._u64)))) }, (Option*)(&_t93), sizeof(v__ast__ComptTimeConstValue)); - return _t93; + Option_v__ast__ComptTimeConstValue _t82; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) >> (*right._u64)))) }, (Option*)(&_t82), sizeof(v__ast__ComptTimeConstValue)); + return _t82; break; } case v__token__Kind__unsigned_right_shift: { - Option_v__ast__ComptTimeConstValue _t94; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, (((u64)((*left._u64))) >> (*right._u64)))) }, (Option*)(&_t94), sizeof(v__ast__ComptTimeConstValue)); - return _t94; + Option_v__ast__ComptTimeConstValue _t83; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, (((u64)((*left._u64))) >> (*right._u64)))) }, (Option*)(&_t83), sizeof(v__ast__ComptTimeConstValue)); + return _t83; break; } case v__token__Kind__unknown: @@ -54199,79 +56900,79 @@ VV_LOCAL_SYMBOL Option_v__ast__ComptTimeConstValue v__checker__Checker_eval_comp switch ((*expr._v__ast__InfixExpr).op) { case v__token__Kind__plus: { - Option_v__ast__ComptTimeConstValue _t96; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((*left._i64) + (*right._i64)))) }, (Option*)(&_t96), sizeof(v__ast__ComptTimeConstValue)); - return _t96; + Option_v__ast__ComptTimeConstValue _t85; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((*left._i64) + (*right._i64)))) }, (Option*)(&_t85), sizeof(v__ast__ComptTimeConstValue)); + return _t85; break; } case v__token__Kind__minus: { - Option_v__ast__ComptTimeConstValue _t97; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((*left._i64) - (*right._i64)))) }, (Option*)(&_t97), sizeof(v__ast__ComptTimeConstValue)); - return _t97; + Option_v__ast__ComptTimeConstValue _t86; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((*left._i64) - (*right._i64)))) }, (Option*)(&_t86), sizeof(v__ast__ComptTimeConstValue)); + return _t86; break; } case v__token__Kind__mul: { - Option_v__ast__ComptTimeConstValue _t98; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((*left._i64) * (*right._i64)))) }, (Option*)(&_t98), sizeof(v__ast__ComptTimeConstValue)); - return _t98; + Option_v__ast__ComptTimeConstValue _t87; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((*left._i64) * (*right._i64)))) }, (Option*)(&_t87), sizeof(v__ast__ComptTimeConstValue)); + return _t87; break; } case v__token__Kind__div: { - Option_v__ast__ComptTimeConstValue _t99; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((*left._i64) / (*right._i64)))) }, (Option*)(&_t99), sizeof(v__ast__ComptTimeConstValue)); - return _t99; + Option_v__ast__ComptTimeConstValue _t88; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((*left._i64) / (*right._i64)))) }, (Option*)(&_t88), sizeof(v__ast__ComptTimeConstValue)); + return _t88; break; } case v__token__Kind__mod: { - Option_v__ast__ComptTimeConstValue _t100; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((*left._i64) % (*right._i64)))) }, (Option*)(&_t100), sizeof(v__ast__ComptTimeConstValue)); - return _t100; + Option_v__ast__ComptTimeConstValue _t89; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((*left._i64) % (*right._i64)))) }, (Option*)(&_t89), sizeof(v__ast__ComptTimeConstValue)); + return _t89; break; } case v__token__Kind__xor: { - Option_v__ast__ComptTimeConstValue _t101; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((*left._i64) ^ (*right._i64))))) }, (Option*)(&_t101), sizeof(v__ast__ComptTimeConstValue)); - return _t101; + Option_v__ast__ComptTimeConstValue _t90; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((*left._i64) ^ (*right._i64))))) }, (Option*)(&_t90), sizeof(v__ast__ComptTimeConstValue)); + return _t90; break; } case v__token__Kind__pipe: { - Option_v__ast__ComptTimeConstValue _t102; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((*left._i64) | (*right._i64))))) }, (Option*)(&_t102), sizeof(v__ast__ComptTimeConstValue)); - return _t102; + Option_v__ast__ComptTimeConstValue _t91; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((*left._i64) | (*right._i64))))) }, (Option*)(&_t91), sizeof(v__ast__ComptTimeConstValue)); + return _t91; break; } case v__token__Kind__amp: { - Option_v__ast__ComptTimeConstValue _t103; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((*left._i64) & (*right._i64))))) }, (Option*)(&_t103), sizeof(v__ast__ComptTimeConstValue)); - return _t103; + Option_v__ast__ComptTimeConstValue _t92; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((*left._i64) & (*right._i64))))) }, (Option*)(&_t92), sizeof(v__ast__ComptTimeConstValue)); + return _t92; break; } case v__token__Kind__left_shift: { - Option_v__ast__ComptTimeConstValue _t104; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)((*left._i64))) << (*right._i64)))))) }, (Option*)(&_t104), sizeof(v__ast__ComptTimeConstValue)); - return _t104; + Option_v__ast__ComptTimeConstValue _t93; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)((*left._i64))) << (*right._i64)))))) }, (Option*)(&_t93), sizeof(v__ast__ComptTimeConstValue)); + return _t93; break; } case v__token__Kind__right_shift: { - Option_v__ast__ComptTimeConstValue _t105; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)((*left._i64))) >> (*right._i64)))))) }, (Option*)(&_t105), sizeof(v__ast__ComptTimeConstValue)); - return _t105; + Option_v__ast__ComptTimeConstValue _t94; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)((*left._i64))) >> (*right._i64)))))) }, (Option*)(&_t94), sizeof(v__ast__ComptTimeConstValue)); + return _t94; break; } case v__token__Kind__unsigned_right_shift: { - Option_v__ast__ComptTimeConstValue _t106; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)(((u64)((*left._i64))))) >> (*right._i64)))))) }, (Option*)(&_t106), sizeof(v__ast__ComptTimeConstValue)); - return _t106; + Option_v__ast__ComptTimeConstValue _t95; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)(((u64)((*left._i64))))) >> (*right._i64)))))) }, (Option*)(&_t95), sizeof(v__ast__ComptTimeConstValue)); + return _t95; break; } case v__token__Kind__unknown: @@ -54389,79 +57090,79 @@ VV_LOCAL_SYMBOL Option_v__ast__ComptTimeConstValue v__checker__Checker_eval_comp switch ((*expr._v__ast__InfixExpr).op) { case v__token__Kind__plus: { - Option_v__ast__ComptTimeConstValue _t108; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) + (*right._u8)))) }, (Option*)(&_t108), sizeof(v__ast__ComptTimeConstValue)); - return _t108; + Option_v__ast__ComptTimeConstValue _t97; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) + (*right._u8)))) }, (Option*)(&_t97), sizeof(v__ast__ComptTimeConstValue)); + return _t97; break; } case v__token__Kind__minus: { - Option_v__ast__ComptTimeConstValue _t109; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) - (*right._u8)))) }, (Option*)(&_t109), sizeof(v__ast__ComptTimeConstValue)); - return _t109; + Option_v__ast__ComptTimeConstValue _t98; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) - (*right._u8)))) }, (Option*)(&_t98), sizeof(v__ast__ComptTimeConstValue)); + return _t98; break; } case v__token__Kind__mul: { - Option_v__ast__ComptTimeConstValue _t110; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) * (*right._u8)))) }, (Option*)(&_t110), sizeof(v__ast__ComptTimeConstValue)); - return _t110; + Option_v__ast__ComptTimeConstValue _t99; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) * (*right._u8)))) }, (Option*)(&_t99), sizeof(v__ast__ComptTimeConstValue)); + return _t99; break; } case v__token__Kind__div: { - Option_v__ast__ComptTimeConstValue _t111; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) / (*right._u8)))) }, (Option*)(&_t111), sizeof(v__ast__ComptTimeConstValue)); - return _t111; + Option_v__ast__ComptTimeConstValue _t100; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) / (*right._u8)))) }, (Option*)(&_t100), sizeof(v__ast__ComptTimeConstValue)); + return _t100; break; } case v__token__Kind__mod: { - Option_v__ast__ComptTimeConstValue _t112; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) % (*right._u8)))) }, (Option*)(&_t112), sizeof(v__ast__ComptTimeConstValue)); - return _t112; + Option_v__ast__ComptTimeConstValue _t101; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) % (*right._u8)))) }, (Option*)(&_t101), sizeof(v__ast__ComptTimeConstValue)); + return _t101; break; } case v__token__Kind__xor: { - Option_v__ast__ComptTimeConstValue _t113; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, (((*left._u8) ^ (*right._u8))))) }, (Option*)(&_t113), sizeof(v__ast__ComptTimeConstValue)); - return _t113; + Option_v__ast__ComptTimeConstValue _t102; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, (((*left._u8) ^ (*right._u8))))) }, (Option*)(&_t102), sizeof(v__ast__ComptTimeConstValue)); + return _t102; break; } case v__token__Kind__pipe: { - Option_v__ast__ComptTimeConstValue _t114; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, (((*left._u8) | (*right._u8))))) }, (Option*)(&_t114), sizeof(v__ast__ComptTimeConstValue)); - return _t114; + Option_v__ast__ComptTimeConstValue _t103; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, (((*left._u8) | (*right._u8))))) }, (Option*)(&_t103), sizeof(v__ast__ComptTimeConstValue)); + return _t103; break; } case v__token__Kind__amp: { - Option_v__ast__ComptTimeConstValue _t115; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, (((*left._u8) & (*right._u8))))) }, (Option*)(&_t115), sizeof(v__ast__ComptTimeConstValue)); - return _t115; + Option_v__ast__ComptTimeConstValue _t104; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, (((*left._u8) & (*right._u8))))) }, (Option*)(&_t104), sizeof(v__ast__ComptTimeConstValue)); + return _t104; break; } case v__token__Kind__left_shift: { - Option_v__ast__ComptTimeConstValue _t116; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) << (*right._u8)))) }, (Option*)(&_t116), sizeof(v__ast__ComptTimeConstValue)); - return _t116; + Option_v__ast__ComptTimeConstValue _t105; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) << (*right._u8)))) }, (Option*)(&_t105), sizeof(v__ast__ComptTimeConstValue)); + return _t105; break; } case v__token__Kind__right_shift: { - Option_v__ast__ComptTimeConstValue _t117; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) >> (*right._u8)))) }, (Option*)(&_t117), sizeof(v__ast__ComptTimeConstValue)); - return _t117; + Option_v__ast__ComptTimeConstValue _t106; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) >> (*right._u8)))) }, (Option*)(&_t106), sizeof(v__ast__ComptTimeConstValue)); + return _t106; break; } case v__token__Kind__unsigned_right_shift: { - Option_v__ast__ComptTimeConstValue _t118; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, (((u8)((*left._u8))) >> (*right._u8)))) }, (Option*)(&_t118), sizeof(v__ast__ComptTimeConstValue)); - return _t118; + Option_v__ast__ComptTimeConstValue _t107; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, (((u8)((*left._u8))) >> (*right._u8)))) }, (Option*)(&_t107), sizeof(v__ast__ComptTimeConstValue)); + return _t107; break; } case v__token__Kind__unknown: @@ -54624,10 +57325,10 @@ VV_LOCAL_SYMBOL void v__checker__Checker_verify_all_vweb_routes(v__checker__Chec for (int _t2 = 0; _t2 < sym_app->methods.len; ++_t2) { v__ast__Fn m = ((v__ast__Fn*)sym_app->methods.data)[_t2]; if (m.return_type == typ_vweb_result) { - multi_return_bool_int_int mr_10340 = v__checker__Checker_verify_vweb_params_for_method(c, m); - bool is_ok = mr_10340.arg0; - int nroute_attributes = mr_10340.arg1; - int nargs = mr_10340.arg2; + multi_return_bool_int_int mr_9819 = v__checker__Checker_verify_vweb_params_for_method(c, m); + bool is_ok = mr_9819.arg0; + int nroute_attributes = mr_9819.arg1; + int nargs = mr_9819.arg2; if (!is_ok) { v__ast__FnDecl* f = ((v__ast__FnDecl*)(m.source_fn)); if (isnil(f)) { @@ -57275,6 +59976,16 @@ VV_LOCAL_SYMBOL void v__checker__Checker_for_c_stmt(v__checker__Checker* c, v__a } v__checker__Checker_expr(c, node.cond); if (node.has_inc) { + if ((node.inc)._typ == 298 /* v.ast.AssignStmt */) { + for (int _t1 = 0; _t1 < (*node.inc._v__ast__AssignStmt).right.len; ++_t1) { + v__ast__Expr right = ((v__ast__Expr*)(*node.inc._v__ast__AssignStmt).right.data)[_t1]; + if ((right)._typ == 252 /* v.ast.CallExpr */) { + if ((*right._v__ast__CallExpr).or_block.stmts.len > 0) { + v__checker__Checker_error(c, _SLIT("optionals are not allowed in `for statement increment` (yet)"), (*right._v__ast__CallExpr).pos); + } + } + } + } v__checker__Checker_stmt(c, node.inc); } v__checker__Checker_check_loop_label(c, node.label, node.pos); @@ -60514,28 +63225,32 @@ v__ast__Expr v__transformer__Transformer_expr(v__transformer__Transformer* t, v_ } else if (node->_typ == 286 /* v.ast.SelectorExpr */) { (*node->_v__ast__SelectorExpr).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__SelectorExpr).expr); + if (((*node->_v__ast__SelectorExpr).expr)._typ == 290 /* v.ast.StringLiteral */ && string__eq((*node->_v__ast__SelectorExpr).field_name, _SLIT("len"))) { + v__ast__Expr _t15 = v__ast__IntegerLiteral_to_sumtype_v__ast__Expr(ADDR(v__ast__IntegerLiteral, (((v__ast__IntegerLiteral){.val = int_str((*(*node->_v__ast__SelectorExpr).expr._v__ast__StringLiteral).val.len),.pos = (*node->_v__ast__SelectorExpr).pos,})))); + return _t15; + } } else if (node->_typ == 287 /* v.ast.SizeOf */) { (*node->_v__ast__SizeOf).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__SizeOf).expr); } else if (node->_typ == 288 /* v.ast.SqlExpr */) { - v__ast__Expr _t15 = v__transformer__Transformer_sql_expr(t, (voidptr)&/*qq*/(*node->_v__ast__SqlExpr)); - return _t15; + v__ast__Expr _t16 = v__transformer__Transformer_sql_expr(t, (voidptr)&/*qq*/(*node->_v__ast__SqlExpr)); + return _t16; } else if (node->_typ == 289 /* v.ast.StringInterLiteral */) { - for (int _t16 = 0; _t16 < (*node->_v__ast__StringInterLiteral).exprs.len; ++_t16) { - v__ast__Expr* expr = ((v__ast__Expr*)(*node->_v__ast__StringInterLiteral).exprs.data) + _t16; + for (int _t17 = 0; _t17 < (*node->_v__ast__StringInterLiteral).exprs.len; ++_t17) { + v__ast__Expr* expr = ((v__ast__Expr*)(*node->_v__ast__StringInterLiteral).exprs.data) + _t17; *expr = v__transformer__Transformer_expr(t, expr); } } else if (node->_typ == 291 /* v.ast.StructInit */) { (*node->_v__ast__StructInit).update_expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__StructInit).update_expr); - for (int _t17 = 0; _t17 < (*node->_v__ast__StructInit).fields.len; ++_t17) { - v__ast__StructInitField* field = ((v__ast__StructInitField*)(*node->_v__ast__StructInit).fields.data) + _t17; + for (int _t18 = 0; _t18 < (*node->_v__ast__StructInit).fields.len; ++_t18) { + v__ast__StructInitField* field = ((v__ast__StructInitField*)(*node->_v__ast__StructInit).fields.data) + _t18; field->expr = v__transformer__Transformer_expr(t, &/*sum*/field->expr); } - for (int _t18 = 0; _t18 < (*node->_v__ast__StructInit).embeds.len; ++_t18) { - v__ast__StructInitEmbed* embed = ((v__ast__StructInitEmbed*)(*node->_v__ast__StructInit).embeds.data) + _t18; + for (int _t19 = 0; _t19 < (*node->_v__ast__StructInit).embeds.len; ++_t19) { + v__ast__StructInitEmbed* embed = ((v__ast__StructInitEmbed*)(*node->_v__ast__StructInit).embeds.data) + _t19; embed->expr = v__transformer__Transformer_expr(t, &/*sum*/embed->expr); } } @@ -60546,8 +63261,8 @@ v__ast__Expr v__transformer__Transformer_expr(v__transformer__Transformer* t, v_ else { } ; - v__ast__Expr _t19 = *node; - return _t19; + v__ast__Expr _t20 = *node; + return _t20; } v__ast__Expr v__transformer__Transformer_call_expr(v__transformer__Transformer* t, v__ast__CallExpr* node) { @@ -61391,7 +64106,7 @@ bool v__markused__mark_used_defer_0 = false; v__markused__Walker_mark_exported_fns(&walker); v__markused__Walker_mark_root_fns(&walker, all_fn_root_names); if (walker.n_asserts > 0) { - v__markused__Walker_fn_decl(&walker, (voidptr)&/*qq*/(*(v__ast__FnDecl*)map_get(ADDR(map, all_fns), &(string[]){_SLIT("__print_assert_failure")}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},} }))); + v__markused__Walker_fn_decl(&walker, (voidptr)&/*qq*/(*(v__ast__FnDecl*)map_get(ADDR(map, all_fns), &(string[]){_SLIT("__print_assert_failure")}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},} }))); } if (table->used_maps > 0) { int _t57 = all_fns.key_values.len; @@ -61514,7 +64229,7 @@ bool v__markused__all_fn_const_and_global_defer_0 = false; v__ast__Stmt node = ((v__ast__Stmt*)file->stmts.data)[_t1]; if (node._typ == 183 /* v.ast.FnDecl */) { string fkey = v__ast__FnDecl_fkey(&(*node._v__ast__FnDecl)); -(*(v__ast__FnDecl*)map_get_and_set((map*)&all_fns, &(string[]){fkey}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},} })) = (*node._v__ast__FnDecl); +(*(v__ast__FnDecl*)map_get_and_set((map*)&all_fns, &(string[]){fkey}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},} })) = (*node._v__ast__FnDecl); } else if (node._typ == 302 /* v.ast.ConstDecl */) { for (int _t2 = 0; _t2 < (*node._v__ast__ConstDecl).fields.len; ++_t2) { @@ -61617,7 +64332,7 @@ void v__markused__Walker_mark_root_fns(v__markused__Walker* w, Array_string all_ println( str_intp(2, _MOV((StrIntpData[]){{_SLIT(">>>> "), 0xfe10, {.d_s = fn_name}}, {_SLIT(" uses: "), 0, { .d_c = 0 }}}))); } #endif - v__markused__Walker_fn_decl(w, (voidptr)&/*qq*/(*(v__ast__FnDecl*)map_get(ADDR(map, w->all_fns), &(string[]){fn_name}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},} }))); + v__markused__Walker_fn_decl(w, (voidptr)&/*qq*/(*(v__ast__FnDecl*)map_get(ADDR(map, w->all_fns), &(string[]){fn_name}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},} }))); } } } @@ -63678,7 +66393,7 @@ string sref_name; Option_v__ast__Fn _t7 = v__ast__Table_find_method(g->table, left_sym, extracted_op); if (_t7.state != 0) { /*or block*/ IError err = _t7.err; - v__gen__c__Gen_error(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("assignemnt operator `"), 0xfe10, {.d_s = extracted_op}}, {_SLIT("=` used but no `"), 0xfe10, {.d_s = extracted_op}}, {_SLIT("` method defined"), 0, { .d_c = 0 }}})), node.pos); + v__gen__c__Gen_error(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("assignment operator `"), 0xfe10, {.d_s = extracted_op}}, {_SLIT("=` used but no `"), 0xfe10, {.d_s = extracted_op}}, {_SLIT("` method defined"), 0, { .d_c = 0 }}})), node.pos); VUNREACHABLE(); *(v__ast__Fn*) _t7.data = ((v__ast__Fn){.is_variadic = 0,.language = 0,.is_pub = 0,.is_ctor_new = 0,.is_deprecated = 0,.is_noreturn = 0,.is_unsafe = 0,.is_placeholder = 0,.is_main = 0,.is_test = 0,.is_keep_alive = 0,.is_method = 0,.no_body = 0,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.file_mode = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type = 0,.receiver_type = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 0,}); } @@ -67293,9 +70008,9 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_optional_type_text(v__gen__c__Gen* g, stri } VV_LOCAL_SYMBOL string v__gen__c__Gen_register_optional(v__gen__c__Gen* g, v__ast__Type t) { - multi_return_string_string mr_36786 = v__gen__c__Gen_optional_type_name(g, t); - string styp = mr_36786.arg0; - string base = mr_36786.arg1; + multi_return_string_string mr_36790 = v__gen__c__Gen_optional_type_name(g, t); + string styp = mr_36790.arg0; + string base = mr_36790.arg1; map_set(&g->optionals, &(string[]){base}, &(string[]) { styp }); string _t1 = styp; return _t1; @@ -67955,11 +70670,9 @@ inline VV_LOCAL_SYMBOL void v__gen__c__Gen_write_v_source_line_info(v__gen__c__G } VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { -bool v__gen__c__Gen_stmt_defer_0 = false; if (!g->skip_stmt_pos) { v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); } - v__gen__c__Gen_stmt_defer_0 = true; if (node._typ == 304 /* v.ast.EmptyStmt */) { } else if (node._typ == 296 /* v.ast.AsmStmt */) { @@ -68260,10 +70973,6 @@ bool v__gen__c__Gen_stmt_defer_0 = false; else if (node._typ == 319 /* v.ast.StructDecl */) { string name = ((*node._v__ast__StructDecl).language == v__ast__Language__c ? (v__util__no_dots((*node._v__ast__StructDecl).name)) : (string__eq((*node._v__ast__StructDecl).name, _SLIT("array")) || string__eq((*node._v__ast__StructDecl).name, _SLIT("string"))) ? ((*node._v__ast__StructDecl).name) : (v__gen__c__c_name((*node._v__ast__StructDecl).name))); if ((*node._v__ast__StructDecl).language == v__ast__Language__c) { - // Defer begin - if (v__gen__c__Gen_stmt_defer_0) { - } - // Defer end return; } if ((*node._v__ast__StructDecl).is_union) { @@ -68285,10 +70994,6 @@ bool v__gen__c__Gen_stmt_defer_0 = false; if ((node)._typ != 183 /* v.ast.FnDecl */) { } } -// Defer begin -if (v__gen__c__Gen_stmt_defer_0) { -} -// Defer end } VV_LOCAL_SYMBOL void v__gen__c__Gen_write_defer_stmts(v__gen__c__Gen* g) { @@ -68369,8 +71074,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_sumtype_casting_fn(v__gen__c__Gen* g, *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t4.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_66009 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t4.data); - Array_v__ast__Type embed_types = mr_66009.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_65944 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t4.data); + Array_v__ast__Type embed_types = mr_65944.arg1; if (embed_types.len > 0) { v__ast__TypeSymbol* embed_sym = v__ast__Table_sym(g->table, (*(v__ast__Type*)array_last(embed_types))); ptr = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = v__ast__TypeSymbol_embed_name(embed_sym)}}, {_SLIT("_ptr"), 0, { .d_c = 0 }}})); @@ -69473,7 +72178,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_char_literal(v__gen__c__Gen* g, v__ast__Char v__gen__c__Gen_write(g, _SLIT("'`'")); return; } - if (utf8_str_len(node.val) < node.val.len) { + if (string_len_utf8(node.val) < node.val.len) { v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("((rune)0x"), 0xfe10, {.d_s = int_hex(string_utf32_code(node.val))}}, {_SLIT(" /* `"), 0xfe10, {.d_s = node.val}}, {_SLIT("` */)"), 0, { .d_c = 0 }}}))); return; } @@ -69598,8 +72303,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_selector_expr(v__gen__c__Gen* g, v__ast__Sel v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 439) /*expected idx: 439, name: v.ast.ArrayFixed */ ; v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe07, {.d_i32 = info.size}}, {_SLIT0, 0, { .d_c = 0 }}}))); return; - } - if (sym->kind == v__ast__Kind__chan && (string__eq(node.field_name, _SLIT("len")) || string__eq(node.field_name, _SLIT("closed")))) { + } else if (sym->kind == v__ast__Kind__chan && (string__eq(node.field_name, _SLIT("len")) || string__eq(node.field_name, _SLIT("closed")))) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("sync__Channel_"), 0xfe10, {.d_s = node.field_name}}, {_SLIT("("), 0, { .d_c = 0 }}}))); v__gen__c__Gen_expr(g, node.expr); v__gen__c__Gen_write(g, _SLIT(")")); @@ -69816,11 +72520,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_map_init(v__gen__c__Gen* g, v__ast__MapInit string value_typ_str = v__gen__c__Gen_typ(g, unwrap_val_typ); v__ast__TypeSymbol* value_sym = v__ast__Table_sym(g->table, unwrap_val_typ); v__ast__TypeSymbol* key_sym = v__ast__Table_final_sym(g->table, unwrap_key_typ); - multi_return_string_string_string_string mr_105252 = v__gen__c__Gen_map_fn_ptrs(g, *key_sym); - string hash_fn = mr_105252.arg0; - string key_eq_fn = mr_105252.arg1; - string clone_fn = mr_105252.arg2; - string free_fn = mr_105252.arg3; + multi_return_string_string_string_string mr_105188 = v__gen__c__Gen_map_fn_ptrs(g, *key_sym); + string hash_fn = mr_105188.arg0; + string key_eq_fn = mr_105188.arg1; + string clone_fn = mr_105188.arg2; + string free_fn = mr_105188.arg3; int size = node.vals.len; string shared_styp = _SLIT(""); string styp = _SLIT(""); @@ -70049,7 +72753,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_ident(v__gen__c__Gen* g, v__ast__Ident node) if (g->pref->translated && !g->is_builtin_mod && !v__util__module_is_builtin(string_all_before_last(node.name, _SLIT(".")))) { string x = v__util__no_dots(node.name); if (string_starts_with(x, _SLIT("main__"))) { - x = string_substr(x, _SLIT("main__").len, (x).len); + x = string_substr(x, 6, (x).len); } v__gen__c__Gen_write(g, x); return; @@ -70992,9 +73696,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ for (int _t3 = 0; _t3 < (*sym->info._v__ast__Struct).fields.len; ++_t3) { v__ast__StructField field = ((v__ast__StructField*)(*sym->info._v__ast__Struct).fields.data)[_t3]; if (v__ast__Type_has_flag(field.typ, v__ast__TypeFlag__optional)) { - multi_return_string_string mr_142389 = v__gen__c__Gen_optional_type_name(g, field.typ); - string styp = mr_142389.arg0; - string base = mr_142389.arg1; + multi_return_string_string mr_142325 = v__gen__c__Gen_optional_type_name(g, field.typ); + string styp = mr_142325.arg0; + string base = mr_142325.arg1; sync__RwMutex_lock(&g->done_optionals->mtx); /*lock*/ { if (!Array_string_contains(g->done_optionals->val, base)) { @@ -71267,11 +73971,11 @@ bool v__gen__c__Gen_or_block_defer_0 = false; if (string__eq(g->file->mod.name, _SLIT("main")) && (isnil(g->fn_decl) || g->fn_decl->is_main)) { string err_msg = str_intp(3, _MOV((StrIntpData[]){{_SLIT("IError_name_table["), 0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._typ]._method_msg("), 0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._object)"), 0, { .d_c = 0 }}})); if (g->pref->is_debug) { - multi_return_int_string_string_string mr_151543 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); - int paline = mr_151543.arg0; - string pafile = mr_151543.arg1; - string pamod = mr_151543.arg2; - string pafn = mr_151543.arg3; + multi_return_int_string_string_string mr_151479 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); + int paline = mr_151479.arg0; + string pafile = mr_151479.arg1; + string pamod = mr_151479.arg2; + string pafn = mr_151479.arg3; v__gen__c__Gen_writeln(g, str_intp(6, _MOV((StrIntpData[]){{_SLIT("panic_debug("), 0xfe07, {.d_i32 = paline}}, {_SLIT(", tos3(\""), 0xfe10, {.d_s = pafile}}, {_SLIT("\"), tos3(\""), 0xfe10, {.d_s = pamod}}, {_SLIT("\"), tos3(\""), 0xfe10, {.d_s = pafn}}, {_SLIT("\"), "), 0xfe10, {.d_s = err_msg}}, {_SLIT(" );"), 0, { .d_c = 0 }}}))); } else { v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tpanic_optional_not_set( "), 0xfe10, {.d_s = err_msg}}, {_SLIT(" );"), 0, { .d_c = 0 }}}))); @@ -71381,11 +74085,11 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_type_default(v__gen__c__Gen* g, v__ast__Ty { v__ast__Map info = v__ast__TypeSymbol_map_info(sym); v__ast__TypeSymbol* key_typ = v__ast__Table_sym(g->table, info.key_type); - multi_return_string_string_string_string mr_154125 = v__gen__c__Gen_map_fn_ptrs(g, *key_typ); - string hash_fn = mr_154125.arg0; - string key_eq_fn = mr_154125.arg1; - string clone_fn = mr_154125.arg2; - string free_fn = mr_154125.arg3; + multi_return_string_string_string_string mr_154061 = v__gen__c__Gen_map_fn_ptrs(g, *key_typ); + string hash_fn = mr_154061.arg0; + string key_eq_fn = mr_154061.arg1; + string clone_fn = mr_154061.arg2; + string free_fn = mr_154061.arg3; string noscan_key = v__gen__c__Gen_check_noscan(g, info.key_type); string noscan_value = v__gen__c__Gen_check_noscan(g, info.value_type); string noscan = (noscan_key.len != 0 || noscan_value.len != 0 ? (_SLIT("_noscan")) : (_SLIT(""))); @@ -71915,8 +74619,8 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { int params_start_pos = g->out.len; Array_v__ast__Param params = array_clone_to_depth(&method.params, 0); array_set(¶ms, 0, &(v__ast__Param[]) { ((v__ast__Param){(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).pos,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).name,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).is_mut,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).is_auto_rec,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).type_pos,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).is_hidden,.typ = v__ast__Type_set_nr_muls(st, 1),}) }); - multi_return_Array_string_Array_string_Array_bool mr_168560 = v__gen__c__Gen_fn_decl_params(g, params, ((voidptr)(0)), false); - Array_string fargs = mr_168560.arg0; + multi_return_Array_string_Array_string_Array_bool mr_168496 = v__gen__c__Gen_fn_decl_params(g, params, ((voidptr)(0)), false); + Array_string fargs = mr_168496.arg0; string parameter_name = strings__Builder_cut_last(&g->out, g->out.len - params_start_pos); if (v__ast__Type_is_ptr(st)) { parameter_name = string_trim_string_left(parameter_name, _SLIT("__shared__")); @@ -71933,8 +74637,8 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { *(multi_return_v__ast__Fn_Array_v__ast__Type*) _t26.data = (multi_return_v__ast__Fn_Array_v__ast__Type){.arg0=((v__ast__Fn){.is_variadic = 0,.language = 0,.is_pub = 0,.is_ctor_new = 0,.is_deprecated = 0,.is_noreturn = 0,.is_unsafe = 0,.is_placeholder = 0,.is_main = 0,.is_test = 0,.is_keep_alive = 0,.is_method = 0,.no_body = 0,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.file_mode = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type = 0,.receiver_type = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_169024 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t26.data); - Array_v__ast__Type embed_types = mr_169024.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_168960 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t26.data); + Array_v__ast__Type embed_types = mr_168960.arg1; if (embed_types.len > 0 && !Array_string_contains(method_names, method.name)) { v__ast__TypeSymbol* embed_sym = v__ast__Table_sym(g->table, (*(v__ast__Type*)array_last(embed_types))); string method_name = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = embed_sym->cname}}, {_SLIT("_"), 0xfe10, {.d_s = method.name}}, {_SLIT0, 0, { .d_c = 0 }}})); @@ -74012,7 +76716,7 @@ int ctmp; } v__ast__Var info = /* as */ *(v__ast__Var*)__as_cast((var.obj)._v__ast__Var,(var.obj)._typ, 324) /*expected idx: 324, name: v.ast.Var */ ; if (v__ast__Table_sym(g->table, info.typ)->kind != v__ast__Kind__function) { - v__gen__c__Gen_writeln(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = v__gen__c__Gen_typ(g, info.typ)}}, {_SLIT0, 0xfe10, {.d_s = deref}}, {_SLIT(" "), 0xfe10, {.d_s = var.name}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_writeln(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = v__gen__c__Gen_typ(g, info.typ)}}, {_SLIT0, 0xfe10, {.d_s = deref}}, {_SLIT(" "), 0xfe10, {.d_s = v__gen__c__c_name(var.name)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } } } @@ -75042,11 +77746,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr } if (!print_auto_str) { if (g->pref->is_debug && string__eq(node.name, _SLIT("panic"))) { - multi_return_int_string_string_string mr_40523 = v__gen__c__Gen_panic_debug_info(g, node.pos); - int paline = mr_40523.arg0; - string pafile = mr_40523.arg1; - string pamod = mr_40523.arg2; - string pafn = mr_40523.arg3; + multi_return_int_string_string_string mr_40533 = v__gen__c__Gen_panic_debug_info(g, node.pos); + int paline = mr_40533.arg0; + string pafile = mr_40533.arg1; + string pamod = mr_40533.arg2; + string pafn = mr_40533.arg3; v__gen__c__Gen_write(g, str_intp(5, _MOV((StrIntpData[]){{_SLIT("panic_debug("), 0xfe07, {.d_i32 = paline}}, {_SLIT(", tos3(\""), 0xfe10, {.d_s = pafile}}, {_SLIT("\"), tos3(\""), 0xfe10, {.d_s = pamod}}, {_SLIT("\"), tos3(\""), 0xfe10, {.d_s = pafn}}, {_SLIT("\"), "), 0, { .d_c = 0 }}}))); v__gen__c__Gen_call_args(g, node); v__gen__c__Gen_write(g, _SLIT(")")); @@ -75440,7 +78144,14 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_go_expr(v__gen__c__Gen* g, v__ast__GoExpr no } } else { v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("pthread_t thread_"), 0xfe10, {.d_s = tmp}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); - v__gen__c__Gen_writeln(g, str_intp(5, _MOV((StrIntpData[]){{_SLIT("int "), 0xfe10, {.d_s = tmp}}, {_SLIT("_thr_res = pthread_create(&thread_"), 0xfe10, {.d_s = tmp}}, {_SLIT(", NULL, (void*)"), 0xfe10, {.d_s = wrapper_fn_name}}, {_SLIT(", "), 0xfe10, {.d_s = arg_tmp_var}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); + string sthread_attributes = _SLIT("NULL"); + if (g->pref->os != v__pref__OS__vinix) { + v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("pthread_attr_t thread_"), 0xfe10, {.d_s = tmp}}, {_SLIT("_attributes;"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("pthread_attr_init(&thread_"), 0xfe10, {.d_s = tmp}}, {_SLIT("_attributes);"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("pthread_attr_setstacksize(&thread_"), 0xfe10, {.d_s = tmp}}, {_SLIT("_attributes, "), 0xfe07, {.d_i32 = g->pref->thread_stack_size}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); + sthread_attributes = str_intp(2, _MOV((StrIntpData[]){{_SLIT("&thread_"), 0xfe10, {.d_s = tmp}}, {_SLIT("_attributes"), 0, { .d_c = 0 }}})); + } + v__gen__c__Gen_writeln(g, str_intp(6, _MOV((StrIntpData[]){{_SLIT("int "), 0xfe10, {.d_s = tmp}}, {_SLIT("_thr_res = pthread_create(&thread_"), 0xfe10, {.d_s = tmp}}, {_SLIT(", "), 0xfe10, {.d_s = sthread_attributes}}, {_SLIT(", (void*)"), 0xfe10, {.d_s = wrapper_fn_name}}, {_SLIT(", "), 0xfe10, {.d_s = arg_tmp_var}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); v__gen__c__Gen_writeln(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT("if ("), 0xfe10, {.d_s = tmp}}, {_SLIT("_thr_res) panic_error_number(tos3(\"`go "), 0xfe10, {.d_s = name}}, {_SLIT("()`: \"), "), 0xfe10, {.d_s = tmp}}, {_SLIT("_thr_res);"), 0, { .d_c = 0 }}}))); if (!node.is_expr) { v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("pthread_detach(thread_"), 0xfe10, {.d_s = tmp}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); @@ -75579,6 +78290,13 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_go_expr(v__gen__c__Gen* g, v__ast__GoExpr no strings__Builder_write_string(&g->gowrappers, call_args_str); } else { for (int i = 0; i < expr.args.len; ++i) { + int expected_nr_muls = v__ast__Type_nr_muls((*(v__ast__Type*)/*ee elem_sym */array_get(expr.expected_arg_types, i))); + int arg_nr_muls = v__ast__Type_nr_muls((*(v__ast__CallArg*)/*ee elem_sym */array_get(expr.args, i)).typ); + if (arg_nr_muls > expected_nr_muls) { + strings__Builder_write_string(&g->gowrappers, string_repeat(_SLIT("*"), arg_nr_muls - expected_nr_muls)); + } else if (arg_nr_muls < expected_nr_muls) { + strings__Builder_write_string(&g->gowrappers, string_repeat(_SLIT("&"), expected_nr_muls - arg_nr_muls)); + } strings__Builder_write_string(&g->gowrappers, str_intp(2, _MOV((StrIntpData[]){{_SLIT("arg->arg"), 0xfe07, {.d_i32 = i + 1}}, {_SLIT0, 0, { .d_c = 0 }}}))); if (i != expr.args.len - 1) { strings__Builder_write_string(&g->gowrappers, _SLIT(", ")); @@ -82828,7 +85546,7 @@ VV_LOCAL_SYMBOL v__ast__HashStmt v__parser__Parser_hash(v__parser__Parser* p) { } VV_LOCAL_SYMBOL v__ast__ComptimeCall v__parser__Parser_comptime_call(v__parser__Parser* p) { - v__ast__ComptimeCall *err_node = HEAP(v__ast__ComptimeCall, (((v__ast__ComptimeCall){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_parens = 0,.method_name = (string){.str=(byteptr)"", .is_lit=1},.method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.scope = 0,.left = {0},.args_var = (string){.str=(byteptr)"", .is_lit=1},.is_vweb = 0,.vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),},.is_embed = 0,.is_env = 0,.env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pkgconfig = 0,.left_type = 0,.result_type = 0,.env_value = (string){.str=(byteptr)"", .is_lit=1},.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.embed_file = (v__ast__EmbeddedFile){.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.is_compressed = 0,.bytes = __new_array(0, 0, sizeof(u8)),.len = 0,},}))); + v__ast__ComptimeCall *err_node = HEAP(v__ast__ComptimeCall, (((v__ast__ComptimeCall){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_parens = 0,.method_name = (string){.str=(byteptr)"", .is_lit=1},.method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.scope = 0,.left = {0},.args_var = (string){.str=(byteptr)"", .is_lit=1},.is_vweb = 0,.vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),},.is_embed = 0,.is_env = 0,.env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pkgconfig = 0,.left_type = 0,.result_type = 0,.env_value = (string){.str=(byteptr)"", .is_lit=1},.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.embed_file = (v__ast__EmbeddedFile){.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.is_compressed = 0,.bytes = __new_array(0, 0, sizeof(u8)),.len = 0,},}))); v__parser__Parser_check(p, v__token__Kind__dollar); v__token__Pos start_pos = v__token__Token_pos(&p->prev_tok); string error_msg = _SLIT("only `$tmpl()`, `$env()`, `$embed_file()`, `$pkgconfig()` and `$vweb.html()` comptime functions are supported right now"); @@ -82864,7 +85582,7 @@ VV_LOCAL_SYMBOL v__ast__ComptimeCall v__parser__Parser_comptime_call(v__parser__ .left = {0}, .args_var = s, .is_vweb = 0, - .vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),}, + .vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),}, .is_embed = 0, .is_env = true, .env_pos = spos, @@ -82890,7 +85608,7 @@ VV_LOCAL_SYMBOL v__ast__ComptimeCall v__parser__Parser_comptime_call(v__parser__ .left = {0}, .args_var = s, .is_vweb = 0, - .vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),}, + .vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),}, .is_embed = 0, .is_env = 0, .env_pos = spos, @@ -82946,7 +85664,7 @@ VV_LOCAL_SYMBOL v__ast__ComptimeCall v__parser__Parser_comptime_call(v__parser__ if (string__eq(embed_compression_type, _SLIT("zlib")) && (p->pref->is_prod || Array_string_contains(p->pref->compile_defines, _SLIT("debug_embed_file_in_prod")))) { v__parser__Parser_register_auto_import(p, _SLIT("v.preludes.embed_file.zlib")); } - v__ast__ComptimeCall _t8 = ((v__ast__ComptimeCall){.pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)),.has_parens = 0,.method_name = (string){.str=(byteptr)"", .is_lit=1},.method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.scope = 0,.left = {0},.args_var = (string){.str=(byteptr)"", .is_lit=1},.is_vweb = 0,.vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),},.is_embed = true,.is_env = 0,.env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pkgconfig = 0,.left_type = 0,.result_type = 0,.env_value = (string){.str=(byteptr)"", .is_lit=1},.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.embed_file = ((v__ast__EmbeddedFile){.rpath = literal_string_param,.apath = epath,.compression_type = embed_compression_type,.is_compressed = 0,.bytes = __new_array(0, 0, sizeof(u8)),.len = 0,}),}); + v__ast__ComptimeCall _t8 = ((v__ast__ComptimeCall){.pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)),.has_parens = 0,.method_name = (string){.str=(byteptr)"", .is_lit=1},.method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.scope = 0,.left = {0},.args_var = (string){.str=(byteptr)"", .is_lit=1},.is_vweb = 0,.vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),},.is_embed = true,.is_env = 0,.env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pkgconfig = 0,.left_type = 0,.result_type = 0,.env_value = (string){.str=(byteptr)"", .is_lit=1},.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.embed_file = ((v__ast__EmbeddedFile){.rpath = literal_string_param,.apath = epath,.compression_type = embed_compression_type,.is_compressed = 0,.bytes = __new_array(0, 0, sizeof(u8)),.len = 0,}),}); return _t8; } Array_string fn_path = string_split(p->cur_fn_name, _SLIT("_")); @@ -82971,7 +85689,7 @@ VV_LOCAL_SYMBOL v__ast__ComptimeCall v__parser__Parser_comptime_call(v__parser__ } if (!os__exists(path)) { if (p->pref->is_fmt) { - v__ast__ComptimeCall _t9 = ((v__ast__ComptimeCall){.pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)),.has_parens = 0,.method_name = method_name,.method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.scope = 0,.left = {0},.args_var = literal_string_param,.is_vweb = true,.vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),},.is_embed = 0,.is_env = 0,.env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pkgconfig = 0,.left_type = 0,.result_type = 0,.env_value = (string){.str=(byteptr)"", .is_lit=1},.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.embed_file = (v__ast__EmbeddedFile){.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.is_compressed = 0,.bytes = __new_array(0, 0, sizeof(u8)),.len = 0,},}); + v__ast__ComptimeCall _t9 = ((v__ast__ComptimeCall){.pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)),.has_parens = 0,.method_name = method_name,.method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.scope = 0,.left = {0},.args_var = literal_string_param,.is_vweb = true,.vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),},.is_embed = 0,.is_env = 0,.env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pkgconfig = 0,.left_type = 0,.result_type = 0,.env_value = (string){.str=(byteptr)"", .is_lit=1},.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.embed_file = (v__ast__EmbeddedFile){.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.is_compressed = 0,.bytes = __new_array(0, 0, sizeof(u8)),.len = 0,},}); return _t9; } if (is_html) { @@ -83105,7 +85823,7 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_comptime_selector(v__parser__Pars .left = left, .args_var = _SLIT(""), .is_vweb = 0, - .vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),}, + .vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),}, .is_embed = 0, .is_env = 0, .env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, @@ -83894,7 +86612,7 @@ v__ast__Expr v__parser__Parser_expr_with_left(v__parser__Parser* p, v__ast__Expr v__ast__Expr right = v__parser__Parser_expr(p, precedence - 1); v__token__Pos_update_last_line(&pos, p->prev_tok.line_nr); if ((node)._typ == 269 /* v.ast.IndexExpr */) { - v__ast__IndexExpr_recursive_mapset_is_setter(&(*node._v__ast__IndexExpr), true); + v__ast__IndexExpr_recursive_arraymap_set_is_setter(&(*node._v__ast__IndexExpr)); } node = v__ast__InfixExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__InfixExpr, (((v__ast__InfixExpr){.op = tok.kind,.pos = pos,.is_stmt = true,.left = node,.right = right,.left_type = 0,.right_type = 0,.auto_locked = (string){.str=(byteptr)"", .is_lit=1},.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.ct_left_value_evaled = 0,.ct_left_value = v__ast__empty_comptime_const_expr(),.ct_right_value_evaled = 0,.ct_right_value = v__ast__empty_comptime_const_expr(),})))); } else if (v__token__Kind_is_infix(p->tok.kind)) { @@ -84341,7 +87059,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { Option_void _t5 = v__parser__Parser_fn_receiver(p, &/*arr*/params, (voidptr)&/*qq*/rec); if (_t5.state != 0 && _t5.err._typ != _IError_None___index) { IError err = _t5.err; - v__ast__FnDecl _t6 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t6 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); return _t6; } @@ -84355,7 +87073,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { name = (language == v__ast__Language__js ? (v__parser__Parser_check_js_name(p)) : (v__parser__Parser_check_name(p))); if (language == v__ast__Language__v && !p->pref->translated && !p->is_translated && v__util__contains_capital(name) && !p->builtin_mod) { v__parser__Parser_error_with_pos(p, _SLIT("function names cannot contain uppercase letters, use snake_case instead"), name_pos); - v__ast__FnDecl _t7 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t7 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); return _t7; } v__ast__TypeSymbol* type_sym = v__ast__Table_sym(p->table, rec.typ); @@ -84368,14 +87086,14 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { } if (is_duplicate) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("duplicate method `"), 0xfe10, {.d_s = name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), name_pos); - v__ast__FnDecl _t8 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t8 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); return _t8; } } if (!p->pref->is_fmt) { if (_IN_MAP(ADDR(string, name), ADDR(map, p->imported_symbols))) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot redefine imported function `"), 0xfe10, {.d_s = name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), name_pos); - v__ast__FnDecl _t9 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t9 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); return _t9; } } @@ -84389,7 +87107,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { v__parser__Parser_error_with_pos(p, _SLIT("cannot overload `!=`, `>`, `<=` and `>=` as they are auto generated from `==` and`<`"), v__token__Token_pos(&p->tok)); } else { v__parser__Parser_error_with_pos(p, _SLIT("expecting method name"), v__token__Token_pos(&p->tok)); - v__ast__FnDecl _t10 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t10 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); return _t10; } multi_return_Array_v__ast__Type_Array_string mr_8867 = v__parser__Parser_parse_generic_types(p); @@ -84429,7 +87147,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { v__ast__Param param = ((v__ast__Param*)params.data)[_t16]; if (v__ast__Scope_known_var(p->scope, param.name)) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("redefinition of parameter `"), 0xfe10, {.d_s = param.name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), param.pos); - v__ast__FnDecl _t17 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t17 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); return _t17; } bool is_stack_obj = !v__ast__Type_has_flag(param.typ, v__ast__TypeFlag__shared_f) && (param.is_mut || v__ast__Type_is_ptr(param.typ)); @@ -84480,7 +87198,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { } if (is_non_local) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot define new methods on non-local type "), 0xfe10, {.d_s = type_sym->name}}, {_SLIT0, 0, { .d_c = 0 }}})), rec.type_pos); - v__ast__FnDecl _t18 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t18 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); return _t18; } type_sym_method_idx = v__ast__TypeSymbol_register_method(type_sym, ((v__ast__Fn){ @@ -84589,7 +87307,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { } if (!no_body && are_args_type_only) { v__parser__Parser_error_with_pos(p, _SLIT("functions with type only args can not have bodies"), body_start_pos); - v__ast__FnDecl _t22 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t22 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); return _t22; } v__ast__FnDecl fn_decl = ((v__ast__FnDecl){ @@ -84626,6 +87344,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { .is_direct_arr = is_direct_arr, .attrs = p->attrs, .ctdefine_idx = conditional_ctdefine_idx, + .idx = 0, .params = params, .stmts = stmts, .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), @@ -84750,7 +87469,7 @@ bool v__parser__Parser_anon_fn_defer_0 = false; v__parser__Parser_check(p, v__token__Kind__key_fn); if (p->pref->is_script && p->tok.kind == v__token__Kind__name) { v__parser__Parser_error_with_pos(p, _SLIT("function declarations in script mode should be before all script statements"), v__token__Token_pos(&p->tok)); - v__ast__AnonFn _t1 = ((v__ast__AnonFn){.decl = (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.inherited_vars = __new_array(0, 0, sizeof(v__ast__Param)),.typ = 0,.has_gen = 0,}); + v__ast__AnonFn _t1 = ((v__ast__AnonFn){.decl = (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.inherited_vars = __new_array(0, 0, sizeof(v__ast__Param)),.typ = 0,.has_gen = 0,}); return _t1; } bool old_inside_defer = p->inside_defer; @@ -84857,6 +87576,7 @@ bool v__parser__Parser_anon_fn_defer_0 = false; .is_direct_arr = 0, .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), .ctdefine_idx = -1, + .idx = 0, .params = args, .stmts = stmts, .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), @@ -86733,7 +89453,7 @@ bool v__parser__parse_stmt_defer_0 = false; eprintln( str_intp(4, _MOV((StrIntpData[]){{_SLIT("> "), 0xfe10, {.d_s = _SLIT("v.parser")}}, {_SLIT("."), 0xfe10, {.d_s = _SLIT("parse_stmt")}}, {_SLIT(" text: "), 0xfe10, {.d_s = text}}, {_SLIT0, 0, { .d_c = 0 }}}))); } #endif - v__parser__Parser p = ((v__parser__Parser){.pref = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.os = 0,.backend = 0,.build_mode = 0,.arch = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.profile_no_inline = 0,.profile_fns = __new_array(0, 0, sizeof(string)),.translated = 0,.is_prod = 0,.obfuscate = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.use_cache = 0,.retry_compilation = true,.is_stats = 0,.cflags = (string){.str=(byteptr)"", .is_lit=1},.m64 = 0,.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.ccompiler_type = 0,.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_fmt = 0,.is_vet = 0,.is_bare = 0,.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.no_preludes = 0,.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.lookup_path = __new_array(0, 0, sizeof(string)),.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.use_color = 0,.no_parallel = 0,.is_vweb = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.is_ios_simulator = 0,.is_apk = 0,.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.is_help = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.is_cstrict = 0,.assert_failure_mode = 0,.message_limit = 100,.nofloat = 0,.checker_match_exhaustive_cutoff_limit = 12,}, sizeof(v__pref__Preferences))),.file_base = (string){.str=(byteptr)"", .is_lit=1},.file_name = (string){.str=(byteptr)"", .is_lit=1},.file_name_dir = (string){.str=(byteptr)"", .is_lit=1},.unique_prefix = (string){.str=(byteptr)"", .is_lit=1},.file_backend_mode = 0,.scanner = v__scanner__new_scanner(text, v__scanner__CommentsMode__skip_comments, ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.os = 0,.backend = 0,.build_mode = 0,.arch = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.profile_no_inline = 0,.profile_fns = __new_array(0, 0, sizeof(string)),.translated = 0,.is_prod = 0,.obfuscate = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.use_cache = 0,.retry_compilation = true,.is_stats = 0,.cflags = (string){.str=(byteptr)"", .is_lit=1},.m64 = 0,.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.ccompiler_type = 0,.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_fmt = 0,.is_vet = 0,.is_bare = 0,.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.no_preludes = 0,.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.lookup_path = __new_array(0, 0, sizeof(string)),.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.use_color = 0,.no_parallel = 0,.is_vweb = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.is_ios_simulator = 0,.is_apk = 0,.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.is_help = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.is_cstrict = 0,.assert_failure_mode = 0,.message_limit = 100,.nofloat = 0,.checker_match_exhaustive_cutoff_limit = 12,}, sizeof(v__pref__Preferences)))),.comments_mode = v__scanner__CommentsMode__skip_comments,.tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.prev_tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.peek_tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.table = table,.language = 0,.fn_language = 0,.expr_level = 0,.inside_vlib_file = 0,.inside_test_file = true,.inside_if = 0,.inside_if_expr = 0,.inside_if_cond = 0,.inside_ct_if_expr = 0,.inside_or_expr = 0,.inside_for = 0,.inside_fn = 0,.inside_fn_return = 0,.inside_unsafe_fn = 0,.inside_str_interp = 0,.inside_array_lit = 0,.inside_in_array = 0,.inside_match = 0,.inside_select = 0,.inside_match_case = 0,.inside_match_body = 0,.inside_unsafe = 0,.inside_sum_type = 0,.inside_asm_template = 0,.inside_asm = 0,.inside_defer = 0,.inside_generic_params = 0,.inside_receiver_param = 0,.inside_struct_field_decl = 0,.or_is_handled = 0,.builtin_mod = 0,.mod = (string){.str=(byteptr)"", .is_lit=1},.is_manualfree = 0,.has_globals = 0,.is_generated = 0,.is_translated = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.expr_mod = (string){.str=(byteptr)"", .is_lit=1},.scope = scope,.imports = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.ast_imports = __new_array(0, 0, sizeof(v__ast__Import)),.used_imports = __new_array(0, 0, sizeof(string)),.auto_imports = __new_array(0, 0, sizeof(string)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.is_amp = 0,.returns = 0,.is_stmt_ident = 0,.expecting_type = 0,.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.vet_errors = __new_array(0, 0, sizeof(v__vet__Error)),.cur_fn_name = (string){.str=(byteptr)"", .is_lit=1},.label_names = __new_array(0, 0, sizeof(string)),.name_error = 0,.n_asm = 0,.global_labels = __new_array(0, 0, sizeof(string)),.comptime_if_cond = 0,.defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)),.should_abort = 0,.codegen_text = (string){.str=(byteptr)"", .is_lit=1},.struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)),}); + v__parser__Parser p = ((v__parser__Parser){.pref = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.os = 0,.backend = 0,.build_mode = 0,.arch = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.profile_no_inline = 0,.profile_fns = __new_array(0, 0, sizeof(string)),.translated = 0,.is_prod = 0,.obfuscate = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.use_cache = 0,.retry_compilation = true,.is_stats = 0,.cflags = (string){.str=(byteptr)"", .is_lit=1},.m64 = 0,.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.ccompiler_type = 0,.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_fmt = 0,.is_vet = 0,.is_bare = 0,.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.no_preludes = 0,.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.lookup_path = __new_array(0, 0, sizeof(string)),.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.use_color = 0,.no_parallel = 0,.is_vweb = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.is_ios_simulator = 0,.is_apk = 0,.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.is_help = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.is_cstrict = 0,.assert_failure_mode = 0,.message_limit = 100,.nofloat = 0,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,}, sizeof(v__pref__Preferences))),.file_base = (string){.str=(byteptr)"", .is_lit=1},.file_name = (string){.str=(byteptr)"", .is_lit=1},.file_name_dir = (string){.str=(byteptr)"", .is_lit=1},.unique_prefix = (string){.str=(byteptr)"", .is_lit=1},.file_backend_mode = 0,.scanner = v__scanner__new_scanner(text, v__scanner__CommentsMode__skip_comments, ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.os = 0,.backend = 0,.build_mode = 0,.arch = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.profile_no_inline = 0,.profile_fns = __new_array(0, 0, sizeof(string)),.translated = 0,.is_prod = 0,.obfuscate = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.use_cache = 0,.retry_compilation = true,.is_stats = 0,.cflags = (string){.str=(byteptr)"", .is_lit=1},.m64 = 0,.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.ccompiler_type = 0,.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_fmt = 0,.is_vet = 0,.is_bare = 0,.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.no_preludes = 0,.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.lookup_path = __new_array(0, 0, sizeof(string)),.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.use_color = 0,.no_parallel = 0,.is_vweb = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.is_ios_simulator = 0,.is_apk = 0,.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.is_help = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.is_cstrict = 0,.assert_failure_mode = 0,.message_limit = 100,.nofloat = 0,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,}, sizeof(v__pref__Preferences)))),.comments_mode = v__scanner__CommentsMode__skip_comments,.tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.prev_tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.peek_tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.table = table,.language = 0,.fn_language = 0,.expr_level = 0,.inside_vlib_file = 0,.inside_test_file = true,.inside_if = 0,.inside_if_expr = 0,.inside_if_cond = 0,.inside_ct_if_expr = 0,.inside_or_expr = 0,.inside_for = 0,.inside_fn = 0,.inside_fn_return = 0,.inside_unsafe_fn = 0,.inside_str_interp = 0,.inside_array_lit = 0,.inside_in_array = 0,.inside_match = 0,.inside_select = 0,.inside_match_case = 0,.inside_match_body = 0,.inside_unsafe = 0,.inside_sum_type = 0,.inside_asm_template = 0,.inside_asm = 0,.inside_defer = 0,.inside_generic_params = 0,.inside_receiver_param = 0,.inside_struct_field_decl = 0,.or_is_handled = 0,.builtin_mod = 0,.mod = (string){.str=(byteptr)"", .is_lit=1},.is_manualfree = 0,.has_globals = 0,.is_generated = 0,.is_translated = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.expr_mod = (string){.str=(byteptr)"", .is_lit=1},.scope = scope,.imports = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.ast_imports = __new_array(0, 0, sizeof(v__ast__Import)),.used_imports = __new_array(0, 0, sizeof(string)),.auto_imports = __new_array(0, 0, sizeof(string)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.is_amp = 0,.returns = 0,.is_stmt_ident = 0,.expecting_type = 0,.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.vet_errors = __new_array(0, 0, sizeof(v__vet__Error)),.cur_fn_name = (string){.str=(byteptr)"", .is_lit=1},.label_names = __new_array(0, 0, sizeof(string)),.name_error = 0,.n_asm = 0,.global_labels = __new_array(0, 0, sizeof(string)),.comptime_if_cond = 0,.defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)),.should_abort = 0,.codegen_text = (string){.str=(byteptr)"", .is_lit=1},.struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)),}); v__parser__Parser_init_parse_fns(&p); v__util__timing_start(_SLIT("PARSE stmt")); v__parser__parse_stmt_defer_0 = true; @@ -87256,6 +89976,7 @@ bool v__parser__Parser_parse_defer_0 = false; .is_test = p->inside_test_file, .is_generated = p->is_generated, .is_translated = p->is_translated, + .idx = 0, .path = p->file_name, .path_base = p->file_base, .scope = p->scope, @@ -87572,6 +90293,7 @@ v__ast__Stmt v__parser__Parser_top_stmt(v__parser__Parser* p) { .is_direct_arr = 0, .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), .ctdefine_idx = -1, + .idx = 0, .params = __new_array(0, 0, sizeof(v__ast__Param)), .stmts = stmts, .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), @@ -91084,7 +93806,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; v__parser__Parser_next(p); is_field_volatile = true; } - bool is_embed = ((p->tok.lit.len > 1 && u8_is_capital(string_at(p->tok.lit, 0)) && (p->peek_tok.kind != v__token__Kind__lsbr || v__parser__Parser_peek_token(p, 2).kind != v__token__Kind__rsbr)) || p->peek_tok.kind == v__token__Kind__dot) && language == v__ast__Language__v && p->peek_tok.kind != v__token__Kind__key_fn; + bool is_embed = ((p->tok.lit.len > 1 && u8_is_capital(string_at(p->tok.lit, 0)) && (p->peek_tok.line_nr != p->tok.line_nr || !(p->peek_tok.kind == v__token__Kind__name || p->peek_tok.kind == v__token__Kind__amp)) && (p->peek_tok.kind != v__token__Kind__lsbr || v__parser__Parser_peek_token(p, 2).kind != v__token__Kind__rsbr)) || p->peek_tok.kind == v__token__Kind__dot) && language == v__ast__Language__v && p->peek_tok.kind != v__token__Kind__key_fn; bool is_on_top = ast_fields.len == 0 && !(is_field_mut || is_field_global); string field_name = _SLIT(""); v__ast__Type typ = ((v__ast__Type)(0)); @@ -91401,8 +94123,8 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser } else { interface_name = v__parser__Parser_prepend_mod(p, modless_name); } - multi_return_Array_v__ast__Type_Array_string mr_12928 = v__parser__Parser_parse_generic_types(p); - Array_v__ast__Type generic_types = mr_12928.arg0; + multi_return_Array_v__ast__Type_Array_string mr_13010 = v__parser__Parser_parse_generic_types(p); + Array_v__ast__Type generic_types = mr_13010.arg0; v__parser__Parser_check(p, v__token__Kind__lcbr); Array_v__ast__Comment pre_comments = v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,})); if (_IN_MAP(ADDR(string, modless_name), ADDR(map, p->imported_symbols))) { @@ -91438,7 +94160,7 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser Array_v__ast__InterfaceEmbedding ifaces = __new_array_with_default(0, 0, sizeof(v__ast__InterfaceEmbedding), 0); for (;;) { if (!(p->tok.kind != v__token__Kind__rcbr && p->tok.kind != v__token__Kind__eof)) break; - if (p->tok.kind == v__token__Kind__name && p->tok.lit.len > 0 && u8_is_capital(string_at(p->tok.lit, 0))) { + if (p->tok.kind == v__token__Kind__name && p->tok.lit.len > 0 && u8_is_capital(string_at(p->tok.lit, 0)) && p->peek_tok.kind != v__token__Kind__lpar) { v__token__Pos iface_pos = v__token__Token_pos(&p->tok); string iface_name = p->tok.lit; v__ast__Type iface_type = v__parser__Parser_parse_type(p); @@ -91495,16 +94217,11 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser v__ast__InterfaceDecl _t7 = ((v__ast__InterfaceDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.language = 0,.field_names = __new_array(0, 0, sizeof(string)),.is_pub = 0,.mut_pos = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.are_embeds_expanded = 0,}); return _t7; } - if (language == v__ast__Language__v && v__util__contains_capital(name)) { - v__parser__Parser_error(p, _SLIT("interface methods cannot contain uppercase letters, use snake_case instead")); - v__ast__InterfaceDecl _t8 = ((v__ast__InterfaceDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.language = 0,.field_names = __new_array(0, 0, sizeof(string)),.is_pub = 0,.mut_pos = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.are_embeds_expanded = 0,}); - return _t8; - } - multi_return_Array_v__ast__Param_bool_bool mr_16146 = v__parser__Parser_fn_args(p); - Array_v__ast__Param args2 = mr_16146.arg0; - bool is_variadic = mr_16146.arg2; + multi_return_Array_v__ast__Param_bool_bool mr_16079 = v__parser__Parser_fn_args(p); + Array_v__ast__Param args2 = mr_16079.arg0; + bool is_variadic = mr_16079.arg2; Array_v__ast__Param args = new_array_from_c_array(1, 1, sizeof(v__ast__Param), _MOV((v__ast__Param[1]){((v__ast__Param){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = _SLIT("x"),.is_mut = is_mut,.is_auto_rec = 0,.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_hidden = true,.typ = typ,})})); - _PUSH_MANY(&args, (args2), _t9, Array_v__ast__Param); + _PUSH_MANY(&args, (args2), _t8, Array_v__ast__Param); v__ast__FnDecl method = ((v__ast__FnDecl){ .name = name, .short_name = name, @@ -91539,6 +94256,7 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser .is_direct_arr = 0, .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), .ctdefine_idx = -1, + .idx = 0, .params = args, .stmts = __new_array(0, 0, sizeof(v__ast__Stmt)), .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), @@ -91632,17 +94350,17 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser array_push((array*)&info.fields, _MOV((v__ast__StructField[]){ ((v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = true,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = is_mut,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = field_name,.typ = field_typ,}) })); } } - Array_v__ast__Type _t15 = {0}; - Array_v__ast__InterfaceEmbedding _t15_orig = ifaces; - int _t15_len = _t15_orig.len; - _t15 = __new_array(0, _t15_len, sizeof(v__ast__Type)); + Array_v__ast__Type _t14 = {0}; + Array_v__ast__InterfaceEmbedding _t14_orig = ifaces; + int _t14_len = _t14_orig.len; + _t14 = __new_array(0, _t14_len, sizeof(v__ast__Type)); - for (int _t16 = 0; _t16 < _t15_len; ++_t16) { - v__ast__InterfaceEmbedding it = ((v__ast__InterfaceEmbedding*) _t15_orig.data)[_t16]; + for (int _t15 = 0; _t15 < _t14_len; ++_t15) { + v__ast__InterfaceEmbedding it = ((v__ast__InterfaceEmbedding*) _t14_orig.data)[_t15]; v__ast__Type ti = it.typ; - array_push((array*)&_t15, &ti); + array_push((array*)&_t14, &ti); } - info.embeds =_t15; + info.embeds =_t14; ts->info = v__ast__Interface_to_sumtype_v__ast__TypeInfo(&info); v__parser__Parser_top_level_statement_end(p); v__parser__Parser_check(p, v__token__Kind__rcbr); @@ -91665,8 +94383,8 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser .are_embeds_expanded = 0, }); v__ast__Table_register_interface(p->table, res); - v__ast__InterfaceDecl _t17 = res; - return _t17; + v__ast__InterfaceDecl _t16 = res; + return _t16; } VV_LOCAL_SYMBOL void v__parser__State_update(v__parser__State* state, string line) { @@ -91786,7 +94504,7 @@ string v__parser__Parser_compile_template_file(v__parser__Parser* p, string temp } int position = (*(int*)_t3.data); - v__parser__Parser_error_with_error(p, ((v__errors__Error){.message = _SLIT("Please use @include 'header' instead of @header (deprecated)"),.details = (string){.str=(byteptr)"", .is_lit=1},.file_path = template_file,.pos = ((v__token__Pos){.len = _SLIT("@header").len,.line_nr = tline_number,.pos = start_of_line_pos + position,.col = 0,.last_line = lines.len,}),.backtrace = (string){.str=(byteptr)"", .is_lit=1},.reporter = v__errors__Reporter__parser,})); + v__parser__Parser_error_with_error(p, ((v__errors__Error){.message = _SLIT("Please use @include 'header' instead of @header (deprecated)"),.details = (string){.str=(byteptr)"", .is_lit=1},.file_path = template_file,.pos = ((v__token__Pos){.len = 7,.line_nr = tline_number,.pos = start_of_line_pos + position,.col = 0,.last_line = lines.len,}),.backtrace = (string){.str=(byteptr)"", .is_lit=1},.reporter = v__errors__Reporter__parser,})); continue; } if (string_contains(line, _SLIT("@footer"))) { @@ -91797,7 +94515,7 @@ string v__parser__Parser_compile_template_file(v__parser__Parser* p, string temp } int position = (*(int*)_t4.data); - v__parser__Parser_error_with_error(p, ((v__errors__Error){.message = _SLIT("Please use @include 'footer' instead of @footer (deprecated)"),.details = (string){.str=(byteptr)"", .is_lit=1},.file_path = template_file,.pos = ((v__token__Pos){.len = _SLIT("@footer").len,.line_nr = tline_number,.pos = start_of_line_pos + position,.col = 0,.last_line = lines.len,}),.backtrace = (string){.str=(byteptr)"", .is_lit=1},.reporter = v__errors__Reporter__parser,})); + v__parser__Parser_error_with_error(p, ((v__errors__Error){.message = _SLIT("Please use @include 'footer' instead of @footer (deprecated)"),.details = (string){.str=(byteptr)"", .is_lit=1},.file_path = template_file,.pos = ((v__token__Pos){.len = 7,.line_nr = tline_number,.pos = start_of_line_pos + position,.col = 0,.last_line = lines.len,}),.backtrace = (string){.str=(byteptr)"", .is_lit=1},.reporter = v__errors__Reporter__parser,})); continue; } if (string_contains(line, _SLIT("@include "))) { @@ -91827,8 +94545,8 @@ string v__parser__Parser_compile_template_file(v__parser__Parser* p, string temp *(int*) _t6.data = 0; } - int position = (*(int*)_t6.data) + _SLIT("@include ").len; - v__parser__Parser_error_with_error(p, ((v__errors__Error){.message = str_intp(3, _MOV((StrIntpData[]){{_SLIT("Reading file "), 0xfe10, {.d_s = file_name}}, {_SLIT(" from path: "), 0xfe10, {.d_s = file_path}}, {_SLIT(" failed"), 0, { .d_c = 0 }}})),.details = str_intp(2, _MOV((StrIntpData[]){{_SLIT("Failed to @include '"), 0xfe10, {.d_s = file_name}}, {_SLIT("'"), 0, { .d_c = 0 }}})),.file_path = template_file,.pos = ((v__token__Pos){.len = _SLIT("@include ").len + file_name.len,.line_nr = tline_number,.pos = start_of_line_pos + position,.col = 0,.last_line = lines.len,}),.backtrace = (string){.str=(byteptr)"", .is_lit=1},.reporter = v__errors__Reporter__parser,})); + int position = (*(int*)_t6.data) + 9; + v__parser__Parser_error_with_error(p, ((v__errors__Error){.message = str_intp(3, _MOV((StrIntpData[]){{_SLIT("Reading file "), 0xfe10, {.d_s = file_name}}, {_SLIT(" from path: "), 0xfe10, {.d_s = file_path}}, {_SLIT(" failed"), 0, { .d_c = 0 }}})),.details = str_intp(2, _MOV((StrIntpData[]){{_SLIT("Failed to @include '"), 0xfe10, {.d_s = file_name}}, {_SLIT("'"), 0, { .d_c = 0 }}})),.file_path = template_file,.pos = ((v__token__Pos){.len = 9 + file_name.len,.line_nr = tline_number,.pos = start_of_line_pos + position,.col = 0,.last_line = lines.len,}),.backtrace = (string){.str=(byteptr)"", .is_lit=1},.reporter = v__errors__Reporter__parser,})); *(string*) _t5.data = _SLIT(""); } @@ -92067,6 +94785,7 @@ v__builder__Builder v__builder__new_builder(v__pref__Preferences* pref) { if (pref->use_color == v__pref__ColorOutput__never) { v__util__EManager_set_support_color(_const_v__util__emanager, false); } + table->pointer_size = (pref->m64 ? (8) : (4)); Option_v__builder__MsvcResult _t1 = v__builder__find_msvc(pref->m64); if (_t1.state != 0) { /*or block*/ IError err = _t1.err; @@ -95591,23 +98310,6 @@ void _vinit(int ___argc, voidptr ___argv) { } { // Initializations for module v.mathutil : } - { // Initializations for module time : - _const_time__month_days = new_array_from_c_array(12, 12, sizeof(int), _MOV((int[12]){ - 31, 28, 31, 30, 31, 30, 31, 31, 30, - 31, 30, 31})); - _const_time__absolute_zero_year = ((i64)(-292277022399)); - _const_time__days_before = new_array_from_c_array(13, 13, sizeof(int), _MOV((int[13]){ - 0, 31, 59, 90, 120, 151, 181, 212, 243, - 273, 304, 334, 365})); - _const_time__long_days = new_array_from_c_array(7, 7, sizeof(string), _MOV((string[7]){_SLIT("Monday"), _SLIT("Tuesday"), _SLIT("Wednesday"), _SLIT("Thursday"), _SLIT("Friday"), _SLIT("Saturday"), _SLIT("Sunday")})); - _const_time__nanosecond = ((time__Duration)(1)); - _const_time__microsecond = ((1000 * _const_time__nanosecond)); - _const_time__millisecond = ((1000 * _const_time__microsecond)); - _const_time__second = ((1000 * _const_time__millisecond)); - _const_time__minute = ((60 * _const_time__second)); - _const_time__hour = ((60 * _const_time__minute)); - _const_time__infinite = ((((i64)(9223372036854775807)))); - } { // Initializations for module v.dotgraph : } { // Initializations for module hash : @@ -95618,6 +98320,8 @@ void _vinit(int ___argc, voidptr ___argv) { } { // Initializations for module hash.fnv1a : } + { // Initializations for module math.internal : + } { // Initializations for module flag : } { // Initializations for module semver : @@ -95633,8 +98337,6 @@ void _vinit(int ___argc, voidptr ___argv) { } { // Initializations for module v.vcache : } - { // Initializations for module v.util.diff : - } { // Initializations for module v.vmod : _const_v__vmod__mod_file_stop_paths = new_array_from_c_array(4, 4, sizeof(string), _MOV((string[4]){_SLIT(".git"), _SLIT(".hg"), _SLIT(".svn"), _SLIT(".v.mod.stop")})); _const_v__vmod__private_file_cacher = v__vmod__new_mod_file_cacher(); @@ -95647,6 +98349,100 @@ void _vinit(int ___argc, voidptr ___argv) { } { // Initializations for module v.cflag : } + { // Initializations for module math : + _const_math__pi_2 = _const_math__pi / 2.0; + _const_math__pi_4 = _const_math__pi / 4.0; + _const_math__log2_e = 1.0 / _const_math__ln2; + _const_math__log10_e = 1.0 / _const_math__ln10; + _const_math__min_i64 = ((i64)(-9223372036854775807 - 1)); + _const_math__max_i64 = ((i64)(9223372036854775807)); + _const_math__bernoulli = new_array_from_c_array(10, 10, sizeof(f64), _MOV((f64[10]){ + 1.0 / (12.), -1.0 / (360), 1.0 / (1260), -1.0 / (1680), 5.0 / (5940), -691.0 / (360360), 7.0 / (1092.), -3617.0 / (122400), 43867.0 / (243576.), + -174611.0 / (125400)})); + _const_math__factorials_table = new_array_from_c_array(171, 171, sizeof(f64), _MOV((f64[171]){ + 1.000000000000000000000e+0, 1.000000000000000000000e+0, 2.000000000000000000000e+0, 6.000000000000000000000e+0, 2.400000000000000000000e+1, 1.200000000000000000000e+2, 7.200000000000000000000e+2, 5.040000000000000000000e+3, 4.032000000000000000000e+4, + 3.628800000000000000000e+5, 3.628800000000000000000e+6, 3.991680000000000000000e+7, 4.790016000000000000000e+8, 6.227020800000000000000e+9, 8.717829120000000000000e+10, 1.307674368000000000000e+12, 2.092278988800000000000e+13, + 3.556874280960000000000e+14, 6.402373705728000000000e+15, 1.216451004088320000000e+17, 2.432902008176640000000e+18, 5.109094217170944000000e+19, 1.124000727777607680000e+21, 2.585201673888497664000e+22, 6.204484017332394393600e+23, + 1.551121004333098598400e+25, 4.032914611266056355840e+26, 1.088886945041835216077e+28, 3.048883446117138605015e+29, 8.841761993739701954544e+30, 2.652528598121910586363e+32, 8.222838654177922817726e+33, 2.631308369336935301672e+35, + 8.683317618811886495518e+36, 2.952327990396041408476e+38, 1.033314796638614492967e+40, 3.719933267899012174680e+41, 1.376375309122634504632e+43, 5.230226174666011117600e+44, 2.039788208119744335864e+46, 8.159152832478977343456e+47, + 3.345252661316380710817e+49, 1.405006117752879898543e+51, 6.041526306337383563736e+52, 2.658271574788448768044e+54, 1.196222208654801945620e+56, 5.502622159812088949850e+57, 2.586232415111681806430e+59, 1.241391559253607267086e+61, + 6.082818640342675608723e+62, 3.041409320171337804361e+64, 1.551118753287382280224e+66, 8.065817517094387857166e+67, 4.274883284060025564298e+69, 2.308436973392413804721e+71, 1.269640335365827592597e+73, 7.109985878048634518540e+74, + 4.052691950487721675568e+76, 2.350561331282878571829e+78, 1.386831185456898357379e+80, 8.320987112741390144276e+81, 5.075802138772247988009e+83, 3.146997326038793752565e+85, 1.982608315404440064116e+87, 1.268869321858841641034e+89, + 8.247650592082470666723e+90, 5.443449390774430640037e+92, 3.647111091818868528825e+94, 2.480035542436830599601e+96, 1.711224524281413113725e+98, 1.197857166996989179607e+100, 8.504785885678623175212e+101, 6.123445837688608686152e+103, + 4.470115461512684340891e+105, 3.307885441519386412260e+107, 2.480914081139539809195e+109, 1.885494701666050254988e+111, 1.451830920282858696341e+113, 1.132428117820629783146e+115, 8.946182130782975286851e+116, 7.156945704626380229481e+118, + 5.797126020747367985880e+120, 4.753643337012841748421e+122, 3.945523969720658651190e+124, 3.314240134565353266999e+126, 2.817104114380550276949e+128, 2.422709538367273238177e+130, 2.107757298379527717214e+132, 1.854826422573984391148e+134, + 1.650795516090846108122e+136, 1.485715964481761497310e+138, 1.352001527678402962552e+140, 1.243841405464130725548e+142, 1.156772507081641574759e+144, 1.087366156656743080274e+146, 1.032997848823905926260e+148, 9.916779348709496892096e+149, + 9.619275968248211985333e+151, 9.426890448883247745626e+153, 9.332621544394415268170e+155, 9.332621544394415268170e+157, 9.425947759838359420852e+159, 9.614466715035126609269e+161, 9.902900716486180407547e+163, 1.029901674514562762385e+166, + 1.081396758240290900504e+168, 1.146280563734708354534e+170, 1.226520203196137939352e+172, 1.324641819451828974500e+174, 1.443859583202493582205e+176, 1.588245541522742940425e+178, 1.762952551090244663872e+180, 1.974506857221074023537e+182, + 2.231192748659813646597e+184, 2.543559733472187557120e+186, 2.925093693493015690688e+188, 3.393108684451898201198e+190, 3.969937160808720895402e+192, 4.684525849754290656574e+194, 5.574585761207605881323e+196, 6.689502913449127057588e+198, + 8.094298525273443739682e+200, 9.875044200833601362412e+202, 1.214630436702532967577e+205, 1.506141741511140879795e+207, 1.882677176888926099744e+209, 2.372173242880046885677e+211, 3.012660018457659544810e+213, 3.856204823625804217357e+215, + 4.974504222477287440390e+217, 6.466855489220473672507e+219, 8.471580690878820510985e+221, 1.118248651196004307450e+224, 1.487270706090685728908e+226, 1.992942746161518876737e+228, 2.690472707318050483595e+230, 3.659042881952548657690e+232, + 5.012888748274991661035e+234, 6.917786472619488492228e+236, 9.615723196941089004197e+238, 1.346201247571752460588e+241, 1.898143759076170969429e+243, 2.695364137888162776589e+245, 3.854370717180072770522e+247, 5.550293832739304789551e+249, + 8.047926057471991944849e+251, 1.174997204390910823948e+254, 1.727245890454638911203e+256, 2.556323917872865588581e+258, 3.808922637630569726986e+260, 5.713383956445854590479e+262, 8.627209774233240431623e+264, 1.311335885683452545607e+267, + 2.006343905095682394778e+269, 3.089769613847350887959e+271, 4.789142901463393876336e+273, 7.471062926282894447084e+275, 1.172956879426414428192e+278, 1.853271869493734796544e+280, 2.946702272495038326504e+282, 4.714723635992061322407e+284, + 7.590705053947218729075e+286, 1.229694218739449434110e+289, 2.004401576545302577600e+291, 3.287218585534296227263e+293, 5.423910666131588774984e+295, 9.003691705778437366474e+297, 1.503616514864999040201e+300, 2.526075744973198387538e+302, + 4.269068009004705274939e+304, 7.257415615307998967397e+306})); + _const_math__log_factorials_table = new_array_from_c_array(172, 172, sizeof(f64), _MOV((f64[172]){ + 0.000000000000000000000e+0, 0.000000000000000000000e+0, 6.931471805599453094172e-1, 1.791759469228055000812e+0, 3.178053830347945619647e+0, 4.787491742782045994248e+0, 6.579251212010100995060e+0, 8.525161361065414300166e+0, 1.060460290274525022842e+1, + 1.280182748008146961121e+1, 1.510441257307551529523e+1, 1.750230784587388583929e+1, 1.998721449566188614952e+1, 2.255216385312342288557e+1, 2.519122118273868150009e+1, 2.789927138384089156609e+1, 3.067186010608067280376e+1, + 3.350507345013688888401e+1, 3.639544520803305357622e+1, 3.933988418719949403622e+1, 4.233561646075348502966e+1, 4.538013889847690802616e+1, 4.847118135183522387964e+1, 5.160667556776437357045e+1, 5.478472939811231919009e+1, + 5.800360522298051993929e+1, 6.126170176100200198477e+1, 6.455753862700633105895e+1, 6.788974313718153498289e+1, 7.125703896716800901007e+1, 7.465823634883016438549e+1, 7.809222355331531063142e+1, 8.155795945611503717850e+1, + 8.505446701758151741396e+1, 8.858082754219767880363e+1, 9.213617560368709248333e+1, 9.571969454214320248496e+1, 9.933061245478742692933e+1, 1.029681986145138126988e+2, 1.066317602606434591262e+2, 1.103206397147573954291e+2, + 1.140342117814617032329e+2, 1.177718813997450715388e+2, 1.215330815154386339623e+2, 1.253172711493568951252e+2, 1.291239336391272148826e+2, 1.329525750356163098828e+2, 1.368027226373263684696e+2, 1.406739236482342593987e+2, + 1.445657439463448860089e+2, 1.484777669517730320675e+2, 1.524095925844973578392e+2, 1.563608363030787851941e+2, 1.603311282166309070282e+2, 1.643201122631951814118e+2, 1.683274454484276523305e+2, 1.723527971391628015638e+2, + 1.763958484069973517152e+2, 1.804562914175437710518e+2, 1.845338288614494905025e+2, 1.886281734236715911873e+2, 1.927390472878449024360e+2, 1.968661816728899939914e+2, 2.010093163992815266793e+2, 2.051681994826411985358e+2, + 2.093425867525368356464e+2, 2.135322414945632611913e+2, 2.177369341139542272510e+2, 2.219564418191303339501e+2, 2.261905483237275933323e+2, 2.304390435657769523214e+2, 2.347017234428182677427e+2, 2.389783895618343230538e+2, + 2.432688490029827141829e+2, 2.475729140961868839366e+2, 2.518904022097231943772e+2, 2.562211355500095254561e+2, 2.605649409718632093053e+2, 2.649216497985528010421e+2, 2.692910976510198225363e+2, 2.736731242856937041486e+2, + 2.780675734403661429141e+2, 2.824742926876303960274e+2, 2.868931332954269939509e+2, 2.913239500942703075662e+2, 2.957666013507606240211e+2, 3.002209486470141317540e+2, 3.046868567656687154726e+2, 3.091641935801469219449e+2, + 3.136528299498790617832e+2, 3.181526396202093268500e+2, 3.226634991267261768912e+2, 3.271852877037752172008e+2, 3.317178871969284731381e+2, 3.362611819791984770344e+2, 3.408150588707990178690e+2, 3.453794070622668541074e+2, + 3.499541180407702369296e+2, 3.545390855194408088492e+2, 3.591342053695753987760e+2, 3.637393755555634901441e+2, 3.683544960724047495950e+2, 3.729794688856890206760e+2, 3.776141978739186564468e+2, 3.822585887730600291111e+2, + 3.869125491232175524822e+2, 3.915759882173296196258e+2, 3.962488170517915257991e+2, 4.009309482789157454921e+2, 4.056222961611448891925e+2, 4.103227765269373054205e+2, 4.150323067282496395563e+2, 4.197508055995447340991e+2, + 4.244781934182570746677e+2, 4.292143918666515701285e+2, 4.339593239950148201939e+2, 4.387129141861211848399e+2, 4.434750881209189409588e+2, 4.482457727453846057188e+2, 4.530248962384961351041e+2, 4.578123879812781810984e+2, + 4.626081785268749221865e+2, 4.674121995716081787447e+2, 4.722243839269805962399e+2, 4.770446654925856331047e+2, 4.818729792298879342285e+2, 4.867092611368394122258e+2, 4.915534482232980034989e+2, 4.964054784872176206648e+2, + 5.012652908915792927797e+2, 5.061328253420348751997e+2, 5.110080226652360267439e+2, 5.158908245878223975982e+2, 5.207811737160441513633e+2, 5.256790135159950627324e+2, 5.305842882944334921812e+2, 5.354969431801695441897e+2, + 5.404169241059976691050e+2, 5.453441777911548737966e+2, 5.502786517242855655538e+2, 5.552202941468948698523e+2, 5.601690540372730381305e+2, 5.651248810948742988613e+2, 5.700877257251342061414e+2, 5.750575390247102067619e+2, + 5.800342727671307811636e+2, 5.850178793888391176022e+2, 5.900083119756178539038e+2, 5.950055242493819689670e+2, 6.000094705553274281080e+2, 6.050201058494236838580e+2, 6.100373856862386081868e+2, 6.150612662070848845750e+2, + 6.200917041284773200381e+2, 6.251286567308909491967e+2, 6.301720818478101958172e+2, 6.352219378550597328635e+2, 6.402781836604080409209e+2, 6.453407786934350077245e+2, 6.504096828956552392500e+2, 6.554848567108890661717e+2, + 6.605662610758735291676e+2, 6.656538574111059132426e+2, 6.707476076119126755767e+2, 6.758474740397368739994e+2, 6.809534195136374546094e+2, 6.860654073019939978423e+2, 6.911834011144107529496e+2, 6.963073650938140118743e+2, + 7.014372638087370853465e+2, 7.065730622457873471107e+2, 7.117147258022900069535e+2})); + _const_math__gamma_p = new_array_from_c_array(7, 7, sizeof(f64), _MOV((f64[7]){1.60119522476751861407e-04, 1.19135147006586384913e-03, 1.04213797561761569935e-02, 4.76367800457137231464e-02, 2.07448227648435975150e-01, 4.94214826801497100753e-01, 9.99999999999999996796e-01})); + _const_math__gamma_q = new_array_from_c_array(8, 8, sizeof(f64), _MOV((f64[8]){-2.31581873324120129819e-05, 5.39605580493303397842e-04, -4.45641913851797240494e-03, 1.18139785222060435552e-02, 3.58236398605498653373e-02, -2.34591795718243348568e-01, 7.14304917030273074085e-02, 1.00000000000000000320e+00})); + _const_math__gamma_s = new_array_from_c_array(5, 5, sizeof(f64), _MOV((f64[5]){7.87311395793093628397e-04, -2.29549961613378126380e-04, -2.68132617805781232825e-03, 3.47222221605458667310e-03, 8.33333333333482257126e-02})); + _const_math__lgamma_a = new_array_from_c_array(12, 12, sizeof(f64), _MOV((f64[12]){ + 7.72156649015328655494e-02, 3.22467033424113591611e-01, 6.73523010531292681824e-02, 2.05808084325167332806e-02, 7.38555086081402883957e-03, 2.89051383673415629091e-03, 1.19270763183362067845e-03, 5.10069792153511336608e-04, 2.20862790713908385557e-04, + 1.08011567247583939954e-04, 2.52144565451257326939e-05, 4.48640949618915160150e-05})); + _const_math__lgamma_r = new_array_from_c_array(7, 7, sizeof(f64), _MOV((f64[7]){1.0, 1.39200533467621045958e+00, 7.21935547567138069525e-01, 1.71933865632803078993e-01, 1.86459191715652901344e-02, 7.77942496381893596434e-04, 7.32668430744625636189e-06})); + _const_math__lgamma_s = new_array_from_c_array(7, 7, sizeof(f64), _MOV((f64[7]){-7.72156649015328655494e-02, 2.14982415960608852501e-01, 3.25778796408930981787e-01, 1.46350472652464452805e-01, 2.66422703033638609560e-02, 1.84028451407337715652e-03, 3.19475326584100867617e-05})); + _const_math__lgamma_t = new_array_from_c_array(15, 15, sizeof(f64), _MOV((f64[15]){ + 4.83836122723810047042e-01, -1.47587722994593911752e-01, 6.46249402391333854778e-02, -3.27885410759859649565e-02, 1.79706750811820387126e-02, -1.03142241298341437450e-02, 6.10053870246291332635e-03, -3.68452016781138256760e-03, 2.25964780900612472250e-03, + -1.40346469989232843813e-03, 8.81081882437654011382e-04, -5.38595305356740546715e-04, 3.15632070903625950361e-04, -3.12754168375120860518e-04, 3.35529192635519073543e-04})); + _const_math__lgamma_u = new_array_from_c_array(6, 6, sizeof(f64), _MOV((f64[6]){-7.72156649015328655494e-02, 6.32827064025093366517e-01, 1.45492250137234768737e+00, 9.77717527963372745603e-01, 2.28963728064692451092e-01, 1.33810918536787660377e-02})); + _const_math__lgamma_v = new_array_from_c_array(6, 6, sizeof(f64), _MOV((f64[6]){1.0, 2.45597793713041134822e+00, 2.12848976379893395361e+00, 7.69285150456672783825e-01, 1.04222645593369134254e-01, 3.21709242282423911810e-03})); + _const_math__lgamma_w = new_array_from_c_array(7, 7, sizeof(f64), _MOV((f64[7]){4.18938533204672725052e-01, 8.33333333333329678849e-02, -2.77777777728775536470e-03, 7.93650558643019558500e-04, -5.95187557450339963135e-04, 8.36339918996282139126e-04, -1.63092934096575273989e-03})); + _const_math__pow10tab = new_array_from_c_array(32, 32, sizeof(f64), _MOV((f64[32]){ + ((f64)(1e+00)), 1e+01, 1e+02, 1e+03, 1e+04, 1e+05, 1e+06, 1e+07, 1e+08, + 1e+09, 1e+10, 1e+11, 1e+12, 1e+13, 1e+14, 1e+15, 1e+16, + 1e+17, 1e+18, 1e+19, 1e+20, 1e+21, 1e+22, 1e+23, 1e+24, + 1e+25, 1e+26, 1e+27, 1e+28, 1e+29, 1e+30, 1e+31})); + _const_math__pow10postab32 = new_array_from_c_array(10, 10, sizeof(f64), _MOV((f64[10]){ + ((f64)(1e+00)), 1e+32, 1e+64, 1e+96, 1e+128, 1e+160, 1e+192, 1e+224, 1e+256, + 1e+288})); + _const_math__pow10negtab32 = new_array_from_c_array(11, 11, sizeof(f64), _MOV((f64[11]){ + ((f64)(1e-00)), 1e-32, 1e-64, 1e-96, 1e-128, 1e-160, 1e-192, 1e-224, 1e-256, + 1e-288, 1e-320})); + _const_math__sin_data = new_array_from_c_array(12, 12, sizeof(f64), _MOV((f64[12]){ + -0.3295190160663511504173, 0.0025374284671667991990, 0.0006261928782647355874, -4.6495547521854042157541e-06, -5.6917531549379706526677e-07, 3.7283335140973803627866e-09, 3.0267376484747473727186e-10, -1.7400875016436622322022e-12, -1.0554678305790849834462e-13, + 5.3701981409132410797062e-16, 2.5984137983099020336115e-17, -1.1821555255364833468288e-19})); + _const_math__sin_cs = ((math__ChebSeries){.c = _const_math__sin_data,.order = 11,.a = -1,.b = 1,}); + _const_math__cos_data = new_array_from_c_array(11, 11, sizeof(f64), _MOV((f64[11]){ + 0.165391825637921473505668118136, -0.00084852883845000173671196530195, -0.000210086507222940730213625768083, 1.16582269619760204299639757584e-6, 1.43319375856259870334412701165e-7, -7.4770883429007141617951330184e-10, -6.0969994944584252706997438007e-11, 2.90748249201909353949854872638e-13, 1.77126739876261435667156490461e-14, + -7.6896421502815579078577263149e-17, -3.7363121133079412079201377318e-18})); + _const_math__cos_cs = ((math__ChebSeries){.c = _const_math__cos_data,.order = 10,.a = -1,.b = 1,}); + _const_math__tan_p = new_array_from_c_array(3, 3, sizeof(f64), _MOV((f64[3]){-1.30936939181383777646e+4, 1.15351664838587416140e+6, -1.79565251976484877988e+7})); + _const_math__tan_q = new_array_from_c_array(5, 5, sizeof(f64), _MOV((f64[5]){1.00000000000000000000e+0, 1.36812963470692954678e+4, -1.32089234440210967447e+6, 2.50083801823357915839e+7, -5.38695755929454629881e+7})); + _const_math__tanh_p = new_array_from_c_array(3, 3, sizeof(f64), _MOV((f64[3]){-9.64399179425052238628e-1, -9.92877231001918586564e+1, -1.61468768441708447952e+3})); + _const_math__tanh_q = new_array_from_c_array(3, 3, sizeof(f64), _MOV((f64[3]){1.12811678491632931402e+2, 2.23548839060100448583e+3, 4.84406305325125486048e+3})); + } { // Initializations for module v.pkgconfig : _const_v__pkgconfig__default_paths = new_array_from_c_array(11, 11, sizeof(string), _MOV((string[11]){ _SLIT("/usr/local/lib/x86_64-linux-gnu/pkgconfig"), _SLIT("/usr/local/lib64/pkgconfig"), _SLIT("/usr/local/lib/pkgconfig"), _SLIT("/usr/local/share/pkgconfig"), _SLIT("/usr/lib/x86_64-linux-gnu/pkgconfig"), _SLIT("/usr/lib/aarch64-linux-gnu/pkgconfig"), _SLIT("/usr/lib64/pkgconfig"), _SLIT("/usr/lib/pkgconfig"), _SLIT("/usr/share/pkgconfig"), @@ -95654,10 +98450,37 @@ void _vinit(int ___argc, voidptr ___argv) { } { // Initializations for module v.vet : } - { // Initializations for module rand.seed : - } { // Initializations for module runtime : } + { // Initializations for module time : + _const_time__tokens_2 = new_array_from_c_array(16, 16, sizeof(string), _MOV((string[16]){ + _SLIT("MM"), _SLIT("DD"), _SLIT("Do"), _SLIT("YY"), _SLIT("ss"), _SLIT("kk"), _SLIT("NN"), _SLIT("mm"), _SLIT("hh"), + _SLIT("HH"), _SLIT("ZZ"), _SLIT("dd"), _SLIT("Qo"), _SLIT("QQ"), _SLIT("wo"), _SLIT("ww")})); + _const_time__tokens_3 = new_array_from_c_array(4, 4, sizeof(string), _MOV((string[4]){_SLIT("MMM"), _SLIT("DDD"), _SLIT("ZZZ"), _SLIT("ddd")})); + _const_time__tokens_4 = new_array_from_c_array(5, 5, sizeof(string), _MOV((string[5]){_SLIT("MMMM"), _SLIT("DDDD"), _SLIT("DDDo"), _SLIT("dddd"), _SLIT("YYYY")})); + _const_time__long_days = new_array_from_c_array(7, 7, sizeof(string), _MOV((string[7]){_SLIT("Monday"), _SLIT("Tuesday"), _SLIT("Wednesday"), _SLIT("Thursday"), _SLIT("Friday"), _SLIT("Saturday"), _SLIT("Sunday")})); + _const_time__month_days = new_array_from_c_array(12, 12, sizeof(int), _MOV((int[12]){ + 31, 28, 31, 30, 31, 30, 31, 31, 30, + 31, 30, 31})); + _const_time__long_months = new_array_from_c_array(12, 12, sizeof(string), _MOV((string[12]){ + _SLIT("January"), _SLIT("February"), _SLIT("March"), _SLIT("April"), _SLIT("May"), _SLIT("June"), _SLIT("July"), _SLIT("August"), _SLIT("September"), + _SLIT("October"), _SLIT("November"), _SLIT("December")})); + _const_time__absolute_zero_year = ((i64)(-292277022399)); + _const_time__days_before = new_array_from_c_array(13, 13, sizeof(int), _MOV((int[13]){ + 0, 31, 59, 90, 120, 151, 181, 212, 243, + 273, 304, 334, 365})); + _const_time__nanosecond = ((time__Duration)(1)); + _const_time__microsecond = ((1000 * _const_time__nanosecond)); + _const_time__millisecond = ((1000 * _const_time__microsecond)); + _const_time__second = ((1000 * _const_time__millisecond)); + _const_time__minute = ((60 * _const_time__second)); + _const_time__hour = ((60 * _const_time__minute)); + _const_time__infinite = ((((i64)(9223372036854775807)))); + } + { // Initializations for module v.util.diff : + } + { // Initializations for module rand.seed : + } { // Initializations for module rand.config : } { // Initializations for module rand.wyrand : @@ -95815,8 +98638,8 @@ void _vinit(int ___argc, voidptr ___argv) { _const_v__gen__c__cmp_str = new_array_from_c_array(6, 6, sizeof(string), _MOV((string[6]){_SLIT("eq"), _SLIT("ne"), _SLIT("gt"), _SLIT("lt"), _SLIT("ge"), _SLIT("le")})); _const_v__gen__c__cmp_rev = new_array_from_c_array(6, 6, sizeof(string), _MOV((string[6]){_SLIT("eq"), _SLIT("ne"), _SLIT("lt"), _SLIT("gt"), _SLIT("le"), _SLIT("ge")})); _const_v__gen__c__builtins = new_array_from_c_array(7, 7, sizeof(string), _MOV((string[7]){_SLIT("string"), _SLIT("array"), _SLIT("DenseArray"), _SLIT("map"), _SLIT("Error"), _SLIT("IError"), _SLIT("Option")})); - _const_v__gen__c__c_headers = _SLIT("//============================== HELPER C MACROS =============================*/\n// _SLIT0 is used as NULL string for literal arguments\n// `\"\" s` is used to enforce a string literal argument\n#define _SLIT0 (string){.str=(byteptr)(\"\"), .len=0, .is_lit=1}\n#define _SLIT(s) ((string){.str=(byteptr)(\"\" s), .len=(sizeof(s)-1), .is_lit=1})\n#define _SLEN(s, n) ((string){.str=(byteptr)(\"\" s), .len=n, .is_lit=1})\n\n// take the address of an rvalue\n#define ADDR(type, expr) (&((type[]){expr}[0]))\n\n// copy something to the heap\n#define HEAP(type, expr) ((type*)memdup((void*)&((type[]){expr}[0]), sizeof(type)))\n#define HEAP_noscan(type, expr) ((type*)memdup_noscan((void*)&((type[]){expr}[0]), sizeof(type)))\n\n#define _PUSH_MANY(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many(arr, tmp.data, tmp.len);}\n#define _PUSH_MANY_noscan(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many_noscan(arr, tmp.data, tmp.len);}\n\n// unsigned/signed comparisons\nstatic inline bool _us32_gt(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a > b; }\nstatic inline bool _us32_ge(uint32_t a, int32_t b) { return a >= INT32_MAX || (int32_t)a >= b; }\nstatic inline bool _us32_eq(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a == b; }\nstatic inline bool _us32_ne(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a != b; }\nstatic inline bool _us32_le(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a <= b; }\nstatic inline bool _us32_lt(uint32_t a, int32_t b) { return a < INT32_MAX && (int32_t)a < b; }\nstatic inline bool _us64_gt(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a > b; }\nstatic inline bool _us64_ge(uint64_t a, int64_t b) { return a >= INT64_MAX || (int64_t)a >= b; }\nstatic inline bool _us64_eq(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a == b; }\nstatic inline bool _us64_ne(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a != b; }\nstatic inline bool _us64_le(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a <= b; }\nstatic inline bool _us64_lt(uint64_t a, int64_t b) { return a < INT64_MAX && (int64_t)a < b; }\n\n#define EMPTY_VARG_INITIALIZATION 0\n#define EMPTY_STRUCT_INITIALIZATION 0\n#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n// Due to a tcc bug, the length of an array needs to be specified, but GCC crashes if it is...\n#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[])\n#define TCCSKIP(x) x\n\n#define __NOINLINE __attribute__((noinline))\n#define __IRQHANDLER __attribute__((interrupt))\n\n#define __V_architecture 0\n#if defined(__x86_64__)\n #define __V_amd64 1\n #undef __V_architecture\n #define __V_architecture 1\n#endif\n\n#if defined(__aarch64__) || defined(__arm64__)\n #define __V_arm64 1\n #undef __V_architecture\n #define __V_architecture 2\n#endif\n\n// Using just __GNUC__ for detecting gcc, is not reliable because other compilers define it too:\n#ifdef __GNUC__\n #define __V_GCC__\n#endif\n#ifdef __TINYC__\n #undef __V_GCC__\n#endif\n#ifdef __cplusplus\n #undef __V_GCC__\n#endif\n#ifdef __clang__\n #undef __V_GCC__\n#endif\n#ifdef _MSC_VER\n #undef __V_GCC__\n #undef EMPTY_STRUCT_INITIALIZATION\n #define EMPTY_STRUCT_INITIALIZATION 0\n#endif\n\n#ifdef __TINYC__\n #undef EMPTY_STRUCT_DECLARATION\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #undef EMPTY_ARRAY_OF_ELEMS\n #define EMPTY_ARRAY_OF_ELEMS(x,n) (x[n])\n #undef __NOINLINE\n #undef __IRQHANDLER\n // tcc does not support inlining at all\n #define __NOINLINE\n #define __IRQHANDLER\n #undef TCCSKIP\n #define TCCSKIP(x)\n // #include \n #ifndef _WIN32\n #include \n int tcc_backtrace(const char *fmt, ...);\n #endif\n#endif\n\n// Use __offsetof_ptr instead of __offset_of, when you *do* have a valid pointer, to avoid UB:\n#ifndef __offsetof_ptr\n #define __offsetof_ptr(ptr,PTYPE,FIELDNAME) ((size_t)((byte *)&((PTYPE *)ptr)->FIELDNAME - (byte *)ptr))\n#endif\n\n// for __offset_of\n#ifndef __offsetof\n #define __offsetof(PTYPE,FIELDNAME) ((size_t)((char *)&((PTYPE *)0)->FIELDNAME - (char *)0))\n#endif\n\n// returns the number of CPU registers that TYPE takes up\n#define _REG_WIDTH(T) (((sizeof(T) + sizeof(void*) - 1) & ~(sizeof(void*) - 1)) / sizeof(void*))\n// parameters of size <= 2 registers are spilled across those two registers; larger types are passed as one pointer to some stack location\n#define _REG_WIDTH_BOUNDED(T) (_REG_WIDTH(T) <= 2 ? _REG_WIDTH(T) : 1)\n\n#define OPTION_CAST(x) (x)\n\n#ifndef V64_PRINTFORMAT\n #ifdef PRIx64\n #define V64_PRINTFORMAT \"0x%\"PRIx64\n #elif defined(__WIN32__)\n #define V64_PRINTFORMAT \"0x%I64x\"\n #elif defined(__linux__) && defined(__LP64__)\n #define V64_PRINTFORMAT \"0x%lx\"\n #else\n #define V64_PRINTFORMAT \"0x%llx\"\n #endif\n#endif\n\n#if defined(_WIN32) || defined(__CYGWIN__)\n #define VV_EXPORTED_SYMBOL extern __declspec(dllexport)\n #define VV_LOCAL_SYMBOL static\n#else\n // 4 < gcc < 5 is used by some older Ubuntu LTS and Centos versions,\n // and does not support __has_attribute(visibility) ...\n #ifndef __has_attribute\n #define __has_attribute(x) 0 // Compatibility with non-clang compilers.\n #endif\n #if (defined(__GNUC__) && (__GNUC__ >= 4)) || (defined(__clang__) && __has_attribute(visibility))\n #ifdef ARM\n #define VV_EXPORTED_SYMBOL extern __attribute__((externally_visible,visibility(\"default\")))\n #else\n #define VV_EXPORTED_SYMBOL extern __attribute__((visibility(\"default\")))\n #endif\n #if defined(__clang__) && (defined(_VUSECACHE) || defined(_VBUILDMODULE))\n #define VV_LOCAL_SYMBOL static\n #else\n #define VV_LOCAL_SYMBOL __attribute__ ((visibility (\"hidden\")))\n #endif\n #else\n #define VV_EXPORTED_SYMBOL extern\n #define VV_LOCAL_SYMBOL static\n #endif\n#endif\n\n#ifdef __cplusplus\n #include \n #define _MOV std::move\n#else\n #define _MOV\n#endif\n\n// tcc does not support has_include properly yet, turn it off completely\n#if defined(__TINYC__) && defined(__has_include)\n#undef __has_include\n#endif\n\n\n#if !defined(VWEAK)\n #define VWEAK __attribute__((weak))\n #ifdef _MSC_VER\n #undef VWEAK\n #define VWEAK\n #endif\n#endif\n\n#if !defined(VNORETURN)\n #if defined(__TINYC__)\n #include \n #define VNORETURN noreturn\n #endif\n # if !defined(__TINYC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L\n # define VNORETURN _Noreturn\n # elif defined(__GNUC__) && __GNUC__ >= 2\n # define VNORETURN __attribute__((noreturn))\n # endif\n #ifndef VNORETURN\n #define VNORETURN\n #endif\n#endif\n\n#if !defined(VUNREACHABLE)\n #if defined(__GNUC__) && !defined(__clang__)\n #define V_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__)\n #if (V_GCC_VERSION >= 40500L)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #if defined(__clang__) && defined(__has_builtin)\n #if __has_builtin(__builtin_unreachable)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #ifndef VUNREACHABLE\n #define VUNREACHABLE() do { } while (0)\n #endif\n #if defined(__FreeBSD__) && defined(__TINYC__)\n #define VUNREACHABLE() do { } while (0)\n #endif\n#endif\n\n//likely and unlikely macros\n#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n #define _likely_(x) __builtin_expect(x,1)\n #define _unlikely_(x) __builtin_expect(x,0)\n#else\n #define _likely_(x) (x)\n #define _unlikely_(x) (x)\n#endif\n\n\n// c_headers\ntypedef int (*qsort_callback_func)(const void*, const void*);\n#include // TODO remove all these includes, define all function signatures and types manually\n#include \n#include \n\n#ifndef _WIN32\n #if defined __has_include\n #if __has_include ()\n #include \n #else\n // Most probably musl OR __ANDROID__ ...\n int backtrace (void **__array, int __size) { return 0; }\n char **backtrace_symbols (void *const *__array, int __size){ return 0; }\n void backtrace_symbols_fd (void *const *__array, int __size, int __fd){}\n #endif\n #endif\n#endif\n\n#include // for va_list\n\n//================================== GLOBALS =================================*/\nint load_so(byteptr);\nvoid _vinit(int ___argc, voidptr ___argv);\nvoid _vcleanup(void);\n#define sigaction_size sizeof(sigaction);\n#define _ARR_LEN(a) ( (sizeof(a)) / (sizeof(a[0])) )\n\nvoid v_free(voidptr ptr);\nvoidptr memdup(voidptr src, int sz);\n\n#if INTPTR_MAX == INT32_MAX\n #define TARGET_IS_32BIT 1\n#elif INTPTR_MAX == INT64_MAX\n #define TARGET_IS_64BIT 1\n#else\n #error \"The environment is not 32 or 64-bit.\"\n#endif\n\n#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ || defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN || defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__)\n #define TARGET_ORDER_IS_BIG 1\n#elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ || defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN || defined(__LITTLE_ENDIAN__) || defined(__ARMEL__) || defined(__THUMBEL__) || defined(__AARCH64EL__) || defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) || defined(_M_AMD64) || defined(_M_X64) || defined(_M_IX86)\n #define TARGET_ORDER_IS_LITTLE 1\n#else\n #error \"Unknown architecture endianness\"\n#endif\n\n#ifndef _WIN32\n #include \n #include // tolower\n #include \n #include // sleep\n extern char **environ;\n#endif\n\n#if defined(__CYGWIN__) && !defined(_WIN32)\n #error Cygwin is not supported, please use MinGW or Visual Studio.\n#endif\n\n#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__vinix__) || defined(__serenity__) || defined(__sun)\n #include \n #include // os__wait uses wait on nix\n#endif\n\n#ifdef __OpenBSD__\n #include \n #include \n #include // os__wait uses wait on nix\n#endif\n\n#ifdef __NetBSD__\n #include // os__wait uses wait on nix\n#endif\n\n#ifdef _WIN32\n #define WINVER 0x0600\n #ifdef _WIN32_WINNT\n #undef _WIN32_WINNT\n #endif\n #define _WIN32_WINNT 0x0600\n #ifndef WIN32_FULL\n #define WIN32_LEAN_AND_MEAN\n #endif\n #ifndef _UNICODE\n #define _UNICODE\n #endif\n #ifndef UNICODE\n #define UNICODE\n #endif\n #include \n\n #include // _waccess\n #include // _wgetcwd\n #include // signal and SIGSEGV for segmentation fault handler\n\n #ifdef _MSC_VER\n // On MSVC these are the same (as long as /volatile:ms is passed)\n #define _Atomic volatile\n\n // MSVC cannot parse some things properly\n #undef EMPTY_STRUCT_DECLARATION\n #undef OPTION_CAST\n\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #define OPTION_CAST(x)\n #undef __NOINLINE\n #undef __IRQHANDLER\n #define __NOINLINE __declspec(noinline)\n #define __IRQHANDLER __declspec(naked)\n\n #include \n #pragma comment(lib, \"Dbghelp\")\n #endif\n#else\n #include \n #ifndef PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP\n // musl does not have that\n #define pthread_rwlockattr_setkind_np(a, b)\n #endif\n#endif\n\n// g_live_info is used by live.info()\nstatic void* g_live_info = NULL;\n\n#if defined(__MINGW32__) || defined(__MINGW64__) || (defined(_WIN32) && defined(__TINYC__))\n #undef PRId64\n #undef PRIi64\n #undef PRIo64\n #undef PRIu64\n #undef PRIx64\n #undef PRIX64\n #define PRId64 \"lld\"\n #define PRIi64 \"lli\"\n #define PRIo64 \"llo\"\n #define PRIu64 \"llu\"\n #define PRIx64 \"llx\"\n #define PRIX64 \"llX\"\n#endif\n\n#ifdef _VFREESTANDING\n#undef _VFREESTANDING\n#endif\n"); - _const_v__gen__c__c_bare_headers = _SLIT("//============================== HELPER C MACROS =============================*/\n// _SLIT0 is used as NULL string for literal arguments\n// `\"\" s` is used to enforce a string literal argument\n#define _SLIT0 (string){.str=(byteptr)(\"\"), .len=0, .is_lit=1}\n#define _SLIT(s) ((string){.str=(byteptr)(\"\" s), .len=(sizeof(s)-1), .is_lit=1})\n#define _SLEN(s, n) ((string){.str=(byteptr)(\"\" s), .len=n, .is_lit=1})\n\n// take the address of an rvalue\n#define ADDR(type, expr) (&((type[]){expr}[0]))\n\n// copy something to the heap\n#define HEAP(type, expr) ((type*)memdup((void*)&((type[]){expr}[0]), sizeof(type)))\n#define HEAP_noscan(type, expr) ((type*)memdup_noscan((void*)&((type[]){expr}[0]), sizeof(type)))\n\n#define _PUSH_MANY(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many(arr, tmp.data, tmp.len);}\n#define _PUSH_MANY_noscan(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many_noscan(arr, tmp.data, tmp.len);}\n\n// unsigned/signed comparisons\nstatic inline bool _us32_gt(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a > b; }\nstatic inline bool _us32_ge(uint32_t a, int32_t b) { return a >= INT32_MAX || (int32_t)a >= b; }\nstatic inline bool _us32_eq(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a == b; }\nstatic inline bool _us32_ne(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a != b; }\nstatic inline bool _us32_le(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a <= b; }\nstatic inline bool _us32_lt(uint32_t a, int32_t b) { return a < INT32_MAX && (int32_t)a < b; }\nstatic inline bool _us64_gt(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a > b; }\nstatic inline bool _us64_ge(uint64_t a, int64_t b) { return a >= INT64_MAX || (int64_t)a >= b; }\nstatic inline bool _us64_eq(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a == b; }\nstatic inline bool _us64_ne(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a != b; }\nstatic inline bool _us64_le(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a <= b; }\nstatic inline bool _us64_lt(uint64_t a, int64_t b) { return a < INT64_MAX && (int64_t)a < b; }\n\n#define EMPTY_VARG_INITIALIZATION 0\n#define EMPTY_STRUCT_INITIALIZATION 0\n#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n// Due to a tcc bug, the length of an array needs to be specified, but GCC crashes if it is...\n#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[])\n#define TCCSKIP(x) x\n\n#define __NOINLINE __attribute__((noinline))\n#define __IRQHANDLER __attribute__((interrupt))\n\n#define __V_architecture 0\n#if defined(__x86_64__)\n #define __V_amd64 1\n #undef __V_architecture\n #define __V_architecture 1\n#endif\n\n#if defined(__aarch64__) || defined(__arm64__)\n #define __V_arm64 1\n #undef __V_architecture\n #define __V_architecture 2\n#endif\n\n// Using just __GNUC__ for detecting gcc, is not reliable because other compilers define it too:\n#ifdef __GNUC__\n #define __V_GCC__\n#endif\n#ifdef __TINYC__\n #undef __V_GCC__\n#endif\n#ifdef __cplusplus\n #undef __V_GCC__\n#endif\n#ifdef __clang__\n #undef __V_GCC__\n#endif\n#ifdef _MSC_VER\n #undef __V_GCC__\n #undef EMPTY_STRUCT_INITIALIZATION\n #define EMPTY_STRUCT_INITIALIZATION 0\n#endif\n\n#ifdef __TINYC__\n #undef EMPTY_STRUCT_DECLARATION\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #undef EMPTY_ARRAY_OF_ELEMS\n #define EMPTY_ARRAY_OF_ELEMS(x,n) (x[n])\n #undef __NOINLINE\n #undef __IRQHANDLER\n // tcc does not support inlining at all\n #define __NOINLINE\n #define __IRQHANDLER\n #undef TCCSKIP\n #define TCCSKIP(x)\n // #include \n #ifndef _WIN32\n #include \n int tcc_backtrace(const char *fmt, ...);\n #endif\n#endif\n\n// Use __offsetof_ptr instead of __offset_of, when you *do* have a valid pointer, to avoid UB:\n#ifndef __offsetof_ptr\n #define __offsetof_ptr(ptr,PTYPE,FIELDNAME) ((size_t)((byte *)&((PTYPE *)ptr)->FIELDNAME - (byte *)ptr))\n#endif\n\n// for __offset_of\n#ifndef __offsetof\n #define __offsetof(PTYPE,FIELDNAME) ((size_t)((char *)&((PTYPE *)0)->FIELDNAME - (char *)0))\n#endif\n\n// returns the number of CPU registers that TYPE takes up\n#define _REG_WIDTH(T) (((sizeof(T) + sizeof(void*) - 1) & ~(sizeof(void*) - 1)) / sizeof(void*))\n// parameters of size <= 2 registers are spilled across those two registers; larger types are passed as one pointer to some stack location\n#define _REG_WIDTH_BOUNDED(T) (_REG_WIDTH(T) <= 2 ? _REG_WIDTH(T) : 1)\n\n#define OPTION_CAST(x) (x)\n\n#ifndef V64_PRINTFORMAT\n #ifdef PRIx64\n #define V64_PRINTFORMAT \"0x%\"PRIx64\n #elif defined(__WIN32__)\n #define V64_PRINTFORMAT \"0x%I64x\"\n #elif defined(__linux__) && defined(__LP64__)\n #define V64_PRINTFORMAT \"0x%lx\"\n #else\n #define V64_PRINTFORMAT \"0x%llx\"\n #endif\n#endif\n\n#if defined(_WIN32) || defined(__CYGWIN__)\n #define VV_EXPORTED_SYMBOL extern __declspec(dllexport)\n #define VV_LOCAL_SYMBOL static\n#else\n // 4 < gcc < 5 is used by some older Ubuntu LTS and Centos versions,\n // and does not support __has_attribute(visibility) ...\n #ifndef __has_attribute\n #define __has_attribute(x) 0 // Compatibility with non-clang compilers.\n #endif\n #if (defined(__GNUC__) && (__GNUC__ >= 4)) || (defined(__clang__) && __has_attribute(visibility))\n #ifdef ARM\n #define VV_EXPORTED_SYMBOL extern __attribute__((externally_visible,visibility(\"default\")))\n #else\n #define VV_EXPORTED_SYMBOL extern __attribute__((visibility(\"default\")))\n #endif\n #if defined(__clang__) && (defined(_VUSECACHE) || defined(_VBUILDMODULE))\n #define VV_LOCAL_SYMBOL static\n #else\n #define VV_LOCAL_SYMBOL __attribute__ ((visibility (\"hidden\")))\n #endif\n #else\n #define VV_EXPORTED_SYMBOL extern\n #define VV_LOCAL_SYMBOL static\n #endif\n#endif\n\n#ifdef __cplusplus\n #include \n #define _MOV std::move\n#else\n #define _MOV\n#endif\n\n// tcc does not support has_include properly yet, turn it off completely\n#if defined(__TINYC__) && defined(__has_include)\n#undef __has_include\n#endif\n\n\n#if !defined(VWEAK)\n #define VWEAK __attribute__((weak))\n #ifdef _MSC_VER\n #undef VWEAK\n #define VWEAK\n #endif\n#endif\n\n#if !defined(VNORETURN)\n #if defined(__TINYC__)\n #include \n #define VNORETURN noreturn\n #endif\n # if !defined(__TINYC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L\n # define VNORETURN _Noreturn\n # elif defined(__GNUC__) && __GNUC__ >= 2\n # define VNORETURN __attribute__((noreturn))\n # endif\n #ifndef VNORETURN\n #define VNORETURN\n #endif\n#endif\n\n#if !defined(VUNREACHABLE)\n #if defined(__GNUC__) && !defined(__clang__)\n #define V_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__)\n #if (V_GCC_VERSION >= 40500L)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #if defined(__clang__) && defined(__has_builtin)\n #if __has_builtin(__builtin_unreachable)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #ifndef VUNREACHABLE\n #define VUNREACHABLE() do { } while (0)\n #endif\n #if defined(__FreeBSD__) && defined(__TINYC__)\n #define VUNREACHABLE() do { } while (0)\n #endif\n#endif\n\n//likely and unlikely macros\n#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n #define _likely_(x) __builtin_expect(x,1)\n #define _unlikely_(x) __builtin_expect(x,0)\n#else\n #define _likely_(x) (x)\n #define _unlikely_(x) (x)\n#endif\n\n\n#define _VFREESTANDING\n\ntypedef long unsigned int size_t;\n\n// Memory allocation related headers\nvoid *malloc(size_t size);\nvoid *calloc(size_t nitems, size_t size);\nvoid *realloc(void *ptr, size_t size);\nvoid *memcpy(void *dest, void *src, size_t n);\nvoid *memset(void *s, int c, size_t n);\nvoid *memmove(void *dest, void *src, size_t n);\n\n// varargs implementation, TODO: works on tcc and gcc, but is very unportable and hacky\ntypedef __builtin_va_list va_list;\n#define va_start(a, b) __builtin_va_start(a, b)\n#define va_end(a) __builtin_va_end(a)\n#define va_arg(a, b) __builtin_va_arg(a, b)\n#define va_copy(a, b) __builtin_va_copy(a, b)\n\n//================================== GLOBALS =================================*/\nint load_so(byteptr);\nvoid _vinit(int ___argc, voidptr ___argv);\nvoid _vcleanup();\n#define sigaction_size sizeof(sigaction);\n#define _ARR_LEN(a) ( (sizeof(a)) / (sizeof(a[0])) )\n\nvoid v_free(voidptr ptr);\nvoidptr memdup(voidptr src, int sz);\n\n"); + _const_v__gen__c__c_headers = _SLIT("//============================== HELPER C MACROS =============================*/\n// _SLIT0 is used as NULL string for literal arguments\n// `\"\" s` is used to enforce a string literal argument\n#define _SLIT0 (string){.str=(byteptr)(\"\"), .len=0, .is_lit=1}\n#define _SLIT(s) ((string){.str=(byteptr)(\"\" s), .len=(sizeof(s)-1), .is_lit=1})\n#define _SLEN(s, n) ((string){.str=(byteptr)(\"\" s), .len=n, .is_lit=1})\n\n// take the address of an rvalue\n#define ADDR(type, expr) (&((type[]){expr}[0]))\n\n// copy something to the heap\n#define HEAP(type, expr) ((type*)memdup((void*)&((type[]){expr}[0]), sizeof(type)))\n#define HEAP_noscan(type, expr) ((type*)memdup_noscan((void*)&((type[]){expr}[0]), sizeof(type)))\n\n#define _PUSH_MANY(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many(arr, tmp.data, tmp.len);}\n#define _PUSH_MANY_noscan(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many_noscan(arr, tmp.data, tmp.len);}\n\n// unsigned/signed comparisons\nstatic inline bool _us32_gt(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a > b; }\nstatic inline bool _us32_ge(uint32_t a, int32_t b) { return a >= INT32_MAX || (int32_t)a >= b; }\nstatic inline bool _us32_eq(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a == b; }\nstatic inline bool _us32_ne(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a != b; }\nstatic inline bool _us32_le(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a <= b; }\nstatic inline bool _us32_lt(uint32_t a, int32_t b) { return a < INT32_MAX && (int32_t)a < b; }\nstatic inline bool _us64_gt(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a > b; }\nstatic inline bool _us64_ge(uint64_t a, int64_t b) { return a >= INT64_MAX || (int64_t)a >= b; }\nstatic inline bool _us64_eq(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a == b; }\nstatic inline bool _us64_ne(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a != b; }\nstatic inline bool _us64_le(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a <= b; }\nstatic inline bool _us64_lt(uint64_t a, int64_t b) { return a < INT64_MAX && (int64_t)a < b; }\n\n#define EMPTY_VARG_INITIALIZATION 0\n#define EMPTY_STRUCT_INITIALIZATION 0\n#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n// Due to a tcc bug, the length of an array needs to be specified, but GCC crashes if it is...\n#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[])\n#define TCCSKIP(x) x\n\n#define __NOINLINE __attribute__((noinline))\n#define __IRQHANDLER __attribute__((interrupt))\n\n#define __V_architecture 0\n#if defined(__x86_64__)\n #define __V_amd64 1\n #undef __V_architecture\n #define __V_architecture 1\n#endif\n\n#if defined(__aarch64__) || defined(__arm64__)\n #define __V_arm64 1\n #undef __V_architecture\n #define __V_architecture 2\n#endif\n\n// Using just __GNUC__ for detecting gcc, is not reliable because other compilers define it too:\n#ifdef __GNUC__\n #define __V_GCC__\n#endif\n#ifdef __TINYC__\n #undef __V_GCC__\n#endif\n#ifdef __cplusplus\n #undef __V_GCC__\n#endif\n#ifdef __clang__\n #undef __V_GCC__\n#endif\n#ifdef _MSC_VER\n #undef __V_GCC__\n #undef EMPTY_STRUCT_INITIALIZATION\n #define EMPTY_STRUCT_INITIALIZATION 0\n#endif\n\n#ifdef __TINYC__\n #define _Atomic volatile\n #undef EMPTY_STRUCT_DECLARATION\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #undef EMPTY_ARRAY_OF_ELEMS\n #define EMPTY_ARRAY_OF_ELEMS(x,n) (x[n])\n #undef __NOINLINE\n #undef __IRQHANDLER\n // tcc does not support inlining at all\n #define __NOINLINE\n #define __IRQHANDLER\n #undef TCCSKIP\n #define TCCSKIP(x)\n // #include \n #ifndef _WIN32\n #include \n int tcc_backtrace(const char *fmt, ...);\n #endif\n#endif\n\n// Use __offsetof_ptr instead of __offset_of, when you *do* have a valid pointer, to avoid UB:\n#ifndef __offsetof_ptr\n #define __offsetof_ptr(ptr,PTYPE,FIELDNAME) ((size_t)((byte *)&((PTYPE *)ptr)->FIELDNAME - (byte *)ptr))\n#endif\n\n// for __offset_of\n#ifndef __offsetof\n #define __offsetof(PTYPE,FIELDNAME) ((size_t)((char *)&((PTYPE *)0)->FIELDNAME - (char *)0))\n#endif\n\n// returns the number of CPU registers that TYPE takes up\n#define _REG_WIDTH(T) (((sizeof(T) + sizeof(void*) - 1) & ~(sizeof(void*) - 1)) / sizeof(void*))\n// parameters of size <= 2 registers are spilled across those two registers; larger types are passed as one pointer to some stack location\n#define _REG_WIDTH_BOUNDED(T) (_REG_WIDTH(T) <= 2 ? _REG_WIDTH(T) : 1)\n\n#define OPTION_CAST(x) (x)\n\n#ifndef V64_PRINTFORMAT\n #ifdef PRIx64\n #define V64_PRINTFORMAT \"0x%\"PRIx64\n #elif defined(__WIN32__)\n #define V64_PRINTFORMAT \"0x%I64x\"\n #elif defined(__linux__) && defined(__LP64__)\n #define V64_PRINTFORMAT \"0x%lx\"\n #else\n #define V64_PRINTFORMAT \"0x%llx\"\n #endif\n#endif\n\n#if defined(_WIN32) || defined(__CYGWIN__)\n #define VV_EXPORTED_SYMBOL extern __declspec(dllexport)\n #define VV_LOCAL_SYMBOL static\n#else\n // 4 < gcc < 5 is used by some older Ubuntu LTS and Centos versions,\n // and does not support __has_attribute(visibility) ...\n #ifndef __has_attribute\n #define __has_attribute(x) 0 // Compatibility with non-clang compilers.\n #endif\n #if (defined(__GNUC__) && (__GNUC__ >= 4)) || (defined(__clang__) && __has_attribute(visibility))\n #ifdef ARM\n #define VV_EXPORTED_SYMBOL extern __attribute__((externally_visible,visibility(\"default\")))\n #else\n #define VV_EXPORTED_SYMBOL extern __attribute__((visibility(\"default\")))\n #endif\n #if defined(__clang__) && (defined(_VUSECACHE) || defined(_VBUILDMODULE))\n #define VV_LOCAL_SYMBOL static\n #else\n #define VV_LOCAL_SYMBOL __attribute__ ((visibility (\"hidden\")))\n #endif\n #else\n #define VV_EXPORTED_SYMBOL extern\n #define VV_LOCAL_SYMBOL static\n #endif\n#endif\n\n#ifdef __cplusplus\n #include \n #define _MOV std::move\n#else\n #define _MOV\n#endif\n\n// tcc does not support has_include properly yet, turn it off completely\n#if defined(__TINYC__) && defined(__has_include)\n#undef __has_include\n#endif\n\n\n#if !defined(VWEAK)\n #define VWEAK __attribute__((weak))\n #ifdef _MSC_VER\n #undef VWEAK\n #define VWEAK\n #endif\n#endif\n\n#if !defined(VNORETURN)\n #if defined(__TINYC__)\n #include \n #define VNORETURN noreturn\n #endif\n # if !defined(__TINYC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L\n # define VNORETURN _Noreturn\n # elif defined(__GNUC__) && __GNUC__ >= 2\n # define VNORETURN __attribute__((noreturn))\n # endif\n #ifndef VNORETURN\n #define VNORETURN\n #endif\n#endif\n\n#if !defined(VUNREACHABLE)\n #if defined(__GNUC__) && !defined(__clang__)\n #define V_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__)\n #if (V_GCC_VERSION >= 40500L)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #if defined(__clang__) && defined(__has_builtin)\n #if __has_builtin(__builtin_unreachable)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #ifndef VUNREACHABLE\n #define VUNREACHABLE() do { } while (0)\n #endif\n #if defined(__FreeBSD__) && defined(__TINYC__)\n #define VUNREACHABLE() do { } while (0)\n #endif\n#endif\n\n//likely and unlikely macros\n#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n #define _likely_(x) __builtin_expect(x,1)\n #define _unlikely_(x) __builtin_expect(x,0)\n#else\n #define _likely_(x) (x)\n #define _unlikely_(x) (x)\n#endif\n\n\n// c_headers\ntypedef int (*qsort_callback_func)(const void*, const void*);\n#include // TODO remove all these includes, define all function signatures and types manually\n#include \n#include \n\n#ifndef _WIN32\n #if defined __has_include\n #if __has_include ()\n #include \n #else\n // Most probably musl OR __ANDROID__ ...\n int backtrace (void **__array, int __size) { return 0; }\n char **backtrace_symbols (void *const *__array, int __size){ return 0; }\n void backtrace_symbols_fd (void *const *__array, int __size, int __fd){}\n #endif\n #endif\n#endif\n\n#include // for va_list\n\n//================================== GLOBALS =================================*/\nint load_so(byteptr);\nvoid _vinit(int ___argc, voidptr ___argv);\nvoid _vcleanup(void);\n#define sigaction_size sizeof(sigaction);\n#define _ARR_LEN(a) ( (sizeof(a)) / (sizeof(a[0])) )\n\nvoid v_free(voidptr ptr);\nvoidptr memdup(voidptr src, int sz);\n\n#if INTPTR_MAX == INT32_MAX\n #define TARGET_IS_32BIT 1\n#elif INTPTR_MAX == INT64_MAX\n #define TARGET_IS_64BIT 1\n#else\n #error \"The environment is not 32 or 64-bit.\"\n#endif\n\n#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ || defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN || defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__)\n #define TARGET_ORDER_IS_BIG 1\n#elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ || defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN || defined(__LITTLE_ENDIAN__) || defined(__ARMEL__) || defined(__THUMBEL__) || defined(__AARCH64EL__) || defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) || defined(_M_AMD64) || defined(_M_X64) || defined(_M_IX86)\n #define TARGET_ORDER_IS_LITTLE 1\n#else\n #error \"Unknown architecture endianness\"\n#endif\n\n#ifndef _WIN32\n #include \n #include // tolower\n #include \n #include // sleep\n extern char **environ;\n#endif\n\n#if defined(__CYGWIN__) && !defined(_WIN32)\n #error Cygwin is not supported, please use MinGW or Visual Studio.\n#endif\n\n#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__vinix__) || defined(__serenity__) || defined(__sun)\n #include \n #include // os__wait uses wait on nix\n#endif\n\n#ifdef __OpenBSD__\n #include \n #include \n #include // os__wait uses wait on nix\n#endif\n\n#ifdef __NetBSD__\n #include // os__wait uses wait on nix\n#endif\n\n#ifdef _WIN32\n #define WINVER 0x0600\n #ifdef _WIN32_WINNT\n #undef _WIN32_WINNT\n #endif\n #define _WIN32_WINNT 0x0600\n #ifndef WIN32_FULL\n #define WIN32_LEAN_AND_MEAN\n #endif\n #ifndef _UNICODE\n #define _UNICODE\n #endif\n #ifndef UNICODE\n #define UNICODE\n #endif\n #include \n\n #include // _waccess\n #include // _wgetcwd\n #include // signal and SIGSEGV for segmentation fault handler\n\n #ifdef _MSC_VER\n // On MSVC these are the same (as long as /volatile:ms is passed)\n #define _Atomic volatile\n\n // MSVC cannot parse some things properly\n #undef EMPTY_STRUCT_DECLARATION\n #undef OPTION_CAST\n\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #define OPTION_CAST(x)\n #undef __NOINLINE\n #undef __IRQHANDLER\n #define __NOINLINE __declspec(noinline)\n #define __IRQHANDLER __declspec(naked)\n\n #include \n #pragma comment(lib, \"Dbghelp\")\n #endif\n#else\n #include \n #ifndef PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP\n // musl does not have that\n #define pthread_rwlockattr_setkind_np(a, b)\n #endif\n#endif\n\n// g_live_info is used by live.info()\nstatic void* g_live_info = NULL;\n\n#if defined(__MINGW32__) || defined(__MINGW64__) || (defined(_WIN32) && defined(__TINYC__))\n #undef PRId64\n #undef PRIi64\n #undef PRIo64\n #undef PRIu64\n #undef PRIx64\n #undef PRIX64\n #define PRId64 \"lld\"\n #define PRIi64 \"lli\"\n #define PRIo64 \"llo\"\n #define PRIu64 \"llu\"\n #define PRIx64 \"llx\"\n #define PRIX64 \"llX\"\n#endif\n\n#ifdef _VFREESTANDING\n#undef _VFREESTANDING\n#endif\n"); + _const_v__gen__c__c_bare_headers = _SLIT("//============================== HELPER C MACROS =============================*/\n// _SLIT0 is used as NULL string for literal arguments\n// `\"\" s` is used to enforce a string literal argument\n#define _SLIT0 (string){.str=(byteptr)(\"\"), .len=0, .is_lit=1}\n#define _SLIT(s) ((string){.str=(byteptr)(\"\" s), .len=(sizeof(s)-1), .is_lit=1})\n#define _SLEN(s, n) ((string){.str=(byteptr)(\"\" s), .len=n, .is_lit=1})\n\n// take the address of an rvalue\n#define ADDR(type, expr) (&((type[]){expr}[0]))\n\n// copy something to the heap\n#define HEAP(type, expr) ((type*)memdup((void*)&((type[]){expr}[0]), sizeof(type)))\n#define HEAP_noscan(type, expr) ((type*)memdup_noscan((void*)&((type[]){expr}[0]), sizeof(type)))\n\n#define _PUSH_MANY(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many(arr, tmp.data, tmp.len);}\n#define _PUSH_MANY_noscan(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many_noscan(arr, tmp.data, tmp.len);}\n\n// unsigned/signed comparisons\nstatic inline bool _us32_gt(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a > b; }\nstatic inline bool _us32_ge(uint32_t a, int32_t b) { return a >= INT32_MAX || (int32_t)a >= b; }\nstatic inline bool _us32_eq(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a == b; }\nstatic inline bool _us32_ne(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a != b; }\nstatic inline bool _us32_le(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a <= b; }\nstatic inline bool _us32_lt(uint32_t a, int32_t b) { return a < INT32_MAX && (int32_t)a < b; }\nstatic inline bool _us64_gt(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a > b; }\nstatic inline bool _us64_ge(uint64_t a, int64_t b) { return a >= INT64_MAX || (int64_t)a >= b; }\nstatic inline bool _us64_eq(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a == b; }\nstatic inline bool _us64_ne(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a != b; }\nstatic inline bool _us64_le(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a <= b; }\nstatic inline bool _us64_lt(uint64_t a, int64_t b) { return a < INT64_MAX && (int64_t)a < b; }\n\n#define EMPTY_VARG_INITIALIZATION 0\n#define EMPTY_STRUCT_INITIALIZATION 0\n#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n// Due to a tcc bug, the length of an array needs to be specified, but GCC crashes if it is...\n#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[])\n#define TCCSKIP(x) x\n\n#define __NOINLINE __attribute__((noinline))\n#define __IRQHANDLER __attribute__((interrupt))\n\n#define __V_architecture 0\n#if defined(__x86_64__)\n #define __V_amd64 1\n #undef __V_architecture\n #define __V_architecture 1\n#endif\n\n#if defined(__aarch64__) || defined(__arm64__)\n #define __V_arm64 1\n #undef __V_architecture\n #define __V_architecture 2\n#endif\n\n// Using just __GNUC__ for detecting gcc, is not reliable because other compilers define it too:\n#ifdef __GNUC__\n #define __V_GCC__\n#endif\n#ifdef __TINYC__\n #undef __V_GCC__\n#endif\n#ifdef __cplusplus\n #undef __V_GCC__\n#endif\n#ifdef __clang__\n #undef __V_GCC__\n#endif\n#ifdef _MSC_VER\n #undef __V_GCC__\n #undef EMPTY_STRUCT_INITIALIZATION\n #define EMPTY_STRUCT_INITIALIZATION 0\n#endif\n\n#ifdef __TINYC__\n #define _Atomic volatile\n #undef EMPTY_STRUCT_DECLARATION\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #undef EMPTY_ARRAY_OF_ELEMS\n #define EMPTY_ARRAY_OF_ELEMS(x,n) (x[n])\n #undef __NOINLINE\n #undef __IRQHANDLER\n // tcc does not support inlining at all\n #define __NOINLINE\n #define __IRQHANDLER\n #undef TCCSKIP\n #define TCCSKIP(x)\n // #include \n #ifndef _WIN32\n #include \n int tcc_backtrace(const char *fmt, ...);\n #endif\n#endif\n\n// Use __offsetof_ptr instead of __offset_of, when you *do* have a valid pointer, to avoid UB:\n#ifndef __offsetof_ptr\n #define __offsetof_ptr(ptr,PTYPE,FIELDNAME) ((size_t)((byte *)&((PTYPE *)ptr)->FIELDNAME - (byte *)ptr))\n#endif\n\n// for __offset_of\n#ifndef __offsetof\n #define __offsetof(PTYPE,FIELDNAME) ((size_t)((char *)&((PTYPE *)0)->FIELDNAME - (char *)0))\n#endif\n\n// returns the number of CPU registers that TYPE takes up\n#define _REG_WIDTH(T) (((sizeof(T) + sizeof(void*) - 1) & ~(sizeof(void*) - 1)) / sizeof(void*))\n// parameters of size <= 2 registers are spilled across those two registers; larger types are passed as one pointer to some stack location\n#define _REG_WIDTH_BOUNDED(T) (_REG_WIDTH(T) <= 2 ? _REG_WIDTH(T) : 1)\n\n#define OPTION_CAST(x) (x)\n\n#ifndef V64_PRINTFORMAT\n #ifdef PRIx64\n #define V64_PRINTFORMAT \"0x%\"PRIx64\n #elif defined(__WIN32__)\n #define V64_PRINTFORMAT \"0x%I64x\"\n #elif defined(__linux__) && defined(__LP64__)\n #define V64_PRINTFORMAT \"0x%lx\"\n #else\n #define V64_PRINTFORMAT \"0x%llx\"\n #endif\n#endif\n\n#if defined(_WIN32) || defined(__CYGWIN__)\n #define VV_EXPORTED_SYMBOL extern __declspec(dllexport)\n #define VV_LOCAL_SYMBOL static\n#else\n // 4 < gcc < 5 is used by some older Ubuntu LTS and Centos versions,\n // and does not support __has_attribute(visibility) ...\n #ifndef __has_attribute\n #define __has_attribute(x) 0 // Compatibility with non-clang compilers.\n #endif\n #if (defined(__GNUC__) && (__GNUC__ >= 4)) || (defined(__clang__) && __has_attribute(visibility))\n #ifdef ARM\n #define VV_EXPORTED_SYMBOL extern __attribute__((externally_visible,visibility(\"default\")))\n #else\n #define VV_EXPORTED_SYMBOL extern __attribute__((visibility(\"default\")))\n #endif\n #if defined(__clang__) && (defined(_VUSECACHE) || defined(_VBUILDMODULE))\n #define VV_LOCAL_SYMBOL static\n #else\n #define VV_LOCAL_SYMBOL __attribute__ ((visibility (\"hidden\")))\n #endif\n #else\n #define VV_EXPORTED_SYMBOL extern\n #define VV_LOCAL_SYMBOL static\n #endif\n#endif\n\n#ifdef __cplusplus\n #include \n #define _MOV std::move\n#else\n #define _MOV\n#endif\n\n// tcc does not support has_include properly yet, turn it off completely\n#if defined(__TINYC__) && defined(__has_include)\n#undef __has_include\n#endif\n\n\n#if !defined(VWEAK)\n #define VWEAK __attribute__((weak))\n #ifdef _MSC_VER\n #undef VWEAK\n #define VWEAK\n #endif\n#endif\n\n#if !defined(VNORETURN)\n #if defined(__TINYC__)\n #include \n #define VNORETURN noreturn\n #endif\n # if !defined(__TINYC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L\n # define VNORETURN _Noreturn\n # elif defined(__GNUC__) && __GNUC__ >= 2\n # define VNORETURN __attribute__((noreturn))\n # endif\n #ifndef VNORETURN\n #define VNORETURN\n #endif\n#endif\n\n#if !defined(VUNREACHABLE)\n #if defined(__GNUC__) && !defined(__clang__)\n #define V_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__)\n #if (V_GCC_VERSION >= 40500L)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #if defined(__clang__) && defined(__has_builtin)\n #if __has_builtin(__builtin_unreachable)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #ifndef VUNREACHABLE\n #define VUNREACHABLE() do { } while (0)\n #endif\n #if defined(__FreeBSD__) && defined(__TINYC__)\n #define VUNREACHABLE() do { } while (0)\n #endif\n#endif\n\n//likely and unlikely macros\n#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n #define _likely_(x) __builtin_expect(x,1)\n #define _unlikely_(x) __builtin_expect(x,0)\n#else\n #define _likely_(x) (x)\n #define _unlikely_(x) (x)\n#endif\n\n\n#define _VFREESTANDING\n\ntypedef long unsigned int size_t;\n\n// Memory allocation related headers\nvoid *malloc(size_t size);\nvoid *calloc(size_t nitems, size_t size);\nvoid *realloc(void *ptr, size_t size);\nvoid *memcpy(void *dest, void *src, size_t n);\nvoid *memset(void *s, int c, size_t n);\nvoid *memmove(void *dest, void *src, size_t n);\n\n// varargs implementation, TODO: works on tcc and gcc, but is very unportable and hacky\ntypedef __builtin_va_list va_list;\n#define va_start(a, b) __builtin_va_start(a, b)\n#define va_end(a) __builtin_va_end(a)\n#define va_arg(a, b) __builtin_va_arg(a, b)\n#define va_copy(a, b) __builtin_va_copy(a, b)\n\n//================================== GLOBALS =================================*/\nint load_so(byteptr);\nvoid _vinit(int ___argc, voidptr ___argv);\nvoid _vcleanup();\n#define sigaction_size sizeof(sigaction);\n#define _ARR_LEN(a) ( (sizeof(a)) / (sizeof(a[0])) )\n\nvoid v_free(voidptr ptr);\nvoidptr memdup(voidptr src, int sz);\n\n"); _const_v__gen__c__skip_struct_init = new_array_from_c_array(2, 2, sizeof(string), _MOV((string[2]){_SLIT("struct stat"), _SLIT("struct addrinfo")})); } { // Initializations for module v.scanner : diff --git a/v_win.c b/v_win.c index 1f9c173..11f52b4 100644 --- a/v_win.c +++ b/v_win.c @@ -1,11 +1,11 @@ -#define V_COMMIT_HASH "b7f2ef78b" +#define V_COMMIT_HASH "9b1f7f5e9" #ifndef V_COMMIT_HASH - #define V_COMMIT_HASH "b81f06e36" + #define V_COMMIT_HASH "b7f2ef78b" #endif #ifndef V_CURRENT_COMMIT_HASH - #define V_CURRENT_COMMIT_HASH "b7f2ef7" + #define V_CURRENT_COMMIT_HASH "9b1f7f5" #endif // V comptime_definitions: @@ -66,6 +66,8 @@ typedef struct multi_return_string_string_string_string multi_return_string_stri typedef struct multi_return_int_string_string_string multi_return_int_string_string_string; typedef struct multi_return_Array_string_Array_string_Array_bool multi_return_Array_string_Array_string_Array_bool; typedef struct multi_return_u64_string multi_return_u64_string; +typedef struct multi_return_i64_i64_i64 multi_return_i64_i64_i64; +typedef struct multi_return_f64_f64 multi_return_f64_f64; // END_multi_return_typedefs typedef struct strconv__BF_param strconv__BF_param; @@ -109,11 +111,6 @@ typedef struct v__token__KeywordsMatcher v__token__KeywordsMatcher; typedef struct v__token__WIndex v__token__WIndex; typedef struct v__token__Pos v__token__Pos; typedef struct v__token__Token v__token__Token; -typedef struct time__TimeParseError time__TimeParseError; -typedef struct time__StopWatchOptions time__StopWatchOptions; -typedef struct time__StopWatch time__StopWatch; -typedef struct time__Time time__Time; -typedef struct time__SystemTime time__SystemTime; typedef struct v__dotgraph__DotGraph v__dotgraph__DotGraph; typedef struct v__dotgraph__NewNodeConfig v__dotgraph__NewNodeConfig; typedef struct v__dotgraph__NewEdgeConfig v__dotgraph__NewEdgeConfig; @@ -156,9 +153,16 @@ typedef struct v__depgraph__DepGraphNode v__depgraph__DepGraphNode; typedef struct v__depgraph__DepGraph v__depgraph__DepGraph; typedef struct v__depgraph__OrderedDepMap v__depgraph__OrderedDepMap; typedef struct v__depgraph__NodeNames v__depgraph__NodeNames; +typedef struct math__DigitParams math__DigitParams; +typedef struct math__ChebSeries math__ChebSeries; typedef struct v__vet__Error v__vet__Error; typedef struct term__Coord term__Coord; typedef struct v__vcache__CacheManager v__vcache__CacheManager; +typedef struct time__TimeParseError time__TimeParseError; +typedef struct time__StopWatchOptions time__StopWatchOptions; +typedef struct time__StopWatch time__StopWatch; +typedef struct time__Time time__Time; +typedef struct time__SystemTime time__SystemTime; typedef struct v__vmod__Manifest v__vmod__Manifest; typedef struct v__vmod__Scanner v__vmod__Scanner; typedef struct v__vmod__Parser v__vmod__Parser; @@ -166,12 +170,12 @@ typedef struct v__vmod__Token v__vmod__Token; typedef struct v__vmod__ModFileAndFolder v__vmod__ModFileAndFolder; typedef struct v__vmod__ModFileCacher v__vmod__ModFileCacher; typedef struct v__cflag__CFlag v__cflag__CFlag; -typedef struct rand__config__PRNGConfigStruct rand__config__PRNGConfigStruct; -typedef struct rand__wyrand__WyRandRNG rand__wyrand__WyRandRNG; typedef struct v__pkgconfig__Main v__pkgconfig__Main; typedef struct v__pkgconfig__MainOptions v__pkgconfig__MainOptions; typedef struct v__pkgconfig__Options v__pkgconfig__Options; typedef struct v__pkgconfig__PkgConfig v__pkgconfig__PkgConfig; +typedef struct rand__config__PRNGConfigStruct rand__config__PRNGConfigStruct; +typedef struct rand__wyrand__WyRandRNG rand__wyrand__WyRandRNG; typedef struct rand__ShuffleConfigStruct rand__ShuffleConfigStruct; typedef struct v__pref__Preferences v__pref__Preferences; typedef struct sync__Subscription sync__Subscription; @@ -356,9 +360,6 @@ typedef struct Option_string Option_string; typedef struct Option_u8 Option_u8; typedef struct Option_voidptr Option_voidptr; typedef struct Option_v__token__Kind Option_v__token__Kind; -typedef struct Option_time__Time Option_time__Time; -typedef struct Option_multi_return_int_int_int Option_multi_return_int_int_int; -typedef struct Option_multi_return_int_int_int_int_i64_bool Option_multi_return_int_int_int_int_i64_bool; typedef struct Option_bool Option_bool; typedef struct Option_void Option_void; typedef struct Option_flag__Flag Option_flag__Flag; @@ -372,6 +373,9 @@ typedef struct Option_FILE_ptr Option_FILE_ptr; typedef struct Option_Array_u8 Option_Array_u8; typedef struct Option_os__SignalHandler Option_os__SignalHandler; typedef struct Option_term__Coord Option_term__Coord; +typedef struct Option_time__Time Option_time__Time; +typedef struct Option_multi_return_int_int_int Option_multi_return_int_int_int; +typedef struct Option_multi_return_int_int_int_int_i64_bool Option_multi_return_int_int_int_int_i64_bool; typedef struct Option_v__vmod__Manifest Option_v__vmod__Manifest; typedef struct Option_multi_return_Array_string_int Option_multi_return_Array_string_int; typedef struct Option_v__pkgconfig__PkgConfig_ptr Option_v__pkgconfig__PkgConfig_ptr; @@ -572,6 +576,7 @@ static inline bool _us64_lt(uint64_t a, int64_t b) { return a < INT64_MAX && (in #endif #ifdef __TINYC__ + #define _Atomic volatile #undef EMPTY_STRUCT_DECLARATION #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad #undef EMPTY_ARRAY_OF_ELEMS @@ -1024,42 +1029,6 @@ static inline uint64_t wy2u0k(uint64_t r, uint64_t k){ _wymum(&r,&k); return k; - - -// added by module `time`, file: time.c.v:6: - -#if defined(__has_include) - -#if __has_include() -#include -#else -#error VERROR_MESSAGE Header file , needed for module `time` was not found. Please install the corresponding development headers. -#endif - -#else -#include -#endif - - - - - -// added by module `time`, file: time_windows.c.v:6: - -#if defined(__has_include) - -#if __has_include() -#include -#else -#error VERROR_MESSAGE Header file , needed for module `time` was not found. Please install the corresponding development headers. -#endif - -#else -#include -#endif - - - // inserted by module `sync.stdatomic`, file: 1.declarations.c.v:8: /* * This file is part of FFmpeg. @@ -1508,6 +1477,60 @@ static inline int atomic_compare_exchange_strong_u16(unsigned short* object, uns +// added by module `math`, file: math.c.v:6: + +#if defined(__has_include) + +#if __has_include() +#include +#else +#error VERROR_MESSAGE Header file , needed for module `math` was not found. Please install the corresponding development headers. +#endif + +#else +#include +#endif + + + + + +// added by module `time`, file: time.c.v:6: + +#if defined(__has_include) + +#if __has_include() +#include +#else +#error VERROR_MESSAGE Header file , needed for module `time` was not found. Please install the corresponding development headers. +#endif + +#else +#include +#endif + + + + + +// added by module `time`, file: time_windows.c.v:6: + +#if defined(__has_include) + +#if __has_include() +#include +#else +#error VERROR_MESSAGE Header file , needed for module `time` was not found. Please install the corresponding development headers. +#endif + +#else +#include +#endif + + + + + // added by module `sync`, file: sync_windows.c.v:8: #if defined(__has_include) @@ -1761,38 +1784,6 @@ typedef enum { v__token__Precedence__index, // +10 } v__token__Precedence; -typedef enum { - time__FormatTime__hhmm12, // - time__FormatTime__hhmm24, // +1 - time__FormatTime__hhmmss12, // +2 - time__FormatTime__hhmmss24, // +3 - time__FormatTime__hhmmss24_milli, // +4 - time__FormatTime__hhmmss24_micro, // +5 - time__FormatTime__no_time, // +6 -} time__FormatTime; - -typedef enum { - time__FormatDate__ddmmyy, // - time__FormatDate__ddmmyyyy, // +1 - time__FormatDate__mmddyy, // +2 - time__FormatDate__mmddyyyy, // +3 - time__FormatDate__mmmd, // +4 - time__FormatDate__mmmdd, // +5 - time__FormatDate__mmmddyy, // +6 - time__FormatDate__mmmddyyyy, // +7 - time__FormatDate__no_date, // +8 - time__FormatDate__yyyymmdd, // +9 - time__FormatDate__yymmdd, // +10 -} time__FormatDate; - -typedef enum { - time__FormatDelimiter__dot, // - time__FormatDelimiter__hyphen, // +1 - time__FormatDelimiter__slash, // +2 - time__FormatDelimiter__space, // +3 - time__FormatDelimiter__no_delimiter, // +4 -} time__FormatDelimiter; - typedef enum { semver__Operator__gt, // semver__Operator__lt, // +1 @@ -1891,6 +1882,38 @@ typedef enum { v__vet__ErrorType__trailing_space, // +2 } v__vet__ErrorType; +typedef enum { + time__FormatTime__hhmm12, // + time__FormatTime__hhmm24, // +1 + time__FormatTime__hhmmss12, // +2 + time__FormatTime__hhmmss24, // +3 + time__FormatTime__hhmmss24_milli, // +4 + time__FormatTime__hhmmss24_micro, // +5 + time__FormatTime__no_time, // +6 +} time__FormatTime; + +typedef enum { + time__FormatDate__ddmmyy, // + time__FormatDate__ddmmyyyy, // +1 + time__FormatDate__mmddyy, // +2 + time__FormatDate__mmddyyyy, // +3 + time__FormatDate__mmmd, // +4 + time__FormatDate__mmmdd, // +5 + time__FormatDate__mmmddyy, // +6 + time__FormatDate__mmmddyyyy, // +7 + time__FormatDate__no_date, // +8 + time__FormatDate__yyyymmdd, // +9 + time__FormatDate__yymmdd, // +10 +} time__FormatDate; + +typedef enum { + time__FormatDelimiter__dot, // + time__FormatDelimiter__hyphen, // +1 + time__FormatDelimiter__slash, // +2 + time__FormatDelimiter__space, // +3 + time__FormatDelimiter__no_delimiter, // +4 +} time__FormatDelimiter; + typedef enum { v__vmod__TokenKind__module_keyword, // v__vmod__TokenKind__field_key, // +1 @@ -2195,7 +2218,6 @@ struct IError { None__* _None__; Error* _Error; MessageError* _MessageError; - time__TimeParseError* _time__TimeParseError; flag__UnkownFlagError* _flag__UnkownFlagError; flag__ArgsCountError* _flag__ArgsCountError; semver__InvalidComparatorFormatError* _semver__InvalidComparatorFormatError; @@ -2204,6 +2226,7 @@ struct IError { os__FileNotOpenedError* _os__FileNotOpenedError; os__SizeOfTypeIs0Error* _os__SizeOfTypeIs0Error; os__ExecutableNotFoundError* _os__ExecutableNotFoundError; + time__TimeParseError* _time__TimeParseError; v__gen__c__UnsupportedAssertCtempTransform* _v__gen__c__UnsupportedAssertCtempTransform; }; int _typ; @@ -2386,12 +2409,12 @@ typedef map Map_int_bool; typedef array Array_v__gen__c__ProfileCounterMeta; typedef array Array_v__ast__InfixExpr; typedef array Array_v__ast__TypeSymbol; +typedef array Array_f64; typedef array Array_v__token__Token; typedef array Array_sync__Channel_ptr; typedef array Array_sync__Direction; typedef array Array_sync__Subscription; typedef array Array_flag__Flag; -typedef array Array_f64; typedef array Array_semver__Comparator; typedef array Array_semver__ComparatorSet; typedef u8 Array_fixed_u8_5 [5]; @@ -3439,6 +3462,7 @@ struct v__ast__Table { Map_string_string mdeprecated_msg; Map_string_time__Time mdeprecated_after; Map_string_bool builtin_pub_fns; + int pointer_size; }; @@ -3985,6 +4009,22 @@ struct v__gen__c__GenSafeIntegerCfg { +struct math__DigitParams { + int base; + bool reverse; +}; + + + +struct math__ChebSeries { + Array_f64 c; + int order; + f64 a; + f64 b; +}; + + + struct v__pkgconfig__MainOptions { bool modversion; bool description; @@ -4321,6 +4361,7 @@ struct v__pref__Preferences { int message_limit; bool nofloat; int checker_match_exhaustive_cutoff_limit; + int thread_stack_size; }; @@ -5650,6 +5691,7 @@ struct v__ast__File { bool is_test; bool is_generated; bool is_translated; + int idx; string path; string path_base; v__ast__Scope* scope; @@ -5701,6 +5743,7 @@ struct v__ast__FnDecl { bool is_direct_arr; Array_v__ast__Attr attrs; int ctdefine_idx; + int idx; Array_v__ast__Param params; Array_v__ast__Stmt stmts; Array_v__ast__DeferStmt defer_stmts; @@ -6337,6 +6380,17 @@ struct multi_return_u64_string { string arg1; }; +struct multi_return_i64_i64_i64 { + i64 arg0; + i64 arg1; + i64 arg2; +}; + +struct multi_return_f64_f64 { + f64 arg0; + f64 arg1; +}; + // END_multi_return_structs @@ -6424,24 +6478,6 @@ struct Option_v__token__Kind { byte data[sizeof(v__token__Kind) > 0 ? sizeof(v__token__Kind) : 1]; }; -struct Option_time__Time { - byte state; - IError err; - byte data[sizeof(time__Time) > 0 ? sizeof(time__Time) : 1]; -}; - -struct Option_multi_return_int_int_int { - byte state; - IError err; - byte data[sizeof(multi_return_int_int_int) > 0 ? sizeof(multi_return_int_int_int) : 1]; -}; - -struct Option_multi_return_int_int_int_int_i64_bool { - byte state; - IError err; - byte data[sizeof(multi_return_int_int_int_int_i64_bool) > 0 ? sizeof(multi_return_int_int_int_int_i64_bool) : 1]; -}; - struct Option_bool { byte state; IError err; @@ -6520,6 +6556,24 @@ struct Option_term__Coord { byte data[sizeof(term__Coord) > 0 ? sizeof(term__Coord) : 1]; }; +struct Option_time__Time { + byte state; + IError err; + byte data[sizeof(time__Time) > 0 ? sizeof(time__Time) : 1]; +}; + +struct Option_multi_return_int_int_int { + byte state; + IError err; + byte data[sizeof(multi_return_int_int_int) > 0 ? sizeof(multi_return_int_int_int) : 1]; +}; + +struct Option_multi_return_int_int_int_int_i64_bool { + byte state; + IError err; + byte data[sizeof(multi_return_int_int_int_int_i64_bool) > 0 ? sizeof(multi_return_int_int_int_int_i64_bool) : 1]; +}; + struct Option_v__vmod__Manifest { byte state; IError err; @@ -7288,6 +7342,7 @@ string u8_vstring_literal(u8* bp); string u8_vstring_literal_with_len(u8* bp, int len); string char_vstring_literal(char* cp); string char_vstring_literal_with_len(char* cp, int len); +int string_len_utf8(string s); VV_LOCAL_SYMBOL string string_clone_static(string a); string string_clone(string a); string string_replace_once(string s, string rep, string with); @@ -7424,10 +7479,10 @@ int utf8_char_len(u8 b); string utf32_to_str(u32 code); string utf32_to_str_no_malloc(u32 code, u8* buf); int utf32_decode_to_buffer(u32 code, u8* buf); +int utf8_str_len(string s); int string_utf32_code(string _rune); Option_rune Array_u8_utf8_to_utf32(Array_u8 _bytes); VV_LOCAL_SYMBOL int utf8_len(u8 c); -int utf8_str_len(string s); int utf8_str_visible_length(string s); bool ArrayFlags_is_empty(ArrayFlags* e); bool ArrayFlags_has(ArrayFlags* e, ArrayFlags flag); @@ -7511,117 +7566,6 @@ string v__token__kind_to_string(v__token__Kind k); Option_v__token__Kind v__token__kind_from_string(string s); int v__mathutil__min_T_int(int a, int b); int v__mathutil__max_T_int(int a, int b); -i64 time__portable_timegm(struct tm* t); -int time__days_from_civil(int oy, int m, int d); -string time__Time_format(time__Time t); -string time__Time_format_ss(time__Time t); -string time__Time_format_ss_milli(time__Time t); -string time__Time_format_ss_micro(time__Time t); -string time__Time_hhmm(time__Time t); -string time__Time_hhmmss(time__Time t); -string time__Time_hhmm12(time__Time t); -string time__Time_ymmdd(time__Time t); -string time__Time_ddmmy(time__Time t); -string time__Time_md(time__Time t); -string time__Time_clean(time__Time t); -string time__Time_clean12(time__Time t); -string time__Time_get_fmt_time_str(time__Time t, time__FormatTime fmt_time); -string time__Time_get_fmt_date_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatDate fmt_date); -string time__Time_get_fmt_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatTime fmt_time, time__FormatDate fmt_date); -string time__Time_utc_string(time__Time t); -bool time__Time__eq(time__Time t1, time__Time t2); -bool time__Time__lt(time__Time t1, time__Time t2); -time__Duration time__Time__minus(time__Time lhs, time__Time rhs); -Option_time__Time time__parse_rfc3339(string s); -Option_time__Time time__parse(string s); -Option_time__Time time__parse_iso8601(string s); -Option_time__Time time__parse_rfc2822(string s); -VV_LOCAL_SYMBOL Option_multi_return_int_int_int time__parse_iso8601_date(string s); -VV_LOCAL_SYMBOL Option_multi_return_int_int_int_int_i64_bool time__parse_iso8601_time(string s); -string time__TimeParseError_msg(time__TimeParseError err); -VV_LOCAL_SYMBOL IError time__error_invalid_time(int code); -time__StopWatch time__new_stopwatch(time__StopWatchOptions opts); -void time__StopWatch_start(time__StopWatch* t); -void time__StopWatch_restart(time__StopWatch* t); -void time__StopWatch_stop(time__StopWatch* t); -void time__StopWatch_pause(time__StopWatch* t); -time__Duration time__StopWatch_elapsed(time__StopWatch t); -time__Time time__now(void); -time__Time time__utc(void); -time__Time time__new_time(time__Time t); -i64 time__ticks(void); -string time__Time_str(time__Time t); -VV_LOCAL_SYMBOL time__Time time__convert_ctime(struct tm t, int microsecond); -string time__Time_strftime(time__Time t, string fmt); -string _const_time__days_string; // a string literal, inited later -Array_int _const_time__month_days; // inited later -string _const_time__months_string; // a string literal, inited later -i64 _const_time__absolute_zero_year; // inited later -#define _const_time__seconds_per_minute 60 -#define _const_time__seconds_per_hour 3600 -#define _const_time__seconds_per_day 86400 -#define _const_time__seconds_per_week 604800 -#define _const_time__days_per_400_years 146097 -#define _const_time__days_per_100_years 36524 -#define _const_time__days_per_4_years 1461 -Array_int _const_time__days_before; // inited later -Array_string _const_time__long_days; // inited later -string time__Time_smonth(time__Time* t); -i64 time__Time_unix_time(time__Time* t); -i64 time__Time_unix_time_milli(time__Time* t); -time__Time time__Time_add(time__Time* t, time__Duration d); -time__Time time__Time_add_seconds(time__Time* t, int seconds); -time__Time time__Time_add_days(time__Time* t, int days); -time__Duration time__since(time__Time t); -string time__Time_relative(time__Time* t); -string time__Time_relative_short(time__Time* t); -int time__day_of_week(int y, int m, int d); -int time__Time_day_of_week(time__Time* t); -string time__Time_weekday_str(time__Time* t); -string time__Time_long_weekday_str(time__Time* t); -bool time__is_leap_year(int year); -Option_int time__days_in_month(int month, int year); -string time__Time_debug(time__Time* t); -time__Duration _const_time__nanosecond; // inited later -time__Duration _const_time__microsecond; // inited later -time__Duration _const_time__millisecond; // inited later -time__Duration _const_time__second; // inited later -time__Duration _const_time__minute; // inited later -time__Duration _const_time__hour; // inited later -time__Duration _const_time__infinite; // inited later -i64 time__Duration_nanoseconds(time__Duration d); -i64 time__Duration_microseconds(time__Duration d); -i64 time__Duration_milliseconds(time__Duration d); -f64 time__Duration_seconds(time__Duration d); -f64 time__Duration_minutes(time__Duration d); -f64 time__Duration_hours(time__Duration d); -string time__Duration_str(time__Duration d); -int time__offset(void); -u64 _const_time__start_time; // inited later -u64 _const_time__freq_time; // inited later -i64 _const_time__start_local_time; // inited later -VV_LOCAL_SYMBOL i64 time__make_unix_time(struct tm t); -VV_LOCAL_SYMBOL u64 time__init_win_time_freq(void); -VV_LOCAL_SYMBOL u64 time__init_win_time_start(void); -u64 time__sys_mono_now(void); -VV_LOCAL_SYMBOL u64 time__vpc_now(void); -VV_LOCAL_SYMBOL i64 time__local_as_unix_time(void); -time__Time time__Time_local(time__Time* t); -VV_LOCAL_SYMBOL time__Time time__win_now(void); -VV_LOCAL_SYMBOL time__Time time__win_utc(void); -i64 time__SystemTime_unix_time(time__SystemTime st); -time__Time time__darwin_now(void); -time__Time time__linux_now(void); -time__Time time__solaris_now(void); -time__Time time__darwin_utc(void); -time__Time time__linux_utc(void); -time__Time time__solaris_utc(void); -void time__sleep(time__Duration duration); -u32 time__Duration_sys_milliseconds(time__Duration d); -time__Time time__unix(i64 abs); -time__Time time__unix2(i64 abs, int microsecond); -VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_date_from_offset(i64 day_offset_); -VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_time_from_offset(i64 second_offset_); void v__dotgraph__start_digraph(void); VV_LOCAL_SYMBOL void anon_fn_eb34f0b759dade77__82(void); v__dotgraph__DotGraph* v__dotgraph__new(string name, string label, string color); @@ -7661,6 +7605,58 @@ u32 hash__fnv1a__sum32_bytes(u8* data, int data_len); u64 hash__fnv1a__sum64_string(string data); u64 hash__fnv1a__sum64(Array_u8 data); u64 hash__fnv1a__sum64_bytes(u8* data, int data_len); +f64 _const_math__internal__f64_epsilon = 2.220446049250313e-16; // precomputed +f64 _const_math__internal__sqrt_f64_epsilon = 3.725290298461914e-09; // precomputed +f64 _const_math__internal__root3_f64_epsilon = 6.055454452393343e-06; // precomputed +f64 _const_math__internal__root4_f64_epsilon = 0.0001220703125; // precomputed +f64 _const_math__internal__root5_f64_epsilon = 0.000740095979741405; // precomputed +f64 _const_math__internal__root6_f64_epsilon = 0.002460783300575925; // precomputed +f64 _const_math__internal__log_f64_epsilon = -36.04365338911715; // precomputed +f64 _const_math__internal__f64_min = 2.2250738585072014e-308; // precomputed +f64 _const_math__internal__sqrt_f64_min = 3.7291703656001034e-155; // precomputed +f64 _const_math__internal__root3_f64_min = 2.8126442852362996e-103; // precomputed +f64 _const_math__internal__root4_f64_min = 1.221338669755462e-77; // precomputed +f64 _const_math__internal__root5_f64_min = 2.9476022969691763e-62; // precomputed +f64 _const_math__internal__root6_f64_min = 5.303436890579822e-52; // precomputed +f64 _const_math__internal__log_f64_min = -708.3964185322641; // precomputed +f64 _const_math__internal__f64_max = 1.7976931348623157e+308; // precomputed +f64 _const_math__internal__sqrt_f64_max = 1.3407807929942596e+154; // precomputed +f64 _const_math__internal__root3_f64_max = 5.64380309412229e+102; // precomputed +f64 _const_math__internal__root4_f64_max = 1.157920892373162e+77; // precomputed +f64 _const_math__internal__root5_f64_max = 4.4765466227572707e+61; // precomputed +f64 _const_math__internal__root6_f64_max = 2.3756689782295612e+51; // precomputed +f64 _const_math__internal__log_f64_max = 709.782712893384; // precomputed +f64 _const_math__internal__f32_epsilon = 1.1920928955078125e-07; // precomputed +f64 _const_math__internal__sqrt_f32_epsilon = 0.00034526698300124393; // precomputed +f64 _const_math__internal__root3_f32_epsilon = 0.00492156660115185; // precomputed +f64 _const_math__internal__root4_f32_epsilon = 0.018581361171917516; // precomputed +f64 _const_math__internal__root5_f32_epsilon = 0.04123462221165294; // precomputed +f64 _const_math__internal__root6_f32_epsilon = 0.07015387801933583; // precomputed +f64 _const_math__internal__log_f32_epsilon = -15.942385152878742; // precomputed +f64 _const_math__internal__f32_min = 2.938735877055719e-39; // precomputed +f64 _const_math__internal__sqrt_f32_min = 2.710505431213761e-20; // precomputed +f64 _const_math__internal__root3_f32_min = 2.273736754432324e-13; // precomputed +f64 _const_math__internal__root4_f32_min = 3.2927225399135965e-10; // precomputed +f64 _const_math__internal__root5_f32_min = 2.5944428542140822e-08; // precomputed +f64 _const_math__internal__root6_f32_min = 4.768371582031254e-07; // precomputed +f64 _const_math__internal__log_f32_min = -87.3365447505531; // precomputed +f64 _const_math__internal__f32_max = 3.4028234663852886e+38; // precomputed +f64 _const_math__internal__sqrt_f32_max = 1.844674352395373e+19; // precomputed +f64 _const_math__internal__root3_f32_max = 6.981463519622324e+12; // precomputed +f64 _const_math__internal__root4_f32_max = 4.2949672319999986e+09; // precomputed +f64 _const_math__internal__root5_f32_max = 5.085900785596004e+07; // precomputed +f64 _const_math__internal__root6_f32_max = 2.642245923380775e+06; // precomputed +f64 _const_math__internal__log_f32_max = 88.72283905206835; // precomputed +f64 _const_math__internal__sflt_epsilon = 0.00048828125; // precomputed +f64 _const_math__internal__sqrt_sflt_epsilon = 0.02209708691207961; // precomputed +f64 _const_math__internal__root3_sflt_epsilon = 0.07874506561842959; // precomputed +f64 _const_math__internal__root4_sflt_epsilon = 0.14865088937534013; // precomputed +f64 _const_math__internal__root5_sflt_epsilon = 0.217637640824031; // precomputed +f64 _const_math__internal__root6_sflt_epsilon = 0.28061551207734325; // precomputed +f64 _const_math__internal__log_sflt_epsilon = -7.6246189861593985; // precomputed +#define _const_math__internal__max_int_fact_arg 170 +f64 _const_math__internal__max_f64_fact_arg = 171.; // precomputed +f64 _const_math__internal__max_long_f64_fact_arg = 1755.5; // precomputed VV_LOCAL_SYMBOL string flag__UnkownFlagError_msg(flag__UnkownFlagError err); VV_LOCAL_SYMBOL string flag__ArgsCountError_msg(flag__ArgsCountError err); VV_LOCAL_SYMBOL void flag__Flag_free(flag__Flag* f); @@ -8123,10 +8119,262 @@ string v__depgraph__DepGraph_display(v__depgraph__DepGraph* graph); string v__depgraph__DepGraph_display_cycles(v__depgraph__DepGraph* graph); VV_LOCAL_SYMBOL multi_return_bool_Array_string v__depgraph__NodeNames_is_part_of_cycle(v__depgraph__NodeNames* nn, string name, Array_string already_seen); void v__depgraph__show(v__depgraph__DepGraph* graph, string path); -VV_LOCAL_SYMBOL u32 rand__seed__nr_next(u32 prev); -Array_u32 rand__seed__time_seed_array(int count); -u32 rand__seed__time_seed_32(void); -u64 rand__seed__time_seed_64(void); +f64 math__fabs(f64 x); +u64 _const_math__uvnan = 9221120237041090561U; // precomputed +u64 _const_math__uvinf = 9218868437227405312U; // precomputed +u64 _const_math__uvneginf = 18442240474082181120U; // precomputed +u64 _const_math__uvone = 4607182418800017408U; // precomputed +#define _const_math__mask 2047 +#define _const_math__shift 52 +#define _const_math__bias 1023 +u64 _const_math__normalize_smallest_mask = 4503599627370496U; // precomputed +u64 _const_math__sign_mask = 9223372036854775808U; // precomputed +u64 _const_math__frac_mask = 4503599627370495U; // precomputed +f64 math__inf(int sign); +f64 math__nan(void); +bool math__is_nan(f64 f); +bool math__is_inf(f64 f, int sign); +bool math__is_finite(f64 f); +multi_return_f64_int math__normalize(f64 x); +f64 math__cbrt(f64 a); +f64 _const_math__e = 2.718281828459045; // precomputed +f64 _const_math__pi = 3.141592653589793; // precomputed +f64 _const_math__pi_2; // inited later +f64 _const_math__pi_4; // inited later +f64 _const_math__phi = 1.618033988749895; // precomputed +f64 _const_math__tau = 6.283185307179586; // precomputed +f64 _const_math__sqrt2 = 1.4142135623730951; // precomputed +f64 _const_math__sqrt_e = 1.6487212707001282; // precomputed +f64 _const_math__sqrt_pi = 1.772453850905516; // precomputed +f64 _const_math__sqrt_tau = 2.5066282746310007; // precomputed +f64 _const_math__sqrt_phi = 1.272019649514069; // precomputed +f64 _const_math__ln2 = 0.6931471805599453; // precomputed +f64 _const_math__log2_e; // inited later +f64 _const_math__ln10 = 2.302585092994046; // precomputed +f64 _const_math__log10_e; // inited later +f64 _const_math__max_f32 = 3.4028234663852886e+38; // precomputed +f64 _const_math__smallest_non_zero_f32 = 3.503246160812043e-46; // precomputed +f64 _const_math__max_f64 = 1.7976931348623157e+308; // precomputed +f64 _const_math__smallest_non_zero_f64 = 0; // precomputed +#define _const_math__max_i8 127 +#define _const_math__min_i8 -128 +#define _const_math__max_i16 32767 +#define _const_math__min_i16 -32768 +#define _const_math__max_i32 2147483647 +#define _const_math__min_i32 -2147483648 +i64 _const_math__min_i64; // inited later +i64 _const_math__max_i64; // inited later +#define _const_math__max_u8 255 +#define _const_math__max_u16 65535 +u32 _const_math__max_u32 = 4294967295; // precomputed +u64 _const_math__max_u64 = 18446744073709551615U; // precomputed +f64 math__mod(f64 x, f64 y); +f64 math__fmod(f64 x, f64 y); +i64 math__gcd(i64 a_, i64 b_); +multi_return_i64_i64_i64 math__egcd(i64 a, i64 b); +i64 math__lcm(i64 a, i64 b); +f64 _const_math__erx = 0.8450629115104675; // precomputed +f64 _const_math__efx = 0.1283791670955126; // precomputed +f64 _const_math__efx8 = 1.0270333367641007; // precomputed +f64 _const_math__pp0 = 0.12837916709551256; // precomputed +f64 _const_math__pp1 = -0.3250421072470015; // precomputed +f64 _const_math__pp2 = -0.02848174957559851; // precomputed +f64 _const_math__pp3 = -0.005770270296489442; // precomputed +f64 _const_math__pp4 = -2.3763016656650163e-05; // precomputed +f64 _const_math__qq1 = 0.39791722395915535; // precomputed +f64 _const_math__qq2 = 0.0650222499887673; // precomputed +f64 _const_math__qq3 = 0.005081306281875766; // precomputed +f64 _const_math__qq4 = 0.00013249473800432164; // precomputed +f64 _const_math__qq5 = -3.960228278775368e-06; // precomputed +f64 _const_math__pa0 = -0.0023621185607526594; // precomputed +f64 _const_math__pa1 = 0.41485611868374833; // precomputed +f64 _const_math__pa2 = -0.3722078760357013; // precomputed +f64 _const_math__pa3 = 0.31834661990116175; // precomputed +f64 _const_math__pa4 = -0.11089469428239668; // precomputed +f64 _const_math__pa5 = 0.035478304325618236; // precomputed +f64 _const_math__pa6 = -0.002166375594868791; // precomputed +f64 _const_math__qa1 = 0.10642088040084423; // precomputed +f64 _const_math__qa2 = 0.540397917702171; // precomputed +f64 _const_math__qa3 = 0.07182865441419627; // precomputed +f64 _const_math__qa4 = 0.12617121980876164; // precomputed +f64 _const_math__qa5 = 0.01363708391202905; // precomputed +f64 _const_math__qa6 = 0.011984499846799107; // precomputed +f64 _const_math__ra0 = -0.009864944034847148; // precomputed +f64 _const_math__ra1 = -0.6938585727071818; // precomputed +f64 _const_math__ra2 = -10.558626225323291; // precomputed +f64 _const_math__ra3 = -62.375332450326006; // precomputed +f64 _const_math__ra4 = -162.39666946257347; // precomputed +f64 _const_math__ra5 = -184.60509290671104; // precomputed +f64 _const_math__ra6 = -81.2874355063066; // precomputed +f64 _const_math__ra7 = -9.814329344169145; // precomputed +f64 _const_math__sa1 = 19.651271667439257; // precomputed +f64 _const_math__sa2 = 137.65775414351904; // precomputed +f64 _const_math__sa3 = 434.56587747522923; // precomputed +f64 _const_math__sa4 = 645.3872717332679; // precomputed +f64 _const_math__sa5 = 429.00814002756783; // precomputed +f64 _const_math__sa6 = 108.63500554177944; // precomputed +f64 _const_math__sa7 = 6.570249770319282; // precomputed +f64 _const_math__sa8 = -0.0604244152148581; // precomputed +f64 _const_math__rb0 = -0.0098649429247001; // precomputed +f64 _const_math__rb1 = -0.799283237680523; // precomputed +f64 _const_math__rb2 = -17.757954917754752; // precomputed +f64 _const_math__rb3 = -160.63638485582192; // precomputed +f64 _const_math__rb4 = -637.5664433683896; // precomputed +f64 _const_math__rb5 = -1025.0951316110772; // precomputed +f64 _const_math__rb6 = -483.5191916086514; // precomputed +f64 _const_math__sb1 = 30.33806074348246; // precomputed +f64 _const_math__sb2 = 325.7925129965739; // precomputed +f64 _const_math__sb3 = 1536.729586084437; // precomputed +f64 _const_math__sb4 = 3199.8582195085955; // precomputed +f64 _const_math__sb5 = 2553.0504064331644; // precomputed +f64 _const_math__sb6 = 474.52854120695537; // precomputed +f64 _const_math__sb7 = -22.44095244658582; // precomputed +f64 math__erf(f64 a); +f64 math__erfc(f64 a); +f64 _const_math__f64_max_exp = 1024.; // precomputed +f64 _const_math__f64_min_exp = -1021.; // precomputed +f64 _const_math__threshold = 709.782712893384; // precomputed +f64 _const_math__ln2_x56 = 38.816242111356935; // precomputed +f64 _const_math__ln2_halfx3 = 1.0397207708399179; // precomputed +f64 _const_math__ln2_half = 0.34657359027997264; // precomputed +f64 _const_math__ln2hi = 0.6931471803691238; // precomputed +f64 _const_math__ln2lo = 1.9082149292705877e-10; // precomputed +f64 _const_math__inv_ln2 = 1.4426950408889634; // precomputed +f64 _const_math__expm1_q1 = -0.03333333333333313; // precomputed +f64 _const_math__expm1_q2 = 0.0015873015872548146; // precomputed +f64 _const_math__expm1_q3 = -7.93650757867488e-05; // precomputed +f64 _const_math__expm1_q4 = 4.008217827329362e-06; // precomputed +f64 _const_math__expm1_q5 = -2.0109921818362437e-07; // precomputed +f64 math__exp(f64 x); +f64 math__exp2(f64 x); +f64 math__ldexp(f64 frac, int exp); +multi_return_f64_int math__frexp(f64 x); +f64 math__expm1(f64 x); +VV_LOCAL_SYMBOL f64 math__expmulti(f64 hi, f64 lo, int k); +f64 math__factorial(f64 n); +f64 math__log_factorial(f64 n); +VV_LOCAL_SYMBOL f64 math__log_factorial_asymptotic_expansion(int n); +i64 math__factoriali(int n); +f64 _const_math__log_sqrt_2pi = 0.9189385332046728; // precomputed +Array_f64 _const_math__bernoulli; // inited later +Array_f64 _const_math__factorials_table; // inited later +Array_f64 _const_math__log_factorials_table; // inited later +f64 math__floor(f64 x); +f64 math__ceil(f64 x); +f64 math__trunc(f64 x); +f64 math__round(f64 x); +f64 math__round_to_even(f64 x); +VV_LOCAL_SYMBOL multi_return_f64_f64 math__stirling(f64 x); +f64 math__gamma(f64 a); +f64 math__log_gamma(f64 x); +multi_return_f64_int math__log_gamma_sign(f64 a); +VV_LOCAL_SYMBOL f64 math__sin_pi(f64 x_); +Array_f64 _const_math__gamma_p; // inited later +Array_f64 _const_math__gamma_q; // inited later +Array_f64 _const_math__gamma_s; // inited later +Array_f64 _const_math__lgamma_a; // inited later +Array_f64 _const_math__lgamma_r; // inited later +Array_f64 _const_math__lgamma_s; // inited later +Array_f64 _const_math__lgamma_t; // inited later +Array_f64 _const_math__lgamma_u; // inited later +Array_f64 _const_math__lgamma_v; // inited later +Array_f64 _const_math__lgamma_w; // inited later +f64 math__hypot(f64 x, f64 y); +f64 math__acosh(f64 x); +f64 math__asinh(f64 x); +f64 math__atanh(f64 x); +f64 _const_math__morebits = 6.123233995736766e-17; // precomputed +f64 _const_math__tan3pio8 = 2.414213562373095; // precomputed +VV_LOCAL_SYMBOL f64 math__xatan(f64 x); +VV_LOCAL_SYMBOL f64 math__satan(f64 x); +f64 math__atan(f64 x); +f64 math__atan2(f64 y, f64 x); +f64 math__asin(f64 x_); +f64 math__acos(f64 x); +f64 math__log_n(f64 x, f64 b); +f64 math__log10(f64 x); +f64 math__log2(f64 x); +f64 math__log1p(f64 x); +f64 math__log_b(f64 x); +int math__ilog_b(f64 x); +VV_LOCAL_SYMBOL int math__ilog_b_(f64 x_); +f64 math__log(f64 a); +f64 math__aprox_sin(f64 a); +f64 math__aprox_cos(f64 a); +f64 math__copysign(f64 x, f64 y); +f64 math__degrees(f64 radians); +Array_int math__digits(i64 num, math__DigitParams params); +int math__count_digits(i64 number); +multi_return_f64_f64 math__minmax(f64 a, f64 b); +f64 math__clamp(f64 x, f64 a, f64 b); +f64 math__sign(f64 n); +int math__signi(f64 n); +f64 math__radians(f64 degrees); +bool math__signbit(f64 x); +bool math__tolerance(f64 a, f64 b, f64 tol); +bool math__close(f64 a, f64 b); +bool math__veryclose(f64 a, f64 b); +bool math__alike(f64 a, f64 b); +VV_LOCAL_SYMBOL bool math__is_odd_int(f64 x); +VV_LOCAL_SYMBOL bool math__is_neg_int(f64 x); +int math__min_T_int(int a, int b); +f64 math__abs_T_f64(f64 a); +f64 _const_math__modf_maxpowtwo = 4.503599627370496e+15; // precomputed +multi_return_f64_f64 math__modf(f64 f); +f32 math__nextafter32(f32 x, f32 y); +f64 math__nextafter(f64 x, f64 y); +VV_LOCAL_SYMBOL f64 math__poly_n_eval(Array_f64 c, int n, f64 x); +VV_LOCAL_SYMBOL f64 math__poly_n_1_eval(Array_f64 c, int n, f64 x); +VV_LOCAL_SYMBOL f64 math__poly_eval(Array_f64 c, f64 x); +VV_LOCAL_SYMBOL f64 math__poly_1_eval(Array_f64 c, f64 x); +VV_LOCAL_SYMBOL multi_return_f64_f64 math__ChebSeries_eval_e(math__ChebSeries cs, f64 x); +f32 math__powf(f32 a, f32 b); +Array_f64 _const_math__pow10tab; // inited later +Array_f64 _const_math__pow10postab32; // inited later +Array_f64 _const_math__pow10negtab32; // inited later +f32 math__pure_v_but_overriden_by_c_powf(f32 a, f32 b); +f64 math__pow10(int n); +i64 math__powi(i64 a, i64 b); +f64 math__pow(f64 x, f64 y); +f64 math__q_rsqrt(f64 x); +f64 math__scalbn(f64 x, int n_); +f32 math__cosf(f32 a); +f32 math__sinf(f32 a); +Array_f64 _const_math__sin_data; // inited later +math__ChebSeries _const_math__sin_cs; // inited later +Array_f64 _const_math__cos_data; // inited later +math__ChebSeries _const_math__cos_cs; // inited later +f64 math__sin(f64 x); +f64 math__cos(f64 x); +f32 math__pure_v_but_overriden_by_c_cosf(f32 a); +f32 math__pure_v_but_overriden_by_c_sinf(f32 a); +multi_return_f64_f64 math__sincos(f64 x); +f64 math__sinh(f64 x_); +f64 math__cosh(f64 x); +f32 math__sqrtf(f32 a); +f64 math__sqrt(f64 a); +f32 math__pure_v_but_overriden_by_c_sqrtf(f32 a); +i64 math__sqrti(i64 a); +f32 math__tanf(f32 a); +Array_f64 _const_math__tan_p; // inited later +Array_f64 _const_math__tan_q; // inited later +f64 _const_math__tan_dp1 = 0.7853981554508209; // precomputed +f64 _const_math__tan_dp2 = 7.946627356147928e-09; // precomputed +f64 _const_math__tan_dp3 = 3.061616997868383e-17; // precomputed +f64 _const_math__tan_lossth = 1.073741824e+09; // precomputed +f64 math__tan(f64 a); +f32 math__pure_v_but_overriden_by_c_tanf(f32 a); +f64 math__cot(f64 a); +Array_f64 _const_math__tanh_p; // inited later +Array_f64 _const_math__tanh_q; // inited later +f64 math__tanh(f64 x); +u32 math__f32_bits(f32 f); +f32 math__f32_from_bits(u32 b); +u64 math__f64_bits(f64 f); +f64 math__f64_from_bits(u64 b); +f64 math__with_set_low_word(f64 f, u32 lo); +f64 math__with_set_high_word(f64 f, u32 hi); +u32 math__get_high_word(f64 f); string term__format(string msg, string open, string close); string term__format_rgb(int r, int g, int b, string msg, string open, string close); string term__rgb(int r, int g, int b, string msg); @@ -8226,10 +8474,123 @@ Option_string v__vcache__CacheManager_exists(v__vcache__CacheManager* cm, string Option_string v__vcache__CacheManager_save(v__vcache__CacheManager* cm, string postfix, string key, string content); Option_string v__vcache__CacheManager_load(v__vcache__CacheManager* cm, string postfix, string key); VV_LOCAL_SYMBOL int v__vcache__mypid(void); -Option_string v__util__diff__find_working_diff_command(void); -VV_LOCAL_SYMBOL bool v__util__diff__opendiff_exists(void); -string v__util__diff__color_compare_files(string diff_cmd, string file1, string file2); -string v__util__diff__color_compare_strings(string diff_cmd, string unique_prefix, string expected, string found); +i64 time__portable_timegm(struct tm* t); +int time__days_from_civil(int oy, int m, int d); +string time__Time_format(time__Time t); +string time__Time_format_ss(time__Time t); +string time__Time_format_ss_milli(time__Time t); +string time__Time_format_ss_micro(time__Time t); +string time__Time_hhmm(time__Time t); +string time__Time_hhmmss(time__Time t); +string time__Time_hhmm12(time__Time t); +string time__Time_ymmdd(time__Time t); +string time__Time_ddmmy(time__Time t); +string time__Time_md(time__Time t); +VV_LOCAL_SYMBOL string time__ordinal_suffix(int n); +Array_string _const_time__tokens_2; // inited later +Array_string _const_time__tokens_3; // inited later +Array_string _const_time__tokens_4; // inited later +string time__Time_custom_format(time__Time t, string s); +string time__Time_clean(time__Time t); +string time__Time_clean12(time__Time t); +string time__Time_get_fmt_time_str(time__Time t, time__FormatTime fmt_time); +string time__Time_get_fmt_date_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatDate fmt_date); +string time__Time_get_fmt_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatTime fmt_time, time__FormatDate fmt_date); +string time__Time_utc_string(time__Time t); +bool time__Time__eq(time__Time t1, time__Time t2); +bool time__Time__lt(time__Time t1, time__Time t2); +time__Duration time__Time__minus(time__Time lhs, time__Time rhs); +Option_time__Time time__parse_rfc3339(string s); +Option_time__Time time__parse(string s); +Option_time__Time time__parse_iso8601(string s); +Option_time__Time time__parse_rfc2822(string s); +VV_LOCAL_SYMBOL Option_multi_return_int_int_int time__parse_iso8601_date(string s); +VV_LOCAL_SYMBOL Option_multi_return_int_int_int_int_i64_bool time__parse_iso8601_time(string s); +string time__TimeParseError_msg(time__TimeParseError err); +VV_LOCAL_SYMBOL IError time__error_invalid_time(int code); +time__StopWatch time__new_stopwatch(time__StopWatchOptions opts); +void time__StopWatch_start(time__StopWatch* t); +void time__StopWatch_restart(time__StopWatch* t); +void time__StopWatch_stop(time__StopWatch* t); +void time__StopWatch_pause(time__StopWatch* t); +time__Duration time__StopWatch_elapsed(time__StopWatch t); +time__Time time__now(void); +time__Time time__utc(void); +time__Time time__new_time(time__Time t); +i64 time__ticks(void); +string time__Time_str(time__Time t); +VV_LOCAL_SYMBOL time__Time time__convert_ctime(struct tm t, int microsecond); +string time__Time_strftime(time__Time t, string fmt); +string _const_time__days_string; // a string literal, inited later +Array_string _const_time__long_days; // inited later +Array_int _const_time__month_days; // inited later +string _const_time__months_string; // a string literal, inited later +Array_string _const_time__long_months; // inited later +i64 _const_time__absolute_zero_year; // inited later +#define _const_time__seconds_per_minute 60 +#define _const_time__seconds_per_hour 3600 +#define _const_time__seconds_per_day 86400 +#define _const_time__seconds_per_week 604800 +#define _const_time__days_per_400_years 146097 +#define _const_time__days_per_100_years 36524 +#define _const_time__days_per_4_years 1461 +Array_int _const_time__days_before; // inited later +string time__Time_smonth(time__Time* t); +i64 time__Time_unix_time(time__Time* t); +i64 time__Time_unix_time_milli(time__Time* t); +time__Time time__Time_add(time__Time* t, time__Duration d); +time__Time time__Time_add_seconds(time__Time* t, int seconds); +time__Time time__Time_add_days(time__Time* t, int days); +time__Duration time__since(time__Time t); +string time__Time_relative(time__Time* t); +string time__Time_relative_short(time__Time* t); +int time__day_of_week(int y, int m, int d); +int time__Time_day_of_week(time__Time* t); +string time__Time_weekday_str(time__Time* t); +string time__Time_long_weekday_str(time__Time* t); +bool time__is_leap_year(int year); +Option_int time__days_in_month(int month, int year); +string time__Time_debug(time__Time* t); +time__Duration _const_time__nanosecond; // inited later +time__Duration _const_time__microsecond; // inited later +time__Duration _const_time__millisecond; // inited later +time__Duration _const_time__second; // inited later +time__Duration _const_time__minute; // inited later +time__Duration _const_time__hour; // inited later +time__Duration _const_time__infinite; // inited later +i64 time__Duration_nanoseconds(time__Duration d); +i64 time__Duration_microseconds(time__Duration d); +i64 time__Duration_milliseconds(time__Duration d); +f64 time__Duration_seconds(time__Duration d); +f64 time__Duration_minutes(time__Duration d); +f64 time__Duration_hours(time__Duration d); +string time__Duration_str(time__Duration d); +int time__offset(void); +u64 _const_time__start_time; // inited later +u64 _const_time__freq_time; // inited later +i64 _const_time__start_local_time; // inited later +VV_LOCAL_SYMBOL i64 time__make_unix_time(struct tm t); +VV_LOCAL_SYMBOL u64 time__init_win_time_freq(void); +VV_LOCAL_SYMBOL u64 time__init_win_time_start(void); +u64 time__sys_mono_now(void); +VV_LOCAL_SYMBOL u64 time__vpc_now(void); +VV_LOCAL_SYMBOL i64 time__local_as_unix_time(void); +time__Time time__Time_local(time__Time* t); +VV_LOCAL_SYMBOL time__Time time__win_now(void); +VV_LOCAL_SYMBOL time__Time time__win_utc(void); +i64 time__SystemTime_unix_time(time__SystemTime st); +time__Time time__darwin_now(void); +time__Time time__linux_now(void); +time__Time time__solaris_now(void); +time__Time time__darwin_utc(void); +time__Time time__linux_utc(void); +time__Time time__solaris_utc(void); +void time__sleep(time__Duration duration); +u32 time__Duration_sys_milliseconds(time__Duration d); +time__Time time__unix(i64 abs); +time__Time time__unix2(i64 abs, int microsecond); +VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_date_from_offset(i64 day_offset_); +VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_time_from_offset(i64 second_offset_); string _const_v__vmod__err_label; // a string literal, inited later Option_v__vmod__Manifest v__vmod__from_file(string vmod_path); Option_v__vmod__Manifest v__vmod__decode(string contents); @@ -8268,16 +8629,6 @@ Array_string Array_v__cflag__CFlag_c_options_after_target(Array_v__cflag__CFlag Array_string Array_v__cflag__CFlag_c_options_without_object_files(Array_v__cflag__CFlag cflags); Array_string Array_v__cflag__CFlag_c_options_only_object_files(Array_v__cflag__CFlag cflags); multi_return_Array_string_Array_string_Array_string Array_v__cflag__CFlag_defines_others_libs(Array_v__cflag__CFlag cflags); -u64 _const_rand__wyrand__wyp0 = 11562461410679940143U; // precomputed -u64 _const_rand__wyrand__wyp1 = 16646288086500911323U; // precomputed -#define _const_rand__wyrand__seed_len 2 -void rand__wyrand__WyRandRNG_seed(rand__wyrand__WyRandRNG* rng, Array_u32 seed_data); -u8 rand__wyrand__WyRandRNG_u8(rand__wyrand__WyRandRNG* rng); -u16 rand__wyrand__WyRandRNG_u16(rand__wyrand__WyRandRNG* rng); -u32 rand__wyrand__WyRandRNG_u32(rand__wyrand__WyRandRNG* rng); -u64 rand__wyrand__WyRandRNG_u64(rand__wyrand__WyRandRNG* rng); -int rand__wyrand__WyRandRNG_block_size(rand__wyrand__WyRandRNG* rng); -void rand__wyrand__WyRandRNG_free(rand__wyrand__WyRandRNG* rng); VV_LOCAL_SYMBOL Option_string v__pkgconfig__desc(string mod); Option_v__pkgconfig__Main_ptr v__pkgconfig__main(Array_string args); VV_LOCAL_SYMBOL int compare_16330786295575367509_string(string* a, string* b) { @@ -8311,6 +8662,24 @@ bool runtime__is_64bit(void); bool runtime__is_little_endian(void); bool runtime__is_big_endian(void); int runtime__nr_cpus(void); +Option_string v__util__diff__find_working_diff_command(void); +VV_LOCAL_SYMBOL bool v__util__diff__opendiff_exists(void); +string v__util__diff__color_compare_files(string diff_cmd, string file1, string file2); +string v__util__diff__color_compare_strings(string diff_cmd, string unique_prefix, string expected, string found); +VV_LOCAL_SYMBOL u32 rand__seed__nr_next(u32 prev); +Array_u32 rand__seed__time_seed_array(int count); +u32 rand__seed__time_seed_32(void); +u64 rand__seed__time_seed_64(void); +u64 _const_rand__wyrand__wyp0 = 11562461410679940143U; // precomputed +u64 _const_rand__wyrand__wyp1 = 16646288086500911323U; // precomputed +#define _const_rand__wyrand__seed_len 2 +void rand__wyrand__WyRandRNG_seed(rand__wyrand__WyRandRNG* rng, Array_u32 seed_data); +u8 rand__wyrand__WyRandRNG_u8(rand__wyrand__WyRandRNG* rng); +u16 rand__wyrand__WyRandRNG_u16(rand__wyrand__WyRandRNG* rng); +u32 rand__wyrand__WyRandRNG_u32(rand__wyrand__WyRandRNG* rng); +u64 rand__wyrand__WyRandRNG_u64(rand__wyrand__WyRandRNG* rng); +int rand__wyrand__WyRandRNG_block_size(rand__wyrand__WyRandRNG* rng); +void rand__wyrand__WyRandRNG_free(rand__wyrand__WyRandRNG* rng); Array_rune _const_rand__clock_seq_hi_and_reserved_valid_values; // inited later string rand__uuid_v4(void); VV_LOCAL_SYMBOL string rand__internal_uuid_v4(rand__PRNG* rng); @@ -8631,6 +9000,7 @@ Option_void v__ast__Stmt_check_c_expr(v__ast__Stmt stmt); v__token__Pos v__ast__Node_pos(v__ast__Node node); Array_v__ast__Node v__ast__Node_children(v__ast__Node node); void v__ast__IndexExpr_recursive_mapset_is_setter(v__ast__IndexExpr* lx, bool val); +void v__ast__IndexExpr_recursive_arraymap_set_is_setter(v__ast__IndexExpr* lx); Map_string_v__ast__ScopeObject v__ast__all_registers(v__ast__Table* t, v__pref__Arch arch); VV_LOCAL_SYMBOL Map_string_v__ast__ScopeObject v__ast__gen_all_registers(v__ast__Table* t, Array_string without_numbers, Map_string_int with_numbers, int bit_size); bool v__ast__Expr_is_literal(v__ast__Expr expr); @@ -8924,6 +9294,8 @@ bool v__ast__TypeSymbol_is_string(v__ast__TypeSymbol* t); bool v__ast__TypeSymbol_is_number(v__ast__TypeSymbol* t); bool v__ast__TypeSymbol_is_primitive(v__ast__TypeSymbol* t); bool v__ast__TypeSymbol_is_builtin(v__ast__TypeSymbol* t); +int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ); +VV_LOCAL_SYMBOL int v__ast__round_up(int n, int multiple); string v__ast__Kind_str(v__ast__Kind k); string Array_v__ast__Kind_str(Array_v__ast__Kind kinds); string v__ast__Table_type_to_str(v__ast__Table* t, v__ast__Type typ); @@ -8963,7 +9335,6 @@ Option_void v__checker__Checker_check_expected(v__checker__Checker* c, v__ast__T VV_LOCAL_SYMBOL string v__checker__Checker_expected_msg(v__checker__Checker* c, v__ast__Type got, v__ast__Type expected); bool v__checker__Checker_symmetric_check(v__checker__Checker* c, v__ast__Type left, v__ast__Type right); void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__Fn func, v__ast__CallExpr* node); -int v__checker__Checker_sizeof_integer(v__checker__Checker* c, v__ast__Type a); int _const_v__checker__int_min; // inited later int _const_v__checker__int_max = 2147483647; // precomputed #define _const_v__checker__expr_level_cutoff_limit 40 @@ -9913,24 +10284,24 @@ static IError I_Error_to_Interface_IError(Error* x); const int _IError_Error_index = 1; static IError I_MessageError_to_Interface_IError(MessageError* x); const int _IError_MessageError_index = 2; -static IError I_time__TimeParseError_to_Interface_IError(time__TimeParseError* x); -const int _IError_time__TimeParseError_index = 3; static IError I_flag__UnkownFlagError_to_Interface_IError(flag__UnkownFlagError* x); -const int _IError_flag__UnkownFlagError_index = 4; +const int _IError_flag__UnkownFlagError_index = 3; static IError I_flag__ArgsCountError_to_Interface_IError(flag__ArgsCountError* x); -const int _IError_flag__ArgsCountError_index = 5; +const int _IError_flag__ArgsCountError_index = 4; static IError I_semver__InvalidComparatorFormatError_to_Interface_IError(semver__InvalidComparatorFormatError* x); -const int _IError_semver__InvalidComparatorFormatError_index = 6; +const int _IError_semver__InvalidComparatorFormatError_index = 5; static IError I_semver__EmptyInputError_to_Interface_IError(semver__EmptyInputError* x); -const int _IError_semver__EmptyInputError_index = 7; +const int _IError_semver__EmptyInputError_index = 6; static IError I_semver__InvalidVersionFormatError_to_Interface_IError(semver__InvalidVersionFormatError* x); -const int _IError_semver__InvalidVersionFormatError_index = 8; +const int _IError_semver__InvalidVersionFormatError_index = 7; static IError I_os__FileNotOpenedError_to_Interface_IError(os__FileNotOpenedError* x); -const int _IError_os__FileNotOpenedError_index = 9; +const int _IError_os__FileNotOpenedError_index = 8; static IError I_os__SizeOfTypeIs0Error_to_Interface_IError(os__SizeOfTypeIs0Error* x); -const int _IError_os__SizeOfTypeIs0Error_index = 10; +const int _IError_os__SizeOfTypeIs0Error_index = 9; static IError I_os__ExecutableNotFoundError_to_Interface_IError(os__ExecutableNotFoundError* x); -const int _IError_os__ExecutableNotFoundError_index = 11; +const int _IError_os__ExecutableNotFoundError_index = 10; +static IError I_time__TimeParseError_to_Interface_IError(time__TimeParseError* x); +const int _IError_time__TimeParseError_index = 11; static IError I_v__gen__c__UnsupportedAssertCtempTransform_to_Interface_IError(v__gen__c__UnsupportedAssertCtempTransform* x); const int _IError_v__gen__c__UnsupportedAssertCtempTransform_index = 12; // ^^^ number of types for interface IError: 13 @@ -9954,12 +10325,6 @@ static inline string MessageError_msg_Interface_IError_method_wrapper(MessageErr static inline int MessageError_code_Interface_IError_method_wrapper(MessageError* err) { return MessageError_code(*err); } -static inline string time__TimeParseError_msg_Interface_IError_method_wrapper(time__TimeParseError* err) { - return time__TimeParseError_msg(*err); -} -static inline int time__TimeParseError_code_Interface_IError_method_wrapper(time__TimeParseError* err) { - return Error_code(err->Error); -} static inline string flag__UnkownFlagError_msg_Interface_IError_method_wrapper(flag__UnkownFlagError* err) { return flag__UnkownFlagError_msg(*err); } @@ -10008,6 +10373,12 @@ static inline string os__ExecutableNotFoundError_msg_Interface_IError_method_wra static inline int os__ExecutableNotFoundError_code_Interface_IError_method_wrapper(os__ExecutableNotFoundError* err) { return Error_code(err->Error); } +static inline string time__TimeParseError_msg_Interface_IError_method_wrapper(time__TimeParseError* err) { + return time__TimeParseError_msg(*err); +} +static inline int time__TimeParseError_code_Interface_IError_method_wrapper(time__TimeParseError* err) { + return Error_code(err->Error); +} static inline string v__gen__c__UnsupportedAssertCtempTransform_msg_Interface_IError_method_wrapper(v__gen__c__UnsupportedAssertCtempTransform* err) { return Error_msg(err->Error); } @@ -10033,10 +10404,6 @@ struct _IError_interface_methods IError_name_table[13] = { ._method_msg = (void*) MessageError_msg_Interface_IError_method_wrapper, ._method_code = (void*) MessageError_code_Interface_IError_method_wrapper, }, - { - ._method_msg = (void*) time__TimeParseError_msg_Interface_IError_method_wrapper, - ._method_code = (void*) time__TimeParseError_code_Interface_IError_method_wrapper, - }, { ._method_msg = (void*) flag__UnkownFlagError_msg_Interface_IError_method_wrapper, ._method_code = (void*) flag__UnkownFlagError_code_Interface_IError_method_wrapper, @@ -10069,6 +10436,10 @@ struct _IError_interface_methods IError_name_table[13] = { ._method_msg = (void*) os__ExecutableNotFoundError_msg_Interface_IError_method_wrapper, ._method_code = (void*) os__ExecutableNotFoundError_code_Interface_IError_method_wrapper, }, + { + ._method_msg = (void*) time__TimeParseError_msg_Interface_IError_method_wrapper, + ._method_code = (void*) time__TimeParseError_code_Interface_IError_method_wrapper, + }, { ._method_msg = (void*) v__gen__c__UnsupportedAssertCtempTransform_msg_Interface_IError_method_wrapper, ._method_code = (void*) v__gen__c__UnsupportedAssertCtempTransform_code_Interface_IError_method_wrapper, @@ -10106,16 +10477,6 @@ static inline IError I_MessageError_to_Interface_IError(MessageError* x) { }; } -// Casting functions for converting "time__TimeParseError" to interface "IError" -static inline IError I_time__TimeParseError_to_Interface_IError(time__TimeParseError* x) { - return (IError) { - ._time__TimeParseError = x, - ._typ = _IError_time__TimeParseError_index, - .msg = (string*)((char*)x), - .code = (int*)((char*)x + __offsetof_ptr(x, time__TimeParseError, code)), - }; -} - // Casting functions for converting "flag__UnkownFlagError" to interface "IError" static inline IError I_flag__UnkownFlagError_to_Interface_IError(flag__UnkownFlagError* x) { return (IError) { @@ -10196,6 +10557,16 @@ static inline IError I_os__ExecutableNotFoundError_to_Interface_IError(os__Execu }; } +// Casting functions for converting "time__TimeParseError" to interface "IError" +static inline IError I_time__TimeParseError_to_Interface_IError(time__TimeParseError* x) { + return (IError) { + ._time__TimeParseError = x, + ._typ = _IError_time__TimeParseError_index, + .msg = (string*)((char*)x), + .code = (int*)((char*)x + __offsetof_ptr(x, time__TimeParseError, code)), + }; +} + // Casting functions for converting "v__gen__c__UnsupportedAssertCtempTransform" to interface "IError" static inline IError I_v__gen__c__UnsupportedAssertCtempTransform_to_Interface_IError(v__gen__c__UnsupportedAssertCtempTransform* x) { return (IError) { @@ -10387,8 +10758,6 @@ void vinit_string_literals(void){ _const_si_s_code = _SLIT("0xfe10"); _const_si_g32_code = _SLIT("0xfe0e"); _const_si_g64_code = _SLIT("0xfe0f"); - _const_time__days_string = _SLIT("MonTueWedThuFriSatSun"); - _const_time__months_string = _SLIT("JanFebMarAprMayJunJulAugSepOctNovDec"); _const_flag__space = _SLIT(" "); _const_flag__underline = _SLIT("-----------------------------------------------"); _const_semver__comparator_sep = _SLIT(" "); @@ -10398,6 +10767,8 @@ void vinit_string_literals(void){ _const_os__path_separator = _SLIT("\\"); _const_os__path_delimiter = _SLIT(";"); _const_v__util__version__v_version = _SLIT("0.2.4"); + _const_time__days_string = _SLIT("MonTueWedThuFriSatSun"); + _const_time__months_string = _SLIT("JanFebMarAprMayJunJulAugSepOctNovDec"); _const_v__vmod__err_label = _SLIT("vmod:"); _const_v__cflag__fexisting_literal = _SLIT("$first_existing"); _const_v__pkgconfig__version = _SLIT("0.3.2"); @@ -10414,7 +10785,7 @@ void vinit_string_literals(void){ _const_v__gen__c__c_commit_hash_default = _SLIT("\n#ifndef V_COMMIT_HASH\n\011#define V_COMMIT_HASH \"@@@\"\n#endif\n"); _const_v__gen__c__c_current_commit_hash_default = _SLIT("\n#ifndef V_CURRENT_COMMIT_HASH\n\011#define V_CURRENT_COMMIT_HASH \"@@@\"\n#endif\n"); _const_v__gen__c__c_concurrency_helpers = _SLIT("\ntypedef struct __shared_map __shared_map;\nstruct __shared_map {\n\011sync__RwMutex mtx;\n\011map val;\n};\nstatic inline voidptr __dup_shared_map(voidptr src, int sz) {\n\011__shared_map* dest = memdup(src, sz);\n\011sync__RwMutex_init(&dest->mtx);\n\011return dest;\n}\ntypedef struct __shared_array __shared_array;\nstruct __shared_array {\n\011sync__RwMutex mtx;\n\011array val;\n};\nstatic inline voidptr __dup_shared_array(voidptr src, int sz) {\n\011__shared_array* dest = memdup(src, sz);\n\011sync__RwMutex_init(&dest->mtx);\n\011return dest;\n}\nstatic inline void __sort_ptr(uintptr_t a[], bool b[], int l) {\n\011for (int i=1; i0 && a[j-1] > ins) {\n\011\011\011a[j] = a[j-1];\n\011\011\011b[j] = b[j-1];\n\011\011\011j--;\n\011\011}\n\011\011a[j] = ins;\n\011\011b[j] = insb;\n\011}\n}\n"); - _const_v__gen__c__c_common_macros = _SLIT("\n#define EMPTY_VARG_INITIALIZATION 0\n#define EMPTY_STRUCT_INITIALIZATION 0\n#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n// Due to a tcc bug, the length of an array needs to be specified, but GCC crashes if it is...\n#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[])\n#define TCCSKIP(x) x\n\n#define __NOINLINE __attribute__((noinline))\n#define __IRQHANDLER __attribute__((interrupt))\n\n#define __V_architecture 0\n#if defined(__x86_64__)\n\011#define __V_amd64 1\n\011#undef __V_architecture\n\011#define __V_architecture 1\n#endif\n\n#if defined(__aarch64__) || defined(__arm64__)\n\011#define __V_arm64 1\n\011#undef __V_architecture\n\011#define __V_architecture 2\n#endif\n\n// Using just __GNUC__ for detecting gcc, is not reliable because other compilers define it too:\n#ifdef __GNUC__\n\011#define __V_GCC__\n#endif\n#ifdef __TINYC__\n\011#undef __V_GCC__\n#endif\n#ifdef __cplusplus\n\011#undef __V_GCC__\n#endif\n#ifdef __clang__\n\011#undef __V_GCC__\n#endif\n#ifdef _MSC_VER\n\011#undef __V_GCC__\n\011#undef EMPTY_STRUCT_INITIALIZATION\n\011#define EMPTY_STRUCT_INITIALIZATION 0\n#endif\n\n#ifdef __TINYC__\n\011#undef EMPTY_STRUCT_DECLARATION\n\011#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n\011#undef EMPTY_ARRAY_OF_ELEMS\n\011#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[n])\n\011#undef __NOINLINE\n\011#undef __IRQHANDLER\n\011// tcc does not support inlining at all\n\011#define __NOINLINE\n\011#define __IRQHANDLER\n\011#undef TCCSKIP\n\011#define TCCSKIP(x)\n\011// #include \n\011#ifndef _WIN32\n\011\011#include \n\011\011int tcc_backtrace(const char *fmt, ...);\n\011#endif\n#endif\n\n// Use __offsetof_ptr instead of __offset_of, when you *do* have a valid pointer, to avoid UB:\n#ifndef __offsetof_ptr\n\011#define __offsetof_ptr(ptr,PTYPE,FIELDNAME) ((size_t)((byte *)&((PTYPE *)ptr)->FIELDNAME - (byte *)ptr))\n#endif\n\n// for __offset_of\n#ifndef __offsetof\n\011#define __offsetof(PTYPE,FIELDNAME) ((size_t)((char *)&((PTYPE *)0)->FIELDNAME - (char *)0))\n#endif\n\n// returns the number of CPU registers that TYPE takes up\n#define _REG_WIDTH(T) (((sizeof(T) + sizeof(void*) - 1) & ~(sizeof(void*) - 1)) / sizeof(void*))\n// parameters of size <= 2 registers are spilled across those two registers; larger types are passed as one pointer to some stack location\n#define _REG_WIDTH_BOUNDED(T) (_REG_WIDTH(T) <= 2 ? _REG_WIDTH(T) : 1)\n\n#define OPTION_CAST(x) (x)\n\n#ifndef V64_PRINTFORMAT\n\011#ifdef PRIx64\n\011\011#define V64_PRINTFORMAT \"0x%\"PRIx64\n\011#elif defined(__WIN32__)\n\011\011#define V64_PRINTFORMAT \"0x%I64x\"\n\011#elif defined(__linux__) && defined(__LP64__)\n\011\011#define V64_PRINTFORMAT \"0x%lx\"\n\011#else\n\011\011#define V64_PRINTFORMAT \"0x%llx\"\n\011#endif\n#endif\n\n#if defined(_WIN32) || defined(__CYGWIN__)\n\011#define VV_EXPORTED_SYMBOL extern __declspec(dllexport)\n\011#define VV_LOCAL_SYMBOL static\n#else\n\011// 4 < gcc < 5 is used by some older Ubuntu LTS and Centos versions,\n\011// and does not support __has_attribute(visibility) ...\n\011#ifndef __has_attribute\n\011\011#define __has_attribute(x) 0 // Compatibility with non-clang compilers.\n\011#endif\n\011#if (defined(__GNUC__) && (__GNUC__ >= 4)) || (defined(__clang__) && __has_attribute(visibility))\n\011\011#ifdef ARM\n\011\011\011#define VV_EXPORTED_SYMBOL extern __attribute__((externally_visible,visibility(\"default\")))\n\011\011#else\n\011\011\011#define VV_EXPORTED_SYMBOL extern __attribute__((visibility(\"default\")))\n\011\011#endif\n\011\011#if defined(__clang__) && (defined(_VUSECACHE) || defined(_VBUILDMODULE))\n\011\011\011#define VV_LOCAL_SYMBOL static\n\011\011#else\n\011\011\011#define VV_LOCAL_SYMBOL __attribute__ ((visibility (\"hidden\")))\n\011\011#endif\n\011#else\n\011\011#define VV_EXPORTED_SYMBOL extern\n\011\011#define VV_LOCAL_SYMBOL static\n\011#endif\n#endif\n\n#ifdef __cplusplus\n\011#include \n\011#define _MOV std::move\n#else\n\011#define _MOV\n#endif\n\n// tcc does not support has_include properly yet, turn it off completely\n#if defined(__TINYC__) && defined(__has_include)\n#undef __has_include\n#endif\n\n\n#if !defined(VWEAK)\n\011#define VWEAK __attribute__((weak))\n\011#ifdef _MSC_VER\n\011\011#undef VWEAK\n\011\011#define VWEAK\n\011#endif\n#endif\n\n#if !defined(VNORETURN)\n\011#if defined(__TINYC__)\n\011\011#include \n\011\011#define VNORETURN noreturn\n\011#endif\n\011# if !defined(__TINYC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L\n\011# define VNORETURN _Noreturn\n\011# elif defined(__GNUC__) && __GNUC__ >= 2\n\011# define VNORETURN __attribute__((noreturn))\n\011# endif\n\011#ifndef VNORETURN\n\011\011#define VNORETURN\n\011#endif\n#endif\n\n#if !defined(VUNREACHABLE)\n\011#if defined(__GNUC__) && !defined(__clang__)\n\011\011#define V_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__)\n\011\011#if (V_GCC_VERSION >= 40500L)\n\011\011\011#define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n\011\011#endif\n\011#endif\n\011#if defined(__clang__) && defined(__has_builtin)\n\011\011#if __has_builtin(__builtin_unreachable)\n\011\011\011#define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n\011\011#endif\n\011#endif\n\011#ifndef VUNREACHABLE\n\011\011#define VUNREACHABLE() do { } while (0)\n\011#endif\n\011#if defined(__FreeBSD__) && defined(__TINYC__)\n\011\011#define VUNREACHABLE() do { } while (0)\n\011#endif\n#endif\n\n//likely and unlikely macros\n#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n\011#define _likely_(x) __builtin_expect(x,1)\n\011#define _unlikely_(x) __builtin_expect(x,0)\n#else\n\011#define _likely_(x) (x)\n\011#define _unlikely_(x) (x)\n#endif\n\n"); + _const_v__gen__c__c_common_macros = _SLIT("\n#define EMPTY_VARG_INITIALIZATION 0\n#define EMPTY_STRUCT_INITIALIZATION 0\n#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n// Due to a tcc bug, the length of an array needs to be specified, but GCC crashes if it is...\n#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[])\n#define TCCSKIP(x) x\n\n#define __NOINLINE __attribute__((noinline))\n#define __IRQHANDLER __attribute__((interrupt))\n\n#define __V_architecture 0\n#if defined(__x86_64__)\n\011#define __V_amd64 1\n\011#undef __V_architecture\n\011#define __V_architecture 1\n#endif\n\n#if defined(__aarch64__) || defined(__arm64__)\n\011#define __V_arm64 1\n\011#undef __V_architecture\n\011#define __V_architecture 2\n#endif\n\n// Using just __GNUC__ for detecting gcc, is not reliable because other compilers define it too:\n#ifdef __GNUC__\n\011#define __V_GCC__\n#endif\n#ifdef __TINYC__\n\011#undef __V_GCC__\n#endif\n#ifdef __cplusplus\n\011#undef __V_GCC__\n#endif\n#ifdef __clang__\n\011#undef __V_GCC__\n#endif\n#ifdef _MSC_VER\n\011#undef __V_GCC__\n\011#undef EMPTY_STRUCT_INITIALIZATION\n\011#define EMPTY_STRUCT_INITIALIZATION 0\n#endif\n\n#ifdef __TINYC__\n\011#define _Atomic volatile\n\011#undef EMPTY_STRUCT_DECLARATION\n\011#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n\011#undef EMPTY_ARRAY_OF_ELEMS\n\011#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[n])\n\011#undef __NOINLINE\n\011#undef __IRQHANDLER\n\011// tcc does not support inlining at all\n\011#define __NOINLINE\n\011#define __IRQHANDLER\n\011#undef TCCSKIP\n\011#define TCCSKIP(x)\n\011// #include \n\011#ifndef _WIN32\n\011\011#include \n\011\011int tcc_backtrace(const char *fmt, ...);\n\011#endif\n#endif\n\n// Use __offsetof_ptr instead of __offset_of, when you *do* have a valid pointer, to avoid UB:\n#ifndef __offsetof_ptr\n\011#define __offsetof_ptr(ptr,PTYPE,FIELDNAME) ((size_t)((byte *)&((PTYPE *)ptr)->FIELDNAME - (byte *)ptr))\n#endif\n\n// for __offset_of\n#ifndef __offsetof\n\011#define __offsetof(PTYPE,FIELDNAME) ((size_t)((char *)&((PTYPE *)0)->FIELDNAME - (char *)0))\n#endif\n\n// returns the number of CPU registers that TYPE takes up\n#define _REG_WIDTH(T) (((sizeof(T) + sizeof(void*) - 1) & ~(sizeof(void*) - 1)) / sizeof(void*))\n// parameters of size <= 2 registers are spilled across those two registers; larger types are passed as one pointer to some stack location\n#define _REG_WIDTH_BOUNDED(T) (_REG_WIDTH(T) <= 2 ? _REG_WIDTH(T) : 1)\n\n#define OPTION_CAST(x) (x)\n\n#ifndef V64_PRINTFORMAT\n\011#ifdef PRIx64\n\011\011#define V64_PRINTFORMAT \"0x%\"PRIx64\n\011#elif defined(__WIN32__)\n\011\011#define V64_PRINTFORMAT \"0x%I64x\"\n\011#elif defined(__linux__) && defined(__LP64__)\n\011\011#define V64_PRINTFORMAT \"0x%lx\"\n\011#else\n\011\011#define V64_PRINTFORMAT \"0x%llx\"\n\011#endif\n#endif\n\n#if defined(_WIN32) || defined(__CYGWIN__)\n\011#define VV_EXPORTED_SYMBOL extern __declspec(dllexport)\n\011#define VV_LOCAL_SYMBOL static\n#else\n\011// 4 < gcc < 5 is used by some older Ubuntu LTS and Centos versions,\n\011// and does not support __has_attribute(visibility) ...\n\011#ifndef __has_attribute\n\011\011#define __has_attribute(x) 0 // Compatibility with non-clang compilers.\n\011#endif\n\011#if (defined(__GNUC__) && (__GNUC__ >= 4)) || (defined(__clang__) && __has_attribute(visibility))\n\011\011#ifdef ARM\n\011\011\011#define VV_EXPORTED_SYMBOL extern __attribute__((externally_visible,visibility(\"default\")))\n\011\011#else\n\011\011\011#define VV_EXPORTED_SYMBOL extern __attribute__((visibility(\"default\")))\n\011\011#endif\n\011\011#if defined(__clang__) && (defined(_VUSECACHE) || defined(_VBUILDMODULE))\n\011\011\011#define VV_LOCAL_SYMBOL static\n\011\011#else\n\011\011\011#define VV_LOCAL_SYMBOL __attribute__ ((visibility (\"hidden\")))\n\011\011#endif\n\011#else\n\011\011#define VV_EXPORTED_SYMBOL extern\n\011\011#define VV_LOCAL_SYMBOL static\n\011#endif\n#endif\n\n#ifdef __cplusplus\n\011#include \n\011#define _MOV std::move\n#else\n\011#define _MOV\n#endif\n\n// tcc does not support has_include properly yet, turn it off completely\n#if defined(__TINYC__) && defined(__has_include)\n#undef __has_include\n#endif\n\n\n#if !defined(VWEAK)\n\011#define VWEAK __attribute__((weak))\n\011#ifdef _MSC_VER\n\011\011#undef VWEAK\n\011\011#define VWEAK\n\011#endif\n#endif\n\n#if !defined(VNORETURN)\n\011#if defined(__TINYC__)\n\011\011#include \n\011\011#define VNORETURN noreturn\n\011#endif\n\011# if !defined(__TINYC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L\n\011# define VNORETURN _Noreturn\n\011# elif defined(__GNUC__) && __GNUC__ >= 2\n\011# define VNORETURN __attribute__((noreturn))\n\011# endif\n\011#ifndef VNORETURN\n\011\011#define VNORETURN\n\011#endif\n#endif\n\n#if !defined(VUNREACHABLE)\n\011#if defined(__GNUC__) && !defined(__clang__)\n\011\011#define V_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__)\n\011\011#if (V_GCC_VERSION >= 40500L)\n\011\011\011#define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n\011\011#endif\n\011#endif\n\011#if defined(__clang__) && defined(__has_builtin)\n\011\011#if __has_builtin(__builtin_unreachable)\n\011\011\011#define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n\011\011#endif\n\011#endif\n\011#ifndef VUNREACHABLE\n\011\011#define VUNREACHABLE() do { } while (0)\n\011#endif\n\011#if defined(__FreeBSD__) && defined(__TINYC__)\n\011\011#define VUNREACHABLE() do { } while (0)\n\011#endif\n#endif\n\n//likely and unlikely macros\n#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n\011#define _likely_(x) __builtin_expect(x,1)\n\011#define _unlikely_(x) __builtin_expect(x,0)\n#else\n\011#define _likely_(x) (x)\n\011#define _unlikely_(x) (x)\n#endif\n\n"); _const_v__gen__c__c_unsigned_comparison_functions = _SLIT("\n// unsigned/signed comparisons\nstatic inline bool _us32_gt(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a > b; }\nstatic inline bool _us32_ge(uint32_t a, int32_t b) { return a >= INT32_MAX || (int32_t)a >= b; }\nstatic inline bool _us32_eq(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a == b; }\nstatic inline bool _us32_ne(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a != b; }\nstatic inline bool _us32_le(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a <= b; }\nstatic inline bool _us32_lt(uint32_t a, int32_t b) { return a < INT32_MAX && (int32_t)a < b; }\nstatic inline bool _us64_gt(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a > b; }\nstatic inline bool _us64_ge(uint64_t a, int64_t b) { return a >= INT64_MAX || (int64_t)a >= b; }\nstatic inline bool _us64_eq(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a == b; }\nstatic inline bool _us64_ne(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a != b; }\nstatic inline bool _us64_le(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a <= b; }\nstatic inline bool _us64_lt(uint64_t a, int64_t b) { return a < INT64_MAX && (int64_t)a < b; }\n"); _const_v__gen__c__c_helper_macros = _SLIT("//============================== HELPER C MACROS =============================*/\n// _SLIT0 is used as NULL string for literal arguments\n// `\"\" s` is used to enforce a string literal argument\n#define _SLIT0 (string){.str=(byteptr)(\"\"), .len=0, .is_lit=1}\n#define _SLIT(s) ((string){.str=(byteptr)(\"\" s), .len=(sizeof(s)-1), .is_lit=1})\n#define _SLEN(s, n) ((string){.str=(byteptr)(\"\" s), .len=n, .is_lit=1})\n\n// take the address of an rvalue\n#define ADDR(type, expr) (&((type[]){expr}[0]))\n\n// copy something to the heap\n#define HEAP(type, expr) ((type*)memdup((void*)&((type[]){expr}[0]), sizeof(type)))\n#define HEAP_noscan(type, expr) ((type*)memdup_noscan((void*)&((type[]){expr}[0]), sizeof(type)))\n\n#define _PUSH_MANY(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many(arr, tmp.data, tmp.len);}\n#define _PUSH_MANY_noscan(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many_noscan(arr, tmp.data, tmp.len);}\n"); _const_v__gen__c__c_builtin_types = _SLIT("\n//================================== builtin types ================================*/\ntypedef int64_t i64;\ntypedef int16_t i16;\ntypedef int8_t i8;\ntypedef uint64_t u64;\ntypedef uint32_t u32;\ntypedef uint8_t u8;\ntypedef uint16_t u16;\n//typedef uint8_t byte;\ntypedef uint32_t rune;\ntypedef size_t usize;\ntypedef ptrdiff_t isize;\n#ifndef VNOFLOAT\ntypedef float f32;\ntypedef double f64;\n#else\ntypedef int32_t f32;\ntypedef int64_t f64;\n#endif\ntypedef int64_t int_literal;\n#ifndef VNOFLOAT\ntypedef double float_literal;\n#else\ntypedef int64_t float_literal;\n#endif\ntypedef unsigned char* byteptr;\ntypedef void* voidptr;\ntypedef char* charptr;\ntypedef u8 array_fixed_byte_300 [300];\n\ntypedef struct sync__Channel* chan;\n\n#ifndef __cplusplus\n\011#ifndef bool\n\011\011#ifdef CUSTOM_DEFINE_4bytebool\n\011\011\011typedef int bool;\n\011\011#else\n\011\011\011typedef u8 bool;\n\011\011#endif\n\011\011#define true 1\n\011\011#define false 0\n\011#endif\n#endif\n\ntypedef u64 (*MapHashFn)(voidptr);\ntypedef bool (*MapEqFn)(voidptr, voidptr);\ntypedef void (*MapCloneFn)(voidptr, voidptr);\ntypedef void (*MapFreeFn)(voidptr);\n"); @@ -12283,7 +12654,6 @@ static char * v_typeof_interface_IError(int sidx) { /* IError */ if (sidx == _IError_None___index) return "None__"; if (sidx == _IError_Error_index) return "Error"; if (sidx == _IError_MessageError_index) return "MessageError"; - if (sidx == _IError_time__TimeParseError_index) return "time.TimeParseError"; if (sidx == _IError_flag__UnkownFlagError_index) return "flag.UnkownFlagError"; if (sidx == _IError_flag__ArgsCountError_index) return "flag.ArgsCountError"; if (sidx == _IError_semver__InvalidComparatorFormatError_index) return "semver.InvalidComparatorFormatError"; @@ -12292,6 +12662,7 @@ static char * v_typeof_interface_IError(int sidx) { /* IError */ if (sidx == _IError_os__FileNotOpenedError_index) return "os.FileNotOpenedError"; if (sidx == _IError_os__SizeOfTypeIs0Error_index) return "os.SizeOfTypeIs0Error"; if (sidx == _IError_os__ExecutableNotFoundError_index) return "os.ExecutableNotFoundError"; + if (sidx == _IError_time__TimeParseError_index) return "time.TimeParseError"; if (sidx == _IError_v__gen__c__UnsupportedAssertCtempTransform_index) return "v.gen.c.UnsupportedAssertCtempTransform"; return "unknown IError"; } @@ -12300,15 +12671,15 @@ static int v_typeof_interface_idx_IError(int sidx) { /* IError */ if (sidx == _IError_None___index) return 65620; if (sidx == _IError_Error_index) return 85; if (sidx == _IError_MessageError_index) return 86; - if (sidx == _IError_time__TimeParseError_index) return 255; - if (sidx == _IError_flag__UnkownFlagError_index) return 66128; - if (sidx == _IError_flag__ArgsCountError_index) return 66129; - if (sidx == _IError_semver__InvalidComparatorFormatError_index) return 66140; - if (sidx == _IError_semver__EmptyInputError_index) return 66142; - if (sidx == _IError_semver__InvalidVersionFormatError_index) return 66143; + if (sidx == _IError_flag__UnkownFlagError_index) return 66133; + if (sidx == _IError_flag__ArgsCountError_index) return 66134; + if (sidx == _IError_semver__InvalidComparatorFormatError_index) return 66144; + if (sidx == _IError_semver__EmptyInputError_index) return 66146; + if (sidx == _IError_semver__InvalidVersionFormatError_index) return 66147; if (sidx == _IError_os__FileNotOpenedError_index) return 65657; if (sidx == _IError_os__SizeOfTypeIs0Error_index) return 65658; if (sidx == _IError_os__ExecutableNotFoundError_index) return 65672; + if (sidx == _IError_time__TimeParseError_index) return 255; if (sidx == _IError_v__gen__c__UnsupportedAssertCtempTransform_index) return 537; return 29; } @@ -12744,9 +13115,9 @@ static char * v_typeof_interface_v__ast__walker__Visitor(int sidx) { /* v.ast.wa } static int v_typeof_interface_idx_v__ast__walker__Visitor(int sidx) { /* v.ast.walker.Visitor */ - if (sidx == _v__ast__walker__Visitor_v__ast__walker__Inspector_index) return 567; + if (sidx == _v__ast__walker__Visitor_v__ast__walker__Inspector_index) return 572; if (sidx == _v__ast__walker__Visitor_v__callgraph__Mapper_index) return 66061; - return 565; + return 570; } // << typeof() support for sum types @@ -17647,7 +18018,7 @@ VV_LOCAL_SYMBOL void add_vectored_exception_handler(int (*handler)(ExceptionPoin // Attr: [callconv] VV_LOCAL_SYMBOL int __stdcall unhandled_exception_handler(ExceptionPointers* e) { - if (e->exception_record->code == (0x4001000A) || e->exception_record->code == (0x40010006)) { + if (e->exception_record->code == (0x4001000A) || e->exception_record->code == (0x40010006) || e->exception_record->code == (0xE06D7363)) { return 0; } else { @@ -19749,6 +20120,17 @@ string char_vstring_literal_with_len(char* cp, int len) { return ((string){.str = ((u8*)(cp)), .len = len, .is_lit = 1}); } +int string_len_utf8(string s) { + int l = 0; + int i = 0; + for (;;) { + if (!(i < s.len)) break; + l++; + i += (((0xe5000000 >> (((s.str[i] >> 3) & 0x1e))) & 3)) + 1; + } + return l; +} + VV_LOCAL_SYMBOL string string_clone_static(string a) { return string_clone(a); } @@ -22151,6 +22533,19 @@ int utf32_decode_to_buffer(u32 code, u8* buf) { return 0; } +// Attr: [deprecated] +// Attr: [deprecated_after] +int utf8_str_len(string s) { + int l = 0; + int i = 0; + for (;;) { + if (!(i < s.len)) break; + l++; + i += (((0xe5000000 >> (((s.str[i] >> 3) & 0x1e))) & 3)) + 1; + } + return l; +} + int string_utf32_code(string _rune) { Option_rune _t2 = Array_u8_utf8_to_utf32(string_bytes(_rune)); if (_t2.state != 0) { /*or block*/ @@ -22209,17 +22604,6 @@ VV_LOCAL_SYMBOL int utf8_len(u8 c) { return b; } -int utf8_str_len(string s) { - int l = 0; - int i = 0; - for (;;) { - if (!(i < s.len)) break; - l++; - i += (((0xe5000000 >> (((s.str[i] >> 3) & 0x1e))) & 3)) + 1; - } - return l; -} - int utf8_str_visible_length(string s) { int l = 0; int ul = 1; @@ -23929,1293 +24313,6 @@ inline int v__mathutil__max_T_int(int a, int b) { return _t1; } -i64 time__portable_timegm(struct tm* t) { - int year = t->tm_year + 1900; - int month = t->tm_mon; - if (month > 11) { - year += month / 12; - month %= 12; - } else if (month < 0) { - int years_diff = (11 - month) / 12; - year -= years_diff; - month += 12 * years_diff; - } - i64 days_since_1970 = ((i64)(time__days_from_civil(year, month + 1, t->tm_mday))); - i64 _t1 = 60 * (60 * (24 * days_since_1970 + t->tm_hour) + t->tm_min) + t->tm_sec; - return _t1; -} - -int time__days_from_civil(int oy, int m, int d) { - int y = (m <= 2 ? (oy - 1) : (oy)); - int era = y / 400; - int yoe = y - era * 400; - int doy = (153 * (m + ((m > 2 ? (-3) : (9)))) + 2) / 5 + d - 1; - int doe = yoe * 365 + yoe / 4 - yoe / 100 + doy; - int _t1 = era * 146097 + doe - 719468; - return _t1; -} - -string time__Time_format(time__Time t) { - string _t1 = time__Time_get_fmt_str(t, time__FormatDelimiter__hyphen, time__FormatTime__hhmm24, time__FormatDate__yyyymmdd); - return _t1; -} - -string time__Time_format_ss(time__Time t) { - string _t1 = time__Time_get_fmt_str(t, time__FormatDelimiter__hyphen, time__FormatTime__hhmmss24, time__FormatDate__yyyymmdd); - return _t1; -} - -string time__Time_format_ss_milli(time__Time t) { - string _t1 = time__Time_get_fmt_str(t, time__FormatDelimiter__hyphen, time__FormatTime__hhmmss24_milli, time__FormatDate__yyyymmdd); - return _t1; -} - -string time__Time_format_ss_micro(time__Time t) { - string _t1 = time__Time_get_fmt_str(t, time__FormatDelimiter__hyphen, time__FormatTime__hhmmss24_micro, time__FormatDate__yyyymmdd); - return _t1; -} - -string time__Time_hhmm(time__Time t) { - string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm24); - return _t1; -} - -string time__Time_hhmmss(time__Time t) { - string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmmss24); - return _t1; -} - -string time__Time_hhmm12(time__Time t) { - string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm12); - return _t1; -} - -string time__Time_ymmdd(time__Time t) { - string _t1 = time__Time_get_fmt_date_str(t, time__FormatDelimiter__hyphen, time__FormatDate__yyyymmdd); - return _t1; -} - -string time__Time_ddmmy(time__Time t) { - string _t1 = time__Time_get_fmt_date_str(t, time__FormatDelimiter__dot, time__FormatDate__ddmmyyyy); - return _t1; -} - -string time__Time_md(time__Time t) { - string _t1 = time__Time_get_fmt_date_str(t, time__FormatDelimiter__space, time__FormatDate__mmmd); - return _t1; -} - -string time__Time_clean(time__Time t) { - time__Time znow = time__now(); - if (t.month == znow.month && t.year == znow.year && t.day == znow.day) { - string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm24); - return _t1; - } - if (t.year == znow.year) { - string _t2 = time__Time_get_fmt_str(t, time__FormatDelimiter__space, time__FormatTime__hhmm24, time__FormatDate__mmmd); - return _t2; - } - string _t3 = time__Time_format(t); - return _t3; -} - -string time__Time_clean12(time__Time t) { - time__Time znow = time__now(); - if (t.month == znow.month && t.year == znow.year && t.day == znow.day) { - string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm12); - return _t1; - } - if (t.year == znow.year) { - string _t2 = time__Time_get_fmt_str(t, time__FormatDelimiter__space, time__FormatTime__hhmm12, time__FormatDate__mmmd); - return _t2; - } - string _t3 = time__Time_format(t); - return _t3; -} - -string time__Time_get_fmt_time_str(time__Time t, time__FormatTime fmt_time) { - if (fmt_time == time__FormatTime__no_time) { - string _t1 = _SLIT(""); - return _t1; - } - string tp = (t.hour > 11 ? (_SLIT("p.m.")) : (_SLIT("a.m."))); - int hour_ = (t.hour > 12 ? (t.hour - 12) : t.hour == 0 ? (12) : (t.hour)); - string _t3 = (string){.str=(byteptr)"", .is_lit=1}; - switch (fmt_time) { - case time__FormatTime__hhmm12: - { - _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe07, {.d_i32 = hour_}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(" "), 0xfe10, {.d_s = tp}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatTime__hhmm24: - { - _t3 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatTime__hhmmss12: - { - _t3 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, 0xfe07, {.d_i32 = hour_}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.second}}, {_SLIT(" "), 0xfe10, {.d_s = tp}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatTime__hhmmss24: - { - _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.second}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatTime__hhmmss24_milli: - { - _t3 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.second}}, {_SLIT("."), 0x8006fe27, {.d_i32 = (t.microsecond / 1000)}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatTime__hhmmss24_micro: - { - _t3 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.second}}, {_SLIT("."), 0x800cfe27, {.d_i32 = t.microsecond}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatTime__no_time: - default: - { - _t3 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown enumeration "), 0xfe10, {.d_s = time__FormatTime_str(fmt_time)}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - } - string _t2 = _t3; - return _t2; -} - -string time__Time_get_fmt_date_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatDate fmt_date) { - if (fmt_date == time__FormatDate__no_date) { - string _t1 = _SLIT(""); - return _t1; - } - string month = time__Time_smonth(&t); - string year = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = (t.year % 100)}}, {_SLIT0, 0, { .d_c = 0 }}})); - string _t2 = (string){.str=(byteptr)"", .is_lit=1}; - switch (fmt_date) { - case time__FormatDate__ddmmyy: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), 0xfe10, {.d_s = year}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__ddmmyyyy: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), 0x8008fe27, {.d_i32 = t.year}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__mmddyy: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), 0xfe10, {.d_s = year}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__mmddyyyy: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), 0x8008fe27, {.d_i32 = t.year}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__mmmd: - { - _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = month}}, {_SLIT("|"), 0xfe07, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__mmmdd: - { - _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__mmmddyy: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), 0xfe10, {.d_s = year}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__mmmddyyyy: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), 0x8008fe27, {.d_i32 = t.year}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__yyyymmdd: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0x8008fe27, {.d_i32 = t.year}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__yymmdd: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = year}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__no_date: - default: - { - _t2 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown enumeration "), 0xfe10, {.d_s = time__FormatDate_str(fmt_date)}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - } - string res = _t2; - string del = ((fmt_dlmtr == (time__FormatDelimiter__dot)) ? (_SLIT(".")) : (fmt_dlmtr == (time__FormatDelimiter__hyphen)) ? (_SLIT("-")) : (fmt_dlmtr == (time__FormatDelimiter__slash)) ? (_SLIT("/")) : (fmt_dlmtr == (time__FormatDelimiter__space)) ? (_SLIT(" ")) : (_SLIT(""))); - res = string_replace(res, _SLIT("|"), del); - string _t3 = res; - return _t3; -} - -string time__Time_get_fmt_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatTime fmt_time, time__FormatDate fmt_date) { - if (fmt_date == time__FormatDate__no_date) { - if (fmt_time == time__FormatTime__no_time) { - string _t1 = _SLIT(""); - return _t1; - } else { - string _t2 = time__Time_get_fmt_time_str(t, fmt_time); - return _t2; - } - } else { - if (fmt_time != time__FormatTime__no_time) { - string dstr = time__Time_get_fmt_date_str(t, fmt_dlmtr, fmt_date); - string tstr = time__Time_get_fmt_time_str(t, fmt_time); - string _t3 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = dstr}}, {_SLIT(" "), 0xfe10, {.d_s = tstr}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t3; - } else { - string _t4 = time__Time_get_fmt_date_str(t, fmt_dlmtr, fmt_date); - return _t4; - } - } - return (string){.str=(byteptr)"", .is_lit=1}; -} - -string time__Time_utc_string(time__Time t) { - string day_str = time__Time_weekday_str(&t); - string month_str = time__Time_smonth(&t); - string utc_string = str_intp(8, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = day_str}}, {_SLIT(", "), 0xfe07, {.d_i32 = t.day}}, {_SLIT(" "), 0xfe10, {.d_s = month_str}}, {_SLIT(" "), 0xfe07, {.d_i32 = t.year}}, {_SLIT(" "), 0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.second}}, {_SLIT(" UTC"), 0, { .d_c = 0 }}})); - string _t1 = utc_string; - return _t1; -} - -// Attr: [inline] -inline bool time__Time__eq(time__Time t1, time__Time t2) { - bool _t1 = t1._v_unix == t2._v_unix && t1.microsecond == t2.microsecond; - return _t1; -} - -// Attr: [inline] -inline bool time__Time__lt(time__Time t1, time__Time t2) { - bool _t1 = t1._v_unix < t2._v_unix || (t1._v_unix == t2._v_unix && t1.microsecond < t2.microsecond); - return _t1; -} - -// Attr: [inline] -inline time__Duration time__Time__minus(time__Time lhs, time__Time rhs) { - i64 lhs_micro = lhs._v_unix * 1000000 + lhs.microsecond; - i64 rhs_micro = rhs._v_unix * 1000000 + rhs.microsecond; - time__Duration _t1 = (lhs_micro - rhs_micro) * _const_time__microsecond; - return _t1; -} - -Option_time__Time time__parse_rfc3339(string s) { - if ((s).len == 0) { - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - string sn = string_replace_each(s, new_array_from_c_array(4, 4, sizeof(string), _MOV((string[4]){_SLIT("t"), _SLIT("T"), _SLIT("z"), _SLIT("Z")}))); - Option_time__Time _t2 = time__parse_iso8601(sn); - if (_t2.state != 0) { /*or block*/ - IError err = _t2.err; - *(time__Time*) _t2.data = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - } - - time__Time t = (*(time__Time*)_t2.data); - if (!time__Time__eq(t, ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}))) { - Option_time__Time _t3; - opt_ok(&(time__Time[]) { t }, (Option*)(&_t3), sizeof(time__Time)); - return _t3; - } - Option_int _t4 = string_index(sn, _SLIT("T")); - if (_t4.state != 0) { /*or block*/ - IError err = _t4.err; - *(int*) _t4.data = -1; - } - - int t_i = (*(int*)_t4.data); - Array_string parts = (t_i != -1 ? (new_array_from_c_array(2, 2, sizeof(string), _MOV((string[2]){string_clone(string_substr(sn, 0, t_i)), string_clone(string_substr(sn, t_i + 1, (sn).len))}))) : (string_split(sn, _SLIT(" ")))); - if (!string_contains_any((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT(" Z")) && string_contains((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT("-"))) { - Option_multi_return_int_int_int _t5 = time__parse_iso8601_date(sn); - if (_t5.state != 0) { /*or block*/ - Option_time__Time _t6; - memcpy(&_t6, &_t5, sizeof(Option)); - return _t6; - } - - multi_return_int_int_int mr_1001 = (*(multi_return_int_int_int*)_t5.data); - int year = mr_1001.arg0; - int month = mr_1001.arg1; - int day = mr_1001.arg2; - t = time__new_time(((time__Time){.year = year,.month = month,.day = day,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,})); - Option_time__Time _t7; - opt_ok(&(time__Time[]) { t }, (Option*)(&_t7), sizeof(time__Time)); - return _t7; - } - if (!string_contains((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT("-")) && string_contains((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT(":"))) { - int hour_ = 0; - int minute_ = 0; - int second_ = 0; - int microsecond_ = 0; - i64 unix_offset = ((i64)(0)); - bool is_local_time = true; - Option_multi_return_int_int_int_int_i64_bool _t8 = time__parse_iso8601_time((*(string*)/*ee elem_sym */array_get(parts, 0))); - if (_t8.state != 0) { /*or block*/ - Option_time__Time _t9; - memcpy(&_t9, &_t8, sizeof(Option)); - return _t9; - } - - multi_return_int_int_int_int_i64_bool mr_1384 = (*(multi_return_int_int_int_int_i64_bool*)_t8.data); - hour_ = mr_1384.arg0; - minute_ = mr_1384.arg1; - second_ = mr_1384.arg2; - microsecond_ = mr_1384.arg3; - unix_offset = mr_1384.arg4; - is_local_time = mr_1384.arg5; - t = time__new_time(((time__Time){.year = 0,.month = 0,.day = 0,.hour = hour_,.minute = minute_,.second = second_,.microsecond = microsecond_,._v_unix = 0,.is_local = 0,})); - if (is_local_time) { - Option_time__Time _t10; - opt_ok(&(time__Time[]) { t }, (Option*)(&_t10), sizeof(time__Time)); - return _t10; - } - i64 unix_time = t._v_unix; - if (unix_offset < 0) { - unix_time -= (-unix_offset); - } else if (unix_offset > 0) { - unix_time += unix_offset; - } - t = time__unix2(((i64)(unix_time)), t.microsecond); - Option_time__Time _t11; - opt_ok(&(time__Time[]) { t }, (Option*)(&_t11), sizeof(time__Time)); - return _t11; - } - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(9), .data={EMPTY_STRUCT_INITIALIZATION} }; -} - -Option_time__Time time__parse(string s) { - if ((s).len == 0) { - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - Option_int _t2 = string_index(s, _SLIT(" ")); - if (_t2.state != 0) { /*or block*/ - IError err = _t2.err; - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(1), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - - int pos = (*(int*)_t2.data); - string symd = string_substr(s, 0, pos); - Array_string ymd = string_split(symd, _SLIT("-")); - if (ymd.len != 3) { - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(2), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - string shms = string_substr(s, pos, (s).len); - Array_string hms = string_split(shms, _SLIT(":")); - string hour_ = string_substr((*(string*)/*ee elem_sym */array_get(hms, 0)), 1, ((*(string*)/*ee elem_sym */array_get(hms, 0))).len); - string minute_ = (*(string*)/*ee elem_sym */array_get(hms, 1)); - string second_ = (*(string*)/*ee elem_sym */array_get(hms, 2)); - int iyear = string_int((*(string*)/*ee elem_sym */array_get(ymd, 0))); - int imonth = string_int((*(string*)/*ee elem_sym */array_get(ymd, 1))); - int iday = string_int((*(string*)/*ee elem_sym */array_get(ymd, 2))); - int ihour = string_int(hour_); - int iminute = string_int(minute_); - int isecond = string_int(second_); - if (iyear > 9999 || iyear < -9999) { - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(3), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (imonth > 12 || imonth < 1) { - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(4), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (iday > 31 || iday < 1) { - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(5), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (ihour > 23 || ihour < 0) { - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(6), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (iminute > 59 || iminute < 0) { - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(7), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (isecond > 59 || isecond < 0) { - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(8), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - time__Time res = time__new_time(((time__Time){ - .year = iyear, - .month = imonth, - .day = iday, - .hour = ihour, - .minute = iminute, - .second = isecond, - .microsecond = 0, - ._v_unix = 0, - .is_local = 0, - })); - Option_time__Time _t11; - opt_ok(&(time__Time[]) { res }, (Option*)(&_t11), sizeof(time__Time)); - return _t11; -} - -Option_time__Time time__parse_iso8601(string s) { - if ((s).len == 0) { - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - Option_int _t2 = string_index(s, _SLIT("T")); - if (_t2.state != 0) { /*or block*/ - IError err = _t2.err; - *(int*) _t2.data = -1; - } - - int t_i = (*(int*)_t2.data); - Array_string parts = (t_i != -1 ? (new_array_from_c_array(2, 2, sizeof(string), _MOV((string[2]){string_clone(string_substr(s, 0, t_i)), string_clone(string_substr(s, t_i + 1, (s).len))}))) : (string_split(s, _SLIT(" ")))); - if (!(parts.len == 1 || parts.len == 2)) { - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(12), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - Option_multi_return_int_int_int _t4 = time__parse_iso8601_date((*(string*)/*ee elem_sym */array_get(parts, 0))); - if (_t4.state != 0) { /*or block*/ - Option_time__Time _t5; - memcpy(&_t5, &_t4, sizeof(Option)); - return _t5; - } - - multi_return_int_int_int mr_3646 = (*(multi_return_int_int_int*)_t4.data); - int year = mr_3646.arg0; - int month = mr_3646.arg1; - int day = mr_3646.arg2; - int hour_ = 0; - int minute_ = 0; - int second_ = 0; - int microsecond_ = 0; - i64 unix_offset = ((i64)(0)); - bool is_local_time = true; - if (parts.len == 2) { - Option_multi_return_int_int_int_int_i64_bool _t6 = time__parse_iso8601_time((*(string*)/*ee elem_sym */array_get(parts, 1))); - if (_t6.state != 0) { /*or block*/ - Option_time__Time _t7; - memcpy(&_t7, &_t6, sizeof(Option)); - return _t7; - } - - multi_return_int_int_int_int_i64_bool mr_3888 = (*(multi_return_int_int_int_int_i64_bool*)_t6.data); - hour_ = mr_3888.arg0; - minute_ = mr_3888.arg1; - second_ = mr_3888.arg2; - microsecond_ = mr_3888.arg3; - unix_offset = mr_3888.arg4; - is_local_time = mr_3888.arg5; - } - time__Time t = time__new_time(((time__Time){ - .year = year, - .month = month, - .day = day, - .hour = hour_, - .minute = minute_, - .second = second_, - .microsecond = microsecond_, - ._v_unix = 0, - .is_local = 0, - })); - if (is_local_time) { - Option_time__Time _t8; - opt_ok(&(time__Time[]) { t }, (Option*)(&_t8), sizeof(time__Time)); - return _t8; - } - i64 unix_time = t._v_unix; - if (unix_offset < 0) { - unix_time -= (-unix_offset); - } else if (unix_offset > 0) { - unix_time += unix_offset; - } - t = time__unix2(((i64)(unix_time)), t.microsecond); - Option_time__Time _t9; - opt_ok(&(time__Time[]) { t }, (Option*)(&_t9), sizeof(time__Time)); - return _t9; -} - -Option_time__Time time__parse_rfc2822(string s) { - if ((s).len == 0) { - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - Array_string fields = string_split(s, _SLIT(" ")); - if (fields.len < 5) { - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(1), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - Option_int _t3 = string_index(_const_time__months_string, (*(string*)/*ee elem_sym */array_get(fields, 2))); - if (_t3.state != 0) { /*or block*/ - IError err = _t3.err; - return (Option_time__Time){ .state=2, .err=time__error_invalid_time(2), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - - int pos = (*(int*)_t3.data); - int mm = pos / 3 + 1; - { // Unsafe block - u8* tmstr = malloc_noscan(s.len * 2); - int count = snprintf(((char*)(tmstr)), (s.len * 2), "%s-%02d-%s %s", (*(string*)/*ee elem_sym */array_get(fields, 3)).str, mm, (*(string*)/*ee elem_sym */array_get(fields, 1)).str, (*(string*)/*ee elem_sym */array_get(fields, 4)).str); - Option_time__Time _t5 = time__parse(tos(tmstr, count)); - return _t5; - } - return (Option_time__Time){0}; -} - -VV_LOCAL_SYMBOL Option_multi_return_int_int_int time__parse_iso8601_date(string s) { - int year = 0; - int month = 0; - int day = 0; - u8 dummy = ((u8)(0)); - int count = sscanf(((char*)(s.str)), "%4d-%2d-%2d%c", &year, &month, &day, &dummy); - if (count != 3) { - return (Option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(10), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (year > 9999) { - return (Option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(13), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (month > 12) { - return (Option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(14), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (day > 31) { - return (Option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(15), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - Option_multi_return_int_int_int _t5; - opt_ok(&(multi_return_int_int_int/*X*/[]) { (multi_return_int_int_int){.arg0=year, .arg1=month, .arg2=day} }, (Option*)(&_t5), sizeof(multi_return_int_int_int)); - return _t5; -} - -VV_LOCAL_SYMBOL Option_multi_return_int_int_int_int_i64_bool time__parse_iso8601_time(string s) { - int hour_ = 0; - int minute_ = 0; - int second_ = 0; - int microsecond_ = 0; - rune plus_min_z = 'a'; - int offset_hour = 0; - int offset_minute = 0; - int count = sscanf(((char*)(s.str)), "%2d:%2d:%2d.%6d%c%2d:%2d", &hour_, &minute_, &second_, µsecond_, ((char*)(&plus_min_z)), &offset_hour, &offset_minute); - if (count < 4) { - count = sscanf(((char*)(s.str)), "%2d:%2d:%2d%c%2d:%2d", &hour_, &minute_, &second_, ((char*)(&plus_min_z)), &offset_hour, &offset_minute); - count++; - } - if (count < 4) { - return (Option_multi_return_int_int_int_int_i64_bool){ .state=2, .err=time__error_invalid_time(10), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - bool is_local_time = plus_min_z == 'a' && count == 4; - bool is_utc = plus_min_z == 'Z' && count == 5; - if (!(count == 7 || is_local_time || is_utc)) { - return (Option_multi_return_int_int_int_int_i64_bool){ .state=2, .err=time__error_invalid_time(11), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (plus_min_z != '+' && plus_min_z != '-' && !is_utc && !is_local_time) { - return (Option_multi_return_int_int_int_int_i64_bool){ .state=2, .err=time__error_invalid_time(12), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - int unix_offset = 0; - if (offset_hour > 0) { - unix_offset += 3600 * offset_hour; - } - if (offset_minute > 0) { - unix_offset += 60 * offset_minute; - } - if (plus_min_z == '+') { - unix_offset *= -1; - } - Option_multi_return_int_int_int_int_i64_bool _t4; - opt_ok(&(multi_return_int_int_int_int_i64_bool/*X*/[]) { (multi_return_int_int_int_int_i64_bool){.arg0=hour_, .arg1=minute_, .arg2=second_, .arg3=microsecond_, .arg4=unix_offset, .arg5=is_local_time} }, (Option*)(&_t4), sizeof(multi_return_int_int_int_int_i64_bool)); - return _t4; -} - -string time__TimeParseError_msg(time__TimeParseError err) { - string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("Invalid time format code: "), 0xfe07, {.d_i32 = err.code}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t1; -} - -VV_LOCAL_SYMBOL IError time__error_invalid_time(int code) { - IError _t1 = I_time__TimeParseError_to_Interface_IError(((time__TimeParseError*)memdup(&(time__TimeParseError){.Error = ((Error){EMPTY_STRUCT_INITIALIZATION}),.code = code,}, sizeof(time__TimeParseError)))); - return _t1; -} - -time__StopWatch time__new_stopwatch(time__StopWatchOptions opts) { - u64 initial = ((u64)(0U)); - if (opts.auto_start) { - initial = time__sys_mono_now(); - } - time__StopWatch _t1 = ((time__StopWatch){.elapsed = 0U,.start = initial,.end = 0U,}); - return _t1; -} - -void time__StopWatch_start(time__StopWatch* t) { - t->start = time__sys_mono_now(); - t->end = 0U; -} - -void time__StopWatch_restart(time__StopWatch* t) { - t->start = time__sys_mono_now(); - t->end = 0U; - t->elapsed = 0U; -} - -void time__StopWatch_stop(time__StopWatch* t) { - t->end = time__sys_mono_now(); -} - -void time__StopWatch_pause(time__StopWatch* t) { - if (t->start > 0U) { - if (t->end == 0U) { - t->elapsed += time__sys_mono_now() - t->start; - } else { - t->elapsed += t->end - t->start; - } - } - t->start = 0U; -} - -time__Duration time__StopWatch_elapsed(time__StopWatch t) { - if (t.start > 0U) { - if (t.end == 0U) { - time__Duration _t1 = ((((i64)(time__sys_mono_now() - t.start + t.elapsed)))); - return _t1; - } else { - time__Duration _t2 = ((((i64)(t.end - t.start + t.elapsed)))); - return _t2; - } - } - time__Duration _t3 = ((((i64)(t.elapsed)))); - return _t3; -} - -time__Time time__now(void) { - time__Time _t1 = time__win_now(); - return _t1; - time_t t = time(0); - struct tm* now = localtime(&t); - time__Time _t2 = time__convert_ctime(*now, 0); - return _t2; -} - -time__Time time__utc(void) { - time__Time _t1 = time__win_utc(); - return _t1; - time_t t = time(0); - time(&t); - time__Time _t2 = time__unix2(((i64)(t)), 0); - return _t2; -} - -time__Time time__new_time(time__Time t) { - if (t._v_unix != 0) { - time__Time _t1 = t; - return _t1; - } - struct tm tt = ((struct tm){ - .tm_year = t.year - 1900, - .tm_mon = t.month - 1, - .tm_mday = t.day, - .tm_hour = t.hour, - .tm_min = t.minute, - .tm_sec = t.second, - }); - i64 utime = time__make_unix_time(tt); - time__Time _t2 = ((time__Time){t.year,t.month,t.day,t.hour,t.minute,t.second,t.microsecond,._v_unix = utime,t.is_local,}); - return _t2; -} - -i64 time__ticks(void) { - #if defined(_WIN32) - { - i64 _t1 = GetTickCount(); - return _t1; - } - #else - { - } - #endif - return 0; -} - -string time__Time_str(time__Time t) { - string _t1 = time__Time_format_ss(t); - return _t1; -} - -VV_LOCAL_SYMBOL time__Time time__convert_ctime(struct tm t, int microsecond) { - time__Time _t1 = ((time__Time){ - .year = t.tm_year + 1900, - .month = t.tm_mon + 1, - .day = t.tm_mday, - .hour = t.tm_hour, - .minute = t.tm_min, - .second = t.tm_sec, - .microsecond = microsecond, - ._v_unix = time__make_unix_time(t), - .is_local = true, - }); - return _t1; -} - -string time__Time_strftime(time__Time t, string fmt) { - struct tm* tm = ((struct tm*)memdup(&(struct tm){.tm_year = 0,.tm_mon = 0,.tm_mday = 0,.tm_hour = 0,.tm_min = 0,.tm_sec = 0,}, sizeof(struct tm))); - #if defined(_WIN32) - { - tm = gmtime(((voidptr)(&t._v_unix))); - } - #else - { - } - #endif - Array_fixed_C__char_1024 buf = {0}; - char* fmt_c = ((char*)(fmt.str)); - strftime(&buf[0], ((size_t)(sizeof(Array_fixed_C__char_1024))), fmt_c, tm); - string _t1 = cstring_to_vstring(((char*)(&buf[0]))); - return _t1; -} - -string time__Time_smonth(time__Time* t) { - if (t->month <= 0 || t->month > 12) { - string _t1 = _SLIT("---"); - return _t1; - } - int i = t->month - 1; - string _t2 = string_substr(_const_time__months_string, i * 3, (i + 1) * 3); - return _t2; -} - -// Attr: [inline] -inline i64 time__Time_unix_time(time__Time* t) { - i64 _t1 = t->_v_unix; - return _t1; -} - -// Attr: [inline] -inline i64 time__Time_unix_time_milli(time__Time* t) { - i64 _t1 = t->_v_unix * 1000 + (t->microsecond / 1000); - return _t1; -} - -time__Time time__Time_add(time__Time* t, time__Duration d) { - i64 microseconds = ((i64)(t->_v_unix)) * 1000000 + t->microsecond + time__Duration_microseconds(d); - i64 _v_unix = microseconds / 1000000; - i64 micro = microseconds % 1000000; - time__Time _t1 = time__unix2(_v_unix, ((int)(micro))); - return _t1; -} - -time__Time time__Time_add_seconds(time__Time* t, int seconds) { - time__Time _t1 = time__Time_add(t, seconds * _const_time__second); - return _t1; -} - -time__Time time__Time_add_days(time__Time* t, int days) { - time__Time _t1 = time__Time_add(t, days * 24 * _const_time__hour); - return _t1; -} - -time__Duration time__since(time__Time t) { - time__Duration _t1 = time__Time__minus(time__now(), t); - return _t1; -} - -string time__Time_relative(time__Time* t) { - time__Time znow = time__now(); - i64 secs = znow._v_unix - t->_v_unix; - if (secs <= 30) { - string _t1 = _SLIT("now"); - return _t1; - } - if (secs < 60) { - string _t2 = _SLIT("1m"); - return _t2; - } - if (secs < 3600) { - i64 m = secs / 60; - if (m == 1) { - string _t3 = _SLIT("1 minute ago"); - return _t3; - } - string _t4 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = m}}, {_SLIT(" minutes ago"), 0, { .d_c = 0 }}})); - return _t4; - } - if (secs < 86400) { - i64 h = secs / 3600; - if (h == 1) { - string _t5 = _SLIT("1 hour ago"); - return _t5; - } - string _t6 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = h}}, {_SLIT(" hours ago"), 0, { .d_c = 0 }}})); - return _t6; - } - if (secs < 432000) { - i64 d = secs / 3600 / 24; - if (d == 1) { - string _t7 = _SLIT("1 day ago"); - return _t7; - } - string _t8 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = d}}, {_SLIT(" days ago"), 0, { .d_c = 0 }}})); - return _t8; - } - if (secs > 864000000) { - string _t9 = _SLIT(""); - return _t9; - } - string _t10 = time__Time_md(/*rec*/*t); - return _t10; -} - -string time__Time_relative_short(time__Time* t) { - time__Time znow = time__now(); - i64 secs = znow._v_unix - t->_v_unix; - if (secs <= 30) { - string _t1 = _SLIT("now"); - return _t1; - } - if (secs < 60) { - string _t2 = _SLIT("1m"); - return _t2; - } - if (secs < 3600) { - string _t3 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = secs / 60}}, {_SLIT("m"), 0, { .d_c = 0 }}})); - return _t3; - } - if (secs < 86400) { - string _t4 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = secs / 3600}}, {_SLIT("h"), 0, { .d_c = 0 }}})); - return _t4; - } - if (secs < 432000) { - string _t5 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = secs / 3600 / 24}}, {_SLIT("d"), 0, { .d_c = 0 }}})); - return _t5; - } - if (secs > 864000000) { - string _t6 = _SLIT(""); - return _t6; - } - string _t7 = time__Time_md(/*rec*/*t); - return _t7; -} - -int time__day_of_week(int y, int m, int d) { - Array_int t = new_array_from_c_array(12, 12, sizeof(int), _MOV((int[12]){ - 0, 3, 2, 5, 0, 3, 5, 1, 4, - 6, 2, 4})); - int sy = y; - if (m < 3) { - sy = sy - 1; - } - int _t1 = (sy + sy / 4 - sy / 100 + sy / 400 + (*(int*)/*ee elem_sym */array_get(t, m - 1)) + d - 1) % 7 + 1; - return _t1; -} - -int time__Time_day_of_week(time__Time* t) { - int _t1 = time__day_of_week(t->year, t->month, t->day); - return _t1; -} - -string time__Time_weekday_str(time__Time* t) { - int i = time__Time_day_of_week(t) - 1; - string _t1 = string_substr(_const_time__days_string, i * 3, (i + 1) * 3); - return _t1; -} - -string time__Time_long_weekday_str(time__Time* t) { - int i = time__Time_day_of_week(t) - 1; - string _t1 = (*(string*)/*ee elem_sym */array_get(_const_time__long_days, i)); - return _t1; -} - -bool time__is_leap_year(int year) { - bool _t1 = (year % 4 == 0) && (year % 100 != 0 || year % 400 == 0); - return _t1; -} - -Option_int time__days_in_month(int month, int year) { - if (month > 12 || month < 1) { - return (Option_int){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("Invalid month: "), 0xfe07, {.d_i32 = month}}, {_SLIT0, 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - int extra = (month == 2 && time__is_leap_year(year) ? (1) : (0)); - int res = (*(int*)/*ee elem_sym */array_get(_const_time__month_days, month - 1)) + extra; - Option_int _t2; - opt_ok(&(int[]) { res }, (Option*)(&_t2), sizeof(int)); - return _t2; -} - -string time__Time_debug(time__Time* t) { - string _t1 = str_intp(9, _MOV((StrIntpData[]){{_SLIT("Time{ year: "), 0x8008fe27, {.d_i32 = t->year}}, {_SLIT(" month: "), 0x8004fe27, {.d_i32 = t->month}}, {_SLIT(" day: "), 0x8004fe27, {.d_i32 = t->day}}, {_SLIT(" hour: "), 0x8004fe27, {.d_i32 = t->hour}}, {_SLIT(" minute: "), 0x8004fe27, {.d_i32 = t->minute}}, {_SLIT(" second: "), 0x8004fe27, {.d_i32 = t->second}}, {_SLIT(" microsecond: "), 0x800cfe27, {.d_i32 = t->microsecond}}, {_SLIT(" unix: "), 0x800efe29, {.d_i64 = t->_v_unix}}, {_SLIT(" }"), 0, { .d_c = 0 }}})); - return _t1; -} - -// TypeDecl -i64 time__Duration_nanoseconds(time__Duration d) { - i64 _t1 = ((i64)(d)); - return _t1; -} - -i64 time__Duration_microseconds(time__Duration d) { - i64 _t1 = ((i64)(d)) / 1000; - return _t1; -} - -i64 time__Duration_milliseconds(time__Duration d) { - i64 _t1 = ((i64)(d)) / 1000000; - return _t1; -} - -f64 time__Duration_seconds(time__Duration d) { - i64 sec = d / _const_time__second; - i64 nsec = d % _const_time__second; - f64 _t1 = ((f64)(sec)) + ((f64)(nsec)) / 1e9; - return _t1; -} - -f64 time__Duration_minutes(time__Duration d) { - i64 min = d / _const_time__minute; - i64 nsec = d % _const_time__minute; - f64 _t1 = ((f64)(min)) + ((f64)(nsec)) / (60 * 1e9); - return _t1; -} - -f64 time__Duration_hours(time__Duration d) { - i64 hr = d / _const_time__hour; - i64 nsec = d % _const_time__hour; - f64 _t1 = ((f64)(hr)) + ((f64)(nsec)) / (3600 * 1e9); - return _t1; -} - -string time__Duration_str(time__Duration d) { - if (time__Duration_alias_eq(d, _const_time__infinite)) { - string _t1 = _SLIT("inf"); - return _t1; - } - i64 t = ((i64)(d)); - i64 hr = t / _const_time__hour; - t -= hr * _const_time__hour; - i64 min = t / _const_time__minute; - t -= min * _const_time__minute; - i64 sec = t / _const_time__second; - t -= sec * _const_time__second; - i64 ms = t / _const_time__millisecond; - t -= ms * _const_time__millisecond; - i64 us = t / _const_time__microsecond; - t -= us * _const_time__microsecond; - i64 ns = t; - if (hr > 0) { - string _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = hr}}, {_SLIT(":"), 0x8004fe29, {.d_i64 = min}}, {_SLIT(":"), 0x8004fe29, {.d_i64 = sec}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t2; - } - if (min > 0) { - string _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = min}}, {_SLIT(":"), 0x8004fe29, {.d_i64 = sec}}, {_SLIT("."), 0x8006fe29, {.d_i64 = ms}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t3; - } - if (sec > 0) { - string _t4 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = sec}}, {_SLIT("."), 0x8006fe29, {.d_i64 = ms}}, {_SLIT("s"), 0, { .d_c = 0 }}})); - return _t4; - } - if (ms > 0) { - string _t5 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = ms}}, {_SLIT("."), 0x8006fe29, {.d_i64 = us}}, {_SLIT("ms"), 0, { .d_c = 0 }}})); - return _t5; - } - if (us > 0) { - string _t6 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = us}}, {_SLIT("."), 0x8006fe29, {.d_i64 = ns}}, {_SLIT("us"), 0, { .d_c = 0 }}})); - return _t6; - } - string _t7 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = ns}}, {_SLIT("ns"), 0, { .d_c = 0 }}})); - return _t7; -} - -int time__offset(void) { - time__Time t = time__utc(); - time__Time local = time__Time_local(&t); - int _t1 = ((int)(local._v_unix - t._v_unix)); - return _t1; -} - -VV_LOCAL_SYMBOL i64 time__make_unix_time(struct tm t) { - i64 _t1 = time__portable_timegm(&t); - return _t1; -} - -VV_LOCAL_SYMBOL u64 time__init_win_time_freq(void) { - u64 f = ((u64)(0U)); - QueryPerformanceFrequency(&f); - u64 _t1 = f; - return _t1; -} - -VV_LOCAL_SYMBOL u64 time__init_win_time_start(void) { - u64 s = ((u64)(0U)); - QueryPerformanceCounter(&s); - u64 _t1 = s; - return _t1; -} - -u64 time__sys_mono_now(void) { - u64 tm = ((u64)(0U)); - QueryPerformanceCounter(&tm); - u64 _t1 = (tm - _const_time__start_time) * 1000000000U / _const_time__freq_time; - return _t1; -} - -// Attr: [inline] -inline VV_LOCAL_SYMBOL u64 time__vpc_now(void) { - u64 tm = ((u64)(0U)); - QueryPerformanceCounter(&tm); - u64 _t1 = tm; - return _t1; -} - -VV_LOCAL_SYMBOL i64 time__local_as_unix_time(void) { - time_t t = time(0); - struct tm* tm = localtime(&t); - i64 _t1 = time__make_unix_time(*tm); - return _t1; -} - -time__Time time__Time_local(time__Time* t) { - if (t->is_local) { - time__Time _t1 = *t; - return _t1; - } - time__SystemTime st_utc = ((time__SystemTime){ - .year = ((u16)(t->year)), - .month = ((u16)(t->month)), - .day_of_week = 0, - .day = ((u16)(t->day)), - .hour = ((u16)(t->hour)), - .minute = ((u16)(t->minute)), - .second = ((u16)(t->second)), - .millisecond = ((u16)(t->microsecond / 1000)), - }); - time__SystemTime st_local = ((time__SystemTime){.year = 0,.month = 0,.day_of_week = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.millisecond = 0,}); - SystemTimeToTzSpecificLocalTime(((voidptr)(0)), &st_utc, &st_local); - time__Time t_local = ((time__Time){ - .year = st_local.year, - .month = st_local.month, - .day = st_local.day, - .hour = st_local.hour, - .minute = st_local.minute, - .second = st_local.second, - .microsecond = st_local.millisecond * 1000U, - ._v_unix = time__SystemTime_unix_time(st_local), - .is_local = 0, - }); - time__Time _t2 = t_local; - return _t2; -} - -VV_LOCAL_SYMBOL time__Time time__win_now(void) { - struct _FILETIME ft_utc = ((struct _FILETIME){.dwLowDateTime = 0,.dwHighDateTime = 0,}); - GetSystemTimeAsFileTime(&ft_utc); - time__SystemTime st_utc = ((time__SystemTime){.year = 0,.month = 0,.day_of_week = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.millisecond = 0,}); - FileTimeToSystemTime(&ft_utc, &st_utc); - time__SystemTime st_local = ((time__SystemTime){.year = 0,.month = 0,.day_of_week = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.millisecond = 0,}); - SystemTimeToTzSpecificLocalTime(((voidptr)(0)), &st_utc, &st_local); - time__Time t = ((time__Time){ - .year = st_local.year, - .month = st_local.month, - .day = st_local.day, - .hour = st_local.hour, - .minute = st_local.minute, - .second = st_local.second, - .microsecond = st_local.millisecond * 1000U, - ._v_unix = time__SystemTime_unix_time(st_local), - .is_local = true, - }); - time__Time _t1 = t; - return _t1; -} - -VV_LOCAL_SYMBOL time__Time time__win_utc(void) { - struct _FILETIME ft_utc = ((struct _FILETIME){.dwLowDateTime = 0,.dwHighDateTime = 0,}); - GetSystemTimeAsFileTime(&ft_utc); - time__SystemTime st_utc = ((time__SystemTime){.year = 0,.month = 0,.day_of_week = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.millisecond = 0,}); - FileTimeToSystemTime(&ft_utc, &st_utc); - time__Time t = ((time__Time){ - .year = st_utc.year, - .month = st_utc.month, - .day = st_utc.day, - .hour = st_utc.hour, - .minute = st_utc.minute, - .second = st_utc.second, - .microsecond = st_utc.millisecond * 1000U, - ._v_unix = time__SystemTime_unix_time(st_utc), - .is_local = false, - }); - time__Time _t1 = t; - return _t1; -} - -i64 time__SystemTime_unix_time(time__SystemTime st) { - struct tm tt = ((struct tm){ - .tm_year = st.year - 1900U, - .tm_mon = st.month - 1U, - .tm_mday = st.day, - .tm_hour = st.hour, - .tm_min = st.minute, - .tm_sec = st.second, - }); - i64 _t1 = time__make_unix_time(tt); - return _t1; -} - -time__Time time__darwin_now(void) { - time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - return _t1; -} - -time__Time time__linux_now(void) { - time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - return _t1; -} - -time__Time time__solaris_now(void) { - time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - return _t1; -} - -time__Time time__darwin_utc(void) { - time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - return _t1; -} - -time__Time time__linux_utc(void) { - time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - return _t1; -} - -time__Time time__solaris_utc(void) { - time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - return _t1; -} - -void time__sleep(time__Duration duration) { - Sleep(((int)(duration / _const_time__millisecond))); -} - -u32 time__Duration_sys_milliseconds(time__Duration d) { - if (d >= ((u32)(-1)) * _const_time__millisecond) { - u32 _t1 = ((u32)(-1)); - return _t1; - } else if (d <= 0) { - u32 _t2 = 0U; - return _t2; - } else { - u32 _t3 = ((u32)(d / _const_time__millisecond)); - return _t3; - } - return 0; -} - -time__Time time__unix(i64 abs) { - i64 day_offset = abs / _const_time__seconds_per_day; - if (abs % _const_time__seconds_per_day < 0) { - day_offset--; - } - multi_return_int_int_int mr_472 = time__calculate_date_from_offset(day_offset); - int year = mr_472.arg0; - int month = mr_472.arg1; - int day = mr_472.arg2; - multi_return_int_int_int mr_528 = time__calculate_time_from_offset(abs % _const_time__seconds_per_day); - int hr = mr_528.arg0; - int min = mr_528.arg1; - int sec = mr_528.arg2; - time__Time _t1 = ((time__Time){ - .year = year, - .month = month, - .day = day, - .hour = hr, - .minute = min, - .second = sec, - .microsecond = 0, - ._v_unix = abs, - .is_local = 0, - }); - return _t1; -} - -time__Time time__unix2(i64 abs, int microsecond) { - i64 day_offset = abs / _const_time__seconds_per_day; - if (abs % _const_time__seconds_per_day < 0) { - day_offset--; - } - multi_return_int_int_int mr_1020 = time__calculate_date_from_offset(day_offset); - int year = mr_1020.arg0; - int month = mr_1020.arg1; - int day = mr_1020.arg2; - multi_return_int_int_int mr_1076 = time__calculate_time_from_offset(abs % _const_time__seconds_per_day); - int hr = mr_1076.arg0; - int min = mr_1076.arg1; - int sec = mr_1076.arg2; - time__Time _t1 = ((time__Time){ - .year = year, - .month = month, - .day = day, - .hour = hr, - .minute = min, - .second = sec, - .microsecond = microsecond, - ._v_unix = abs, - .is_local = 0, - }); - return _t1; -} - -VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_date_from_offset(i64 day_offset_) { - i64 day_offset = day_offset_; - int year = 2001; - day_offset -= 11323; - year += ((int)(day_offset / _const_time__days_per_400_years)) * 400; - day_offset %= _const_time__days_per_400_years; - if (day_offset == _const_time__days_per_100_years * 4) { - year += 300; - day_offset -= _const_time__days_per_100_years * 3; - } else { - year += ((int)(day_offset / _const_time__days_per_100_years)) * 100; - day_offset %= _const_time__days_per_100_years; - } - if (day_offset == _const_time__days_per_4_years * 25) { - year += 96; - day_offset -= _const_time__days_per_4_years * 24; - } else { - year += ((int)(day_offset / _const_time__days_per_4_years)) * 4; - day_offset %= _const_time__days_per_4_years; - } - if (day_offset == 1460) { - year += 3; - day_offset -= 1095; - } else { - year += ((int)(day_offset / 365)); - day_offset %= 365; - } - if (day_offset < 0) { - year--; - if (time__is_leap_year(year)) { - day_offset += 366; - } else { - day_offset += 365; - } - } - if (time__is_leap_year(year)) { - if (day_offset > 59) { - day_offset--; - } else if (day_offset == 59) { - return (multi_return_int_int_int){.arg0=year, .arg1=2, .arg2=29}; - } - } - i64 estimated_month = day_offset / 31; - for (;;) { - if (!(day_offset >= (*(int*)/*ee elem_sym */array_get(_const_time__days_before, estimated_month + 1)))) break; - estimated_month++; - } - for (;;) { - if (!(day_offset < (*(int*)/*ee elem_sym */array_get(_const_time__days_before, estimated_month)))) break; - if (estimated_month == 0) { - break; - } - estimated_month--; - } - day_offset -= (*(int*)/*ee elem_sym */array_get(_const_time__days_before, estimated_month)); - return (multi_return_int_int_int){.arg0=year, .arg1=((int)(estimated_month + 1)), .arg2=((int)(day_offset + 1))}; -} - -VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_time_from_offset(i64 second_offset_) { - i64 second_offset = second_offset_; - if (second_offset < 0) { - second_offset += _const_time__seconds_per_day; - } - i64 hour_ = second_offset / _const_time__seconds_per_hour; - second_offset %= _const_time__seconds_per_hour; - i64 min = second_offset / _const_time__seconds_per_minute; - second_offset %= _const_time__seconds_per_minute; - return (multi_return_int_int_int){.arg0=((int)(hour_)), .arg1=((int)(min)), .arg2=((int)(second_offset))}; -} - void v__dotgraph__start_digraph(void) { println(_SLIT("digraph G {")); atexit((voidptr) anon_fn_eb34f0b759dade77__82); @@ -30651,42 +29748,2019 @@ void v__depgraph__show(v__depgraph__DepGraph* graph, string path) { v__dotgraph__DotGraph_finish(dg); } -// Attr: [inline] -inline VV_LOCAL_SYMBOL u32 rand__seed__nr_next(u32 prev) { - u32 _t1 = prev * 1664525U + 1013904223U; - return _t1; -} - -Array_u32 rand__seed__time_seed_array(int count) { - u64 ctime = time__sys_mono_now(); - u32 seed = ((u32)((ctime >> 32U ^ ((ctime & 0x00000000FFFFFFFFU))))); - Array_u32 seed_data = __new_array_with_default(0, count, sizeof(u32), 0); - for (int _t1 = 0; _t1 < count; ++_t1) { - seed = rand__seed__nr_next(seed); - array_push((array*)&seed_data, _MOV((u32[]){ rand__seed__nr_next(seed) })); +// Attr: [deprecated] +f64 math__fabs(f64 x) { + if (x > 0.0) { + return x; } - Array_u32 _t3 = seed_data; - return _t3; + return -x; } -// Attr: [manualfree] -u32 rand__seed__time_seed_32(void) { - Array_u32 sa = rand__seed__time_seed_array(1); - u32 res = (*(u32*)/*ee elem_sym */array_get(sa, 0)); - array_free(&sa); - u32 _t1 = res; - return _t1; +f64 math__inf(int sign) { + u64 v = (sign >= 0 ? (_const_math__uvinf) : (_const_math__uvneginf)); + return math__f64_from_bits(v); } -// Attr: [manualfree] -u64 rand__seed__time_seed_64(void) { - Array_u32 seed_data = rand__seed__time_seed_array(2); - u64 lower = ((u64)((*(u32*)/*ee elem_sym */array_get(seed_data, 0)))); - u64 upper = ((u64)((*(u32*)/*ee elem_sym */array_get(seed_data, 1)))); - array_free(&seed_data); - u64 res = (lower | (upper << 32U)); - u64 _t1 = res; - return _t1; +f64 math__nan(void) { + return math__f64_from_bits(_const_math__uvnan); +} + +bool math__is_nan(f64 f) { + return f != f; +} + +bool math__is_inf(f64 f, int sign) { + return (sign >= 0 && f > _const_math__max_f64) || (sign <= 0 && f < -_const_math__max_f64); +} + +bool math__is_finite(f64 f) { + return !math__is_nan(f) && !math__is_inf(f, 0); +} + +multi_return_f64_int math__normalize(f64 x) { + f64 smallest_normal = 2.2250738585072014e-308; + if (math__abs_T_f64(x) < smallest_normal) { + return (multi_return_f64_int){.arg0=x * _const_math__normalize_smallest_mask, .arg1=-52}; + } + return (multi_return_f64_int){.arg0=x, .arg1=0}; +} + +f64 math__cbrt(f64 a) { + f64 x = a; + int b1 = 715094163; + int b2 = 696219795; + f64 c = 5.42857142857142815906e-01; + f64 d = -7.05306122448979611050e-01; + f64 e_ = 1.41428571428571436819e+00; + f64 f = 1.60714285714285720630e+00; + f64 g = 3.57142857142857150787e-01; + f64 smallest_normal = 2.22507385850720138309e-308; + if (x == 0.0 || math__is_nan(x) || math__is_inf(x, 0)) { + return x; + } + bool sign = false; + if (x < 0) { + x = -x; + sign = true; + } + f64 t = math__f64_from_bits(math__f64_bits(x) / ((u64)(3 + (((u64)(b1)) << 32U)))); + if (x < smallest_normal) { + t = ((f64)(((u64)(1U)) << 54U)); + t *= x; + t = math__f64_from_bits(math__f64_bits(t) / ((u64)(3 + (((u64)(b2)) << 32U)))); + } + f64 r = t * t / x; + f64 s = c + r * t; + t *= g + f / (s + e_ + d / s); + t = math__f64_from_bits((math__f64_bits(t) & (((u64)(0xffffffffcU)) << 28U)) + (((u64)(1U)) << 30U)); + s = t * t; + r = x / s; + f64 w = t + t; + r = (r - t) / (w + r); + t = t + t * r; + if (sign) { + t = -t; + } + return t; +} + +f64 math__mod(f64 x, f64 y) { + return math__fmod(x, y); +} + +f64 math__fmod(f64 x, f64 y) { + if (y == 0 || math__is_inf(x, 0) || math__is_nan(x) || math__is_nan(y)) { + return math__nan(); + } + f64 abs_y = math__abs_T_f64(y); + multi_return_f64_int mr_594 = math__frexp(abs_y); + f64 abs_y_fr = mr_594.arg0; + int abs_y_exp = mr_594.arg1; + f64 r = x; + if (x < 0) { + r = -x; + } + for (;;) { + if (!(r >= abs_y)) break; + multi_return_f64_int mr_680 = math__frexp(r); + f64 rfr = mr_680.arg0; + int rexp = mr_680.arg1; + if (rfr < abs_y_fr) { + rexp = rexp - 1; + } + r = r - math__ldexp(abs_y, rexp - abs_y_exp); + } + if (x < 0) { + r = -r; + } + return r; +} + +i64 math__gcd(i64 a_, i64 b_) { + i64 a = a_; + i64 b = b_; + if (a < 0) { + a = -a; + } + if (b < 0) { + b = -b; + } + for (;;) { + if (!(b != 0)) break; + a %= b; + if (a == 0) { + return b; + } + b %= a; + } + return a; +} + +multi_return_i64_i64_i64 math__egcd(i64 a, i64 b) { + i64 old_r = a; + i64 r = b; + i64 old_s = ((i64)(1)); + i64 s = ((i64)(0)); + i64 old_t = ((i64)(0)); + i64 t = ((i64)(1)); + for (;;) { + if (!(r != 0)) break; + i64 quot = old_r / r; + i64 _var_1339 = old_r; + i64 _var_1346 = r; + old_r = _var_1346; + r = _var_1339%_var_1346; + i64 _var_1365 = old_s; + i64 _var_1372 = s; + old_s = _var_1372; + s = _var_1365-quot*_var_1372; + i64 _var_1398 = old_t; + i64 _var_1405 = t; + old_t = _var_1405; + t = _var_1398-quot*_var_1405; + } + return (multi_return_i64_i64_i64){.arg0=(old_r < 0 ? (-old_r) : (old_r)), .arg1=old_s, .arg2=old_t}; +} + +i64 math__lcm(i64 a, i64 b) { + if (a == 0) { + return a; + } + i64 res = a * (b / math__gcd(b, a)); + if (res < 0) { + return -res; + } + return res; +} + +f64 math__erf(f64 a) { + f64 x = a; + f64 very_tiny = 2.848094538889218e-306; + f64 small_ = 1.0 / ((f64)(((u64)(1U)) << 28U)); + if (math__is_nan(x)) { + return math__nan(); + } + if (math__is_inf(x, 1)) { + return 1.0; + } + if (math__is_inf(x, -1)) { + return ((f64)(-1)); + } + bool sign = false; + if (x < 0) { + x = -x; + sign = true; + } + if (x < 0.84375) { + f64 temp = 0.0; + if (x < small_) { + if (x < very_tiny) { + temp = 0.125 * (8.0 * x + _const_math__efx8 * x); + } else { + temp = x + _const_math__efx * x; + } + } else { + f64 z = x * x; + f64 r = _const_math__pp0 + z * (_const_math__pp1 + z * (_const_math__pp2 + z * (_const_math__pp3 + z * _const_math__pp4))); + f64 s_ = 1.0 + z * (_const_math__qq1 + z * (_const_math__qq2 + z * (_const_math__qq3 + z * (_const_math__qq4 + z * _const_math__qq5)))); + f64 y = r / s_; + temp = x + x * y; + } + if (sign) { + return -temp; + } + return temp; + } + if (x < 1.25) { + f64 s_ = x - 1; + f64 p = _const_math__pa0 + s_ * (_const_math__pa1 + s_ * (_const_math__pa2 + s_ * (_const_math__pa3 + s_ * (_const_math__pa4 + s_ * (_const_math__pa5 + s_ * _const_math__pa6))))); + f64 q = 1.0 + s_ * (_const_math__qa1 + s_ * (_const_math__qa2 + s_ * (_const_math__qa3 + s_ * (_const_math__qa4 + s_ * (_const_math__qa5 + s_ * _const_math__qa6))))); + if (sign) { + return -_const_math__erx - p / q; + } + return _const_math__erx + p / q; + } + if (x >= 6) { + if (sign) { + return -1; + } + return 1.0; + } + f64 s_ = 1.0 / (x * x); + f64 r = 0.0; + f64 s = 0.0; + if (x < 2.857143) { + r = _const_math__ra0 + s_ * (_const_math__ra1 + s_ * (_const_math__ra2 + s_ * (_const_math__ra3 + s_ * (_const_math__ra4 + s_ * (_const_math__ra5 + s_ * (_const_math__ra6 + s_ * _const_math__ra7)))))); + s = 1.0 + s_ * (_const_math__sa1 + s_ * (_const_math__sa2 + s_ * (_const_math__sa3 + s_ * (_const_math__sa4 + s_ * (_const_math__sa5 + s_ * (_const_math__sa6 + s_ * (_const_math__sa7 + s_ * _const_math__sa8))))))); + } else { + r = _const_math__rb0 + s_ * (_const_math__rb1 + s_ * (_const_math__rb2 + s_ * (_const_math__rb3 + s_ * (_const_math__rb4 + s_ * (_const_math__rb5 + s_ * _const_math__rb6))))); + s = 1.0 + s_ * (_const_math__sb1 + s_ * (_const_math__sb2 + s_ * (_const_math__sb3 + s_ * (_const_math__sb4 + s_ * (_const_math__sb5 + s_ * (_const_math__sb6 + s_ * _const_math__sb7)))))); + } + f64 z = math__f64_from_bits((math__f64_bits(x) & 0xffffffff00000000U)); + f64 r_ = math__exp(-z * z - 0.5625) * math__exp((z - x) * (z + x) + r / s); + if (sign) { + return r_ / x - 1.0; + } + return 1.0 - r_ / x; +} + +f64 math__erfc(f64 a) { + f64 x = a; + f64 tiny = 1.0 / ((f64)(((u64)(1U)) << 56U)); + if (math__is_nan(x)) { + return math__nan(); + } + if (math__is_inf(x, 1)) { + return 0.0; + } + if (math__is_inf(x, -1)) { + return 2.0; + } + bool sign = false; + if (x < 0) { + x = -x; + sign = true; + } + if (x < 0.84375) { + f64 temp = 0.0; + if (x < tiny) { + temp = x; + } else { + f64 z = x * x; + f64 r = _const_math__pp0 + z * (_const_math__pp1 + z * (_const_math__pp2 + z * (_const_math__pp3 + z * _const_math__pp4))); + f64 s_ = 1.0 + z * (_const_math__qq1 + z * (_const_math__qq2 + z * (_const_math__qq3 + z * (_const_math__qq4 + z * _const_math__qq5)))); + f64 y = r / s_; + if (x < 0.25) { + temp = x + x * y; + } else { + temp = 0.5 + (x * y + (x - 0.5)); + } + } + if (sign) { + return 1.0 + temp; + } + return 1.0 - temp; + } + if (x < 1.25) { + f64 s_ = x - 1; + f64 p = _const_math__pa0 + s_ * (_const_math__pa1 + s_ * (_const_math__pa2 + s_ * (_const_math__pa3 + s_ * (_const_math__pa4 + s_ * (_const_math__pa5 + s_ * _const_math__pa6))))); + f64 q = 1.0 + s_ * (_const_math__qa1 + s_ * (_const_math__qa2 + s_ * (_const_math__qa3 + s_ * (_const_math__qa4 + s_ * (_const_math__qa5 + s_ * _const_math__qa6))))); + if (sign) { + return 1.0 + _const_math__erx + p / q; + } + return 1.0 - _const_math__erx - p / q; + } + if (x < 28) { + f64 s_ = 1.0 / (x * x); + f64 r = 0.0; + f64 s = 0.0; + if (x < 2.857143) { + r = _const_math__ra0 + s_ * (_const_math__ra1 + s_ * (_const_math__ra2 + s_ * (_const_math__ra3 + s_ * (_const_math__ra4 + s_ * (_const_math__ra5 + s_ * (_const_math__ra6 + s_ * _const_math__ra7)))))); + s = 1.0 + s_ * (_const_math__sa1 + s_ * (_const_math__sa2 + s_ * (_const_math__sa3 + s_ * (_const_math__sa4 + s_ * (_const_math__sa5 + s_ * (_const_math__sa6 + s_ * (_const_math__sa7 + s_ * _const_math__sa8))))))); + } else { + if (sign && x > 6) { + return 2.0; + } + r = _const_math__rb0 + s_ * (_const_math__rb1 + s_ * (_const_math__rb2 + s_ * (_const_math__rb3 + s_ * (_const_math__rb4 + s_ * (_const_math__rb5 + s_ * _const_math__rb6))))); + s = 1.0 + s_ * (_const_math__sb1 + s_ * (_const_math__sb2 + s_ * (_const_math__sb3 + s_ * (_const_math__sb4 + s_ * (_const_math__sb5 + s_ * (_const_math__sb6 + s_ * _const_math__sb7)))))); + } + f64 z = math__f64_from_bits((math__f64_bits(x) & 0xffffffff00000000U)); + f64 r_ = math__exp(-z * z - 0.5625) * math__exp((z - x) * (z + x) + r / s); + if (sign) { + return 2.0 - r_ / x; + } + return r_ / x; + } + if (sign) { + return 2.0; + } + return 0.0; +} + +f64 math__exp(f64 x) { + f64 log2e = 1.44269504088896338700e+00; + f64 overflow = 7.09782712893383973096e+02; + f64 underflow = -7.45133219101941108420e+02; + f64 near_zero = 1.0 / (268435456); + if (math__is_nan(x) || math__is_inf(x, 1)) { + return x; + } + if (math__is_inf(x, -1)) { + return 0.0; + } + if (x > overflow) { + return math__inf(1); + } + if (x < underflow) { + return 0.0; + } + if (-near_zero < x && x < near_zero) { + return 1.0 + x; + } + int k = 0; + if (x < 0) { + k = ((int)(log2e * x - 0.5)); + } + if (x > 0) { + k = ((int)(log2e * x + 0.5)); + } + f64 hi = x - ((f64)(k)) * _const_math__ln2hi; + f64 lo = ((f64)(k)) * _const_math__ln2lo; + return math__expmulti(hi, lo, k); +} + +f64 math__exp2(f64 x) { + f64 overflow = 1.0239999999999999e+03; + f64 underflow = -1.0740e+03; + if (math__is_nan(x) || math__is_inf(x, 1)) { + return x; + } + if (math__is_inf(x, -1)) { + return 0; + } + if (x > overflow) { + return math__inf(1); + } + if (x < underflow) { + return 0; + } + int k = 0; + if (x > 0) { + k = ((int)(x + 0.5)); + } + if (x < 0) { + k = ((int)(x - 0.5)); + } + f64 t = x - ((f64)(k)); + f64 hi = t * _const_math__ln2hi; + f64 lo = -t * _const_math__ln2lo; + return math__expmulti(hi, lo, k); +} + +f64 math__ldexp(f64 frac, int exp) { + return math__scalbn(frac, exp); +} + +multi_return_f64_int math__frexp(f64 x) { + u64 y = math__f64_bits(x); + int ee = ((int)(((y >> 52U) & 0x7ffU))); + if (ee == 0) { + if (x != 0.0) { + f64 x1p64 = math__f64_from_bits(((u64)(0x43f0000000000000U))); + multi_return_f64_int mr_3352 = math__frexp(x * x1p64); + f64 z = mr_3352.arg0; + int e_ = mr_3352.arg1; + return (multi_return_f64_int){.arg0=z, .arg1=e_ - 64}; + } + return (multi_return_f64_int){.arg0=x, .arg1=0}; + } else if (ee == 0x7ff) { + return (multi_return_f64_int){.arg0=x, .arg1=0}; + } + int e_ = ee - 0x3fe; + y &= ((u64)(0x800fffffffffffffU)); + y |= ((u64)(0x3fe0000000000000U)); + return (multi_return_f64_int){.arg0=math__f64_from_bits(y), .arg1=e_}; +} + +f64 math__expm1(f64 x) { + if (math__is_inf(x, 1) || math__is_nan(x)) { + return x; + } + if (math__is_inf(x, -1)) { + return ((f64)(-1)); + } + if (math__abs_T_f64(x) < _const_math__ln2) { + f64 i = 1.0; + f64 sum = x; + f64 term = x / 1.0; + i++; + term *= x / ((f64)(i)); + sum += term; + for (;;) { + if (!(math__abs_T_f64(term) > math__abs_T_f64(sum) * _const_math__internal__f64_epsilon)) break; + i++; + term *= x / ((f64)(i)); + sum += term; + } + return sum; + } else { + return math__exp(x) - 1; + } + return 0; +} + +VV_LOCAL_SYMBOL f64 math__expmulti(f64 hi, f64 lo, int k) { + f64 exp_p1 = 1.66666666666666657415e-01; + f64 exp_p2 = -2.77777777770155933842e-03; + f64 exp_p3 = 6.61375632143793436117e-05; + f64 exp_p4 = -1.65339022054652515390e-06; + f64 exp_p5 = 4.13813679705723846039e-08; + f64 r = hi - lo; + f64 t = r * r; + f64 c = r - t * (exp_p1 + t * (exp_p2 + t * (exp_p3 + t * (exp_p4 + t * exp_p5)))); + f64 y = 1 - ((lo - (r * c) / (2 - c)) - hi); + return math__ldexp(y, k); +} + +f64 math__factorial(f64 n) { + if (n >= _const_math__factorials_table.len) { + return _const_math__max_f64; + } + if (n == ((f64)(((i64)(n)))) && n >= 0.0) { + return (*(f64*)/*ee elem_sym */array_get(_const_math__factorials_table, ((i64)(n)))); + } + return math__gamma(n + 1.0); +} + +f64 math__log_factorial(f64 n) { + if (n < 0) { + return -_const_math__max_f64; + } + if (n != ((f64)(((i64)(n))))) { + return math__log_gamma(n + 1); + } else if (n < _const_math__log_factorials_table.len) { + return (*(f64*)/*ee elem_sym */array_get(_const_math__log_factorials_table, ((i64)(n)))); + } + return math__log_factorial_asymptotic_expansion(((int)(n))); +} + +VV_LOCAL_SYMBOL f64 math__log_factorial_asymptotic_expansion(int n) { + int m = 6; + Array_f64 term = __new_array_with_default(0, 0, sizeof(f64), 0); + f64 xx = ((f64)((n + 1) * (n + 1))); + f64 xj = ((f64)(n + 1)); + f64 log_factorial = _const_math__log_sqrt_2pi - xj + (xj - 0.5) * math__log(xj); + int i = 0; + for (i = 0; i < m; i++) { + array_push((array*)&term, _MOV((f64[]){ (*(f64*)/*ee elem_sym */array_get(_const_math__bernoulli, i)) / xj })); + xj *= xx; + } + f64 sum = (*(f64*)/*ee elem_sym */array_get(term, m - 1)); + for (i = m - 2; i >= 0; i--) { + if (math__abs_T_f64(sum) <= math__abs_T_f64((*(f64*)/*ee elem_sym */array_get(term, i)))) { + break; + } + sum = (*(f64*)/*ee elem_sym */array_get(term, i)); + } + for (;;) { + if (!(i >= 0)) break; + sum += (*(f64*)/*ee elem_sym */array_get(term, i)); + i--; + } + return log_factorial + sum; +} + +i64 math__factoriali(int n) { + if (n <= 0) { + return ((i64)(1)); + } + if (n < 21) { + return ((i64)((*(f64*)/*ee elem_sym */array_get(_const_math__factorials_table, n)))); + } + return ((i64)(-1)); +} + +f64 math__floor(f64 x) { + if (x == 0 || math__is_nan(x) || math__is_inf(x, 0)) { + return x; + } + if (x < 0) { + multi_return_f64_f64 mr_280 = math__modf(-x); + f64 d = mr_280.arg0; + f64 fract = mr_280.arg1; + if (fract != 0.0) { + d = d + 1; + } + return -d; + } + multi_return_f64_f64 mr_350 = math__modf(x); + f64 d = mr_350.arg0; + return d; +} + +f64 math__ceil(f64 x) { + return -math__floor(-x); +} + +f64 math__trunc(f64 x) { + if (x == 0 || math__is_nan(x) || math__is_inf(x, 0)) { + return x; + } + multi_return_f64_f64 mr_793 = math__modf(x); + f64 d = mr_793.arg0; + return d; +} + +f64 math__round(f64 x) { + if (x == 0 || math__is_nan(x) || math__is_inf(x, 0)) { + return x; + } + f64 y = math__floor(x); + f64 r = x - y; + if (r > 0.5) { + { // Unsafe block + goto rndup; + } + } + if (r == 0.5) { + r = y - 2.0 * math__floor(0.5 * y); + if (r == 1.0) { + rndup: {} + y += 1.0; + } + } + return y; +} + +f64 math__round_to_even(f64 x) { + u64 bits = math__f64_bits(x); + u64 e_ = ((bits >> _const_math__shift) & _const_math__mask); + if (e_ >= _const_math__bias) { + u64 half_minus_ulp = ((u64)(((u64)(1U)) << (_const_math__shift - 1))) - 1U; + e_ -= ((u64)(_const_math__bias)); + bits += (half_minus_ulp + ((bits >> (_const_math__shift - e_)) & 1U)) >> e_; + bits &= _const_math__frac_mask >> e_; + bits ^= _const_math__frac_mask >> e_; + } else if (e_ == _const_math__bias - 1 && (bits & _const_math__frac_mask) != 0U) { + bits = ((bits & _const_math__sign_mask) | _const_math__uvone); + } else { + bits &= _const_math__sign_mask; + } + return math__f64_from_bits(bits); +} + +VV_LOCAL_SYMBOL multi_return_f64_f64 math__stirling(f64 x) { + if (x > 200) { + return (multi_return_f64_f64){.arg0=math__inf(1), .arg1=1.0}; + } + f64 sqrt_two_pi = 2.506628274631000502417; + f64 max_stirling = 143.01608; + f64 w = 1.0 / x; + w = 1.0 + w * (((((*(f64*)/*ee elem_sym */array_get(_const_math__gamma_s, 0)) * w + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_s, 1))) * w + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_s, 2))) * w + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_s, 3))) * w + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_s, 4))); + f64 y1 = math__exp(x); + f64 y2 = 1.0; + if (x > max_stirling) { + f64 v = math__pow(x, 0.5 * x - 0.25); + f64 y1_ = y1; + y1 = v; + y2 = v / y1_; + } else { + y1 = math__pow(x, x - 0.5) / y1; + } + return (multi_return_f64_f64){.arg0=y1, .arg1=((f64)(sqrt_two_pi)) * w * y2}; +} + +f64 math__gamma(f64 a) { + f64 x = a; + f64 euler = 0.57721566490153286060651209008240243104215933593992; + if (math__is_neg_int(x) || math__is_inf(x, -1) || math__is_nan(x)) { + return math__nan(); + } + if (math__is_inf(x, 1)) { + return math__inf(1); + } + if (x == 0.0) { + return math__copysign(math__inf(1), x); + } + f64 q = math__abs_T_f64(x); + f64 p = math__floor(q); + if (q > 33) { + if (x >= 0) { + multi_return_f64_f64 mr_1482 = math__stirling(x); + f64 y1 = mr_1482.arg0; + f64 y2 = mr_1482.arg1; + return y1 * y2; + } + int signgam = 1; + i64 ip = ((i64)(p)); + if (((ip & 1)) == 0) { + signgam = -1; + } + f64 z = q - p; + if (z > 0.5) { + p = p + 1; + z = q - p; + } + z = q * math__sin(_const_math__pi * z); + if (z == 0) { + return math__inf(signgam); + } + multi_return_f64_f64 mr_1927 = math__stirling(q); + f64 sq1 = mr_1927.arg0; + f64 sq2 = mr_1927.arg1; + f64 absz = math__abs_T_f64(z); + f64 d = absz * sq1 * sq2; + if (math__is_inf(d, 0)) { + z = _const_math__pi / absz / sq1 / sq2; + } else { + z = _const_math__pi / d; + } + return ((f64)(signgam)) * z; + } + f64 z = 1.0; + for (;;) { + if (!(x >= 3)) break; + x = x - 1; + z = z * x; + } + for (;;) { + if (!(x < 0)) break; + if (x > -1e-09) { + { // Unsafe block + goto _v_small; + } + } + z = z / x; + x = x + 1; + } + for (;;) { + if (!(x < 2)) break; + if (x < 1e-09) { + { // Unsafe block + goto _v_small; + } + } + z = z / x; + x = x + 1; + } + if (x == 2) { + return z; + } + x = x - 2; + p = (((((x * (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 0)) + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 1))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 2))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 3))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 4))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 5))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 6)); + q = ((((((x * (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 0)) + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 1))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 2))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 3))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 4))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 5))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 6))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 7)); + if (true) { + return z * p / q; + } + _v_small: {} + if (x == 0) { + return math__inf(1); + } + return z / ((1.0 + euler * x) * x); +} + +f64 math__log_gamma(f64 x) { + multi_return_f64_int mr_3045 = math__log_gamma_sign(x); + f64 y = mr_3045.arg0; + return y; +} + +multi_return_f64_int math__log_gamma_sign(f64 a) { + f64 x = a; + f64 ymin = 1.461632144968362245; + f64 tiny = math__exp2(-70); + f64 two52 = math__exp2(52); + f64 two58 = math__exp2(58); + f64 tc = 1.46163214496836224576e+00; + f64 tf = -1.21486290535849611461e-01; + f64 tt = -3.63867699703950536541e-18; + int sign = 1; + if (math__is_nan(x)) { + return (multi_return_f64_int){.arg0=x, .arg1=sign}; + } + if (math__is_inf(x, 1)) { + return (multi_return_f64_int){.arg0=x, .arg1=sign}; + } + if (x == 0.0) { + return (multi_return_f64_int){.arg0=math__inf(1), .arg1=sign}; + } + bool neg = false; + if (x < 0) { + x = -x; + neg = true; + } + if (x < tiny) { + if (neg) { + sign = -1; + } + return (multi_return_f64_int){.arg0=-math__log(x), .arg1=sign}; + } + f64 nadj = 0.0; + if (neg) { + if (x >= two52) { + return (multi_return_f64_int){.arg0=math__inf(1), .arg1=sign}; + } + f64 t = math__sin_pi(x); + if (t == 0) { + return (multi_return_f64_int){.arg0=math__inf(1), .arg1=sign}; + } + nadj = math__log(_const_math__pi / math__abs_T_f64(t * x)); + if (t < 0) { + sign = -1; + } + } + f64 lgamma = 0.0; + if (x == 1 || x == 2) { + return (multi_return_f64_int){.arg0=0.0, .arg1=sign}; + } else if (x < 2) { + f64 y = 0.0; + int i = 0; + if (x <= 0.9) { + lgamma = -math__log(x); + if (x >= (ymin - 1 + 0.27)) { + y = 1.0 - x; + i = 0; + } else if (x >= (ymin - 1 - 0.27)) { + y = x - (tc - 1); + i = 1; + } else { + y = x; + i = 2; + } + } else { + lgamma = 0; + if (x >= (ymin + 0.27)) { + y = ((f64)(2)) - x; + i = 0; + } else if (x >= (ymin - 0.27)) { + y = x - tc; + i = 1; + } else { + y = x - 1; + i = 2; + } + } + if (i == 0) { + f64 z = y * y; + f64 gamma_p1 = (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 0)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 2)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 4)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 6)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 8)) + z * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 10)))))); + f64 gamma_p2 = z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 1)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 3)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 5)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 7)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 9)) + z * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 11))))))); + f64 p = y * gamma_p1 + gamma_p2; + lgamma += (p - 0.5 * y); + } else if (i == 1) { + f64 z = y * y; + f64 w = z * y; + f64 gamma_p1 = (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 0)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 3)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 6)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 9)) + w * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 12))))); + f64 gamma_p2 = (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 1)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 4)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 7)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 10)) + w * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 13))))); + f64 gamma_p3 = (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 2)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 5)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 8)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 11)) + w * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 14))))); + f64 p = z * gamma_p1 - (tt - w * (gamma_p2 + y * gamma_p3)); + lgamma += (tf + p); + } else if (i == 2) { + f64 gamma_p1 = y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_u, 0)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_u, 1)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_u, 2)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_u, 3)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_u, 4)) + y * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_u, 5))))))); + f64 gamma_p2 = 1.0 + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_v, 1)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_v, 2)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_v, 3)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_v, 4)) + y * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_v, 5)))))); + lgamma += (-0.5 * y + gamma_p1 / gamma_p2); + } + } else if (x < 8) { + int i = ((int)(x)); + f64 y = x - ((f64)(i)); + f64 p = y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 0)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 1)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 2)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 3)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 4)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 5)) + y * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 6)))))))); + f64 q = 1.0 + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_r, 1)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_r, 2)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_r, 3)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_r, 4)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_r, 5)) + y * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_r, 6))))))); + lgamma = 0.5 * y + p / q; + f64 z = 1.0; + if (i == 7) { + z *= (y + 6); + z *= (y + 5); + z *= (y + 4); + z *= (y + 3); + z *= (y + 2); + lgamma += math__log(z); + } else if (i == 6) { + z *= (y + 5); + z *= (y + 4); + z *= (y + 3); + z *= (y + 2); + lgamma += math__log(z); + } else if (i == 5) { + z *= (y + 4); + z *= (y + 3); + z *= (y + 2); + lgamma += math__log(z); + } else if (i == 4) { + z *= (y + 3); + z *= (y + 2); + lgamma += math__log(z); + } else if (i == 3) { + z *= (y + 2); + lgamma += math__log(z); + } + } else if (x < two58) { + f64 t = math__log(x); + f64 z = 1.0 / x; + f64 y = z * z; + f64 w = (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 0)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 1)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 2)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 3)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 4)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 5)) + y * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 6))))))); + lgamma = (x - 0.5) * (t - 1.0) + w; + } else { + lgamma = x * (math__log(x) - 1.0); + } + if (neg) { + lgamma = nadj - lgamma; + } + return (multi_return_f64_int){.arg0=lgamma, .arg1=sign}; +} + +VV_LOCAL_SYMBOL f64 math__sin_pi(f64 x_) { + f64 x = x_; + f64 two52 = math__exp2(52); + f64 two53 = math__exp2(53); + if (x < 0.25) { + return -math__sin(_const_math__pi * x); + } + f64 z = math__floor(x); + int n = 0; + if (z != x) { + x = math__mod(x, 2); + n = ((int)(x * 4)); + } else { + if (x >= two53) { + x = 0; + n = 0; + } else { + if (x < two52) { + z = x + two52; + } + n = (1 & ((int)(math__f64_bits(z)))); + x = ((f64)(n)); + n <<= 2; + } + } + if (n == 0) { + x = math__sin(_const_math__pi * x); + } else if (n == 1 || n == 2) { + x = math__cos(_const_math__pi * (0.5 - x)); + } else if (n == 3 || n == 4) { + x = math__sin(_const_math__pi * (1.0 - x)); + } else if (n == 5 || n == 6) { + x = -math__cos(_const_math__pi * (x - 1.5)); + } else { + x = math__sin(_const_math__pi * (x - 2)); + } + return -x; +} + +f64 math__hypot(f64 x, f64 y) { + if (math__is_inf(x, 0) || math__is_inf(y, 0)) { + return math__inf(1); + } + if (math__is_nan(x) || math__is_nan(y)) { + return math__nan(); + } + f64 result = 0.0; + if (x != 0.0 || y != 0.0) { + f64 abs_x = math__abs_T_f64(x); + f64 abs_y = math__abs_T_f64(y); + multi_return_f64_f64 mr_240 = math__minmax(abs_x, abs_y); + f64 min = mr_240.arg0; + f64 max = mr_240.arg1; + f64 rat = min / max; + f64 root_term = math__sqrt(1.0 + rat * rat); + if (max < _const_math__max_f64 / root_term) { + result = max * root_term; + } else { + _v_panic(_SLIT("overflow in hypot_e function")); + VUNREACHABLE(); + } + } + return result; +} + +f64 math__acosh(f64 x) { + if (x == 0.0) { + return 0.0; + } else if (x > 1.0 / _const_math__internal__sqrt_f64_epsilon) { + return math__log(x) + _const_math__pi * 2; + } else if (x > 2.0) { + return math__log(2.0 * x - 1.0 / (math__sqrt(x * x - 1.0) + x)); + } else if (x > 1.0) { + f64 t = x - 1.0; + return math__log1p(t + math__sqrt(2.0 * t + t * t)); + } else if (x == 1.0) { + return 0.0; + } else { + return math__nan(); + } + return 0; +} + +f64 math__asinh(f64 x) { + f64 a = math__abs_T_f64(x); + f64 s = (x < 0 ? (-1.0) : (1.0)); + if (a > 1.0 / _const_math__internal__sqrt_f64_epsilon) { + return s * (math__log(a) + _const_math__pi * 2.0); + } else if (a > 2.0) { + return s * math__log(2.0 * a + 1.0 / (a + math__sqrt(a * a + 1.0))); + } else if (a > _const_math__internal__sqrt_f64_epsilon) { + f64 a2 = a * a; + return s * math__log1p(a + a2 / (1.0 + math__sqrt(1.0 + a2))); + } else { + return x; + } + return 0; +} + +f64 math__atanh(f64 x) { + f64 a = math__abs_T_f64(x); + f64 s = (x < 0 ? (-1.0) : (1.0)); + if (a > 1.0) { + return math__nan(); + } else if (a == 1.0) { + return (x < 0 ? (math__inf(-1)) : (math__inf(1))); + } else if (a >= 0.5) { + return s * 0.5 * math__log1p(2.0 * a / (1.0 - a)); + } else if (a > _const_math__internal__f64_epsilon) { + return s * 0.5 * math__log1p(2.0 * a + 2.0 * a * a / (1.0 - a)); + } else { + return x; + } + return 0; +} + +// Attr: [inline] +inline VV_LOCAL_SYMBOL f64 math__xatan(f64 x) { + f64 xatan_p0 = -8.750608600031904122785e-01; + f64 xatan_p1 = -1.615753718733365076637e+01; + f64 xatan_p2 = -7.500855792314704667340e+01; + f64 xatan_p3 = -1.228866684490136173410e+02; + f64 xatan_p4 = -6.485021904942025371773e+01; + f64 xatan_q0 = 2.485846490142306297962e+01; + f64 xatan_q1 = 1.650270098316988542046e+02; + f64 xatan_q2 = 4.328810604912902668951e+02; + f64 xatan_q3 = 4.853903996359136964868e+02; + f64 xatan_q4 = 1.945506571482613964425e+02; + f64 z = x * x; + z = z * ((((xatan_p0 * z + xatan_p1) * z + xatan_p2) * z + xatan_p3) * z + xatan_p4) / (((((z + xatan_q0) * z + xatan_q1) * z + xatan_q2) * z + xatan_q3) * z + xatan_q4); + z = x * z + x; + return z; +} + +// Attr: [inline] +inline VV_LOCAL_SYMBOL f64 math__satan(f64 x) { + if (x <= 0.66) { + return math__xatan(x); + } + if (x > _const_math__tan3pio8) { + return _const_math__pi / 2.0 - math__xatan(1.0 / x) + ((f64)(_const_math__morebits)); + } + return _const_math__pi / 4 + math__xatan((x - 1.0) / (x + 1.0)) + 0.5 * ((f64)(_const_math__morebits)); +} + +f64 math__atan(f64 x) { + if (x == 0) { + return x; + } + if (x > 0) { + return math__satan(x); + } + return -math__satan(-x); +} + +f64 math__atan2(f64 y, f64 x) { + if (math__is_nan(y) || math__is_nan(x)) { + return math__nan(); + } + if (y == 0.0) { + if (x >= 0 && !math__signbit(x)) { + return math__copysign(0, y); + } + return math__copysign(_const_math__pi, y); + } + if (x == 0.0) { + return math__copysign(_const_math__pi / 2.0, y); + } + if (math__is_inf(x, 0)) { + if (math__is_inf(x, 1)) { + if (math__is_inf(y, 0)) { + return math__copysign(_const_math__pi / 4, y); + } + return math__copysign(0, y); + } + if (math__is_inf(y, 0)) { + return math__copysign(3.0 * _const_math__pi / 4.0, y); + } + return math__copysign(_const_math__pi, y); + } + if (math__is_inf(y, 0)) { + return math__copysign(_const_math__pi / 2.0, y); + } + f64 q = math__atan(y / x); + if (x < 0) { + if (q <= 0) { + return q + _const_math__pi; + } + return q - _const_math__pi; + } + return q; +} + +f64 math__asin(f64 x_) { + f64 x = x_; + if (x == 0.0) { + return x; + } + bool sign = false; + if (x < 0.0) { + x = -x; + sign = true; + } + if (x > 1.0) { + return math__nan(); + } + f64 temp = math__sqrt(1.0 - x * x); + if (x > 0.7) { + temp = _const_math__pi / 2.0 - math__satan(temp / x); + } else { + temp = math__satan(x / temp); + } + if (sign) { + temp = -temp; + } + return temp; +} + +// Attr: [inline] +inline f64 math__acos(f64 x) { + if ((x < -1.0) || (x > 1.0)) { + return math__nan(); + } + if (x > 0.5) { + return ((f64)(2.0)) * math__asin(math__sqrt(0.5 - 0.5 * x)); + } + f64 z = _const_math__pi / ((f64)(4.0)) - math__asin(x); + z = z + _const_math__morebits; + z = z + _const_math__pi / ((f64)(4.0)); + return z; +} + +f64 math__log_n(f64 x, f64 b) { + f64 y = math__log(x); + f64 z = math__log(b); + return y / z; +} + +f64 math__log10(f64 x) { + return math__log(x) * (1.0 / _const_math__ln10); +} + +f64 math__log2(f64 x) { + multi_return_f64_int mr_364 = math__frexp(x); + f64 frac = mr_364.arg0; + int exp = mr_364.arg1; + if (frac == 0.5) { + return ((f64)(exp - 1)); + } + return math__log(frac) * (1.0 / _const_math__ln2) + ((f64)(exp)); +} + +f64 math__log1p(f64 x) { + f64 y = 1.0 + x; + f64 z = y - 1.0; + return math__log(y) - (z - x) / y; +} + +f64 math__log_b(f64 x) { + if (x == 0) { + return math__inf(-1); + } + if (math__is_inf(x, 0)) { + return math__inf(1); + } + if (math__is_nan(x)) { + return x; + } + return ((f64)(math__ilog_b_(x))); +} + +int math__ilog_b(f64 x) { + if (x == 0) { + return _const_math__min_i32; + } + if (math__is_nan(x)) { + return _const_math__max_i32; + } + if (math__is_inf(x, 0)) { + return _const_math__max_i32; + } + return math__ilog_b_(x); +} + +VV_LOCAL_SYMBOL int math__ilog_b_(f64 x_) { + multi_return_f64_int mr_1424 = math__normalize(x_); + f64 x = mr_1424.arg0; + int exp = mr_1424.arg1; + return ((int)(((math__f64_bits(x) >> _const_math__shift) & _const_math__mask))) - _const_math__bias + exp; +} + +f64 math__log(f64 a) { + f64 ln2_hi = 6.93147180369123816490e-01; + f64 ln2_lo = 1.90821492927058770002e-10; + f64 l1 = 6.666666666666735130e-01; + f64 l2 = 3.999999999940941908e-01; + f64 l3 = 2.857142874366239149e-01; + f64 l4 = 2.222219843214978396e-01; + f64 l5 = 1.818357216161805012e-01; + f64 l6 = 1.531383769920937332e-01; + f64 l7 = 1.479819860511658591e-01; + f64 x = a; + if (math__is_nan(x) || math__is_inf(x, 1)) { + return x; + } else if (x < 0) { + return math__nan(); + } else if (x == 0) { + return math__inf(-1); + } + multi_return_f64_int mr_4006 = math__frexp(x); + f64 f1 = mr_4006.arg0; + int ki = mr_4006.arg1; + if (f1 < _const_math__sqrt2 / 2) { + f1 *= 2; + ki--; + } + f64 f = f1 - 1; + f64 k = ((f64)(ki)); + f64 s = f / (2 + f); + f64 s2 = s * s; + f64 s4 = s2 * s2; + f64 t1 = s2 * (l1 + s4 * (l3 + s4 * (l5 + s4 * l7))); + f64 t2 = s4 * (l2 + s4 * (l4 + s4 * l6)); + f64 r = t1 + t2; + f64 hfsq = 0.5 * f * f; + return k * ln2_hi - ((hfsq - (s * (hfsq + r) + k * ln2_lo)) - f); +} + +#if defined(_WIN32) +#else +#endif +f64 math__aprox_sin(f64 a) { + f64 a0 = 1.91059300966915117e-31; + f64 a1 = 1.00086760103908896; + f64 a2 = -1.21276126894734565e-2; + f64 a3 = -1.38078780785773762e-1; + f64 a4 = -2.67353392911981221e-2; + f64 a5 = 2.08026600266304389e-2; + f64 a6 = -3.03996055049204407e-3; + f64 a7 = 1.38235642404333740e-4; + return a0 + a * (a1 + a * (a2 + a * (a3 + a * (a4 + a * (a5 + a * (a6 + a * a7)))))); +} + +f64 math__aprox_cos(f64 a) { + f64 a0 = 9.9995999154986614e-1; + f64 a1 = 1.2548995793001028e-3; + f64 a2 = -5.0648546280678015e-1; + f64 a3 = 1.2942246466519995e-2; + f64 a4 = 2.8668384702547972e-2; + f64 a5 = 7.3726485210586547e-3; + f64 a6 = -3.8510875386947414e-3; + f64 a7 = 4.7196604604366623e-4; + f64 a8 = -1.8776444013090451e-5; + return a0 + a * (a1 + a * (a2 + a * (a3 + a * (a4 + a * (a5 + a * (a6 + a * (a7 + a * a8))))))); +} + +// Attr: [inline] +inline f64 math__copysign(f64 x, f64 y) { + return math__f64_from_bits((((math__f64_bits(x) & ~_const_math__sign_mask)) | ((math__f64_bits(y) & _const_math__sign_mask)))); +} + +// Attr: [inline] +inline f64 math__degrees(f64 radians) { + return radians * (180.0 / _const_math__pi); +} + +Array_int math__digits(i64 num, math__DigitParams params) { + int b = params.base; + if (b < 2) { + _v_panic( str_intp(2, _MOV((StrIntpData[]){{_SLIT("digits: Cannot find digits of n with base "), 0xfe07, {.d_i32 = b}}, {_SLIT0, 0, { .d_c = 0 }}}))); + VUNREACHABLE(); + } + i64 n = num; + int sign = 1; + if (n < 0) { + sign = -1; + n = -n; + } + Array_int res = __new_array_with_default(0, 0, sizeof(int), 0); + if (n == 0) { + array_push((array*)&res, _MOV((int[]){ 0 })); + return res; + } + for (;;) { + if (!(n != 0)) break; + i64 next_n = n / b; + array_push((array*)&res, _MOV((int[]){ ((int)(n - next_n * b)) })); + n = next_n; + } + if (sign == -1) { + (*(int*)array_get(res, res.len - 1)) *= sign; + } + if (params.reverse) { + res = array_reverse(res); + } + return res; +} + +int math__count_digits(i64 number) { + i64 n = number; + if (n == 0) { + return 1; + } + int c = 0; + for (;;) { + if (!(n != 0)) break; + n = n / 10; + c++; + } + return c; +} + +multi_return_f64_f64 math__minmax(f64 a, f64 b) { + if (a < b) { + return (multi_return_f64_f64){.arg0=a, .arg1=b}; + } + return (multi_return_f64_f64){.arg0=b, .arg1=a}; +} + +// Attr: [inline] +inline f64 math__clamp(f64 x, f64 a, f64 b) { + if (x < a) { + return a; + } + if (x > b) { + return b; + } + return x; +} + +// Attr: [inline] +inline f64 math__sign(f64 n) { + if (math__is_nan(n)) { + return math__nan(); + } + return math__copysign(1.0, n); +} + +// Attr: [inline] +inline int math__signi(f64 n) { + return ((int)(math__copysign(1.0, n))); +} + +// Attr: [inline] +inline f64 math__radians(f64 degrees) { + return degrees * (_const_math__pi / 180.0); +} + +// Attr: [inline] +inline bool math__signbit(f64 x) { + return (math__f64_bits(x) & _const_math__sign_mask) != 0U; +} + +bool math__tolerance(f64 a, f64 b, f64 tol) { + f64 ee = tol; + if (a == b) { + return true; + } + f64 d = a - b; + if (d < 0) { + d = -d; + } + if (b != 0) { + ee = ee * b; + if (ee < 0) { + ee = -ee; + } + } + return d < ee; +} + +bool math__close(f64 a, f64 b) { + return math__tolerance(a, b, 1e-14); +} + +bool math__veryclose(f64 a, f64 b) { + return math__tolerance(a, b, 4e-16); +} + +bool math__alike(f64 a, f64 b) { + if (math__is_nan(a) && math__is_nan(b)) { + return true; + } else if (a == b) { + return math__signbit(a) == math__signbit(b); + } + return false; +} + +VV_LOCAL_SYMBOL bool math__is_odd_int(f64 x) { + multi_return_f64_f64 mr_4654 = math__modf(x); + f64 xi = mr_4654.arg0; + f64 xf = mr_4654.arg1; + return xf == 0 && ((((i64)(xi)) & 1)) == 1; +} + +VV_LOCAL_SYMBOL bool math__is_neg_int(f64 x) { + if (x < 0) { + multi_return_f64_f64 mr_4754 = math__modf(x); + f64 xf = mr_4754.arg1; + return xf == 0; + } + return false; +} + +// Attr: [inline] +inline int math__min_T_int(int a, int b) { + return (a < b ? (a) : (b)); +} + +// Attr: [inline] +inline f64 math__abs_T_f64(f64 a) { + return (a < 0 ? (-a) : (a)); +} + +multi_return_f64_f64 math__modf(f64 f) { + f64 abs_f = math__abs_T_f64(f); + f64 i = 0.0; + if (abs_f >= _const_math__modf_maxpowtwo) { + i = f; + } else { + i = abs_f + _const_math__modf_maxpowtwo; + i -= _const_math__modf_maxpowtwo; + for (;;) { + if (!(i > abs_f)) break; + i -= 1.0; + } + if (f < 0.0) { + i = -i; + } + } + return (multi_return_f64_f64){.arg0=i, .arg1=f - i}; +} + +f32 math__nextafter32(f32 x, f32 y) { + f32 r = ((f32)(0.0)); + if (math__is_nan(((f64)(x))) || math__is_nan(((f64)(y)))) { + r = ((f32)(math__nan())); + } else if (x == y) { + r = x; + } else if (x == 0) { + r = ((f32)(math__copysign(((f64)(math__f32_from_bits(1U))), ((f64)(y))))); + } else if ((y > x) == (x > 0)) { + r = math__f32_from_bits(math__f32_bits(x) + 1U); + } else { + r = math__f32_from_bits(math__f32_bits(x) - 1U); + } + return r; +} + +f64 math__nextafter(f64 x, f64 y) { + f64 r = 0.0; + if (math__is_nan(x) || math__is_nan(y)) { + r = math__nan(); + } else if (x == y) { + r = x; + } else if (x == 0) { + r = math__copysign(math__f64_from_bits(1U), y); + } else if ((y > x) == (x > 0)) { + r = math__f64_from_bits(math__f64_bits(x) + 1U); + } else { + r = math__f64_from_bits(math__f64_bits(x) - 1U); + } + return r; +} + +VV_LOCAL_SYMBOL f64 math__poly_n_eval(Array_f64 c, int n, f64 x) { + if (c.len == 0) { + _v_panic(_SLIT("coeficients can not be empty")); + VUNREACHABLE(); + } + int len = ((int)(math__min_T_int(c.len, n))); + f64 ans = (*(f64*)/*ee elem_sym */array_get(c, len - 1)); + Array_f64 _t1 = array_slice(c, 0, len - 1); + for (int _t2 = 0; _t2 < _t1.len; ++_t2) { + f64 e = ((f64*)_t1.data)[_t2]; + ans = e + x * ans; + } + return ans; +} + +VV_LOCAL_SYMBOL f64 math__poly_n_1_eval(Array_f64 c, int n, f64 x) { + if (c.len == 0) { + _v_panic(_SLIT("coeficients can not be empty")); + VUNREACHABLE(); + } + int len = ((int)(math__min_T_int(c.len, n))) - 1; + f64 ans = (*(f64*)/*ee elem_sym */array_get(c, len - 1)); + Array_f64 _t1 = array_slice(c, 0, len - 1); + for (int _t2 = 0; _t2 < _t1.len; ++_t2) { + f64 e = ((f64*)_t1.data)[_t2]; + ans = e + x * ans; + } + return ans; +} + +// Attr: [inline] +inline VV_LOCAL_SYMBOL f64 math__poly_eval(Array_f64 c, f64 x) { + return math__poly_n_eval(c, c.len, x); +} + +// Attr: [inline] +inline VV_LOCAL_SYMBOL f64 math__poly_1_eval(Array_f64 c, f64 x) { + return math__poly_n_1_eval(c, c.len, x); +} + +VV_LOCAL_SYMBOL multi_return_f64_f64 math__ChebSeries_eval_e(math__ChebSeries cs, f64 x) { + f64 d = 0.0; + f64 dd = 0.0; + f64 y = (2.0 * x - cs.a - cs.b) / (cs.b - cs.a); + f64 y2 = 2.0 * y; + f64 e_ = 0.0; + f64 temp = 0.0; + for (int j = cs.order; j >= 1; j--) { + temp = d; + d = y2 * d - dd + (*(f64*)/*ee elem_sym */array_get(cs.c, j)); + e_ += math__abs_T_f64(y2 * temp) + math__abs_T_f64(dd) + math__abs_T_f64((*(f64*)/*ee elem_sym */array_get(cs.c, j))); + dd = temp; + } + temp = d; + d = y * d - dd + 0.5 * (*(f64*)/*ee elem_sym */array_get(cs.c, 0)); + e_ += math__abs_T_f64(y * temp) + math__abs_T_f64(dd) + 0.5 * math__abs_T_f64((*(f64*)/*ee elem_sym */array_get(cs.c, 0))); + return (multi_return_f64_f64){.arg0=d, .arg1=((f64)(_const_math__internal__f64_epsilon)) * e_ + math__abs_T_f64((*(f64*)/*ee elem_sym */array_get(cs.c, cs.order)))}; +} + +// Attr: [inline] +inline f32 math__powf(f32 a, f32 b) { + return powf(a, b); +} + +// Attr: [inline] +inline f32 math__pure_v_but_overriden_by_c_powf(f32 a, f32 b) { + return ((f32)(math__pow(a, b))); +} + +f64 math__pow10(int n) { + if (0 <= n && n <= 308) { + return (*(f64*)/*ee elem_sym */array_get(_const_math__pow10postab32, ((u32)(n)) / 32U)) * (*(f64*)/*ee elem_sym */array_get(_const_math__pow10tab, ((u32)(n)) % 32U)); + } + if (-323 <= n && n <= 0) { + return (*(f64*)/*ee elem_sym */array_get(_const_math__pow10negtab32, ((u32)(-n)) / 32U)) / (*(f64*)/*ee elem_sym */array_get(_const_math__pow10tab, ((u32)(-n)) % 32U)); + } + if (n > 0) { + return math__inf(1); + } + return 0.0; +} + +i64 math__powi(i64 a, i64 b) { + i64 b_ = b; + i64 p = a; + i64 v = ((i64)(1)); + if (b_ < 0) { + if (a == 0) { + return -1; + } + return (a * a != 1 ? (0) : ((((b_ & 1)) > 0 ? (a) : (1)))); + } + for (; b_ > 0; ) { + if ((b_ & 1) > 0) { + v *= p; + } + p *= p; + b_ >>= 1; + } + return v; +} + +f64 math__pow(f64 x, f64 y) { + if (y == 0 || x == 1) { + return 1; + } else if (y == 1) { + return x; + } else if (math__is_nan(x) || math__is_nan(y)) { + return math__nan(); + } else if (x == 0) { + if (y < 0) { + if (math__is_odd_int(y)) { + return math__copysign(math__inf(1), x); + } + return math__inf(1); + } else if (y > 0) { + if (math__is_odd_int(y)) { + return x; + } + return 0; + } + } else if (math__is_inf(y, 0)) { + if (x == -1) { + return 1; + } else if ((math__abs_T_f64(x) < 1) == math__is_inf(y, 1)) { + return 0; + } else { + return math__inf(1); + } + } else if (math__is_inf(x, 0)) { + if (math__is_inf(x, -1)) { + return math__pow(1 / x, -y); + } + if (y < 0) { + return 0; + } else if (y > 0) { + return math__inf(1); + } + } else if (y == 0.5) { + return math__sqrt(x); + } else if (y == -0.5) { + return 1 / math__sqrt(x); + } + multi_return_f64_f64 mr_2400 = math__modf(math__abs_T_f64(y)); + f64 yi = mr_2400.arg0; + f64 yf = mr_2400.arg1; + if (yf != 0 && x < 0) { + return math__nan(); + } + if (yi >= (((u64)(1U)) << 63U)) { + if (x == -1) { + return 1; + } else if ((math__abs_T_f64(x) < 1) == (y > 0)) { + return 0; + } else { + return math__inf(1); + } + } + f64 a1 = 1.0; + int ae = 0; + if (yf != 0) { + if (yf > 0.5) { + yf--; + yi++; + } + a1 = math__exp(yf * math__log(x)); + } + multi_return_f64_int mr_3038 = math__frexp(x); + f64 x1 = mr_3038.arg0; + int xe = mr_3038.arg1; + for (i64 i = ((i64)(yi)); i != 0; i >>= 1) { + if (xe < ((int)(((u32)(((u32)(-1)) << 12U)))) || 4096 < xe) { + ae += xe; + break; + } + if ((i & 1) == 1) { + a1 *= x1; + ae += xe; + } + x1 *= x1; + xe <<= 1; + if (x1 < .5) { + x1 += x1; + xe--; + } + } + if (y < 0) { + a1 = 1 / a1; + ae = -ae; + } + return math__ldexp(a1, ae); +} + +// Attr: [inline] +inline f64 math__q_rsqrt(f64 x) { + f64 x_half = 0.5 * x; + i64 i = ((i64)(math__f64_bits(x))); + i = 0x5fe6eb50c7b537a9 - (i >> 1); + f64 j = math__f64_from_bits(((u64)(i))); + j *= (1.5 - x_half * j * j); + j *= (1.5 - x_half * j * j); + return j; +} + +f64 math__scalbn(f64 x, int n_) { + int n = n_; + f64 x1p1023 = math__f64_from_bits(((u64)(0x7fe0000000000000U))); + f64 x1p53 = math__f64_from_bits(((u64)(0x4340000000000000U))); + f64 x1p_1022 = math__f64_from_bits(((u64)(0x0010000000000000U))); + f64 y = x; + if (n > 1023) { + y *= x1p1023; + n -= 1023; + if (n > 1023) { + y *= x1p1023; + n -= 1023; + if (n > 1023) { + n = 1023; + } + } + } else if (n < -1022) { + y *= x1p_1022 * x1p53; + n += 969; + if (n < -1022) { + y *= x1p_1022 * x1p53; + n += 969; + if (n < -1022) { + n = -1022; + } + } + } + return y * math__f64_from_bits(((u64)((0x3ff + n))) << 52U); +} + +// Attr: [inline] +inline f32 math__cosf(f32 a) { + return cosf(a); +} + +// Attr: [inline] +inline f32 math__sinf(f32 a) { + return sinf(a); +} + +f64 math__sin(f64 x) { + f64 p1 = 7.85398125648498535156e-1; + f64 p2 = 3.77489470793079817668e-8; + f64 p3 = 2.69515142907905952645e-15; + int sgn_x = (x < 0 ? (-1) : (1)); + f64 abs_x = math__abs_T_f64(x); + if (abs_x < _const_math__internal__root4_f64_epsilon) { + f64 x2 = x * x; + return x * (1.0 - x2 / 6.0); + } else { + int sgn_result = sgn_x; + f64 y = math__floor(abs_x / (0.25 * _const_math__pi)); + int octant = ((int)(y - math__ldexp(math__floor(math__ldexp(y, -3)), 3))); + if (((octant & 1)) == 1) { + octant++; + octant &= 7; + y += 1.0; + } + if (octant > 3) { + octant -= 4; + sgn_result = -sgn_result; + } + f64 z = ((abs_x - y * p1) - y * p2) - y * p3; + f64 result = 0.0; + if (octant == 0) { + f64 t = 8.0 * math__abs_T_f64(z) / _const_math__pi - 1.0; + multi_return_f64_f64 mr_1676 = math__ChebSeries_eval_e(_const_math__sin_cs, t); + f64 sin_cs_val = mr_1676.arg0; + result = z * (1.0 + z * z * sin_cs_val); + } else { + f64 t = 8.0 * math__abs_T_f64(z) / _const_math__pi - 1.0; + multi_return_f64_f64 mr_1804 = math__ChebSeries_eval_e(_const_math__cos_cs, t); + f64 cos_cs_val = mr_1804.arg0; + result = 1.0 - 0.5 * z * z * (1.0 - z * z * cos_cs_val); + } + result *= sgn_result; + return result; + } + return 0; +} + +f64 math__cos(f64 x) { + f64 p1 = 7.85398125648498535156e-1; + f64 p2 = 3.77489470793079817668e-8; + f64 p3 = 2.69515142907905952645e-15; + f64 abs_x = math__abs_T_f64(x); + if (abs_x < _const_math__internal__root4_f64_epsilon) { + f64 x2 = x * x; + return 1.0 - 0.5 * x2; + } else { + int sgn_result = 1; + f64 y = math__floor(abs_x / (0.25 * _const_math__pi)); + int octant = ((int)(y - math__ldexp(math__floor(math__ldexp(y, -3)), 3))); + if (((octant & 1)) == 1) { + octant++; + octant &= 7; + y += 1.0; + } + if (octant > 3) { + octant -= 4; + sgn_result = -sgn_result; + } + if (octant > 1) { + sgn_result = -sgn_result; + } + f64 z = ((abs_x - y * p1) - y * p2) - y * p3; + f64 result = 0.0; + if (octant == 0) { + f64 t = 8.0 * math__abs_T_f64(z) / _const_math__pi - 1.0; + multi_return_f64_f64 mr_2597 = math__ChebSeries_eval_e(_const_math__cos_cs, t); + f64 cos_cs_val = mr_2597.arg0; + result = 1.0 - 0.5 * z * z * (1.0 - z * z * cos_cs_val); + } else { + f64 t = 8.0 * math__abs_T_f64(z) / _const_math__pi - 1.0; + multi_return_f64_f64 mr_2741 = math__ChebSeries_eval_e(_const_math__sin_cs, t); + f64 sin_cs_val = mr_2741.arg0; + result = z * (1.0 + z * z * sin_cs_val); + } + result *= sgn_result; + return result; + } + return 0; +} + +// Attr: [inline] +inline f32 math__pure_v_but_overriden_by_c_cosf(f32 a) { + return ((f32)(math__cos(a))); +} + +// Attr: [inline] +inline f32 math__pure_v_but_overriden_by_c_sinf(f32 a) { + return ((f32)(math__sin(a))); +} + +multi_return_f64_f64 math__sincos(f64 x) { + f64 p1 = 7.85398125648498535156e-1; + f64 p2 = 3.77489470793079817668e-8; + f64 p3 = 2.69515142907905952645e-15; + int sgn_x = (x < 0 ? (-1) : (1)); + f64 abs_x = math__abs_T_f64(x); + if (abs_x < _const_math__internal__root4_f64_epsilon) { + f64 x2 = x * x; + return (multi_return_f64_f64){.arg0=x * (1.0 - x2 / 6.0), .arg1=1.0 - 0.5 * x2}; + } else { + int sgn_result_sin = sgn_x; + int sgn_result_cos = 1; + f64 y = math__floor(abs_x / (0.25 * _const_math__pi)); + int octant = ((int)(y - math__ldexp(math__floor(math__ldexp(y, -3)), 3))); + if (((octant & 1)) == 1) { + octant++; + octant &= 7; + y += 1.0; + } + if (octant > 3) { + octant -= 4; + sgn_result_sin = -sgn_result_sin; + sgn_result_cos = -sgn_result_cos; + } + sgn_result_cos = (octant > 1 ? (-sgn_result_cos) : (sgn_result_cos)); + f64 z = ((abs_x - y * p1) - y * p2) - y * p3; + f64 t = 8.0 * math__abs_T_f64(z) / _const_math__pi - 1.0; + multi_return_f64_f64 mr_3838 = math__ChebSeries_eval_e(_const_math__sin_cs, t); + f64 sin_cs_val = mr_3838.arg0; + multi_return_f64_f64 mr_3879 = math__ChebSeries_eval_e(_const_math__cos_cs, t); + f64 cos_cs_val = mr_3879.arg0; + f64 result_sin = 0.0; + f64 result_cos = 0.0; + if (octant == 0) { + result_sin = z * (1.0 + z * z * sin_cs_val); + result_cos = 1.0 - 0.5 * z * z * (1.0 - z * z * cos_cs_val); + } else { + result_sin = 1.0 - 0.5 * z * z * (1.0 - z * z * cos_cs_val); + result_cos = z * (1.0 + z * z * sin_cs_val); + } + result_sin *= sgn_result_sin; + result_cos *= sgn_result_cos; + return (multi_return_f64_f64){.arg0=result_sin, .arg1=result_cos}; + } + return (multi_return_f64_f64){0}; +} + +f64 math__sinh(f64 x_) { + f64 x = x_; + f64 p0 = -0.6307673640497716991184787251e+6; + f64 p1 = -0.8991272022039509355398013511e+5; + f64 p2 = -0.2894211355989563807284660366e+4; + f64 p3 = -0.2630563213397497062819489e+2; + f64 q0 = -0.6307673640497716991212077277e+6; + f64 q1 = 0.1521517378790019070696485176e+5; + f64 q2 = -0.173678953558233699533450911e+3; + bool sign = false; + if (x < 0) { + x = -x; + sign = true; + } + f64 temp = 0.0; + if (x > 21) { + temp = math__exp(x) * 0.5; + } else if (x > 0.5) { + f64 ex = math__exp(x); + temp = (ex - 1.0 / ex) * 0.5; + } else { + f64 sq = x * x; + temp = (((p3 * sq + p2) * sq + p1) * sq + p0) * x; + temp = temp / (((sq + q2) * sq + q1) * sq + q0); + } + if (sign) { + temp = -temp; + } + return temp; +} + +f64 math__cosh(f64 x) { + f64 abs_x = math__abs_T_f64(x); + if (abs_x > 21) { + return math__exp(abs_x) * 0.5; + } + f64 ex = math__exp(abs_x); + return (ex + 1.0 / ex) * 0.5; +} + +// Attr: [inline] +inline f32 math__sqrtf(f32 a) { + return sqrtf(a); +} + +// Attr: [inline] +inline f64 math__sqrt(f64 a) { + f64 x = a; + if (x == 0.0 || math__is_nan(x) || math__is_inf(x, 1)) { + return x; + } + if (x < 0.0) { + return math__nan(); + } + multi_return_f64_int mr_258 = math__frexp(x); + f64 z = mr_258.arg0; + int ex = mr_258.arg1; + f64 w = x; + x = 4.173075996388649989089e-1 + 5.9016206709064458299663e-1 * z; + if (((ex & 1)) != 0) { + x *= _const_math__sqrt2; + } + x = math__ldexp(x, ex >> 1); + x = 0.5 * (x + w / x); + x = 0.5 * (x + w / x); + x = 0.5 * (x + w / x); + return x; +} + +// Attr: [inline] +inline f32 math__pure_v_but_overriden_by_c_sqrtf(f32 a) { + return ((f32)(math__sqrt(a))); +} + +i64 math__sqrti(i64 a) { + i64 x = a; + i64 q = ((i64)(1)); + i64 r = ((i64)(0)); + for (; q <= x; ) { + q <<= 2; + } + for (; q > 1; ) { + q >>= 2; + i64 t = x - r - q; + r >>= 1; + if (t >= 0) { + x = t; + r += q; + } + } + return r; +} + +// Attr: [inline] +inline f32 math__tanf(f32 a) { + return tanf(a); +} + +f64 math__tan(f64 a) { + f64 x = a; + if (x == 0.0 || math__is_nan(x)) { + return x; + } + if (math__is_inf(x, 0)) { + return math__nan(); + } + int sign = 1; + if (x < 0) { + x = -x; + sign = -1; + } + if (x > _const_math__tan_lossth) { + return 0.0; + } + f64 y = math__floor(x * 4.0 / _const_math__pi); + f64 z = math__ldexp(y, -3); + z = math__floor(z); + z = y - math__ldexp(z, 3); + int octant = ((int)(z)); + if (((octant & 1)) == 1) { + octant++; + y += 1.0; + } + z = ((x - y * _const_math__tan_dp1) - y * _const_math__tan_dp2) - y * _const_math__tan_dp3; + f64 zz = z * z; + if (zz > 1.0e-14) { + y = z + z * (zz * ((((*(f64*)/*ee elem_sym */array_get(_const_math__tan_p, 0)) * zz) + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_p, 1))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_p, 2))) / ((((zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 1))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 2))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 3))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 4)))); + } else { + y = z; + } + if (((octant & 2)) == 2) { + y = -1.0 / y; + } + if (sign < 0) { + y = -y; + } + return y; +} + +// Attr: [inline] +inline f32 math__pure_v_but_overriden_by_c_tanf(f32 a) { + return ((f32)(math__tan(a))); +} + +f64 math__cot(f64 a) { + f64 x = a; + if (x == 0.0) { + return math__inf(1); + } + int sign = 1; + if (x < 0) { + x = -x; + sign = -1; + } + if (x > _const_math__tan_lossth) { + return 0.0; + } + f64 y = math__floor(x * 4.0 / _const_math__pi); + f64 z = math__ldexp(y, -3); + z = math__floor(z); + z = y - math__ldexp(z, 3); + int octant = ((int)(z)); + if (((octant & 1)) == 1) { + octant++; + y += 1.0; + } + z = ((x - y * _const_math__tan_dp1) - y * _const_math__tan_dp2) - y * _const_math__tan_dp3; + f64 zz = z * z; + if (zz > 1.0e-14) { + y = z + z * (zz * ((((*(f64*)/*ee elem_sym */array_get(_const_math__tan_p, 0)) * zz) + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_p, 1))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_p, 2))) / ((((zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 1))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 2))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 3))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 4)))); + } else { + y = z; + } + if (((octant & 2)) == 2) { + y = -y; + } else { + y = 1.0 / y; + } + if (sign < 0) { + y = -y; + } + return y; +} + +f64 math__tanh(f64 x) { + f64 maxlog = 8.8029691931113054295988e+01; + f64 z = math__abs_T_f64(x); + if (z > 0.5 * maxlog) { + if (x < 0) { + return ((f64)(-1)); + } + return 1.0; + } else if (z >= 0.625) { + f64 s = math__exp(2.0 * z); + z = 1.0 - 2.0 / (s + 1.0); + if (x < 0) { + z = -z; + } + } else { + if (x == 0) { + return x; + } + f64 s = x * x; + z = x + x * s * (((*(f64*)/*ee elem_sym */array_get(_const_math__tanh_p, 0)) * s + (*(f64*)/*ee elem_sym */array_get(_const_math__tanh_p, 1))) * s + (*(f64*)/*ee elem_sym */array_get(_const_math__tanh_p, 2))) / (((s + (*(f64*)/*ee elem_sym */array_get(_const_math__tanh_q, 0))) * s + (*(f64*)/*ee elem_sym */array_get(_const_math__tanh_q, 1))) * s + (*(f64*)/*ee elem_sym */array_get(_const_math__tanh_q, 2))); + } + return z; +} + +u32 math__f32_bits(f32 f) { + u32 p = *((u32*)(&f)); + return p; +} + +f32 math__f32_from_bits(u32 b) { + f32 p = *((f32*)(&b)); + return p; +} + +u64 math__f64_bits(f64 f) { + u64 p = *((u64*)(&f)); + return p; +} + +f64 math__f64_from_bits(u64 b) { + f64 p = *((f64*)(&b)); + return p; +} + +f64 math__with_set_low_word(f64 f, u32 lo) { + u64 tmp = math__f64_bits(f); + tmp &= 0xffffffff00000000U; + tmp |= ((u64)(lo)); + return math__f64_from_bits(tmp); +} + +f64 math__with_set_high_word(f64 f, u32 hi) { + u64 tmp = math__f64_bits(f); + tmp &= 0x00000000ffffffffU; + tmp |= ((u64)(hi)) << 32U; + return math__f64_from_bits(tmp); +} + +u32 math__get_high_word(f64 f) { + return ((u32)(math__f64_bits(f) >> 32U)); } string term__format(string msg, string open, string close) { @@ -31561,119 +32635,1493 @@ VV_LOCAL_SYMBOL int v__vcache__mypid(void) { return _t1; } -Option_string v__util__diff__find_working_diff_command(void) { - string env_difftool = os__getenv(_SLIT("VDIFF_TOOL")); - string env_diffopts = os__getenv(_SLIT("VDIFF_OPTIONS")); - if ((env_difftool).len != 0) { - Option_string _t1; - opt_ok(&(string[]) { str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = env_difftool}}, {_SLIT(" "), 0xfe10, {.d_s = env_diffopts}}, {_SLIT0, 0, { .d_c = 0 }}})) }, (Option*)(&_t1), sizeof(string)); - return _t1; +i64 time__portable_timegm(struct tm* t) { + int year = t->tm_year + 1900; + int month = t->tm_mon; + if (month > 11) { + year += month / 12; + month %= 12; + } else if (month < 0) { + int years_diff = (11 - month) / 12; + year -= years_diff; + month += 12 * years_diff; } - Array_string known_diff_tools = __new_array_with_default(0, 0, sizeof(string), 0); - if (env_difftool.len > 0) { - array_push((array*)&known_diff_tools, _MOV((string[]){ string_clone(env_difftool) })); - } - _PUSH_MANY(&known_diff_tools, (new_array_from_c_array(8, 8, sizeof(string), _MOV((string[8]){_SLIT("colordiff"), _SLIT("gdiff"), _SLIT("diff"), _SLIT("colordiff.exe"), _SLIT("diff.exe"), _SLIT("opendiff"), _SLIT("code"), _SLIT("code.cmd")}))), _t3, Array_string); - for (int _t4 = 0; _t4 < known_diff_tools.len; ++_t4) { - string diffcmd = ((string*)known_diff_tools.data)[_t4]; - if (string__eq(diffcmd, _SLIT("opendiff"))) { - if (v__util__diff__opendiff_exists()) { - Option_string _t5; - opt_ok(&(string[]) { diffcmd }, (Option*)(&_t5), sizeof(string)); - return _t5; - } - continue; - } - os__Result p = os__execute( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = diffcmd}}, {_SLIT(" --version"), 0, { .d_c = 0 }}}))); - if (p.exit_code < 0) { - continue; - } - if (p.exit_code == 127 && string__eq(diffcmd, env_difftool)) { - return (Option_string){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("could not find specified VDIFF_TOOL "), 0xfe10, {.d_s = diffcmd}}, {_SLIT0, 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (p.exit_code == 0) { - if (string__eq(diffcmd, _SLIT("code")) || string__eq(diffcmd, _SLIT("code.cmd"))) { - Option_string _t7; - opt_ok(&(string[]) { str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = diffcmd}}, {_SLIT(" "), 0xfe10, {.d_s = env_diffopts}}, {_SLIT(" -d"), 0, { .d_c = 0 }}})) }, (Option*)(&_t7), sizeof(string)); - return _t7; - } - Option_string _t8; - opt_ok(&(string[]) { str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = diffcmd}}, {_SLIT(" "), 0xfe10, {.d_s = env_diffopts}}, {_SLIT0, 0, { .d_c = 0 }}})) }, (Option*)(&_t8), sizeof(string)); - return _t8; - } - } - return (Option_string){ .state=2, .err=_v_error(_SLIT("No working \"diff\" command found")), .data={EMPTY_STRUCT_INITIALIZATION} }; + i64 days_since_1970 = ((i64)(time__days_from_civil(year, month + 1, t->tm_mday))); + i64 _t1 = 60 * (60 * (24 * days_since_1970 + t->tm_hour) + t->tm_min) + t->tm_sec; + return _t1; } -VV_LOCAL_SYMBOL bool v__util__diff__opendiff_exists(void) { - os__Result o = os__execute(_SLIT("opendiff")); - if (o.exit_code < 0) { - bool _t1 = false; +int time__days_from_civil(int oy, int m, int d) { + int y = (m <= 2 ? (oy - 1) : (oy)); + int era = y / 400; + int yoe = y - era * 400; + int doy = (153 * (m + ((m > 2 ? (-3) : (9)))) + 2) / 5 + d - 1; + int doe = yoe * 365 + yoe / 4 - yoe / 100 + doy; + int _t1 = era * 146097 + doe - 719468; + return _t1; +} + +string time__Time_format(time__Time t) { + string _t1 = time__Time_get_fmt_str(t, time__FormatDelimiter__hyphen, time__FormatTime__hhmm24, time__FormatDate__yyyymmdd); + return _t1; +} + +string time__Time_format_ss(time__Time t) { + string _t1 = time__Time_get_fmt_str(t, time__FormatDelimiter__hyphen, time__FormatTime__hhmmss24, time__FormatDate__yyyymmdd); + return _t1; +} + +string time__Time_format_ss_milli(time__Time t) { + string _t1 = time__Time_get_fmt_str(t, time__FormatDelimiter__hyphen, time__FormatTime__hhmmss24_milli, time__FormatDate__yyyymmdd); + return _t1; +} + +string time__Time_format_ss_micro(time__Time t) { + string _t1 = time__Time_get_fmt_str(t, time__FormatDelimiter__hyphen, time__FormatTime__hhmmss24_micro, time__FormatDate__yyyymmdd); + return _t1; +} + +string time__Time_hhmm(time__Time t) { + string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm24); + return _t1; +} + +string time__Time_hhmmss(time__Time t) { + string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmmss24); + return _t1; +} + +string time__Time_hhmm12(time__Time t) { + string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm12); + return _t1; +} + +string time__Time_ymmdd(time__Time t) { + string _t1 = time__Time_get_fmt_date_str(t, time__FormatDelimiter__hyphen, time__FormatDate__yyyymmdd); + return _t1; +} + +string time__Time_ddmmy(time__Time t) { + string _t1 = time__Time_get_fmt_date_str(t, time__FormatDelimiter__dot, time__FormatDate__ddmmyyyy); + return _t1; +} + +string time__Time_md(time__Time t) { + string _t1 = time__Time_get_fmt_date_str(t, time__FormatDelimiter__space, time__FormatDate__mmmd); + return _t1; +} + +VV_LOCAL_SYMBOL string time__ordinal_suffix(int n) { + if (n > 3 && n < 21) { + string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe07, {.d_i32 = n}}, {_SLIT("th"), 0, { .d_c = 0 }}})); return _t1; } - if (o.exit_code == 1) { - if (string_contains(o.output, _SLIT("too few arguments"))) { - bool _t2 = true; + int _t2 = n % 10; + + if (_t2 == (1)) { + string _t3 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe07, {.d_i32 = n}}, {_SLIT("st"), 0, { .d_c = 0 }}})); + return _t3; + } + else if (_t2 == (2)) { + string _t4 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe07, {.d_i32 = n}}, {_SLIT("nd"), 0, { .d_c = 0 }}})); + return _t4; + } + else if (_t2 == (3)) { + string _t5 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe07, {.d_i32 = n}}, {_SLIT("rd"), 0, { .d_c = 0 }}})); + return _t5; + } + else { + string _t6 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe07, {.d_i32 = n}}, {_SLIT("th"), 0, { .d_c = 0 }}})); + return _t6; + }; + return (string){.str=(byteptr)"", .is_lit=1}; +} + +string time__Time_custom_format(time__Time t, string s) { + Array_string tokens = __new_array_with_default(0, 0, sizeof(string), 0); + for (int i = 0; i < s.len; ) { + for (int j = 4; j > 0; j--) { + if (i > s.len - j) { + continue; + } + if (j == 1 || (j == 2 && Array_string_contains(_const_time__tokens_2, string_substr(s, i, i + j))) || (j == 3 && Array_string_contains(_const_time__tokens_3, string_substr(s, i, i + j))) || (j == 4 && Array_string_contains(_const_time__tokens_4, string_substr(s, i, i + j)))) { + array_push((array*)&tokens, _MOV((string[]){ string_clone(string_substr(s, i, i + j)) })); + i += (j - 1); + break; + } + } + i++; + } + strings__Builder sb = strings__new_builder(128); + for (int _t2 = 0; _t2 < tokens.len; ++_t2) { + string token = ((string*)tokens.data)[_t2]; + + if (string__eq(token, _SLIT("M"))) { + strings__Builder_write_string(&sb, int_str(t.month)); + } + else if (string__eq(token, _SLIT("MM"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.month}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("Mo"))) { + strings__Builder_write_string(&sb, time__ordinal_suffix(t.month)); + } + else if (string__eq(token, _SLIT("MMM"))) { + strings__Builder_write_string(&sb, string_substr((*(string*)/*ee elem_sym */array_get(_const_time__long_months, t.month - 1)), 0, 3)); + } + else if (string__eq(token, _SLIT("MMMM"))) { + strings__Builder_write_string(&sb, (*(string*)/*ee elem_sym */array_get(_const_time__long_months, t.month - 1))); + } + else if (string__eq(token, _SLIT("D"))) { + strings__Builder_write_string(&sb, int_str(t.day)); + } + else if (string__eq(token, _SLIT("DD"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("Do"))) { + strings__Builder_write_string(&sb, time__ordinal_suffix(t.day)); + } + else if (string__eq(token, _SLIT("DDD"))) { + strings__Builder_write_string(&sb, int_str((t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]))); + } + else if (string__eq(token, _SLIT("DDDD"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8006fe27, {.d_i32 = t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("DDDo"))) { + strings__Builder_write_string(&sb, time__ordinal_suffix(t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0])); + } + else if (string__eq(token, _SLIT("d"))) { + strings__Builder_write_string(&sb, int_str(time__Time_day_of_week(&t))); + } + else if (string__eq(token, _SLIT("dd"))) { + strings__Builder_write_string(&sb, string_substr((*(string*)/*ee elem_sym */array_get(_const_time__long_days, time__Time_day_of_week(&t) - 1)), 0, 2)); + } + else if (string__eq(token, _SLIT("ddd"))) { + strings__Builder_write_string(&sb, string_substr((*(string*)/*ee elem_sym */array_get(_const_time__long_days, time__Time_day_of_week(&t) - 1)), 0, 3)); + } + else if (string__eq(token, _SLIT("dddd"))) { + strings__Builder_write_string(&sb, (*(string*)/*ee elem_sym */array_get(_const_time__long_days, time__Time_day_of_week(&t) - 1))); + } + else if (string__eq(token, _SLIT("YY"))) { + strings__Builder_write_string(&sb, string_substr(int_str(t.year), 2, 4)); + } + else if (string__eq(token, _SLIT("YYYY"))) { + strings__Builder_write_string(&sb, int_str(t.year)); + } + else if (string__eq(token, _SLIT("H"))) { + strings__Builder_write_string(&sb, int_str(t.hour)); + } + else if (string__eq(token, _SLIT("HH"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.hour}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("h"))) { + strings__Builder_write_string(&sb, int_str((t.hour % 12))); + } + else if (string__eq(token, _SLIT("hh"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = (t.hour % 12)}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("m"))) { + strings__Builder_write_string(&sb, int_str(t.minute)); + } + else if (string__eq(token, _SLIT("mm"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("s"))) { + strings__Builder_write_string(&sb, int_str(t.second)); + } + else if (string__eq(token, _SLIT("ss"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.second}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("k"))) { + strings__Builder_write_string(&sb, int_str((t.hour + 1))); + } + else if (string__eq(token, _SLIT("kk"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = (t.hour + 1)}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("w"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x1000f, {.d_f64 = math__ceil((t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]) / 7)}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("ww"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8005002f, {.d_f64 = math__ceil((t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]) / 7)}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("wo"))) { + strings__Builder_write_string(&sb, time__ordinal_suffix(((int)(math__ceil((t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]) / 7))))); + } + else if (string__eq(token, _SLIT("Q"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe07, {.d_i32 = (t.month % 4) + 1}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("QQ"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = (t.month % 4) + 1}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("Qo"))) { + strings__Builder_write_string(&sb, time__ordinal_suffix((t.month % 4) + 1)); + } + else if (string__eq(token, _SLIT("c"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe07, {.d_i32 = time__Time_day_of_week(&t) + 1}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("N"))) { + strings__Builder_write_string(&sb, _SLIT("AD")); + } + else if (string__eq(token, _SLIT("NN"))) { + strings__Builder_write_string(&sb, _SLIT("Anno Domini")); + } + else if (string__eq(token, _SLIT("Z"))) { + int hours = time__offset() / _const_time__seconds_per_hour; + if (hours >= 0) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("+"), 0xfe07, {.d_i32 = hours}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } else { + hours = -hours; + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("-"), 0xfe07, {.d_i32 = hours}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + } + else if (string__eq(token, _SLIT("ZZ"))) { + int hours = time__offset() / _const_time__seconds_per_hour; + if (hours >= 0) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("+"), 0x8004fe27, {.d_i32 = hours}}, {_SLIT("00"), 0, { .d_c = 0 }}}))); + } else { + hours = -hours; + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("-"), 0x8004fe27, {.d_i32 = hours}}, {_SLIT("00"), 0, { .d_c = 0 }}}))); + } + } + else if (string__eq(token, _SLIT("ZZZ"))) { + int hours = time__offset() / _const_time__seconds_per_hour; + if (hours >= 0) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("+"), 0x8004fe27, {.d_i32 = hours}}, {_SLIT(":00"), 0, { .d_c = 0 }}}))); + } else { + hours = -hours; + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("-"), 0x8004fe27, {.d_i32 = hours}}, {_SLIT(":00"), 0, { .d_c = 0 }}}))); + } + } + else if (string__eq(token, _SLIT("a"))) { + if (t.hour > 12) { + strings__Builder_write_string(&sb, _SLIT("pm")); + } else { + strings__Builder_write_string(&sb, _SLIT("am")); + } + } + else if (string__eq(token, _SLIT("A"))) { + if (t.hour > 12) { + strings__Builder_write_string(&sb, _SLIT("PM")); + } else { + strings__Builder_write_string(&sb, _SLIT("AM")); + } + } + else { + strings__Builder_write_string(&sb, token); + }; + } + string _t3 = strings__Builder_str(&sb); + return _t3; +} + +string time__Time_clean(time__Time t) { + time__Time znow = time__now(); + if (t.month == znow.month && t.year == znow.year && t.day == znow.day) { + string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm24); + return _t1; + } + if (t.year == znow.year) { + string _t2 = time__Time_get_fmt_str(t, time__FormatDelimiter__space, time__FormatTime__hhmm24, time__FormatDate__mmmd); + return _t2; + } + string _t3 = time__Time_format(t); + return _t3; +} + +string time__Time_clean12(time__Time t) { + time__Time znow = time__now(); + if (t.month == znow.month && t.year == znow.year && t.day == znow.day) { + string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm12); + return _t1; + } + if (t.year == znow.year) { + string _t2 = time__Time_get_fmt_str(t, time__FormatDelimiter__space, time__FormatTime__hhmm12, time__FormatDate__mmmd); + return _t2; + } + string _t3 = time__Time_format(t); + return _t3; +} + +string time__Time_get_fmt_time_str(time__Time t, time__FormatTime fmt_time) { + if (fmt_time == time__FormatTime__no_time) { + string _t1 = _SLIT(""); + return _t1; + } + string tp = (t.hour > 11 ? (_SLIT("p.m.")) : (_SLIT("a.m."))); + int hour_ = (t.hour > 12 ? (t.hour - 12) : t.hour == 0 ? (12) : (t.hour)); + string _t3 = (string){.str=(byteptr)"", .is_lit=1}; + switch (fmt_time) { + case time__FormatTime__hhmm12: + { + _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe07, {.d_i32 = hour_}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(" "), 0xfe10, {.d_s = tp}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatTime__hhmm24: + { + _t3 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatTime__hhmmss12: + { + _t3 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, 0xfe07, {.d_i32 = hour_}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.second}}, {_SLIT(" "), 0xfe10, {.d_s = tp}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatTime__hhmmss24: + { + _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.second}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatTime__hhmmss24_milli: + { + _t3 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.second}}, {_SLIT("."), 0x8006fe27, {.d_i32 = (t.microsecond / 1000)}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatTime__hhmmss24_micro: + { + _t3 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.second}}, {_SLIT("."), 0x800cfe27, {.d_i32 = t.microsecond}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatTime__no_time: + default: + { + _t3 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown enumeration "), 0xfe10, {.d_s = time__FormatTime_str(fmt_time)}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + } + string _t2 = _t3; + return _t2; +} + +string time__Time_get_fmt_date_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatDate fmt_date) { + if (fmt_date == time__FormatDate__no_date) { + string _t1 = _SLIT(""); + return _t1; + } + string month = time__Time_smonth(&t); + string year = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = (t.year % 100)}}, {_SLIT0, 0, { .d_c = 0 }}})); + string _t2 = (string){.str=(byteptr)"", .is_lit=1}; + switch (fmt_date) { + case time__FormatDate__ddmmyy: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), 0xfe10, {.d_s = year}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__ddmmyyyy: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), 0x8008fe27, {.d_i32 = t.year}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__mmddyy: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), 0xfe10, {.d_s = year}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__mmddyyyy: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), 0x8008fe27, {.d_i32 = t.year}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__mmmd: + { + _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = month}}, {_SLIT("|"), 0xfe07, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__mmmdd: + { + _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__mmmddyy: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), 0xfe10, {.d_s = year}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__mmmddyyyy: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), 0x8008fe27, {.d_i32 = t.year}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__yyyymmdd: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0x8008fe27, {.d_i32 = t.year}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__yymmdd: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = year}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), 0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__no_date: + default: + { + _t2 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown enumeration "), 0xfe10, {.d_s = time__FormatDate_str(fmt_date)}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + } + string res = _t2; + string del = ((fmt_dlmtr == (time__FormatDelimiter__dot)) ? (_SLIT(".")) : (fmt_dlmtr == (time__FormatDelimiter__hyphen)) ? (_SLIT("-")) : (fmt_dlmtr == (time__FormatDelimiter__slash)) ? (_SLIT("/")) : (fmt_dlmtr == (time__FormatDelimiter__space)) ? (_SLIT(" ")) : (_SLIT(""))); + res = string_replace(res, _SLIT("|"), del); + string _t3 = res; + return _t3; +} + +string time__Time_get_fmt_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatTime fmt_time, time__FormatDate fmt_date) { + if (fmt_date == time__FormatDate__no_date) { + if (fmt_time == time__FormatTime__no_time) { + string _t1 = _SLIT(""); + return _t1; + } else { + string _t2 = time__Time_get_fmt_time_str(t, fmt_time); + return _t2; + } + } else { + if (fmt_time != time__FormatTime__no_time) { + string dstr = time__Time_get_fmt_date_str(t, fmt_dlmtr, fmt_date); + string tstr = time__Time_get_fmt_time_str(t, fmt_time); + string _t3 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = dstr}}, {_SLIT(" "), 0xfe10, {.d_s = tstr}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t3; + } else { + string _t4 = time__Time_get_fmt_date_str(t, fmt_dlmtr, fmt_date); + return _t4; + } + } + return (string){.str=(byteptr)"", .is_lit=1}; +} + +string time__Time_utc_string(time__Time t) { + string day_str = time__Time_weekday_str(&t); + string month_str = time__Time_smonth(&t); + string utc_string = str_intp(8, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = day_str}}, {_SLIT(", "), 0xfe07, {.d_i32 = t.day}}, {_SLIT(" "), 0xfe10, {.d_s = month_str}}, {_SLIT(" "), 0xfe07, {.d_i32 = t.year}}, {_SLIT(" "), 0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), 0x8004fe27, {.d_i32 = t.second}}, {_SLIT(" UTC"), 0, { .d_c = 0 }}})); + string _t1 = utc_string; + return _t1; +} + +// Attr: [inline] +inline bool time__Time__eq(time__Time t1, time__Time t2) { + bool _t1 = t1._v_unix == t2._v_unix && t1.microsecond == t2.microsecond; + return _t1; +} + +// Attr: [inline] +inline bool time__Time__lt(time__Time t1, time__Time t2) { + bool _t1 = t1._v_unix < t2._v_unix || (t1._v_unix == t2._v_unix && t1.microsecond < t2.microsecond); + return _t1; +} + +// Attr: [inline] +inline time__Duration time__Time__minus(time__Time lhs, time__Time rhs) { + i64 lhs_micro = lhs._v_unix * 1000000 + lhs.microsecond; + i64 rhs_micro = rhs._v_unix * 1000000 + rhs.microsecond; + time__Duration _t1 = (lhs_micro - rhs_micro) * _const_time__microsecond; + return _t1; +} + +Option_time__Time time__parse_rfc3339(string s) { + if ((s).len == 0) { + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + string sn = string_replace_each(s, new_array_from_c_array(4, 4, sizeof(string), _MOV((string[4]){_SLIT("t"), _SLIT("T"), _SLIT("z"), _SLIT("Z")}))); + Option_time__Time _t2 = time__parse_iso8601(sn); + if (_t2.state != 0) { /*or block*/ + IError err = _t2.err; + *(time__Time*) _t2.data = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + } + + time__Time t = (*(time__Time*)_t2.data); + if (!time__Time__eq(t, ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}))) { + Option_time__Time _t3; + opt_ok(&(time__Time[]) { t }, (Option*)(&_t3), sizeof(time__Time)); + return _t3; + } + Option_int _t4 = string_index(sn, _SLIT("T")); + if (_t4.state != 0) { /*or block*/ + IError err = _t4.err; + *(int*) _t4.data = -1; + } + + int t_i = (*(int*)_t4.data); + Array_string parts = (t_i != -1 ? (new_array_from_c_array(2, 2, sizeof(string), _MOV((string[2]){string_clone(string_substr(sn, 0, t_i)), string_clone(string_substr(sn, t_i + 1, (sn).len))}))) : (string_split(sn, _SLIT(" ")))); + if (!string_contains_any((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT(" Z")) && string_contains((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT("-"))) { + Option_multi_return_int_int_int _t5 = time__parse_iso8601_date(sn); + if (_t5.state != 0) { /*or block*/ + Option_time__Time _t6; + memcpy(&_t6, &_t5, sizeof(Option)); + return _t6; + } + + multi_return_int_int_int mr_1001 = (*(multi_return_int_int_int*)_t5.data); + int year = mr_1001.arg0; + int month = mr_1001.arg1; + int day = mr_1001.arg2; + t = time__new_time(((time__Time){.year = year,.month = month,.day = day,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,})); + Option_time__Time _t7; + opt_ok(&(time__Time[]) { t }, (Option*)(&_t7), sizeof(time__Time)); + return _t7; + } + if (!string_contains((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT("-")) && string_contains((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT(":"))) { + int hour_ = 0; + int minute_ = 0; + int second_ = 0; + int microsecond_ = 0; + i64 unix_offset = ((i64)(0)); + bool is_local_time = true; + Option_multi_return_int_int_int_int_i64_bool _t8 = time__parse_iso8601_time((*(string*)/*ee elem_sym */array_get(parts, 0))); + if (_t8.state != 0) { /*or block*/ + Option_time__Time _t9; + memcpy(&_t9, &_t8, sizeof(Option)); + return _t9; + } + + multi_return_int_int_int_int_i64_bool mr_1384 = (*(multi_return_int_int_int_int_i64_bool*)_t8.data); + hour_ = mr_1384.arg0; + minute_ = mr_1384.arg1; + second_ = mr_1384.arg2; + microsecond_ = mr_1384.arg3; + unix_offset = mr_1384.arg4; + is_local_time = mr_1384.arg5; + t = time__new_time(((time__Time){.year = 0,.month = 0,.day = 0,.hour = hour_,.minute = minute_,.second = second_,.microsecond = microsecond_,._v_unix = 0,.is_local = 0,})); + if (is_local_time) { + Option_time__Time _t10; + opt_ok(&(time__Time[]) { t }, (Option*)(&_t10), sizeof(time__Time)); + return _t10; + } + i64 unix_time = t._v_unix; + if (unix_offset < 0) { + unix_time -= (-unix_offset); + } else if (unix_offset > 0) { + unix_time += unix_offset; + } + t = time__unix2(((i64)(unix_time)), t.microsecond); + Option_time__Time _t11; + opt_ok(&(time__Time[]) { t }, (Option*)(&_t11), sizeof(time__Time)); + return _t11; + } + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(9), .data={EMPTY_STRUCT_INITIALIZATION} }; +} + +Option_time__Time time__parse(string s) { + if ((s).len == 0) { + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + Option_int _t2 = string_index(s, _SLIT(" ")); + if (_t2.state != 0) { /*or block*/ + IError err = _t2.err; + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(1), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + + int pos = (*(int*)_t2.data); + string symd = string_substr(s, 0, pos); + Array_string ymd = string_split(symd, _SLIT("-")); + if (ymd.len != 3) { + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(2), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + string shms = string_substr(s, pos, (s).len); + Array_string hms = string_split(shms, _SLIT(":")); + string hour_ = string_substr((*(string*)/*ee elem_sym */array_get(hms, 0)), 1, ((*(string*)/*ee elem_sym */array_get(hms, 0))).len); + string minute_ = (*(string*)/*ee elem_sym */array_get(hms, 1)); + string second_ = (*(string*)/*ee elem_sym */array_get(hms, 2)); + int iyear = string_int((*(string*)/*ee elem_sym */array_get(ymd, 0))); + int imonth = string_int((*(string*)/*ee elem_sym */array_get(ymd, 1))); + int iday = string_int((*(string*)/*ee elem_sym */array_get(ymd, 2))); + int ihour = string_int(hour_); + int iminute = string_int(minute_); + int isecond = string_int(second_); + if (iyear > 9999 || iyear < -9999) { + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(3), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (imonth > 12 || imonth < 1) { + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(4), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (iday > 31 || iday < 1) { + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(5), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (ihour > 23 || ihour < 0) { + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(6), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (iminute > 59 || iminute < 0) { + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(7), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (isecond > 59 || isecond < 0) { + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(8), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + time__Time res = time__new_time(((time__Time){ + .year = iyear, + .month = imonth, + .day = iday, + .hour = ihour, + .minute = iminute, + .second = isecond, + .microsecond = 0, + ._v_unix = 0, + .is_local = 0, + })); + Option_time__Time _t11; + opt_ok(&(time__Time[]) { res }, (Option*)(&_t11), sizeof(time__Time)); + return _t11; +} + +Option_time__Time time__parse_iso8601(string s) { + if ((s).len == 0) { + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + Option_int _t2 = string_index(s, _SLIT("T")); + if (_t2.state != 0) { /*or block*/ + IError err = _t2.err; + *(int*) _t2.data = -1; + } + + int t_i = (*(int*)_t2.data); + Array_string parts = (t_i != -1 ? (new_array_from_c_array(2, 2, sizeof(string), _MOV((string[2]){string_clone(string_substr(s, 0, t_i)), string_clone(string_substr(s, t_i + 1, (s).len))}))) : (string_split(s, _SLIT(" ")))); + if (!(parts.len == 1 || parts.len == 2)) { + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(12), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + Option_multi_return_int_int_int _t4 = time__parse_iso8601_date((*(string*)/*ee elem_sym */array_get(parts, 0))); + if (_t4.state != 0) { /*or block*/ + Option_time__Time _t5; + memcpy(&_t5, &_t4, sizeof(Option)); + return _t5; + } + + multi_return_int_int_int mr_3646 = (*(multi_return_int_int_int*)_t4.data); + int year = mr_3646.arg0; + int month = mr_3646.arg1; + int day = mr_3646.arg2; + int hour_ = 0; + int minute_ = 0; + int second_ = 0; + int microsecond_ = 0; + i64 unix_offset = ((i64)(0)); + bool is_local_time = true; + if (parts.len == 2) { + Option_multi_return_int_int_int_int_i64_bool _t6 = time__parse_iso8601_time((*(string*)/*ee elem_sym */array_get(parts, 1))); + if (_t6.state != 0) { /*or block*/ + Option_time__Time _t7; + memcpy(&_t7, &_t6, sizeof(Option)); + return _t7; + } + + multi_return_int_int_int_int_i64_bool mr_3888 = (*(multi_return_int_int_int_int_i64_bool*)_t6.data); + hour_ = mr_3888.arg0; + minute_ = mr_3888.arg1; + second_ = mr_3888.arg2; + microsecond_ = mr_3888.arg3; + unix_offset = mr_3888.arg4; + is_local_time = mr_3888.arg5; + } + time__Time t = time__new_time(((time__Time){ + .year = year, + .month = month, + .day = day, + .hour = hour_, + .minute = minute_, + .second = second_, + .microsecond = microsecond_, + ._v_unix = 0, + .is_local = 0, + })); + if (is_local_time) { + Option_time__Time _t8; + opt_ok(&(time__Time[]) { t }, (Option*)(&_t8), sizeof(time__Time)); + return _t8; + } + i64 unix_time = t._v_unix; + if (unix_offset < 0) { + unix_time -= (-unix_offset); + } else if (unix_offset > 0) { + unix_time += unix_offset; + } + t = time__unix2(((i64)(unix_time)), t.microsecond); + Option_time__Time _t9; + opt_ok(&(time__Time[]) { t }, (Option*)(&_t9), sizeof(time__Time)); + return _t9; +} + +Option_time__Time time__parse_rfc2822(string s) { + if ((s).len == 0) { + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + Array_string fields = string_split(s, _SLIT(" ")); + if (fields.len < 5) { + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(1), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + Option_int _t3 = string_index(_const_time__months_string, (*(string*)/*ee elem_sym */array_get(fields, 2))); + if (_t3.state != 0) { /*or block*/ + IError err = _t3.err; + return (Option_time__Time){ .state=2, .err=time__error_invalid_time(2), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + + int pos = (*(int*)_t3.data); + int mm = pos / 3 + 1; + { // Unsafe block + u8* tmstr = malloc_noscan(s.len * 2); + int count = snprintf(((char*)(tmstr)), (s.len * 2), "%s-%02d-%s %s", (*(string*)/*ee elem_sym */array_get(fields, 3)).str, mm, (*(string*)/*ee elem_sym */array_get(fields, 1)).str, (*(string*)/*ee elem_sym */array_get(fields, 4)).str); + Option_time__Time _t5 = time__parse(tos(tmstr, count)); + return _t5; + } + return (Option_time__Time){0}; +} + +VV_LOCAL_SYMBOL Option_multi_return_int_int_int time__parse_iso8601_date(string s) { + int year = 0; + int month = 0; + int day = 0; + u8 dummy = ((u8)(0)); + int count = sscanf(((char*)(s.str)), "%4d-%2d-%2d%c", &year, &month, &day, &dummy); + if (count != 3) { + return (Option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(10), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (year > 9999) { + return (Option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(13), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (month > 12) { + return (Option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(14), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (day > 31) { + return (Option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(15), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + Option_multi_return_int_int_int _t5; + opt_ok(&(multi_return_int_int_int/*X*/[]) { (multi_return_int_int_int){.arg0=year, .arg1=month, .arg2=day} }, (Option*)(&_t5), sizeof(multi_return_int_int_int)); + return _t5; +} + +VV_LOCAL_SYMBOL Option_multi_return_int_int_int_int_i64_bool time__parse_iso8601_time(string s) { + int hour_ = 0; + int minute_ = 0; + int second_ = 0; + int microsecond_ = 0; + rune plus_min_z = 'a'; + int offset_hour = 0; + int offset_minute = 0; + int count = sscanf(((char*)(s.str)), "%2d:%2d:%2d.%6d%c%2d:%2d", &hour_, &minute_, &second_, µsecond_, ((char*)(&plus_min_z)), &offset_hour, &offset_minute); + if (count < 4) { + count = sscanf(((char*)(s.str)), "%2d:%2d:%2d%c%2d:%2d", &hour_, &minute_, &second_, ((char*)(&plus_min_z)), &offset_hour, &offset_minute); + count++; + } + if (count < 4) { + return (Option_multi_return_int_int_int_int_i64_bool){ .state=2, .err=time__error_invalid_time(10), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + bool is_local_time = plus_min_z == 'a' && count == 4; + bool is_utc = plus_min_z == 'Z' && count == 5; + if (!(count == 7 || is_local_time || is_utc)) { + return (Option_multi_return_int_int_int_int_i64_bool){ .state=2, .err=time__error_invalid_time(11), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (plus_min_z != '+' && plus_min_z != '-' && !is_utc && !is_local_time) { + return (Option_multi_return_int_int_int_int_i64_bool){ .state=2, .err=time__error_invalid_time(12), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + int unix_offset = 0; + if (offset_hour > 0) { + unix_offset += 3600 * offset_hour; + } + if (offset_minute > 0) { + unix_offset += 60 * offset_minute; + } + if (plus_min_z == '+') { + unix_offset *= -1; + } + Option_multi_return_int_int_int_int_i64_bool _t4; + opt_ok(&(multi_return_int_int_int_int_i64_bool/*X*/[]) { (multi_return_int_int_int_int_i64_bool){.arg0=hour_, .arg1=minute_, .arg2=second_, .arg3=microsecond_, .arg4=unix_offset, .arg5=is_local_time} }, (Option*)(&_t4), sizeof(multi_return_int_int_int_int_i64_bool)); + return _t4; +} + +string time__TimeParseError_msg(time__TimeParseError err) { + string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("Invalid time format code: "), 0xfe07, {.d_i32 = err.code}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t1; +} + +VV_LOCAL_SYMBOL IError time__error_invalid_time(int code) { + IError _t1 = I_time__TimeParseError_to_Interface_IError(((time__TimeParseError*)memdup(&(time__TimeParseError){.Error = ((Error){EMPTY_STRUCT_INITIALIZATION}),.code = code,}, sizeof(time__TimeParseError)))); + return _t1; +} + +time__StopWatch time__new_stopwatch(time__StopWatchOptions opts) { + u64 initial = ((u64)(0U)); + if (opts.auto_start) { + initial = time__sys_mono_now(); + } + time__StopWatch _t1 = ((time__StopWatch){.elapsed = 0U,.start = initial,.end = 0U,}); + return _t1; +} + +void time__StopWatch_start(time__StopWatch* t) { + t->start = time__sys_mono_now(); + t->end = 0U; +} + +void time__StopWatch_restart(time__StopWatch* t) { + t->start = time__sys_mono_now(); + t->end = 0U; + t->elapsed = 0U; +} + +void time__StopWatch_stop(time__StopWatch* t) { + t->end = time__sys_mono_now(); +} + +void time__StopWatch_pause(time__StopWatch* t) { + if (t->start > 0U) { + if (t->end == 0U) { + t->elapsed += time__sys_mono_now() - t->start; + } else { + t->elapsed += t->end - t->start; + } + } + t->start = 0U; +} + +time__Duration time__StopWatch_elapsed(time__StopWatch t) { + if (t.start > 0U) { + if (t.end == 0U) { + time__Duration _t1 = ((((i64)(time__sys_mono_now() - t.start + t.elapsed)))); + return _t1; + } else { + time__Duration _t2 = ((((i64)(t.end - t.start + t.elapsed)))); return _t2; } } - bool _t3 = false; + time__Duration _t3 = ((((i64)(t.elapsed)))); return _t3; } -string v__util__diff__color_compare_files(string diff_cmd, string file1, string file2) { - if ((diff_cmd).len != 0) { - string full_cmd = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = diff_cmd}}, {_SLIT(" --minimal --text --unified=2 --show-function-line=\"fn \" "), 0xfe10, {.d_s = os__quoted_path(file1)}}, {_SLIT(" "), 0xfe10, {.d_s = os__quoted_path(file2)}}, {_SLIT(" "), 0, { .d_c = 0 }}})); - os__Result x = os__execute(full_cmd); - if (x.exit_code < 0) { - string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("comparison command: `"), 0xfe10, {.d_s = full_cmd}}, {_SLIT("` not found"), 0, { .d_c = 0 }}})); - return _t1; - } - string _t2 = string_trim_right(x.output, _SLIT("\r\n")); +time__Time time__now(void) { + time__Time _t1 = time__win_now(); + return _t1; + time_t t = time(0); + struct tm* now = localtime(&t); + time__Time _t2 = time__convert_ctime(*now, 0); + return _t2; +} + +time__Time time__utc(void) { + time__Time _t1 = time__win_utc(); + return _t1; + time_t t = time(0); + time(&t); + time__Time _t2 = time__unix2(((i64)(t)), 0); + return _t2; +} + +time__Time time__new_time(time__Time t) { + if (t._v_unix != 0) { + time__Time _t1 = t; + return _t1; + } + struct tm tt = ((struct tm){ + .tm_year = t.year - 1900, + .tm_mon = t.month - 1, + .tm_mday = t.day, + .tm_hour = t.hour, + .tm_min = t.minute, + .tm_sec = t.second, + }); + i64 utime = time__make_unix_time(tt); + time__Time _t2 = ((time__Time){t.year,t.month,t.day,t.hour,t.minute,t.second,t.microsecond,._v_unix = utime,t.is_local,}); + return _t2; +} + +i64 time__ticks(void) { + #if defined(_WIN32) + { + i64 _t1 = GetTickCount(); + return _t1; + } + #else + { + } + #endif + return 0; +} + +string time__Time_str(time__Time t) { + string _t1 = time__Time_format_ss(t); + return _t1; +} + +VV_LOCAL_SYMBOL time__Time time__convert_ctime(struct tm t, int microsecond) { + time__Time _t1 = ((time__Time){ + .year = t.tm_year + 1900, + .month = t.tm_mon + 1, + .day = t.tm_mday, + .hour = t.tm_hour, + .minute = t.tm_min, + .second = t.tm_sec, + .microsecond = microsecond, + ._v_unix = time__make_unix_time(t), + .is_local = true, + }); + return _t1; +} + +string time__Time_strftime(time__Time t, string fmt) { + struct tm* tm = ((struct tm*)memdup(&(struct tm){.tm_year = 0,.tm_mon = 0,.tm_mday = 0,.tm_hour = 0,.tm_min = 0,.tm_sec = 0,}, sizeof(struct tm))); + #if defined(_WIN32) + { + tm = gmtime(((voidptr)(&t._v_unix))); + } + #else + { + } + #endif + Array_fixed_C__char_1024 buf = {0}; + char* fmt_c = ((char*)(fmt.str)); + strftime(&buf[0], ((size_t)(sizeof(Array_fixed_C__char_1024))), fmt_c, tm); + string _t1 = cstring_to_vstring(((char*)(&buf[0]))); + return _t1; +} + +string time__Time_smonth(time__Time* t) { + if (t->month <= 0 || t->month > 12) { + string _t1 = _SLIT("---"); + return _t1; + } + int i = t->month - 1; + string _t2 = string_substr(_const_time__months_string, i * 3, (i + 1) * 3); + return _t2; +} + +// Attr: [inline] +inline i64 time__Time_unix_time(time__Time* t) { + i64 _t1 = t->_v_unix; + return _t1; +} + +// Attr: [inline] +inline i64 time__Time_unix_time_milli(time__Time* t) { + i64 _t1 = t->_v_unix * 1000 + (t->microsecond / 1000); + return _t1; +} + +time__Time time__Time_add(time__Time* t, time__Duration d) { + i64 microseconds = ((i64)(t->_v_unix)) * 1000000 + t->microsecond + time__Duration_microseconds(d); + i64 _v_unix = microseconds / 1000000; + i64 micro = microseconds % 1000000; + time__Time _t1 = time__unix2(_v_unix, ((int)(micro))); + return _t1; +} + +time__Time time__Time_add_seconds(time__Time* t, int seconds) { + time__Time _t1 = time__Time_add(t, seconds * _const_time__second); + return _t1; +} + +time__Time time__Time_add_days(time__Time* t, int days) { + time__Time _t1 = time__Time_add(t, days * 24 * _const_time__hour); + return _t1; +} + +time__Duration time__since(time__Time t) { + time__Duration _t1 = time__Time__minus(time__now(), t); + return _t1; +} + +string time__Time_relative(time__Time* t) { + time__Time znow = time__now(); + i64 secs = znow._v_unix - t->_v_unix; + if (secs <= 30) { + string _t1 = _SLIT("now"); + return _t1; + } + if (secs < 60) { + string _t2 = _SLIT("1m"); return _t2; } - string _t3 = _SLIT(""); - return _t3; + if (secs < 3600) { + i64 m = secs / 60; + if (m == 1) { + string _t3 = _SLIT("1 minute ago"); + return _t3; + } + string _t4 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = m}}, {_SLIT(" minutes ago"), 0, { .d_c = 0 }}})); + return _t4; + } + if (secs < 86400) { + i64 h = secs / 3600; + if (h == 1) { + string _t5 = _SLIT("1 hour ago"); + return _t5; + } + string _t6 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = h}}, {_SLIT(" hours ago"), 0, { .d_c = 0 }}})); + return _t6; + } + if (secs < 432000) { + i64 d = secs / 3600 / 24; + if (d == 1) { + string _t7 = _SLIT("1 day ago"); + return _t7; + } + string _t8 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = d}}, {_SLIT(" days ago"), 0, { .d_c = 0 }}})); + return _t8; + } + if (secs > 864000000) { + string _t9 = _SLIT(""); + return _t9; + } + string _t10 = time__Time_md(/*rec*/*t); + return _t10; } -string v__util__diff__color_compare_strings(string diff_cmd, string unique_prefix, string expected, string found) { - string cdir = os__join_path_single(os__cache_dir(), unique_prefix); - Option_bool _t1 = os__mkdir(cdir); - if (_t1.state != 0) { /*or block*/ - IError err = _t1.err; +string time__Time_relative_short(time__Time* t) { + time__Time znow = time__now(); + i64 secs = znow._v_unix - t->_v_unix; + if (secs <= 30) { + string _t1 = _SLIT("now"); + return _t1; } - - (*(bool*)_t1.data); - u64 ctime = time__sys_mono_now(); - string e_file = os__join_path_single(cdir, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe08, {.d_u64 = ctime}}, {_SLIT(".expected.txt"), 0, { .d_c = 0 }}}))); - string f_file = os__join_path_single(cdir, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe08, {.d_u64 = ctime}}, {_SLIT(".found.txt"), 0, { .d_c = 0 }}}))); - Option_void _t2 = os__write_file(e_file, expected); - if (_t2.state != 0 && _t2.err._typ != _IError_None___index) { - IError err = _t2.err; - _v_panic(IError_str(err)); - VUNREACHABLE(); - ; + if (secs < 60) { + string _t2 = _SLIT("1m"); + return _t2; } - - ; - Option_void _t3 = os__write_file(f_file, found); - if (_t3.state != 0 && _t3.err._typ != _IError_None___index) { - IError err = _t3.err; - _v_panic(IError_str(err)); - VUNREACHABLE(); - ; + if (secs < 3600) { + string _t3 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = secs / 60}}, {_SLIT("m"), 0, { .d_c = 0 }}})); + return _t3; } - - ; - string res = v__util__diff__color_compare_files(diff_cmd, e_file, f_file); - Option_void _t4 = os__rmdir_all(cdir); - if (_t4.state != 0 && _t4.err._typ != _IError_None___index) { - IError err = _t4.err; + if (secs < 86400) { + string _t4 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = secs / 3600}}, {_SLIT("h"), 0, { .d_c = 0 }}})); + return _t4; } - - ; - string _t5 = res; - return _t5; + if (secs < 432000) { + string _t5 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = secs / 3600 / 24}}, {_SLIT("d"), 0, { .d_c = 0 }}})); + return _t5; + } + if (secs > 864000000) { + string _t6 = _SLIT(""); + return _t6; + } + string _t7 = time__Time_md(/*rec*/*t); + return _t7; +} + +int time__day_of_week(int y, int m, int d) { + Array_int t = new_array_from_c_array(12, 12, sizeof(int), _MOV((int[12]){ + 0, 3, 2, 5, 0, 3, 5, 1, 4, + 6, 2, 4})); + int sy = y; + if (m < 3) { + sy = sy - 1; + } + int _t1 = (sy + sy / 4 - sy / 100 + sy / 400 + (*(int*)/*ee elem_sym */array_get(t, m - 1)) + d - 1) % 7 + 1; + return _t1; +} + +int time__Time_day_of_week(time__Time* t) { + int _t1 = time__day_of_week(t->year, t->month, t->day); + return _t1; +} + +string time__Time_weekday_str(time__Time* t) { + int i = time__Time_day_of_week(t) - 1; + string _t1 = string_substr((*(string*)/*ee elem_sym */array_get(_const_time__long_days, i)), 0, 3); + return _t1; +} + +string time__Time_long_weekday_str(time__Time* t) { + int i = time__Time_day_of_week(t) - 1; + string _t1 = (*(string*)/*ee elem_sym */array_get(_const_time__long_days, i)); + return _t1; +} + +bool time__is_leap_year(int year) { + bool _t1 = (year % 4 == 0) && (year % 100 != 0 || year % 400 == 0); + return _t1; +} + +Option_int time__days_in_month(int month, int year) { + if (month > 12 || month < 1) { + return (Option_int){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("Invalid month: "), 0xfe07, {.d_i32 = month}}, {_SLIT0, 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + int extra = (month == 2 && time__is_leap_year(year) ? (1) : (0)); + int res = (*(int*)/*ee elem_sym */array_get(_const_time__month_days, month - 1)) + extra; + Option_int _t2; + opt_ok(&(int[]) { res }, (Option*)(&_t2), sizeof(int)); + return _t2; +} + +string time__Time_debug(time__Time* t) { + string _t1 = str_intp(9, _MOV((StrIntpData[]){{_SLIT("Time{ year: "), 0x8008fe27, {.d_i32 = t->year}}, {_SLIT(" month: "), 0x8004fe27, {.d_i32 = t->month}}, {_SLIT(" day: "), 0x8004fe27, {.d_i32 = t->day}}, {_SLIT(" hour: "), 0x8004fe27, {.d_i32 = t->hour}}, {_SLIT(" minute: "), 0x8004fe27, {.d_i32 = t->minute}}, {_SLIT(" second: "), 0x8004fe27, {.d_i32 = t->second}}, {_SLIT(" microsecond: "), 0x800cfe27, {.d_i32 = t->microsecond}}, {_SLIT(" unix: "), 0x800efe29, {.d_i64 = t->_v_unix}}, {_SLIT(" }"), 0, { .d_c = 0 }}})); + return _t1; +} + +// TypeDecl +i64 time__Duration_nanoseconds(time__Duration d) { + i64 _t1 = ((i64)(d)); + return _t1; +} + +i64 time__Duration_microseconds(time__Duration d) { + i64 _t1 = ((i64)(d)) / 1000; + return _t1; +} + +i64 time__Duration_milliseconds(time__Duration d) { + i64 _t1 = ((i64)(d)) / 1000000; + return _t1; +} + +f64 time__Duration_seconds(time__Duration d) { + i64 sec = d / _const_time__second; + i64 nsec = d % _const_time__second; + f64 _t1 = ((f64)(sec)) + ((f64)(nsec)) / 1e9; + return _t1; +} + +f64 time__Duration_minutes(time__Duration d) { + i64 min = d / _const_time__minute; + i64 nsec = d % _const_time__minute; + f64 _t1 = ((f64)(min)) + ((f64)(nsec)) / (60 * 1e9); + return _t1; +} + +f64 time__Duration_hours(time__Duration d) { + i64 hr = d / _const_time__hour; + i64 nsec = d % _const_time__hour; + f64 _t1 = ((f64)(hr)) + ((f64)(nsec)) / (3600 * 1e9); + return _t1; +} + +string time__Duration_str(time__Duration d) { + if (time__Duration_alias_eq(d, _const_time__infinite)) { + string _t1 = _SLIT("inf"); + return _t1; + } + i64 t = ((i64)(d)); + i64 hr = t / _const_time__hour; + t -= hr * _const_time__hour; + i64 min = t / _const_time__minute; + t -= min * _const_time__minute; + i64 sec = t / _const_time__second; + t -= sec * _const_time__second; + i64 ms = t / _const_time__millisecond; + t -= ms * _const_time__millisecond; + i64 us = t / _const_time__microsecond; + t -= us * _const_time__microsecond; + i64 ns = t; + if (hr > 0) { + string _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = hr}}, {_SLIT(":"), 0x8004fe29, {.d_i64 = min}}, {_SLIT(":"), 0x8004fe29, {.d_i64 = sec}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t2; + } + if (min > 0) { + string _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = min}}, {_SLIT(":"), 0x8004fe29, {.d_i64 = sec}}, {_SLIT("."), 0x8006fe29, {.d_i64 = ms}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t3; + } + if (sec > 0) { + string _t4 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = sec}}, {_SLIT("."), 0x8006fe29, {.d_i64 = ms}}, {_SLIT("s"), 0, { .d_c = 0 }}})); + return _t4; + } + if (ms > 0) { + string _t5 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = ms}}, {_SLIT("."), 0x8006fe29, {.d_i64 = us}}, {_SLIT("ms"), 0, { .d_c = 0 }}})); + return _t5; + } + if (us > 0) { + string _t6 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = us}}, {_SLIT("."), 0x8006fe29, {.d_i64 = ns}}, {_SLIT("us"), 0, { .d_c = 0 }}})); + return _t6; + } + string _t7 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe09, {.d_i64 = ns}}, {_SLIT("ns"), 0, { .d_c = 0 }}})); + return _t7; +} + +int time__offset(void) { + time__Time t = time__utc(); + time__Time local = time__Time_local(&t); + int _t1 = ((int)(local._v_unix - t._v_unix)); + return _t1; +} + +VV_LOCAL_SYMBOL i64 time__make_unix_time(struct tm t) { + i64 _t1 = time__portable_timegm(&t); + return _t1; +} + +VV_LOCAL_SYMBOL u64 time__init_win_time_freq(void) { + u64 f = ((u64)(0U)); + QueryPerformanceFrequency(&f); + u64 _t1 = f; + return _t1; +} + +VV_LOCAL_SYMBOL u64 time__init_win_time_start(void) { + u64 s = ((u64)(0U)); + QueryPerformanceCounter(&s); + u64 _t1 = s; + return _t1; +} + +u64 time__sys_mono_now(void) { + u64 tm = ((u64)(0U)); + QueryPerformanceCounter(&tm); + u64 _t1 = (tm - _const_time__start_time) * 1000000000U / _const_time__freq_time; + return _t1; +} + +// Attr: [inline] +inline VV_LOCAL_SYMBOL u64 time__vpc_now(void) { + u64 tm = ((u64)(0U)); + QueryPerformanceCounter(&tm); + u64 _t1 = tm; + return _t1; +} + +VV_LOCAL_SYMBOL i64 time__local_as_unix_time(void) { + time_t t = time(0); + struct tm* tm = localtime(&t); + i64 _t1 = time__make_unix_time(*tm); + return _t1; +} + +time__Time time__Time_local(time__Time* t) { + if (t->is_local) { + time__Time _t1 = *t; + return _t1; + } + time__SystemTime st_utc = ((time__SystemTime){ + .year = ((u16)(t->year)), + .month = ((u16)(t->month)), + .day_of_week = 0, + .day = ((u16)(t->day)), + .hour = ((u16)(t->hour)), + .minute = ((u16)(t->minute)), + .second = ((u16)(t->second)), + .millisecond = ((u16)(t->microsecond / 1000)), + }); + time__SystemTime st_local = ((time__SystemTime){.year = 0,.month = 0,.day_of_week = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.millisecond = 0,}); + SystemTimeToTzSpecificLocalTime(((voidptr)(0)), &st_utc, &st_local); + time__Time t_local = ((time__Time){ + .year = st_local.year, + .month = st_local.month, + .day = st_local.day, + .hour = st_local.hour, + .minute = st_local.minute, + .second = st_local.second, + .microsecond = st_local.millisecond * 1000U, + ._v_unix = time__SystemTime_unix_time(st_local), + .is_local = 0, + }); + time__Time _t2 = t_local; + return _t2; +} + +VV_LOCAL_SYMBOL time__Time time__win_now(void) { + struct _FILETIME ft_utc = ((struct _FILETIME){.dwLowDateTime = 0,.dwHighDateTime = 0,}); + GetSystemTimeAsFileTime(&ft_utc); + time__SystemTime st_utc = ((time__SystemTime){.year = 0,.month = 0,.day_of_week = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.millisecond = 0,}); + FileTimeToSystemTime(&ft_utc, &st_utc); + time__SystemTime st_local = ((time__SystemTime){.year = 0,.month = 0,.day_of_week = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.millisecond = 0,}); + SystemTimeToTzSpecificLocalTime(((voidptr)(0)), &st_utc, &st_local); + time__Time t = ((time__Time){ + .year = st_local.year, + .month = st_local.month, + .day = st_local.day, + .hour = st_local.hour, + .minute = st_local.minute, + .second = st_local.second, + .microsecond = st_local.millisecond * 1000U, + ._v_unix = time__SystemTime_unix_time(st_local), + .is_local = true, + }); + time__Time _t1 = t; + return _t1; +} + +VV_LOCAL_SYMBOL time__Time time__win_utc(void) { + struct _FILETIME ft_utc = ((struct _FILETIME){.dwLowDateTime = 0,.dwHighDateTime = 0,}); + GetSystemTimeAsFileTime(&ft_utc); + time__SystemTime st_utc = ((time__SystemTime){.year = 0,.month = 0,.day_of_week = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.millisecond = 0,}); + FileTimeToSystemTime(&ft_utc, &st_utc); + time__Time t = ((time__Time){ + .year = st_utc.year, + .month = st_utc.month, + .day = st_utc.day, + .hour = st_utc.hour, + .minute = st_utc.minute, + .second = st_utc.second, + .microsecond = st_utc.millisecond * 1000U, + ._v_unix = time__SystemTime_unix_time(st_utc), + .is_local = false, + }); + time__Time _t1 = t; + return _t1; +} + +i64 time__SystemTime_unix_time(time__SystemTime st) { + struct tm tt = ((struct tm){ + .tm_year = st.year - 1900U, + .tm_mon = st.month - 1U, + .tm_mday = st.day, + .tm_hour = st.hour, + .tm_min = st.minute, + .tm_sec = st.second, + }); + i64 _t1 = time__make_unix_time(tt); + return _t1; +} + +time__Time time__darwin_now(void) { + time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + return _t1; +} + +time__Time time__linux_now(void) { + time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + return _t1; +} + +time__Time time__solaris_now(void) { + time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + return _t1; +} + +time__Time time__darwin_utc(void) { + time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + return _t1; +} + +time__Time time__linux_utc(void) { + time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + return _t1; +} + +time__Time time__solaris_utc(void) { + time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + return _t1; +} + +void time__sleep(time__Duration duration) { + Sleep(((int)(duration / _const_time__millisecond))); +} + +u32 time__Duration_sys_milliseconds(time__Duration d) { + if (d >= ((u32)(-1)) * _const_time__millisecond) { + u32 _t1 = ((u32)(-1)); + return _t1; + } else if (d <= 0) { + u32 _t2 = 0U; + return _t2; + } else { + u32 _t3 = ((u32)(d / _const_time__millisecond)); + return _t3; + } + return 0; +} + +time__Time time__unix(i64 abs) { + i64 day_offset = abs / _const_time__seconds_per_day; + if (abs % _const_time__seconds_per_day < 0) { + day_offset--; + } + multi_return_int_int_int mr_472 = time__calculate_date_from_offset(day_offset); + int year = mr_472.arg0; + int month = mr_472.arg1; + int day = mr_472.arg2; + multi_return_int_int_int mr_528 = time__calculate_time_from_offset(abs % _const_time__seconds_per_day); + int hr = mr_528.arg0; + int min = mr_528.arg1; + int sec = mr_528.arg2; + time__Time _t1 = ((time__Time){ + .year = year, + .month = month, + .day = day, + .hour = hr, + .minute = min, + .second = sec, + .microsecond = 0, + ._v_unix = abs, + .is_local = 0, + }); + return _t1; +} + +time__Time time__unix2(i64 abs, int microsecond) { + i64 day_offset = abs / _const_time__seconds_per_day; + if (abs % _const_time__seconds_per_day < 0) { + day_offset--; + } + multi_return_int_int_int mr_1020 = time__calculate_date_from_offset(day_offset); + int year = mr_1020.arg0; + int month = mr_1020.arg1; + int day = mr_1020.arg2; + multi_return_int_int_int mr_1076 = time__calculate_time_from_offset(abs % _const_time__seconds_per_day); + int hr = mr_1076.arg0; + int min = mr_1076.arg1; + int sec = mr_1076.arg2; + time__Time _t1 = ((time__Time){ + .year = year, + .month = month, + .day = day, + .hour = hr, + .minute = min, + .second = sec, + .microsecond = microsecond, + ._v_unix = abs, + .is_local = 0, + }); + return _t1; +} + +VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_date_from_offset(i64 day_offset_) { + i64 day_offset = day_offset_; + int year = 2001; + day_offset -= 11323; + year += ((int)(day_offset / _const_time__days_per_400_years)) * 400; + day_offset %= _const_time__days_per_400_years; + if (day_offset == _const_time__days_per_100_years * 4) { + year += 300; + day_offset -= _const_time__days_per_100_years * 3; + } else { + year += ((int)(day_offset / _const_time__days_per_100_years)) * 100; + day_offset %= _const_time__days_per_100_years; + } + if (day_offset == _const_time__days_per_4_years * 25) { + year += 96; + day_offset -= _const_time__days_per_4_years * 24; + } else { + year += ((int)(day_offset / _const_time__days_per_4_years)) * 4; + day_offset %= _const_time__days_per_4_years; + } + if (day_offset == 1460) { + year += 3; + day_offset -= 1095; + } else { + year += ((int)(day_offset / 365)); + day_offset %= 365; + } + if (day_offset < 0) { + year--; + if (time__is_leap_year(year)) { + day_offset += 366; + } else { + day_offset += 365; + } + } + if (time__is_leap_year(year)) { + if (day_offset > 59) { + day_offset--; + } else if (day_offset == 59) { + return (multi_return_int_int_int){.arg0=year, .arg1=2, .arg2=29}; + } + } + i64 estimated_month = day_offset / 31; + for (;;) { + if (!(day_offset >= (*(int*)/*ee elem_sym */array_get(_const_time__days_before, estimated_month + 1)))) break; + estimated_month++; + } + for (;;) { + if (!(day_offset < (*(int*)/*ee elem_sym */array_get(_const_time__days_before, estimated_month)))) break; + if (estimated_month == 0) { + break; + } + estimated_month--; + } + day_offset -= (*(int*)/*ee elem_sym */array_get(_const_time__days_before, estimated_month)); + return (multi_return_int_int_int){.arg0=year, .arg1=((int)(estimated_month + 1)), .arg2=((int)(day_offset + 1))}; +} + +VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_time_from_offset(i64 second_offset_) { + i64 second_offset = second_offset_; + if (second_offset < 0) { + second_offset += _const_time__seconds_per_day; + } + i64 hour_ = second_offset / _const_time__seconds_per_hour; + second_offset %= _const_time__seconds_per_hour; + i64 min = second_offset / _const_time__seconds_per_minute; + second_offset %= _const_time__seconds_per_minute; + return (multi_return_int_int_int){.arg0=((int)(hour_)), .arg1=((int)(min)), .arg2=((int)(second_offset))}; } Option_v__vmod__Manifest v__vmod__from_file(string vmod_path) { @@ -32212,90 +34660,6 @@ multi_return_Array_string_Array_string_Array_string Array_v__cflag__CFlag_define return (multi_return_Array_string_Array_string_Array_string){.arg0=defines, .arg1=others, .arg2=libs}; } -void rand__wyrand__WyRandRNG_seed(rand__wyrand__WyRandRNG* rng, Array_u32 seed_data) { - if (seed_data.len != 2) { - eprintln(_SLIT("WyRandRNG needs 2 32-bit unsigned integers as the seed.")); - _v_exit(1); - VUNREACHABLE(); - } - rng->state = ((*(u32*)/*ee elem_sym */array_get(seed_data, 0)) | (((u64)((*(u32*)/*ee elem_sym */array_get(seed_data, 1)))) << 32U)); - rng->bytes_left = 0; - rng->buffer = 0U; -} - -// Attr: [inline] -inline u8 rand__wyrand__WyRandRNG_u8(rand__wyrand__WyRandRNG* rng) { - if (rng->bytes_left >= 1) { - rng->bytes_left -= 1; - u8 value = ((u8)(rng->buffer)); - rng->buffer >>= 8U; - u8 _t1 = value; - return _t1; - } - rng->buffer = rand__wyrand__WyRandRNG_u64(rng); - rng->bytes_left = 7; - u8 value = ((u8)(rng->buffer)); - rng->buffer >>= 8U; - u8 _t2 = value; - return _t2; -} - -// Attr: [inline] -inline u16 rand__wyrand__WyRandRNG_u16(rand__wyrand__WyRandRNG* rng) { - if (rng->bytes_left >= 2) { - rng->bytes_left -= 2; - u16 value = ((u16)(rng->buffer)); - rng->buffer >>= 16U; - u16 _t1 = value; - return _t1; - } - u64 ans = rand__wyrand__WyRandRNG_u64(rng); - rng->buffer = ans >> 16U; - rng->bytes_left = 6; - u16 _t2 = ((u16)(ans)); - return _t2; -} - -// Attr: [inline] -inline u32 rand__wyrand__WyRandRNG_u32(rand__wyrand__WyRandRNG* rng) { - if (rng->bytes_left >= 4) { - rng->bytes_left -= 4; - u32 value = ((u32)(rng->buffer)); - rng->buffer >>= 32U; - u32 _t1 = value; - return _t1; - } - u64 ans = rand__wyrand__WyRandRNG_u64(rng); - rng->buffer = ans >> 32U; - rng->bytes_left = 4; - u32 _t2 = ((u32)(ans)); - return _t2; -} - -// Attr: [inline] -inline u64 rand__wyrand__WyRandRNG_u64(rand__wyrand__WyRandRNG* rng) { - { // Unsafe block - u64 seed1 = rng->state; - seed1 += _const_rand__wyrand__wyp0; - rng->state = seed1; - u64 _t1 = hash__wymum((seed1 ^ _const_rand__wyrand__wyp1), seed1); - return _t1; - } - u64 _t2 = 0U; - return _t2; -} - -// Attr: [inline] -inline int rand__wyrand__WyRandRNG_block_size(rand__wyrand__WyRandRNG* rng) { - int _t1 = 64; - return _t1; -} - -// Attr: [unsafe] -void rand__wyrand__WyRandRNG_free(rand__wyrand__WyRandRNG* rng) { - _v_free(rng); -} - VV_LOCAL_SYMBOL Option_string v__pkgconfig__desc(string mod) { v__pkgconfig__Options options = ((v__pkgconfig__Options){.path = (string){.str=(byteptr)"", .is_lit=1},.debug = 0,.norecurse = 0,.only_description = true,.use_default_paths = true,}); Option_v__pkgconfig__PkgConfig_ptr _t1 = v__pkgconfig__load(mod, options); @@ -32920,6 +35284,243 @@ int runtime__nr_cpus(void) { return _t1; } +Option_string v__util__diff__find_working_diff_command(void) { + string env_difftool = os__getenv(_SLIT("VDIFF_TOOL")); + string env_diffopts = os__getenv(_SLIT("VDIFF_OPTIONS")); + if ((env_difftool).len != 0) { + Option_string _t1; + opt_ok(&(string[]) { str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = env_difftool}}, {_SLIT(" "), 0xfe10, {.d_s = env_diffopts}}, {_SLIT0, 0, { .d_c = 0 }}})) }, (Option*)(&_t1), sizeof(string)); + return _t1; + } + Array_string known_diff_tools = __new_array_with_default(0, 0, sizeof(string), 0); + if (env_difftool.len > 0) { + array_push((array*)&known_diff_tools, _MOV((string[]){ string_clone(env_difftool) })); + } + _PUSH_MANY(&known_diff_tools, (new_array_from_c_array(8, 8, sizeof(string), _MOV((string[8]){_SLIT("colordiff"), _SLIT("gdiff"), _SLIT("diff"), _SLIT("colordiff.exe"), _SLIT("diff.exe"), _SLIT("opendiff"), _SLIT("code"), _SLIT("code.cmd")}))), _t3, Array_string); + for (int _t4 = 0; _t4 < known_diff_tools.len; ++_t4) { + string diffcmd = ((string*)known_diff_tools.data)[_t4]; + if (string__eq(diffcmd, _SLIT("opendiff"))) { + if (v__util__diff__opendiff_exists()) { + Option_string _t5; + opt_ok(&(string[]) { diffcmd }, (Option*)(&_t5), sizeof(string)); + return _t5; + } + continue; + } + os__Result p = os__execute( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = diffcmd}}, {_SLIT(" --version"), 0, { .d_c = 0 }}}))); + if (p.exit_code < 0) { + continue; + } + if (p.exit_code == 127 && string__eq(diffcmd, env_difftool)) { + return (Option_string){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("could not find specified VDIFF_TOOL "), 0xfe10, {.d_s = diffcmd}}, {_SLIT0, 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (p.exit_code == 0) { + if (string__eq(diffcmd, _SLIT("code")) || string__eq(diffcmd, _SLIT("code.cmd"))) { + Option_string _t7; + opt_ok(&(string[]) { str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = diffcmd}}, {_SLIT(" "), 0xfe10, {.d_s = env_diffopts}}, {_SLIT(" -d"), 0, { .d_c = 0 }}})) }, (Option*)(&_t7), sizeof(string)); + return _t7; + } + Option_string _t8; + opt_ok(&(string[]) { str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = diffcmd}}, {_SLIT(" "), 0xfe10, {.d_s = env_diffopts}}, {_SLIT0, 0, { .d_c = 0 }}})) }, (Option*)(&_t8), sizeof(string)); + return _t8; + } + } + return (Option_string){ .state=2, .err=_v_error(_SLIT("No working \"diff\" command found")), .data={EMPTY_STRUCT_INITIALIZATION} }; +} + +VV_LOCAL_SYMBOL bool v__util__diff__opendiff_exists(void) { + os__Result o = os__execute(_SLIT("opendiff")); + if (o.exit_code < 0) { + bool _t1 = false; + return _t1; + } + if (o.exit_code == 1) { + if (string_contains(o.output, _SLIT("too few arguments"))) { + bool _t2 = true; + return _t2; + } + } + bool _t3 = false; + return _t3; +} + +string v__util__diff__color_compare_files(string diff_cmd, string file1, string file2) { + if ((diff_cmd).len != 0) { + string full_cmd = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = diff_cmd}}, {_SLIT(" --minimal --text --unified=2 --show-function-line=\"fn \" "), 0xfe10, {.d_s = os__quoted_path(file1)}}, {_SLIT(" "), 0xfe10, {.d_s = os__quoted_path(file2)}}, {_SLIT(" "), 0, { .d_c = 0 }}})); + os__Result x = os__execute(full_cmd); + if (x.exit_code < 0) { + string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("comparison command: `"), 0xfe10, {.d_s = full_cmd}}, {_SLIT("` not found"), 0, { .d_c = 0 }}})); + return _t1; + } + string _t2 = string_trim_right(x.output, _SLIT("\r\n")); + return _t2; + } + string _t3 = _SLIT(""); + return _t3; +} + +string v__util__diff__color_compare_strings(string diff_cmd, string unique_prefix, string expected, string found) { + string cdir = os__join_path_single(os__cache_dir(), unique_prefix); + Option_bool _t1 = os__mkdir(cdir); + if (_t1.state != 0) { /*or block*/ + IError err = _t1.err; + } + + (*(bool*)_t1.data); + u64 ctime = time__sys_mono_now(); + string e_file = os__join_path_single(cdir, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe08, {.d_u64 = ctime}}, {_SLIT(".expected.txt"), 0, { .d_c = 0 }}}))); + string f_file = os__join_path_single(cdir, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe08, {.d_u64 = ctime}}, {_SLIT(".found.txt"), 0, { .d_c = 0 }}}))); + Option_void _t2 = os__write_file(e_file, expected); + if (_t2.state != 0 && _t2.err._typ != _IError_None___index) { + IError err = _t2.err; + _v_panic(IError_str(err)); + VUNREACHABLE(); + ; + } + + ; + Option_void _t3 = os__write_file(f_file, found); + if (_t3.state != 0 && _t3.err._typ != _IError_None___index) { + IError err = _t3.err; + _v_panic(IError_str(err)); + VUNREACHABLE(); + ; + } + + ; + string res = v__util__diff__color_compare_files(diff_cmd, e_file, f_file); + Option_void _t4 = os__rmdir_all(cdir); + if (_t4.state != 0 && _t4.err._typ != _IError_None___index) { + IError err = _t4.err; + } + + ; + string _t5 = res; + return _t5; +} + +// Attr: [inline] +inline VV_LOCAL_SYMBOL u32 rand__seed__nr_next(u32 prev) { + u32 _t1 = prev * 1664525U + 1013904223U; + return _t1; +} + +Array_u32 rand__seed__time_seed_array(int count) { + u64 ctime = time__sys_mono_now(); + u32 seed = ((u32)((ctime >> 32U ^ ((ctime & 0x00000000FFFFFFFFU))))); + Array_u32 seed_data = __new_array_with_default(0, count, sizeof(u32), 0); + for (int _t1 = 0; _t1 < count; ++_t1) { + seed = rand__seed__nr_next(seed); + array_push((array*)&seed_data, _MOV((u32[]){ rand__seed__nr_next(seed) })); + } + Array_u32 _t3 = seed_data; + return _t3; +} + +// Attr: [manualfree] +u32 rand__seed__time_seed_32(void) { + Array_u32 sa = rand__seed__time_seed_array(1); + u32 res = (*(u32*)/*ee elem_sym */array_get(sa, 0)); + array_free(&sa); + u32 _t1 = res; + return _t1; +} + +// Attr: [manualfree] +u64 rand__seed__time_seed_64(void) { + Array_u32 seed_data = rand__seed__time_seed_array(2); + u64 lower = ((u64)((*(u32*)/*ee elem_sym */array_get(seed_data, 0)))); + u64 upper = ((u64)((*(u32*)/*ee elem_sym */array_get(seed_data, 1)))); + array_free(&seed_data); + u64 res = (lower | (upper << 32U)); + u64 _t1 = res; + return _t1; +} + +void rand__wyrand__WyRandRNG_seed(rand__wyrand__WyRandRNG* rng, Array_u32 seed_data) { + if (seed_data.len != 2) { + eprintln(_SLIT("WyRandRNG needs 2 32-bit unsigned integers as the seed.")); + _v_exit(1); + VUNREACHABLE(); + } + rng->state = ((*(u32*)/*ee elem_sym */array_get(seed_data, 0)) | (((u64)((*(u32*)/*ee elem_sym */array_get(seed_data, 1)))) << 32U)); + rng->bytes_left = 0; + rng->buffer = 0U; +} + +// Attr: [inline] +inline u8 rand__wyrand__WyRandRNG_u8(rand__wyrand__WyRandRNG* rng) { + if (rng->bytes_left >= 1) { + rng->bytes_left -= 1; + u8 value = ((u8)(rng->buffer)); + rng->buffer >>= 8U; + u8 _t1 = value; + return _t1; + } + rng->buffer = rand__wyrand__WyRandRNG_u64(rng); + rng->bytes_left = 7; + u8 value = ((u8)(rng->buffer)); + rng->buffer >>= 8U; + u8 _t2 = value; + return _t2; +} + +// Attr: [inline] +inline u16 rand__wyrand__WyRandRNG_u16(rand__wyrand__WyRandRNG* rng) { + if (rng->bytes_left >= 2) { + rng->bytes_left -= 2; + u16 value = ((u16)(rng->buffer)); + rng->buffer >>= 16U; + u16 _t1 = value; + return _t1; + } + u64 ans = rand__wyrand__WyRandRNG_u64(rng); + rng->buffer = ans >> 16U; + rng->bytes_left = 6; + u16 _t2 = ((u16)(ans)); + return _t2; +} + +// Attr: [inline] +inline u32 rand__wyrand__WyRandRNG_u32(rand__wyrand__WyRandRNG* rng) { + if (rng->bytes_left >= 4) { + rng->bytes_left -= 4; + u32 value = ((u32)(rng->buffer)); + rng->buffer >>= 32U; + u32 _t1 = value; + return _t1; + } + u64 ans = rand__wyrand__WyRandRNG_u64(rng); + rng->buffer = ans >> 32U; + rng->bytes_left = 4; + u32 _t2 = ((u32)(ans)); + return _t2; +} + +// Attr: [inline] +inline u64 rand__wyrand__WyRandRNG_u64(rand__wyrand__WyRandRNG* rng) { + { // Unsafe block + u64 seed1 = rng->state; + seed1 += _const_rand__wyrand__wyp0; + rng->state = seed1; + u64 _t1 = hash__wymum((seed1 ^ _const_rand__wyrand__wyp1), seed1); + return _t1; + } + u64 _t2 = 0U; + return _t2; +} + +// Attr: [inline] +inline int rand__wyrand__WyRandRNG_block_size(rand__wyrand__WyRandRNG* rng) { + int _t1 = 64; + return _t1; +} + +// Attr: [unsafe] +void rand__wyrand__WyRandRNG_free(rand__wyrand__WyRandRNG* rng) { + _v_free(rng); +} + string rand__uuid_v4(void) { string _t1 = rand__internal_uuid_v4(default_rng); return _t1; @@ -33566,7 +36167,7 @@ string rand__ascii(int len) { } v__pref__Preferences* v__pref__new_preferences(void) { - v__pref__Preferences* p = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.os = 0,.backend = 0,.build_mode = 0,.arch = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.profile_no_inline = 0,.profile_fns = __new_array(0, 0, sizeof(string)),.translated = 0,.is_prod = 0,.obfuscate = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.use_cache = 0,.retry_compilation = true,.is_stats = 0,.cflags = (string){.str=(byteptr)"", .is_lit=1},.m64 = 0,.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.ccompiler_type = 0,.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_fmt = 0,.is_vet = 0,.is_bare = 0,.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.no_preludes = 0,.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.lookup_path = __new_array(0, 0, sizeof(string)),.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.use_color = 0,.no_parallel = 0,.is_vweb = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.is_ios_simulator = 0,.is_apk = 0,.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.is_help = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.is_cstrict = 0,.assert_failure_mode = 0,.message_limit = 100,.nofloat = 0,.checker_match_exhaustive_cutoff_limit = 12,}, sizeof(v__pref__Preferences))); + v__pref__Preferences* p = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.os = 0,.backend = 0,.build_mode = 0,.arch = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.profile_no_inline = 0,.profile_fns = __new_array(0, 0, sizeof(string)),.translated = 0,.is_prod = 0,.obfuscate = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.use_cache = 0,.retry_compilation = true,.is_stats = 0,.cflags = (string){.str=(byteptr)"", .is_lit=1},.m64 = 0,.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.ccompiler_type = 0,.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_fmt = 0,.is_vet = 0,.is_bare = 0,.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.no_preludes = 0,.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.lookup_path = __new_array(0, 0, sizeof(string)),.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.use_color = 0,.no_parallel = 0,.is_vweb = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.is_ios_simulator = 0,.is_apk = 0,.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.is_help = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.is_cstrict = 0,.assert_failure_mode = 0,.message_limit = 100,.nofloat = 0,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,}, sizeof(v__pref__Preferences))); v__pref__Preferences_fill_with_defaults(p); v__pref__Preferences* _t1 = p; return _t1; @@ -33634,7 +36235,7 @@ void v__pref__Preferences_fill_with_defaults(v__pref__Preferences* p) { if ((p->third_party_option).len == 0) { p->third_party_option = p->cflags; } - string vhash = _SLIT("b81f06e36"); + string vhash = _SLIT("b7f2ef78b"); p->cache_manager = v__vcache__new_cache_manager(new_array_from_c_array(7, 7, sizeof(string), _MOV((string[7]){string_clone(vhash), str_intp(6, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = v__pref__Backend_str(p->backend)}}, {_SLIT(" | "), 0xfe10, {.d_s = v__pref__OS_str(p->os)}}, {_SLIT(" | "), 0xfe10, {.d_s = p->ccompiler}}, {_SLIT(" | "), 0xfe10, {.d_s = p->is_prod ? _SLIT("true") : _SLIT("false")}}, {_SLIT(" | "), 0xfe10, {.d_s = p->sanitize ? _SLIT("true") : _SLIT("false")}}, {_SLIT0, 0, { .d_c = 0 }}})), string_clone(string_trim_space(p->cflags)), string_clone(string_trim_space(p->third_party_option)), string_clone(Array_string_str(p->compile_defines_all)), string_clone(Array_string_str(p->compile_defines)), string_clone(Array_string_str(p->lookup_path))}))); if (string__eq(os__user_os(), _SLIT("windows"))) { p->use_cache = false; @@ -34062,7 +36663,7 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args(Array_string kn } multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors(Array_string known_external_commands, Array_string args, bool show_output) { - v__pref__Preferences* res = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.os = 0,.backend = 0,.build_mode = 0,.arch = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.profile_no_inline = 0,.profile_fns = __new_array(0, 0, sizeof(string)),.translated = 0,.is_prod = 0,.obfuscate = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.use_cache = 0,.retry_compilation = true,.is_stats = 0,.cflags = (string){.str=(byteptr)"", .is_lit=1},.m64 = 0,.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.ccompiler_type = 0,.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_fmt = 0,.is_vet = 0,.is_bare = 0,.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.no_preludes = 0,.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.lookup_path = __new_array(0, 0, sizeof(string)),.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.use_color = 0,.no_parallel = 0,.is_vweb = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.is_ios_simulator = 0,.is_apk = 0,.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.is_help = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.is_cstrict = 0,.assert_failure_mode = 0,.message_limit = 100,.nofloat = 0,.checker_match_exhaustive_cutoff_limit = 12,}, sizeof(v__pref__Preferences))); + v__pref__Preferences* res = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.os = 0,.backend = 0,.build_mode = 0,.arch = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.profile_no_inline = 0,.profile_fns = __new_array(0, 0, sizeof(string)),.translated = 0,.is_prod = 0,.obfuscate = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.use_cache = 0,.retry_compilation = true,.is_stats = 0,.cflags = (string){.str=(byteptr)"", .is_lit=1},.m64 = 0,.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.ccompiler_type = 0,.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_fmt = 0,.is_vet = 0,.is_bare = 0,.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.no_preludes = 0,.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.lookup_path = __new_array(0, 0, sizeof(string)),.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.use_color = 0,.no_parallel = 0,.is_vweb = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.is_ios_simulator = 0,.is_apk = 0,.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.is_help = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.is_cstrict = 0,.assert_failure_mode = 0,.message_limit = 100,.nofloat = 0,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,}, sizeof(v__pref__Preferences))); #if defined(TARGET_IS_64BIT) { res->m64 = true; @@ -34439,6 +37040,10 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors res->message_limit = string_int(os__cmdline__option(current_args, arg, _SLIT("5"))); i++; } + else if (string__eq(arg, _SLIT("-thread-stack-size"))) { + res->thread_stack_size = string_int(os__cmdline__option(current_args, arg, int_str(res->thread_stack_size))); + i++; + } else if (string__eq(arg, _SLIT("-cc"))) { res->ccompiler = os__cmdline__option(current_args, _SLIT("-cc"), _SLIT("cc")); array_push((array*)&res->build_options, _MOV((string[]){ string_clone( str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = arg}}, {_SLIT(" \""), 0xfe10, {.d_s = res->ccompiler}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); @@ -38769,6 +41374,17 @@ void v__ast__IndexExpr_recursive_mapset_is_setter(v__ast__IndexExpr* lx, bool va } } +void v__ast__IndexExpr_recursive_arraymap_set_is_setter(v__ast__IndexExpr* lx) { + lx->is_setter = true; + if ((lx->left)._typ == 308 /* v.ast.IndexExpr */) { + v__ast__IndexExpr_recursive_arraymap_set_is_setter(&(*lx->left._v__ast__IndexExpr)); + } else if ((lx->left)._typ == 325 /* v.ast.SelectorExpr */) { + if (((*lx->left._v__ast__SelectorExpr).expr)._typ == 308 /* v.ast.IndexExpr */) { + v__ast__IndexExpr_recursive_arraymap_set_is_setter(&(*(*lx->left._v__ast__SelectorExpr).expr._v__ast__IndexExpr)); + } + } +} + Map_string_v__ast__ScopeObject v__ast__all_registers(v__ast__Table* t, v__pref__Arch arch) { Map_string_v__ast__ScopeObject res = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); switch (arch) { @@ -40770,7 +43386,7 @@ v__ast__FnDecl v__ast__FnDecl_new_method_with_receiver_type(v__ast__FnDecl* f, v v__ast__FnDecl _t1 = *new_method; return _t1; } - return (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}; + return (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}; } VV_LOCAL_SYMBOL bool v__ast__Param_equals(v__ast__Param* p, v__ast__Param* o) { @@ -40794,7 +43410,7 @@ VV_LOCAL_SYMBOL bool Array_v__ast__Param_equals(Array_v__ast__Param p, Array_v__ } v__ast__Table* v__ast__new_table(void) { - v__ast__Table* t = ((v__ast__Table*)memdup(&(v__ast__Table){.parsing_type = (string){.str=(byteptr)"", .is_lit=1},.type_symbols = __new_array(0, 0, sizeof(v__ast__TypeSymbol*)),.type_idxs = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.fns = new_map(sizeof(string), sizeof(v__ast__Fn), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.iface_types = new_map(sizeof(string), sizeof(Array_v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.dumps = new_map(sizeof(int), sizeof(string), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.imports = __new_array(0, 0, sizeof(string)),.modules = __new_array(0, 0, sizeof(string)),.global_scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = 0,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))),.cflags = __new_array(0, 0, sizeof(v__cflag__CFlag)),.redefined_fns = __new_array(0, 0, sizeof(string)),.fn_generic_types = new_map(sizeof(string), sizeof(Array_Array_v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.interfaces = new_map(sizeof(int), sizeof(v__ast__InterfaceDecl), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.cmod_prefix = (string){.str=(byteptr)"", .is_lit=1},.is_fmt = 0,.used_fns = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_consts = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_globals = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_vweb_types = __new_array(0, 0, sizeof(v__ast__Type)),.used_maps = 0,.panic_handler = v__ast__default_table_panic_handler,.panic_userdata = ((voidptr)(0)),.panic_npanics = 0,.cur_fn = 0,.cur_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.gostmts = 0,.enum_decls = new_map(sizeof(string), sizeof(v__ast__EnumDecl), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.mdeprecated_msg = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.mdeprecated_after = new_map(sizeof(string), sizeof(time__Time), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.builtin_pub_fns = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),}, sizeof(v__ast__Table))); + v__ast__Table* t = ((v__ast__Table*)memdup(&(v__ast__Table){.parsing_type = (string){.str=(byteptr)"", .is_lit=1},.type_symbols = __new_array(0, 0, sizeof(v__ast__TypeSymbol*)),.type_idxs = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.fns = new_map(sizeof(string), sizeof(v__ast__Fn), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.iface_types = new_map(sizeof(string), sizeof(Array_v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.dumps = new_map(sizeof(int), sizeof(string), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.imports = __new_array(0, 0, sizeof(string)),.modules = __new_array(0, 0, sizeof(string)),.global_scope = ((v__ast__Scope*)memdup(&(v__ast__Scope){.objects = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.struct_fields = new_map(sizeof(string), sizeof(v__ast__ScopeStructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.parent = 0,.detached_from_parent = 0,.children = __new_array(0, 0, sizeof(v__ast__Scope*)),.start_pos = 0,.end_pos = 0,}, sizeof(v__ast__Scope))),.cflags = __new_array(0, 0, sizeof(v__cflag__CFlag)),.redefined_fns = __new_array(0, 0, sizeof(string)),.fn_generic_types = new_map(sizeof(string), sizeof(Array_Array_v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.interfaces = new_map(sizeof(int), sizeof(v__ast__InterfaceDecl), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop),.cmod_prefix = (string){.str=(byteptr)"", .is_lit=1},.is_fmt = 0,.used_fns = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_consts = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_globals = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.used_vweb_types = __new_array(0, 0, sizeof(v__ast__Type)),.used_maps = 0,.panic_handler = v__ast__default_table_panic_handler,.panic_userdata = ((voidptr)(0)),.panic_npanics = 0,.cur_fn = 0,.cur_concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.gostmts = 0,.enum_decls = new_map(sizeof(string), sizeof(v__ast__EnumDecl), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.mdeprecated_msg = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.mdeprecated_after = new_map(sizeof(string), sizeof(time__Time), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.builtin_pub_fns = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.pointer_size = 0,}, sizeof(v__ast__Table))); v__ast__Table_register_builtin_type_symbols(t); t->is_fmt = true; v__ast__set_global_table(t); @@ -41070,9 +43686,9 @@ Option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_from continue; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_12267 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t5.data); - v__ast__Fn method = mr_12267.arg0; - Array_v__ast__Type types = mr_12267.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_12290 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t5.data); + v__ast__Fn method = mr_12290.arg0; + Array_v__ast__Type types = mr_12290.arg1; array_push((array*)&found_methods, _MOV((v__ast__Fn[]){ method })); array_push((array*)&embed_of_found_methods, _MOV((v__ast__Type[]){ embed })); _PUSH_MANY(&embed_of_found_methods, (types), _t8, Array_v__ast__Type); @@ -41104,9 +43720,9 @@ Option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_from continue; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_12925 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t15.data); - v__ast__Fn method = mr_12925.arg0; - Array_v__ast__Type types = mr_12925.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_12948 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t15.data); + v__ast__Fn method = mr_12948.arg0; + Array_v__ast__Type types = mr_12948.arg1; array_push((array*)&found_methods, _MOV((v__ast__Fn[]){ method })); array_push((array*)&embed_of_found_methods, _MOV((v__ast__Type[]){ embed })); _PUSH_MANY(&embed_of_found_methods, (types), _t18, Array_v__ast__Type); @@ -41129,9 +43745,9 @@ Option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_from continue; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_13388 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t22.data); - v__ast__Fn method = mr_13388.arg0; - Array_v__ast__Type embed_types = mr_13388.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_13411 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t22.data); + v__ast__Fn method = mr_13411.arg0; + Array_v__ast__Type embed_types = mr_13411.arg1; if (embed_types.len != 0) { Option_multi_return_v__ast__Fn_Array_v__ast__Type _t23; opt_ok(&(multi_return_v__ast__Fn_Array_v__ast__Type/*X*/[]) { (multi_return_v__ast__Fn_Array_v__ast__Type){.arg0=method, .arg1=embed_types} }, (Option*)(&_t23), sizeof(multi_return_v__ast__Fn_Array_v__ast__Type)); @@ -41158,8 +43774,8 @@ Option_v__ast__Fn v__ast__Table_find_method_with_embeds(v__ast__Table* t, v__ast return (Option_v__ast__Fn){ .state=2, .err=first_err, .data={EMPTY_STRUCT_INITIALIZATION} }; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_13849 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t3.data); - v__ast__Fn func = mr_13849.arg0; + multi_return_v__ast__Fn_Array_v__ast__Type mr_13872 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t3.data); + v__ast__Fn func = mr_13872.arg0; Option_v__ast__Fn _t5; opt_ok(&(v__ast__Fn[]) { func }, (Option*)(&_t5), sizeof(v__ast__Fn)); return _t5; @@ -41322,9 +43938,9 @@ Option_multi_return_v__ast__StructField_Array_v__ast__Type v__ast__Table_find_fi continue; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_17096 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t5.data); - v__ast__StructField field = mr_17096.arg0; - Array_v__ast__Type types = mr_17096.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_17119 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t5.data); + v__ast__StructField field = mr_17119.arg0; + Array_v__ast__Type types = mr_17119.arg1; array_push((array*)&found_fields, _MOV((v__ast__StructField[]){ field })); array_push((array*)&embeds_of_found_fields, _MOV((v__ast__Type[]){ embed })); _PUSH_MANY(&embeds_of_found_fields, (types), _t8, Array_v__ast__Type); @@ -41347,9 +43963,9 @@ Option_multi_return_v__ast__StructField_Array_v__ast__Type v__ast__Table_find_fi continue; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_17549 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t12.data); - v__ast__StructField field = mr_17549.arg0; - Array_v__ast__Type embed_types = mr_17549.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_17572 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t12.data); + v__ast__StructField field = mr_17572.arg0; + Array_v__ast__Type embed_types = mr_17572.arg1; if (embed_types.len > 0) { Option_multi_return_v__ast__StructField_Array_v__ast__Type _t13; opt_ok(&(multi_return_v__ast__StructField_Array_v__ast__Type/*X*/[]) { (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=field, .arg1=embed_types} }, (Option*)(&_t13), sizeof(multi_return_v__ast__StructField_Array_v__ast__Type)); @@ -41380,8 +43996,8 @@ Option_v__ast__StructField v__ast__Table_find_field_with_embeds(v__ast__Table* t return (Option_v__ast__StructField){ .state=2, .err=first_err, .data={EMPTY_STRUCT_INITIALIZATION} }; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_18147 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t3.data); - v__ast__StructField field = mr_18147.arg0; + multi_return_v__ast__StructField_Array_v__ast__Type mr_18170 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t3.data); + v__ast__StructField field = mr_18170.arg0; Option_v__ast__StructField _t5; opt_ok(&(v__ast__StructField[]) { field }, (Option*)(&_t5), sizeof(v__ast__StructField)); return _t5; @@ -41875,9 +44491,9 @@ int v__ast__Table_find_or_register_multi_return(v__ast__Table* t, Array_v__ast__ for (int i = 0; i < mr_typs.len; ++i) { v__ast__Type mr_typ = ((v__ast__Type*)mr_typs.data)[i]; v__ast__TypeSymbol* mr_type_sym = v__ast__Table_sym(t, v__ast__mktyp(mr_typ)); - multi_return_string_string mr_31205 = (v__ast__Type_is_ptr(mr_typ) ? ((multi_return_string_string){.arg0=_SLIT("&"),.arg1=_SLIT("ref_")}) : ((multi_return_string_string){.arg0=_SLIT(""),.arg1=_SLIT("")})); - string ref = mr_31205.arg0; - string cref = mr_31205.arg1; + multi_return_string_string mr_31228 = (v__ast__Type_is_ptr(mr_typ) ? ((multi_return_string_string){.arg0=_SLIT("&"),.arg1=_SLIT("ref_")}) : ((multi_return_string_string){.arg0=_SLIT(""),.arg1=_SLIT("")})); + string ref = mr_31228.arg0; + string cref = mr_31228.arg1; name = /*f*/string__plus(name, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = ref}}, {_SLIT0, 0xfe10, {.d_s = mr_type_sym->name}}, {_SLIT0, 0, { .d_c = 0 }}}))); cname = /*f*/string__plus(cname, str_intp(3, _MOV((StrIntpData[]){{_SLIT("_"), 0xfe10, {.d_s = cref}}, {_SLIT0, 0xfe10, {.d_s = mr_type_sym->cname}}, {_SLIT0, 0, { .d_c = 0 }}}))); if (i < mr_typs.len - 1) { @@ -43885,6 +46501,182 @@ inline bool v__ast__TypeSymbol_is_builtin(v__ast__TypeSymbol* t) { return _t1; } +int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) { + if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__optional)) { + int _t1 = v__ast__Table_type_size(t, _const_v__ast__error_type_idx); + return _t1; + } + if (v__ast__Type_nr_muls(typ) > 0) { + int _t2 = t->pointer_size; + return _t2; + } + v__ast__TypeSymbol* sym = v__ast__Table_sym(t, typ); + switch (sym->kind) { + case v__ast__Kind__placeholder: + case v__ast__Kind__void: + case v__ast__Kind__none_: + { + int _t3 = 0; + return _t3; + break; + } + case v__ast__Kind__voidptr: + case v__ast__Kind__byteptr: + case v__ast__Kind__charptr: + case v__ast__Kind__function: + case v__ast__Kind__usize: + case v__ast__Kind__isize: + case v__ast__Kind__any: + case v__ast__Kind__thread: + case v__ast__Kind__chan: + { + int _t4 = t->pointer_size; + return _t4; + break; + } + case v__ast__Kind__i8: + case v__ast__Kind__u8: + case v__ast__Kind__char: + case v__ast__Kind__bool: + { + int _t5 = 1; + return _t5; + break; + } + case v__ast__Kind__i16: + case v__ast__Kind__u16: + { + int _t6 = 2; + return _t6; + break; + } + case v__ast__Kind__int: + case v__ast__Kind__u32: + case v__ast__Kind__rune: + case v__ast__Kind__f32: + case v__ast__Kind__enum_: + { + int _t7 = 4; + return _t7; + break; + } + case v__ast__Kind__i64: + case v__ast__Kind__u64: + case v__ast__Kind__int_literal: + case v__ast__Kind__f64: + case v__ast__Kind__float_literal: + { + int _t8 = 8; + return _t8; + break; + } + case v__ast__Kind__alias: + { + int _t9 = v__ast__Table_type_size(t, (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 470) /*expected idx: 470, name: v.ast.Alias */ ).parent_type); + return _t9; + break; + } + case v__ast__Kind__struct_: + case v__ast__Kind__string: + case v__ast__Kind__multi_return: + { + int max_alignment = 0; + int total_size = 0; + Array_v__ast__Type _t10; /* if prepend */ + if ((sym->info)._typ == 455 /* v.ast.Struct */) { + Array_v__ast__Type _t11 = {0}; + Array_v__ast__StructField _t11_orig = (*sym->info._v__ast__Struct).fields; + int _t11_len = _t11_orig.len; + _t11 = __new_array(0, _t11_len, sizeof(v__ast__Type)); + + for (int _t12 = 0; _t12 < _t11_len; ++_t12) { + v__ast__StructField it = ((v__ast__StructField*) _t11_orig.data)[_t12]; + v__ast__Type ti = it.typ; + array_push((array*)&_t11, &ti); + } + _t10 =_t11; + } else { + _t10 = (/* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 481) /*expected idx: 481, name: v.ast.MultiReturn */ ).types; + } + Array_v__ast__Type types = _t10; + for (int _t13 = 0; _t13 < types.len; ++_t13) { + v__ast__Type ftyp = ((v__ast__Type*)types.data)[_t13]; + int field_size = v__ast__Table_type_size(t, ftyp); + int alignment = (field_size > t->pointer_size ? (t->pointer_size) : (field_size)); + if (alignment > max_alignment) { + max_alignment = alignment; + } + total_size = v__ast__round_up(total_size, alignment) + field_size; + } + int _t14 = v__ast__round_up(total_size, max_alignment); + return _t14; + break; + } + case v__ast__Kind__sum_type: + case v__ast__Kind__interface_: + case v__ast__Kind__aggregate: + { + if (sym->info._typ == 474 /* v.ast.SumType */) { + int _t15 = ((*sym->info._v__ast__SumType).fields.len + 2) * t->pointer_size; + return _t15; + } + else if (sym->info._typ == 468 /* v.ast.Aggregate */) { + int _t16 = ((*sym->info._v__ast__Aggregate).fields.len + 2) * t->pointer_size; + return _t16; + } + else if (sym->info._typ == 473 /* v.ast.Interface */) { + int res = ((*sym->info._v__ast__Interface).fields.len + 2) * t->pointer_size; + for (int _t17 = 0; _t17 < (*sym->info._v__ast__Interface).embeds.len; ++_t17) { + v__ast__Type etyp = ((v__ast__Type*)(*sym->info._v__ast__Interface).embeds.data)[_t17]; + res += v__ast__Table_type_size(t, etyp) - 2 * t->pointer_size; + } + int _t18 = res; + return _t18; + } + + else { + int _t19 = 0; + return _t19; + } + ; + break; + } + case v__ast__Kind__array_fixed: + { + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 478) /*expected idx: 478, name: v.ast.ArrayFixed */ ; + int _t20 = info.size * v__ast__Table_type_size(t, info.elem_type); + return _t20; + break; + } + case v__ast__Kind__map: + { + int _t21 = (t->pointer_size == 8 ? (120) : (80)); + return _t21; + break; + } + case v__ast__Kind__array: + { + int _t22 = (t->pointer_size == 8 ? (32) : (24)); + return _t22; + break; + } + case v__ast__Kind__generic_inst: + { + int _t23 = 0; + return _t23; + break; + } + } + ; + return 0; +} + +// Attr: [inline] +inline VV_LOCAL_SYMBOL int v__ast__round_up(int n, int multiple) { + int _t1 = ((n + multiple - 1) & -multiple); + return _t1; +} + string v__ast__Kind_str(v__ast__Kind k) { string _t2 = (string){.str=(byteptr)"", .is_lit=1}; switch (k) { @@ -46396,44 +49188,6 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ } } -int v__checker__Checker_sizeof_integer(v__checker__Checker* c, v__ast__Type a) { - v__ast__Type t = (Array_int_contains(_const_v__ast__unsigned_integer_type_idxs, a) ? (v__ast__Type_flip_signedness(a)) : (a)); - int_literal _t1 = 0; - - if (t == (_const_v__ast__char_type_idx) || t == (_const_v__ast__i8_type_idx)) { - _t1 = 1; - } - else if (t == (_const_v__ast__i16_type_idx)) { - _t1 = 2; - } - else if (t == (_const_v__ast__int_type_idx)) { - _t1 = 4; - } - else if (t == (_const_v__ast__rune_type_idx)) { - _t1 = 4; - } - else if (t == (_const_v__ast__i64_type_idx)) { - _t1 = 8; - } - else if (t == (_const_v__ast__isize_type_idx)) { - _t1 = (c->pref->m64 ? (8) : (4)); - } - else if (t == (_const_v__ast__int_literal_type)) { - string s = v__ast__Table_type_to_str(c->table, a); - _v_panic( str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), 0xfe10, {.d_s = s}}, {_SLIT("` has unknown size"), 0, { .d_c = 0 }}}))); - VUNREACHABLE(); - _t1 = 0; - } - else { - string s = v__ast__Table_type_to_str(c->table, a); - _v_panic( str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), 0xfe10, {.d_s = s}}, {_SLIT("` is not an integer"), 0, { .d_c = 0 }}}))); - VUNREACHABLE(); - _t1 = 0; - }int r = _t1; - int _t2 = r; - return _t2; -} - VV_LOCAL_SYMBOL Array_string v__checker__all_valid_comptime_idents(void) { Array_string res = __new_array_with_default(0, 0, sizeof(string), 0); _PUSH_MANY(&res, (_const_v__checker__valid_comptime_if_os), _t1, Array_string); @@ -46447,7 +49201,7 @@ VV_LOCAL_SYMBOL Array_string v__checker__all_valid_comptime_idents(void) { v__checker__Checker* v__checker__new_checker(v__ast__Table* table, v__pref__Preferences* pref) { bool timers_should_print = false; - v__checker__Checker* _t1 = ((v__checker__Checker*)memdup(&(v__checker__Checker){.pref = pref,.table = table,.file = 0,.nr_errors = 0,.nr_warnings = 0,.nr_notices = 0,.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.error_lines = __new_array(0, 0, sizeof(int)),.expected_type = 0,.expected_or_type = 0,.expected_expr_type = 0,.mod = (string){.str=(byteptr)"", .is_lit=1},.const_decl = (string){.str=(byteptr)"", .is_lit=1},.const_deps = __new_array(0, 0, sizeof(string)),.const_names = __new_array(0, 0, sizeof(string)),.global_names = __new_array(0, 0, sizeof(string)),.locked_names = __new_array(0, 0, sizeof(string)),.rlocked_names = __new_array(0, 0, sizeof(string)),.in_for_count = 0,.should_abort = 0,.returns = 0,.scope_returns = 0,.is_builtin_mod = 0,.is_just_builtin_mod = 0,.is_generated = 0,.inside_unsafe = 0,.inside_const = 0,.inside_anon_fn = 0,.inside_ref_lit = 0,.inside_defer = 0,.inside_fn_arg = 0,.inside_ct_attr = 0,.inside_comptime_for_field = 0,.skip_flags = 0,.fn_level = 0,.smartcast_mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.smartcast_cond_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.ct_cond_stack = __new_array(0, 0, sizeof(v__ast__Expr)),.stmt_level = 0,.files = __new_array(0, 0, sizeof(v__ast__File)),.expr_level = 0,.cur_orm_ts = (v__ast__TypeSymbol){.parent_idx = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.cname = (string){.str=(byteptr)"", .is_lit=1},.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.idx = 0,},.error_details = __new_array(0, 0, sizeof(string)),.vmod_file_content = (string){.str=(byteptr)"", .is_lit=1},.loop_label = (string){.str=(byteptr)"", .is_lit=1},.vweb_gen_types = __new_array(0, 0, sizeof(v__ast__Type)),.timers = v__util__new_timers(((v__util__TimerParams){.should_print = timers_should_print,.label = _SLIT("checker"),})),.comptime_fields_default_type = 0,.comptime_fields_type = new_map(sizeof(string), sizeof(v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.fn_scope = ((voidptr)(0)),.main_fn_decl_node = (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.match_exhaustive_cutoff_limit = pref->checker_match_exhaustive_cutoff_limit,.is_last_stmt = 0,.prevent_sum_type_unwrapping_once = 0,.using_new_err_struct = 0,.need_recheck_generic_fns = 0,.inside_sql = 0,.inside_selector_expr = 0,.inside_println_arg = 0,.inside_decl_rhs = 0,.inside_if_guard = 0,.comptime_call_pos = 0,}, sizeof(v__checker__Checker))); + v__checker__Checker* _t1 = ((v__checker__Checker*)memdup(&(v__checker__Checker){.pref = pref,.table = table,.file = 0,.nr_errors = 0,.nr_warnings = 0,.nr_notices = 0,.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.error_lines = __new_array(0, 0, sizeof(int)),.expected_type = 0,.expected_or_type = 0,.expected_expr_type = 0,.mod = (string){.str=(byteptr)"", .is_lit=1},.const_decl = (string){.str=(byteptr)"", .is_lit=1},.const_deps = __new_array(0, 0, sizeof(string)),.const_names = __new_array(0, 0, sizeof(string)),.global_names = __new_array(0, 0, sizeof(string)),.locked_names = __new_array(0, 0, sizeof(string)),.rlocked_names = __new_array(0, 0, sizeof(string)),.in_for_count = 0,.should_abort = 0,.returns = 0,.scope_returns = 0,.is_builtin_mod = 0,.is_just_builtin_mod = 0,.is_generated = 0,.inside_unsafe = 0,.inside_const = 0,.inside_anon_fn = 0,.inside_ref_lit = 0,.inside_defer = 0,.inside_fn_arg = 0,.inside_ct_attr = 0,.inside_comptime_for_field = 0,.skip_flags = 0,.fn_level = 0,.smartcast_mut_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.smartcast_cond_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.ct_cond_stack = __new_array(0, 0, sizeof(v__ast__Expr)),.stmt_level = 0,.files = __new_array(0, 0, sizeof(v__ast__File)),.expr_level = 0,.cur_orm_ts = (v__ast__TypeSymbol){.parent_idx = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.cname = (string){.str=(byteptr)"", .is_lit=1},.methods = __new_array(0, 0, sizeof(v__ast__Fn)),.mod = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.idx = 0,},.error_details = __new_array(0, 0, sizeof(string)),.vmod_file_content = (string){.str=(byteptr)"", .is_lit=1},.loop_label = (string){.str=(byteptr)"", .is_lit=1},.vweb_gen_types = __new_array(0, 0, sizeof(v__ast__Type)),.timers = v__util__new_timers(((v__util__TimerParams){.should_print = timers_should_print,.label = _SLIT("checker"),})),.comptime_fields_default_type = 0,.comptime_fields_type = new_map(sizeof(string), sizeof(v__ast__Type), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.fn_scope = ((voidptr)(0)),.main_fn_decl_node = (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.match_exhaustive_cutoff_limit = pref->checker_match_exhaustive_cutoff_limit,.is_last_stmt = 0,.prevent_sum_type_unwrapping_once = 0,.using_new_err_struct = 0,.need_recheck_generic_fns = 0,.inside_sql = 0,.inside_selector_expr = 0,.inside_println_arg = 0,.inside_decl_rhs = 0,.inside_if_guard = 0,.comptime_call_pos = 0,}, sizeof(v__checker__Checker))); return _t1; } @@ -46641,6 +49395,7 @@ void v__checker__Checker_check_files(v__checker__Checker* c, Array_v__ast__File_ .is_direct_arr = 0, .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), .ctdefine_idx = -1, + .idx = 0, .params = __new_array(0, 0, sizeof(v__ast__Param)), .stmts = __new_array(0, 0, sizeof(v__ast__Stmt)), .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), @@ -47044,8 +49799,8 @@ v__ast__Type former_expected_type; v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("negative value cannot be compared with `"), 0xfe10, {.d_s = rt}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*node->left._v__ast__IntegerLiteral).pos); } } else if (is_left_type_signed != is_right_type_signed && left_type != _const_v__ast__int_literal_type_idx && right_type != _const_v__ast__int_literal_type_idx) { - int ls = v__checker__Checker_sizeof_integer(c, left_type); - int rs = v__checker__Checker_sizeof_integer(c, right_type); + int ls = v__ast__Table_type_size(c->table, left_type); + int rs = v__ast__Table_type_size(c->table, right_type); if ((is_left_type_signed && ls < rs) || (is_right_type_signed && rs < ls)) { string lt = v__ast__Table_sym(c->table, left_type)->name; string rt = v__ast__Table_sym(c->table, right_type)->name; @@ -47124,7 +49879,7 @@ v__ast__Type former_expected_type; if ((left_sym->info)._typ == 470 /* v.ast.Alias */ && (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 470) /*expected idx: 470, name: v.ast.Alias */ ).language != v__ast__Language__c && string__eq(c->mod, (*(string*)/*ee elem_sym */array_get(string_split(v__ast__Table_type_to_str(c->table, left_type), _SLIT(".")), 0))) && v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 470) /*expected idx: 470, name: v.ast.Alias */ ).parent_type))) { left_sym = v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 470) /*expected idx: 470, name: v.ast.Alias */ ).parent_type); } - if (c->pref->translated && (node->op == v__token__Kind__plus || node->op == v__token__Kind__minus || node->op == v__token__Kind__mul) && v__ast__Type_is_any_kind_of_pointer(left_type) && (v__ast__Type_is_any_kind_of_pointer(right_type) || v__ast__Type_is_int(right_type))) { + if (c->pref->translated && (node->op == v__token__Kind__plus || node->op == v__token__Kind__minus || node->op == v__token__Kind__mul) && v__ast__Type_is_any_kind_of_pointer(left_type) && v__ast__Type_is_any_kind_of_pointer(right_type)) { return_type = left_type; } else if (!c->pref->translated && left_sym->kind == v__ast__Kind__alias && (left_sym->info)._typ == 470 /* v.ast.Alias */ && !(v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 470) /*expected idx: 470, name: v.ast.Alias */ ).parent_type)))) { if (v__ast__TypeSymbol_has_method(left_sym, v__token__Kind_str(node->op))) { @@ -47165,7 +49920,7 @@ v__ast__Type former_expected_type; } } } - if (left_sym->kind == v__ast__Kind__array || left_sym->kind == v__ast__Kind__array_fixed || left_sym->kind == v__ast__Kind__map || left_sym->kind == v__ast__Kind__struct_) { + if (!c->pref->translated && (left_sym->kind == v__ast__Kind__array || left_sym->kind == v__ast__Kind__array_fixed || left_sym->kind == v__ast__Kind__map || left_sym->kind == v__ast__Kind__struct_)) { if (v__ast__TypeSymbol_has_method_with_generic_parent(left_sym, v__token__Kind_str(node->op))) { Option_v__ast__Fn _t7; if (_t7 = v__ast__TypeSymbol_find_method_with_generic_parent(left_sym, v__token__Kind_str(node->op)), _t7.state == 0) { @@ -47184,7 +49939,7 @@ v__ast__Type former_expected_type; v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("mismatched types `"), 0xfe10, {.d_s = left_name}}, {_SLIT("` and `"), 0xfe10, {.d_s = right_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), left_right_pos); } } - } else if (right_sym->kind == v__ast__Kind__array || right_sym->kind == v__ast__Kind__array_fixed || right_sym->kind == v__ast__Kind__map || right_sym->kind == v__ast__Kind__struct_) { + } else if (!c->pref->translated && (right_sym->kind == v__ast__Kind__array || right_sym->kind == v__ast__Kind__array_fixed || right_sym->kind == v__ast__Kind__map || right_sym->kind == v__ast__Kind__struct_)) { if (v__ast__TypeSymbol_has_method_with_generic_parent(right_sym, v__token__Kind_str(node->op))) { Option_v__ast__Fn _t8; if (_t8 = v__ast__TypeSymbol_find_method_with_generic_parent(right_sym, v__token__Kind_str(node->op)), _t8.state == 0) { @@ -47318,8 +50073,8 @@ v__ast__Type former_expected_type; v__checker__Checker_error(c, _SLIT("array append cannot be used in an expression"), node->pos); } v__checker__Checker_check_expr_opt_call(c, node->right, right_type); - multi_return_string_v__token__Pos mr_33947 = v__checker__Checker_fail_if_immutable(c, node->left); - node->auto_locked = mr_33947.arg0; + multi_return_string_v__token__Pos mr_33844 = v__checker__Checker_fail_if_immutable(c, node->left); + node->auto_locked = mr_33844.arg0; v__ast__Type left_value_type = v__ast__Table_value_type(c->table, v__checker__Checker_unwrap_generic(c, left_type)); v__ast__TypeSymbol* left_value_sym = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, left_value_type)); if (left_value_sym->kind == v__ast__Kind__interface_) { @@ -47341,12 +50096,12 @@ v__ast__Type former_expected_type; return _t10; } else if (left_value_sym->kind == v__ast__Kind__sum_type) { if (right_final->kind != v__ast__Kind__array) { - if (!v__ast__Table_is_sumtype_or_in_variant(c->table, left_value_type, right_type)) { + if (!v__ast__Table_is_sumtype_or_in_variant(c->table, left_value_type, v__ast__mktyp(right_type))) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot append `"), 0xfe10, {.d_s = right_sym->name}}, {_SLIT("` to `"), 0xfe10, {.d_s = left_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), right_pos); } } else { v__ast__Type right_value_type = v__ast__Table_value_type(c->table, right_type); - if (!v__ast__Table_is_sumtype_or_in_variant(c->table, left_value_type, right_value_type)) { + if (!v__ast__Table_is_sumtype_or_in_variant(c->table, left_value_type, v__ast__mktyp(right_value_type))) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot append `"), 0xfe10, {.d_s = right_sym->name}}, {_SLIT("` to `"), 0xfe10, {.d_s = left_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), right_pos); } } @@ -47755,19 +50510,19 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im if (v__ast__Type_has_flag(elem_type, v__ast__TypeFlag__shared_f)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("you have to create a handle and `lock` it to modify `shared` "), 0xfe10, {.d_s = kind}}, {_SLIT(" element"), 0, { .d_c = 0 }}})), v__token__Pos_extend(v__ast__Expr_pos((*expr._v__ast__IndexExpr).left), (*expr._v__ast__IndexExpr).pos)); } - multi_return_string_v__token__Pos mr_44323 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__IndexExpr).left); - to_lock = mr_44323.arg0; - pos = mr_44323.arg1; + multi_return_string_v__token__Pos mr_44242 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__IndexExpr).left); + to_lock = mr_44242.arg0; + pos = mr_44242.arg1; } else if (expr._typ == 320 /* v.ast.ParExpr */) { - multi_return_string_v__token__Pos mr_44392 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__ParExpr).expr); - to_lock = mr_44392.arg0; - pos = mr_44392.arg1; + multi_return_string_v__token__Pos mr_44311 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__ParExpr).expr); + to_lock = mr_44311.arg0; + pos = mr_44311.arg1; } else if (expr._typ == 322 /* v.ast.PrefixExpr */) { - multi_return_string_v__token__Pos mr_44464 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__PrefixExpr).right); - to_lock = mr_44464.arg0; - pos = mr_44464.arg1; + multi_return_string_v__token__Pos mr_44383 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__PrefixExpr).right); + to_lock = mr_44383.arg0; + pos = mr_44383.arg1; } else if (expr._typ == 325 /* v.ast.SelectorExpr */) { if ((*expr._v__ast__SelectorExpr).expr_type == 0) { @@ -47817,9 +50572,9 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im string type_str = v__ast__Table_type_to_str(c->table, (*expr._v__ast__SelectorExpr).expr_type); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("field `"), 0xfe10, {.d_s = (*expr._v__ast__SelectorExpr).field_name}}, {_SLIT("` of struct `"), 0xfe10, {.d_s = type_str}}, {_SLIT("` is immutable"), 0, { .d_c = 0 }}})), (*expr._v__ast__SelectorExpr).pos); } - multi_return_string_v__token__Pos mr_45928 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__SelectorExpr).expr); - to_lock = mr_45928.arg0; - pos = mr_45928.arg1; + multi_return_string_v__token__Pos mr_45847 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__SelectorExpr).expr); + to_lock = mr_45847.arg0; + pos = mr_45847.arg1; } if ((to_lock).len != 0) { explicit_lock_needed = true; @@ -47925,9 +50680,9 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im } else if (expr._typ == 291 /* v.ast.CallExpr */) { if (string__eq((*expr._v__ast__CallExpr).name, _SLIT("slice"))) { - multi_return_string_v__token__Pos mr_47751 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__CallExpr).left); - to_lock = mr_47751.arg0; - pos = mr_47751.arg1; + multi_return_string_v__token__Pos mr_47670 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__CallExpr).left); + to_lock = mr_47670.arg0; + pos = mr_47670.arg1; if ((to_lock).len != 0) { explicit_lock_needed = true; } @@ -48326,9 +51081,9 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t13.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_60952 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t13.data); - field = mr_60952.arg0; - embed_types = mr_60952.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_60871 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t13.data); + field = mr_60871.arg0; + embed_types = mr_60871.arg1; node->from_embed_types = embed_types; if (sym->kind == v__ast__Kind__aggregate || sym->kind == v__ast__Kind__sum_type) { unknown_field_msg = IError_name_table[err._typ]._method_msg(err._object); @@ -48362,9 +51117,9 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t15.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_61783 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t15.data); - field = mr_61783.arg0; - embed_types = mr_61783.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_61702 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t15.data); + field = mr_61702.arg0; + embed_types = mr_61702.arg1; node->from_embed_types = embed_types; } } @@ -50588,8 +53343,8 @@ v__ast__Type v__checker__Checker_postfix_expr(v__checker__Checker* c, v__ast__Po string typ_str = v__ast__Table_type_to_str(c->table, typ); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("invalid operation: "), 0xfe10, {.d_s = v__token__Kind_str(node->op)}}, {_SLIT(" (non-numeric type `"), 0xfe10, {.d_s = typ_str}}, {_SLIT("`)"), 0, { .d_c = 0 }}})), node->pos); } else { - multi_return_string_v__token__Pos mr_116016 = v__checker__Checker_fail_if_immutable(c, node->expr); - node->auto_locked = mr_116016.arg0; + multi_return_string_v__token__Pos mr_115935 = v__checker__Checker_fail_if_immutable(c, node->expr); + node->auto_locked = mr_115935.arg0; } v__ast__Type _t1 = typ; return _t1; @@ -51362,7 +54117,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_comptime_call(v__checker__Check if (node->is_vweb) { v__ast__FnDecl* save_cur_fn = c->table->cur_fn; v__pref__Preferences *pref_ = HEAP(v__pref__Preferences, (*c->pref)); - v__pref__Preferences* pref2 = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){(*(pref_)).os,(*(pref_)).backend,(*(pref_)).build_mode,(*(pref_)).arch,(*(pref_)).output_mode,(*(pref_)).is_verbose,(*(pref_)).is_test,(*(pref_)).is_script,(*(pref_)).is_vsh,(*(pref_)).is_livemain,(*(pref_)).is_liveshared,(*(pref_)).is_shared,(*(pref_)).is_o,(*(pref_)).is_prof,(*(pref_)).test_runner,(*(pref_)).profile_file,(*(pref_)).profile_no_inline,(*(pref_)).profile_fns,(*(pref_)).translated,(*(pref_)).is_prod,(*(pref_)).obfuscate,(*(pref_)).is_repl,(*(pref_)).is_run,(*(pref_)).is_debug,(*(pref_)).is_vlines,(*(pref_)).sanitize,(*(pref_)).sourcemap,(*(pref_)).sourcemap_inline,(*(pref_)).sourcemap_src_included,(*(pref_)).show_cc,(*(pref_)).show_c_output,(*(pref_)).show_callgraph,(*(pref_)).show_depgraph,(*(pref_)).dump_c_flags,(*(pref_)).use_cache,(*(pref_)).retry_compilation,(*(pref_)).is_stats,(*(pref_)).cflags,(*(pref_)).m64,(*(pref_)).ccompiler,(*(pref_)).ccompiler_type,(*(pref_)).third_party_option,(*(pref_)).building_v,(*(pref_)).autofree,(*(pref_)).compress,(*(pref_)).no_builtin,(*(pref_)).enable_globals,(*(pref_)).is_fmt,(*(pref_)).is_vet,(*(pref_)).is_bare,(*(pref_)).bare_builtin_dir,(*(pref_)).no_preludes,(*(pref_)).custom_prelude,(*(pref_)).lookup_path,(*(pref_)).output_cross_c,(*(pref_)).output_es5,(*(pref_)).prealloc,(*(pref_)).vroot,(*(pref_)).out_name_c,(*(pref_)).out_name,(*(pref_)).path,(*(pref_)).run_only,(*(pref_)).compile_defines,(*(pref_)).compile_defines_all,(*(pref_)).run_args,(*(pref_)).printfn_list,(*(pref_)).print_v_files,(*(pref_)).skip_running,(*(pref_)).skip_warnings,(*(pref_)).warn_impure_v,(*(pref_)).warns_are_errors,(*(pref_)).fatal_errors,(*(pref_)).reuse_tmpc,(*(pref_)).no_rsp,(*(pref_)).no_std,(*(pref_)).use_color,(*(pref_)).no_parallel,.is_vweb = true,(*(pref_)).only_check_syntax,(*(pref_)).check_only,(*(pref_)).experimental,(*(pref_)).skip_unused,(*(pref_)).show_timings,(*(pref_)).is_ios_simulator,(*(pref_)).is_apk,(*(pref_)).cleanup_files,(*(pref_)).build_options,(*(pref_)).cache_manager,(*(pref_)).is_help,(*(pref_)).gc_mode,(*(pref_)).is_cstrict,(*(pref_)).assert_failure_mode,(*(pref_)).message_limit,(*(pref_)).nofloat,(*(pref_)).checker_match_exhaustive_cutoff_limit,}, sizeof(v__pref__Preferences))); + v__pref__Preferences* pref2 = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){(*(pref_)).os,(*(pref_)).backend,(*(pref_)).build_mode,(*(pref_)).arch,(*(pref_)).output_mode,(*(pref_)).is_verbose,(*(pref_)).is_test,(*(pref_)).is_script,(*(pref_)).is_vsh,(*(pref_)).is_livemain,(*(pref_)).is_liveshared,(*(pref_)).is_shared,(*(pref_)).is_o,(*(pref_)).is_prof,(*(pref_)).test_runner,(*(pref_)).profile_file,(*(pref_)).profile_no_inline,(*(pref_)).profile_fns,(*(pref_)).translated,(*(pref_)).is_prod,(*(pref_)).obfuscate,(*(pref_)).is_repl,(*(pref_)).is_run,(*(pref_)).is_debug,(*(pref_)).is_vlines,(*(pref_)).sanitize,(*(pref_)).sourcemap,(*(pref_)).sourcemap_inline,(*(pref_)).sourcemap_src_included,(*(pref_)).show_cc,(*(pref_)).show_c_output,(*(pref_)).show_callgraph,(*(pref_)).show_depgraph,(*(pref_)).dump_c_flags,(*(pref_)).use_cache,(*(pref_)).retry_compilation,(*(pref_)).is_stats,(*(pref_)).cflags,(*(pref_)).m64,(*(pref_)).ccompiler,(*(pref_)).ccompiler_type,(*(pref_)).third_party_option,(*(pref_)).building_v,(*(pref_)).autofree,(*(pref_)).compress,(*(pref_)).no_builtin,(*(pref_)).enable_globals,(*(pref_)).is_fmt,(*(pref_)).is_vet,(*(pref_)).is_bare,(*(pref_)).bare_builtin_dir,(*(pref_)).no_preludes,(*(pref_)).custom_prelude,(*(pref_)).lookup_path,(*(pref_)).output_cross_c,(*(pref_)).output_es5,(*(pref_)).prealloc,(*(pref_)).vroot,(*(pref_)).out_name_c,(*(pref_)).out_name,(*(pref_)).path,(*(pref_)).run_only,(*(pref_)).compile_defines,(*(pref_)).compile_defines_all,(*(pref_)).run_args,(*(pref_)).printfn_list,(*(pref_)).print_v_files,(*(pref_)).skip_running,(*(pref_)).skip_warnings,(*(pref_)).warn_impure_v,(*(pref_)).warns_are_errors,(*(pref_)).fatal_errors,(*(pref_)).reuse_tmpc,(*(pref_)).no_rsp,(*(pref_)).no_std,(*(pref_)).use_color,(*(pref_)).no_parallel,.is_vweb = true,(*(pref_)).only_check_syntax,(*(pref_)).check_only,(*(pref_)).experimental,(*(pref_)).skip_unused,(*(pref_)).show_timings,(*(pref_)).is_ios_simulator,(*(pref_)).is_apk,(*(pref_)).cleanup_files,(*(pref_)).build_options,(*(pref_)).cache_manager,(*(pref_)).is_help,(*(pref_)).gc_mode,(*(pref_)).is_cstrict,(*(pref_)).assert_failure_mode,(*(pref_)).message_limit,(*(pref_)).nofloat,(*(pref_)).checker_match_exhaustive_cutoff_limit,(*(pref_)).thread_stack_size,}, sizeof(v__pref__Preferences))); v__checker__Checker* c2 = v__checker__new_checker(c->table, pref2); c2->comptime_call_pos = node->pos.pos; v__checker__Checker_check(c2, (voidptr)&/*qq*/node->vweb_tmpl); @@ -51460,248 +54215,189 @@ VV_LOCAL_SYMBOL Option_v__ast__ComptTimeConstValue v__checker__Checker_eval_comp return _t2; } else if (expr._typ == 326 /* v.ast.SizeOf */) { - v__ast__Type xtype = (*expr._v__ast__SizeOf).typ; - if (v__ast__Type_is_real_pointer(xtype)) { - if (c->pref->m64) { - Option_v__ast__ComptTimeConstValue _t3; - opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, (8))) }, (Option*)(&_t3), sizeof(v__ast__ComptTimeConstValue)); - return _t3; - } - Option_v__ast__ComptTimeConstValue _t4; - opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, (4))) }, (Option*)(&_t4), sizeof(v__ast__ComptTimeConstValue)); - return _t4; - } - if (((int)(xtype)) == v__ast__Type_idx(xtype)) { - - if (xtype == (_const_v__ast__char_type)) { - Option_v__ast__ComptTimeConstValue _t5; - opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, (1))) }, (Option*)(&_t5), sizeof(v__ast__ComptTimeConstValue)); - return _t5; - } - else if (xtype == (_const_v__ast__i8_type)) { - Option_v__ast__ComptTimeConstValue _t6; - opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, (1))) }, (Option*)(&_t6), sizeof(v__ast__ComptTimeConstValue)); - return _t6; - } - else if (xtype == (_const_v__ast__i16_type)) { - Option_v__ast__ComptTimeConstValue _t7; - opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, (2))) }, (Option*)(&_t7), sizeof(v__ast__ComptTimeConstValue)); - return _t7; - } - else if (xtype == (_const_v__ast__int_type)) { - Option_v__ast__ComptTimeConstValue _t8; - opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, (4))) }, (Option*)(&_t8), sizeof(v__ast__ComptTimeConstValue)); - return _t8; - } - else if (xtype == (_const_v__ast__i64_type)) { - Option_v__ast__ComptTimeConstValue _t9; - opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, (8))) }, (Option*)(&_t9), sizeof(v__ast__ComptTimeConstValue)); - return _t9; - } - else if (xtype == (_const_v__ast__byte_type)) { - Option_v__ast__ComptTimeConstValue _t10; - opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, (1))) }, (Option*)(&_t10), sizeof(v__ast__ComptTimeConstValue)); - return _t10; - } - else if (xtype == (_const_v__ast__u16_type)) { - Option_v__ast__ComptTimeConstValue _t11; - opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, (2))) }, (Option*)(&_t11), sizeof(v__ast__ComptTimeConstValue)); - return _t11; - } - else if (xtype == (_const_v__ast__u32_type)) { - Option_v__ast__ComptTimeConstValue _t12; - opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, (4))) }, (Option*)(&_t12), sizeof(v__ast__ComptTimeConstValue)); - return _t12; - } - else if (xtype == (_const_v__ast__u64_type)) { - Option_v__ast__ComptTimeConstValue _t13; - opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, (8))) }, (Option*)(&_t13), sizeof(v__ast__ComptTimeConstValue)); - return _t13; - } - else { - }; - } - return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; + Option_v__ast__ComptTimeConstValue _t3; + opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, (v__ast__Table_type_size(c->table, (*expr._v__ast__SizeOf).typ)))) }, (Option*)(&_t3), sizeof(v__ast__ComptTimeConstValue)); + return _t3; } else if (expr._typ == 303 /* v.ast.FloatLiteral */) { f64 x = string_f64((*expr._v__ast__FloatLiteral).val); - Option_v__ast__ComptTimeConstValue _t15; - opt_ok(&(v__ast__ComptTimeConstValue[]) { f64_to_sumtype_v__ast__ComptTimeConstValue(&x) }, (Option*)(&_t15), sizeof(v__ast__ComptTimeConstValue)); - return _t15; + Option_v__ast__ComptTimeConstValue _t4; + opt_ok(&(v__ast__ComptTimeConstValue[]) { f64_to_sumtype_v__ast__ComptTimeConstValue(&x) }, (Option*)(&_t4), sizeof(v__ast__ComptTimeConstValue)); + return _t4; } else if (expr._typ == 310 /* v.ast.IntegerLiteral */) { u64 x = string_u64((*expr._v__ast__IntegerLiteral).val); if (x > 9223372036854775807U) { - Option_v__ast__ComptTimeConstValue _t16; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(&x) }, (Option*)(&_t16), sizeof(v__ast__ComptTimeConstValue)); - return _t16; + Option_v__ast__ComptTimeConstValue _t5; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(&x) }, (Option*)(&_t5), sizeof(v__ast__ComptTimeConstValue)); + return _t5; } - Option_v__ast__ComptTimeConstValue _t17; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (string_i64((*expr._v__ast__IntegerLiteral).val)))) }, (Option*)(&_t17), sizeof(v__ast__ComptTimeConstValue)); - return _t17; + Option_v__ast__ComptTimeConstValue _t6; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (string_i64((*expr._v__ast__IntegerLiteral).val)))) }, (Option*)(&_t6), sizeof(v__ast__ComptTimeConstValue)); + return _t6; } else if (expr._typ == 329 /* v.ast.StringLiteral */) { - Option_v__ast__ComptTimeConstValue _t18; - opt_ok(&(v__ast__ComptTimeConstValue[]) { string_to_sumtype_v__ast__ComptTimeConstValue(ADDR(string, (v__util__smart_quote((*expr._v__ast__StringLiteral).val, (*expr._v__ast__StringLiteral).is_raw)))) }, (Option*)(&_t18), sizeof(v__ast__ComptTimeConstValue)); - return _t18; + Option_v__ast__ComptTimeConstValue _t7; + opt_ok(&(v__ast__ComptTimeConstValue[]) { string_to_sumtype_v__ast__ComptTimeConstValue(ADDR(string, (v__util__smart_quote((*expr._v__ast__StringLiteral).val, (*expr._v__ast__StringLiteral).is_raw)))) }, (Option*)(&_t7), sizeof(v__ast__ComptTimeConstValue)); + return _t7; } else if (expr._typ == 294 /* v.ast.CharLiteral */) { Array_rune runes = string_runes((*expr._v__ast__CharLiteral).val); if (runes.len > 0) { - Option_v__ast__ComptTimeConstValue _t19; - opt_ok(&(v__ast__ComptTimeConstValue[]) { rune_to_sumtype_v__ast__ComptTimeConstValue(&(*(rune*)/*ee elem_sym */array_get(runes, 0))) }, (Option*)(&_t19), sizeof(v__ast__ComptTimeConstValue)); - return _t19; + Option_v__ast__ComptTimeConstValue _t8; + opt_ok(&(v__ast__ComptTimeConstValue[]) { rune_to_sumtype_v__ast__ComptTimeConstValue(&(*(rune*)/*ee elem_sym */array_get(runes, 0))) }, (Option*)(&_t8), sizeof(v__ast__ComptTimeConstValue)); + return _t8; } return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } else if (expr._typ == 305 /* v.ast.Ident */) { if (((*expr._v__ast__Ident).obj)._typ == 361 /* v.ast.ConstField */) { - Option_v__ast__ComptTimeConstValue _t21 = v__checker__Checker_eval_comptime_const_expr(c, (*(*expr._v__ast__Ident).obj._v__ast__ConstField).expr, nlevel + 1); - return _t21; + Option_v__ast__ComptTimeConstValue _t10 = v__checker__Checker_eval_comptime_const_expr(c, (*(*expr._v__ast__Ident).obj._v__ast__ConstField).expr, nlevel + 1); + return _t10; } } else if (expr._typ == 292 /* v.ast.CastExpr */) { - Option_v__ast__ComptTimeConstValue _t22 = v__checker__Checker_eval_comptime_const_expr(c, (*expr._v__ast__CastExpr).expr, nlevel + 1); - if (_t22.state != 0) { /*or block*/ - IError err = _t22.err; + Option_v__ast__ComptTimeConstValue _t11 = v__checker__Checker_eval_comptime_const_expr(c, (*expr._v__ast__CastExpr).expr, nlevel + 1); + if (_t11.state != 0) { /*or block*/ + IError err = _t11.err; return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } - v__ast__ComptTimeConstValue cast_expr_value = (*(v__ast__ComptTimeConstValue*)_t22.data); + v__ast__ComptTimeConstValue cast_expr_value = (*(v__ast__ComptTimeConstValue*)_t11.data); if (v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__i8_type)) { - Option_i8 _t25 = v__ast__ComptTimeConstValue_i8(cast_expr_value); - if (_t25.state != 0) { /*or block*/ - IError err = _t25.err; + Option_i8 _t14 = v__ast__ComptTimeConstValue_i8(cast_expr_value); + if (_t14.state != 0) { /*or block*/ + IError err = _t14.err; return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } - Option_v__ast__ComptTimeConstValue _t24; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i8, ( (*(i8*)_t25.data)))) }, (Option*)(&_t24), sizeof(v__ast__ComptTimeConstValue)); - return _t24; + Option_v__ast__ComptTimeConstValue _t13; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i8, ( (*(i8*)_t14.data)))) }, (Option*)(&_t13), sizeof(v__ast__ComptTimeConstValue)); + return _t13; } if (v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__i16_type)) { - Option_i16 _t28 = v__ast__ComptTimeConstValue_i16(cast_expr_value); - if (_t28.state != 0) { /*or block*/ - IError err = _t28.err; + Option_i16 _t17 = v__ast__ComptTimeConstValue_i16(cast_expr_value); + if (_t17.state != 0) { /*or block*/ + IError err = _t17.err; return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } - Option_v__ast__ComptTimeConstValue _t27; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i16_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i16, ( (*(i16*)_t28.data)))) }, (Option*)(&_t27), sizeof(v__ast__ComptTimeConstValue)); - return _t27; + Option_v__ast__ComptTimeConstValue _t16; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i16_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i16, ( (*(i16*)_t17.data)))) }, (Option*)(&_t16), sizeof(v__ast__ComptTimeConstValue)); + return _t16; } if (v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__int_type)) { - Option_int _t31 = v__ast__ComptTimeConstValue_int(cast_expr_value); - if (_t31.state != 0) { /*or block*/ - IError err = _t31.err; + Option_int _t20 = v__ast__ComptTimeConstValue_int(cast_expr_value); + if (_t20.state != 0) { /*or block*/ + IError err = _t20.err; return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } - Option_v__ast__ComptTimeConstValue _t30; - opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, ( (*(int*)_t31.data)))) }, (Option*)(&_t30), sizeof(v__ast__ComptTimeConstValue)); - return _t30; + Option_v__ast__ComptTimeConstValue _t19; + opt_ok(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(ADDR(int, ( (*(int*)_t20.data)))) }, (Option*)(&_t19), sizeof(v__ast__ComptTimeConstValue)); + return _t19; } if (v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__i64_type)) { - Option_i64 _t34 = v__ast__ComptTimeConstValue_i64(cast_expr_value); - if (_t34.state != 0) { /*or block*/ - IError err = _t34.err; + Option_i64 _t23 = v__ast__ComptTimeConstValue_i64(cast_expr_value); + if (_t23.state != 0) { /*or block*/ + IError err = _t23.err; return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } - Option_v__ast__ComptTimeConstValue _t33; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ( (*(i64*)_t34.data)))) }, (Option*)(&_t33), sizeof(v__ast__ComptTimeConstValue)); - return _t33; + Option_v__ast__ComptTimeConstValue _t22; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ( (*(i64*)_t23.data)))) }, (Option*)(&_t22), sizeof(v__ast__ComptTimeConstValue)); + return _t22; } if (v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__byte_type)) { - Option_u8 _t37 = v__ast__ComptTimeConstValue_u8(cast_expr_value); - if (_t37.state != 0) { /*or block*/ - IError err = _t37.err; + Option_u8 _t26 = v__ast__ComptTimeConstValue_u8(cast_expr_value); + if (_t26.state != 0) { /*or block*/ + IError err = _t26.err; return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } - Option_v__ast__ComptTimeConstValue _t36; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ( (*(u8*)_t37.data)))) }, (Option*)(&_t36), sizeof(v__ast__ComptTimeConstValue)); - return _t36; + Option_v__ast__ComptTimeConstValue _t25; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ( (*(u8*)_t26.data)))) }, (Option*)(&_t25), sizeof(v__ast__ComptTimeConstValue)); + return _t25; } if (v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__u16_type)) { - Option_u16 _t40 = v__ast__ComptTimeConstValue_u16(cast_expr_value); - if (_t40.state != 0) { /*or block*/ - IError err = _t40.err; + Option_u16 _t29 = v__ast__ComptTimeConstValue_u16(cast_expr_value); + if (_t29.state != 0) { /*or block*/ + IError err = _t29.err; return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } - Option_v__ast__ComptTimeConstValue _t39; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u16_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u16, ( (*(u16*)_t40.data)))) }, (Option*)(&_t39), sizeof(v__ast__ComptTimeConstValue)); - return _t39; + Option_v__ast__ComptTimeConstValue _t28; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u16_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u16, ( (*(u16*)_t29.data)))) }, (Option*)(&_t28), sizeof(v__ast__ComptTimeConstValue)); + return _t28; } if (v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__u32_type)) { - Option_u32 _t43 = v__ast__ComptTimeConstValue_u32(cast_expr_value); - if (_t43.state != 0) { /*or block*/ - IError err = _t43.err; + Option_u32 _t32 = v__ast__ComptTimeConstValue_u32(cast_expr_value); + if (_t32.state != 0) { /*or block*/ + IError err = _t32.err; return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } - Option_v__ast__ComptTimeConstValue _t42; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u32_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u32, ( (*(u32*)_t43.data)))) }, (Option*)(&_t42), sizeof(v__ast__ComptTimeConstValue)); - return _t42; + Option_v__ast__ComptTimeConstValue _t31; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u32_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u32, ( (*(u32*)_t32.data)))) }, (Option*)(&_t31), sizeof(v__ast__ComptTimeConstValue)); + return _t31; } if (v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__u64_type)) { - Option_u64 _t46 = v__ast__ComptTimeConstValue_u64(cast_expr_value); - if (_t46.state != 0) { /*or block*/ - IError err = _t46.err; + Option_u64 _t35 = v__ast__ComptTimeConstValue_u64(cast_expr_value); + if (_t35.state != 0) { /*or block*/ + IError err = _t35.err; return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } - Option_v__ast__ComptTimeConstValue _t45; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ( (*(u64*)_t46.data)))) }, (Option*)(&_t45), sizeof(v__ast__ComptTimeConstValue)); - return _t45; + Option_v__ast__ComptTimeConstValue _t34; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ( (*(u64*)_t35.data)))) }, (Option*)(&_t34), sizeof(v__ast__ComptTimeConstValue)); + return _t34; } if (v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__f32_type)) { - Option_f32 _t49 = v__ast__ComptTimeConstValue_f32(cast_expr_value); - if (_t49.state != 0) { /*or block*/ - IError err = _t49.err; + Option_f32 _t38 = v__ast__ComptTimeConstValue_f32(cast_expr_value); + if (_t38.state != 0) { /*or block*/ + IError err = _t38.err; return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } - Option_v__ast__ComptTimeConstValue _t48; - opt_ok(&(v__ast__ComptTimeConstValue[]) { f32_to_sumtype_v__ast__ComptTimeConstValue(ADDR(f32, ( (*(f32*)_t49.data)))) }, (Option*)(&_t48), sizeof(v__ast__ComptTimeConstValue)); - return _t48; + Option_v__ast__ComptTimeConstValue _t37; + opt_ok(&(v__ast__ComptTimeConstValue[]) { f32_to_sumtype_v__ast__ComptTimeConstValue(ADDR(f32, ( (*(f32*)_t38.data)))) }, (Option*)(&_t37), sizeof(v__ast__ComptTimeConstValue)); + return _t37; } if (v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__f64_type)) { - Option_f64 _t52 = v__ast__ComptTimeConstValue_f64(cast_expr_value); - if (_t52.state != 0) { /*or block*/ - IError err = _t52.err; + Option_f64 _t41 = v__ast__ComptTimeConstValue_f64(cast_expr_value); + if (_t41.state != 0) { /*or block*/ + IError err = _t41.err; return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } - Option_v__ast__ComptTimeConstValue _t51; - opt_ok(&(v__ast__ComptTimeConstValue[]) { f64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(f64, ( (*(f64*)_t52.data)))) }, (Option*)(&_t51), sizeof(v__ast__ComptTimeConstValue)); - return _t51; + Option_v__ast__ComptTimeConstValue _t40; + opt_ok(&(v__ast__ComptTimeConstValue[]) { f64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(f64, ( (*(f64*)_t41.data)))) }, (Option*)(&_t40), sizeof(v__ast__ComptTimeConstValue)); + return _t40; } } else if (expr._typ == 309 /* v.ast.InfixExpr */) { - Option_v__ast__ComptTimeConstValue _t54 = v__checker__Checker_eval_comptime_const_expr(c, (*expr._v__ast__InfixExpr).left, nlevel + 1); - if (_t54.state != 0) { /*or block*/ - Option_v__ast__ComptTimeConstValue _t55; - memcpy(&_t55, &_t54, sizeof(Option)); - return _t55; + Option_v__ast__ComptTimeConstValue _t43 = v__checker__Checker_eval_comptime_const_expr(c, (*expr._v__ast__InfixExpr).left, nlevel + 1); + if (_t43.state != 0) { /*or block*/ + Option_v__ast__ComptTimeConstValue _t44; + memcpy(&_t44, &_t43, sizeof(Option)); + return _t44; } - v__ast__ComptTimeConstValue left = (*(v__ast__ComptTimeConstValue*)_t54.data); - Option_v__ast__ComptTimeConstValue _t56 = v__checker__Checker_eval_comptime_const_expr(c, (*expr._v__ast__InfixExpr).right, nlevel + 1); - if (_t56.state != 0) { /*or block*/ - Option_v__ast__ComptTimeConstValue _t57; - memcpy(&_t57, &_t56, sizeof(Option)); - return _t57; + v__ast__ComptTimeConstValue left = (*(v__ast__ComptTimeConstValue*)_t43.data); + Option_v__ast__ComptTimeConstValue _t45 = v__checker__Checker_eval_comptime_const_expr(c, (*expr._v__ast__InfixExpr).right, nlevel + 1); + if (_t45.state != 0) { /*or block*/ + Option_v__ast__ComptTimeConstValue _t46; + memcpy(&_t46, &_t45, sizeof(Option)); + return _t46; } - v__ast__ComptTimeConstValue right = (*(v__ast__ComptTimeConstValue*)_t56.data); + v__ast__ComptTimeConstValue right = (*(v__ast__ComptTimeConstValue*)_t45.data); if ((left)._typ == 20 /* string */ && (right)._typ == 20 /* string */) { if ((*expr._v__ast__InfixExpr).op == (v__token__Kind__plus)) { - Option_v__ast__ComptTimeConstValue _t58; - opt_ok(&(v__ast__ComptTimeConstValue[]) { string_to_sumtype_v__ast__ComptTimeConstValue(ADDR(string, (string__plus((*left._string), (*right._string))))) }, (Option*)(&_t58), sizeof(v__ast__ComptTimeConstValue)); - return _t58; + Option_v__ast__ComptTimeConstValue _t47; + opt_ok(&(v__ast__ComptTimeConstValue[]) { string_to_sumtype_v__ast__ComptTimeConstValue(ADDR(string, (string__plus((*left._string), (*right._string))))) }, (Option*)(&_t47), sizeof(v__ast__ComptTimeConstValue)); + return _t47; } else { return (Option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; @@ -51710,79 +54406,79 @@ VV_LOCAL_SYMBOL Option_v__ast__ComptTimeConstValue v__checker__Checker_eval_comp switch ((*expr._v__ast__InfixExpr).op) { case v__token__Kind__plus: { - Option_v__ast__ComptTimeConstValue _t60; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._u64))) + ((i64)((*right._i64)))))) }, (Option*)(&_t60), sizeof(v__ast__ComptTimeConstValue)); - return _t60; + Option_v__ast__ComptTimeConstValue _t49; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._u64))) + ((i64)((*right._i64)))))) }, (Option*)(&_t49), sizeof(v__ast__ComptTimeConstValue)); + return _t49; break; } case v__token__Kind__minus: { - Option_v__ast__ComptTimeConstValue _t61; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._u64))) - ((i64)((*right._i64)))))) }, (Option*)(&_t61), sizeof(v__ast__ComptTimeConstValue)); - return _t61; + Option_v__ast__ComptTimeConstValue _t50; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._u64))) - ((i64)((*right._i64)))))) }, (Option*)(&_t50), sizeof(v__ast__ComptTimeConstValue)); + return _t50; break; } case v__token__Kind__mul: { - Option_v__ast__ComptTimeConstValue _t62; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._u64))) * ((i64)((*right._i64)))))) }, (Option*)(&_t62), sizeof(v__ast__ComptTimeConstValue)); - return _t62; + Option_v__ast__ComptTimeConstValue _t51; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._u64))) * ((i64)((*right._i64)))))) }, (Option*)(&_t51), sizeof(v__ast__ComptTimeConstValue)); + return _t51; break; } case v__token__Kind__div: { - Option_v__ast__ComptTimeConstValue _t63; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._u64))) / ((i64)((*right._i64)))))) }, (Option*)(&_t63), sizeof(v__ast__ComptTimeConstValue)); - return _t63; + Option_v__ast__ComptTimeConstValue _t52; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._u64))) / ((i64)((*right._i64)))))) }, (Option*)(&_t52), sizeof(v__ast__ComptTimeConstValue)); + return _t52; break; } case v__token__Kind__mod: { - Option_v__ast__ComptTimeConstValue _t64; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._u64))) % ((i64)((*right._i64)))))) }, (Option*)(&_t64), sizeof(v__ast__ComptTimeConstValue)); - return _t64; + Option_v__ast__ComptTimeConstValue _t53; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._u64))) % ((i64)((*right._i64)))))) }, (Option*)(&_t53), sizeof(v__ast__ComptTimeConstValue)); + return _t53; break; } case v__token__Kind__xor: { - Option_v__ast__ComptTimeConstValue _t65; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((((i64)((*left._u64))) ^ ((i64)((*right._i64))))))) }, (Option*)(&_t65), sizeof(v__ast__ComptTimeConstValue)); - return _t65; + Option_v__ast__ComptTimeConstValue _t54; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((((i64)((*left._u64))) ^ ((i64)((*right._i64))))))) }, (Option*)(&_t54), sizeof(v__ast__ComptTimeConstValue)); + return _t54; break; } case v__token__Kind__pipe: { - Option_v__ast__ComptTimeConstValue _t66; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((((i64)((*left._u64))) | ((i64)((*right._i64))))))) }, (Option*)(&_t66), sizeof(v__ast__ComptTimeConstValue)); - return _t66; + Option_v__ast__ComptTimeConstValue _t55; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((((i64)((*left._u64))) | ((i64)((*right._i64))))))) }, (Option*)(&_t55), sizeof(v__ast__ComptTimeConstValue)); + return _t55; break; } case v__token__Kind__amp: { - Option_v__ast__ComptTimeConstValue _t67; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((((i64)((*left._u64))) & ((i64)((*right._i64))))))) }, (Option*)(&_t67), sizeof(v__ast__ComptTimeConstValue)); - return _t67; + Option_v__ast__ComptTimeConstValue _t56; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((((i64)((*left._u64))) & ((i64)((*right._i64))))))) }, (Option*)(&_t56), sizeof(v__ast__ComptTimeConstValue)); + return _t56; break; } case v__token__Kind__left_shift: { - Option_v__ast__ComptTimeConstValue _t68; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)((*left._u64))) << ((i64)((*right._i64)))))))) }, (Option*)(&_t68), sizeof(v__ast__ComptTimeConstValue)); - return _t68; + Option_v__ast__ComptTimeConstValue _t57; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)((*left._u64))) << ((i64)((*right._i64)))))))) }, (Option*)(&_t57), sizeof(v__ast__ComptTimeConstValue)); + return _t57; break; } case v__token__Kind__right_shift: { - Option_v__ast__ComptTimeConstValue _t69; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)((*left._u64))) >> ((i64)((*right._i64)))))))) }, (Option*)(&_t69), sizeof(v__ast__ComptTimeConstValue)); - return _t69; + Option_v__ast__ComptTimeConstValue _t58; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)((*left._u64))) >> ((i64)((*right._i64)))))))) }, (Option*)(&_t58), sizeof(v__ast__ComptTimeConstValue)); + return _t58; break; } case v__token__Kind__unsigned_right_shift: { - Option_v__ast__ComptTimeConstValue _t70; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)(((u64)((*left._u64))))) >> ((i64)((*right._i64)))))))) }, (Option*)(&_t70), sizeof(v__ast__ComptTimeConstValue)); - return _t70; + Option_v__ast__ComptTimeConstValue _t59; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)(((u64)((*left._u64))))) >> ((i64)((*right._i64)))))))) }, (Option*)(&_t59), sizeof(v__ast__ComptTimeConstValue)); + return _t59; break; } case v__token__Kind__unknown: @@ -51900,79 +54596,79 @@ VV_LOCAL_SYMBOL Option_v__ast__ComptTimeConstValue v__checker__Checker_eval_comp switch ((*expr._v__ast__InfixExpr).op) { case v__token__Kind__plus: { - Option_v__ast__ComptTimeConstValue _t72; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._i64))) + ((i64)((*right._u64)))))) }, (Option*)(&_t72), sizeof(v__ast__ComptTimeConstValue)); - return _t72; + Option_v__ast__ComptTimeConstValue _t61; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._i64))) + ((i64)((*right._u64)))))) }, (Option*)(&_t61), sizeof(v__ast__ComptTimeConstValue)); + return _t61; break; } case v__token__Kind__minus: { - Option_v__ast__ComptTimeConstValue _t73; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._i64))) - ((i64)((*right._u64)))))) }, (Option*)(&_t73), sizeof(v__ast__ComptTimeConstValue)); - return _t73; + Option_v__ast__ComptTimeConstValue _t62; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._i64))) - ((i64)((*right._u64)))))) }, (Option*)(&_t62), sizeof(v__ast__ComptTimeConstValue)); + return _t62; break; } case v__token__Kind__mul: { - Option_v__ast__ComptTimeConstValue _t74; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._i64))) * ((i64)((*right._u64)))))) }, (Option*)(&_t74), sizeof(v__ast__ComptTimeConstValue)); - return _t74; + Option_v__ast__ComptTimeConstValue _t63; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._i64))) * ((i64)((*right._u64)))))) }, (Option*)(&_t63), sizeof(v__ast__ComptTimeConstValue)); + return _t63; break; } case v__token__Kind__div: { - Option_v__ast__ComptTimeConstValue _t75; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._i64))) / ((i64)((*right._u64)))))) }, (Option*)(&_t75), sizeof(v__ast__ComptTimeConstValue)); - return _t75; + Option_v__ast__ComptTimeConstValue _t64; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._i64))) / ((i64)((*right._u64)))))) }, (Option*)(&_t64), sizeof(v__ast__ComptTimeConstValue)); + return _t64; break; } case v__token__Kind__mod: { - Option_v__ast__ComptTimeConstValue _t76; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._i64))) % ((i64)((*right._u64)))))) }, (Option*)(&_t76), sizeof(v__ast__ComptTimeConstValue)); - return _t76; + Option_v__ast__ComptTimeConstValue _t65; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)((*left._i64))) % ((i64)((*right._u64)))))) }, (Option*)(&_t65), sizeof(v__ast__ComptTimeConstValue)); + return _t65; break; } case v__token__Kind__xor: { - Option_v__ast__ComptTimeConstValue _t77; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((((i64)((*left._i64))) ^ ((i64)((*right._u64))))))) }, (Option*)(&_t77), sizeof(v__ast__ComptTimeConstValue)); - return _t77; + Option_v__ast__ComptTimeConstValue _t66; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((((i64)((*left._i64))) ^ ((i64)((*right._u64))))))) }, (Option*)(&_t66), sizeof(v__ast__ComptTimeConstValue)); + return _t66; break; } case v__token__Kind__pipe: { - Option_v__ast__ComptTimeConstValue _t78; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((((i64)((*left._i64))) | ((i64)((*right._u64))))))) }, (Option*)(&_t78), sizeof(v__ast__ComptTimeConstValue)); - return _t78; + Option_v__ast__ComptTimeConstValue _t67; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((((i64)((*left._i64))) | ((i64)((*right._u64))))))) }, (Option*)(&_t67), sizeof(v__ast__ComptTimeConstValue)); + return _t67; break; } case v__token__Kind__amp: { - Option_v__ast__ComptTimeConstValue _t79; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((((i64)((*left._i64))) & ((i64)((*right._u64))))))) }, (Option*)(&_t79), sizeof(v__ast__ComptTimeConstValue)); - return _t79; + Option_v__ast__ComptTimeConstValue _t68; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((((i64)((*left._i64))) & ((i64)((*right._u64))))))) }, (Option*)(&_t68), sizeof(v__ast__ComptTimeConstValue)); + return _t68; break; } case v__token__Kind__left_shift: { - Option_v__ast__ComptTimeConstValue _t80; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)((*left._i64))) << ((i64)((*right._u64)))))))) }, (Option*)(&_t80), sizeof(v__ast__ComptTimeConstValue)); - return _t80; + Option_v__ast__ComptTimeConstValue _t69; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)((*left._i64))) << ((i64)((*right._u64)))))))) }, (Option*)(&_t69), sizeof(v__ast__ComptTimeConstValue)); + return _t69; break; } case v__token__Kind__right_shift: { - Option_v__ast__ComptTimeConstValue _t81; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)((*left._i64))) >> ((i64)((*right._u64)))))))) }, (Option*)(&_t81), sizeof(v__ast__ComptTimeConstValue)); - return _t81; + Option_v__ast__ComptTimeConstValue _t70; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)((*left._i64))) >> ((i64)((*right._u64)))))))) }, (Option*)(&_t70), sizeof(v__ast__ComptTimeConstValue)); + return _t70; break; } case v__token__Kind__unsigned_right_shift: { - Option_v__ast__ComptTimeConstValue _t82; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)(((u64)((*left._i64))))) >> ((i64)((*right._u64)))))))) }, (Option*)(&_t82), sizeof(v__ast__ComptTimeConstValue)); - return _t82; + Option_v__ast__ComptTimeConstValue _t71; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)(((u64)((*left._i64))))) >> ((i64)((*right._u64)))))))) }, (Option*)(&_t71), sizeof(v__ast__ComptTimeConstValue)); + return _t71; break; } case v__token__Kind__unknown: @@ -52090,79 +54786,79 @@ VV_LOCAL_SYMBOL Option_v__ast__ComptTimeConstValue v__checker__Checker_eval_comp switch ((*expr._v__ast__InfixExpr).op) { case v__token__Kind__plus: { - Option_v__ast__ComptTimeConstValue _t84; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) + (*right._u64)))) }, (Option*)(&_t84), sizeof(v__ast__ComptTimeConstValue)); - return _t84; + Option_v__ast__ComptTimeConstValue _t73; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) + (*right._u64)))) }, (Option*)(&_t73), sizeof(v__ast__ComptTimeConstValue)); + return _t73; break; } case v__token__Kind__minus: { - Option_v__ast__ComptTimeConstValue _t85; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) - (*right._u64)))) }, (Option*)(&_t85), sizeof(v__ast__ComptTimeConstValue)); - return _t85; + Option_v__ast__ComptTimeConstValue _t74; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) - (*right._u64)))) }, (Option*)(&_t74), sizeof(v__ast__ComptTimeConstValue)); + return _t74; break; } case v__token__Kind__mul: { - Option_v__ast__ComptTimeConstValue _t86; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) * (*right._u64)))) }, (Option*)(&_t86), sizeof(v__ast__ComptTimeConstValue)); - return _t86; + Option_v__ast__ComptTimeConstValue _t75; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) * (*right._u64)))) }, (Option*)(&_t75), sizeof(v__ast__ComptTimeConstValue)); + return _t75; break; } case v__token__Kind__div: { - Option_v__ast__ComptTimeConstValue _t87; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) / (*right._u64)))) }, (Option*)(&_t87), sizeof(v__ast__ComptTimeConstValue)); - return _t87; + Option_v__ast__ComptTimeConstValue _t76; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) / (*right._u64)))) }, (Option*)(&_t76), sizeof(v__ast__ComptTimeConstValue)); + return _t76; break; } case v__token__Kind__mod: { - Option_v__ast__ComptTimeConstValue _t88; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) % (*right._u64)))) }, (Option*)(&_t88), sizeof(v__ast__ComptTimeConstValue)); - return _t88; + Option_v__ast__ComptTimeConstValue _t77; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) % (*right._u64)))) }, (Option*)(&_t77), sizeof(v__ast__ComptTimeConstValue)); + return _t77; break; } case v__token__Kind__xor: { - Option_v__ast__ComptTimeConstValue _t89; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, (((*left._u64) ^ (*right._u64))))) }, (Option*)(&_t89), sizeof(v__ast__ComptTimeConstValue)); - return _t89; + Option_v__ast__ComptTimeConstValue _t78; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, (((*left._u64) ^ (*right._u64))))) }, (Option*)(&_t78), sizeof(v__ast__ComptTimeConstValue)); + return _t78; break; } case v__token__Kind__pipe: { - Option_v__ast__ComptTimeConstValue _t90; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, (((*left._u64) | (*right._u64))))) }, (Option*)(&_t90), sizeof(v__ast__ComptTimeConstValue)); - return _t90; + Option_v__ast__ComptTimeConstValue _t79; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, (((*left._u64) | (*right._u64))))) }, (Option*)(&_t79), sizeof(v__ast__ComptTimeConstValue)); + return _t79; break; } case v__token__Kind__amp: { - Option_v__ast__ComptTimeConstValue _t91; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, (((*left._u64) & (*right._u64))))) }, (Option*)(&_t91), sizeof(v__ast__ComptTimeConstValue)); - return _t91; + Option_v__ast__ComptTimeConstValue _t80; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, (((*left._u64) & (*right._u64))))) }, (Option*)(&_t80), sizeof(v__ast__ComptTimeConstValue)); + return _t80; break; } case v__token__Kind__left_shift: { - Option_v__ast__ComptTimeConstValue _t92; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) << (*right._u64)))) }, (Option*)(&_t92), sizeof(v__ast__ComptTimeConstValue)); - return _t92; + Option_v__ast__ComptTimeConstValue _t81; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) << (*right._u64)))) }, (Option*)(&_t81), sizeof(v__ast__ComptTimeConstValue)); + return _t81; break; } case v__token__Kind__right_shift: { - Option_v__ast__ComptTimeConstValue _t93; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) >> (*right._u64)))) }, (Option*)(&_t93), sizeof(v__ast__ComptTimeConstValue)); - return _t93; + Option_v__ast__ComptTimeConstValue _t82; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, ((*left._u64) >> (*right._u64)))) }, (Option*)(&_t82), sizeof(v__ast__ComptTimeConstValue)); + return _t82; break; } case v__token__Kind__unsigned_right_shift: { - Option_v__ast__ComptTimeConstValue _t94; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, (((u64)((*left._u64))) >> (*right._u64)))) }, (Option*)(&_t94), sizeof(v__ast__ComptTimeConstValue)); - return _t94; + Option_v__ast__ComptTimeConstValue _t83; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u64, (((u64)((*left._u64))) >> (*right._u64)))) }, (Option*)(&_t83), sizeof(v__ast__ComptTimeConstValue)); + return _t83; break; } case v__token__Kind__unknown: @@ -52280,79 +54976,79 @@ VV_LOCAL_SYMBOL Option_v__ast__ComptTimeConstValue v__checker__Checker_eval_comp switch ((*expr._v__ast__InfixExpr).op) { case v__token__Kind__plus: { - Option_v__ast__ComptTimeConstValue _t96; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((*left._i64) + (*right._i64)))) }, (Option*)(&_t96), sizeof(v__ast__ComptTimeConstValue)); - return _t96; + Option_v__ast__ComptTimeConstValue _t85; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((*left._i64) + (*right._i64)))) }, (Option*)(&_t85), sizeof(v__ast__ComptTimeConstValue)); + return _t85; break; } case v__token__Kind__minus: { - Option_v__ast__ComptTimeConstValue _t97; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((*left._i64) - (*right._i64)))) }, (Option*)(&_t97), sizeof(v__ast__ComptTimeConstValue)); - return _t97; + Option_v__ast__ComptTimeConstValue _t86; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((*left._i64) - (*right._i64)))) }, (Option*)(&_t86), sizeof(v__ast__ComptTimeConstValue)); + return _t86; break; } case v__token__Kind__mul: { - Option_v__ast__ComptTimeConstValue _t98; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((*left._i64) * (*right._i64)))) }, (Option*)(&_t98), sizeof(v__ast__ComptTimeConstValue)); - return _t98; + Option_v__ast__ComptTimeConstValue _t87; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((*left._i64) * (*right._i64)))) }, (Option*)(&_t87), sizeof(v__ast__ComptTimeConstValue)); + return _t87; break; } case v__token__Kind__div: { - Option_v__ast__ComptTimeConstValue _t99; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((*left._i64) / (*right._i64)))) }, (Option*)(&_t99), sizeof(v__ast__ComptTimeConstValue)); - return _t99; + Option_v__ast__ComptTimeConstValue _t88; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((*left._i64) / (*right._i64)))) }, (Option*)(&_t88), sizeof(v__ast__ComptTimeConstValue)); + return _t88; break; } case v__token__Kind__mod: { - Option_v__ast__ComptTimeConstValue _t100; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((*left._i64) % (*right._i64)))) }, (Option*)(&_t100), sizeof(v__ast__ComptTimeConstValue)); - return _t100; + Option_v__ast__ComptTimeConstValue _t89; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, ((*left._i64) % (*right._i64)))) }, (Option*)(&_t89), sizeof(v__ast__ComptTimeConstValue)); + return _t89; break; } case v__token__Kind__xor: { - Option_v__ast__ComptTimeConstValue _t101; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((*left._i64) ^ (*right._i64))))) }, (Option*)(&_t101), sizeof(v__ast__ComptTimeConstValue)); - return _t101; + Option_v__ast__ComptTimeConstValue _t90; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((*left._i64) ^ (*right._i64))))) }, (Option*)(&_t90), sizeof(v__ast__ComptTimeConstValue)); + return _t90; break; } case v__token__Kind__pipe: { - Option_v__ast__ComptTimeConstValue _t102; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((*left._i64) | (*right._i64))))) }, (Option*)(&_t102), sizeof(v__ast__ComptTimeConstValue)); - return _t102; + Option_v__ast__ComptTimeConstValue _t91; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((*left._i64) | (*right._i64))))) }, (Option*)(&_t91), sizeof(v__ast__ComptTimeConstValue)); + return _t91; break; } case v__token__Kind__amp: { - Option_v__ast__ComptTimeConstValue _t103; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((*left._i64) & (*right._i64))))) }, (Option*)(&_t103), sizeof(v__ast__ComptTimeConstValue)); - return _t103; + Option_v__ast__ComptTimeConstValue _t92; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((*left._i64) & (*right._i64))))) }, (Option*)(&_t92), sizeof(v__ast__ComptTimeConstValue)); + return _t92; break; } case v__token__Kind__left_shift: { - Option_v__ast__ComptTimeConstValue _t104; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)((*left._i64))) << (*right._i64)))))) }, (Option*)(&_t104), sizeof(v__ast__ComptTimeConstValue)); - return _t104; + Option_v__ast__ComptTimeConstValue _t93; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)((*left._i64))) << (*right._i64)))))) }, (Option*)(&_t93), sizeof(v__ast__ComptTimeConstValue)); + return _t93; break; } case v__token__Kind__right_shift: { - Option_v__ast__ComptTimeConstValue _t105; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)((*left._i64))) >> (*right._i64)))))) }, (Option*)(&_t105), sizeof(v__ast__ComptTimeConstValue)); - return _t105; + Option_v__ast__ComptTimeConstValue _t94; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)((*left._i64))) >> (*right._i64)))))) }, (Option*)(&_t94), sizeof(v__ast__ComptTimeConstValue)); + return _t94; break; } case v__token__Kind__unsigned_right_shift: { - Option_v__ast__ComptTimeConstValue _t106; - opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)(((u64)((*left._i64))))) >> (*right._i64)))))) }, (Option*)(&_t106), sizeof(v__ast__ComptTimeConstValue)); - return _t106; + Option_v__ast__ComptTimeConstValue _t95; + opt_ok(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (((i64)(((u64)(((u64)((*left._i64))))) >> (*right._i64)))))) }, (Option*)(&_t95), sizeof(v__ast__ComptTimeConstValue)); + return _t95; break; } case v__token__Kind__unknown: @@ -52470,79 +55166,79 @@ VV_LOCAL_SYMBOL Option_v__ast__ComptTimeConstValue v__checker__Checker_eval_comp switch ((*expr._v__ast__InfixExpr).op) { case v__token__Kind__plus: { - Option_v__ast__ComptTimeConstValue _t108; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) + (*right._u8)))) }, (Option*)(&_t108), sizeof(v__ast__ComptTimeConstValue)); - return _t108; + Option_v__ast__ComptTimeConstValue _t97; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) + (*right._u8)))) }, (Option*)(&_t97), sizeof(v__ast__ComptTimeConstValue)); + return _t97; break; } case v__token__Kind__minus: { - Option_v__ast__ComptTimeConstValue _t109; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) - (*right._u8)))) }, (Option*)(&_t109), sizeof(v__ast__ComptTimeConstValue)); - return _t109; + Option_v__ast__ComptTimeConstValue _t98; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) - (*right._u8)))) }, (Option*)(&_t98), sizeof(v__ast__ComptTimeConstValue)); + return _t98; break; } case v__token__Kind__mul: { - Option_v__ast__ComptTimeConstValue _t110; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) * (*right._u8)))) }, (Option*)(&_t110), sizeof(v__ast__ComptTimeConstValue)); - return _t110; + Option_v__ast__ComptTimeConstValue _t99; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) * (*right._u8)))) }, (Option*)(&_t99), sizeof(v__ast__ComptTimeConstValue)); + return _t99; break; } case v__token__Kind__div: { - Option_v__ast__ComptTimeConstValue _t111; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) / (*right._u8)))) }, (Option*)(&_t111), sizeof(v__ast__ComptTimeConstValue)); - return _t111; + Option_v__ast__ComptTimeConstValue _t100; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) / (*right._u8)))) }, (Option*)(&_t100), sizeof(v__ast__ComptTimeConstValue)); + return _t100; break; } case v__token__Kind__mod: { - Option_v__ast__ComptTimeConstValue _t112; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) % (*right._u8)))) }, (Option*)(&_t112), sizeof(v__ast__ComptTimeConstValue)); - return _t112; + Option_v__ast__ComptTimeConstValue _t101; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) % (*right._u8)))) }, (Option*)(&_t101), sizeof(v__ast__ComptTimeConstValue)); + return _t101; break; } case v__token__Kind__xor: { - Option_v__ast__ComptTimeConstValue _t113; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, (((*left._u8) ^ (*right._u8))))) }, (Option*)(&_t113), sizeof(v__ast__ComptTimeConstValue)); - return _t113; + Option_v__ast__ComptTimeConstValue _t102; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, (((*left._u8) ^ (*right._u8))))) }, (Option*)(&_t102), sizeof(v__ast__ComptTimeConstValue)); + return _t102; break; } case v__token__Kind__pipe: { - Option_v__ast__ComptTimeConstValue _t114; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, (((*left._u8) | (*right._u8))))) }, (Option*)(&_t114), sizeof(v__ast__ComptTimeConstValue)); - return _t114; + Option_v__ast__ComptTimeConstValue _t103; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, (((*left._u8) | (*right._u8))))) }, (Option*)(&_t103), sizeof(v__ast__ComptTimeConstValue)); + return _t103; break; } case v__token__Kind__amp: { - Option_v__ast__ComptTimeConstValue _t115; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, (((*left._u8) & (*right._u8))))) }, (Option*)(&_t115), sizeof(v__ast__ComptTimeConstValue)); - return _t115; + Option_v__ast__ComptTimeConstValue _t104; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, (((*left._u8) & (*right._u8))))) }, (Option*)(&_t104), sizeof(v__ast__ComptTimeConstValue)); + return _t104; break; } case v__token__Kind__left_shift: { - Option_v__ast__ComptTimeConstValue _t116; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) << (*right._u8)))) }, (Option*)(&_t116), sizeof(v__ast__ComptTimeConstValue)); - return _t116; + Option_v__ast__ComptTimeConstValue _t105; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) << (*right._u8)))) }, (Option*)(&_t105), sizeof(v__ast__ComptTimeConstValue)); + return _t105; break; } case v__token__Kind__right_shift: { - Option_v__ast__ComptTimeConstValue _t117; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) >> (*right._u8)))) }, (Option*)(&_t117), sizeof(v__ast__ComptTimeConstValue)); - return _t117; + Option_v__ast__ComptTimeConstValue _t106; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, ((*left._u8) >> (*right._u8)))) }, (Option*)(&_t106), sizeof(v__ast__ComptTimeConstValue)); + return _t106; break; } case v__token__Kind__unsigned_right_shift: { - Option_v__ast__ComptTimeConstValue _t118; - opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, (((u8)((*left._u8))) >> (*right._u8)))) }, (Option*)(&_t118), sizeof(v__ast__ComptTimeConstValue)); - return _t118; + Option_v__ast__ComptTimeConstValue _t107; + opt_ok(&(v__ast__ComptTimeConstValue[]) { u8_to_sumtype_v__ast__ComptTimeConstValue(ADDR(u8, (((u8)((*left._u8))) >> (*right._u8)))) }, (Option*)(&_t107), sizeof(v__ast__ComptTimeConstValue)); + return _t107; break; } case v__token__Kind__unknown: @@ -52705,10 +55401,10 @@ VV_LOCAL_SYMBOL void v__checker__Checker_verify_all_vweb_routes(v__checker__Chec for (int _t2 = 0; _t2 < sym_app->methods.len; ++_t2) { v__ast__Fn m = ((v__ast__Fn*)sym_app->methods.data)[_t2]; if (m.return_type == typ_vweb_result) { - multi_return_bool_int_int mr_10340 = v__checker__Checker_verify_vweb_params_for_method(c, m); - bool is_ok = mr_10340.arg0; - int nroute_attributes = mr_10340.arg1; - int nargs = mr_10340.arg2; + multi_return_bool_int_int mr_9819 = v__checker__Checker_verify_vweb_params_for_method(c, m); + bool is_ok = mr_9819.arg0; + int nroute_attributes = mr_9819.arg1; + int nargs = mr_9819.arg2; if (!is_ok) { v__ast__FnDecl* f = ((v__ast__FnDecl*)(m.source_fn)); if (isnil(f)) { @@ -55337,6 +58033,16 @@ VV_LOCAL_SYMBOL void v__checker__Checker_for_c_stmt(v__checker__Checker* c, v__a } v__checker__Checker_expr(c, node.cond); if (node.has_inc) { + if ((node.inc)._typ == 337 /* v.ast.AssignStmt */) { + for (int _t1 = 0; _t1 < (*node.inc._v__ast__AssignStmt).right.len; ++_t1) { + v__ast__Expr right = ((v__ast__Expr*)(*node.inc._v__ast__AssignStmt).right.data)[_t1]; + if ((right)._typ == 291 /* v.ast.CallExpr */) { + if ((*right._v__ast__CallExpr).or_block.stmts.len > 0) { + v__checker__Checker_error(c, _SLIT("optionals are not allowed in `for statement increment` (yet)"), (*right._v__ast__CallExpr).pos); + } + } + } + } v__checker__Checker_stmt(c, node.inc); } v__checker__Checker_check_loop_label(c, node.label, node.pos); @@ -58538,28 +61244,32 @@ v__ast__Expr v__transformer__Transformer_expr(v__transformer__Transformer* t, v_ } else if (node->_typ == 325 /* v.ast.SelectorExpr */) { (*node->_v__ast__SelectorExpr).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__SelectorExpr).expr); + if (((*node->_v__ast__SelectorExpr).expr)._typ == 329 /* v.ast.StringLiteral */ && string__eq((*node->_v__ast__SelectorExpr).field_name, _SLIT("len"))) { + v__ast__Expr _t15 = v__ast__IntegerLiteral_to_sumtype_v__ast__Expr(ADDR(v__ast__IntegerLiteral, (((v__ast__IntegerLiteral){.val = int_str((*(*node->_v__ast__SelectorExpr).expr._v__ast__StringLiteral).val.len),.pos = (*node->_v__ast__SelectorExpr).pos,})))); + return _t15; + } } else if (node->_typ == 326 /* v.ast.SizeOf */) { (*node->_v__ast__SizeOf).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__SizeOf).expr); } else if (node->_typ == 327 /* v.ast.SqlExpr */) { - v__ast__Expr _t15 = v__transformer__Transformer_sql_expr(t, (voidptr)&/*qq*/(*node->_v__ast__SqlExpr)); - return _t15; + v__ast__Expr _t16 = v__transformer__Transformer_sql_expr(t, (voidptr)&/*qq*/(*node->_v__ast__SqlExpr)); + return _t16; } else if (node->_typ == 328 /* v.ast.StringInterLiteral */) { - for (int _t16 = 0; _t16 < (*node->_v__ast__StringInterLiteral).exprs.len; ++_t16) { - v__ast__Expr* expr = ((v__ast__Expr*)(*node->_v__ast__StringInterLiteral).exprs.data) + _t16; + for (int _t17 = 0; _t17 < (*node->_v__ast__StringInterLiteral).exprs.len; ++_t17) { + v__ast__Expr* expr = ((v__ast__Expr*)(*node->_v__ast__StringInterLiteral).exprs.data) + _t17; *expr = v__transformer__Transformer_expr(t, expr); } } else if (node->_typ == 330 /* v.ast.StructInit */) { (*node->_v__ast__StructInit).update_expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__StructInit).update_expr); - for (int _t17 = 0; _t17 < (*node->_v__ast__StructInit).fields.len; ++_t17) { - v__ast__StructInitField* field = ((v__ast__StructInitField*)(*node->_v__ast__StructInit).fields.data) + _t17; + for (int _t18 = 0; _t18 < (*node->_v__ast__StructInit).fields.len; ++_t18) { + v__ast__StructInitField* field = ((v__ast__StructInitField*)(*node->_v__ast__StructInit).fields.data) + _t18; field->expr = v__transformer__Transformer_expr(t, &/*sum*/field->expr); } - for (int _t18 = 0; _t18 < (*node->_v__ast__StructInit).embeds.len; ++_t18) { - v__ast__StructInitEmbed* embed = ((v__ast__StructInitEmbed*)(*node->_v__ast__StructInit).embeds.data) + _t18; + for (int _t19 = 0; _t19 < (*node->_v__ast__StructInit).embeds.len; ++_t19) { + v__ast__StructInitEmbed* embed = ((v__ast__StructInitEmbed*)(*node->_v__ast__StructInit).embeds.data) + _t19; embed->expr = v__transformer__Transformer_expr(t, &/*sum*/embed->expr); } } @@ -58570,8 +61280,8 @@ v__ast__Expr v__transformer__Transformer_expr(v__transformer__Transformer* t, v_ else { } ; - v__ast__Expr _t19 = *node; - return _t19; + v__ast__Expr _t20 = *node; + return _t20; } v__ast__Expr v__transformer__Transformer_call_expr(v__transformer__Transformer* t, v__ast__CallExpr* node) { @@ -59405,7 +62115,7 @@ bool v__markused__mark_used_defer_0 = false; v__markused__Walker_mark_exported_fns(&walker); v__markused__Walker_mark_root_fns(&walker, all_fn_root_names); if (walker.n_asserts > 0) { - v__markused__Walker_fn_decl(&walker, (voidptr)&/*qq*/(*(v__ast__FnDecl*)map_get(ADDR(map, all_fns), &(string[]){_SLIT("__print_assert_failure")}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},} }))); + v__markused__Walker_fn_decl(&walker, (voidptr)&/*qq*/(*(v__ast__FnDecl*)map_get(ADDR(map, all_fns), &(string[]){_SLIT("__print_assert_failure")}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},} }))); } if (table->used_maps > 0) { int _t57 = all_fns.key_values.len; @@ -59502,7 +62212,7 @@ bool v__markused__all_fn_const_and_global_defer_0 = false; v__ast__Stmt node = ((v__ast__Stmt*)file->stmts.data)[_t1]; if (node._typ == 218 /* v.ast.FnDecl */) { string fkey = v__ast__FnDecl_fkey(&(*node._v__ast__FnDecl)); -(*(v__ast__FnDecl*)map_get_and_set((map*)&all_fns, &(string[]){fkey}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},} })) = (*node._v__ast__FnDecl); +(*(v__ast__FnDecl*)map_get_and_set((map*)&all_fns, &(string[]){fkey}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},} })) = (*node._v__ast__FnDecl); } else if (node._typ == 341 /* v.ast.ConstDecl */) { for (int _t2 = 0; _t2 < (*node._v__ast__ConstDecl).fields.len; ++_t2) { @@ -59585,7 +62295,7 @@ void v__markused__Walker_mark_root_fns(v__markused__Walker* w, Array_string all_ for (int _t1 = 0; _t1 < all_fn_root_names.len; ++_t1) { string fn_name = ((string*)all_fn_root_names.data)[_t1]; if (!_IN_MAP(ADDR(string, fn_name), ADDR(map, w->used_fns))) { - v__markused__Walker_fn_decl(w, (voidptr)&/*qq*/(*(v__ast__FnDecl*)map_get(ADDR(map, w->all_fns), &(string[]){fn_name}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},} }))); + v__markused__Walker_fn_decl(w, (voidptr)&/*qq*/(*(v__ast__FnDecl*)map_get(ADDR(map, w->all_fns), &(string[]){fn_name}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},} }))); } } } @@ -61646,7 +64356,7 @@ string sref_name; Option_v__ast__Fn _t7 = v__ast__Table_find_method(g->table, left_sym, extracted_op); if (_t7.state != 0) { /*or block*/ IError err = _t7.err; - v__gen__c__Gen_error(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("assignemnt operator `"), 0xfe10, {.d_s = extracted_op}}, {_SLIT("=` used but no `"), 0xfe10, {.d_s = extracted_op}}, {_SLIT("` method defined"), 0, { .d_c = 0 }}})), node.pos); + v__gen__c__Gen_error(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("assignment operator `"), 0xfe10, {.d_s = extracted_op}}, {_SLIT("=` used but no `"), 0xfe10, {.d_s = extracted_op}}, {_SLIT("` method defined"), 0, { .d_c = 0 }}})), node.pos); VUNREACHABLE(); *(v__ast__Fn*) _t7.data = ((v__ast__Fn){.is_variadic = 0,.language = 0,.is_pub = 0,.is_ctor_new = 0,.is_deprecated = 0,.is_noreturn = 0,.is_unsafe = 0,.is_placeholder = 0,.is_main = 0,.is_test = 0,.is_keep_alive = 0,.is_method = 0,.no_body = 0,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.file_mode = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type = 0,.receiver_type = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 0,}); } @@ -65162,9 +67872,9 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_optional_type_text(v__gen__c__Gen* g, stri } VV_LOCAL_SYMBOL string v__gen__c__Gen_register_optional(v__gen__c__Gen* g, v__ast__Type t) { - multi_return_string_string mr_36786 = v__gen__c__Gen_optional_type_name(g, t); - string styp = mr_36786.arg0; - string base = mr_36786.arg1; + multi_return_string_string mr_36790 = v__gen__c__Gen_optional_type_name(g, t); + string styp = mr_36790.arg0; + string base = mr_36790.arg1; map_set(&g->optionals, &(string[]){base}, &(string[]) { styp }); string _t1 = styp; return _t1; @@ -65795,11 +68505,9 @@ inline VV_LOCAL_SYMBOL void v__gen__c__Gen_write_v_source_line_info(v__gen__c__G } VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { -bool v__gen__c__Gen_stmt_defer_0 = false; if (!g->skip_stmt_pos) { v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); } - v__gen__c__Gen_stmt_defer_0 = true; if (node._typ == 343 /* v.ast.EmptyStmt */) { } else if (node._typ == 335 /* v.ast.AsmStmt */) { @@ -66100,10 +68808,6 @@ bool v__gen__c__Gen_stmt_defer_0 = false; else if (node._typ == 358 /* v.ast.StructDecl */) { string name = ((*node._v__ast__StructDecl).language == v__ast__Language__c ? (v__util__no_dots((*node._v__ast__StructDecl).name)) : (string__eq((*node._v__ast__StructDecl).name, _SLIT("array")) || string__eq((*node._v__ast__StructDecl).name, _SLIT("string"))) ? ((*node._v__ast__StructDecl).name) : (v__gen__c__c_name((*node._v__ast__StructDecl).name))); if ((*node._v__ast__StructDecl).language == v__ast__Language__c) { - // Defer begin - if (v__gen__c__Gen_stmt_defer_0) { - } - // Defer end return; } if ((*node._v__ast__StructDecl).is_union) { @@ -66125,10 +68829,6 @@ bool v__gen__c__Gen_stmt_defer_0 = false; if ((node)._typ != 218 /* v.ast.FnDecl */) { } } -// Defer begin -if (v__gen__c__Gen_stmt_defer_0) { -} -// Defer end } VV_LOCAL_SYMBOL void v__gen__c__Gen_write_defer_stmts(v__gen__c__Gen* g) { @@ -66209,8 +68909,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_sumtype_casting_fn(v__gen__c__Gen* g, *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t4.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_66009 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t4.data); - Array_v__ast__Type embed_types = mr_66009.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_65944 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t4.data); + Array_v__ast__Type embed_types = mr_65944.arg1; if (embed_types.len > 0) { v__ast__TypeSymbol* embed_sym = v__ast__Table_sym(g->table, (*(v__ast__Type*)array_last(embed_types))); ptr = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = v__ast__TypeSymbol_embed_name(embed_sym)}}, {_SLIT("_ptr"), 0, { .d_c = 0 }}})); @@ -67313,7 +70013,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_char_literal(v__gen__c__Gen* g, v__ast__Char v__gen__c__Gen_write(g, _SLIT("'`'")); return; } - if (utf8_str_len(node.val) < node.val.len) { + if (string_len_utf8(node.val) < node.val.len) { v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("((rune)0x"), 0xfe10, {.d_s = int_hex(string_utf32_code(node.val))}}, {_SLIT(" /* `"), 0xfe10, {.d_s = node.val}}, {_SLIT("` */)"), 0, { .d_c = 0 }}}))); return; } @@ -67438,8 +70138,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_selector_expr(v__gen__c__Gen* g, v__ast__Sel v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 478) /*expected idx: 478, name: v.ast.ArrayFixed */ ; v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, 0xfe07, {.d_i32 = info.size}}, {_SLIT0, 0, { .d_c = 0 }}}))); return; - } - if (sym->kind == v__ast__Kind__chan && (string__eq(node.field_name, _SLIT("len")) || string__eq(node.field_name, _SLIT("closed")))) { + } else if (sym->kind == v__ast__Kind__chan && (string__eq(node.field_name, _SLIT("len")) || string__eq(node.field_name, _SLIT("closed")))) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("sync__Channel_"), 0xfe10, {.d_s = node.field_name}}, {_SLIT("("), 0, { .d_c = 0 }}}))); v__gen__c__Gen_expr(g, node.expr); v__gen__c__Gen_write(g, _SLIT(")")); @@ -67656,11 +70355,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_map_init(v__gen__c__Gen* g, v__ast__MapInit string value_typ_str = v__gen__c__Gen_typ(g, unwrap_val_typ); v__ast__TypeSymbol* value_sym = v__ast__Table_sym(g->table, unwrap_val_typ); v__ast__TypeSymbol* key_sym = v__ast__Table_final_sym(g->table, unwrap_key_typ); - multi_return_string_string_string_string mr_105252 = v__gen__c__Gen_map_fn_ptrs(g, *key_sym); - string hash_fn = mr_105252.arg0; - string key_eq_fn = mr_105252.arg1; - string clone_fn = mr_105252.arg2; - string free_fn = mr_105252.arg3; + multi_return_string_string_string_string mr_105188 = v__gen__c__Gen_map_fn_ptrs(g, *key_sym); + string hash_fn = mr_105188.arg0; + string key_eq_fn = mr_105188.arg1; + string clone_fn = mr_105188.arg2; + string free_fn = mr_105188.arg3; int size = node.vals.len; string shared_styp = _SLIT(""); string styp = _SLIT(""); @@ -67889,7 +70588,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_ident(v__gen__c__Gen* g, v__ast__Ident node) if (g->pref->translated && !g->is_builtin_mod && !v__util__module_is_builtin(string_all_before_last(node.name, _SLIT(".")))) { string x = v__util__no_dots(node.name); if (string_starts_with(x, _SLIT("main__"))) { - x = string_substr(x, _SLIT("main__").len, (x).len); + x = string_substr(x, 6, (x).len); } v__gen__c__Gen_write(g, x); return; @@ -68817,9 +71516,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ for (int _t3 = 0; _t3 < (*sym->info._v__ast__Struct).fields.len; ++_t3) { v__ast__StructField field = ((v__ast__StructField*)(*sym->info._v__ast__Struct).fields.data)[_t3]; if (v__ast__Type_has_flag(field.typ, v__ast__TypeFlag__optional)) { - multi_return_string_string mr_142389 = v__gen__c__Gen_optional_type_name(g, field.typ); - string styp = mr_142389.arg0; - string base = mr_142389.arg1; + multi_return_string_string mr_142325 = v__gen__c__Gen_optional_type_name(g, field.typ); + string styp = mr_142325.arg0; + string base = mr_142325.arg1; sync__RwMutex_lock(&g->done_optionals->mtx); /*lock*/ { if (!Array_string_contains(g->done_optionals->val, base)) { @@ -69092,11 +71791,11 @@ bool v__gen__c__Gen_or_block_defer_0 = false; if (string__eq(g->file->mod.name, _SLIT("main")) && (isnil(g->fn_decl) || g->fn_decl->is_main)) { string err_msg = str_intp(3, _MOV((StrIntpData[]){{_SLIT("IError_name_table["), 0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._typ]._method_msg("), 0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._object)"), 0, { .d_c = 0 }}})); if (g->pref->is_debug) { - multi_return_int_string_string_string mr_151543 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); - int paline = mr_151543.arg0; - string pafile = mr_151543.arg1; - string pamod = mr_151543.arg2; - string pafn = mr_151543.arg3; + multi_return_int_string_string_string mr_151479 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); + int paline = mr_151479.arg0; + string pafile = mr_151479.arg1; + string pamod = mr_151479.arg2; + string pafn = mr_151479.arg3; v__gen__c__Gen_writeln(g, str_intp(6, _MOV((StrIntpData[]){{_SLIT("panic_debug("), 0xfe07, {.d_i32 = paline}}, {_SLIT(", tos3(\""), 0xfe10, {.d_s = pafile}}, {_SLIT("\"), tos3(\""), 0xfe10, {.d_s = pamod}}, {_SLIT("\"), tos3(\""), 0xfe10, {.d_s = pafn}}, {_SLIT("\"), "), 0xfe10, {.d_s = err_msg}}, {_SLIT(" );"), 0, { .d_c = 0 }}}))); } else { v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tpanic_optional_not_set( "), 0xfe10, {.d_s = err_msg}}, {_SLIT(" );"), 0, { .d_c = 0 }}}))); @@ -69206,11 +71905,11 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_type_default(v__gen__c__Gen* g, v__ast__Ty { v__ast__Map info = v__ast__TypeSymbol_map_info(sym); v__ast__TypeSymbol* key_typ = v__ast__Table_sym(g->table, info.key_type); - multi_return_string_string_string_string mr_154125 = v__gen__c__Gen_map_fn_ptrs(g, *key_typ); - string hash_fn = mr_154125.arg0; - string key_eq_fn = mr_154125.arg1; - string clone_fn = mr_154125.arg2; - string free_fn = mr_154125.arg3; + multi_return_string_string_string_string mr_154061 = v__gen__c__Gen_map_fn_ptrs(g, *key_typ); + string hash_fn = mr_154061.arg0; + string key_eq_fn = mr_154061.arg1; + string clone_fn = mr_154061.arg2; + string free_fn = mr_154061.arg3; string noscan_key = v__gen__c__Gen_check_noscan(g, info.key_type); string noscan_value = v__gen__c__Gen_check_noscan(g, info.value_type); string noscan = (noscan_key.len != 0 || noscan_value.len != 0 ? (_SLIT("_noscan")) : (_SLIT(""))); @@ -69735,8 +72434,8 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { int params_start_pos = g->out.len; Array_v__ast__Param params = array_clone_to_depth(&method.params, 0); array_set(¶ms, 0, &(v__ast__Param[]) { ((v__ast__Param){(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).pos,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).name,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).is_mut,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).is_auto_rec,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).type_pos,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).is_hidden,.typ = v__ast__Type_set_nr_muls(st, 1),}) }); - multi_return_Array_string_Array_string_Array_bool mr_168560 = v__gen__c__Gen_fn_decl_params(g, params, ((voidptr)(0)), false); - Array_string fargs = mr_168560.arg0; + multi_return_Array_string_Array_string_Array_bool mr_168496 = v__gen__c__Gen_fn_decl_params(g, params, ((voidptr)(0)), false); + Array_string fargs = mr_168496.arg0; string parameter_name = strings__Builder_cut_last(&g->out, g->out.len - params_start_pos); if (v__ast__Type_is_ptr(st)) { parameter_name = string_trim_string_left(parameter_name, _SLIT("__shared__")); @@ -69753,8 +72452,8 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { *(multi_return_v__ast__Fn_Array_v__ast__Type*) _t26.data = (multi_return_v__ast__Fn_Array_v__ast__Type){.arg0=((v__ast__Fn){.is_variadic = 0,.language = 0,.is_pub = 0,.is_ctor_new = 0,.is_deprecated = 0,.is_noreturn = 0,.is_unsafe = 0,.is_placeholder = 0,.is_main = 0,.is_test = 0,.is_keep_alive = 0,.is_method = 0,.no_body = 0,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.file_mode = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type = 0,.receiver_type = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_169024 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t26.data); - Array_v__ast__Type embed_types = mr_169024.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_168960 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t26.data); + Array_v__ast__Type embed_types = mr_168960.arg1; if (embed_types.len > 0 && !Array_string_contains(method_names, method.name)) { v__ast__TypeSymbol* embed_sym = v__ast__Table_sym(g->table, (*(v__ast__Type*)array_last(embed_types))); string method_name = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = embed_sym->cname}}, {_SLIT("_"), 0xfe10, {.d_s = method.name}}, {_SLIT0, 0, { .d_c = 0 }}})); @@ -71792,7 +74491,7 @@ int ctmp; } v__ast__Var info = /* as */ *(v__ast__Var*)__as_cast((var.obj)._v__ast__Var,(var.obj)._typ, 363) /*expected idx: 363, name: v.ast.Var */ ; if (v__ast__Table_sym(g->table, info.typ)->kind != v__ast__Kind__function) { - v__gen__c__Gen_writeln(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = v__gen__c__Gen_typ(g, info.typ)}}, {_SLIT0, 0xfe10, {.d_s = deref}}, {_SLIT(" "), 0xfe10, {.d_s = var.name}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_writeln(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, 0xfe10, {.d_s = v__gen__c__Gen_typ(g, info.typ)}}, {_SLIT0, 0xfe10, {.d_s = deref}}, {_SLIT(" "), 0xfe10, {.d_s = v__gen__c__c_name(var.name)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } } } @@ -72816,11 +75515,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr } if (!print_auto_str) { if (g->pref->is_debug && string__eq(node.name, _SLIT("panic"))) { - multi_return_int_string_string_string mr_40523 = v__gen__c__Gen_panic_debug_info(g, node.pos); - int paline = mr_40523.arg0; - string pafile = mr_40523.arg1; - string pamod = mr_40523.arg2; - string pafn = mr_40523.arg3; + multi_return_int_string_string_string mr_40533 = v__gen__c__Gen_panic_debug_info(g, node.pos); + int paline = mr_40533.arg0; + string pafile = mr_40533.arg1; + string pamod = mr_40533.arg2; + string pafn = mr_40533.arg3; v__gen__c__Gen_write(g, str_intp(5, _MOV((StrIntpData[]){{_SLIT("panic_debug("), 0xfe07, {.d_i32 = paline}}, {_SLIT(", tos3(\""), 0xfe10, {.d_s = pafile}}, {_SLIT("\"), tos3(\""), 0xfe10, {.d_s = pamod}}, {_SLIT("\"), tos3(\""), 0xfe10, {.d_s = pafn}}, {_SLIT("\"), "), 0, { .d_c = 0 }}}))); v__gen__c__Gen_call_args(g, node); v__gen__c__Gen_write(g, _SLIT(")")); @@ -73214,7 +75913,14 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_go_expr(v__gen__c__Gen* g, v__ast__GoExpr no } } else { v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("pthread_t thread_"), 0xfe10, {.d_s = tmp}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); - v__gen__c__Gen_writeln(g, str_intp(5, _MOV((StrIntpData[]){{_SLIT("int "), 0xfe10, {.d_s = tmp}}, {_SLIT("_thr_res = pthread_create(&thread_"), 0xfe10, {.d_s = tmp}}, {_SLIT(", NULL, (void*)"), 0xfe10, {.d_s = wrapper_fn_name}}, {_SLIT(", "), 0xfe10, {.d_s = arg_tmp_var}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); + string sthread_attributes = _SLIT("NULL"); + if (g->pref->os != v__pref__OS__vinix) { + v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("pthread_attr_t thread_"), 0xfe10, {.d_s = tmp}}, {_SLIT("_attributes;"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("pthread_attr_init(&thread_"), 0xfe10, {.d_s = tmp}}, {_SLIT("_attributes);"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("pthread_attr_setstacksize(&thread_"), 0xfe10, {.d_s = tmp}}, {_SLIT("_attributes, "), 0xfe07, {.d_i32 = g->pref->thread_stack_size}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); + sthread_attributes = str_intp(2, _MOV((StrIntpData[]){{_SLIT("&thread_"), 0xfe10, {.d_s = tmp}}, {_SLIT("_attributes"), 0, { .d_c = 0 }}})); + } + v__gen__c__Gen_writeln(g, str_intp(6, _MOV((StrIntpData[]){{_SLIT("int "), 0xfe10, {.d_s = tmp}}, {_SLIT("_thr_res = pthread_create(&thread_"), 0xfe10, {.d_s = tmp}}, {_SLIT(", "), 0xfe10, {.d_s = sthread_attributes}}, {_SLIT(", (void*)"), 0xfe10, {.d_s = wrapper_fn_name}}, {_SLIT(", "), 0xfe10, {.d_s = arg_tmp_var}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); v__gen__c__Gen_writeln(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT("if ("), 0xfe10, {.d_s = tmp}}, {_SLIT("_thr_res) panic_error_number(tos3(\"`go "), 0xfe10, {.d_s = name}}, {_SLIT("()`: \"), "), 0xfe10, {.d_s = tmp}}, {_SLIT("_thr_res);"), 0, { .d_c = 0 }}}))); if (!node.is_expr) { v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("pthread_detach(thread_"), 0xfe10, {.d_s = tmp}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); @@ -73353,6 +76059,13 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_go_expr(v__gen__c__Gen* g, v__ast__GoExpr no strings__Builder_write_string(&g->gowrappers, call_args_str); } else { for (int i = 0; i < expr.args.len; ++i) { + int expected_nr_muls = v__ast__Type_nr_muls((*(v__ast__Type*)/*ee elem_sym */array_get(expr.expected_arg_types, i))); + int arg_nr_muls = v__ast__Type_nr_muls((*(v__ast__CallArg*)/*ee elem_sym */array_get(expr.args, i)).typ); + if (arg_nr_muls > expected_nr_muls) { + strings__Builder_write_string(&g->gowrappers, string_repeat(_SLIT("*"), arg_nr_muls - expected_nr_muls)); + } else if (arg_nr_muls < expected_nr_muls) { + strings__Builder_write_string(&g->gowrappers, string_repeat(_SLIT("&"), expected_nr_muls - arg_nr_muls)); + } strings__Builder_write_string(&g->gowrappers, str_intp(2, _MOV((StrIntpData[]){{_SLIT("arg->arg"), 0xfe07, {.d_i32 = i + 1}}, {_SLIT0, 0, { .d_c = 0 }}}))); if (i != expr.args.len - 1) { strings__Builder_write_string(&g->gowrappers, _SLIT(", ")); @@ -80562,7 +83275,7 @@ VV_LOCAL_SYMBOL v__ast__HashStmt v__parser__Parser_hash(v__parser__Parser* p) { } VV_LOCAL_SYMBOL v__ast__ComptimeCall v__parser__Parser_comptime_call(v__parser__Parser* p) { - v__ast__ComptimeCall *err_node = HEAP(v__ast__ComptimeCall, (((v__ast__ComptimeCall){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_parens = 0,.method_name = (string){.str=(byteptr)"", .is_lit=1},.method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.scope = 0,.left = {0},.args_var = (string){.str=(byteptr)"", .is_lit=1},.is_vweb = 0,.vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),},.is_embed = 0,.is_env = 0,.env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pkgconfig = 0,.left_type = 0,.result_type = 0,.env_value = (string){.str=(byteptr)"", .is_lit=1},.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.embed_file = (v__ast__EmbeddedFile){.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.is_compressed = 0,.bytes = __new_array(0, 0, sizeof(u8)),.len = 0,},}))); + v__ast__ComptimeCall *err_node = HEAP(v__ast__ComptimeCall, (((v__ast__ComptimeCall){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_parens = 0,.method_name = (string){.str=(byteptr)"", .is_lit=1},.method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.scope = 0,.left = {0},.args_var = (string){.str=(byteptr)"", .is_lit=1},.is_vweb = 0,.vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),},.is_embed = 0,.is_env = 0,.env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pkgconfig = 0,.left_type = 0,.result_type = 0,.env_value = (string){.str=(byteptr)"", .is_lit=1},.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.embed_file = (v__ast__EmbeddedFile){.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.is_compressed = 0,.bytes = __new_array(0, 0, sizeof(u8)),.len = 0,},}))); v__parser__Parser_check(p, v__token__Kind__dollar); v__token__Pos start_pos = v__token__Token_pos(&p->prev_tok); string error_msg = _SLIT("only `$tmpl()`, `$env()`, `$embed_file()`, `$pkgconfig()` and `$vweb.html()` comptime functions are supported right now"); @@ -80598,7 +83311,7 @@ VV_LOCAL_SYMBOL v__ast__ComptimeCall v__parser__Parser_comptime_call(v__parser__ .left = {0}, .args_var = s, .is_vweb = 0, - .vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),}, + .vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),}, .is_embed = 0, .is_env = true, .env_pos = spos, @@ -80624,7 +83337,7 @@ VV_LOCAL_SYMBOL v__ast__ComptimeCall v__parser__Parser_comptime_call(v__parser__ .left = {0}, .args_var = s, .is_vweb = 0, - .vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),}, + .vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),}, .is_embed = 0, .is_env = 0, .env_pos = spos, @@ -80680,7 +83393,7 @@ VV_LOCAL_SYMBOL v__ast__ComptimeCall v__parser__Parser_comptime_call(v__parser__ if (string__eq(embed_compression_type, _SLIT("zlib")) && (p->pref->is_prod || Array_string_contains(p->pref->compile_defines, _SLIT("debug_embed_file_in_prod")))) { v__parser__Parser_register_auto_import(p, _SLIT("v.preludes.embed_file.zlib")); } - v__ast__ComptimeCall _t8 = ((v__ast__ComptimeCall){.pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)),.has_parens = 0,.method_name = (string){.str=(byteptr)"", .is_lit=1},.method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.scope = 0,.left = {0},.args_var = (string){.str=(byteptr)"", .is_lit=1},.is_vweb = 0,.vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),},.is_embed = true,.is_env = 0,.env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pkgconfig = 0,.left_type = 0,.result_type = 0,.env_value = (string){.str=(byteptr)"", .is_lit=1},.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.embed_file = ((v__ast__EmbeddedFile){.rpath = literal_string_param,.apath = epath,.compression_type = embed_compression_type,.is_compressed = 0,.bytes = __new_array(0, 0, sizeof(u8)),.len = 0,}),}); + v__ast__ComptimeCall _t8 = ((v__ast__ComptimeCall){.pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)),.has_parens = 0,.method_name = (string){.str=(byteptr)"", .is_lit=1},.method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.scope = 0,.left = {0},.args_var = (string){.str=(byteptr)"", .is_lit=1},.is_vweb = 0,.vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),},.is_embed = true,.is_env = 0,.env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pkgconfig = 0,.left_type = 0,.result_type = 0,.env_value = (string){.str=(byteptr)"", .is_lit=1},.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.embed_file = ((v__ast__EmbeddedFile){.rpath = literal_string_param,.apath = epath,.compression_type = embed_compression_type,.is_compressed = 0,.bytes = __new_array(0, 0, sizeof(u8)),.len = 0,}),}); return _t8; } Array_string fn_path = string_split(p->cur_fn_name, _SLIT("_")); @@ -80705,7 +83418,7 @@ VV_LOCAL_SYMBOL v__ast__ComptimeCall v__parser__Parser_comptime_call(v__parser__ } if (!os__exists(path)) { if (p->pref->is_fmt) { - v__ast__ComptimeCall _t9 = ((v__ast__ComptimeCall){.pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)),.has_parens = 0,.method_name = method_name,.method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.scope = 0,.left = {0},.args_var = literal_string_param,.is_vweb = true,.vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),},.is_embed = 0,.is_env = 0,.env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pkgconfig = 0,.left_type = 0,.result_type = 0,.env_value = (string){.str=(byteptr)"", .is_lit=1},.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.embed_file = (v__ast__EmbeddedFile){.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.is_compressed = 0,.bytes = __new_array(0, 0, sizeof(u8)),.len = 0,},}); + v__ast__ComptimeCall _t9 = ((v__ast__ComptimeCall){.pos = v__token__Pos_extend(start_pos, v__token__Token_pos(&p->prev_tok)),.has_parens = 0,.method_name = method_name,.method_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.scope = 0,.left = {0},.args_var = literal_string_param,.is_vweb = true,.vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),},.is_embed = 0,.is_env = 0,.env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_pkgconfig = 0,.left_type = 0,.result_type = 0,.env_value = (string){.str=(byteptr)"", .is_lit=1},.args = __new_array(0, 0, sizeof(v__ast__CallArg)),.embed_file = (v__ast__EmbeddedFile){.rpath = (string){.str=(byteptr)"", .is_lit=1},.apath = (string){.str=(byteptr)"", .is_lit=1},.compression_type = (string){.str=(byteptr)"", .is_lit=1},.is_compressed = 0,.bytes = __new_array(0, 0, sizeof(u8)),.len = 0,},}); return _t9; } if (is_html) { @@ -80816,7 +83529,7 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_comptime_selector(v__parser__Pars .left = left, .args_var = _SLIT(""), .is_vweb = 0, - .vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),}, + .vweb_tmpl = (v__ast__File){.nr_lines = 0,.nr_bytes = 0,.mod = (v__ast__Module){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_skipped = 0,},.global_scope = 0,.is_test = 0,.is_generated = 0,.is_translated = 0,.idx = 0,.path = (string){.str=(byteptr)"", .is_lit=1},.path_base = (string){.str=(byteptr)"", .is_lit=1},.scope = 0,.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.imports = __new_array(0, 0, sizeof(v__ast__Import)),.auto_imports = __new_array(0, 0, sizeof(string)),.embedded_files = __new_array(0, 0, sizeof(v__ast__EmbeddedFile)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.generic_fns = __new_array(0, 0, sizeof(v__ast__FnDecl*)),.global_labels = __new_array(0, 0, sizeof(string)),}, .is_embed = 0, .is_env = 0, .env_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}, @@ -81598,7 +84311,7 @@ v__ast__Expr v__parser__Parser_expr_with_left(v__parser__Parser* p, v__ast__Expr v__ast__Expr right = v__parser__Parser_expr(p, precedence - 1); v__token__Pos_update_last_line(&pos, p->prev_tok.line_nr); if ((node)._typ == 308 /* v.ast.IndexExpr */) { - v__ast__IndexExpr_recursive_mapset_is_setter(&(*node._v__ast__IndexExpr), true); + v__ast__IndexExpr_recursive_arraymap_set_is_setter(&(*node._v__ast__IndexExpr)); } node = v__ast__InfixExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__InfixExpr, (((v__ast__InfixExpr){.op = tok.kind,.pos = pos,.is_stmt = true,.left = node,.right = right,.left_type = 0,.right_type = 0,.auto_locked = (string){.str=(byteptr)"", .is_lit=1},.or_block = (v__ast__OrExpr){.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.ct_left_value_evaled = 0,.ct_left_value = v__ast__empty_comptime_const_expr(),.ct_right_value_evaled = 0,.ct_right_value = v__ast__empty_comptime_const_expr(),})))); } else if (v__token__Kind_is_infix(p->tok.kind)) { @@ -82045,7 +84758,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { Option_void _t5 = v__parser__Parser_fn_receiver(p, &/*arr*/params, (voidptr)&/*qq*/rec); if (_t5.state != 0 && _t5.err._typ != _IError_None___index) { IError err = _t5.err; - v__ast__FnDecl _t6 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t6 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); return _t6; } @@ -82059,7 +84772,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { name = (language == v__ast__Language__js ? (v__parser__Parser_check_js_name(p)) : (v__parser__Parser_check_name(p))); if (language == v__ast__Language__v && !p->pref->translated && !p->is_translated && v__util__contains_capital(name) && !p->builtin_mod) { v__parser__Parser_error_with_pos(p, _SLIT("function names cannot contain uppercase letters, use snake_case instead"), name_pos); - v__ast__FnDecl _t7 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t7 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); return _t7; } v__ast__TypeSymbol* type_sym = v__ast__Table_sym(p->table, rec.typ); @@ -82072,14 +84785,14 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { } if (is_duplicate) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("duplicate method `"), 0xfe10, {.d_s = name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), name_pos); - v__ast__FnDecl _t8 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t8 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); return _t8; } } if (!p->pref->is_fmt) { if (_IN_MAP(ADDR(string, name), ADDR(map, p->imported_symbols))) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot redefine imported function `"), 0xfe10, {.d_s = name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), name_pos); - v__ast__FnDecl _t9 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t9 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); return _t9; } } @@ -82093,7 +84806,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { v__parser__Parser_error_with_pos(p, _SLIT("cannot overload `!=`, `>`, `<=` and `>=` as they are auto generated from `==` and`<`"), v__token__Token_pos(&p->tok)); } else { v__parser__Parser_error_with_pos(p, _SLIT("expecting method name"), v__token__Token_pos(&p->tok)); - v__ast__FnDecl _t10 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t10 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); return _t10; } multi_return_Array_v__ast__Type_Array_string mr_8867 = v__parser__Parser_parse_generic_types(p); @@ -82133,7 +84846,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { v__ast__Param param = ((v__ast__Param*)params.data)[_t16]; if (v__ast__Scope_known_var(p->scope, param.name)) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("redefinition of parameter `"), 0xfe10, {.d_s = param.name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), param.pos); - v__ast__FnDecl _t17 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t17 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); return _t17; } bool is_stack_obj = !v__ast__Type_has_flag(param.typ, v__ast__TypeFlag__shared_f) && (param.is_mut || v__ast__Type_is_ptr(param.typ)); @@ -82184,7 +84897,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { } if (is_non_local) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot define new methods on non-local type "), 0xfe10, {.d_s = type_sym->name}}, {_SLIT0, 0, { .d_c = 0 }}})), rec.type_pos); - v__ast__FnDecl _t18 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t18 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); return _t18; } type_sym_method_idx = v__ast__TypeSymbol_register_method(type_sym, ((v__ast__Fn){ @@ -82293,7 +85006,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { } if (!no_body && are_args_type_only) { v__parser__Parser_error_with_pos(p, _SLIT("functions with type only args can not have bodies"), body_start_pos); - v__ast__FnDecl _t22 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); + v__ast__FnDecl _t22 = ((v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.rec_share = 0,.language = 0,.file_mode = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}); return _t22; } v__ast__FnDecl fn_decl = ((v__ast__FnDecl){ @@ -82330,6 +85043,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { .is_direct_arr = is_direct_arr, .attrs = p->attrs, .ctdefine_idx = conditional_ctdefine_idx, + .idx = 0, .params = params, .stmts = stmts, .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), @@ -82454,7 +85168,7 @@ bool v__parser__Parser_anon_fn_defer_0 = false; v__parser__Parser_check(p, v__token__Kind__key_fn); if (p->pref->is_script && p->tok.kind == v__token__Kind__name) { v__parser__Parser_error_with_pos(p, _SLIT("function declarations in script mode should be before all script statements"), v__token__Token_pos(&p->tok)); - v__ast__AnonFn _t1 = ((v__ast__AnonFn){.decl = (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.inherited_vars = __new_array(0, 0, sizeof(v__ast__Param)),.typ = 0,.has_gen = 0,}); + v__ast__AnonFn _t1 = ((v__ast__AnonFn){.decl = (v__ast__FnDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.receiver = (v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = 0,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = 0,.is_global = 0,.is_volatile = 0,.default_expr_typ = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,},.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_method = 0,.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.file = (string){.str=(byteptr)"", .is_lit=1},.generic_names = __new_array(0, 0, sizeof(string)),.is_direct_arr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ctdefine_idx = -1,.idx = 0,.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.return_type = 0,.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_return = 0,.should_be_skipped = 0,.ninstances = 0,.has_await = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.source_file = 0,.scope = 0,.label_names = __new_array(0, 0, sizeof(string)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},},.inherited_vars = __new_array(0, 0, sizeof(v__ast__Param)),.typ = 0,.has_gen = 0,}); return _t1; } bool old_inside_defer = p->inside_defer; @@ -82561,6 +85275,7 @@ bool v__parser__Parser_anon_fn_defer_0 = false; .is_direct_arr = 0, .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), .ctdefine_idx = -1, + .idx = 0, .params = args, .stmts = stmts, .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), @@ -84432,7 +87147,7 @@ v__ast__Type v__parser__Parser_parse_generic_inst_type(v__parser__Parser* p, str v__ast__Stmt v__parser__parse_stmt(string text, v__ast__Table* table, v__ast__Scope* scope) { bool v__parser__parse_stmt_defer_0 = false; - v__parser__Parser p = ((v__parser__Parser){.pref = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.os = 0,.backend = 0,.build_mode = 0,.arch = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.profile_no_inline = 0,.profile_fns = __new_array(0, 0, sizeof(string)),.translated = 0,.is_prod = 0,.obfuscate = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.use_cache = 0,.retry_compilation = true,.is_stats = 0,.cflags = (string){.str=(byteptr)"", .is_lit=1},.m64 = 0,.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.ccompiler_type = 0,.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_fmt = 0,.is_vet = 0,.is_bare = 0,.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.no_preludes = 0,.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.lookup_path = __new_array(0, 0, sizeof(string)),.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.use_color = 0,.no_parallel = 0,.is_vweb = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.is_ios_simulator = 0,.is_apk = 0,.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.is_help = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.is_cstrict = 0,.assert_failure_mode = 0,.message_limit = 100,.nofloat = 0,.checker_match_exhaustive_cutoff_limit = 12,}, sizeof(v__pref__Preferences))),.file_base = (string){.str=(byteptr)"", .is_lit=1},.file_name = (string){.str=(byteptr)"", .is_lit=1},.file_name_dir = (string){.str=(byteptr)"", .is_lit=1},.unique_prefix = (string){.str=(byteptr)"", .is_lit=1},.file_backend_mode = 0,.scanner = v__scanner__new_scanner(text, v__scanner__CommentsMode__skip_comments, ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.os = 0,.backend = 0,.build_mode = 0,.arch = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.profile_no_inline = 0,.profile_fns = __new_array(0, 0, sizeof(string)),.translated = 0,.is_prod = 0,.obfuscate = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.use_cache = 0,.retry_compilation = true,.is_stats = 0,.cflags = (string){.str=(byteptr)"", .is_lit=1},.m64 = 0,.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.ccompiler_type = 0,.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_fmt = 0,.is_vet = 0,.is_bare = 0,.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.no_preludes = 0,.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.lookup_path = __new_array(0, 0, sizeof(string)),.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.use_color = 0,.no_parallel = 0,.is_vweb = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.is_ios_simulator = 0,.is_apk = 0,.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.is_help = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.is_cstrict = 0,.assert_failure_mode = 0,.message_limit = 100,.nofloat = 0,.checker_match_exhaustive_cutoff_limit = 12,}, sizeof(v__pref__Preferences)))),.comments_mode = v__scanner__CommentsMode__skip_comments,.tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.prev_tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.peek_tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.table = table,.language = 0,.fn_language = 0,.expr_level = 0,.inside_vlib_file = 0,.inside_test_file = true,.inside_if = 0,.inside_if_expr = 0,.inside_if_cond = 0,.inside_ct_if_expr = 0,.inside_or_expr = 0,.inside_for = 0,.inside_fn = 0,.inside_fn_return = 0,.inside_unsafe_fn = 0,.inside_str_interp = 0,.inside_array_lit = 0,.inside_in_array = 0,.inside_match = 0,.inside_select = 0,.inside_match_case = 0,.inside_match_body = 0,.inside_unsafe = 0,.inside_sum_type = 0,.inside_asm_template = 0,.inside_asm = 0,.inside_defer = 0,.inside_generic_params = 0,.inside_receiver_param = 0,.inside_struct_field_decl = 0,.or_is_handled = 0,.builtin_mod = 0,.mod = (string){.str=(byteptr)"", .is_lit=1},.is_manualfree = 0,.has_globals = 0,.is_generated = 0,.is_translated = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.expr_mod = (string){.str=(byteptr)"", .is_lit=1},.scope = scope,.imports = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.ast_imports = __new_array(0, 0, sizeof(v__ast__Import)),.used_imports = __new_array(0, 0, sizeof(string)),.auto_imports = __new_array(0, 0, sizeof(string)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.is_amp = 0,.returns = 0,.is_stmt_ident = 0,.expecting_type = 0,.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.vet_errors = __new_array(0, 0, sizeof(v__vet__Error)),.cur_fn_name = (string){.str=(byteptr)"", .is_lit=1},.label_names = __new_array(0, 0, sizeof(string)),.name_error = 0,.n_asm = 0,.global_labels = __new_array(0, 0, sizeof(string)),.comptime_if_cond = 0,.defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)),.should_abort = 0,.codegen_text = (string){.str=(byteptr)"", .is_lit=1},.struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)),}); + v__parser__Parser p = ((v__parser__Parser){.pref = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.os = 0,.backend = 0,.build_mode = 0,.arch = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.profile_no_inline = 0,.profile_fns = __new_array(0, 0, sizeof(string)),.translated = 0,.is_prod = 0,.obfuscate = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.use_cache = 0,.retry_compilation = true,.is_stats = 0,.cflags = (string){.str=(byteptr)"", .is_lit=1},.m64 = 0,.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.ccompiler_type = 0,.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_fmt = 0,.is_vet = 0,.is_bare = 0,.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.no_preludes = 0,.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.lookup_path = __new_array(0, 0, sizeof(string)),.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.use_color = 0,.no_parallel = 0,.is_vweb = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.is_ios_simulator = 0,.is_apk = 0,.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.is_help = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.is_cstrict = 0,.assert_failure_mode = 0,.message_limit = 100,.nofloat = 0,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,}, sizeof(v__pref__Preferences))),.file_base = (string){.str=(byteptr)"", .is_lit=1},.file_name = (string){.str=(byteptr)"", .is_lit=1},.file_name_dir = (string){.str=(byteptr)"", .is_lit=1},.unique_prefix = (string){.str=(byteptr)"", .is_lit=1},.file_backend_mode = 0,.scanner = v__scanner__new_scanner(text, v__scanner__CommentsMode__skip_comments, ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.os = 0,.backend = 0,.build_mode = 0,.arch = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.profile_no_inline = 0,.profile_fns = __new_array(0, 0, sizeof(string)),.translated = 0,.is_prod = 0,.obfuscate = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.use_cache = 0,.retry_compilation = true,.is_stats = 0,.cflags = (string){.str=(byteptr)"", .is_lit=1},.m64 = 0,.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.ccompiler_type = 0,.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_fmt = 0,.is_vet = 0,.is_bare = 0,.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.no_preludes = 0,.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.lookup_path = __new_array(0, 0, sizeof(string)),.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.use_color = 0,.no_parallel = 0,.is_vweb = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.is_ios_simulator = 0,.is_apk = 0,.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.is_help = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.is_cstrict = 0,.assert_failure_mode = 0,.message_limit = 100,.nofloat = 0,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,}, sizeof(v__pref__Preferences)))),.comments_mode = v__scanner__CommentsMode__skip_comments,.tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.prev_tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.peek_tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.table = table,.language = 0,.fn_language = 0,.expr_level = 0,.inside_vlib_file = 0,.inside_test_file = true,.inside_if = 0,.inside_if_expr = 0,.inside_if_cond = 0,.inside_ct_if_expr = 0,.inside_or_expr = 0,.inside_for = 0,.inside_fn = 0,.inside_fn_return = 0,.inside_unsafe_fn = 0,.inside_str_interp = 0,.inside_array_lit = 0,.inside_in_array = 0,.inside_match = 0,.inside_select = 0,.inside_match_case = 0,.inside_match_body = 0,.inside_unsafe = 0,.inside_sum_type = 0,.inside_asm_template = 0,.inside_asm = 0,.inside_defer = 0,.inside_generic_params = 0,.inside_receiver_param = 0,.inside_struct_field_decl = 0,.or_is_handled = 0,.builtin_mod = 0,.mod = (string){.str=(byteptr)"", .is_lit=1},.is_manualfree = 0,.has_globals = 0,.is_generated = 0,.is_translated = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.expr_mod = (string){.str=(byteptr)"", .is_lit=1},.scope = scope,.imports = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.ast_imports = __new_array(0, 0, sizeof(v__ast__Import)),.used_imports = __new_array(0, 0, sizeof(string)),.auto_imports = __new_array(0, 0, sizeof(string)),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.is_amp = 0,.returns = 0,.is_stmt_ident = 0,.expecting_type = 0,.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.vet_errors = __new_array(0, 0, sizeof(v__vet__Error)),.cur_fn_name = (string){.str=(byteptr)"", .is_lit=1},.label_names = __new_array(0, 0, sizeof(string)),.name_error = 0,.n_asm = 0,.global_labels = __new_array(0, 0, sizeof(string)),.comptime_if_cond = 0,.defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)),.should_abort = 0,.codegen_text = (string){.str=(byteptr)"", .is_lit=1},.struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)),}); v__parser__Parser_init_parse_fns(&p); v__util__timing_start(_SLIT("PARSE stmt")); v__parser__parse_stmt_defer_0 = true; @@ -84935,6 +87650,7 @@ bool v__parser__Parser_parse_defer_0 = false; .is_test = p->inside_test_file, .is_generated = p->is_generated, .is_translated = p->is_translated, + .idx = 0, .path = p->file_name, .path_base = p->file_base, .scope = p->scope, @@ -85241,6 +87957,7 @@ v__ast__Stmt v__parser__Parser_top_stmt(v__parser__Parser* p) { .is_direct_arr = 0, .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), .ctdefine_idx = -1, + .idx = 0, .params = __new_array(0, 0, sizeof(v__ast__Param)), .stmts = stmts, .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), @@ -88743,7 +91460,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; v__parser__Parser_next(p); is_field_volatile = true; } - bool is_embed = ((p->tok.lit.len > 1 && u8_is_capital(string_at(p->tok.lit, 0)) && (p->peek_tok.kind != v__token__Kind__lsbr || v__parser__Parser_peek_token(p, 2).kind != v__token__Kind__rsbr)) || p->peek_tok.kind == v__token__Kind__dot) && language == v__ast__Language__v && p->peek_tok.kind != v__token__Kind__key_fn; + bool is_embed = ((p->tok.lit.len > 1 && u8_is_capital(string_at(p->tok.lit, 0)) && (p->peek_tok.line_nr != p->tok.line_nr || !(p->peek_tok.kind == v__token__Kind__name || p->peek_tok.kind == v__token__Kind__amp)) && (p->peek_tok.kind != v__token__Kind__lsbr || v__parser__Parser_peek_token(p, 2).kind != v__token__Kind__rsbr)) || p->peek_tok.kind == v__token__Kind__dot) && language == v__ast__Language__v && p->peek_tok.kind != v__token__Kind__key_fn; bool is_on_top = ast_fields.len == 0 && !(is_field_mut || is_field_global); string field_name = _SLIT(""); v__ast__Type typ = ((v__ast__Type)(0)); @@ -89060,8 +91777,8 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser } else { interface_name = v__parser__Parser_prepend_mod(p, modless_name); } - multi_return_Array_v__ast__Type_Array_string mr_12928 = v__parser__Parser_parse_generic_types(p); - Array_v__ast__Type generic_types = mr_12928.arg0; + multi_return_Array_v__ast__Type_Array_string mr_13010 = v__parser__Parser_parse_generic_types(p); + Array_v__ast__Type generic_types = mr_13010.arg0; v__parser__Parser_check(p, v__token__Kind__lcbr); Array_v__ast__Comment pre_comments = v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,})); if (_IN_MAP(ADDR(string, modless_name), ADDR(map, p->imported_symbols))) { @@ -89097,7 +91814,7 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser Array_v__ast__InterfaceEmbedding ifaces = __new_array_with_default(0, 0, sizeof(v__ast__InterfaceEmbedding), 0); for (;;) { if (!(p->tok.kind != v__token__Kind__rcbr && p->tok.kind != v__token__Kind__eof)) break; - if (p->tok.kind == v__token__Kind__name && p->tok.lit.len > 0 && u8_is_capital(string_at(p->tok.lit, 0))) { + if (p->tok.kind == v__token__Kind__name && p->tok.lit.len > 0 && u8_is_capital(string_at(p->tok.lit, 0)) && p->peek_tok.kind != v__token__Kind__lpar) { v__token__Pos iface_pos = v__token__Token_pos(&p->tok); string iface_name = p->tok.lit; v__ast__Type iface_type = v__parser__Parser_parse_type(p); @@ -89154,16 +91871,11 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser v__ast__InterfaceDecl _t7 = ((v__ast__InterfaceDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.language = 0,.field_names = __new_array(0, 0, sizeof(string)),.is_pub = 0,.mut_pos = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.are_embeds_expanded = 0,}); return _t7; } - if (language == v__ast__Language__v && v__util__contains_capital(name)) { - v__parser__Parser_error(p, _SLIT("interface methods cannot contain uppercase letters, use snake_case instead")); - v__ast__InterfaceDecl _t8 = ((v__ast__InterfaceDecl){.name = (string){.str=(byteptr)"", .is_lit=1},.typ = 0,.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.language = 0,.field_names = __new_array(0, 0, sizeof(string)),.is_pub = 0,.mut_pos = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.are_embeds_expanded = 0,}); - return _t8; - } - multi_return_Array_v__ast__Param_bool_bool mr_16146 = v__parser__Parser_fn_args(p); - Array_v__ast__Param args2 = mr_16146.arg0; - bool is_variadic = mr_16146.arg2; + multi_return_Array_v__ast__Param_bool_bool mr_16079 = v__parser__Parser_fn_args(p); + Array_v__ast__Param args2 = mr_16079.arg0; + bool is_variadic = mr_16079.arg2; Array_v__ast__Param args = new_array_from_c_array(1, 1, sizeof(v__ast__Param), _MOV((v__ast__Param[1]){((v__ast__Param){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.name = _SLIT("x"),.is_mut = is_mut,.is_auto_rec = 0,.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.is_hidden = true,.typ = typ,})})); - _PUSH_MANY(&args, (args2), _t9, Array_v__ast__Param); + _PUSH_MANY(&args, (args2), _t8, Array_v__ast__Param); v__ast__FnDecl method = ((v__ast__FnDecl){ .name = name, .short_name = name, @@ -89198,6 +91910,7 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser .is_direct_arr = 0, .attrs = __new_array(0, 0, sizeof(v__ast__Attr)), .ctdefine_idx = -1, + .idx = 0, .params = args, .stmts = __new_array(0, 0, sizeof(v__ast__Stmt)), .defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)), @@ -89291,17 +92004,17 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser array_push((array*)&info.fields, _MOV((v__ast__StructField[]){ ((v__ast__StructField){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.has_default_expr = 0,.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_pub = true,.default_val = (string){.str=(byteptr)"", .is_lit=1},.is_mut = is_mut,.is_global = 0,.is_volatile = 0,.default_expr = {0},.default_expr_typ = 0,.name = field_name,.typ = field_typ,}) })); } } - Array_v__ast__Type _t15 = {0}; - Array_v__ast__InterfaceEmbedding _t15_orig = ifaces; - int _t15_len = _t15_orig.len; - _t15 = __new_array(0, _t15_len, sizeof(v__ast__Type)); + Array_v__ast__Type _t14 = {0}; + Array_v__ast__InterfaceEmbedding _t14_orig = ifaces; + int _t14_len = _t14_orig.len; + _t14 = __new_array(0, _t14_len, sizeof(v__ast__Type)); - for (int _t16 = 0; _t16 < _t15_len; ++_t16) { - v__ast__InterfaceEmbedding it = ((v__ast__InterfaceEmbedding*) _t15_orig.data)[_t16]; + for (int _t15 = 0; _t15 < _t14_len; ++_t15) { + v__ast__InterfaceEmbedding it = ((v__ast__InterfaceEmbedding*) _t14_orig.data)[_t15]; v__ast__Type ti = it.typ; - array_push((array*)&_t15, &ti); + array_push((array*)&_t14, &ti); } - info.embeds =_t15; + info.embeds =_t14; ts->info = v__ast__Interface_to_sumtype_v__ast__TypeInfo(&info); v__parser__Parser_top_level_statement_end(p); v__parser__Parser_check(p, v__token__Kind__rcbr); @@ -89324,8 +92037,8 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser .are_embeds_expanded = 0, }); v__ast__Table_register_interface(p->table, res); - v__ast__InterfaceDecl _t17 = res; - return _t17; + v__ast__InterfaceDecl _t16 = res; + return _t16; } VV_LOCAL_SYMBOL void v__parser__State_update(v__parser__State* state, string line) { @@ -89440,7 +92153,7 @@ string v__parser__Parser_compile_template_file(v__parser__Parser* p, string temp } int position = (*(int*)_t3.data); - v__parser__Parser_error_with_error(p, ((v__errors__Error){.message = _SLIT("Please use @include 'header' instead of @header (deprecated)"),.details = (string){.str=(byteptr)"", .is_lit=1},.file_path = template_file,.pos = ((v__token__Pos){.len = _SLIT("@header").len,.line_nr = tline_number,.pos = start_of_line_pos + position,.col = 0,.last_line = lines.len,}),.backtrace = (string){.str=(byteptr)"", .is_lit=1},.reporter = v__errors__Reporter__parser,})); + v__parser__Parser_error_with_error(p, ((v__errors__Error){.message = _SLIT("Please use @include 'header' instead of @header (deprecated)"),.details = (string){.str=(byteptr)"", .is_lit=1},.file_path = template_file,.pos = ((v__token__Pos){.len = 7,.line_nr = tline_number,.pos = start_of_line_pos + position,.col = 0,.last_line = lines.len,}),.backtrace = (string){.str=(byteptr)"", .is_lit=1},.reporter = v__errors__Reporter__parser,})); continue; } if (string_contains(line, _SLIT("@footer"))) { @@ -89451,7 +92164,7 @@ string v__parser__Parser_compile_template_file(v__parser__Parser* p, string temp } int position = (*(int*)_t4.data); - v__parser__Parser_error_with_error(p, ((v__errors__Error){.message = _SLIT("Please use @include 'footer' instead of @footer (deprecated)"),.details = (string){.str=(byteptr)"", .is_lit=1},.file_path = template_file,.pos = ((v__token__Pos){.len = _SLIT("@footer").len,.line_nr = tline_number,.pos = start_of_line_pos + position,.col = 0,.last_line = lines.len,}),.backtrace = (string){.str=(byteptr)"", .is_lit=1},.reporter = v__errors__Reporter__parser,})); + v__parser__Parser_error_with_error(p, ((v__errors__Error){.message = _SLIT("Please use @include 'footer' instead of @footer (deprecated)"),.details = (string){.str=(byteptr)"", .is_lit=1},.file_path = template_file,.pos = ((v__token__Pos){.len = 7,.line_nr = tline_number,.pos = start_of_line_pos + position,.col = 0,.last_line = lines.len,}),.backtrace = (string){.str=(byteptr)"", .is_lit=1},.reporter = v__errors__Reporter__parser,})); continue; } if (string_contains(line, _SLIT("@include "))) { @@ -89476,8 +92189,8 @@ string v__parser__Parser_compile_template_file(v__parser__Parser* p, string temp *(int*) _t6.data = 0; } - int position = (*(int*)_t6.data) + _SLIT("@include ").len; - v__parser__Parser_error_with_error(p, ((v__errors__Error){.message = str_intp(3, _MOV((StrIntpData[]){{_SLIT("Reading file "), 0xfe10, {.d_s = file_name}}, {_SLIT(" from path: "), 0xfe10, {.d_s = file_path}}, {_SLIT(" failed"), 0, { .d_c = 0 }}})),.details = str_intp(2, _MOV((StrIntpData[]){{_SLIT("Failed to @include '"), 0xfe10, {.d_s = file_name}}, {_SLIT("'"), 0, { .d_c = 0 }}})),.file_path = template_file,.pos = ((v__token__Pos){.len = _SLIT("@include ").len + file_name.len,.line_nr = tline_number,.pos = start_of_line_pos + position,.col = 0,.last_line = lines.len,}),.backtrace = (string){.str=(byteptr)"", .is_lit=1},.reporter = v__errors__Reporter__parser,})); + int position = (*(int*)_t6.data) + 9; + v__parser__Parser_error_with_error(p, ((v__errors__Error){.message = str_intp(3, _MOV((StrIntpData[]){{_SLIT("Reading file "), 0xfe10, {.d_s = file_name}}, {_SLIT(" from path: "), 0xfe10, {.d_s = file_path}}, {_SLIT(" failed"), 0, { .d_c = 0 }}})),.details = str_intp(2, _MOV((StrIntpData[]){{_SLIT("Failed to @include '"), 0xfe10, {.d_s = file_name}}, {_SLIT("'"), 0, { .d_c = 0 }}})),.file_path = template_file,.pos = ((v__token__Pos){.len = 9 + file_name.len,.line_nr = tline_number,.pos = start_of_line_pos + position,.col = 0,.last_line = lines.len,}),.backtrace = (string){.str=(byteptr)"", .is_lit=1},.reporter = v__errors__Reporter__parser,})); *(string*) _t5.data = _SLIT(""); } @@ -89709,6 +92422,7 @@ v__builder__Builder v__builder__new_builder(v__pref__Preferences* pref) { if (pref->use_color == v__pref__ColorOutput__never) { v__util__EManager_set_support_color(_const_v__util__emanager, false); } + table->pointer_size = (pref->m64 ? (8) : (4)); Option_v__builder__MsvcResult _t1 = v__builder__find_msvc(pref->m64); if (_t1.state != 0) { /*or block*/ IError err = _t1.err; @@ -93022,26 +95736,6 @@ void _vinit(int ___argc, voidptr ___argv) { } { // Initializations for module v.mathutil : } - { // Initializations for module time : - _const_time__month_days = new_array_from_c_array(12, 12, sizeof(int), _MOV((int[12]){ - 31, 28, 31, 30, 31, 30, 31, 31, 30, - 31, 30, 31})); - _const_time__absolute_zero_year = ((i64)(-292277022399)); - _const_time__days_before = new_array_from_c_array(13, 13, sizeof(int), _MOV((int[13]){ - 0, 31, 59, 90, 120, 151, 181, 212, 243, - 273, 304, 334, 365})); - _const_time__long_days = new_array_from_c_array(7, 7, sizeof(string), _MOV((string[7]){_SLIT("Monday"), _SLIT("Tuesday"), _SLIT("Wednesday"), _SLIT("Thursday"), _SLIT("Friday"), _SLIT("Saturday"), _SLIT("Sunday")})); - _const_time__nanosecond = ((time__Duration)(1)); - _const_time__microsecond = ((1000 * _const_time__nanosecond)); - _const_time__millisecond = ((1000 * _const_time__microsecond)); - _const_time__second = ((1000 * _const_time__millisecond)); - _const_time__minute = ((60 * _const_time__second)); - _const_time__hour = ((60 * _const_time__minute)); - _const_time__infinite = ((((i64)(9223372036854775807)))); - _const_time__start_time = time__init_win_time_start(); - _const_time__freq_time = time__init_win_time_freq(); - _const_time__start_local_time = time__local_as_unix_time(); - } { // Initializations for module v.dotgraph : } { // Initializations for module hash : @@ -93052,6 +95746,8 @@ void _vinit(int ___argc, voidptr ___argv) { } { // Initializations for module hash.fnv1a : } + { // Initializations for module math.internal : + } { // Initializations for module flag : } { // Initializations for module semver : @@ -93073,9 +95769,101 @@ void _vinit(int ___argc, voidptr ___argv) { } { // Initializations for module v.depgraph : } - { // Initializations for module v.vet : + { // Initializations for module math : + _const_math__pi_2 = _const_math__pi / 2.0; + _const_math__pi_4 = _const_math__pi / 4.0; + _const_math__log2_e = 1.0 / _const_math__ln2; + _const_math__log10_e = 1.0 / _const_math__ln10; + _const_math__min_i64 = ((i64)(-9223372036854775807 - 1)); + _const_math__max_i64 = ((i64)(9223372036854775807)); + _const_math__bernoulli = new_array_from_c_array(10, 10, sizeof(f64), _MOV((f64[10]){ + 1.0 / (12.), -1.0 / (360), 1.0 / (1260), -1.0 / (1680), 5.0 / (5940), -691.0 / (360360), 7.0 / (1092.), -3617.0 / (122400), 43867.0 / (243576.), + -174611.0 / (125400)})); + _const_math__factorials_table = new_array_from_c_array(171, 171, sizeof(f64), _MOV((f64[171]){ + 1.000000000000000000000e+0, 1.000000000000000000000e+0, 2.000000000000000000000e+0, 6.000000000000000000000e+0, 2.400000000000000000000e+1, 1.200000000000000000000e+2, 7.200000000000000000000e+2, 5.040000000000000000000e+3, 4.032000000000000000000e+4, + 3.628800000000000000000e+5, 3.628800000000000000000e+6, 3.991680000000000000000e+7, 4.790016000000000000000e+8, 6.227020800000000000000e+9, 8.717829120000000000000e+10, 1.307674368000000000000e+12, 2.092278988800000000000e+13, + 3.556874280960000000000e+14, 6.402373705728000000000e+15, 1.216451004088320000000e+17, 2.432902008176640000000e+18, 5.109094217170944000000e+19, 1.124000727777607680000e+21, 2.585201673888497664000e+22, 6.204484017332394393600e+23, + 1.551121004333098598400e+25, 4.032914611266056355840e+26, 1.088886945041835216077e+28, 3.048883446117138605015e+29, 8.841761993739701954544e+30, 2.652528598121910586363e+32, 8.222838654177922817726e+33, 2.631308369336935301672e+35, + 8.683317618811886495518e+36, 2.952327990396041408476e+38, 1.033314796638614492967e+40, 3.719933267899012174680e+41, 1.376375309122634504632e+43, 5.230226174666011117600e+44, 2.039788208119744335864e+46, 8.159152832478977343456e+47, + 3.345252661316380710817e+49, 1.405006117752879898543e+51, 6.041526306337383563736e+52, 2.658271574788448768044e+54, 1.196222208654801945620e+56, 5.502622159812088949850e+57, 2.586232415111681806430e+59, 1.241391559253607267086e+61, + 6.082818640342675608723e+62, 3.041409320171337804361e+64, 1.551118753287382280224e+66, 8.065817517094387857166e+67, 4.274883284060025564298e+69, 2.308436973392413804721e+71, 1.269640335365827592597e+73, 7.109985878048634518540e+74, + 4.052691950487721675568e+76, 2.350561331282878571829e+78, 1.386831185456898357379e+80, 8.320987112741390144276e+81, 5.075802138772247988009e+83, 3.146997326038793752565e+85, 1.982608315404440064116e+87, 1.268869321858841641034e+89, + 8.247650592082470666723e+90, 5.443449390774430640037e+92, 3.647111091818868528825e+94, 2.480035542436830599601e+96, 1.711224524281413113725e+98, 1.197857166996989179607e+100, 8.504785885678623175212e+101, 6.123445837688608686152e+103, + 4.470115461512684340891e+105, 3.307885441519386412260e+107, 2.480914081139539809195e+109, 1.885494701666050254988e+111, 1.451830920282858696341e+113, 1.132428117820629783146e+115, 8.946182130782975286851e+116, 7.156945704626380229481e+118, + 5.797126020747367985880e+120, 4.753643337012841748421e+122, 3.945523969720658651190e+124, 3.314240134565353266999e+126, 2.817104114380550276949e+128, 2.422709538367273238177e+130, 2.107757298379527717214e+132, 1.854826422573984391148e+134, + 1.650795516090846108122e+136, 1.485715964481761497310e+138, 1.352001527678402962552e+140, 1.243841405464130725548e+142, 1.156772507081641574759e+144, 1.087366156656743080274e+146, 1.032997848823905926260e+148, 9.916779348709496892096e+149, + 9.619275968248211985333e+151, 9.426890448883247745626e+153, 9.332621544394415268170e+155, 9.332621544394415268170e+157, 9.425947759838359420852e+159, 9.614466715035126609269e+161, 9.902900716486180407547e+163, 1.029901674514562762385e+166, + 1.081396758240290900504e+168, 1.146280563734708354534e+170, 1.226520203196137939352e+172, 1.324641819451828974500e+174, 1.443859583202493582205e+176, 1.588245541522742940425e+178, 1.762952551090244663872e+180, 1.974506857221074023537e+182, + 2.231192748659813646597e+184, 2.543559733472187557120e+186, 2.925093693493015690688e+188, 3.393108684451898201198e+190, 3.969937160808720895402e+192, 4.684525849754290656574e+194, 5.574585761207605881323e+196, 6.689502913449127057588e+198, + 8.094298525273443739682e+200, 9.875044200833601362412e+202, 1.214630436702532967577e+205, 1.506141741511140879795e+207, 1.882677176888926099744e+209, 2.372173242880046885677e+211, 3.012660018457659544810e+213, 3.856204823625804217357e+215, + 4.974504222477287440390e+217, 6.466855489220473672507e+219, 8.471580690878820510985e+221, 1.118248651196004307450e+224, 1.487270706090685728908e+226, 1.992942746161518876737e+228, 2.690472707318050483595e+230, 3.659042881952548657690e+232, + 5.012888748274991661035e+234, 6.917786472619488492228e+236, 9.615723196941089004197e+238, 1.346201247571752460588e+241, 1.898143759076170969429e+243, 2.695364137888162776589e+245, 3.854370717180072770522e+247, 5.550293832739304789551e+249, + 8.047926057471991944849e+251, 1.174997204390910823948e+254, 1.727245890454638911203e+256, 2.556323917872865588581e+258, 3.808922637630569726986e+260, 5.713383956445854590479e+262, 8.627209774233240431623e+264, 1.311335885683452545607e+267, + 2.006343905095682394778e+269, 3.089769613847350887959e+271, 4.789142901463393876336e+273, 7.471062926282894447084e+275, 1.172956879426414428192e+278, 1.853271869493734796544e+280, 2.946702272495038326504e+282, 4.714723635992061322407e+284, + 7.590705053947218729075e+286, 1.229694218739449434110e+289, 2.004401576545302577600e+291, 3.287218585534296227263e+293, 5.423910666131588774984e+295, 9.003691705778437366474e+297, 1.503616514864999040201e+300, 2.526075744973198387538e+302, + 4.269068009004705274939e+304, 7.257415615307998967397e+306})); + _const_math__log_factorials_table = new_array_from_c_array(172, 172, sizeof(f64), _MOV((f64[172]){ + 0.000000000000000000000e+0, 0.000000000000000000000e+0, 6.931471805599453094172e-1, 1.791759469228055000812e+0, 3.178053830347945619647e+0, 4.787491742782045994248e+0, 6.579251212010100995060e+0, 8.525161361065414300166e+0, 1.060460290274525022842e+1, + 1.280182748008146961121e+1, 1.510441257307551529523e+1, 1.750230784587388583929e+1, 1.998721449566188614952e+1, 2.255216385312342288557e+1, 2.519122118273868150009e+1, 2.789927138384089156609e+1, 3.067186010608067280376e+1, + 3.350507345013688888401e+1, 3.639544520803305357622e+1, 3.933988418719949403622e+1, 4.233561646075348502966e+1, 4.538013889847690802616e+1, 4.847118135183522387964e+1, 5.160667556776437357045e+1, 5.478472939811231919009e+1, + 5.800360522298051993929e+1, 6.126170176100200198477e+1, 6.455753862700633105895e+1, 6.788974313718153498289e+1, 7.125703896716800901007e+1, 7.465823634883016438549e+1, 7.809222355331531063142e+1, 8.155795945611503717850e+1, + 8.505446701758151741396e+1, 8.858082754219767880363e+1, 9.213617560368709248333e+1, 9.571969454214320248496e+1, 9.933061245478742692933e+1, 1.029681986145138126988e+2, 1.066317602606434591262e+2, 1.103206397147573954291e+2, + 1.140342117814617032329e+2, 1.177718813997450715388e+2, 1.215330815154386339623e+2, 1.253172711493568951252e+2, 1.291239336391272148826e+2, 1.329525750356163098828e+2, 1.368027226373263684696e+2, 1.406739236482342593987e+2, + 1.445657439463448860089e+2, 1.484777669517730320675e+2, 1.524095925844973578392e+2, 1.563608363030787851941e+2, 1.603311282166309070282e+2, 1.643201122631951814118e+2, 1.683274454484276523305e+2, 1.723527971391628015638e+2, + 1.763958484069973517152e+2, 1.804562914175437710518e+2, 1.845338288614494905025e+2, 1.886281734236715911873e+2, 1.927390472878449024360e+2, 1.968661816728899939914e+2, 2.010093163992815266793e+2, 2.051681994826411985358e+2, + 2.093425867525368356464e+2, 2.135322414945632611913e+2, 2.177369341139542272510e+2, 2.219564418191303339501e+2, 2.261905483237275933323e+2, 2.304390435657769523214e+2, 2.347017234428182677427e+2, 2.389783895618343230538e+2, + 2.432688490029827141829e+2, 2.475729140961868839366e+2, 2.518904022097231943772e+2, 2.562211355500095254561e+2, 2.605649409718632093053e+2, 2.649216497985528010421e+2, 2.692910976510198225363e+2, 2.736731242856937041486e+2, + 2.780675734403661429141e+2, 2.824742926876303960274e+2, 2.868931332954269939509e+2, 2.913239500942703075662e+2, 2.957666013507606240211e+2, 3.002209486470141317540e+2, 3.046868567656687154726e+2, 3.091641935801469219449e+2, + 3.136528299498790617832e+2, 3.181526396202093268500e+2, 3.226634991267261768912e+2, 3.271852877037752172008e+2, 3.317178871969284731381e+2, 3.362611819791984770344e+2, 3.408150588707990178690e+2, 3.453794070622668541074e+2, + 3.499541180407702369296e+2, 3.545390855194408088492e+2, 3.591342053695753987760e+2, 3.637393755555634901441e+2, 3.683544960724047495950e+2, 3.729794688856890206760e+2, 3.776141978739186564468e+2, 3.822585887730600291111e+2, + 3.869125491232175524822e+2, 3.915759882173296196258e+2, 3.962488170517915257991e+2, 4.009309482789157454921e+2, 4.056222961611448891925e+2, 4.103227765269373054205e+2, 4.150323067282496395563e+2, 4.197508055995447340991e+2, + 4.244781934182570746677e+2, 4.292143918666515701285e+2, 4.339593239950148201939e+2, 4.387129141861211848399e+2, 4.434750881209189409588e+2, 4.482457727453846057188e+2, 4.530248962384961351041e+2, 4.578123879812781810984e+2, + 4.626081785268749221865e+2, 4.674121995716081787447e+2, 4.722243839269805962399e+2, 4.770446654925856331047e+2, 4.818729792298879342285e+2, 4.867092611368394122258e+2, 4.915534482232980034989e+2, 4.964054784872176206648e+2, + 5.012652908915792927797e+2, 5.061328253420348751997e+2, 5.110080226652360267439e+2, 5.158908245878223975982e+2, 5.207811737160441513633e+2, 5.256790135159950627324e+2, 5.305842882944334921812e+2, 5.354969431801695441897e+2, + 5.404169241059976691050e+2, 5.453441777911548737966e+2, 5.502786517242855655538e+2, 5.552202941468948698523e+2, 5.601690540372730381305e+2, 5.651248810948742988613e+2, 5.700877257251342061414e+2, 5.750575390247102067619e+2, + 5.800342727671307811636e+2, 5.850178793888391176022e+2, 5.900083119756178539038e+2, 5.950055242493819689670e+2, 6.000094705553274281080e+2, 6.050201058494236838580e+2, 6.100373856862386081868e+2, 6.150612662070848845750e+2, + 6.200917041284773200381e+2, 6.251286567308909491967e+2, 6.301720818478101958172e+2, 6.352219378550597328635e+2, 6.402781836604080409209e+2, 6.453407786934350077245e+2, 6.504096828956552392500e+2, 6.554848567108890661717e+2, + 6.605662610758735291676e+2, 6.656538574111059132426e+2, 6.707476076119126755767e+2, 6.758474740397368739994e+2, 6.809534195136374546094e+2, 6.860654073019939978423e+2, 6.911834011144107529496e+2, 6.963073650938140118743e+2, + 7.014372638087370853465e+2, 7.065730622457873471107e+2, 7.117147258022900069535e+2})); + _const_math__gamma_p = new_array_from_c_array(7, 7, sizeof(f64), _MOV((f64[7]){1.60119522476751861407e-04, 1.19135147006586384913e-03, 1.04213797561761569935e-02, 4.76367800457137231464e-02, 2.07448227648435975150e-01, 4.94214826801497100753e-01, 9.99999999999999996796e-01})); + _const_math__gamma_q = new_array_from_c_array(8, 8, sizeof(f64), _MOV((f64[8]){-2.31581873324120129819e-05, 5.39605580493303397842e-04, -4.45641913851797240494e-03, 1.18139785222060435552e-02, 3.58236398605498653373e-02, -2.34591795718243348568e-01, 7.14304917030273074085e-02, 1.00000000000000000320e+00})); + _const_math__gamma_s = new_array_from_c_array(5, 5, sizeof(f64), _MOV((f64[5]){7.87311395793093628397e-04, -2.29549961613378126380e-04, -2.68132617805781232825e-03, 3.47222221605458667310e-03, 8.33333333333482257126e-02})); + _const_math__lgamma_a = new_array_from_c_array(12, 12, sizeof(f64), _MOV((f64[12]){ + 7.72156649015328655494e-02, 3.22467033424113591611e-01, 6.73523010531292681824e-02, 2.05808084325167332806e-02, 7.38555086081402883957e-03, 2.89051383673415629091e-03, 1.19270763183362067845e-03, 5.10069792153511336608e-04, 2.20862790713908385557e-04, + 1.08011567247583939954e-04, 2.52144565451257326939e-05, 4.48640949618915160150e-05})); + _const_math__lgamma_r = new_array_from_c_array(7, 7, sizeof(f64), _MOV((f64[7]){1.0, 1.39200533467621045958e+00, 7.21935547567138069525e-01, 1.71933865632803078993e-01, 1.86459191715652901344e-02, 7.77942496381893596434e-04, 7.32668430744625636189e-06})); + _const_math__lgamma_s = new_array_from_c_array(7, 7, sizeof(f64), _MOV((f64[7]){-7.72156649015328655494e-02, 2.14982415960608852501e-01, 3.25778796408930981787e-01, 1.46350472652464452805e-01, 2.66422703033638609560e-02, 1.84028451407337715652e-03, 3.19475326584100867617e-05})); + _const_math__lgamma_t = new_array_from_c_array(15, 15, sizeof(f64), _MOV((f64[15]){ + 4.83836122723810047042e-01, -1.47587722994593911752e-01, 6.46249402391333854778e-02, -3.27885410759859649565e-02, 1.79706750811820387126e-02, -1.03142241298341437450e-02, 6.10053870246291332635e-03, -3.68452016781138256760e-03, 2.25964780900612472250e-03, + -1.40346469989232843813e-03, 8.81081882437654011382e-04, -5.38595305356740546715e-04, 3.15632070903625950361e-04, -3.12754168375120860518e-04, 3.35529192635519073543e-04})); + _const_math__lgamma_u = new_array_from_c_array(6, 6, sizeof(f64), _MOV((f64[6]){-7.72156649015328655494e-02, 6.32827064025093366517e-01, 1.45492250137234768737e+00, 9.77717527963372745603e-01, 2.28963728064692451092e-01, 1.33810918536787660377e-02})); + _const_math__lgamma_v = new_array_from_c_array(6, 6, sizeof(f64), _MOV((f64[6]){1.0, 2.45597793713041134822e+00, 2.12848976379893395361e+00, 7.69285150456672783825e-01, 1.04222645593369134254e-01, 3.21709242282423911810e-03})); + _const_math__lgamma_w = new_array_from_c_array(7, 7, sizeof(f64), _MOV((f64[7]){4.18938533204672725052e-01, 8.33333333333329678849e-02, -2.77777777728775536470e-03, 7.93650558643019558500e-04, -5.95187557450339963135e-04, 8.36339918996282139126e-04, -1.63092934096575273989e-03})); + _const_math__pow10tab = new_array_from_c_array(32, 32, sizeof(f64), _MOV((f64[32]){ + ((f64)(1e+00)), 1e+01, 1e+02, 1e+03, 1e+04, 1e+05, 1e+06, 1e+07, 1e+08, + 1e+09, 1e+10, 1e+11, 1e+12, 1e+13, 1e+14, 1e+15, 1e+16, + 1e+17, 1e+18, 1e+19, 1e+20, 1e+21, 1e+22, 1e+23, 1e+24, + 1e+25, 1e+26, 1e+27, 1e+28, 1e+29, 1e+30, 1e+31})); + _const_math__pow10postab32 = new_array_from_c_array(10, 10, sizeof(f64), _MOV((f64[10]){ + ((f64)(1e+00)), 1e+32, 1e+64, 1e+96, 1e+128, 1e+160, 1e+192, 1e+224, 1e+256, + 1e+288})); + _const_math__pow10negtab32 = new_array_from_c_array(11, 11, sizeof(f64), _MOV((f64[11]){ + ((f64)(1e-00)), 1e-32, 1e-64, 1e-96, 1e-128, 1e-160, 1e-192, 1e-224, 1e-256, + 1e-288, 1e-320})); + _const_math__sin_data = new_array_from_c_array(12, 12, sizeof(f64), _MOV((f64[12]){ + -0.3295190160663511504173, 0.0025374284671667991990, 0.0006261928782647355874, -4.6495547521854042157541e-06, -5.6917531549379706526677e-07, 3.7283335140973803627866e-09, 3.0267376484747473727186e-10, -1.7400875016436622322022e-12, -1.0554678305790849834462e-13, + 5.3701981409132410797062e-16, 2.5984137983099020336115e-17, -1.1821555255364833468288e-19})); + _const_math__sin_cs = ((math__ChebSeries){.c = _const_math__sin_data,.order = 11,.a = -1,.b = 1,}); + _const_math__cos_data = new_array_from_c_array(11, 11, sizeof(f64), _MOV((f64[11]){ + 0.165391825637921473505668118136, -0.00084852883845000173671196530195, -0.000210086507222940730213625768083, 1.16582269619760204299639757584e-6, 1.43319375856259870334412701165e-7, -7.4770883429007141617951330184e-10, -6.0969994944584252706997438007e-11, 2.90748249201909353949854872638e-13, 1.77126739876261435667156490461e-14, + -7.6896421502815579078577263149e-17, -3.7363121133079412079201377318e-18})); + _const_math__cos_cs = ((math__ChebSeries){.c = _const_math__cos_data,.order = 10,.a = -1,.b = 1,}); + _const_math__tan_p = new_array_from_c_array(3, 3, sizeof(f64), _MOV((f64[3]){-1.30936939181383777646e+4, 1.15351664838587416140e+6, -1.79565251976484877988e+7})); + _const_math__tan_q = new_array_from_c_array(5, 5, sizeof(f64), _MOV((f64[5]){1.00000000000000000000e+0, 1.36812963470692954678e+4, -1.32089234440210967447e+6, 2.50083801823357915839e+7, -5.38695755929454629881e+7})); + _const_math__tanh_p = new_array_from_c_array(3, 3, sizeof(f64), _MOV((f64[3]){-9.64399179425052238628e-1, -9.92877231001918586564e+1, -1.61468768441708447952e+3})); + _const_math__tanh_q = new_array_from_c_array(3, 3, sizeof(f64), _MOV((f64[3]){1.12811678491632931402e+2, 2.23548839060100448583e+3, 4.84406305325125486048e+3})); } - { // Initializations for module rand.seed : + { // Initializations for module v.vet : } { // Initializations for module term : } @@ -93083,7 +95871,33 @@ void _vinit(int ___argc, voidptr ___argv) { } { // Initializations for module v.vcache : } - { // Initializations for module v.util.diff : + { // Initializations for module time : + _const_time__tokens_2 = new_array_from_c_array(16, 16, sizeof(string), _MOV((string[16]){ + _SLIT("MM"), _SLIT("DD"), _SLIT("Do"), _SLIT("YY"), _SLIT("ss"), _SLIT("kk"), _SLIT("NN"), _SLIT("mm"), _SLIT("hh"), + _SLIT("HH"), _SLIT("ZZ"), _SLIT("dd"), _SLIT("Qo"), _SLIT("QQ"), _SLIT("wo"), _SLIT("ww")})); + _const_time__tokens_3 = new_array_from_c_array(4, 4, sizeof(string), _MOV((string[4]){_SLIT("MMM"), _SLIT("DDD"), _SLIT("ZZZ"), _SLIT("ddd")})); + _const_time__tokens_4 = new_array_from_c_array(5, 5, sizeof(string), _MOV((string[5]){_SLIT("MMMM"), _SLIT("DDDD"), _SLIT("DDDo"), _SLIT("dddd"), _SLIT("YYYY")})); + _const_time__long_days = new_array_from_c_array(7, 7, sizeof(string), _MOV((string[7]){_SLIT("Monday"), _SLIT("Tuesday"), _SLIT("Wednesday"), _SLIT("Thursday"), _SLIT("Friday"), _SLIT("Saturday"), _SLIT("Sunday")})); + _const_time__month_days = new_array_from_c_array(12, 12, sizeof(int), _MOV((int[12]){ + 31, 28, 31, 30, 31, 30, 31, 31, 30, + 31, 30, 31})); + _const_time__long_months = new_array_from_c_array(12, 12, sizeof(string), _MOV((string[12]){ + _SLIT("January"), _SLIT("February"), _SLIT("March"), _SLIT("April"), _SLIT("May"), _SLIT("June"), _SLIT("July"), _SLIT("August"), _SLIT("September"), + _SLIT("October"), _SLIT("November"), _SLIT("December")})); + _const_time__absolute_zero_year = ((i64)(-292277022399)); + _const_time__days_before = new_array_from_c_array(13, 13, sizeof(int), _MOV((int[13]){ + 0, 31, 59, 90, 120, 151, 181, 212, 243, + 273, 304, 334, 365})); + _const_time__nanosecond = ((time__Duration)(1)); + _const_time__microsecond = ((1000 * _const_time__nanosecond)); + _const_time__millisecond = ((1000 * _const_time__microsecond)); + _const_time__second = ((1000 * _const_time__millisecond)); + _const_time__minute = ((60 * _const_time__second)); + _const_time__hour = ((60 * _const_time__minute)); + _const_time__infinite = ((((i64)(9223372036854775807)))); + _const_time__start_time = time__init_win_time_start(); + _const_time__freq_time = time__init_win_time_freq(); + _const_time__start_local_time = time__local_as_unix_time(); } { // Initializations for module v.vmod : _const_v__vmod__mod_file_stop_paths = new_array_from_c_array(4, 4, sizeof(string), _MOV((string[4]){_SLIT(".git"), _SLIT(".hg"), _SLIT(".svn"), _SLIT(".v.mod.stop")})); @@ -93093,10 +95907,6 @@ void _vinit(int ___argc, voidptr ___argv) { } { // Initializations for module v.cflag : } - { // Initializations for module rand.config : - } - { // Initializations for module rand.wyrand : - } { // Initializations for module v.pkgconfig : _const_v__pkgconfig__default_paths = new_array_from_c_array(11, 11, sizeof(string), _MOV((string[11]){ _SLIT("/usr/local/lib/x86_64-linux-gnu/pkgconfig"), _SLIT("/usr/local/lib64/pkgconfig"), _SLIT("/usr/local/lib/pkgconfig"), _SLIT("/usr/local/share/pkgconfig"), _SLIT("/usr/lib/x86_64-linux-gnu/pkgconfig"), _SLIT("/usr/lib/aarch64-linux-gnu/pkgconfig"), _SLIT("/usr/lib64/pkgconfig"), _SLIT("/usr/lib/pkgconfig"), _SLIT("/usr/share/pkgconfig"), @@ -93104,6 +95914,14 @@ void _vinit(int ___argc, voidptr ___argv) { } { // Initializations for module runtime : } + { // Initializations for module v.util.diff : + } + { // Initializations for module rand.seed : + } + { // Initializations for module rand.config : + } + { // Initializations for module rand.wyrand : + } { // Initializations for module rand : _const_rand__clock_seq_hi_and_reserved_valid_values = new_array_from_c_array(4, 4, sizeof(rune), _MOV((rune[4]){'8', '9', 'a', 'b'})); default_rng = *(rand__PRNG**)&((rand__PRNG*[]){0}[0]); // global @@ -93257,8 +96075,8 @@ void _vinit(int ___argc, voidptr ___argv) { _const_v__gen__c__cmp_str = new_array_from_c_array(6, 6, sizeof(string), _MOV((string[6]){_SLIT("eq"), _SLIT("ne"), _SLIT("gt"), _SLIT("lt"), _SLIT("ge"), _SLIT("le")})); _const_v__gen__c__cmp_rev = new_array_from_c_array(6, 6, sizeof(string), _MOV((string[6]){_SLIT("eq"), _SLIT("ne"), _SLIT("lt"), _SLIT("gt"), _SLIT("le"), _SLIT("ge")})); _const_v__gen__c__builtins = new_array_from_c_array(7, 7, sizeof(string), _MOV((string[7]){_SLIT("string"), _SLIT("array"), _SLIT("DenseArray"), _SLIT("map"), _SLIT("Error"), _SLIT("IError"), _SLIT("Option")})); - _const_v__gen__c__c_headers = _SLIT("//============================== HELPER C MACROS =============================*/\n// _SLIT0 is used as NULL string for literal arguments\n// `\"\" s` is used to enforce a string literal argument\n#define _SLIT0 (string){.str=(byteptr)(\"\"), .len=0, .is_lit=1}\n#define _SLIT(s) ((string){.str=(byteptr)(\"\" s), .len=(sizeof(s)-1), .is_lit=1})\n#define _SLEN(s, n) ((string){.str=(byteptr)(\"\" s), .len=n, .is_lit=1})\n\n// take the address of an rvalue\n#define ADDR(type, expr) (&((type[]){expr}[0]))\n\n// copy something to the heap\n#define HEAP(type, expr) ((type*)memdup((void*)&((type[]){expr}[0]), sizeof(type)))\n#define HEAP_noscan(type, expr) ((type*)memdup_noscan((void*)&((type[]){expr}[0]), sizeof(type)))\n\n#define _PUSH_MANY(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many(arr, tmp.data, tmp.len);}\n#define _PUSH_MANY_noscan(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many_noscan(arr, tmp.data, tmp.len);}\n\n// unsigned/signed comparisons\nstatic inline bool _us32_gt(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a > b; }\nstatic inline bool _us32_ge(uint32_t a, int32_t b) { return a >= INT32_MAX || (int32_t)a >= b; }\nstatic inline bool _us32_eq(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a == b; }\nstatic inline bool _us32_ne(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a != b; }\nstatic inline bool _us32_le(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a <= b; }\nstatic inline bool _us32_lt(uint32_t a, int32_t b) { return a < INT32_MAX && (int32_t)a < b; }\nstatic inline bool _us64_gt(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a > b; }\nstatic inline bool _us64_ge(uint64_t a, int64_t b) { return a >= INT64_MAX || (int64_t)a >= b; }\nstatic inline bool _us64_eq(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a == b; }\nstatic inline bool _us64_ne(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a != b; }\nstatic inline bool _us64_le(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a <= b; }\nstatic inline bool _us64_lt(uint64_t a, int64_t b) { return a < INT64_MAX && (int64_t)a < b; }\n\n#define EMPTY_VARG_INITIALIZATION 0\n#define EMPTY_STRUCT_INITIALIZATION 0\n#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n// Due to a tcc bug, the length of an array needs to be specified, but GCC crashes if it is...\n#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[])\n#define TCCSKIP(x) x\n\n#define __NOINLINE __attribute__((noinline))\n#define __IRQHANDLER __attribute__((interrupt))\n\n#define __V_architecture 0\n#if defined(__x86_64__)\n #define __V_amd64 1\n #undef __V_architecture\n #define __V_architecture 1\n#endif\n\n#if defined(__aarch64__) || defined(__arm64__)\n #define __V_arm64 1\n #undef __V_architecture\n #define __V_architecture 2\n#endif\n\n// Using just __GNUC__ for detecting gcc, is not reliable because other compilers define it too:\n#ifdef __GNUC__\n #define __V_GCC__\n#endif\n#ifdef __TINYC__\n #undef __V_GCC__\n#endif\n#ifdef __cplusplus\n #undef __V_GCC__\n#endif\n#ifdef __clang__\n #undef __V_GCC__\n#endif\n#ifdef _MSC_VER\n #undef __V_GCC__\n #undef EMPTY_STRUCT_INITIALIZATION\n #define EMPTY_STRUCT_INITIALIZATION 0\n#endif\n\n#ifdef __TINYC__\n #undef EMPTY_STRUCT_DECLARATION\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #undef EMPTY_ARRAY_OF_ELEMS\n #define EMPTY_ARRAY_OF_ELEMS(x,n) (x[n])\n #undef __NOINLINE\n #undef __IRQHANDLER\n // tcc does not support inlining at all\n #define __NOINLINE\n #define __IRQHANDLER\n #undef TCCSKIP\n #define TCCSKIP(x)\n // #include \n #ifndef _WIN32\n #include \n int tcc_backtrace(const char *fmt, ...);\n #endif\n#endif\n\n// Use __offsetof_ptr instead of __offset_of, when you *do* have a valid pointer, to avoid UB:\n#ifndef __offsetof_ptr\n #define __offsetof_ptr(ptr,PTYPE,FIELDNAME) ((size_t)((byte *)&((PTYPE *)ptr)->FIELDNAME - (byte *)ptr))\n#endif\n\n// for __offset_of\n#ifndef __offsetof\n #define __offsetof(PTYPE,FIELDNAME) ((size_t)((char *)&((PTYPE *)0)->FIELDNAME - (char *)0))\n#endif\n\n// returns the number of CPU registers that TYPE takes up\n#define _REG_WIDTH(T) (((sizeof(T) + sizeof(void*) - 1) & ~(sizeof(void*) - 1)) / sizeof(void*))\n// parameters of size <= 2 registers are spilled across those two registers; larger types are passed as one pointer to some stack location\n#define _REG_WIDTH_BOUNDED(T) (_REG_WIDTH(T) <= 2 ? _REG_WIDTH(T) : 1)\n\n#define OPTION_CAST(x) (x)\n\n#ifndef V64_PRINTFORMAT\n #ifdef PRIx64\n #define V64_PRINTFORMAT \"0x%\"PRIx64\n #elif defined(__WIN32__)\n #define V64_PRINTFORMAT \"0x%I64x\"\n #elif defined(__linux__) && defined(__LP64__)\n #define V64_PRINTFORMAT \"0x%lx\"\n #else\n #define V64_PRINTFORMAT \"0x%llx\"\n #endif\n#endif\n\n#if defined(_WIN32) || defined(__CYGWIN__)\n #define VV_EXPORTED_SYMBOL extern __declspec(dllexport)\n #define VV_LOCAL_SYMBOL static\n#else\n // 4 < gcc < 5 is used by some older Ubuntu LTS and Centos versions,\n // and does not support __has_attribute(visibility) ...\n #ifndef __has_attribute\n #define __has_attribute(x) 0 // Compatibility with non-clang compilers.\n #endif\n #if (defined(__GNUC__) && (__GNUC__ >= 4)) || (defined(__clang__) && __has_attribute(visibility))\n #ifdef ARM\n #define VV_EXPORTED_SYMBOL extern __attribute__((externally_visible,visibility(\"default\")))\n #else\n #define VV_EXPORTED_SYMBOL extern __attribute__((visibility(\"default\")))\n #endif\n #if defined(__clang__) && (defined(_VUSECACHE) || defined(_VBUILDMODULE))\n #define VV_LOCAL_SYMBOL static\n #else\n #define VV_LOCAL_SYMBOL __attribute__ ((visibility (\"hidden\")))\n #endif\n #else\n #define VV_EXPORTED_SYMBOL extern\n #define VV_LOCAL_SYMBOL static\n #endif\n#endif\n\n#ifdef __cplusplus\n #include \n #define _MOV std::move\n#else\n #define _MOV\n#endif\n\n// tcc does not support has_include properly yet, turn it off completely\n#if defined(__TINYC__) && defined(__has_include)\n#undef __has_include\n#endif\n\n\n#if !defined(VWEAK)\n #define VWEAK __attribute__((weak))\n #ifdef _MSC_VER\n #undef VWEAK\n #define VWEAK\n #endif\n#endif\n\n#if !defined(VNORETURN)\n #if defined(__TINYC__)\n #include \n #define VNORETURN noreturn\n #endif\n # if !defined(__TINYC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L\n # define VNORETURN _Noreturn\n # elif defined(__GNUC__) && __GNUC__ >= 2\n # define VNORETURN __attribute__((noreturn))\n # endif\n #ifndef VNORETURN\n #define VNORETURN\n #endif\n#endif\n\n#if !defined(VUNREACHABLE)\n #if defined(__GNUC__) && !defined(__clang__)\n #define V_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__)\n #if (V_GCC_VERSION >= 40500L)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #if defined(__clang__) && defined(__has_builtin)\n #if __has_builtin(__builtin_unreachable)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #ifndef VUNREACHABLE\n #define VUNREACHABLE() do { } while (0)\n #endif\n #if defined(__FreeBSD__) && defined(__TINYC__)\n #define VUNREACHABLE() do { } while (0)\n #endif\n#endif\n\n//likely and unlikely macros\n#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n #define _likely_(x) __builtin_expect(x,1)\n #define _unlikely_(x) __builtin_expect(x,0)\n#else\n #define _likely_(x) (x)\n #define _unlikely_(x) (x)\n#endif\n\n\n// c_headers\ntypedef int (*qsort_callback_func)(const void*, const void*);\n#include // TODO remove all these includes, define all function signatures and types manually\n#include \n#include \n\n#ifndef _WIN32\n #if defined __has_include\n #if __has_include ()\n #include \n #else\n // Most probably musl OR __ANDROID__ ...\n int backtrace (void **__array, int __size) { return 0; }\n char **backtrace_symbols (void *const *__array, int __size){ return 0; }\n void backtrace_symbols_fd (void *const *__array, int __size, int __fd){}\n #endif\n #endif\n#endif\n\n#include // for va_list\n\n//================================== GLOBALS =================================*/\nint load_so(byteptr);\nvoid _vinit(int ___argc, voidptr ___argv);\nvoid _vcleanup(void);\n#define sigaction_size sizeof(sigaction);\n#define _ARR_LEN(a) ( (sizeof(a)) / (sizeof(a[0])) )\n\nvoid v_free(voidptr ptr);\nvoidptr memdup(voidptr src, int sz);\n\n#if INTPTR_MAX == INT32_MAX\n #define TARGET_IS_32BIT 1\n#elif INTPTR_MAX == INT64_MAX\n #define TARGET_IS_64BIT 1\n#else\n #error \"The environment is not 32 or 64-bit.\"\n#endif\n\n#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ || defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN || defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__)\n #define TARGET_ORDER_IS_BIG 1\n#elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ || defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN || defined(__LITTLE_ENDIAN__) || defined(__ARMEL__) || defined(__THUMBEL__) || defined(__AARCH64EL__) || defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) || defined(_M_AMD64) || defined(_M_X64) || defined(_M_IX86)\n #define TARGET_ORDER_IS_LITTLE 1\n#else\n #error \"Unknown architecture endianness\"\n#endif\n\n#ifndef _WIN32\n #include \n #include // tolower\n #include \n #include // sleep\n extern char **environ;\n#endif\n\n#if defined(__CYGWIN__) && !defined(_WIN32)\n #error Cygwin is not supported, please use MinGW or Visual Studio.\n#endif\n\n#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__vinix__) || defined(__serenity__) || defined(__sun)\n #include \n #include // os__wait uses wait on nix\n#endif\n\n#ifdef __OpenBSD__\n #include \n #include \n #include // os__wait uses wait on nix\n#endif\n\n#ifdef __NetBSD__\n #include // os__wait uses wait on nix\n#endif\n\n#ifdef _WIN32\n #define WINVER 0x0600\n #ifdef _WIN32_WINNT\n #undef _WIN32_WINNT\n #endif\n #define _WIN32_WINNT 0x0600\n #ifndef WIN32_FULL\n #define WIN32_LEAN_AND_MEAN\n #endif\n #ifndef _UNICODE\n #define _UNICODE\n #endif\n #ifndef UNICODE\n #define UNICODE\n #endif\n #include \n\n #include // _waccess\n #include // _wgetcwd\n #include // signal and SIGSEGV for segmentation fault handler\n\n #ifdef _MSC_VER\n // On MSVC these are the same (as long as /volatile:ms is passed)\n #define _Atomic volatile\n\n // MSVC cannot parse some things properly\n #undef EMPTY_STRUCT_DECLARATION\n #undef OPTION_CAST\n\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #define OPTION_CAST(x)\n #undef __NOINLINE\n #undef __IRQHANDLER\n #define __NOINLINE __declspec(noinline)\n #define __IRQHANDLER __declspec(naked)\n\n #include \n #pragma comment(lib, \"Dbghelp\")\n #endif\n#else\n #include \n #ifndef PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP\n // musl does not have that\n #define pthread_rwlockattr_setkind_np(a, b)\n #endif\n#endif\n\n// g_live_info is used by live.info()\nstatic void* g_live_info = NULL;\n\n#if defined(__MINGW32__) || defined(__MINGW64__) || (defined(_WIN32) && defined(__TINYC__))\n #undef PRId64\n #undef PRIi64\n #undef PRIo64\n #undef PRIu64\n #undef PRIx64\n #undef PRIX64\n #define PRId64 \"lld\"\n #define PRIi64 \"lli\"\n #define PRIo64 \"llo\"\n #define PRIu64 \"llu\"\n #define PRIx64 \"llx\"\n #define PRIX64 \"llX\"\n#endif\n\n#ifdef _VFREESTANDING\n#undef _VFREESTANDING\n#endif\n"); - _const_v__gen__c__c_bare_headers = _SLIT("//============================== HELPER C MACROS =============================*/\n// _SLIT0 is used as NULL string for literal arguments\n// `\"\" s` is used to enforce a string literal argument\n#define _SLIT0 (string){.str=(byteptr)(\"\"), .len=0, .is_lit=1}\n#define _SLIT(s) ((string){.str=(byteptr)(\"\" s), .len=(sizeof(s)-1), .is_lit=1})\n#define _SLEN(s, n) ((string){.str=(byteptr)(\"\" s), .len=n, .is_lit=1})\n\n// take the address of an rvalue\n#define ADDR(type, expr) (&((type[]){expr}[0]))\n\n// copy something to the heap\n#define HEAP(type, expr) ((type*)memdup((void*)&((type[]){expr}[0]), sizeof(type)))\n#define HEAP_noscan(type, expr) ((type*)memdup_noscan((void*)&((type[]){expr}[0]), sizeof(type)))\n\n#define _PUSH_MANY(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many(arr, tmp.data, tmp.len);}\n#define _PUSH_MANY_noscan(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many_noscan(arr, tmp.data, tmp.len);}\n\n// unsigned/signed comparisons\nstatic inline bool _us32_gt(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a > b; }\nstatic inline bool _us32_ge(uint32_t a, int32_t b) { return a >= INT32_MAX || (int32_t)a >= b; }\nstatic inline bool _us32_eq(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a == b; }\nstatic inline bool _us32_ne(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a != b; }\nstatic inline bool _us32_le(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a <= b; }\nstatic inline bool _us32_lt(uint32_t a, int32_t b) { return a < INT32_MAX && (int32_t)a < b; }\nstatic inline bool _us64_gt(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a > b; }\nstatic inline bool _us64_ge(uint64_t a, int64_t b) { return a >= INT64_MAX || (int64_t)a >= b; }\nstatic inline bool _us64_eq(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a == b; }\nstatic inline bool _us64_ne(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a != b; }\nstatic inline bool _us64_le(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a <= b; }\nstatic inline bool _us64_lt(uint64_t a, int64_t b) { return a < INT64_MAX && (int64_t)a < b; }\n\n#define EMPTY_VARG_INITIALIZATION 0\n#define EMPTY_STRUCT_INITIALIZATION 0\n#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n// Due to a tcc bug, the length of an array needs to be specified, but GCC crashes if it is...\n#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[])\n#define TCCSKIP(x) x\n\n#define __NOINLINE __attribute__((noinline))\n#define __IRQHANDLER __attribute__((interrupt))\n\n#define __V_architecture 0\n#if defined(__x86_64__)\n #define __V_amd64 1\n #undef __V_architecture\n #define __V_architecture 1\n#endif\n\n#if defined(__aarch64__) || defined(__arm64__)\n #define __V_arm64 1\n #undef __V_architecture\n #define __V_architecture 2\n#endif\n\n// Using just __GNUC__ for detecting gcc, is not reliable because other compilers define it too:\n#ifdef __GNUC__\n #define __V_GCC__\n#endif\n#ifdef __TINYC__\n #undef __V_GCC__\n#endif\n#ifdef __cplusplus\n #undef __V_GCC__\n#endif\n#ifdef __clang__\n #undef __V_GCC__\n#endif\n#ifdef _MSC_VER\n #undef __V_GCC__\n #undef EMPTY_STRUCT_INITIALIZATION\n #define EMPTY_STRUCT_INITIALIZATION 0\n#endif\n\n#ifdef __TINYC__\n #undef EMPTY_STRUCT_DECLARATION\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #undef EMPTY_ARRAY_OF_ELEMS\n #define EMPTY_ARRAY_OF_ELEMS(x,n) (x[n])\n #undef __NOINLINE\n #undef __IRQHANDLER\n // tcc does not support inlining at all\n #define __NOINLINE\n #define __IRQHANDLER\n #undef TCCSKIP\n #define TCCSKIP(x)\n // #include \n #ifndef _WIN32\n #include \n int tcc_backtrace(const char *fmt, ...);\n #endif\n#endif\n\n// Use __offsetof_ptr instead of __offset_of, when you *do* have a valid pointer, to avoid UB:\n#ifndef __offsetof_ptr\n #define __offsetof_ptr(ptr,PTYPE,FIELDNAME) ((size_t)((byte *)&((PTYPE *)ptr)->FIELDNAME - (byte *)ptr))\n#endif\n\n// for __offset_of\n#ifndef __offsetof\n #define __offsetof(PTYPE,FIELDNAME) ((size_t)((char *)&((PTYPE *)0)->FIELDNAME - (char *)0))\n#endif\n\n// returns the number of CPU registers that TYPE takes up\n#define _REG_WIDTH(T) (((sizeof(T) + sizeof(void*) - 1) & ~(sizeof(void*) - 1)) / sizeof(void*))\n// parameters of size <= 2 registers are spilled across those two registers; larger types are passed as one pointer to some stack location\n#define _REG_WIDTH_BOUNDED(T) (_REG_WIDTH(T) <= 2 ? _REG_WIDTH(T) : 1)\n\n#define OPTION_CAST(x) (x)\n\n#ifndef V64_PRINTFORMAT\n #ifdef PRIx64\n #define V64_PRINTFORMAT \"0x%\"PRIx64\n #elif defined(__WIN32__)\n #define V64_PRINTFORMAT \"0x%I64x\"\n #elif defined(__linux__) && defined(__LP64__)\n #define V64_PRINTFORMAT \"0x%lx\"\n #else\n #define V64_PRINTFORMAT \"0x%llx\"\n #endif\n#endif\n\n#if defined(_WIN32) || defined(__CYGWIN__)\n #define VV_EXPORTED_SYMBOL extern __declspec(dllexport)\n #define VV_LOCAL_SYMBOL static\n#else\n // 4 < gcc < 5 is used by some older Ubuntu LTS and Centos versions,\n // and does not support __has_attribute(visibility) ...\n #ifndef __has_attribute\n #define __has_attribute(x) 0 // Compatibility with non-clang compilers.\n #endif\n #if (defined(__GNUC__) && (__GNUC__ >= 4)) || (defined(__clang__) && __has_attribute(visibility))\n #ifdef ARM\n #define VV_EXPORTED_SYMBOL extern __attribute__((externally_visible,visibility(\"default\")))\n #else\n #define VV_EXPORTED_SYMBOL extern __attribute__((visibility(\"default\")))\n #endif\n #if defined(__clang__) && (defined(_VUSECACHE) || defined(_VBUILDMODULE))\n #define VV_LOCAL_SYMBOL static\n #else\n #define VV_LOCAL_SYMBOL __attribute__ ((visibility (\"hidden\")))\n #endif\n #else\n #define VV_EXPORTED_SYMBOL extern\n #define VV_LOCAL_SYMBOL static\n #endif\n#endif\n\n#ifdef __cplusplus\n #include \n #define _MOV std::move\n#else\n #define _MOV\n#endif\n\n// tcc does not support has_include properly yet, turn it off completely\n#if defined(__TINYC__) && defined(__has_include)\n#undef __has_include\n#endif\n\n\n#if !defined(VWEAK)\n #define VWEAK __attribute__((weak))\n #ifdef _MSC_VER\n #undef VWEAK\n #define VWEAK\n #endif\n#endif\n\n#if !defined(VNORETURN)\n #if defined(__TINYC__)\n #include \n #define VNORETURN noreturn\n #endif\n # if !defined(__TINYC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L\n # define VNORETURN _Noreturn\n # elif defined(__GNUC__) && __GNUC__ >= 2\n # define VNORETURN __attribute__((noreturn))\n # endif\n #ifndef VNORETURN\n #define VNORETURN\n #endif\n#endif\n\n#if !defined(VUNREACHABLE)\n #if defined(__GNUC__) && !defined(__clang__)\n #define V_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__)\n #if (V_GCC_VERSION >= 40500L)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #if defined(__clang__) && defined(__has_builtin)\n #if __has_builtin(__builtin_unreachable)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #ifndef VUNREACHABLE\n #define VUNREACHABLE() do { } while (0)\n #endif\n #if defined(__FreeBSD__) && defined(__TINYC__)\n #define VUNREACHABLE() do { } while (0)\n #endif\n#endif\n\n//likely and unlikely macros\n#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n #define _likely_(x) __builtin_expect(x,1)\n #define _unlikely_(x) __builtin_expect(x,0)\n#else\n #define _likely_(x) (x)\n #define _unlikely_(x) (x)\n#endif\n\n\n#define _VFREESTANDING\n\ntypedef long unsigned int size_t;\n\n// Memory allocation related headers\nvoid *malloc(size_t size);\nvoid *calloc(size_t nitems, size_t size);\nvoid *realloc(void *ptr, size_t size);\nvoid *memcpy(void *dest, void *src, size_t n);\nvoid *memset(void *s, int c, size_t n);\nvoid *memmove(void *dest, void *src, size_t n);\n\n// varargs implementation, TODO: works on tcc and gcc, but is very unportable and hacky\ntypedef __builtin_va_list va_list;\n#define va_start(a, b) __builtin_va_start(a, b)\n#define va_end(a) __builtin_va_end(a)\n#define va_arg(a, b) __builtin_va_arg(a, b)\n#define va_copy(a, b) __builtin_va_copy(a, b)\n\n//================================== GLOBALS =================================*/\nint load_so(byteptr);\nvoid _vinit(int ___argc, voidptr ___argv);\nvoid _vcleanup();\n#define sigaction_size sizeof(sigaction);\n#define _ARR_LEN(a) ( (sizeof(a)) / (sizeof(a[0])) )\n\nvoid v_free(voidptr ptr);\nvoidptr memdup(voidptr src, int sz);\n\n"); + _const_v__gen__c__c_headers = _SLIT("//============================== HELPER C MACROS =============================*/\n// _SLIT0 is used as NULL string for literal arguments\n// `\"\" s` is used to enforce a string literal argument\n#define _SLIT0 (string){.str=(byteptr)(\"\"), .len=0, .is_lit=1}\n#define _SLIT(s) ((string){.str=(byteptr)(\"\" s), .len=(sizeof(s)-1), .is_lit=1})\n#define _SLEN(s, n) ((string){.str=(byteptr)(\"\" s), .len=n, .is_lit=1})\n\n// take the address of an rvalue\n#define ADDR(type, expr) (&((type[]){expr}[0]))\n\n// copy something to the heap\n#define HEAP(type, expr) ((type*)memdup((void*)&((type[]){expr}[0]), sizeof(type)))\n#define HEAP_noscan(type, expr) ((type*)memdup_noscan((void*)&((type[]){expr}[0]), sizeof(type)))\n\n#define _PUSH_MANY(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many(arr, tmp.data, tmp.len);}\n#define _PUSH_MANY_noscan(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many_noscan(arr, tmp.data, tmp.len);}\n\n// unsigned/signed comparisons\nstatic inline bool _us32_gt(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a > b; }\nstatic inline bool _us32_ge(uint32_t a, int32_t b) { return a >= INT32_MAX || (int32_t)a >= b; }\nstatic inline bool _us32_eq(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a == b; }\nstatic inline bool _us32_ne(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a != b; }\nstatic inline bool _us32_le(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a <= b; }\nstatic inline bool _us32_lt(uint32_t a, int32_t b) { return a < INT32_MAX && (int32_t)a < b; }\nstatic inline bool _us64_gt(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a > b; }\nstatic inline bool _us64_ge(uint64_t a, int64_t b) { return a >= INT64_MAX || (int64_t)a >= b; }\nstatic inline bool _us64_eq(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a == b; }\nstatic inline bool _us64_ne(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a != b; }\nstatic inline bool _us64_le(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a <= b; }\nstatic inline bool _us64_lt(uint64_t a, int64_t b) { return a < INT64_MAX && (int64_t)a < b; }\n\n#define EMPTY_VARG_INITIALIZATION 0\n#define EMPTY_STRUCT_INITIALIZATION 0\n#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n// Due to a tcc bug, the length of an array needs to be specified, but GCC crashes if it is...\n#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[])\n#define TCCSKIP(x) x\n\n#define __NOINLINE __attribute__((noinline))\n#define __IRQHANDLER __attribute__((interrupt))\n\n#define __V_architecture 0\n#if defined(__x86_64__)\n #define __V_amd64 1\n #undef __V_architecture\n #define __V_architecture 1\n#endif\n\n#if defined(__aarch64__) || defined(__arm64__)\n #define __V_arm64 1\n #undef __V_architecture\n #define __V_architecture 2\n#endif\n\n// Using just __GNUC__ for detecting gcc, is not reliable because other compilers define it too:\n#ifdef __GNUC__\n #define __V_GCC__\n#endif\n#ifdef __TINYC__\n #undef __V_GCC__\n#endif\n#ifdef __cplusplus\n #undef __V_GCC__\n#endif\n#ifdef __clang__\n #undef __V_GCC__\n#endif\n#ifdef _MSC_VER\n #undef __V_GCC__\n #undef EMPTY_STRUCT_INITIALIZATION\n #define EMPTY_STRUCT_INITIALIZATION 0\n#endif\n\n#ifdef __TINYC__\n #define _Atomic volatile\n #undef EMPTY_STRUCT_DECLARATION\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #undef EMPTY_ARRAY_OF_ELEMS\n #define EMPTY_ARRAY_OF_ELEMS(x,n) (x[n])\n #undef __NOINLINE\n #undef __IRQHANDLER\n // tcc does not support inlining at all\n #define __NOINLINE\n #define __IRQHANDLER\n #undef TCCSKIP\n #define TCCSKIP(x)\n // #include \n #ifndef _WIN32\n #include \n int tcc_backtrace(const char *fmt, ...);\n #endif\n#endif\n\n// Use __offsetof_ptr instead of __offset_of, when you *do* have a valid pointer, to avoid UB:\n#ifndef __offsetof_ptr\n #define __offsetof_ptr(ptr,PTYPE,FIELDNAME) ((size_t)((byte *)&((PTYPE *)ptr)->FIELDNAME - (byte *)ptr))\n#endif\n\n// for __offset_of\n#ifndef __offsetof\n #define __offsetof(PTYPE,FIELDNAME) ((size_t)((char *)&((PTYPE *)0)->FIELDNAME - (char *)0))\n#endif\n\n// returns the number of CPU registers that TYPE takes up\n#define _REG_WIDTH(T) (((sizeof(T) + sizeof(void*) - 1) & ~(sizeof(void*) - 1)) / sizeof(void*))\n// parameters of size <= 2 registers are spilled across those two registers; larger types are passed as one pointer to some stack location\n#define _REG_WIDTH_BOUNDED(T) (_REG_WIDTH(T) <= 2 ? _REG_WIDTH(T) : 1)\n\n#define OPTION_CAST(x) (x)\n\n#ifndef V64_PRINTFORMAT\n #ifdef PRIx64\n #define V64_PRINTFORMAT \"0x%\"PRIx64\n #elif defined(__WIN32__)\n #define V64_PRINTFORMAT \"0x%I64x\"\n #elif defined(__linux__) && defined(__LP64__)\n #define V64_PRINTFORMAT \"0x%lx\"\n #else\n #define V64_PRINTFORMAT \"0x%llx\"\n #endif\n#endif\n\n#if defined(_WIN32) || defined(__CYGWIN__)\n #define VV_EXPORTED_SYMBOL extern __declspec(dllexport)\n #define VV_LOCAL_SYMBOL static\n#else\n // 4 < gcc < 5 is used by some older Ubuntu LTS and Centos versions,\n // and does not support __has_attribute(visibility) ...\n #ifndef __has_attribute\n #define __has_attribute(x) 0 // Compatibility with non-clang compilers.\n #endif\n #if (defined(__GNUC__) && (__GNUC__ >= 4)) || (defined(__clang__) && __has_attribute(visibility))\n #ifdef ARM\n #define VV_EXPORTED_SYMBOL extern __attribute__((externally_visible,visibility(\"default\")))\n #else\n #define VV_EXPORTED_SYMBOL extern __attribute__((visibility(\"default\")))\n #endif\n #if defined(__clang__) && (defined(_VUSECACHE) || defined(_VBUILDMODULE))\n #define VV_LOCAL_SYMBOL static\n #else\n #define VV_LOCAL_SYMBOL __attribute__ ((visibility (\"hidden\")))\n #endif\n #else\n #define VV_EXPORTED_SYMBOL extern\n #define VV_LOCAL_SYMBOL static\n #endif\n#endif\n\n#ifdef __cplusplus\n #include \n #define _MOV std::move\n#else\n #define _MOV\n#endif\n\n// tcc does not support has_include properly yet, turn it off completely\n#if defined(__TINYC__) && defined(__has_include)\n#undef __has_include\n#endif\n\n\n#if !defined(VWEAK)\n #define VWEAK __attribute__((weak))\n #ifdef _MSC_VER\n #undef VWEAK\n #define VWEAK\n #endif\n#endif\n\n#if !defined(VNORETURN)\n #if defined(__TINYC__)\n #include \n #define VNORETURN noreturn\n #endif\n # if !defined(__TINYC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L\n # define VNORETURN _Noreturn\n # elif defined(__GNUC__) && __GNUC__ >= 2\n # define VNORETURN __attribute__((noreturn))\n # endif\n #ifndef VNORETURN\n #define VNORETURN\n #endif\n#endif\n\n#if !defined(VUNREACHABLE)\n #if defined(__GNUC__) && !defined(__clang__)\n #define V_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__)\n #if (V_GCC_VERSION >= 40500L)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #if defined(__clang__) && defined(__has_builtin)\n #if __has_builtin(__builtin_unreachable)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #ifndef VUNREACHABLE\n #define VUNREACHABLE() do { } while (0)\n #endif\n #if defined(__FreeBSD__) && defined(__TINYC__)\n #define VUNREACHABLE() do { } while (0)\n #endif\n#endif\n\n//likely and unlikely macros\n#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n #define _likely_(x) __builtin_expect(x,1)\n #define _unlikely_(x) __builtin_expect(x,0)\n#else\n #define _likely_(x) (x)\n #define _unlikely_(x) (x)\n#endif\n\n\n// c_headers\ntypedef int (*qsort_callback_func)(const void*, const void*);\n#include // TODO remove all these includes, define all function signatures and types manually\n#include \n#include \n\n#ifndef _WIN32\n #if defined __has_include\n #if __has_include ()\n #include \n #else\n // Most probably musl OR __ANDROID__ ...\n int backtrace (void **__array, int __size) { return 0; }\n char **backtrace_symbols (void *const *__array, int __size){ return 0; }\n void backtrace_symbols_fd (void *const *__array, int __size, int __fd){}\n #endif\n #endif\n#endif\n\n#include // for va_list\n\n//================================== GLOBALS =================================*/\nint load_so(byteptr);\nvoid _vinit(int ___argc, voidptr ___argv);\nvoid _vcleanup(void);\n#define sigaction_size sizeof(sigaction);\n#define _ARR_LEN(a) ( (sizeof(a)) / (sizeof(a[0])) )\n\nvoid v_free(voidptr ptr);\nvoidptr memdup(voidptr src, int sz);\n\n#if INTPTR_MAX == INT32_MAX\n #define TARGET_IS_32BIT 1\n#elif INTPTR_MAX == INT64_MAX\n #define TARGET_IS_64BIT 1\n#else\n #error \"The environment is not 32 or 64-bit.\"\n#endif\n\n#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ || defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN || defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__)\n #define TARGET_ORDER_IS_BIG 1\n#elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ || defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN || defined(__LITTLE_ENDIAN__) || defined(__ARMEL__) || defined(__THUMBEL__) || defined(__AARCH64EL__) || defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) || defined(_M_AMD64) || defined(_M_X64) || defined(_M_IX86)\n #define TARGET_ORDER_IS_LITTLE 1\n#else\n #error \"Unknown architecture endianness\"\n#endif\n\n#ifndef _WIN32\n #include \n #include // tolower\n #include \n #include // sleep\n extern char **environ;\n#endif\n\n#if defined(__CYGWIN__) && !defined(_WIN32)\n #error Cygwin is not supported, please use MinGW or Visual Studio.\n#endif\n\n#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__vinix__) || defined(__serenity__) || defined(__sun)\n #include \n #include // os__wait uses wait on nix\n#endif\n\n#ifdef __OpenBSD__\n #include \n #include \n #include // os__wait uses wait on nix\n#endif\n\n#ifdef __NetBSD__\n #include // os__wait uses wait on nix\n#endif\n\n#ifdef _WIN32\n #define WINVER 0x0600\n #ifdef _WIN32_WINNT\n #undef _WIN32_WINNT\n #endif\n #define _WIN32_WINNT 0x0600\n #ifndef WIN32_FULL\n #define WIN32_LEAN_AND_MEAN\n #endif\n #ifndef _UNICODE\n #define _UNICODE\n #endif\n #ifndef UNICODE\n #define UNICODE\n #endif\n #include \n\n #include // _waccess\n #include // _wgetcwd\n #include // signal and SIGSEGV for segmentation fault handler\n\n #ifdef _MSC_VER\n // On MSVC these are the same (as long as /volatile:ms is passed)\n #define _Atomic volatile\n\n // MSVC cannot parse some things properly\n #undef EMPTY_STRUCT_DECLARATION\n #undef OPTION_CAST\n\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #define OPTION_CAST(x)\n #undef __NOINLINE\n #undef __IRQHANDLER\n #define __NOINLINE __declspec(noinline)\n #define __IRQHANDLER __declspec(naked)\n\n #include \n #pragma comment(lib, \"Dbghelp\")\n #endif\n#else\n #include \n #ifndef PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP\n // musl does not have that\n #define pthread_rwlockattr_setkind_np(a, b)\n #endif\n#endif\n\n// g_live_info is used by live.info()\nstatic void* g_live_info = NULL;\n\n#if defined(__MINGW32__) || defined(__MINGW64__) || (defined(_WIN32) && defined(__TINYC__))\n #undef PRId64\n #undef PRIi64\n #undef PRIo64\n #undef PRIu64\n #undef PRIx64\n #undef PRIX64\n #define PRId64 \"lld\"\n #define PRIi64 \"lli\"\n #define PRIo64 \"llo\"\n #define PRIu64 \"llu\"\n #define PRIx64 \"llx\"\n #define PRIX64 \"llX\"\n#endif\n\n#ifdef _VFREESTANDING\n#undef _VFREESTANDING\n#endif\n"); + _const_v__gen__c__c_bare_headers = _SLIT("//============================== HELPER C MACROS =============================*/\n// _SLIT0 is used as NULL string for literal arguments\n// `\"\" s` is used to enforce a string literal argument\n#define _SLIT0 (string){.str=(byteptr)(\"\"), .len=0, .is_lit=1}\n#define _SLIT(s) ((string){.str=(byteptr)(\"\" s), .len=(sizeof(s)-1), .is_lit=1})\n#define _SLEN(s, n) ((string){.str=(byteptr)(\"\" s), .len=n, .is_lit=1})\n\n// take the address of an rvalue\n#define ADDR(type, expr) (&((type[]){expr}[0]))\n\n// copy something to the heap\n#define HEAP(type, expr) ((type*)memdup((void*)&((type[]){expr}[0]), sizeof(type)))\n#define HEAP_noscan(type, expr) ((type*)memdup_noscan((void*)&((type[]){expr}[0]), sizeof(type)))\n\n#define _PUSH_MANY(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many(arr, tmp.data, tmp.len);}\n#define _PUSH_MANY_noscan(arr, val, tmp, tmp_typ) {tmp_typ tmp = (val); array_push_many_noscan(arr, tmp.data, tmp.len);}\n\n// unsigned/signed comparisons\nstatic inline bool _us32_gt(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a > b; }\nstatic inline bool _us32_ge(uint32_t a, int32_t b) { return a >= INT32_MAX || (int32_t)a >= b; }\nstatic inline bool _us32_eq(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a == b; }\nstatic inline bool _us32_ne(uint32_t a, int32_t b) { return a > INT32_MAX || (int32_t)a != b; }\nstatic inline bool _us32_le(uint32_t a, int32_t b) { return a <= INT32_MAX && (int32_t)a <= b; }\nstatic inline bool _us32_lt(uint32_t a, int32_t b) { return a < INT32_MAX && (int32_t)a < b; }\nstatic inline bool _us64_gt(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a > b; }\nstatic inline bool _us64_ge(uint64_t a, int64_t b) { return a >= INT64_MAX || (int64_t)a >= b; }\nstatic inline bool _us64_eq(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a == b; }\nstatic inline bool _us64_ne(uint64_t a, int64_t b) { return a > INT64_MAX || (int64_t)a != b; }\nstatic inline bool _us64_le(uint64_t a, int64_t b) { return a <= INT64_MAX && (int64_t)a <= b; }\nstatic inline bool _us64_lt(uint64_t a, int64_t b) { return a < INT64_MAX && (int64_t)a < b; }\n\n#define EMPTY_VARG_INITIALIZATION 0\n#define EMPTY_STRUCT_INITIALIZATION 0\n#define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n// Due to a tcc bug, the length of an array needs to be specified, but GCC crashes if it is...\n#define EMPTY_ARRAY_OF_ELEMS(x,n) (x[])\n#define TCCSKIP(x) x\n\n#define __NOINLINE __attribute__((noinline))\n#define __IRQHANDLER __attribute__((interrupt))\n\n#define __V_architecture 0\n#if defined(__x86_64__)\n #define __V_amd64 1\n #undef __V_architecture\n #define __V_architecture 1\n#endif\n\n#if defined(__aarch64__) || defined(__arm64__)\n #define __V_arm64 1\n #undef __V_architecture\n #define __V_architecture 2\n#endif\n\n// Using just __GNUC__ for detecting gcc, is not reliable because other compilers define it too:\n#ifdef __GNUC__\n #define __V_GCC__\n#endif\n#ifdef __TINYC__\n #undef __V_GCC__\n#endif\n#ifdef __cplusplus\n #undef __V_GCC__\n#endif\n#ifdef __clang__\n #undef __V_GCC__\n#endif\n#ifdef _MSC_VER\n #undef __V_GCC__\n #undef EMPTY_STRUCT_INITIALIZATION\n #define EMPTY_STRUCT_INITIALIZATION 0\n#endif\n\n#ifdef __TINYC__\n #define _Atomic volatile\n #undef EMPTY_STRUCT_DECLARATION\n #define EMPTY_STRUCT_DECLARATION voidptr _dummy_pad\n #undef EMPTY_ARRAY_OF_ELEMS\n #define EMPTY_ARRAY_OF_ELEMS(x,n) (x[n])\n #undef __NOINLINE\n #undef __IRQHANDLER\n // tcc does not support inlining at all\n #define __NOINLINE\n #define __IRQHANDLER\n #undef TCCSKIP\n #define TCCSKIP(x)\n // #include \n #ifndef _WIN32\n #include \n int tcc_backtrace(const char *fmt, ...);\n #endif\n#endif\n\n// Use __offsetof_ptr instead of __offset_of, when you *do* have a valid pointer, to avoid UB:\n#ifndef __offsetof_ptr\n #define __offsetof_ptr(ptr,PTYPE,FIELDNAME) ((size_t)((byte *)&((PTYPE *)ptr)->FIELDNAME - (byte *)ptr))\n#endif\n\n// for __offset_of\n#ifndef __offsetof\n #define __offsetof(PTYPE,FIELDNAME) ((size_t)((char *)&((PTYPE *)0)->FIELDNAME - (char *)0))\n#endif\n\n// returns the number of CPU registers that TYPE takes up\n#define _REG_WIDTH(T) (((sizeof(T) + sizeof(void*) - 1) & ~(sizeof(void*) - 1)) / sizeof(void*))\n// parameters of size <= 2 registers are spilled across those two registers; larger types are passed as one pointer to some stack location\n#define _REG_WIDTH_BOUNDED(T) (_REG_WIDTH(T) <= 2 ? _REG_WIDTH(T) : 1)\n\n#define OPTION_CAST(x) (x)\n\n#ifndef V64_PRINTFORMAT\n #ifdef PRIx64\n #define V64_PRINTFORMAT \"0x%\"PRIx64\n #elif defined(__WIN32__)\n #define V64_PRINTFORMAT \"0x%I64x\"\n #elif defined(__linux__) && defined(__LP64__)\n #define V64_PRINTFORMAT \"0x%lx\"\n #else\n #define V64_PRINTFORMAT \"0x%llx\"\n #endif\n#endif\n\n#if defined(_WIN32) || defined(__CYGWIN__)\n #define VV_EXPORTED_SYMBOL extern __declspec(dllexport)\n #define VV_LOCAL_SYMBOL static\n#else\n // 4 < gcc < 5 is used by some older Ubuntu LTS and Centos versions,\n // and does not support __has_attribute(visibility) ...\n #ifndef __has_attribute\n #define __has_attribute(x) 0 // Compatibility with non-clang compilers.\n #endif\n #if (defined(__GNUC__) && (__GNUC__ >= 4)) || (defined(__clang__) && __has_attribute(visibility))\n #ifdef ARM\n #define VV_EXPORTED_SYMBOL extern __attribute__((externally_visible,visibility(\"default\")))\n #else\n #define VV_EXPORTED_SYMBOL extern __attribute__((visibility(\"default\")))\n #endif\n #if defined(__clang__) && (defined(_VUSECACHE) || defined(_VBUILDMODULE))\n #define VV_LOCAL_SYMBOL static\n #else\n #define VV_LOCAL_SYMBOL __attribute__ ((visibility (\"hidden\")))\n #endif\n #else\n #define VV_EXPORTED_SYMBOL extern\n #define VV_LOCAL_SYMBOL static\n #endif\n#endif\n\n#ifdef __cplusplus\n #include \n #define _MOV std::move\n#else\n #define _MOV\n#endif\n\n// tcc does not support has_include properly yet, turn it off completely\n#if defined(__TINYC__) && defined(__has_include)\n#undef __has_include\n#endif\n\n\n#if !defined(VWEAK)\n #define VWEAK __attribute__((weak))\n #ifdef _MSC_VER\n #undef VWEAK\n #define VWEAK\n #endif\n#endif\n\n#if !defined(VNORETURN)\n #if defined(__TINYC__)\n #include \n #define VNORETURN noreturn\n #endif\n # if !defined(__TINYC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L\n # define VNORETURN _Noreturn\n # elif defined(__GNUC__) && __GNUC__ >= 2\n # define VNORETURN __attribute__((noreturn))\n # endif\n #ifndef VNORETURN\n #define VNORETURN\n #endif\n#endif\n\n#if !defined(VUNREACHABLE)\n #if defined(__GNUC__) && !defined(__clang__)\n #define V_GCC_VERSION (__GNUC__ * 10000L + __GNUC_MINOR__ * 100L + __GNUC_PATCHLEVEL__)\n #if (V_GCC_VERSION >= 40500L)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #if defined(__clang__) && defined(__has_builtin)\n #if __has_builtin(__builtin_unreachable)\n #define VUNREACHABLE() do { __builtin_unreachable(); } while (0)\n #endif\n #endif\n #ifndef VUNREACHABLE\n #define VUNREACHABLE() do { } while (0)\n #endif\n #if defined(__FreeBSD__) && defined(__TINYC__)\n #define VUNREACHABLE() do { } while (0)\n #endif\n#endif\n\n//likely and unlikely macros\n#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)\n #define _likely_(x) __builtin_expect(x,1)\n #define _unlikely_(x) __builtin_expect(x,0)\n#else\n #define _likely_(x) (x)\n #define _unlikely_(x) (x)\n#endif\n\n\n#define _VFREESTANDING\n\ntypedef long unsigned int size_t;\n\n// Memory allocation related headers\nvoid *malloc(size_t size);\nvoid *calloc(size_t nitems, size_t size);\nvoid *realloc(void *ptr, size_t size);\nvoid *memcpy(void *dest, void *src, size_t n);\nvoid *memset(void *s, int c, size_t n);\nvoid *memmove(void *dest, void *src, size_t n);\n\n// varargs implementation, TODO: works on tcc and gcc, but is very unportable and hacky\ntypedef __builtin_va_list va_list;\n#define va_start(a, b) __builtin_va_start(a, b)\n#define va_end(a) __builtin_va_end(a)\n#define va_arg(a, b) __builtin_va_arg(a, b)\n#define va_copy(a, b) __builtin_va_copy(a, b)\n\n//================================== GLOBALS =================================*/\nint load_so(byteptr);\nvoid _vinit(int ___argc, voidptr ___argv);\nvoid _vcleanup();\n#define sigaction_size sizeof(sigaction);\n#define _ARR_LEN(a) ( (sizeof(a)) / (sizeof(a[0])) )\n\nvoid v_free(voidptr ptr);\nvoidptr memdup(voidptr src, int sz);\n\n"); _const_v__gen__c__skip_struct_init = new_array_from_c_array(2, 2, sizeof(string), _MOV((string[2]){_SLIT("struct stat"), _SLIT("struct addrinfo")})); } { // Initializations for module v.scanner :