diff --git a/bind/common.go b/bind/common.go index 9f5f172c..a47a0e1b 100644 --- a/bind/common.go +++ b/bind/common.go @@ -51,7 +51,7 @@ func Invoke(index int, request *api.Request) string { if !ok { return BuildResult(errors.New("instance not found")) } - return BuildResult(api.Invoke(instance, request)) + return jsonEncode(api.Invoke(instance, request)) } func BuildResult(data any) string { @@ -59,6 +59,10 @@ func BuildResult(data any) string { buf, _ := json.Marshal(model.NewErrorResult[any](err.Error())) return string(buf) } - buf, _ := json.Marshal(model.NewOkResult(data)) + return jsonEncode(model.NewOkResult(data)) +} + +func jsonEncode(data any) string { + buf, _ := json.Marshal(data) return string(buf) } diff --git a/bind/desktop/main.go b/bind/desktop/main.go index 32cc5109..c2c1afd5 100644 --- a/bind/desktop/main.go +++ b/bind/desktop/main.go @@ -1,15 +1,11 @@ package main -/* -#include -*/ import "C" import ( "encoding/json" "github.com/GopeedLab/gopeed/bind" "github.com/GopeedLab/gopeed/pkg/api" "github.com/GopeedLab/gopeed/pkg/api/model" - "unsafe" ) func main() {} @@ -20,7 +16,6 @@ func Create(cfg *C.char) *C.char { if err := json.Unmarshal([]byte(C.GoString(cfg)), &config); err != nil { return C.CString(bind.BuildResult(err)) } - defer C.free(unsafe.Pointer(cfg)) return C.CString(bind.Create(&config)) } @@ -31,7 +26,6 @@ func Invoke(index int, req *C.char) *C.char { if err := json.Unmarshal([]byte(C.GoString(req)), &request); err != nil { return C.CString(bind.BuildResult(err)) } - defer C.free(unsafe.Pointer(req)) return C.CString(bind.Invoke(index, &request)) } diff --git a/bind/mobile/main.go b/bind/mobile/main.go index 04acf2e4..9ea1e05f 100644 --- a/bind/mobile/main.go +++ b/bind/mobile/main.go @@ -8,8 +8,8 @@ import ( "github.com/GopeedLab/gopeed/pkg/api/model" ) -func Create(config *model.StartConfig) string { - return bind.Create(config) +func Create(cfg *model.StartConfig) string { + return bind.Create(cfg) } func Invoke(index int, request *api.Request) string { diff --git a/cmd/api/main.go b/cmd/api/main.go index b95c868b..080870cd 100644 --- a/cmd/api/main.go +++ b/cmd/api/main.go @@ -3,14 +3,20 @@ package main import ( "github.com/GopeedLab/gopeed/cmd" "github.com/GopeedLab/gopeed/pkg/api/model" + "github.com/GopeedLab/gopeed/pkg/base" ) // only for local development func main() { cfg := &model.StartConfig{ - Network: "tcp", - Address: "127.0.0.1:9999", - Storage: model.StorageBolt, + Storage: model.StorageBolt, + DownloadConfig: &base.DownloaderStoreConfig{ + Http: &base.DownloaderHttpConfig{ + Enable: true, + Host: "127.0.0.1", + Port: 9999, + }, + }, WebEnable: true, } cmd.Start(cfg) diff --git a/cmd/server.go b/cmd/server.go index 84375bee..4e822a0f 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -21,6 +21,7 @@ func Start(cfg *model.StartConfig) { if err != nil { panic(err) } + downloadCfgResult := instance.GetConfig() if downloadCfgResult.HasError() { panic(downloadCfgResult.Msg) @@ -52,13 +53,15 @@ func Start(cfg *model.StartConfig) { } } } - startResult := instance.Start() - if startResult.HasError() { - panic(startResult.Msg) - } - fmt.Printf("Server start success on http://%s:%s\n", startResult.Data.Host, startResult.Data.Port) watchExit(instance) + + result, start, err := api.ListenHttp(cfg.DownloadConfig.Http, instance) + if err != nil { + panic(err) + } + fmt.Printf("Server start success on http://%s:%d\n", result.Host, result.Port) + start() } func watchExit(instance *api.Instance) { @@ -67,7 +70,7 @@ func watchExit(instance *api.Instance) { go func() { sig := <-sigs fmt.Printf("Server is shutting down due to signal: %s\n", sig) - instance.Stop() + instance.Close() os.Exit(0) }() } diff --git a/cmd/web/flags.go b/cmd/web/flags.go index e27bbd70..b5e94caf 100644 --- a/cmd/web/flags.go +++ b/cmd/web/flags.go @@ -35,8 +35,8 @@ func parse() *args { // args priority: config file > cli args cfgArgs := loadConfig(*cliArgs.configPath) - if cfgArgs.Address == nil { - cfgArgs.Address = cliArgs.Address + if cfgArgs.Host == nil { + cfgArgs.Host = cliArgs.Host } if cfgArgs.Port == nil { cfgArgs.Port = cliArgs.Port diff --git a/cmd/web/main.go b/cmd/web/main.go index e4e2c5ef..57087160 100644 --- a/cmd/web/main.go +++ b/cmd/web/main.go @@ -46,6 +46,7 @@ func main() { args.DownloadConfig = &base.DownloaderStoreConfig{} } args.DownloadConfig.Http = &base.DownloaderHttpConfig{ + Enable: true, Host: *args.Host, Port: *args.Port, ApiToken: *args.ApiToken, diff --git a/pkg/api/api.go b/pkg/api/api.go index c7f3eccc..2cf7514f 100644 --- a/pkg/api/api.go +++ b/pkg/api/api.go @@ -7,7 +7,6 @@ import ( "github.com/GopeedLab/gopeed/pkg/api/model" "github.com/GopeedLab/gopeed/pkg/base" "github.com/GopeedLab/gopeed/pkg/download" - "github.com/pkg/errors" "net" "net/http" "reflect" @@ -36,24 +35,6 @@ func Create(startCfg *model.StartConfig) (*Instance, error) { startCfg: startCfg, } - return i, nil -} - -func (i *Instance) Start() *model.Result[*model.StartResult] { - // avoid repeat start - if i.running { - // If the http server is not enabled, return nil - if i.runningPort == 0 { - return model.NewOkResult[*model.StartResult](nil) - } - host, _, _ := net.SplitHostPort(i.listener.Addr().String()) - return model.NewOkResult(&model.StartResult{ - Host: host, - Port: i.runningPort, - }) - } - - startCfg := i.startCfg downloadCfg := &download.DownloaderConfig{ ProductionMode: startCfg.ProductionMode, RefreshInterval: startCfg.RefreshInterval, @@ -67,69 +48,47 @@ func (i *Instance) Start() *model.Result[*model.StartResult] { downloadCfg.Init() downloader := download.NewDownloader(downloadCfg) if err := downloader.Setup(); err != nil { - return model.NewErrorResult[*model.StartResult](err.Error()) + return nil, err } i.downloader = downloader i.running = true - - config, err := i.downloader.GetConfig() - if err != nil { - return model.NewErrorResult[*model.StartResult](err.Error()) - } - httpCfg := config.Http - if httpCfg == nil || !httpCfg.Enable { - return model.NewOkResult[*model.StartResult](nil) - } - i.httpLock = sync.Mutex{} - startResult := i.StartHttp(httpCfg) - if startResult.HasError() { - i.downloader.Logger.Error().Err(err).Msgf("listen http failed: %s", startResult.Msg) - return model.NewOkResult[*model.StartResult](nil) - } - go func() { - if err := i.srv.Serve(i.listener); err != nil && !errors.Is(err, http.ErrServerClosed) { - panic(err) - } - }() - - addr, _ := i.listener.Addr().(*net.TCPAddr) - i.runningPort = addr.Port - return model.NewOkResult(&model.StartResult{ - Host: httpCfg.Host, - Port: i.runningPort, - }) + return i, nil } -func (i *Instance) Stop() *model.Result[any] { - i.StopHttp() - if i.downloader != nil { - if err := i.downloader.Close(); err != nil { - i.downloader.Logger.Warn().Err(err).Msg("close downloader failed") - } - i.downloader = nil - i.running = false - } - - return model.NewNilResult() -} - -func (i *Instance) StartHttp(httpCfg *base.DownloaderHttpConfig) *model.Result[int] { +func (i *Instance) StartHttp() *model.Result[*model.HttpListenResult] { i.httpLock.Lock() defer i.httpLock.Unlock() - return i.startHttp(httpCfg) + return i.startHttp() } -func (i *Instance) startHttp(httpCfg *base.DownloaderHttpConfig) *model.Result[int] { +func (i *Instance) startHttp() *model.Result[*model.HttpListenResult] { + var httpCfg *base.DownloaderHttpConfig + // if startCfg has http config, first use it + if i.startCfg.DownloadConfig != nil && i.startCfg.DownloadConfig.Http != nil { + httpCfg = i.startCfg.DownloadConfig.Http + } else { + cfg, err := i.downloader.GetConfig() + if err != nil { + return model.NewErrorResult[*model.HttpListenResult](err.Error()) + } + httpCfg = cfg.Http + } + + if httpCfg == nil || !httpCfg.Enable { + return model.NewErrorResult[*model.HttpListenResult]("HTTP API server not enabled") + } if i.srv != nil { - return model.NewErrorResult[int]("server already started") + return model.NewErrorResult[*model.HttpListenResult]("HTTP API server already started") } - if err := ListenHttp(httpCfg, i); err != nil { - return model.NewErrorResult[int](err.Error()) + result, start, err := ListenHttp(httpCfg, i) + if err != nil { + return model.NewErrorResult[*model.HttpListenResult](err.Error()) } - return model.NewOkResult(i.runningPort) + go start() + return model.NewOkResult[*model.HttpListenResult](result) } func (i *Instance) StopHttp() *model.Result[any] { @@ -151,16 +110,12 @@ func (i *Instance) stopHttp() *model.Result[any] { return model.NewNilResult() } -func (i *Instance) RestartHttp(httpCfg *base.DownloaderHttpConfig) *model.Result[int] { +func (i *Instance) RestartHttp() *model.Result[*model.HttpListenResult] { i.httpLock.Lock() defer i.httpLock.Unlock() - return i.restartHttp(httpCfg) -} - -func (i *Instance) restartHttp(httpCfg *base.DownloaderHttpConfig) *model.Result[int] { i.stopHttp() - return i.startHttp(httpCfg) + return i.startHttp() } func (i *Instance) Info() *model.Result[map[string]any] { @@ -375,6 +330,19 @@ func (i *Instance) UpgradeExtension(identity string) *model.Result[any] { return model.NewNilResult() } +func (i *Instance) Close() *model.Result[any] { + i.StopHttp() + if i.downloader != nil { + if err := i.downloader.Close(); err != nil { + i.downloader.Logger.Warn().Err(err).Msg("close downloader failed") + } + i.downloader = nil + i.running = false + } + + return model.NewNilResult() +} + type Request struct { Method string `json:"method"` Params []string `json:"params"` diff --git a/pkg/api/http.go b/pkg/api/http.go index ab283906..8fc888a9 100644 --- a/pkg/api/http.go +++ b/pkg/api/http.go @@ -22,7 +22,7 @@ import ( const instanceKey string = "apiInstance" -func ListenHttp(httpCfg *base.DownloaderHttpConfig, ai *Instance) error { +func ListenHttp(httpCfg *base.DownloaderHttpConfig, ai *Instance) (*model.HttpListenResult, func(), error) { var r = mux.NewRouter() r.Methods(http.MethodGet).Path("/api/v1/info").HandlerFunc(Info) r.Methods(http.MethodPost).Path("/api/v1/resolve").HandlerFunc(Resolve) @@ -106,12 +106,19 @@ func ListenHttp(httpCfg *base.DownloaderHttpConfig, ai *Instance) error { listener, err := net.Listen("tcp", net.JoinHostPort(httpCfg.Host, fmt.Sprintf("%d", httpCfg.Port))) if err != nil { - return err + return nil, nil, err } - ai.srv = srv ai.listener = listener - return nil + + return &model.HttpListenResult{ + Host: httpCfg.Host, + Port: listener.Addr().(*net.TCPAddr).Port, + }, func() { + if err := srv.Serve(listener); err != nil && !errors.Is(err, http.ErrServerClosed) { + ai.downloader.Logger.Error().Err(err).Msg("http server listen error") + } + }, nil } func getInstance(r *http.Request) *Instance { diff --git a/pkg/api/model/api.go b/pkg/api/model/api.go index 46e15152..faa7fec9 100644 --- a/pkg/api/model/api.go +++ b/pkg/api/model/api.go @@ -51,7 +51,7 @@ func (cfg *WebBasicAuth) Authorization() string { return "Basic " + base64.StdEncoding.EncodeToString([]byte(userId)) } -type StartResult struct { +type HttpListenResult struct { Host string `json:"host"` // Port is the http server real listen port. Port int `json:"port"` diff --git a/pkg/download/model.go b/pkg/download/model.go index 6f57444b..b6af700a 100644 --- a/pkg/download/model.go +++ b/pkg/download/model.go @@ -113,9 +113,9 @@ func (t *Task) calcSpeed(speedArr []int64, downloaded int64, usedTime float64) i } type TaskFilter struct { - IDs []string - Statuses []base.Status - NotStatuses []base.Status + IDs []string `json:"ids"` + Statuses []base.Status `json:"statuses"` + NotStatuses []base.Status `json:"notStatuses"` } func (f *TaskFilter) IsEmpty() bool { diff --git a/ui/flutter/include/libgopeed.h b/ui/flutter/include/libgopeed.h index 766cf7e6..1af88c08 100644 --- a/ui/flutter/include/libgopeed.h +++ b/ui/flutter/include/libgopeed.h @@ -2,7 +2,6 @@ /* package github.com/GopeedLab/gopeed/bind/desktop */ - #line 1 "cgo-builtin-export-prolog" #include @@ -11,19 +10,24 @@ #define GO_CGO_EXPORT_PROLOGUE_H #ifndef GO_CGO_GOSTRING_TYPEDEF -typedef struct { const char *p; ptrdiff_t n; } _GoString_; +typedef struct { + const char *p; + ptrdiff_t n; +} _GoString_; #endif #endif /* Start of preamble from import "C" comments. */ +#line 3 "main.go" +#include +#line 1 "cgo-generated-wrapper" /* End of preamble from import "C" comments. */ - /* Start of boilerplate cgo prologue. */ #line 1 "cgo-gcc-export-header-prolog" @@ -56,15 +60,22 @@ typedef double _Complex GoComplex128; static assertion to make sure the file is being used on architecture at least with matching size of GoInt. */ -typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1]; +typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void *) == 64 / 8 ? 1 : -1]; #ifndef GO_CGO_GOSTRING_TYPEDEF typedef _GoString_ GoString; #endif typedef void *GoMap; typedef void *GoChan; -typedef struct { void *t; void *v; } GoInterface; -typedef struct { void *data; GoInt len; GoInt cap; } GoSlice; +typedef struct { + void *t; + void *v; +} GoInterface; +typedef struct { + void *data; + GoInt len; + GoInt cap; +} GoSlice; #endif @@ -74,14 +85,8 @@ typedef struct { void *data; GoInt len; GoInt cap; } GoSlice; extern "C" { #endif - -/* Return type for Start */ -struct Start_return { - GoInt r0; - char* r1; -}; -extern struct Start_return Start(char* cfg); -extern void Stop(); +extern __declspec(dllexport) char *Create(char *cfg); +extern __declspec(dllexport) char *Invoke(GoInt index, char *req); #ifdef __cplusplus } diff --git a/ui/flutter/lib/api/api.dart b/ui/flutter/lib/api/api.dart deleted file mode 100644 index a3040820..00000000 --- a/ui/flutter/lib/api/api.dart +++ /dev/null @@ -1,210 +0,0 @@ -import 'dart:io'; - -import 'package:dio/dio.dart'; -import 'package:dio/io.dart'; -import 'package:flutter/foundation.dart'; -import 'package:gopeed/api/model/extension.dart'; -import 'package:gopeed/api/model/install_extension.dart'; -import 'package:gopeed/api/model/switch_extension.dart'; - -import '../util/util.dart'; -import 'model/create_task.dart'; -import 'model/downloader_config.dart'; -import 'model/request.dart'; -import 'model/resolve_result.dart'; -import 'model/result.dart'; -import 'model/task.dart'; -import 'model/update_extension_settings.dart'; -import 'model/update_check_extension_resp.dart'; - -class _Client { - static _Client? _instance; - - late Dio dio; - - _Client._internal(); - - factory _Client(String network, String address, String apiToken) { - if (_instance == null) { - _instance = _Client._internal(); - var dio = Dio(); - final isUnixSocket = network == 'unix'; - var baseUrl = 'http://127.0.0.1'; - if (!isUnixSocket) { - if (Util.isWeb()) { - baseUrl = kDebugMode ? 'http://127.0.0.1:9999' : ''; - } else { - baseUrl = 'http://$address'; - } - } - dio.options.baseUrl = baseUrl; - dio.options.contentType = Headers.jsonContentType; - dio.options.sendTimeout = const Duration(seconds: 5); - dio.options.connectTimeout = const Duration(seconds: 5); - dio.options.receiveTimeout = const Duration(seconds: 60); - dio.interceptors.add(InterceptorsWrapper(onRequest: (options, handler) { - if (apiToken.isNotEmpty) { - options.headers['X-Api-Token'] = apiToken; - } - handler.next(options); - })); - - _instance!.dio = dio; - if (isUnixSocket) { - (_instance!.dio.httpClientAdapter as IOHttpClientAdapter) - .createHttpClient = () { - final client = HttpClient(); - client.connectionFactory = - (Uri uri, String? proxyHost, int? proxyPort) { - return Socket.startConnect( - InternetAddress(address, type: InternetAddressType.unix), 0); - }; - return client; - }; - } - } - return _instance!; - } -} - -class TimeoutException implements Exception { - final String message; - - TimeoutException(this.message); -} - -late _Client _client; - -void init(String network, String address, String apiToken) { - _client = _Client(network, address, apiToken); -} - -Future _parse( - Future Function() fetch, - T Function(dynamic json)? fromJsonT, -) async { - try { - var resp = await fetch(); - fromJsonT ??= (json) => null as T; - final result = Result.fromJson(resp.data, fromJsonT); - if (result.code == 0) { - return result.data as T; - } else { - throw Exception(result); - } - } on DioException catch (e) { - if (e.type == DioExceptionType.sendTimeout || - e.type == DioExceptionType.receiveTimeout || - e.type == DioExceptionType.connectionTimeout) { - throw TimeoutException("request timeout"); - } - throw Exception(Result(code: 1000, msg: e.message)); - } -} - -Future resolve(Request request) async { - return _parse( - () => _client.dio.post("/api/v1/resolve", data: request), - (data) => ResolveResult.fromJson(data)); -} - -Future createTask(CreateTask createTask) async { - return _parse( - () => _client.dio.post("/api/v1/tasks", data: createTask), - (data) => data as String); -} - -Future> getTasks(List statuses) async { - return _parse>( - () => _client.dio.get( - "/api/v1/tasks?${statuses.map((e) => "status=${e.name}").join("&")}"), - (data) => (data as List).map((e) => Task.fromJson(e)).toList()); -} - -Future pauseTask(String id) async { - return _parse(() => _client.dio.put("/api/v1/tasks/$id/pause"), null); -} - -Future continueTask(String id) async { - return _parse(() => _client.dio.put("/api/v1/tasks/$id/continue"), null); -} - -Future pauseAllTasks() async { - return _parse(() => _client.dio.put("/api/v1/tasks/pause"), null); -} - -Future continueAllTasks() async { - return _parse(() => _client.dio.put("/api/v1/tasks/continue"), null); -} - -Future deleteTask(String id, bool force) async { - return _parse( - () => _client.dio.delete("/api/v1/tasks/$id?force=$force"), null); -} - -Future getConfig() async { - return _parse(() => _client.dio.get("/api/v1/config"), - (data) => DownloaderConfig.fromJson(data)); -} - -Future putConfig(DownloaderConfig config) async { - return _parse(() => _client.dio.put("/api/v1/config", data: config), null); -} - -Future installExtension(InstallExtension installExtension) async { - return _parse( - () => _client.dio.post("/api/v1/extensions", data: installExtension), - null); -} - -Future> getExtensions() async { - return _parse>(() => _client.dio.get("/api/v1/extensions"), - (data) => (data as List).map((e) => Extension.fromJson(e)).toList()); -} - -Future updateExtensionSettings( - String identity, UpdateExtensionSettings updateExtensionSettings) async { - return _parse( - () => _client.dio.put("/api/v1/extensions/$identity/settings", - data: updateExtensionSettings), - null); -} - -Future switchExtension( - String identity, SwitchExtension switchExtension) async { - return _parse( - () => _client.dio - .put("/api/v1/extensions/$identity/switch", data: switchExtension), - null); -} - -Future deleteExtension(String identity) async { - return _parse(() => _client.dio.delete("/api/v1/extensions/$identity"), null); -} - -Future upgradeCheckExtension(String identity) async { - return _parse(() => _client.dio.get("/api/v1/extensions/$identity/update"), - (data) => UpdateCheckExtensionResp.fromJson(data)); -} - -Future updateExtension(String identity) async { - return _parse( - () => _client.dio.post("/api/v1/extensions/$identity/update"), null); -} - -Future> proxyRequest(String uri, - {data, Options? options}) async { - options ??= Options(); - options.headers ??= {}; - options.headers!["X-Target-Uri"] = uri; - - // add timestamp to avoid cache - return _client.dio.request( - "/api/v1/proxy?t=${DateTime.now().millisecondsSinceEpoch}", - data: data, - options: options); -} - -String join(String path) { - return "${_client.dio.options.baseUrl}/${Util.cleanPath(path)}"; -} diff --git a/ui/flutter/lib/api/api_exception.dart b/ui/flutter/lib/api/api_exception.dart new file mode 100644 index 00000000..522d31e4 --- /dev/null +++ b/ui/flutter/lib/api/api_exception.dart @@ -0,0 +1,6 @@ +class ApiException implements Exception { + final int code; + final String message; + + ApiException(this.code, this.message); +} diff --git a/ui/flutter/lib/api/entry/libgopeed_boot_base.dart b/ui/flutter/lib/api/entry/libgopeed_boot_base.dart new file mode 100644 index 00000000..3f357031 --- /dev/null +++ b/ui/flutter/lib/api/entry/libgopeed_boot_base.dart @@ -0,0 +1,25 @@ +import 'package:dio/dio.dart'; + +import '../api_exception.dart'; +import '../model/result.dart'; + +mixin LibgopeedBootBase { + Dio createDio() { + Dio dio = Dio(); + dio.options.contentType = Headers.jsonContentType; + dio.options.sendTimeout = const Duration(seconds: 5); + dio.options.connectTimeout = const Duration(seconds: 5); + dio.options.receiveTimeout = const Duration(seconds: 60); + return dio; + } + + T handleResult( + Result result, + ) { + if (result.code == 0) { + return result.data as T; + } else { + throw ApiException(result.code, result.msg ?? ''); + } + } +} diff --git a/ui/flutter/lib/api/entry/libgopeed_boot_native.dart b/ui/flutter/lib/api/entry/libgopeed_boot_native.dart new file mode 100644 index 00000000..257013f8 --- /dev/null +++ b/ui/flutter/lib/api/entry/libgopeed_boot_native.dart @@ -0,0 +1,245 @@ +import 'dart:async'; +import 'dart:convert'; +import 'dart:ffi'; +import 'dart:io'; + +import 'package:dio/dio.dart'; + +import '../../api/model/create_task.dart'; +import '../../api/model/create_task_batch.dart'; +import '../../api/model/downloader_config.dart'; +import '../../api/model/extension.dart'; +import '../../api/model/http_listen_result.dart'; +import '../../api/model/info.dart'; +import '../../api/model/install_extension.dart'; +import '../../api/model/request.dart'; +import '../../api/model/resolve_result.dart'; +import '../../api/model/result.dart'; +import '../../api/model/switch_extension.dart'; +import '../../api/model/task.dart'; +import '../../api/model/task_filter.dart'; +import '../../api/model/update_check_extension_resp.dart'; +import '../../api/model/update_extension_settings.dart'; +import '../../util/extensions.dart'; +import '../../util/util.dart'; +import '../libgopeed_boot.dart'; +import '../native/channel/libgopeed_channel.dart'; +import '../native/ffi/libgopeed_bind.dart'; +import '../native/ffi/libgopeed_ffi.dart'; +import '../native/libgopeed_interface.dart'; +import '../native/model/invoke_request.dart'; +import '../native/model/start_config.dart'; +import 'libgopeed_boot_base.dart'; + +LibgopeedBoot create() => LibgopeedBootNative(); + +class LibgopeedBootNative with LibgopeedBootBase implements LibgopeedBoot { + late LibgopeedAbi _libgopeedAbi; + late int _apiInstance; + late Dio _dio; + + LibgopeedBootNative() { + if (Util.isDesktop()) { + var libName = "libgopeed."; + if (Platform.isWindows) { + libName += "dll"; + } + if (Platform.isMacOS) { + libName += "dylib"; + } + if (Platform.isLinux) { + libName += "so"; + } + _libgopeedAbi = LibgopeedFFi(LibgopeedBind(DynamicLibrary.open(libName))); + } else { + _libgopeedAbi = LibgopeedChannel(); + } + } + + Future _invoke( + String method, + List params, + T Function(dynamic json)? fromJsonT, + ) async { + final invokeRequest = InvokeRequest( + method: method, + params: params.map((e) { + if (e.toJson != null) { + return jsonEncode(e.toJson()); + } + return jsonEncode(e); + }).toList()); + final resp = + await _libgopeedAbi.invoke(_apiInstance, jsonEncode(invokeRequest)); + final result = + Result.fromJson(jsonDecode(resp), fromJsonT ??= (json) => null as T); + return handleResult(result); + } + + List _parseTaskFilter(TaskFilter? filter) { + if (filter == null) { + return []; + } + return [filter]; + } + + @override + Future init(StartConfig cfg) async { + final result = await _libgopeedAbi.create(jsonEncode(cfg.toJson())); + _apiInstance = + Result.fromJson(jsonDecode(result), (data) => data as int).data!; + _dio = createDio(); + } + + @override + Future startHttp() async { + return _invoke( + "startHttp", [], (json) => HttpListenResult.fromJson(json)); + } + + @override + Future stopHttp() async { + await _invoke("stopHttp", [], null); + } + + @override + Future restartHttp() async { + await _invoke("restartHttp", [], null); + } + + @override + Future info() async { + return _invoke("info", [], (json) => Info.fromJson(json)); + } + + @override + Future resolve(Request request) async { + return _invoke( + "resolve", [request], (json) => ResolveResult.fromJson(json)); + } + + @override + Future createTask(CreateTask createTask) async { + return _invoke( + "createTask", [createTask], (json) => json as String); + } + + @override + Future createTaskBatch(CreateTaskBatch createTask) async { + return _invoke( + "createTaskBatch", [createTask], (json) => json as String); + } + + @override + Future pauseTask(String id) async { + await _invoke("pauseTask", [id], null); + } + + @override + Future pauseTasks(TaskFilter? filter) async { + await _invoke("pauseTasks", _parseTaskFilter(filter), null); + } + + @override + Future continueTask(String id) async { + await _invoke("continueTask", [id], null); + } + + @override + Future continueTasks(TaskFilter? filter) async { + await _invoke("continueTasks", _parseTaskFilter(filter), null); + } + + @override + Future deleteTask(String id, bool force) async { + await _invoke("deleteTask", [id, force], null); + } + + @override + Future deleteTasks(TaskFilter? filter, bool force) async { + await _invoke( + "deleteTasks", + _parseTaskFilter(filter).apply((it) { + it.add(force); + }), + null); + } + + @override + Future getTask(String id) async { + return _invoke("getTask", [id], (json) => Task.fromJson(json)); + } + + @override + Future> getTasks(TaskFilter? filter) async { + return _invoke>("getTasks", _parseTaskFilter(filter), + (json) => json.map((e) => Task.fromJson(e)).toList()); + } + + @override + Future> getTaskStats(String id) async { + return _invoke>( + "getTaskStats", [id], (json) => json as Map); + } + + @override + Future getConfig() async { + return _invoke( + "getConfig", [], (json) => DownloaderConfig.fromJson(json)); + } + + @override + Future putConfig(DownloaderConfig config) async { + await _invoke("putConfig", [config], null); + } + + @override + Future installExtension(InstallExtension installExtension) async { + await _invoke("installExtension", [installExtension], null); + } + + @override + Future> getExtensions() async { + return _invoke>("getExtensions", [], + (json) => json.map((e) => Extension.fromJson(e)).toList()); + } + + @override + Future updateExtensionSettings( + String identity, UpdateExtensionSettings updateExtensionSettings) async { + await _invoke( + "updateExtensionSettings", [identity, updateExtensionSettings], null); + } + + @override + Future switchExtension( + String identity, SwitchExtension switchExtension) async {} + + @override + Future deleteExtension(String identity) async { + await _invoke("deleteExtension", [identity], null); + } + + @override + Future upgradeCheckExtension( + String identity) async { + return _invoke("upgradeCheckExtension", + [identity], (json) => UpdateCheckExtensionResp.fromJson(json)); + } + + @override + Future upgradeExtension(String identity) async { + await _invoke("upgradeExtension", [identity], null); + } + + @override + Future close() async { + await _invoke("close", [], null); + } + + @override + Future> proxyRequest(String uri, + {data, Options? options}) { + return _dio.request(uri, data: data, options: options); + } +} diff --git a/ui/flutter/lib/api/entry/libgopeed_boot_web.dart b/ui/flutter/lib/api/entry/libgopeed_boot_web.dart new file mode 100644 index 00000000..4c739556 --- /dev/null +++ b/ui/flutter/lib/api/entry/libgopeed_boot_web.dart @@ -0,0 +1,275 @@ +import 'package:dio/dio.dart'; +import 'package:flutter/foundation.dart'; + +import '../../api/model/create_task.dart'; +import '../../api/model/create_task_batch.dart'; +import '../../api/model/downloader_config.dart'; +import '../../api/model/extension.dart'; +import '../../api/model/http_listen_result.dart'; +import '../../api/model/info.dart'; +import '../../api/model/install_extension.dart'; +import '../../api/model/request.dart'; +import '../../api/model/resolve_result.dart'; +import '../../api/model/result.dart'; +import '../../api/model/switch_extension.dart'; +import '../../api/model/task.dart'; +import '../../api/model/task_filter.dart'; +import '../../api/model/update_check_extension_resp.dart'; +import '../../api/model/update_extension_settings.dart'; +import '../../util/extensions.dart'; +import '../../util/util.dart'; +import '../api_exception.dart'; +import '../libgopeed_boot.dart'; +import '../native/model/start_config.dart'; +import 'libgopeed_boot_base.dart'; + +LibgopeedBoot create() => LibgopeedBootWeb(); + +class LibgopeedBootWeb with LibgopeedBootBase implements LibgopeedBoot { + late Dio _dio; + static const String _apiPrefix = '/api/v1'; + + LibgopeedBootWeb(); + + Future _fetch( + Future Function() fetch, + T Function(dynamic json)? fromJsonT, + ) async { + try { + var resp = await fetch(); + fromJsonT ??= (json) => null as T; + final result = Result.fromJson(resp.data, fromJsonT); + return handleResult(result); + } on DioException catch (e) { + if (e.type == DioExceptionType.sendTimeout || + e.type == DioExceptionType.receiveTimeout || + e.type == DioExceptionType.connectionTimeout) { + throw ApiException(1000, 'request timeout'); + } + throw ApiException(1000, e.message ?? ""); + } + } + + Map? _parseTaskFilter(TaskFilter? filter) { + if (filter == null) { + return null; + } + + Map params = {}; + if (filter.ids != null) { + params['ids'] = filter.ids; + } + if (filter.statuses != null) { + params['statuses'] = filter.statuses; + } + if (filter.notStatuses != null) { + params['notStatuses'] = filter.notStatuses; + } + if (params.isEmpty) { + return null; + } + return params; + } + + @override + Future init(StartConfig cfg) async { + _dio = createDio(); + _dio.options.baseUrl = kDebugMode ? 'http://127.0.0.1:9999' : ''; + } + + @override + Future startHttp() async { + throw UnimplementedError(); + } + + @override + Future stopHttp() async { + throw UnimplementedError(); + } + + @override + Future restartHttp() async { + throw UnimplementedError(); + } + + @override + Future info() { + return _fetch( + () => _dio.get("$_apiPrefix/info"), (data) => Info.fromJson(data)); + } + + @override + Future resolve(Request request) async { + return _fetch( + () => _dio.post("$_apiPrefix/resolve", data: request), + (data) => ResolveResult.fromJson(data)); + } + + @override + Future createTask(CreateTask createTask) async { + return _fetch( + () => _dio.post("$_apiPrefix/tasks", data: createTask), + (data) => data as String); + } + + @override + Future createTaskBatch(CreateTaskBatch createTask) async { + return _fetch( + () => _dio.post("$_apiPrefix/tasks", data: createTask), + (data) => data as String); + } + + @override + Future pauseTask(String id) async { + await _fetch( + () => _dio.put("$_apiPrefix/tasks/$id/pause", data: {}), null); + } + + @override + Future pauseTasks(TaskFilter? filter) async { + await _fetch( + () => _dio.put("$_apiPrefix/tasks/pause", + queryParameters: _parseTaskFilter(filter)), + null); + } + + @override + Future continueTask(String id) async { + await _fetch( + () => _dio.put("$_apiPrefix/tasks/$id/continue", data: {}), null); + } + + @override + Future continueTasks(TaskFilter? filter) async { + await _fetch( + () => _dio.put("$_apiPrefix/tasks/continue", + queryParameters: _parseTaskFilter(filter)), + null); + } + + @override + Future deleteTask(String id, bool force) async { + await _fetch( + () => _dio + .delete("$_apiPrefix/tasks/$id", queryParameters: {'force': force}), + null); + } + + @override + Future deleteTasks(TaskFilter? filter, bool force) async { + await _fetch( + () => _dio.delete("$_apiPrefix/tasks", + queryParameters: _parseTaskFilter(filter)?.apply((it) { + it['force'] = force; + })), + null); + } + + @override + Future getTask(String id) async { + return _fetch( + () => _dio.get("$_apiPrefix/tasks/$id"), (data) => Task.fromJson(data)); + } + + @override + Future> getTasks(TaskFilter? filter) async { + return _fetch>( + () => _dio.get("$_apiPrefix/tasks", + queryParameters: _parseTaskFilter(filter)), + (data) => (data as List).map((e) => Task.fromJson(e)).toList()); + } + + @override + Future> getTaskStats(String id) async { + return _fetch>( + () => _dio.get("$_apiPrefix/tasks/$id/stats"), + (data) => data as Map); + } + + @override + Future getConfig() async { + return _fetch(() => _dio.get("$_apiPrefix/config"), + (data) => DownloaderConfig.fromJson(data)); + } + + @override + Future putConfig(DownloaderConfig config) async { + await _fetch( + () => _dio.put("$_apiPrefix/config", data: config), null); + } + + @override + Future installExtension(InstallExtension installExtension) async { + await _fetch( + () => _dio.post("$_apiPrefix/extensions", data: installExtension), + null); + } + + @override + Future> getExtensions() async { + return _fetch>(() => _dio.get("$_apiPrefix/extensions"), + (data) => (data as List).map((e) => Extension.fromJson(e)).toList()); + } + + @override + Future updateExtensionSettings( + String identity, UpdateExtensionSettings updateExtensionSettings) async { + await _fetch( + () => _dio.put("$_apiPrefix/extensions/$identity/settings", + data: updateExtensionSettings), + null); + } + + @override + Future switchExtension( + String identity, SwitchExtension switchExtension) async { + await _fetch( + () => _dio.put("$_apiPrefix/extensions/$identity/switch", + data: switchExtension), + null); + } + + @override + Future deleteExtension(String identity) async { + await _fetch( + () => _dio.delete("$_apiPrefix/extensions/$identity"), null); + } + + @override + Future upgradeCheckExtension( + String identity) async { + return _fetch( + () => _dio.get("$_apiPrefix/extensions/$identity/upgrade"), + (data) => UpdateCheckExtensionResp.fromJson(data)); + } + + @override + Future upgradeExtension(String identity) async { + await _fetch( + () => _dio.post("$_apiPrefix/extensions/$identity/upgrade"), null); + } + + @override + Future close() async { + throw UnimplementedError(); + } + + // To avoid CORS, use a backend proxy to forward the request + @override + Future> proxyRequest(String uri, + {data, Options? options}) async { + options ??= Options(); + options.headers ??= {}; + options.headers!["X-Target-Uri"] = uri; + + // add timestamp to avoid cache + return _dio.request( + "/api/v1/proxy?t=${DateTime.now().millisecondsSinceEpoch}", + data: data, + options: options); + } + + String join(String path) { + return "${_dio.options.baseUrl}/${Util.cleanPath(path)}"; + } +} diff --git a/ui/flutter/lib/core/libgopeed_boot.dart b/ui/flutter/lib/api/libgopeed_boot.dart similarity index 72% rename from ui/flutter/lib/core/libgopeed_boot.dart rename to ui/flutter/lib/api/libgopeed_boot.dart index 98bf3dc8..a3d82588 100644 --- a/ui/flutter/lib/core/libgopeed_boot.dart +++ b/ui/flutter/lib/api/libgopeed_boot.dart @@ -1,9 +1,9 @@ -import 'common/start_config.dart'; import "libgopeed_boot_stub.dart" if (dart.library.html) 'entry/libgopeed_boot_browser.dart' if (dart.library.io) 'entry/libgopeed_boot_native.dart'; +import 'native/libgopeed_interface.dart'; -abstract class LibgopeedBoot { +abstract class LibgopeedBoot implements LibgopeedApi { static LibgopeedBoot? _instance; static LibgopeedBoot get instance { @@ -12,8 +12,4 @@ abstract class LibgopeedBoot { } factory LibgopeedBoot() => create(); - - Future start(StartConfig cfg); - - Future stop(); } diff --git a/ui/flutter/lib/core/libgopeed_boot_stub.dart b/ui/flutter/lib/api/libgopeed_boot_stub.dart similarity index 100% rename from ui/flutter/lib/core/libgopeed_boot_stub.dart rename to ui/flutter/lib/api/libgopeed_boot_stub.dart diff --git a/ui/flutter/lib/api/model/create_task_batch.dart b/ui/flutter/lib/api/model/create_task_batch.dart new file mode 100644 index 00000000..e6e5c6b5 --- /dev/null +++ b/ui/flutter/lib/api/model/create_task_batch.dart @@ -0,0 +1,20 @@ +import 'package:gopeed/api/model/extension.dart'; +import 'package:gopeed/api/model/request.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'create_task_batch.g.dart'; + +@JsonSerializable() +class CreateTaskBatch { + List reqs; + Option? opt; + + CreateTaskBatch({ + this.reqs = const [], + this.opt, + }); + + factory CreateTaskBatch.fromJson(Map json) => + _$CreateTaskBatchFromJson(json); + Map toJson() => _$CreateTaskBatchToJson(this); +} diff --git a/ui/flutter/lib/api/model/create_task_batch.g.dart b/ui/flutter/lib/api/model/create_task_batch.g.dart new file mode 100644 index 00000000..20867fe0 --- /dev/null +++ b/ui/flutter/lib/api/model/create_task_batch.g.dart @@ -0,0 +1,33 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'create_task_batch.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +CreateTaskBatch _$CreateTaskBatchFromJson(Map json) => + CreateTaskBatch( + reqs: (json['reqs'] as List?) + ?.map((e) => Request.fromJson(e as Map)) + .toList() ?? + const [], + opt: json['opt'] == null + ? null + : Option.fromJson(json['opt'] as Map), + ); + +Map _$CreateTaskBatchToJson(CreateTaskBatch instance) { + final val = { + 'reqs': instance.reqs, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('opt', instance.opt); + return val; +} diff --git a/ui/flutter/lib/api/model/http_listen_result.dart b/ui/flutter/lib/api/model/http_listen_result.dart new file mode 100644 index 00000000..a875c7fc --- /dev/null +++ b/ui/flutter/lib/api/model/http_listen_result.dart @@ -0,0 +1,18 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'http_listen_result.g.dart'; + +@JsonSerializable() +class HttpListenResult { + String host; + int port; + + HttpListenResult({ + this.host = '', + this.port = 0, + }); + + factory HttpListenResult.fromJson(Map json) => + _$HttpListenResultFromJson(json); + Map toJson() => _$HttpListenResultToJson(this); +} diff --git a/ui/flutter/lib/api/model/http_listen_result.g.dart b/ui/flutter/lib/api/model/http_listen_result.g.dart new file mode 100644 index 00000000..db3096a0 --- /dev/null +++ b/ui/flutter/lib/api/model/http_listen_result.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'http_listen_result.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +HttpListenResult _$HttpListenResultFromJson(Map json) => + HttpListenResult( + host: json['host'] as String? ?? '', + port: (json['port'] as num?)?.toInt() ?? 0, + ); + +Map _$HttpListenResultToJson(HttpListenResult instance) => + { + 'host': instance.host, + 'port': instance.port, + }; diff --git a/ui/flutter/lib/api/model/info.dart b/ui/flutter/lib/api/model/info.dart new file mode 100644 index 00000000..d7c9f0ce --- /dev/null +++ b/ui/flutter/lib/api/model/info.dart @@ -0,0 +1,23 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'info.g.dart'; + +@JsonSerializable() +class Info { + String version; + String runtime; + String os; + String arch; + bool inDocker; + + Info({ + this.version = '', + this.runtime = '', + this.os = '', + this.arch = '', + this.inDocker = false, + }); + + factory Info.fromJson(Map json) => _$InfoFromJson(json); + Map toJson() => _$InfoToJson(this); +} diff --git a/ui/flutter/lib/api/model/info.g.dart b/ui/flutter/lib/api/model/info.g.dart new file mode 100644 index 00000000..f14e67e0 --- /dev/null +++ b/ui/flutter/lib/api/model/info.g.dart @@ -0,0 +1,23 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'info.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Info _$InfoFromJson(Map json) => Info( + version: json['version'] as String? ?? '', + runtime: json['runtime'] as String? ?? '', + os: json['os'] as String? ?? '', + arch: json['arch'] as String? ?? '', + inDocker: json['inDocker'] as bool? ?? false, + ); + +Map _$InfoToJson(Info instance) => { + 'version': instance.version, + 'runtime': instance.runtime, + 'os': instance.os, + 'arch': instance.arch, + 'inDocker': instance.inDocker, + }; diff --git a/ui/flutter/lib/api/model/options.g.dart b/ui/flutter/lib/api/model/options.g.dart index b496e9fc..40a1a8a4 100644 --- a/ui/flutter/lib/api/model/options.g.dart +++ b/ui/flutter/lib/api/model/options.g.dart @@ -10,7 +10,7 @@ Options _$OptionsFromJson(Map json) => Options( name: json['name'] as String, path: json['path'] as String, selectFiles: (json['selectFiles'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ?? const [], extra: json['extra'], @@ -35,7 +35,7 @@ Map _$OptionsToJson(Options instance) { OptsExtraHttp _$OptsExtraHttpFromJson(Map json) => OptsExtraHttp() - ..connections = json['connections'] as int + ..connections = (json['connections'] as num).toInt() ..autoTorrent = json['autoTorrent'] as bool; Map _$OptsExtraHttpToJson(OptsExtraHttp instance) => diff --git a/ui/flutter/lib/api/model/result.g.dart b/ui/flutter/lib/api/model/result.g.dart index 452a7c7c..03d4f734 100644 --- a/ui/flutter/lib/api/model/result.g.dart +++ b/ui/flutter/lib/api/model/result.g.dart @@ -11,7 +11,7 @@ Result _$ResultFromJson( T Function(Object? json) fromJsonT, ) => Result( - code: json['code'] as int, + code: (json['code'] as num).toInt(), msg: json['msg'] as String?, data: _$nullableGenericFromJson(json['data'], fromJsonT), ); diff --git a/ui/flutter/lib/api/model/task_filter.dart b/ui/flutter/lib/api/model/task_filter.dart new file mode 100644 index 00000000..75400d9b --- /dev/null +++ b/ui/flutter/lib/api/model/task_filter.dart @@ -0,0 +1,17 @@ +import 'package:gopeed/api/model/task.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'task_filter.g.dart'; + +@JsonSerializable() +class TaskFilter { + List? ids; + List? statuses; + List? notStatuses; + + TaskFilter({this.ids, this.statuses, this.notStatuses}); + + factory TaskFilter.fromJson(Map json) => + _$TaskFilterFromJson(json); + Map toJson() => _$TaskFilterToJson(this); +} diff --git a/ui/flutter/lib/api/model/task_filter.g.dart b/ui/flutter/lib/api/model/task_filter.g.dart new file mode 100644 index 00000000..c3f8a0c6 --- /dev/null +++ b/ui/flutter/lib/api/model/task_filter.g.dart @@ -0,0 +1,43 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'task_filter.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +TaskFilter _$TaskFilterFromJson(Map json) => TaskFilter( + ids: (json['ids'] as List?)?.map((e) => e as String).toList(), + statuses: (json['statuses'] as List?) + ?.map((e) => $enumDecode(_$StatusEnumMap, e)) + .toList(), + notStatuses: (json['notStatuses'] as List?) + ?.map((e) => $enumDecode(_$StatusEnumMap, e)) + .toList(), + ); + +Map _$TaskFilterToJson(TaskFilter instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('ids', instance.ids); + writeNotNull( + 'statuses', instance.statuses?.map((e) => _$StatusEnumMap[e]!).toList()); + writeNotNull('notStatuses', + instance.notStatuses?.map((e) => _$StatusEnumMap[e]!).toList()); + return val; +} + +const _$StatusEnumMap = { + Status.ready: 'ready', + Status.running: 'running', + Status.pause: 'pause', + Status.wait: 'wait', + Status.error: 'error', + Status.done: 'done', +}; diff --git a/ui/flutter/lib/api/native/channel/libgopeed_channel.dart b/ui/flutter/lib/api/native/channel/libgopeed_channel.dart new file mode 100644 index 00000000..6c958c10 --- /dev/null +++ b/ui/flutter/lib/api/native/channel/libgopeed_channel.dart @@ -0,0 +1,24 @@ +import 'package:flutter/services.dart'; + +import '../libgopeed_interface.dart'; + +class LibgopeedChannel implements LibgopeedAbi { + static const _channel = MethodChannel('gopeed.com/libgopeed'); + + @override + Future create(String cfg) async { + final result = await _channel.invokeMethod('create', { + 'cfg': cfg, + }); + return result!; + } + + @override + Future invoke(int instance, String params) async { + final result = await _channel.invokeMethod('invoke', { + 'instance': instance, + 'params': params, + }); + return result!; + } +} diff --git a/ui/flutter/lib/api/native/ffi/libgopeed_bind.dart b/ui/flutter/lib/api/native/ffi/libgopeed_bind.dart new file mode 100644 index 00000000..0002e15a --- /dev/null +++ b/ui/flutter/lib/api/native/ffi/libgopeed_bind.dart @@ -0,0 +1,5554 @@ +// AUTO GENERATED FILE, DO NOT EDIT. +// +// Generated by `package:ffigen`. +// ignore_for_file: type=lint +import 'dart:ffi' as ffi; + +/// Bindings to gopeed library. +class LibgopeedBind { + /// Holds the symbol lookup function. + final ffi.Pointer Function(String symbolName) + _lookup; + + /// The symbols are looked up in [dynamicLibrary]. + LibgopeedBind(ffi.DynamicLibrary dynamicLibrary) + : _lookup = dynamicLibrary.lookup; + + /// The symbols are looked up with [lookup]. + LibgopeedBind.fromLookup( + ffi.Pointer Function(String symbolName) + lookup) + : _lookup = lookup; + + void __va_start( + ffi.Pointer arg0, + ) { + return ___va_start( + arg0, + ); + } + + late final ___va_startPtr = + _lookup)>>( + '__va_start'); + late final ___va_start = + ___va_startPtr.asFunction)>(); + + void __security_init_cookie() { + return ___security_init_cookie(); + } + + late final ___security_init_cookiePtr = + _lookup>( + '__security_init_cookie'); + late final ___security_init_cookie = + ___security_init_cookiePtr.asFunction(); + + void __security_check_cookie( + int _StackCookie, + ) { + return ___security_check_cookie( + _StackCookie, + ); + } + + late final ___security_check_cookiePtr = + _lookup>( + '__security_check_cookie'); + late final ___security_check_cookie = + ___security_check_cookiePtr.asFunction(); + + void __report_gsfailure( + int _StackCookie, + ) { + return ___report_gsfailure( + _StackCookie, + ); + } + + late final ___report_gsfailurePtr = + _lookup>( + '__report_gsfailure'); + late final ___report_gsfailure = + ___report_gsfailurePtr.asFunction(); + + late final ffi.Pointer ___security_cookie = + _lookup('__security_cookie'); + + int get __security_cookie => ___security_cookie.value; + + set __security_cookie(int value) => ___security_cookie.value = value; + + void _invalid_parameter_noinfo() { + return __invalid_parameter_noinfo(); + } + + late final __invalid_parameter_noinfoPtr = + _lookup>( + '_invalid_parameter_noinfo'); + late final __invalid_parameter_noinfo = + __invalid_parameter_noinfoPtr.asFunction(); + + void _invalid_parameter_noinfo_noreturn() { + return __invalid_parameter_noinfo_noreturn(); + } + + late final __invalid_parameter_noinfo_noreturnPtr = + _lookup>( + '_invalid_parameter_noinfo_noreturn'); + late final __invalid_parameter_noinfo_noreturn = + __invalid_parameter_noinfo_noreturnPtr.asFunction(); + + void _invoke_watson( + ffi.Pointer _Expression, + ffi.Pointer _FunctionName, + ffi.Pointer _FileName, + int _LineNo, + int _Reserved, + ) { + return __invoke_watson( + _Expression, + _FunctionName, + _FileName, + _LineNo, + _Reserved, + ); + } + + late final __invoke_watsonPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedInt, + ffi.UintPtr)>>('_invoke_watson'); + late final __invoke_watson = __invoke_watsonPtr.asFunction< + void Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer, int, int)>(); + + ffi.Pointer _errno() { + return __errno(); + } + + late final __errnoPtr = + _lookup Function()>>('_errno'); + late final __errno = __errnoPtr.asFunction Function()>(); + + int _set_errno( + int _Value, + ) { + return __set_errno( + _Value, + ); + } + + late final __set_errnoPtr = + _lookup>('_set_errno'); + late final __set_errno = __set_errnoPtr.asFunction(); + + int _get_errno( + ffi.Pointer _Value, + ) { + return __get_errno( + _Value, + ); + } + + late final __get_errnoPtr = + _lookup)>>( + '_get_errno'); + late final __get_errno = + __get_errnoPtr.asFunction)>(); + + int __threadid() { + return ___threadid(); + } + + late final ___threadidPtr = + _lookup>('__threadid'); + late final ___threadid = ___threadidPtr.asFunction(); + + int __threadhandle() { + return ___threadhandle(); + } + + late final ___threadhandlePtr = + _lookup>('__threadhandle'); + late final ___threadhandle = ___threadhandlePtr.asFunction(); + + ffi.Pointer _calloc_base( + int _Count, + int _Size, + ) { + return __calloc_base( + _Count, + _Size, + ); + } + + late final __calloc_basePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Size, ffi.Size)>>('_calloc_base'); + late final __calloc_base = + __calloc_basePtr.asFunction Function(int, int)>(); + + ffi.Pointer calloc( + int _Count, + int _Size, + ) { + return _calloc( + _Count, + _Size, + ); + } + + late final _callocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Size, ffi.Size)>>('calloc'); + late final _calloc = + _callocPtr.asFunction Function(int, int)>(); + + int _callnewh( + int _Size, + ) { + return __callnewh( + _Size, + ); + } + + late final __callnewhPtr = + _lookup>('_callnewh'); + late final __callnewh = __callnewhPtr.asFunction(); + + ffi.Pointer _expand( + ffi.Pointer _Block, + int _Size, + ) { + return __expand( + _Block, + _Size, + ); + } + + late final __expandPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Size)>>('_expand'); + late final __expand = __expandPtr + .asFunction Function(ffi.Pointer, int)>(); + + void _free_base( + ffi.Pointer _Block, + ) { + return __free_base( + _Block, + ); + } + + late final __free_basePtr = + _lookup)>>( + '_free_base'); + late final __free_base = + __free_basePtr.asFunction)>(); + + void free( + ffi.Pointer _Block, + ) { + return _free( + _Block, + ); + } + + late final _freePtr = + _lookup)>>( + 'free'); + late final _free = + _freePtr.asFunction)>(); + + ffi.Pointer _malloc_base( + int _Size, + ) { + return __malloc_base( + _Size, + ); + } + + late final __malloc_basePtr = + _lookup Function(ffi.Size)>>( + '_malloc_base'); + late final __malloc_base = + __malloc_basePtr.asFunction Function(int)>(); + + ffi.Pointer malloc( + int _Size, + ) { + return _malloc( + _Size, + ); + } + + late final _mallocPtr = + _lookup Function(ffi.Size)>>( + 'malloc'); + late final _malloc = + _mallocPtr.asFunction Function(int)>(); + + int _msize_base( + ffi.Pointer _Block, + ) { + return __msize_base( + _Block, + ); + } + + late final __msize_basePtr = + _lookup)>>( + '_msize_base'); + late final __msize_base = + __msize_basePtr.asFunction)>(); + + int _msize( + ffi.Pointer _Block, + ) { + return __msize( + _Block, + ); + } + + late final __msizePtr = + _lookup)>>( + '_msize'); + late final __msize = + __msizePtr.asFunction)>(); + + ffi.Pointer _realloc_base( + ffi.Pointer _Block, + int _Size, + ) { + return __realloc_base( + _Block, + _Size, + ); + } + + late final __realloc_basePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Size)>>('_realloc_base'); + late final __realloc_base = __realloc_basePtr + .asFunction Function(ffi.Pointer, int)>(); + + ffi.Pointer realloc( + ffi.Pointer _Block, + int _Size, + ) { + return _realloc( + _Block, + _Size, + ); + } + + late final _reallocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Size)>>('realloc'); + late final _realloc = _reallocPtr + .asFunction Function(ffi.Pointer, int)>(); + + ffi.Pointer _recalloc_base( + ffi.Pointer _Block, + int _Count, + int _Size, + ) { + return __recalloc_base( + _Block, + _Count, + _Size, + ); + } + + late final __recalloc_basePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Size, ffi.Size)>>('_recalloc_base'); + late final __recalloc_base = __recalloc_basePtr.asFunction< + ffi.Pointer Function(ffi.Pointer, int, int)>(); + + ffi.Pointer _recalloc( + ffi.Pointer _Block, + int _Count, + int _Size, + ) { + return __recalloc( + _Block, + _Count, + _Size, + ); + } + + late final __recallocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Size, ffi.Size)>>('_recalloc'); + late final __recalloc = __recallocPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, int, int)>(); + + void _aligned_free( + ffi.Pointer _Block, + ) { + return __aligned_free( + _Block, + ); + } + + late final __aligned_freePtr = + _lookup)>>( + '_aligned_free'); + late final __aligned_free = + __aligned_freePtr.asFunction)>(); + + ffi.Pointer _aligned_malloc( + int _Size, + int _Alignment, + ) { + return __aligned_malloc( + _Size, + _Alignment, + ); + } + + late final __aligned_mallocPtr = _lookup< + ffi + .NativeFunction Function(ffi.Size, ffi.Size)>>( + '_aligned_malloc'); + late final __aligned_malloc = __aligned_mallocPtr + .asFunction Function(int, int)>(); + + ffi.Pointer _aligned_offset_malloc( + int _Size, + int _Alignment, + int _Offset, + ) { + return __aligned_offset_malloc( + _Size, + _Alignment, + _Offset, + ); + } + + late final __aligned_offset_mallocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Size, ffi.Size, ffi.Size)>>('_aligned_offset_malloc'); + late final __aligned_offset_malloc = __aligned_offset_mallocPtr + .asFunction Function(int, int, int)>(); + + int _aligned_msize( + ffi.Pointer _Block, + int _Alignment, + int _Offset, + ) { + return __aligned_msize( + _Block, + _Alignment, + _Offset, + ); + } + + late final __aligned_msizePtr = _lookup< + ffi.NativeFunction< + ffi.Size Function( + ffi.Pointer, ffi.Size, ffi.Size)>>('_aligned_msize'); + late final __aligned_msize = __aligned_msizePtr + .asFunction, int, int)>(); + + ffi.Pointer _aligned_offset_realloc( + ffi.Pointer _Block, + int _Size, + int _Alignment, + int _Offset, + ) { + return __aligned_offset_realloc( + _Block, + _Size, + _Alignment, + _Offset, + ); + } + + late final __aligned_offset_reallocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Size, + ffi.Size, ffi.Size)>>('_aligned_offset_realloc'); + late final __aligned_offset_realloc = __aligned_offset_reallocPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, int, int, int)>(); + + ffi.Pointer _aligned_offset_recalloc( + ffi.Pointer _Block, + int _Count, + int _Size, + int _Alignment, + int _Offset, + ) { + return __aligned_offset_recalloc( + _Block, + _Count, + _Size, + _Alignment, + _Offset, + ); + } + + late final __aligned_offset_recallocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Size, + ffi.Size, ffi.Size, ffi.Size)>>('_aligned_offset_recalloc'); + late final __aligned_offset_recalloc = + __aligned_offset_recallocPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, int, int, int)>(); + + ffi.Pointer _aligned_realloc( + ffi.Pointer _Block, + int _Size, + int _Alignment, + ) { + return __aligned_realloc( + _Block, + _Size, + _Alignment, + ); + } + + late final __aligned_reallocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Size, ffi.Size)>>('_aligned_realloc'); + late final __aligned_realloc = __aligned_reallocPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, int, int)>(); + + ffi.Pointer _aligned_recalloc( + ffi.Pointer _Block, + int _Count, + int _Size, + int _Alignment, + ) { + return __aligned_recalloc( + _Block, + _Count, + _Size, + _Alignment, + ); + } + + late final __aligned_recallocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Size, + ffi.Size, ffi.Size)>>('_aligned_recalloc'); + late final __aligned_recalloc = __aligned_recallocPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, int, int, int)>(); + + ffi.Pointer bsearch_s( + ffi.Pointer _Key, + ffi.Pointer _Base, + int _NumOfElements, + int _SizeOfElements, + _CoreCrtSecureSearchSortCompareFunction _CompareFunction, + ffi.Pointer _Context, + ) { + return _bsearch_s( + _Key, + _Base, + _NumOfElements, + _SizeOfElements, + _CompareFunction, + _Context, + ); + } + + late final _bsearch_sPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + rsize_t, + rsize_t, + _CoreCrtSecureSearchSortCompareFunction, + ffi.Pointer)>>('bsearch_s'); + late final _bsearch_s = _bsearch_sPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + int, + int, + _CoreCrtSecureSearchSortCompareFunction, + ffi.Pointer)>(); + + void qsort_s( + ffi.Pointer _Base, + int _NumOfElements, + int _SizeOfElements, + _CoreCrtSecureSearchSortCompareFunction _CompareFunction, + ffi.Pointer _Context, + ) { + return _qsort_s( + _Base, + _NumOfElements, + _SizeOfElements, + _CompareFunction, + _Context, + ); + } + + late final _qsort_sPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + rsize_t, + rsize_t, + _CoreCrtSecureSearchSortCompareFunction, + ffi.Pointer)>>('qsort_s'); + late final _qsort_s = _qsort_sPtr.asFunction< + void Function(ffi.Pointer, int, int, + _CoreCrtSecureSearchSortCompareFunction, ffi.Pointer)>(); + + ffi.Pointer bsearch( + ffi.Pointer _Key, + ffi.Pointer _Base, + int _NumOfElements, + int _SizeOfElements, + _CoreCrtNonSecureSearchSortCompareFunction _CompareFunction, + ) { + return _bsearch( + _Key, + _Base, + _NumOfElements, + _SizeOfElements, + _CompareFunction, + ); + } + + late final _bsearchPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Size, + ffi.Size, + _CoreCrtNonSecureSearchSortCompareFunction)>>('bsearch'); + late final _bsearch = _bsearchPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + int, + int, + _CoreCrtNonSecureSearchSortCompareFunction)>(); + + void qsort( + ffi.Pointer _Base, + int _NumOfElements, + int _SizeOfElements, + _CoreCrtNonSecureSearchSortCompareFunction _CompareFunction, + ) { + return _qsort( + _Base, + _NumOfElements, + _SizeOfElements, + _CompareFunction, + ); + } + + late final _qsortPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, ffi.Size, ffi.Size, + _CoreCrtNonSecureSearchSortCompareFunction)>>('qsort'); + late final _qsort = _qsortPtr.asFunction< + void Function(ffi.Pointer, int, int, + _CoreCrtNonSecureSearchSortCompareFunction)>(); + + ffi.Pointer _lfind_s( + ffi.Pointer _Key, + ffi.Pointer _Base, + ffi.Pointer _NumOfElements, + int _SizeOfElements, + _CoreCrtSecureSearchSortCompareFunction _CompareFunction, + ffi.Pointer _Context, + ) { + return __lfind_s( + _Key, + _Base, + _NumOfElements, + _SizeOfElements, + _CompareFunction, + _Context, + ); + } + + late final __lfind_sPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Size, + _CoreCrtSecureSearchSortCompareFunction, + ffi.Pointer)>>('_lfind_s'); + late final __lfind_s = __lfind_sPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + _CoreCrtSecureSearchSortCompareFunction, + ffi.Pointer)>(); + + ffi.Pointer _lfind( + ffi.Pointer _Key, + ffi.Pointer _Base, + ffi.Pointer _NumOfElements, + int _SizeOfElements, + _CoreCrtNonSecureSearchSortCompareFunction _CompareFunction, + ) { + return __lfind( + _Key, + _Base, + _NumOfElements, + _SizeOfElements, + _CompareFunction, + ); + } + + late final __lfindPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedInt, + _CoreCrtNonSecureSearchSortCompareFunction)>>('_lfind'); + late final __lfind = __lfindPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + _CoreCrtNonSecureSearchSortCompareFunction)>(); + + ffi.Pointer _lsearch_s( + ffi.Pointer _Key, + ffi.Pointer _Base, + ffi.Pointer _NumOfElements, + int _SizeOfElements, + _CoreCrtSecureSearchSortCompareFunction _CompareFunction, + ffi.Pointer _Context, + ) { + return __lsearch_s( + _Key, + _Base, + _NumOfElements, + _SizeOfElements, + _CompareFunction, + _Context, + ); + } + + late final __lsearch_sPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Size, + _CoreCrtSecureSearchSortCompareFunction, + ffi.Pointer)>>('_lsearch_s'); + late final __lsearch_s = __lsearch_sPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + _CoreCrtSecureSearchSortCompareFunction, + ffi.Pointer)>(); + + ffi.Pointer _lsearch( + ffi.Pointer _Key, + ffi.Pointer _Base, + ffi.Pointer _NumOfElements, + int _SizeOfElements, + _CoreCrtNonSecureSearchSortCompareFunction _CompareFunction, + ) { + return __lsearch( + _Key, + _Base, + _NumOfElements, + _SizeOfElements, + _CompareFunction, + ); + } + + late final __lsearchPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedInt, + _CoreCrtNonSecureSearchSortCompareFunction)>>('_lsearch'); + late final __lsearch = __lsearchPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + _CoreCrtNonSecureSearchSortCompareFunction)>(); + + ffi.Pointer lfind( + ffi.Pointer _Key, + ffi.Pointer _Base, + ffi.Pointer _NumOfElements, + int _SizeOfElements, + _CoreCrtNonSecureSearchSortCompareFunction _CompareFunction, + ) { + return _lfind1( + _Key, + _Base, + _NumOfElements, + _SizeOfElements, + _CompareFunction, + ); + } + + late final _lfindPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedInt, + _CoreCrtNonSecureSearchSortCompareFunction)>>('lfind'); + late final _lfind1 = _lfindPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + _CoreCrtNonSecureSearchSortCompareFunction)>(); + + ffi.Pointer lsearch( + ffi.Pointer _Key, + ffi.Pointer _Base, + ffi.Pointer _NumOfElements, + int _SizeOfElements, + _CoreCrtNonSecureSearchSortCompareFunction _CompareFunction, + ) { + return _lsearch1( + _Key, + _Base, + _NumOfElements, + _SizeOfElements, + _CompareFunction, + ); + } + + late final _lsearchPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedInt, + _CoreCrtNonSecureSearchSortCompareFunction)>>('lsearch'); + late final _lsearch1 = _lsearchPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + _CoreCrtNonSecureSearchSortCompareFunction)>(); + + int _itow_s( + int _Value, + ffi.Pointer _Buffer, + int _BufferCount, + int _Radix, + ) { + return __itow_s( + _Value, + _Buffer, + _BufferCount, + _Radix, + ); + } + + late final __itow_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function( + ffi.Int, ffi.Pointer, ffi.Size, ffi.Int)>>('_itow_s'); + late final __itow_s = __itow_sPtr + .asFunction, int, int)>(); + + ffi.Pointer _itow( + int _Value, + ffi.Pointer _Buffer, + int _Radix, + ) { + return __itow( + _Value, + _Buffer, + _Radix, + ); + } + + late final __itowPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Int, ffi.Pointer, ffi.Int)>>('_itow'); + late final __itow = __itowPtr.asFunction< + ffi.Pointer Function(int, ffi.Pointer, int)>(); + + int _ltow_s( + int _Value, + ffi.Pointer _Buffer, + int _BufferCount, + int _Radix, + ) { + return __ltow_s( + _Value, + _Buffer, + _BufferCount, + _Radix, + ); + } + + late final __ltow_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function( + ffi.Long, ffi.Pointer, ffi.Size, ffi.Int)>>('_ltow_s'); + late final __ltow_s = __ltow_sPtr + .asFunction, int, int)>(); + + ffi.Pointer _ltow( + int _Value, + ffi.Pointer _Buffer, + int _Radix, + ) { + return __ltow( + _Value, + _Buffer, + _Radix, + ); + } + + late final __ltowPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Long, ffi.Pointer, ffi.Int)>>('_ltow'); + late final __ltow = __ltowPtr.asFunction< + ffi.Pointer Function(int, ffi.Pointer, int)>(); + + int _ultow_s( + int _Value, + ffi.Pointer _Buffer, + int _BufferCount, + int _Radix, + ) { + return __ultow_s( + _Value, + _Buffer, + _BufferCount, + _Radix, + ); + } + + late final __ultow_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function(ffi.UnsignedLong, ffi.Pointer, ffi.Size, + ffi.Int)>>('_ultow_s'); + late final __ultow_s = __ultow_sPtr + .asFunction, int, int)>(); + + ffi.Pointer _ultow( + int _Value, + ffi.Pointer _Buffer, + int _Radix, + ) { + return __ultow( + _Value, + _Buffer, + _Radix, + ); + } + + late final __ultowPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.UnsignedLong, ffi.Pointer, ffi.Int)>>('_ultow'); + late final __ultow = __ultowPtr.asFunction< + ffi.Pointer Function(int, ffi.Pointer, int)>(); + + double wcstod( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + ) { + return _wcstod( + _String, + _EndPtr, + ); + } + + late final _wcstodPtr = _lookup< + ffi.NativeFunction< + ffi.Double Function(ffi.Pointer, + ffi.Pointer>)>>('wcstod'); + late final _wcstod = _wcstodPtr.asFunction< + double Function( + ffi.Pointer, ffi.Pointer>)>(); + + double _wcstod_l( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + _locale_t _Locale, + ) { + return __wcstod_l( + _String, + _EndPtr, + _Locale, + ); + } + + late final __wcstod_lPtr = _lookup< + ffi.NativeFunction< + ffi.Double Function(ffi.Pointer, + ffi.Pointer>, _locale_t)>>('_wcstod_l'); + late final __wcstod_l = __wcstod_lPtr.asFunction< + double Function(ffi.Pointer, + ffi.Pointer>, _locale_t)>(); + + int wcstol( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + int _Radix, + ) { + return _wcstol( + _String, + _EndPtr, + _Radix, + ); + } + + late final _wcstolPtr = _lookup< + ffi.NativeFunction< + ffi.Long Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('wcstol'); + late final _wcstol = _wcstolPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + int _wcstol_l( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + int _Radix, + _locale_t _Locale, + ) { + return __wcstol_l( + _String, + _EndPtr, + _Radix, + _Locale, + ); + } + + late final __wcstol_lPtr = _lookup< + ffi.NativeFunction< + ffi.Long Function( + ffi.Pointer, + ffi.Pointer>, + ffi.Int, + _locale_t)>>('_wcstol_l'); + late final __wcstol_l = __wcstol_lPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer>, + int, _locale_t)>(); + + int wcstoll( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + int _Radix, + ) { + return _wcstoll( + _String, + _EndPtr, + _Radix, + ); + } + + late final _wcstollPtr = _lookup< + ffi.NativeFunction< + ffi.LongLong Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('wcstoll'); + late final _wcstoll = _wcstollPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + int _wcstoll_l( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + int _Radix, + _locale_t _Locale, + ) { + return __wcstoll_l( + _String, + _EndPtr, + _Radix, + _Locale, + ); + } + + late final __wcstoll_lPtr = _lookup< + ffi.NativeFunction< + ffi.LongLong Function( + ffi.Pointer, + ffi.Pointer>, + ffi.Int, + _locale_t)>>('_wcstoll_l'); + late final __wcstoll_l = __wcstoll_lPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer>, + int, _locale_t)>(); + + int wcstoul( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + int _Radix, + ) { + return _wcstoul( + _String, + _EndPtr, + _Radix, + ); + } + + late final _wcstoulPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLong Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('wcstoul'); + late final _wcstoul = _wcstoulPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + int _wcstoul_l( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + int _Radix, + _locale_t _Locale, + ) { + return __wcstoul_l( + _String, + _EndPtr, + _Radix, + _Locale, + ); + } + + late final __wcstoul_lPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLong Function( + ffi.Pointer, + ffi.Pointer>, + ffi.Int, + _locale_t)>>('_wcstoul_l'); + late final __wcstoul_l = __wcstoul_lPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer>, + int, _locale_t)>(); + + int wcstoull( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + int _Radix, + ) { + return _wcstoull( + _String, + _EndPtr, + _Radix, + ); + } + + late final _wcstoullPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLongLong Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('wcstoull'); + late final _wcstoull = _wcstoullPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + int _wcstoull_l( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + int _Radix, + _locale_t _Locale, + ) { + return __wcstoull_l( + _String, + _EndPtr, + _Radix, + _Locale, + ); + } + + late final __wcstoull_lPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLongLong Function( + ffi.Pointer, + ffi.Pointer>, + ffi.Int, + _locale_t)>>('_wcstoull_l'); + late final __wcstoull_l = __wcstoull_lPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer>, + int, _locale_t)>(); + + double wcstof( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + ) { + return _wcstof( + _String, + _EndPtr, + ); + } + + late final _wcstofPtr = _lookup< + ffi.NativeFunction< + ffi.Float Function(ffi.Pointer, + ffi.Pointer>)>>('wcstof'); + late final _wcstof = _wcstofPtr.asFunction< + double Function( + ffi.Pointer, ffi.Pointer>)>(); + + double _wcstof_l( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + _locale_t _Locale, + ) { + return __wcstof_l( + _String, + _EndPtr, + _Locale, + ); + } + + late final __wcstof_lPtr = _lookup< + ffi.NativeFunction< + ffi.Float Function(ffi.Pointer, + ffi.Pointer>, _locale_t)>>('_wcstof_l'); + late final __wcstof_l = __wcstof_lPtr.asFunction< + double Function(ffi.Pointer, + ffi.Pointer>, _locale_t)>(); + + double _wtof( + ffi.Pointer _String, + ) { + return __wtof( + _String, + ); + } + + late final __wtofPtr = + _lookup)>>( + '_wtof'); + late final __wtof = + __wtofPtr.asFunction)>(); + + double _wtof_l( + ffi.Pointer _String, + _locale_t _Locale, + ) { + return __wtof_l( + _String, + _Locale, + ); + } + + late final __wtof_lPtr = _lookup< + ffi.NativeFunction< + ffi.Double Function(ffi.Pointer, _locale_t)>>('_wtof_l'); + late final __wtof_l = __wtof_lPtr + .asFunction, _locale_t)>(); + + int _wtoi( + ffi.Pointer _String, + ) { + return __wtoi( + _String, + ); + } + + late final __wtoiPtr = + _lookup)>>( + '_wtoi'); + late final __wtoi = + __wtoiPtr.asFunction)>(); + + int _wtoi_l( + ffi.Pointer _String, + _locale_t _Locale, + ) { + return __wtoi_l( + _String, + _Locale, + ); + } + + late final __wtoi_lPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, _locale_t)>>('_wtoi_l'); + late final __wtoi_l = + __wtoi_lPtr.asFunction, _locale_t)>(); + + int _wtol( + ffi.Pointer _String, + ) { + return __wtol( + _String, + ); + } + + late final __wtolPtr = + _lookup)>>( + '_wtol'); + late final __wtol = + __wtolPtr.asFunction)>(); + + int _wtol_l( + ffi.Pointer _String, + _locale_t _Locale, + ) { + return __wtol_l( + _String, + _Locale, + ); + } + + late final __wtol_lPtr = _lookup< + ffi.NativeFunction< + ffi.Long Function(ffi.Pointer, _locale_t)>>('_wtol_l'); + late final __wtol_l = + __wtol_lPtr.asFunction, _locale_t)>(); + + int _wtoll( + ffi.Pointer _String, + ) { + return __wtoll( + _String, + ); + } + + late final __wtollPtr = _lookup< + ffi + .NativeFunction)>>('_wtoll'); + late final __wtoll = + __wtollPtr.asFunction)>(); + + int _wtoll_l( + ffi.Pointer _String, + _locale_t _Locale, + ) { + return __wtoll_l( + _String, + _Locale, + ); + } + + late final __wtoll_lPtr = _lookup< + ffi.NativeFunction< + ffi.LongLong Function( + ffi.Pointer, _locale_t)>>('_wtoll_l'); + late final __wtoll_l = __wtoll_lPtr + .asFunction, _locale_t)>(); + + int _i64tow_s( + int _Value, + ffi.Pointer _Buffer, + int _BufferCount, + int _Radix, + ) { + return __i64tow_s( + _Value, + _Buffer, + _BufferCount, + _Radix, + ); + } + + late final __i64tow_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function(ffi.LongLong, ffi.Pointer, ffi.Size, + ffi.Int)>>('_i64tow_s'); + late final __i64tow_s = __i64tow_sPtr + .asFunction, int, int)>(); + + ffi.Pointer _i64tow( + int _Value, + ffi.Pointer _Buffer, + int _Radix, + ) { + return __i64tow( + _Value, + _Buffer, + _Radix, + ); + } + + late final __i64towPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.LongLong, ffi.Pointer, ffi.Int)>>('_i64tow'); + late final __i64tow = __i64towPtr.asFunction< + ffi.Pointer Function(int, ffi.Pointer, int)>(); + + int _ui64tow_s( + int _Value, + ffi.Pointer _Buffer, + int _BufferCount, + int _Radix, + ) { + return __ui64tow_s( + _Value, + _Buffer, + _BufferCount, + _Radix, + ); + } + + late final __ui64tow_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function(ffi.UnsignedLongLong, ffi.Pointer, + ffi.Size, ffi.Int)>>('_ui64tow_s'); + late final __ui64tow_s = __ui64tow_sPtr + .asFunction, int, int)>(); + + ffi.Pointer _ui64tow( + int _Value, + ffi.Pointer _Buffer, + int _Radix, + ) { + return __ui64tow( + _Value, + _Buffer, + _Radix, + ); + } + + late final __ui64towPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.UnsignedLongLong, + ffi.Pointer, ffi.Int)>>('_ui64tow'); + late final __ui64tow = __ui64towPtr.asFunction< + ffi.Pointer Function(int, ffi.Pointer, int)>(); + + int _wtoi64( + ffi.Pointer _String, + ) { + return __wtoi64( + _String, + ); + } + + late final __wtoi64Ptr = _lookup< + ffi.NativeFunction)>>( + '_wtoi64'); + late final __wtoi64 = + __wtoi64Ptr.asFunction)>(); + + int _wtoi64_l( + ffi.Pointer _String, + _locale_t _Locale, + ) { + return __wtoi64_l( + _String, + _Locale, + ); + } + + late final __wtoi64_lPtr = _lookup< + ffi.NativeFunction< + ffi.LongLong Function( + ffi.Pointer, _locale_t)>>('_wtoi64_l'); + late final __wtoi64_l = __wtoi64_lPtr + .asFunction, _locale_t)>(); + + int _wcstoi64( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + int _Radix, + ) { + return __wcstoi64( + _String, + _EndPtr, + _Radix, + ); + } + + late final __wcstoi64Ptr = _lookup< + ffi.NativeFunction< + ffi.LongLong Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('_wcstoi64'); + late final __wcstoi64 = __wcstoi64Ptr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + int _wcstoi64_l( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + int _Radix, + _locale_t _Locale, + ) { + return __wcstoi64_l( + _String, + _EndPtr, + _Radix, + _Locale, + ); + } + + late final __wcstoi64_lPtr = _lookup< + ffi.NativeFunction< + ffi.LongLong Function( + ffi.Pointer, + ffi.Pointer>, + ffi.Int, + _locale_t)>>('_wcstoi64_l'); + late final __wcstoi64_l = __wcstoi64_lPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer>, + int, _locale_t)>(); + + int _wcstoui64( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + int _Radix, + ) { + return __wcstoui64( + _String, + _EndPtr, + _Radix, + ); + } + + late final __wcstoui64Ptr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLongLong Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('_wcstoui64'); + late final __wcstoui64 = __wcstoui64Ptr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + int _wcstoui64_l( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + int _Radix, + _locale_t _Locale, + ) { + return __wcstoui64_l( + _String, + _EndPtr, + _Radix, + _Locale, + ); + } + + late final __wcstoui64_lPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLongLong Function( + ffi.Pointer, + ffi.Pointer>, + ffi.Int, + _locale_t)>>('_wcstoui64_l'); + late final __wcstoui64_l = __wcstoui64_lPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer>, + int, _locale_t)>(); + + ffi.Pointer _wfullpath( + ffi.Pointer _Buffer, + ffi.Pointer _Path, + int _BufferCount, + ) { + return __wfullpath( + _Buffer, + _Path, + _BufferCount, + ); + } + + late final __wfullpathPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Size)>>('_wfullpath'); + late final __wfullpath = __wfullpathPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer, int)>(); + + int _wmakepath_s( + ffi.Pointer _Buffer, + int _BufferCount, + ffi.Pointer _Drive, + ffi.Pointer _Dir, + ffi.Pointer _Filename, + ffi.Pointer _Ext, + ) { + return __wmakepath_s( + _Buffer, + _BufferCount, + _Drive, + _Dir, + _Filename, + _Ext, + ); + } + + late final __wmakepath_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function( + ffi.Pointer, + ffi.Size, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>('_wmakepath_s'); + late final __wmakepath_s = __wmakepath_sPtr.asFunction< + int Function( + ffi.Pointer, + int, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(); + + void _wmakepath( + ffi.Pointer _Buffer, + ffi.Pointer _Drive, + ffi.Pointer _Dir, + ffi.Pointer _Filename, + ffi.Pointer _Ext, + ) { + return __wmakepath( + _Buffer, + _Drive, + _Dir, + _Filename, + _Ext, + ); + } + + late final __wmakepathPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>('_wmakepath'); + late final __wmakepath = __wmakepathPtr.asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(); + + void _wperror( + ffi.Pointer _ErrorMessage, + ) { + return __wperror( + _ErrorMessage, + ); + } + + late final __wperrorPtr = + _lookup)>>( + '_wperror'); + late final __wperror = + __wperrorPtr.asFunction)>(); + + void _wsplitpath( + ffi.Pointer _FullPath, + ffi.Pointer _Drive, + ffi.Pointer _Dir, + ffi.Pointer _Filename, + ffi.Pointer _Ext, + ) { + return __wsplitpath( + _FullPath, + _Drive, + _Dir, + _Filename, + _Ext, + ); + } + + late final __wsplitpathPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>('_wsplitpath'); + late final __wsplitpath = __wsplitpathPtr.asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(); + + int _wsplitpath_s( + ffi.Pointer _FullPath, + ffi.Pointer _Drive, + int _DriveCount, + ffi.Pointer _Dir, + int _DirCount, + ffi.Pointer _Filename, + int _FilenameCount, + ffi.Pointer _Ext, + int _ExtCount, + ) { + return __wsplitpath_s( + _FullPath, + _Drive, + _DriveCount, + _Dir, + _DirCount, + _Filename, + _FilenameCount, + _Ext, + _ExtCount, + ); + } + + late final __wsplitpath_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function( + ffi.Pointer, + ffi.Pointer, + ffi.Size, + ffi.Pointer, + ffi.Size, + ffi.Pointer, + ffi.Size, + ffi.Pointer, + ffi.Size)>>('_wsplitpath_s'); + late final __wsplitpath_s = __wsplitpath_sPtr.asFunction< + int Function( + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer, + int, + ffi.Pointer, + int, + ffi.Pointer, + int)>(); + + int _wdupenv_s( + ffi.Pointer> _Buffer, + ffi.Pointer _BufferCount, + ffi.Pointer _VarName, + ) { + return __wdupenv_s( + _Buffer, + _BufferCount, + _VarName, + ); + } + + late final __wdupenv_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function(ffi.Pointer>, + ffi.Pointer, ffi.Pointer)>>('_wdupenv_s'); + late final __wdupenv_s = __wdupenv_sPtr.asFunction< + int Function(ffi.Pointer>, ffi.Pointer, + ffi.Pointer)>(); + + ffi.Pointer _wgetenv( + ffi.Pointer _VarName, + ) { + return __wgetenv( + _VarName, + ); + } + + late final __wgetenvPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('_wgetenv'); + late final __wgetenv = __wgetenvPtr + .asFunction Function(ffi.Pointer)>(); + + int _wgetenv_s( + ffi.Pointer _RequiredCount, + ffi.Pointer _Buffer, + int _BufferCount, + ffi.Pointer _VarName, + ) { + return __wgetenv_s( + _RequiredCount, + _Buffer, + _BufferCount, + _VarName, + ); + } + + late final __wgetenv_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function(ffi.Pointer, ffi.Pointer, + ffi.Size, ffi.Pointer)>>('_wgetenv_s'); + late final __wgetenv_s = __wgetenv_sPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int, + ffi.Pointer)>(); + + int _wputenv( + ffi.Pointer _EnvString, + ) { + return __wputenv( + _EnvString, + ); + } + + late final __wputenvPtr = + _lookup)>>( + '_wputenv'); + late final __wputenv = + __wputenvPtr.asFunction)>(); + + int _wputenv_s( + ffi.Pointer _Name, + ffi.Pointer _Value, + ) { + return __wputenv_s( + _Name, + _Value, + ); + } + + late final __wputenv_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function( + ffi.Pointer, ffi.Pointer)>>('_wputenv_s'); + late final __wputenv_s = __wputenv_sPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer)>(); + + int _wsearchenv_s( + ffi.Pointer _Filename, + ffi.Pointer _VarName, + ffi.Pointer _Buffer, + int _BufferCount, + ) { + return __wsearchenv_s( + _Filename, + _VarName, + _Buffer, + _BufferCount, + ); + } + + late final __wsearchenv_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer, ffi.Size)>>('_wsearchenv_s'); + late final __wsearchenv_s = __wsearchenv_sPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer, int)>(); + + void _wsearchenv( + ffi.Pointer _Filename, + ffi.Pointer _VarName, + ffi.Pointer _ResultPath, + ) { + return __wsearchenv( + _Filename, + _VarName, + _ResultPath, + ); + } + + late final __wsearchenvPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer)>>('_wsearchenv'); + late final __wsearchenv = __wsearchenvPtr.asFunction< + void Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer)>(); + + int _wsystem( + ffi.Pointer _Command, + ) { + return __wsystem( + _Command, + ); + } + + late final __wsystemPtr = + _lookup)>>( + '_wsystem'); + late final __wsystem = + __wsystemPtr.asFunction)>(); + + void _swab( + ffi.Pointer _Buf1, + ffi.Pointer _Buf2, + int _SizeInBytes, + ) { + return __swab( + _Buf1, + _Buf2, + _SizeInBytes, + ); + } + + late final __swabPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, ffi.Pointer, ffi.Int)>>('_swab'); + late final __swab = __swabPtr.asFunction< + void Function(ffi.Pointer, ffi.Pointer, int)>(); + + void exit( + int _Code, + ) { + return _exit1( + _Code, + ); + } + + late final _exitPtr = + _lookup>('exit'); + late final _exit1 = _exitPtr.asFunction(); + + void _exit( + int _Code, + ) { + return __exit( + _Code, + ); + } + + late final __exitPtr = + _lookup>('_exit'); + late final __exit = __exitPtr.asFunction(); + + void _Exit( + int _Code, + ) { + return __Exit( + _Code, + ); + } + + late final __ExitPtr = + _lookup>('_Exit'); + late final __Exit = __ExitPtr.asFunction(); + + void quick_exit( + int _Code, + ) { + return _quick_exit( + _Code, + ); + } + + late final _quick_exitPtr = + _lookup>('quick_exit'); + late final _quick_exit = _quick_exitPtr.asFunction(); + + void abort() { + return _abort(); + } + + late final _abortPtr = + _lookup>('abort'); + late final _abort = _abortPtr.asFunction(); + + int _set_abort_behavior( + int _Flags, + int _Mask, + ) { + return __set_abort_behavior( + _Flags, + _Mask, + ); + } + + late final __set_abort_behaviorPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedInt Function( + ffi.UnsignedInt, ffi.UnsignedInt)>>('_set_abort_behavior'); + late final __set_abort_behavior = + __set_abort_behaviorPtr.asFunction(); + + int atexit( + ffi.Pointer> arg0, + ) { + return _atexit( + arg0, + ); + } + + late final _atexitPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer>)>>('atexit'); + late final _atexit = _atexitPtr.asFunction< + int Function(ffi.Pointer>)>(); + + _onexit_t _onexit( + _onexit_t _Func, + ) { + return __onexit( + _Func, + ); + } + + late final __onexitPtr = + _lookup>('_onexit'); + late final __onexit = __onexitPtr.asFunction<_onexit_t Function(_onexit_t)>(); + + int at_quick_exit( + ffi.Pointer> arg0, + ) { + return _at_quick_exit( + arg0, + ); + } + + late final _at_quick_exitPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer>)>>( + 'at_quick_exit'); + late final _at_quick_exit = _at_quick_exitPtr.asFunction< + int Function(ffi.Pointer>)>(); + + _purecall_handler _set_purecall_handler( + _purecall_handler _Handler, + ) { + return __set_purecall_handler( + _Handler, + ); + } + + late final __set_purecall_handlerPtr = _lookup< + ffi.NativeFunction<_purecall_handler Function(_purecall_handler)>>( + '_set_purecall_handler'); + late final __set_purecall_handler = __set_purecall_handlerPtr + .asFunction<_purecall_handler Function(_purecall_handler)>(); + + _purecall_handler _get_purecall_handler() { + return __get_purecall_handler(); + } + + late final __get_purecall_handlerPtr = + _lookup>( + '_get_purecall_handler'); + late final __get_purecall_handler = + __get_purecall_handlerPtr.asFunction<_purecall_handler Function()>(); + + _invalid_parameter_handler _set_invalid_parameter_handler( + _invalid_parameter_handler _Handler, + ) { + return __set_invalid_parameter_handler( + _Handler, + ); + } + + late final __set_invalid_parameter_handlerPtr = _lookup< + ffi.NativeFunction< + _invalid_parameter_handler Function( + _invalid_parameter_handler)>>('_set_invalid_parameter_handler'); + late final __set_invalid_parameter_handler = + __set_invalid_parameter_handlerPtr.asFunction< + _invalid_parameter_handler Function(_invalid_parameter_handler)>(); + + _invalid_parameter_handler _get_invalid_parameter_handler() { + return __get_invalid_parameter_handler(); + } + + late final __get_invalid_parameter_handlerPtr = + _lookup>( + '_get_invalid_parameter_handler'); + late final __get_invalid_parameter_handler = + __get_invalid_parameter_handlerPtr + .asFunction<_invalid_parameter_handler Function()>(); + + _invalid_parameter_handler _set_thread_local_invalid_parameter_handler( + _invalid_parameter_handler _Handler, + ) { + return __set_thread_local_invalid_parameter_handler( + _Handler, + ); + } + + late final __set_thread_local_invalid_parameter_handlerPtr = _lookup< + ffi.NativeFunction< + _invalid_parameter_handler Function(_invalid_parameter_handler)>>( + '_set_thread_local_invalid_parameter_handler'); + late final __set_thread_local_invalid_parameter_handler = + __set_thread_local_invalid_parameter_handlerPtr.asFunction< + _invalid_parameter_handler Function(_invalid_parameter_handler)>(); + + _invalid_parameter_handler _get_thread_local_invalid_parameter_handler() { + return __get_thread_local_invalid_parameter_handler(); + } + + late final __get_thread_local_invalid_parameter_handlerPtr = + _lookup>( + '_get_thread_local_invalid_parameter_handler'); + late final __get_thread_local_invalid_parameter_handler = + __get_thread_local_invalid_parameter_handlerPtr + .asFunction<_invalid_parameter_handler Function()>(); + + int _set_error_mode( + int _Mode, + ) { + return __set_error_mode( + _Mode, + ); + } + + late final __set_error_modePtr = + _lookup>('_set_error_mode'); + late final __set_error_mode = + __set_error_modePtr.asFunction(); + + ffi.Pointer __doserrno() { + return ___doserrno(); + } + + late final ___doserrnoPtr = + _lookup Function()>>( + '__doserrno'); + late final ___doserrno = + ___doserrnoPtr.asFunction Function()>(); + + int _set_doserrno( + int _Value, + ) { + return __set_doserrno( + _Value, + ); + } + + late final __set_doserrnoPtr = + _lookup>( + '_set_doserrno'); + late final __set_doserrno = __set_doserrnoPtr.asFunction(); + + int _get_doserrno( + ffi.Pointer _Value, + ) { + return __get_doserrno( + _Value, + ); + } + + late final __get_doserrnoPtr = _lookup< + ffi.NativeFunction)>>( + '_get_doserrno'); + late final __get_doserrno = __get_doserrnoPtr + .asFunction)>(); + + ffi.Pointer> __sys_errlist() { + return ___sys_errlist(); + } + + late final ___sys_errlistPtr = _lookup< + ffi.NativeFunction> Function()>>( + '__sys_errlist'); + late final ___sys_errlist = ___sys_errlistPtr + .asFunction> Function()>(); + + ffi.Pointer __sys_nerr() { + return ___sys_nerr(); + } + + late final ___sys_nerrPtr = + _lookup Function()>>( + '__sys_nerr'); + late final ___sys_nerr = + ___sys_nerrPtr.asFunction Function()>(); + + void perror( + ffi.Pointer _ErrMsg, + ) { + return _perror( + _ErrMsg, + ); + } + + late final _perrorPtr = + _lookup)>>( + 'perror'); + late final _perror = + _perrorPtr.asFunction)>(); + + ffi.Pointer> __p__pgmptr() { + return ___p__pgmptr(); + } + + late final ___p__pgmptrPtr = _lookup< + ffi.NativeFunction> Function()>>( + '__p__pgmptr'); + late final ___p__pgmptr = ___p__pgmptrPtr + .asFunction> Function()>(); + + ffi.Pointer> __p__wpgmptr() { + return ___p__wpgmptr(); + } + + late final ___p__wpgmptrPtr = _lookup< + ffi.NativeFunction> Function()>>( + '__p__wpgmptr'); + late final ___p__wpgmptr = ___p__wpgmptrPtr + .asFunction> Function()>(); + + ffi.Pointer __p__fmode() { + return ___p__fmode(); + } + + late final ___p__fmodePtr = + _lookup Function()>>( + '__p__fmode'); + late final ___p__fmode = + ___p__fmodePtr.asFunction Function()>(); + + int _get_pgmptr( + ffi.Pointer> _Value, + ) { + return __get_pgmptr( + _Value, + ); + } + + late final __get_pgmptrPtr = _lookup< + ffi.NativeFunction< + errno_t Function(ffi.Pointer>)>>('_get_pgmptr'); + late final __get_pgmptr = __get_pgmptrPtr + .asFunction>)>(); + + int _get_wpgmptr( + ffi.Pointer> _Value, + ) { + return __get_wpgmptr( + _Value, + ); + } + + late final __get_wpgmptrPtr = _lookup< + ffi.NativeFunction< + errno_t Function( + ffi.Pointer>)>>('_get_wpgmptr'); + late final __get_wpgmptr = __get_wpgmptrPtr + .asFunction>)>(); + + int _set_fmode( + int _Mode, + ) { + return __set_fmode( + _Mode, + ); + } + + late final __set_fmodePtr = + _lookup>('_set_fmode'); + late final __set_fmode = __set_fmodePtr.asFunction(); + + int _get_fmode( + ffi.Pointer _PMode, + ) { + return __get_fmode( + _PMode, + ); + } + + late final __get_fmodePtr = + _lookup)>>( + '_get_fmode'); + late final __get_fmode = + __get_fmodePtr.asFunction)>(); + + int abs( + int _Number, + ) { + return _abs( + _Number, + ); + } + + late final _absPtr = + _lookup>('abs'); + late final _abs = _absPtr.asFunction(); + + int labs( + int _Number, + ) { + return _labs( + _Number, + ); + } + + late final _labsPtr = + _lookup>('labs'); + late final _labs = _labsPtr.asFunction(); + + int llabs( + int _Number, + ) { + return _llabs( + _Number, + ); + } + + late final _llabsPtr = + _lookup>('llabs'); + late final _llabs = _llabsPtr.asFunction(); + + int _abs64( + int _Number, + ) { + return __abs64( + _Number, + ); + } + + late final __abs64Ptr = + _lookup>( + '_abs64'); + late final __abs64 = __abs64Ptr.asFunction(); + + int _byteswap_ushort( + int _Number, + ) { + return __byteswap_ushort( + _Number, + ); + } + + late final __byteswap_ushortPtr = _lookup< + ffi.NativeFunction>( + '_byteswap_ushort'); + late final __byteswap_ushort = + __byteswap_ushortPtr.asFunction(); + + int _byteswap_ulong( + int _Number, + ) { + return __byteswap_ulong( + _Number, + ); + } + + late final __byteswap_ulongPtr = + _lookup>( + '_byteswap_ulong'); + late final __byteswap_ulong = + __byteswap_ulongPtr.asFunction(); + + int _byteswap_uint64( + int _Number, + ) { + return __byteswap_uint64( + _Number, + ); + } + + late final __byteswap_uint64Ptr = _lookup< + ffi + .NativeFunction>( + '_byteswap_uint64'); + late final __byteswap_uint64 = + __byteswap_uint64Ptr.asFunction(); + + div_t div( + int _Numerator, + int _Denominator, + ) { + return _div( + _Numerator, + _Denominator, + ); + } + + late final _divPtr = + _lookup>('div'); + late final _div = _divPtr.asFunction(); + + ldiv_t ldiv( + int _Numerator, + int _Denominator, + ) { + return _ldiv( + _Numerator, + _Denominator, + ); + } + + late final _ldivPtr = + _lookup>('ldiv'); + late final _ldiv = _ldivPtr.asFunction(); + + lldiv_t lldiv( + int _Numerator, + int _Denominator, + ) { + return _lldiv( + _Numerator, + _Denominator, + ); + } + + late final _lldivPtr = + _lookup>( + 'lldiv'); + late final _lldiv = _lldivPtr.asFunction(); + + int _rotl( + int _Value, + int _Shift, + ) { + return __rotl( + _Value, + _Shift, + ); + } + + late final __rotlPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedInt Function(ffi.UnsignedInt, ffi.Int)>>('_rotl'); + late final __rotl = __rotlPtr.asFunction(); + + int _lrotl( + int _Value, + int _Shift, + ) { + return __lrotl( + _Value, + _Shift, + ); + } + + late final __lrotlPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLong Function(ffi.UnsignedLong, ffi.Int)>>('_lrotl'); + late final __lrotl = __lrotlPtr.asFunction(); + + int _rotl64( + int _Value, + int _Shift, + ) { + return __rotl64( + _Value, + _Shift, + ); + } + + late final __rotl64Ptr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLongLong Function( + ffi.UnsignedLongLong, ffi.Int)>>('_rotl64'); + late final __rotl64 = __rotl64Ptr.asFunction(); + + int _rotr( + int _Value, + int _Shift, + ) { + return __rotr( + _Value, + _Shift, + ); + } + + late final __rotrPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedInt Function(ffi.UnsignedInt, ffi.Int)>>('_rotr'); + late final __rotr = __rotrPtr.asFunction(); + + int _lrotr( + int _Value, + int _Shift, + ) { + return __lrotr( + _Value, + _Shift, + ); + } + + late final __lrotrPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLong Function(ffi.UnsignedLong, ffi.Int)>>('_lrotr'); + late final __lrotr = __lrotrPtr.asFunction(); + + int _rotr64( + int _Value, + int _Shift, + ) { + return __rotr64( + _Value, + _Shift, + ); + } + + late final __rotr64Ptr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLongLong Function( + ffi.UnsignedLongLong, ffi.Int)>>('_rotr64'); + late final __rotr64 = __rotr64Ptr.asFunction(); + + void srand( + int _Seed, + ) { + return _srand( + _Seed, + ); + } + + late final _srandPtr = + _lookup>('srand'); + late final _srand = _srandPtr.asFunction(); + + int rand() { + return _rand(); + } + + late final _randPtr = _lookup>('rand'); + late final _rand = _randPtr.asFunction(); + + double atof( + ffi.Pointer _String, + ) { + return _atof( + _String, + ); + } + + late final _atofPtr = + _lookup)>>( + 'atof'); + late final _atof = + _atofPtr.asFunction)>(); + + int atoi( + ffi.Pointer _String, + ) { + return _atoi( + _String, + ); + } + + late final _atoiPtr = + _lookup)>>( + 'atoi'); + late final _atoi = _atoiPtr.asFunction)>(); + + int atol( + ffi.Pointer _String, + ) { + return _atol( + _String, + ); + } + + late final _atolPtr = + _lookup)>>( + 'atol'); + late final _atol = _atolPtr.asFunction)>(); + + int atoll( + ffi.Pointer _String, + ) { + return _atoll( + _String, + ); + } + + late final _atollPtr = + _lookup)>>( + 'atoll'); + late final _atoll = + _atollPtr.asFunction)>(); + + int _atoi64( + ffi.Pointer _String, + ) { + return __atoi64( + _String, + ); + } + + late final __atoi64Ptr = + _lookup)>>( + '_atoi64'); + late final __atoi64 = + __atoi64Ptr.asFunction)>(); + + double _atof_l( + ffi.Pointer _String, + _locale_t _Locale, + ) { + return __atof_l( + _String, + _Locale, + ); + } + + late final __atof_lPtr = _lookup< + ffi.NativeFunction< + ffi.Double Function(ffi.Pointer, _locale_t)>>('_atof_l'); + late final __atof_l = __atof_lPtr + .asFunction, _locale_t)>(); + + int _atoi_l( + ffi.Pointer _String, + _locale_t _Locale, + ) { + return __atoi_l( + _String, + _Locale, + ); + } + + late final __atoi_lPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, _locale_t)>>('_atoi_l'); + late final __atoi_l = + __atoi_lPtr.asFunction, _locale_t)>(); + + int _atol_l( + ffi.Pointer _String, + _locale_t _Locale, + ) { + return __atol_l( + _String, + _Locale, + ); + } + + late final __atol_lPtr = _lookup< + ffi.NativeFunction< + ffi.Long Function(ffi.Pointer, _locale_t)>>('_atol_l'); + late final __atol_l = + __atol_lPtr.asFunction, _locale_t)>(); + + int _atoll_l( + ffi.Pointer _String, + _locale_t _Locale, + ) { + return __atoll_l( + _String, + _Locale, + ); + } + + late final __atoll_lPtr = _lookup< + ffi.NativeFunction< + ffi.LongLong Function(ffi.Pointer, _locale_t)>>('_atoll_l'); + late final __atoll_l = + __atoll_lPtr.asFunction, _locale_t)>(); + + int _atoi64_l( + ffi.Pointer _String, + _locale_t _Locale, + ) { + return __atoi64_l( + _String, + _Locale, + ); + } + + late final __atoi64_lPtr = _lookup< + ffi.NativeFunction< + ffi.LongLong Function( + ffi.Pointer, _locale_t)>>('_atoi64_l'); + late final __atoi64_l = __atoi64_lPtr + .asFunction, _locale_t)>(); + + int _atoflt( + ffi.Pointer<_CRT_FLOAT> _Result, + ffi.Pointer _String, + ) { + return __atoflt( + _Result, + _String, + ); + } + + late final __atofltPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer<_CRT_FLOAT>, ffi.Pointer)>>('_atoflt'); + late final __atoflt = __atofltPtr.asFunction< + int Function(ffi.Pointer<_CRT_FLOAT>, ffi.Pointer)>(); + + int _atodbl( + ffi.Pointer<_CRT_DOUBLE> _Result, + ffi.Pointer _String, + ) { + return __atodbl( + _Result, + _String, + ); + } + + late final __atodblPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer<_CRT_DOUBLE>, ffi.Pointer)>>('_atodbl'); + late final __atodbl = __atodblPtr.asFunction< + int Function(ffi.Pointer<_CRT_DOUBLE>, ffi.Pointer)>(); + + int _atoldbl( + ffi.Pointer<_LDOUBLE> _Result, + ffi.Pointer _String, + ) { + return __atoldbl( + _Result, + _String, + ); + } + + late final __atoldblPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer<_LDOUBLE>, ffi.Pointer)>>('_atoldbl'); + late final __atoldbl = __atoldblPtr + .asFunction, ffi.Pointer)>(); + + int _atoflt_l( + ffi.Pointer<_CRT_FLOAT> _Result, + ffi.Pointer _String, + _locale_t _Locale, + ) { + return __atoflt_l( + _Result, + _String, + _Locale, + ); + } + + late final __atoflt_lPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer<_CRT_FLOAT>, ffi.Pointer, + _locale_t)>>('_atoflt_l'); + late final __atoflt_l = __atoflt_lPtr.asFunction< + int Function( + ffi.Pointer<_CRT_FLOAT>, ffi.Pointer, _locale_t)>(); + + int _atodbl_l( + ffi.Pointer<_CRT_DOUBLE> _Result, + ffi.Pointer _String, + _locale_t _Locale, + ) { + return __atodbl_l( + _Result, + _String, + _Locale, + ); + } + + late final __atodbl_lPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer<_CRT_DOUBLE>, ffi.Pointer, + _locale_t)>>('_atodbl_l'); + late final __atodbl_l = __atodbl_lPtr.asFunction< + int Function( + ffi.Pointer<_CRT_DOUBLE>, ffi.Pointer, _locale_t)>(); + + int _atoldbl_l( + ffi.Pointer<_LDOUBLE> _Result, + ffi.Pointer _String, + _locale_t _Locale, + ) { + return __atoldbl_l( + _Result, + _String, + _Locale, + ); + } + + late final __atoldbl_lPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer<_LDOUBLE>, ffi.Pointer, + _locale_t)>>('_atoldbl_l'); + late final __atoldbl_l = __atoldbl_lPtr.asFunction< + int Function(ffi.Pointer<_LDOUBLE>, ffi.Pointer, _locale_t)>(); + + double strtof( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + ) { + return _strtof( + _String, + _EndPtr, + ); + } + + late final _strtofPtr = _lookup< + ffi.NativeFunction< + ffi.Float Function(ffi.Pointer, + ffi.Pointer>)>>('strtof'); + late final _strtof = _strtofPtr.asFunction< + double Function( + ffi.Pointer, ffi.Pointer>)>(); + + double _strtof_l( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + _locale_t _Locale, + ) { + return __strtof_l( + _String, + _EndPtr, + _Locale, + ); + } + + late final __strtof_lPtr = _lookup< + ffi.NativeFunction< + ffi.Float Function(ffi.Pointer, + ffi.Pointer>, _locale_t)>>('_strtof_l'); + late final __strtof_l = __strtof_lPtr.asFunction< + double Function(ffi.Pointer, ffi.Pointer>, + _locale_t)>(); + + double strtod( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + ) { + return _strtod( + _String, + _EndPtr, + ); + } + + late final _strtodPtr = _lookup< + ffi.NativeFunction< + ffi.Double Function(ffi.Pointer, + ffi.Pointer>)>>('strtod'); + late final _strtod = _strtodPtr.asFunction< + double Function( + ffi.Pointer, ffi.Pointer>)>(); + + double _strtod_l( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + _locale_t _Locale, + ) { + return __strtod_l( + _String, + _EndPtr, + _Locale, + ); + } + + late final __strtod_lPtr = _lookup< + ffi.NativeFunction< + ffi.Double Function(ffi.Pointer, + ffi.Pointer>, _locale_t)>>('_strtod_l'); + late final __strtod_l = __strtod_lPtr.asFunction< + double Function(ffi.Pointer, ffi.Pointer>, + _locale_t)>(); + + int strtol( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + int _Radix, + ) { + return _strtol( + _String, + _EndPtr, + _Radix, + ); + } + + late final _strtolPtr = _lookup< + ffi.NativeFunction< + ffi.Long Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('strtol'); + late final _strtol = _strtolPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + int _strtol_l( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + int _Radix, + _locale_t _Locale, + ) { + return __strtol_l( + _String, + _EndPtr, + _Radix, + _Locale, + ); + } + + late final __strtol_lPtr = _lookup< + ffi.NativeFunction< + ffi.Long Function( + ffi.Pointer, + ffi.Pointer>, + ffi.Int, + _locale_t)>>('_strtol_l'); + late final __strtol_l = __strtol_lPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer>, + int, _locale_t)>(); + + int strtoll( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + int _Radix, + ) { + return _strtoll( + _String, + _EndPtr, + _Radix, + ); + } + + late final _strtollPtr = _lookup< + ffi.NativeFunction< + ffi.LongLong Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('strtoll'); + late final _strtoll = _strtollPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + int _strtoll_l( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + int _Radix, + _locale_t _Locale, + ) { + return __strtoll_l( + _String, + _EndPtr, + _Radix, + _Locale, + ); + } + + late final __strtoll_lPtr = _lookup< + ffi.NativeFunction< + ffi.LongLong Function( + ffi.Pointer, + ffi.Pointer>, + ffi.Int, + _locale_t)>>('_strtoll_l'); + late final __strtoll_l = __strtoll_lPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer>, + int, _locale_t)>(); + + int strtoul( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + int _Radix, + ) { + return _strtoul( + _String, + _EndPtr, + _Radix, + ); + } + + late final _strtoulPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLong Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('strtoul'); + late final _strtoul = _strtoulPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + int _strtoul_l( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + int _Radix, + _locale_t _Locale, + ) { + return __strtoul_l( + _String, + _EndPtr, + _Radix, + _Locale, + ); + } + + late final __strtoul_lPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLong Function( + ffi.Pointer, + ffi.Pointer>, + ffi.Int, + _locale_t)>>('_strtoul_l'); + late final __strtoul_l = __strtoul_lPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer>, + int, _locale_t)>(); + + int strtoull( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + int _Radix, + ) { + return _strtoull( + _String, + _EndPtr, + _Radix, + ); + } + + late final _strtoullPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLongLong Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('strtoull'); + late final _strtoull = _strtoullPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + int _strtoull_l( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + int _Radix, + _locale_t _Locale, + ) { + return __strtoull_l( + _String, + _EndPtr, + _Radix, + _Locale, + ); + } + + late final __strtoull_lPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLongLong Function( + ffi.Pointer, + ffi.Pointer>, + ffi.Int, + _locale_t)>>('_strtoull_l'); + late final __strtoull_l = __strtoull_lPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer>, + int, _locale_t)>(); + + int _strtoi64( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + int _Radix, + ) { + return __strtoi64( + _String, + _EndPtr, + _Radix, + ); + } + + late final __strtoi64Ptr = _lookup< + ffi.NativeFunction< + ffi.LongLong Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('_strtoi64'); + late final __strtoi64 = __strtoi64Ptr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + int _strtoi64_l( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + int _Radix, + _locale_t _Locale, + ) { + return __strtoi64_l( + _String, + _EndPtr, + _Radix, + _Locale, + ); + } + + late final __strtoi64_lPtr = _lookup< + ffi.NativeFunction< + ffi.LongLong Function( + ffi.Pointer, + ffi.Pointer>, + ffi.Int, + _locale_t)>>('_strtoi64_l'); + late final __strtoi64_l = __strtoi64_lPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer>, + int, _locale_t)>(); + + int _strtoui64( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + int _Radix, + ) { + return __strtoui64( + _String, + _EndPtr, + _Radix, + ); + } + + late final __strtoui64Ptr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLongLong Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('_strtoui64'); + late final __strtoui64 = __strtoui64Ptr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + int _strtoui64_l( + ffi.Pointer _String, + ffi.Pointer> _EndPtr, + int _Radix, + _locale_t _Locale, + ) { + return __strtoui64_l( + _String, + _EndPtr, + _Radix, + _Locale, + ); + } + + late final __strtoui64_lPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLongLong Function( + ffi.Pointer, + ffi.Pointer>, + ffi.Int, + _locale_t)>>('_strtoui64_l'); + late final __strtoui64_l = __strtoui64_lPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer>, + int, _locale_t)>(); + + int _itoa_s( + int _Value, + ffi.Pointer _Buffer, + int _BufferCount, + int _Radix, + ) { + return __itoa_s( + _Value, + _Buffer, + _BufferCount, + _Radix, + ); + } + + late final __itoa_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function( + ffi.Int, ffi.Pointer, ffi.Size, ffi.Int)>>('_itoa_s'); + late final __itoa_s = __itoa_sPtr + .asFunction, int, int)>(); + + ffi.Pointer _itoa( + int _Value, + ffi.Pointer _Buffer, + int _Radix, + ) { + return __itoa( + _Value, + _Buffer, + _Radix, + ); + } + + late final __itoaPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Int, ffi.Pointer, ffi.Int)>>('_itoa'); + late final __itoa = __itoaPtr.asFunction< + ffi.Pointer Function(int, ffi.Pointer, int)>(); + + int _ltoa_s( + int _Value, + ffi.Pointer _Buffer, + int _BufferCount, + int _Radix, + ) { + return __ltoa_s( + _Value, + _Buffer, + _BufferCount, + _Radix, + ); + } + + late final __ltoa_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function( + ffi.Long, ffi.Pointer, ffi.Size, ffi.Int)>>('_ltoa_s'); + late final __ltoa_s = __ltoa_sPtr + .asFunction, int, int)>(); + + ffi.Pointer _ltoa( + int _Value, + ffi.Pointer _Buffer, + int _Radix, + ) { + return __ltoa( + _Value, + _Buffer, + _Radix, + ); + } + + late final __ltoaPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Long, ffi.Pointer, ffi.Int)>>('_ltoa'); + late final __ltoa = __ltoaPtr.asFunction< + ffi.Pointer Function(int, ffi.Pointer, int)>(); + + int _ultoa_s( + int _Value, + ffi.Pointer _Buffer, + int _BufferCount, + int _Radix, + ) { + return __ultoa_s( + _Value, + _Buffer, + _BufferCount, + _Radix, + ); + } + + late final __ultoa_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function(ffi.UnsignedLong, ffi.Pointer, ffi.Size, + ffi.Int)>>('_ultoa_s'); + late final __ultoa_s = __ultoa_sPtr + .asFunction, int, int)>(); + + ffi.Pointer _ultoa( + int _Value, + ffi.Pointer _Buffer, + int _Radix, + ) { + return __ultoa( + _Value, + _Buffer, + _Radix, + ); + } + + late final __ultoaPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.UnsignedLong, ffi.Pointer, ffi.Int)>>('_ultoa'); + late final __ultoa = __ultoaPtr.asFunction< + ffi.Pointer Function(int, ffi.Pointer, int)>(); + + int _i64toa_s( + int _Value, + ffi.Pointer _Buffer, + int _BufferCount, + int _Radix, + ) { + return __i64toa_s( + _Value, + _Buffer, + _BufferCount, + _Radix, + ); + } + + late final __i64toa_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function(ffi.LongLong, ffi.Pointer, ffi.Size, + ffi.Int)>>('_i64toa_s'); + late final __i64toa_s = __i64toa_sPtr + .asFunction, int, int)>(); + + ffi.Pointer _i64toa( + int _Value, + ffi.Pointer _Buffer, + int _Radix, + ) { + return __i64toa( + _Value, + _Buffer, + _Radix, + ); + } + + late final __i64toaPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.LongLong, ffi.Pointer, ffi.Int)>>('_i64toa'); + late final __i64toa = __i64toaPtr.asFunction< + ffi.Pointer Function(int, ffi.Pointer, int)>(); + + int _ui64toa_s( + int _Value, + ffi.Pointer _Buffer, + int _BufferCount, + int _Radix, + ) { + return __ui64toa_s( + _Value, + _Buffer, + _BufferCount, + _Radix, + ); + } + + late final __ui64toa_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function(ffi.UnsignedLongLong, ffi.Pointer, + ffi.Size, ffi.Int)>>('_ui64toa_s'); + late final __ui64toa_s = __ui64toa_sPtr + .asFunction, int, int)>(); + + ffi.Pointer _ui64toa( + int _Value, + ffi.Pointer _Buffer, + int _Radix, + ) { + return __ui64toa( + _Value, + _Buffer, + _Radix, + ); + } + + late final __ui64toaPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.UnsignedLongLong, + ffi.Pointer, ffi.Int)>>('_ui64toa'); + late final __ui64toa = __ui64toaPtr.asFunction< + ffi.Pointer Function(int, ffi.Pointer, int)>(); + + int _ecvt_s( + ffi.Pointer _Buffer, + int _BufferCount, + double _Value, + int _DigitCount, + ffi.Pointer _PtDec, + ffi.Pointer _PtSign, + ) { + return __ecvt_s( + _Buffer, + _BufferCount, + _Value, + _DigitCount, + _PtDec, + _PtSign, + ); + } + + late final __ecvt_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function(ffi.Pointer, ffi.Size, ffi.Double, ffi.Int, + ffi.Pointer, ffi.Pointer)>>('_ecvt_s'); + late final __ecvt_s = __ecvt_sPtr.asFunction< + int Function(ffi.Pointer, int, double, int, + ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer _ecvt( + double _Value, + int _DigitCount, + ffi.Pointer _PtDec, + ffi.Pointer _PtSign, + ) { + return __ecvt( + _Value, + _DigitCount, + _PtDec, + _PtSign, + ); + } + + late final __ecvtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Double, ffi.Int, + ffi.Pointer, ffi.Pointer)>>('_ecvt'); + late final __ecvt = __ecvtPtr.asFunction< + ffi.Pointer Function( + double, int, ffi.Pointer, ffi.Pointer)>(); + + int _fcvt_s( + ffi.Pointer _Buffer, + int _BufferCount, + double _Value, + int _FractionalDigitCount, + ffi.Pointer _PtDec, + ffi.Pointer _PtSign, + ) { + return __fcvt_s( + _Buffer, + _BufferCount, + _Value, + _FractionalDigitCount, + _PtDec, + _PtSign, + ); + } + + late final __fcvt_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function(ffi.Pointer, ffi.Size, ffi.Double, ffi.Int, + ffi.Pointer, ffi.Pointer)>>('_fcvt_s'); + late final __fcvt_s = __fcvt_sPtr.asFunction< + int Function(ffi.Pointer, int, double, int, + ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer _fcvt( + double _Value, + int _FractionalDigitCount, + ffi.Pointer _PtDec, + ffi.Pointer _PtSign, + ) { + return __fcvt( + _Value, + _FractionalDigitCount, + _PtDec, + _PtSign, + ); + } + + late final __fcvtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Double, ffi.Int, + ffi.Pointer, ffi.Pointer)>>('_fcvt'); + late final __fcvt = __fcvtPtr.asFunction< + ffi.Pointer Function( + double, int, ffi.Pointer, ffi.Pointer)>(); + + int _gcvt_s( + ffi.Pointer _Buffer, + int _BufferCount, + double _Value, + int _DigitCount, + ) { + return __gcvt_s( + _Buffer, + _BufferCount, + _Value, + _DigitCount, + ); + } + + late final __gcvt_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function(ffi.Pointer, ffi.Size, ffi.Double, + ffi.Int)>>('_gcvt_s'); + late final __gcvt_s = __gcvt_sPtr + .asFunction, int, double, int)>(); + + ffi.Pointer _gcvt( + double _Value, + int _DigitCount, + ffi.Pointer _Buffer, + ) { + return __gcvt( + _Value, + _DigitCount, + _Buffer, + ); + } + + late final __gcvtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Double, ffi.Int, ffi.Pointer)>>('_gcvt'); + late final __gcvt = __gcvtPtr.asFunction< + ffi.Pointer Function(double, int, ffi.Pointer)>(); + + int ___mb_cur_max_func() { + return ____mb_cur_max_func(); + } + + late final ____mb_cur_max_funcPtr = + _lookup>('___mb_cur_max_func'); + late final ____mb_cur_max_func = + ____mb_cur_max_funcPtr.asFunction(); + + int ___mb_cur_max_l_func( + _locale_t _Locale, + ) { + return ____mb_cur_max_l_func( + _Locale, + ); + } + + late final ____mb_cur_max_l_funcPtr = + _lookup>( + '___mb_cur_max_l_func'); + late final ____mb_cur_max_l_func = + ____mb_cur_max_l_funcPtr.asFunction(); + + int mblen( + ffi.Pointer _Ch, + int _MaxCount, + ) { + return _mblen( + _Ch, + _MaxCount, + ); + } + + late final _mblenPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Size)>>('mblen'); + late final _mblen = + _mblenPtr.asFunction, int)>(); + + int _mblen_l( + ffi.Pointer _Ch, + int _MaxCount, + _locale_t _Locale, + ) { + return __mblen_l( + _Ch, + _MaxCount, + _Locale, + ); + } + + late final __mblen_lPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Size, _locale_t)>>('_mblen_l'); + late final __mblen_l = __mblen_lPtr + .asFunction, int, _locale_t)>(); + + int _mbstrlen( + ffi.Pointer _String, + ) { + return __mbstrlen( + _String, + ); + } + + late final __mbstrlenPtr = + _lookup)>>( + '_mbstrlen'); + late final __mbstrlen = + __mbstrlenPtr.asFunction)>(); + + int _mbstrlen_l( + ffi.Pointer _String, + _locale_t _Locale, + ) { + return __mbstrlen_l( + _String, + _Locale, + ); + } + + late final __mbstrlen_lPtr = _lookup< + ffi.NativeFunction< + ffi.Size Function(ffi.Pointer, _locale_t)>>('_mbstrlen_l'); + late final __mbstrlen_l = __mbstrlen_lPtr + .asFunction, _locale_t)>(); + + int _mbstrnlen( + ffi.Pointer _String, + int _MaxCount, + ) { + return __mbstrnlen( + _String, + _MaxCount, + ); + } + + late final __mbstrnlenPtr = _lookup< + ffi.NativeFunction< + ffi.Size Function(ffi.Pointer, ffi.Size)>>('_mbstrnlen'); + late final __mbstrnlen = + __mbstrnlenPtr.asFunction, int)>(); + + int _mbstrnlen_l( + ffi.Pointer _String, + int _MaxCount, + _locale_t _Locale, + ) { + return __mbstrnlen_l( + _String, + _MaxCount, + _Locale, + ); + } + + late final __mbstrnlen_lPtr = _lookup< + ffi.NativeFunction< + ffi.Size Function( + ffi.Pointer, ffi.Size, _locale_t)>>('_mbstrnlen_l'); + late final __mbstrnlen_l = __mbstrnlen_lPtr + .asFunction, int, _locale_t)>(); + + int mbtowc( + ffi.Pointer _DstCh, + ffi.Pointer _SrcCh, + int _SrcSizeInBytes, + ) { + return _mbtowc( + _DstCh, + _SrcCh, + _SrcSizeInBytes, + ); + } + + late final _mbtowcPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.Size)>>('mbtowc'); + late final _mbtowc = _mbtowcPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int)>(); + + int _mbtowc_l( + ffi.Pointer _DstCh, + ffi.Pointer _SrcCh, + int _SrcSizeInBytes, + _locale_t _Locale, + ) { + return __mbtowc_l( + _DstCh, + _SrcCh, + _SrcSizeInBytes, + _Locale, + ); + } + + late final __mbtowc_lPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.Size, _locale_t)>>('_mbtowc_l'); + late final __mbtowc_l = __mbtowc_lPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer, int, _locale_t)>(); + + int mbstowcs_s( + ffi.Pointer _PtNumOfCharConverted, + ffi.Pointer _DstBuf, + int _SizeInWords, + ffi.Pointer _SrcBuf, + int _MaxCount, + ) { + return _mbstowcs_s( + _PtNumOfCharConverted, + _DstBuf, + _SizeInWords, + _SrcBuf, + _MaxCount, + ); + } + + late final _mbstowcs_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function(ffi.Pointer, ffi.Pointer, + ffi.Size, ffi.Pointer, ffi.Size)>>('mbstowcs_s'); + late final _mbstowcs_s = _mbstowcs_sPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int, + ffi.Pointer, int)>(); + + int mbstowcs( + ffi.Pointer _Dest, + ffi.Pointer _Source, + int _MaxCount, + ) { + return _mbstowcs( + _Dest, + _Source, + _MaxCount, + ); + } + + late final _mbstowcsPtr = _lookup< + ffi.NativeFunction< + ffi.Size Function(ffi.Pointer, ffi.Pointer, + ffi.Size)>>('mbstowcs'); + late final _mbstowcs = _mbstowcsPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int)>(); + + int _mbstowcs_s_l( + ffi.Pointer _PtNumOfCharConverted, + ffi.Pointer _DstBuf, + int _SizeInWords, + ffi.Pointer _SrcBuf, + int _MaxCount, + _locale_t _Locale, + ) { + return __mbstowcs_s_l( + _PtNumOfCharConverted, + _DstBuf, + _SizeInWords, + _SrcBuf, + _MaxCount, + _Locale, + ); + } + + late final __mbstowcs_s_lPtr = _lookup< + ffi.NativeFunction< + errno_t Function( + ffi.Pointer, + ffi.Pointer, + ffi.Size, + ffi.Pointer, + ffi.Size, + _locale_t)>>('_mbstowcs_s_l'); + late final __mbstowcs_s_l = __mbstowcs_s_lPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int, + ffi.Pointer, int, _locale_t)>(); + + int _mbstowcs_l( + ffi.Pointer _Dest, + ffi.Pointer _Source, + int _MaxCount, + _locale_t _Locale, + ) { + return __mbstowcs_l( + _Dest, + _Source, + _MaxCount, + _Locale, + ); + } + + late final __mbstowcs_lPtr = _lookup< + ffi.NativeFunction< + ffi.Size Function(ffi.Pointer, ffi.Pointer, + ffi.Size, _locale_t)>>('_mbstowcs_l'); + late final __mbstowcs_l = __mbstowcs_lPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer, int, _locale_t)>(); + + int wctomb( + ffi.Pointer _MbCh, + int _WCh, + ) { + return _wctomb( + _MbCh, + _WCh, + ); + } + + late final _wctombPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.WChar)>>('wctomb'); + late final _wctomb = + _wctombPtr.asFunction, int)>(); + + int _wctomb_l( + ffi.Pointer _MbCh, + int _WCh, + _locale_t _Locale, + ) { + return __wctomb_l( + _MbCh, + _WCh, + _Locale, + ); + } + + late final __wctomb_lPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.WChar, _locale_t)>>('_wctomb_l'); + late final __wctomb_l = __wctomb_lPtr + .asFunction, int, _locale_t)>(); + + int wctomb_s( + ffi.Pointer _SizeConverted, + ffi.Pointer _MbCh, + int _SizeInBytes, + int _WCh, + ) { + return _wctomb_s( + _SizeConverted, + _MbCh, + _SizeInBytes, + _WCh, + ); + } + + late final _wctomb_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function(ffi.Pointer, ffi.Pointer, rsize_t, + ffi.WChar)>>('wctomb_s'); + late final _wctomb_s = _wctomb_sPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int, int)>(); + + int _wctomb_s_l( + ffi.Pointer _SizeConverted, + ffi.Pointer _MbCh, + int _SizeInBytes, + int _WCh, + _locale_t _Locale, + ) { + return __wctomb_s_l( + _SizeConverted, + _MbCh, + _SizeInBytes, + _WCh, + _Locale, + ); + } + + late final __wctomb_s_lPtr = _lookup< + ffi.NativeFunction< + errno_t Function(ffi.Pointer, ffi.Pointer, + ffi.Size, ffi.WChar, _locale_t)>>('_wctomb_s_l'); + late final __wctomb_s_l = __wctomb_s_lPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer, int, int, _locale_t)>(); + + int wcstombs_s( + ffi.Pointer _PtNumOfCharConverted, + ffi.Pointer _Dst, + int _DstSizeInBytes, + ffi.Pointer _Src, + int _MaxCountInBytes, + ) { + return _wcstombs_s( + _PtNumOfCharConverted, + _Dst, + _DstSizeInBytes, + _Src, + _MaxCountInBytes, + ); + } + + late final _wcstombs_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function(ffi.Pointer, ffi.Pointer, + ffi.Size, ffi.Pointer, ffi.Size)>>('wcstombs_s'); + late final _wcstombs_s = _wcstombs_sPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int, + ffi.Pointer, int)>(); + + int wcstombs( + ffi.Pointer _Dest, + ffi.Pointer _Source, + int _MaxCount, + ) { + return _wcstombs( + _Dest, + _Source, + _MaxCount, + ); + } + + late final _wcstombsPtr = _lookup< + ffi.NativeFunction< + ffi.Size Function(ffi.Pointer, ffi.Pointer, + ffi.Size)>>('wcstombs'); + late final _wcstombs = _wcstombsPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int)>(); + + int _wcstombs_s_l( + ffi.Pointer _PtNumOfCharConverted, + ffi.Pointer _Dst, + int _DstSizeInBytes, + ffi.Pointer _Src, + int _MaxCountInBytes, + _locale_t _Locale, + ) { + return __wcstombs_s_l( + _PtNumOfCharConverted, + _Dst, + _DstSizeInBytes, + _Src, + _MaxCountInBytes, + _Locale, + ); + } + + late final __wcstombs_s_lPtr = _lookup< + ffi.NativeFunction< + errno_t Function( + ffi.Pointer, + ffi.Pointer, + ffi.Size, + ffi.Pointer, + ffi.Size, + _locale_t)>>('_wcstombs_s_l'); + late final __wcstombs_s_l = __wcstombs_s_lPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int, + ffi.Pointer, int, _locale_t)>(); + + int _wcstombs_l( + ffi.Pointer _Dest, + ffi.Pointer _Source, + int _MaxCount, + _locale_t _Locale, + ) { + return __wcstombs_l( + _Dest, + _Source, + _MaxCount, + _Locale, + ); + } + + late final __wcstombs_lPtr = _lookup< + ffi.NativeFunction< + ffi.Size Function(ffi.Pointer, ffi.Pointer, + ffi.Size, _locale_t)>>('_wcstombs_l'); + late final __wcstombs_l = __wcstombs_lPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer, int, _locale_t)>(); + + ffi.Pointer _fullpath( + ffi.Pointer _Buffer, + ffi.Pointer _Path, + int _BufferCount, + ) { + return __fullpath( + _Buffer, + _Path, + _BufferCount, + ); + } + + late final __fullpathPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Size)>>('_fullpath'); + late final __fullpath = __fullpathPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer, int)>(); + + int _makepath_s( + ffi.Pointer _Buffer, + int _BufferCount, + ffi.Pointer _Drive, + ffi.Pointer _Dir, + ffi.Pointer _Filename, + ffi.Pointer _Ext, + ) { + return __makepath_s( + _Buffer, + _BufferCount, + _Drive, + _Dir, + _Filename, + _Ext, + ); + } + + late final __makepath_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function( + ffi.Pointer, + ffi.Size, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>('_makepath_s'); + late final __makepath_s = __makepath_sPtr.asFunction< + int Function( + ffi.Pointer, + int, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(); + + void _makepath( + ffi.Pointer _Buffer, + ffi.Pointer _Drive, + ffi.Pointer _Dir, + ffi.Pointer _Filename, + ffi.Pointer _Ext, + ) { + return __makepath( + _Buffer, + _Drive, + _Dir, + _Filename, + _Ext, + ); + } + + late final __makepathPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>('_makepath'); + late final __makepath = __makepathPtr.asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(); + + void _splitpath( + ffi.Pointer _FullPath, + ffi.Pointer _Drive, + ffi.Pointer _Dir, + ffi.Pointer _Filename, + ffi.Pointer _Ext, + ) { + return __splitpath( + _FullPath, + _Drive, + _Dir, + _Filename, + _Ext, + ); + } + + late final __splitpathPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>('_splitpath'); + late final __splitpath = __splitpathPtr.asFunction< + void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>(); + + int _splitpath_s( + ffi.Pointer _FullPath, + ffi.Pointer _Drive, + int _DriveCount, + ffi.Pointer _Dir, + int _DirCount, + ffi.Pointer _Filename, + int _FilenameCount, + ffi.Pointer _Ext, + int _ExtCount, + ) { + return __splitpath_s( + _FullPath, + _Drive, + _DriveCount, + _Dir, + _DirCount, + _Filename, + _FilenameCount, + _Ext, + _ExtCount, + ); + } + + late final __splitpath_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function( + ffi.Pointer, + ffi.Pointer, + ffi.Size, + ffi.Pointer, + ffi.Size, + ffi.Pointer, + ffi.Size, + ffi.Pointer, + ffi.Size)>>('_splitpath_s'); + late final __splitpath_s = __splitpath_sPtr.asFunction< + int Function( + ffi.Pointer, + ffi.Pointer, + int, + ffi.Pointer, + int, + ffi.Pointer, + int, + ffi.Pointer, + int)>(); + + int getenv_s( + ffi.Pointer _RequiredCount, + ffi.Pointer _Buffer, + int _BufferCount, + ffi.Pointer _VarName, + ) { + return _getenv_s( + _RequiredCount, + _Buffer, + _BufferCount, + _VarName, + ); + } + + late final _getenv_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function(ffi.Pointer, ffi.Pointer, + rsize_t, ffi.Pointer)>>('getenv_s'); + late final _getenv_s = _getenv_sPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int, + ffi.Pointer)>(); + + ffi.Pointer __p___argc() { + return ___p___argc(); + } + + late final ___p___argcPtr = + _lookup Function()>>( + '__p___argc'); + late final ___p___argc = + ___p___argcPtr.asFunction Function()>(); + + ffi.Pointer>> __p___argv() { + return ___p___argv(); + } + + late final ___p___argvPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer>> + Function()>>('__p___argv'); + late final ___p___argv = ___p___argvPtr + .asFunction>> Function()>(); + + ffi.Pointer>> __p___wargv() { + return ___p___wargv(); + } + + late final ___p___wargvPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer>> + Function()>>('__p___wargv'); + late final ___p___wargv = ___p___wargvPtr.asFunction< + ffi.Pointer>> Function()>(); + + ffi.Pointer>> __p__environ() { + return ___p__environ(); + } + + late final ___p__environPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer>> + Function()>>('__p__environ'); + late final ___p__environ = ___p__environPtr + .asFunction>> Function()>(); + + ffi.Pointer>> __p__wenviron() { + return ___p__wenviron(); + } + + late final ___p__wenvironPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer>> + Function()>>('__p__wenviron'); + late final ___p__wenviron = ___p__wenvironPtr.asFunction< + ffi.Pointer>> Function()>(); + + ffi.Pointer getenv( + ffi.Pointer _VarName, + ) { + return _getenv( + _VarName, + ); + } + + late final _getenvPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('getenv'); + late final _getenv = _getenvPtr + .asFunction Function(ffi.Pointer)>(); + + int _dupenv_s( + ffi.Pointer> _Buffer, + ffi.Pointer _BufferCount, + ffi.Pointer _VarName, + ) { + return __dupenv_s( + _Buffer, + _BufferCount, + _VarName, + ); + } + + late final __dupenv_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function(ffi.Pointer>, + ffi.Pointer, ffi.Pointer)>>('_dupenv_s'); + late final __dupenv_s = __dupenv_sPtr.asFunction< + int Function(ffi.Pointer>, ffi.Pointer, + ffi.Pointer)>(); + + int system( + ffi.Pointer _Command, + ) { + return _system( + _Command, + ); + } + + late final _systemPtr = + _lookup)>>( + 'system'); + late final _system = + _systemPtr.asFunction)>(); + + int _putenv( + ffi.Pointer _EnvString, + ) { + return __putenv( + _EnvString, + ); + } + + late final __putenvPtr = + _lookup)>>( + '_putenv'); + late final __putenv = + __putenvPtr.asFunction)>(); + + int _putenv_s( + ffi.Pointer _Name, + ffi.Pointer _Value, + ) { + return __putenv_s( + _Name, + _Value, + ); + } + + late final __putenv_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function( + ffi.Pointer, ffi.Pointer)>>('_putenv_s'); + late final __putenv_s = __putenv_sPtr + .asFunction, ffi.Pointer)>(); + + int _searchenv_s( + ffi.Pointer _Filename, + ffi.Pointer _VarName, + ffi.Pointer _Buffer, + int _BufferCount, + ) { + return __searchenv_s( + _Filename, + _VarName, + _Buffer, + _BufferCount, + ); + } + + late final __searchenv_sPtr = _lookup< + ffi.NativeFunction< + errno_t Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer, ffi.Size)>>('_searchenv_s'); + late final __searchenv_s = __searchenv_sPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer, int)>(); + + void _searchenv( + ffi.Pointer _Filename, + ffi.Pointer _VarName, + ffi.Pointer _Buffer, + ) { + return __searchenv( + _Filename, + _VarName, + _Buffer, + ); + } + + late final __searchenvPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer)>>('_searchenv'); + late final __searchenv = __searchenvPtr.asFunction< + void Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer)>(); + + void _seterrormode( + int _Mode, + ) { + return __seterrormode( + _Mode, + ); + } + + late final __seterrormodePtr = + _lookup>('_seterrormode'); + late final __seterrormode = + __seterrormodePtr.asFunction(); + + void _beep( + int _Frequency, + int _Duration, + ) { + return __beep( + _Frequency, + _Duration, + ); + } + + late final __beepPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.UnsignedInt, ffi.UnsignedInt)>>('_beep'); + late final __beep = __beepPtr.asFunction(); + + void _sleep( + int _Duration, + ) { + return __sleep( + _Duration, + ); + } + + late final __sleepPtr = + _lookup>( + '_sleep'); + late final __sleep = __sleepPtr.asFunction(); + + ffi.Pointer ecvt( + double _Value, + int _DigitCount, + ffi.Pointer _PtDec, + ffi.Pointer _PtSign, + ) { + return _ecvt1( + _Value, + _DigitCount, + _PtDec, + _PtSign, + ); + } + + late final _ecvtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Double, ffi.Int, + ffi.Pointer, ffi.Pointer)>>('ecvt'); + late final _ecvt1 = _ecvtPtr.asFunction< + ffi.Pointer Function( + double, int, ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer fcvt( + double _Value, + int _FractionalDigitCount, + ffi.Pointer _PtDec, + ffi.Pointer _PtSign, + ) { + return _fcvt1( + _Value, + _FractionalDigitCount, + _PtDec, + _PtSign, + ); + } + + late final _fcvtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Double, ffi.Int, + ffi.Pointer, ffi.Pointer)>>('fcvt'); + late final _fcvt1 = _fcvtPtr.asFunction< + ffi.Pointer Function( + double, int, ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer gcvt( + double _Value, + int _DigitCount, + ffi.Pointer _DstBuf, + ) { + return _gcvt1( + _Value, + _DigitCount, + _DstBuf, + ); + } + + late final _gcvtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Double, ffi.Int, ffi.Pointer)>>('gcvt'); + late final _gcvt1 = _gcvtPtr.asFunction< + ffi.Pointer Function(double, int, ffi.Pointer)>(); + + ffi.Pointer itoa( + int _Value, + ffi.Pointer _Buffer, + int _Radix, + ) { + return _itoa1( + _Value, + _Buffer, + _Radix, + ); + } + + late final _itoaPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Int, ffi.Pointer, ffi.Int)>>('itoa'); + late final _itoa1 = _itoaPtr.asFunction< + ffi.Pointer Function(int, ffi.Pointer, int)>(); + + ffi.Pointer ltoa( + int _Value, + ffi.Pointer _Buffer, + int _Radix, + ) { + return _ltoa1( + _Value, + _Buffer, + _Radix, + ); + } + + late final _ltoaPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Long, ffi.Pointer, ffi.Int)>>('ltoa'); + late final _ltoa1 = _ltoaPtr.asFunction< + ffi.Pointer Function(int, ffi.Pointer, int)>(); + + void swab( + ffi.Pointer _Buf1, + ffi.Pointer _Buf2, + int _SizeInBytes, + ) { + return _swab1( + _Buf1, + _Buf2, + _SizeInBytes, + ); + } + + late final _swabPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, ffi.Pointer, ffi.Int)>>('swab'); + late final _swab1 = _swabPtr.asFunction< + void Function(ffi.Pointer, ffi.Pointer, int)>(); + + ffi.Pointer ultoa( + int _Value, + ffi.Pointer _Buffer, + int _Radix, + ) { + return _ultoa1( + _Value, + _Buffer, + _Radix, + ); + } + + late final _ultoaPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.UnsignedLong, ffi.Pointer, ffi.Int)>>('ultoa'); + late final _ultoa1 = _ultoaPtr.asFunction< + ffi.Pointer Function(int, ffi.Pointer, int)>(); + + int putenv( + ffi.Pointer _EnvString, + ) { + return _putenv1( + _EnvString, + ); + } + + late final _putenvPtr = + _lookup)>>( + 'putenv'); + late final _putenv1 = + _putenvPtr.asFunction)>(); + + _onexit_t onexit( + _onexit_t _Func, + ) { + return _onexit1( + _Func, + ); + } + + late final _onexitPtr = + _lookup>('onexit'); + late final _onexit1 = _onexitPtr.asFunction<_onexit_t Function(_onexit_t)>(); + + double cabs( + _Dcomplex _Z, + ) { + return _cabs( + _Z, + ); + } + + late final _cabsPtr = + _lookup>('cabs'); + late final _cabs = _cabsPtr.asFunction(); + + _Dcomplex cacos( + _Dcomplex _Z, + ) { + return _cacos( + _Z, + ); + } + + late final _cacosPtr = + _lookup>('cacos'); + late final _cacos = _cacosPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); + + _Dcomplex cacosh( + _Dcomplex _Z, + ) { + return _cacosh( + _Z, + ); + } + + late final _cacoshPtr = + _lookup>('cacosh'); + late final _cacosh = _cacoshPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); + + double carg( + _Dcomplex _Z, + ) { + return _carg( + _Z, + ); + } + + late final _cargPtr = + _lookup>('carg'); + late final _carg = _cargPtr.asFunction(); + + _Dcomplex casin( + _Dcomplex _Z, + ) { + return _casin( + _Z, + ); + } + + late final _casinPtr = + _lookup>('casin'); + late final _casin = _casinPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); + + _Dcomplex casinh( + _Dcomplex _Z, + ) { + return _casinh( + _Z, + ); + } + + late final _casinhPtr = + _lookup>('casinh'); + late final _casinh = _casinhPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); + + _Dcomplex catan( + _Dcomplex _Z, + ) { + return _catan( + _Z, + ); + } + + late final _catanPtr = + _lookup>('catan'); + late final _catan = _catanPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); + + _Dcomplex catanh( + _Dcomplex _Z, + ) { + return _catanh( + _Z, + ); + } + + late final _catanhPtr = + _lookup>('catanh'); + late final _catanh = _catanhPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); + + _Dcomplex ccos( + _Dcomplex _Z, + ) { + return _ccos( + _Z, + ); + } + + late final _ccosPtr = + _lookup>('ccos'); + late final _ccos = _ccosPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); + + _Dcomplex ccosh( + _Dcomplex _Z, + ) { + return _ccosh( + _Z, + ); + } + + late final _ccoshPtr = + _lookup>('ccosh'); + late final _ccosh = _ccoshPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); + + _Dcomplex cexp( + _Dcomplex _Z, + ) { + return _cexp( + _Z, + ); + } + + late final _cexpPtr = + _lookup>('cexp'); + late final _cexp = _cexpPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); + + double cimag( + _Dcomplex _Z, + ) { + return _cimag( + _Z, + ); + } + + late final _cimagPtr = + _lookup>('cimag'); + late final _cimag = _cimagPtr.asFunction(); + + _Dcomplex clog( + _Dcomplex _Z, + ) { + return _clog( + _Z, + ); + } + + late final _clogPtr = + _lookup>('clog'); + late final _clog = _clogPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); + + _Dcomplex clog10( + _Dcomplex _Z, + ) { + return _clog10( + _Z, + ); + } + + late final _clog10Ptr = + _lookup>('clog10'); + late final _clog10 = _clog10Ptr.asFunction<_Dcomplex Function(_Dcomplex)>(); + + _Dcomplex conj( + _Dcomplex _Z, + ) { + return _conj( + _Z, + ); + } + + late final _conjPtr = + _lookup>('conj'); + late final _conj = _conjPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); + + _Dcomplex cpow( + _Dcomplex _X, + _Dcomplex _Y, + ) { + return _cpow( + _X, + _Y, + ); + } + + late final _cpowPtr = + _lookup>( + 'cpow'); + late final _cpow = + _cpowPtr.asFunction<_Dcomplex Function(_Dcomplex, _Dcomplex)>(); + + _Dcomplex cproj( + _Dcomplex _Z, + ) { + return _cproj( + _Z, + ); + } + + late final _cprojPtr = + _lookup>('cproj'); + late final _cproj = _cprojPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); + + double creal( + _Dcomplex _Z, + ) { + return _creal( + _Z, + ); + } + + late final _crealPtr = + _lookup>('creal'); + late final _creal = _crealPtr.asFunction(); + + _Dcomplex csin( + _Dcomplex _Z, + ) { + return _csin( + _Z, + ); + } + + late final _csinPtr = + _lookup>('csin'); + late final _csin = _csinPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); + + _Dcomplex csinh( + _Dcomplex _Z, + ) { + return _csinh( + _Z, + ); + } + + late final _csinhPtr = + _lookup>('csinh'); + late final _csinh = _csinhPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); + + _Dcomplex csqrt( + _Dcomplex _Z, + ) { + return _csqrt( + _Z, + ); + } + + late final _csqrtPtr = + _lookup>('csqrt'); + late final _csqrt = _csqrtPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); + + _Dcomplex ctan( + _Dcomplex _Z, + ) { + return _ctan( + _Z, + ); + } + + late final _ctanPtr = + _lookup>('ctan'); + late final _ctan = _ctanPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); + + _Dcomplex ctanh( + _Dcomplex _Z, + ) { + return _ctanh( + _Z, + ); + } + + late final _ctanhPtr = + _lookup>('ctanh'); + late final _ctanh = _ctanhPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); + + double norm( + _Dcomplex _Z, + ) { + return _norm( + _Z, + ); + } + + late final _normPtr = + _lookup>('norm'); + late final _norm = _normPtr.asFunction(); + + double cabsf( + _Fcomplex _Z, + ) { + return _cabsf( + _Z, + ); + } + + late final _cabsfPtr = + _lookup>('cabsf'); + late final _cabsf = _cabsfPtr.asFunction(); + + _Fcomplex cacosf( + _Fcomplex _Z, + ) { + return _cacosf( + _Z, + ); + } + + late final _cacosfPtr = + _lookup>('cacosf'); + late final _cacosf = _cacosfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); + + _Fcomplex cacoshf( + _Fcomplex _Z, + ) { + return _cacoshf( + _Z, + ); + } + + late final _cacoshfPtr = + _lookup>('cacoshf'); + late final _cacoshf = _cacoshfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); + + double cargf( + _Fcomplex _Z, + ) { + return _cargf( + _Z, + ); + } + + late final _cargfPtr = + _lookup>('cargf'); + late final _cargf = _cargfPtr.asFunction(); + + _Fcomplex casinf( + _Fcomplex _Z, + ) { + return _casinf( + _Z, + ); + } + + late final _casinfPtr = + _lookup>('casinf'); + late final _casinf = _casinfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); + + _Fcomplex casinhf( + _Fcomplex _Z, + ) { + return _casinhf( + _Z, + ); + } + + late final _casinhfPtr = + _lookup>('casinhf'); + late final _casinhf = _casinhfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); + + _Fcomplex catanf( + _Fcomplex _Z, + ) { + return _catanf( + _Z, + ); + } + + late final _catanfPtr = + _lookup>('catanf'); + late final _catanf = _catanfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); + + _Fcomplex catanhf( + _Fcomplex _Z, + ) { + return _catanhf( + _Z, + ); + } + + late final _catanhfPtr = + _lookup>('catanhf'); + late final _catanhf = _catanhfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); + + _Fcomplex ccosf( + _Fcomplex _Z, + ) { + return _ccosf( + _Z, + ); + } + + late final _ccosfPtr = + _lookup>('ccosf'); + late final _ccosf = _ccosfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); + + _Fcomplex ccoshf( + _Fcomplex _Z, + ) { + return _ccoshf( + _Z, + ); + } + + late final _ccoshfPtr = + _lookup>('ccoshf'); + late final _ccoshf = _ccoshfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); + + _Fcomplex cexpf( + _Fcomplex _Z, + ) { + return _cexpf( + _Z, + ); + } + + late final _cexpfPtr = + _lookup>('cexpf'); + late final _cexpf = _cexpfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); + + double cimagf( + _Fcomplex _Z, + ) { + return _cimagf( + _Z, + ); + } + + late final _cimagfPtr = + _lookup>('cimagf'); + late final _cimagf = _cimagfPtr.asFunction(); + + _Fcomplex clogf( + _Fcomplex _Z, + ) { + return _clogf( + _Z, + ); + } + + late final _clogfPtr = + _lookup>('clogf'); + late final _clogf = _clogfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); + + _Fcomplex clog10f( + _Fcomplex _Z, + ) { + return _clog10f( + _Z, + ); + } + + late final _clog10fPtr = + _lookup>('clog10f'); + late final _clog10f = _clog10fPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); + + _Fcomplex conjf( + _Fcomplex _Z, + ) { + return _conjf( + _Z, + ); + } + + late final _conjfPtr = + _lookup>('conjf'); + late final _conjf = _conjfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); + + _Fcomplex cpowf( + _Fcomplex _X, + _Fcomplex _Y, + ) { + return _cpowf( + _X, + _Y, + ); + } + + late final _cpowfPtr = + _lookup>( + 'cpowf'); + late final _cpowf = + _cpowfPtr.asFunction<_Fcomplex Function(_Fcomplex, _Fcomplex)>(); + + _Fcomplex cprojf( + _Fcomplex _Z, + ) { + return _cprojf( + _Z, + ); + } + + late final _cprojfPtr = + _lookup>('cprojf'); + late final _cprojf = _cprojfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); + + double crealf( + _Fcomplex _Z, + ) { + return _crealf( + _Z, + ); + } + + late final _crealfPtr = + _lookup>('crealf'); + late final _crealf = _crealfPtr.asFunction(); + + _Fcomplex csinf( + _Fcomplex _Z, + ) { + return _csinf( + _Z, + ); + } + + late final _csinfPtr = + _lookup>('csinf'); + late final _csinf = _csinfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); + + _Fcomplex csinhf( + _Fcomplex _Z, + ) { + return _csinhf( + _Z, + ); + } + + late final _csinhfPtr = + _lookup>('csinhf'); + late final _csinhf = _csinhfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); + + _Fcomplex csqrtf( + _Fcomplex _Z, + ) { + return _csqrtf( + _Z, + ); + } + + late final _csqrtfPtr = + _lookup>('csqrtf'); + late final _csqrtf = _csqrtfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); + + _Fcomplex ctanf( + _Fcomplex _Z, + ) { + return _ctanf( + _Z, + ); + } + + late final _ctanfPtr = + _lookup>('ctanf'); + late final _ctanf = _ctanfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); + + _Fcomplex ctanhf( + _Fcomplex _Z, + ) { + return _ctanhf( + _Z, + ); + } + + late final _ctanhfPtr = + _lookup>('ctanhf'); + late final _ctanhf = _ctanhfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); + + double normf( + _Fcomplex _Z, + ) { + return _normf( + _Z, + ); + } + + late final _normfPtr = + _lookup>('normf'); + late final _normf = _normfPtr.asFunction(); + + _Dcomplex _Cbuild( + double _Re, + double _Im, + ) { + return __Cbuild( + _Re, + _Im, + ); + } + + late final __CbuildPtr = + _lookup>( + '_Cbuild'); + late final __Cbuild = + __CbuildPtr.asFunction<_Dcomplex Function(double, double)>(); + + _Dcomplex _Cmulcc( + _Dcomplex _X, + _Dcomplex _Y, + ) { + return __Cmulcc( + _X, + _Y, + ); + } + + late final __CmulccPtr = + _lookup>( + '_Cmulcc'); + late final __Cmulcc = + __CmulccPtr.asFunction<_Dcomplex Function(_Dcomplex, _Dcomplex)>(); + + _Dcomplex _Cmulcr( + _Dcomplex _X, + double _Y, + ) { + return __Cmulcr( + _X, + _Y, + ); + } + + late final __CmulcrPtr = + _lookup>( + '_Cmulcr'); + late final __Cmulcr = + __CmulcrPtr.asFunction<_Dcomplex Function(_Dcomplex, double)>(); + + _Fcomplex _FCbuild( + double _Re, + double _Im, + ) { + return __FCbuild( + _Re, + _Im, + ); + } + + late final __FCbuildPtr = + _lookup>( + '_FCbuild'); + late final __FCbuild = + __FCbuildPtr.asFunction<_Fcomplex Function(double, double)>(); + + _Fcomplex _FCmulcc( + _Fcomplex _X, + _Fcomplex _Y, + ) { + return __FCmulcc( + _X, + _Y, + ); + } + + late final __FCmulccPtr = + _lookup>( + '_FCmulcc'); + late final __FCmulcc = + __FCmulccPtr.asFunction<_Fcomplex Function(_Fcomplex, _Fcomplex)>(); + + _Fcomplex _FCmulcr( + _Fcomplex _X, + double _Y, + ) { + return __FCmulcr( + _X, + _Y, + ); + } + + late final __FCmulcrPtr = + _lookup>( + '_FCmulcr'); + late final __FCmulcr = + __FCmulcrPtr.asFunction<_Fcomplex Function(_Fcomplex, double)>(); + + ffi.Pointer Create( + ffi.Pointer cfg, + ) { + return _Create( + cfg, + ); + } + + late final _CreatePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('Create'); + late final _Create = _CreatePtr.asFunction< + ffi.Pointer Function(ffi.Pointer)>(); + + ffi.Pointer Invoke( + int index, + ffi.Pointer req, + ) { + return _Invoke( + index, + req, + ); + } + + late final _InvokePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + GoInt, ffi.Pointer)>>('Invoke'); + late final _Invoke = _InvokePtr.asFunction< + ffi.Pointer Function(int, ffi.Pointer)>(); +} + +typedef va_list = ffi.Pointer; + +final class __crt_locale_data_public extends ffi.Struct { + external ffi.Pointer _locale_pctype; + + @ffi.Int() + external int _locale_mb_cur_max; + + @ffi.UnsignedInt() + external int _locale_lc_codepage; +} + +final class __crt_locale_pointers extends ffi.Struct { + external ffi.Pointer<__crt_locale_data> locinfo; + + external ffi.Pointer<__crt_multibyte_data> mbcinfo; +} + +final class __crt_locale_data extends ffi.Opaque {} + +final class __crt_multibyte_data extends ffi.Opaque {} + +final class _Mbstatet extends ffi.Struct { + @ffi.UnsignedLong() + external int _Wchar; + + @ffi.UnsignedShort() + external int _Byte; + + @ffi.UnsignedShort() + external int _State; +} + +typedef errno_t = ffi.Int; +typedef Darterrno_t = int; + +final class _GoString_ extends ffi.Struct { + external ffi.Pointer p; + + @ptrdiff_t() + external int n; +} + +typedef ptrdiff_t = ffi.LongLong; +typedef Dartptrdiff_t = int; +typedef rsize_t = ffi.Size; +typedef Dartrsize_t = int; +typedef _CoreCrtSecureSearchSortCompareFunction = ffi.Pointer< + ffi.NativeFunction<_CoreCrtSecureSearchSortCompareFunctionFunction>>; +typedef _CoreCrtSecureSearchSortCompareFunctionFunction = ffi.Int Function( + ffi.Pointer, ffi.Pointer, ffi.Pointer); +typedef Dart_CoreCrtSecureSearchSortCompareFunctionFunction = int Function( + ffi.Pointer, ffi.Pointer, ffi.Pointer); +typedef _CoreCrtNonSecureSearchSortCompareFunction = ffi.Pointer< + ffi.NativeFunction<_CoreCrtNonSecureSearchSortCompareFunctionFunction>>; +typedef _CoreCrtNonSecureSearchSortCompareFunctionFunction = ffi.Int Function( + ffi.Pointer, ffi.Pointer); +typedef Dart_CoreCrtNonSecureSearchSortCompareFunctionFunction = int Function( + ffi.Pointer, ffi.Pointer); +typedef _locale_t = ffi.Pointer<__crt_locale_pointers>; +typedef _onexit_t = ffi.Pointer>; +typedef _onexit_tFunction = ffi.Int Function(); +typedef Dart_onexit_tFunction = int Function(); +typedef _purecall_handler + = ffi.Pointer>; +typedef _purecall_handlerFunction = ffi.Void Function(); +typedef Dart_purecall_handlerFunction = void Function(); +typedef _invalid_parameter_handler + = ffi.Pointer>; +typedef _invalid_parameter_handlerFunction = ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ffi.UnsignedInt, + ffi.UintPtr); +typedef Dart_invalid_parameter_handlerFunction = void Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + int, + int); + +final class _div_t extends ffi.Struct { + @ffi.Int() + external int quot; + + @ffi.Int() + external int rem; +} + +final class _ldiv_t extends ffi.Struct { + @ffi.Long() + external int quot; + + @ffi.Long() + external int rem; +} + +final class _lldiv_t extends ffi.Struct { + @ffi.LongLong() + external int quot; + + @ffi.LongLong() + external int rem; +} + +typedef div_t = _div_t; +typedef ldiv_t = _ldiv_t; +typedef lldiv_t = _lldiv_t; + +final class _LDOUBLE extends ffi.Struct { + @ffi.Array.multi([10]) + external ffi.Array ld; +} + +final class _CRT_DOUBLE extends ffi.Struct { + @ffi.Double() + external double x; +} + +final class _CRT_FLOAT extends ffi.Struct { + @ffi.Float() + external double f; +} + +final class _LONGDOUBLE extends ffi.Opaque {} + +final class _LDBL12 extends ffi.Struct { + @ffi.Array.multi([12]) + external ffi.Array ld12; +} + +final class _C_double_complex extends ffi.Struct { + @ffi.Array.multi([2]) + external ffi.Array _Val; +} + +final class _C_float_complex extends ffi.Struct { + @ffi.Array.multi([2]) + external ffi.Array _Val; +} + +final class _C_ldouble_complex extends ffi.Opaque {} + +typedef _Dcomplex = _C_double_complex; +typedef _Fcomplex = _C_float_complex; + +final class GoInterface extends ffi.Struct { + external ffi.Pointer t; + + external ffi.Pointer v; +} + +final class GoSlice extends ffi.Struct { + external ffi.Pointer data; + + @GoInt() + external int len; + + @GoInt() + external int cap; +} + +typedef GoInt = GoInt64; +typedef GoInt64 = ffi.LongLong; +typedef DartGoInt64 = int; + +const int _VCRT_COMPILER_PREPROCESSOR = 1; + +const int _SAL_VERSION = 20; + +const int __SAL_H_VERSION = 180000000; + +const int _USE_DECLSPECS_FOR_SAL = 0; + +const int _USE_ATTRIBUTES_FOR_SAL = 0; + +const int _CRT_PACKING = 8; + +const int _VCRUNTIME_DISABLED_WARNINGS = 4514; + +const int _HAS_EXCEPTIONS = 1; + +const int _WCHAR_T_DEFINED = 1; + +const int NULL = 0; + +const int _HAS_CXX17 = 0; + +const int _HAS_CXX20 = 0; + +const int _HAS_CXX23 = 0; + +const int _HAS_NODISCARD = 1; + +const int _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE = 1; + +const int _CRT_BUILD_DESKTOP_APP = 1; + +const int _UCRT_DISABLED_WARNINGS = 4324; + +const int _ARGMAX = 100; + +const int _TRUNCATE = -1; + +const int _CRT_INT_MAX = 2147483647; + +const int _CRT_SIZE_MAX = -1; + +const String __FILEW__ = 'C'; + +const int _CRT_FUNCTIONS_REQUIRED = 1; + +const int _CRT_HAS_CXX17 = 0; + +const int _CRT_HAS_C11 = 0; + +const int _CRT_INTERNAL_NONSTDC_NAMES = 1; + +const int __STDC_SECURE_LIB__ = 200411; + +const int __GOT_SECURE_LIB__ = 200411; + +const int __STDC_WANT_SECURE_LIB__ = 1; + +const int _SECURECRT_FILL_BUFFER_PATTERN = 254; + +const int _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES = 0; + +const int _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT = 0; + +const int _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES = 1; + +const int _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY = 0; + +const int _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES_MEMORY = 0; + +const int _MAX_ITOSTR_BASE16_COUNT = 9; + +const int _MAX_ITOSTR_BASE10_COUNT = 12; + +const int _MAX_ITOSTR_BASE8_COUNT = 12; + +const int _MAX_ITOSTR_BASE2_COUNT = 33; + +const int _MAX_LTOSTR_BASE16_COUNT = 9; + +const int _MAX_LTOSTR_BASE10_COUNT = 12; + +const int _MAX_LTOSTR_BASE8_COUNT = 12; + +const int _MAX_LTOSTR_BASE2_COUNT = 33; + +const int _MAX_ULTOSTR_BASE16_COUNT = 9; + +const int _MAX_ULTOSTR_BASE10_COUNT = 11; + +const int _MAX_ULTOSTR_BASE8_COUNT = 12; + +const int _MAX_ULTOSTR_BASE2_COUNT = 33; + +const int _MAX_I64TOSTR_BASE16_COUNT = 17; + +const int _MAX_I64TOSTR_BASE10_COUNT = 21; + +const int _MAX_I64TOSTR_BASE8_COUNT = 23; + +const int _MAX_I64TOSTR_BASE2_COUNT = 65; + +const int _MAX_U64TOSTR_BASE16_COUNT = 17; + +const int _MAX_U64TOSTR_BASE10_COUNT = 21; + +const int _MAX_U64TOSTR_BASE8_COUNT = 23; + +const int _MAX_U64TOSTR_BASE2_COUNT = 65; + +const int CHAR_BIT = 8; + +const int SCHAR_MIN = -128; + +const int SCHAR_MAX = 127; + +const int UCHAR_MAX = 255; + +const int CHAR_MIN = -128; + +const int CHAR_MAX = 127; + +const int MB_LEN_MAX = 5; + +const int SHRT_MIN = -32768; + +const int SHRT_MAX = 32767; + +const int USHRT_MAX = 65535; + +const int INT_MIN = -2147483648; + +const int INT_MAX = 2147483647; + +const int UINT_MAX = 4294967295; + +const int LONG_MIN = -2147483648; + +const int LONG_MAX = 2147483647; + +const int ULONG_MAX = 4294967295; + +const int LLONG_MAX = 9223372036854775807; + +const int LLONG_MIN = -9223372036854775808; + +const int ULLONG_MAX = -1; + +const int _I8_MIN = -128; + +const int _I8_MAX = 127; + +const int _UI8_MAX = 255; + +const int _I16_MIN = -32768; + +const int _I16_MAX = 32767; + +const int _UI16_MAX = 65535; + +const int _I32_MIN = -2147483648; + +const int _I32_MAX = 2147483647; + +const int _UI32_MAX = 4294967295; + +const int _I64_MIN = -9223372036854775808; + +const int _I64_MAX = 9223372036854775807; + +const int _UI64_MAX = -1; + +const int SIZE_MAX = -1; + +const int RSIZE_MAX = 9223372036854775807; + +const int EXIT_SUCCESS = 0; + +const int EXIT_FAILURE = 1; + +const int _WRITE_ABORT_MSG = 1; + +const int _CALL_REPORTFAULT = 2; + +const int _OUT_TO_DEFAULT = 0; + +const int _OUT_TO_STDERR = 1; + +const int _OUT_TO_MSGBOX = 2; + +const int _REPORT_ERRMODE = 3; + +const int RAND_MAX = 32767; + +const int _CVTBUFSIZE = 349; + +const int _MAX_PATH = 260; + +const int _MAX_DRIVE = 3; + +const int _MAX_DIR = 256; + +const int _MAX_FNAME = 256; + +const int _MAX_EXT = 256; + +const int _MAX_ENV = 32767; diff --git a/ui/flutter/lib/api/native/ffi/libgopeed_ffi.dart b/ui/flutter/lib/api/native/ffi/libgopeed_ffi.dart new file mode 100644 index 00000000..4b4b71e7 --- /dev/null +++ b/ui/flutter/lib/api/native/ffi/libgopeed_ffi.dart @@ -0,0 +1,36 @@ +import 'dart:async'; + +import 'package:ffi/ffi.dart'; + +import '../libgopeed_interface.dart'; +import 'libgopeed_bind.dart'; + +class LibgopeedFFi implements LibgopeedAbi { + late LibgopeedBind _libgopeed; + + LibgopeedFFi(LibgopeedBind libgopeed) { + _libgopeed = libgopeed; + } + + @override + Future create(String cfg) { + final cfgPtr = cfg.toNativeUtf8(); + try { + final result = _libgopeed.Create(cfgPtr.cast()); + return Future.value(result.cast().toDartString()); + } finally { + calloc.free(cfgPtr); + } + } + + @override + Future invoke(int instance, String params) { + final paramsPtr = params.toNativeUtf8(); + try { + final result = _libgopeed.Invoke(instance, paramsPtr.cast()); + return Future.value(result.cast().toDartString()); + } finally { + calloc.free(paramsPtr); + } + } +} diff --git a/ui/flutter/lib/api/native/libgopeed_interface.dart b/ui/flutter/lib/api/native/libgopeed_interface.dart new file mode 100644 index 00000000..c8f4b555 --- /dev/null +++ b/ui/flutter/lib/api/native/libgopeed_interface.dart @@ -0,0 +1,83 @@ +import 'package:dio/dio.dart'; + +import '../model/create_task.dart'; +import '../model/create_task_batch.dart'; +import '../model/downloader_config.dart'; +import '../model/extension.dart'; +import '../model/http_listen_result.dart'; +import '../model/info.dart'; +import '../model/install_extension.dart'; +import '../model/request.dart'; +import '../model/resolve_result.dart'; +import '../model/switch_extension.dart'; +import '../model/task.dart'; +import '../model/task_filter.dart'; +import '../model/update_check_extension_resp.dart'; +import '../model/update_extension_settings.dart'; +import 'model/start_config.dart'; + +abstract class LibgopeedAbi { + Future create(String cfg); + Future invoke(int instance, String params); +} + +abstract class LibgopeedApi { + Future init(StartConfig cfg); + + Future startHttp(); + + Future stopHttp(); + + Future restartHttp(); + + Future info(); + + Future resolve(Request request); + + Future createTask(CreateTask createTask); + + Future createTaskBatch(CreateTaskBatch createTask); + + Future pauseTask(String id); + + Future pauseTasks(TaskFilter? filter); + + Future continueTask(String id); + + Future continueTasks(TaskFilter? filter); + + Future deleteTask(String id, bool force); + + Future deleteTasks(TaskFilter? filter, bool force); + + Future getTask(String id); + + Future> getTasks(TaskFilter? filter); + + Future> getTaskStats(String id); + + Future getConfig(); + + Future putConfig(DownloaderConfig config); + + Future installExtension(InstallExtension installExtension); + + Future> getExtensions(); + + Future updateExtensionSettings( + String identity, UpdateExtensionSettings updateExtensionSettings); + + Future switchExtension( + String identity, SwitchExtension switchExtension); + + Future deleteExtension(String identity); + + Future upgradeCheckExtension(String identity); + + Future upgradeExtension(String identity); + + Future close(); + + Future> proxyRequest(String uri, + {data, Options? options}); +} diff --git a/ui/flutter/lib/api/native/model/invoke_request.dart b/ui/flutter/lib/api/native/model/invoke_request.dart new file mode 100644 index 00000000..b697670e --- /dev/null +++ b/ui/flutter/lib/api/native/model/invoke_request.dart @@ -0,0 +1,19 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'invoke_request.g.dart'; + +@JsonSerializable() +class InvokeRequest { + String method; + List params; + + InvokeRequest({ + this.method = '', + this.params = const [], + }); + + factory InvokeRequest.fromJson(Map json) => + _$InvokeRequestFromJson(json); + + Map toJson() => _$InvokeRequestToJson(this); +} diff --git a/ui/flutter/lib/api/native/model/invoke_request.g.dart b/ui/flutter/lib/api/native/model/invoke_request.g.dart new file mode 100644 index 00000000..79e74894 --- /dev/null +++ b/ui/flutter/lib/api/native/model/invoke_request.g.dart @@ -0,0 +1,22 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'invoke_request.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +InvokeRequest _$InvokeRequestFromJson(Map json) => + InvokeRequest( + method: json['method'] as String? ?? '', + params: (json['params'] as List?) + ?.map((e) => e as String) + .toList() ?? + const [], + ); + +Map _$InvokeRequestToJson(InvokeRequest instance) => + { + 'method': instance.method, + 'params': instance.params, + }; diff --git a/ui/flutter/lib/core/common/start_config.dart b/ui/flutter/lib/api/native/model/start_config.dart similarity index 63% rename from ui/flutter/lib/core/common/start_config.dart rename to ui/flutter/lib/api/native/model/start_config.dart index 26bf481d..207428e5 100644 --- a/ui/flutter/lib/core/common/start_config.dart +++ b/ui/flutter/lib/api/native/model/start_config.dart @@ -4,14 +4,13 @@ part 'start_config.g.dart'; @JsonSerializable() class StartConfig { - late String network; - late String address; - late String storage; - late String storageDir; - late int refreshInterval; - late String apiToken; + String storage; + String storageDir; - StartConfig(); + StartConfig({ + this.storage = '', + this.storageDir = '', + }); factory StartConfig.fromJson(Map json) => _$StartConfigFromJson(json); diff --git a/ui/flutter/lib/core/common/start_config.g.dart b/ui/flutter/lib/api/native/model/start_config.g.dart similarity index 53% rename from ui/flutter/lib/core/common/start_config.g.dart rename to ui/flutter/lib/api/native/model/start_config.g.dart index 8732accb..8166b2ab 100644 --- a/ui/flutter/lib/core/common/start_config.g.dart +++ b/ui/flutter/lib/api/native/model/start_config.g.dart @@ -6,20 +6,13 @@ part of 'start_config.dart'; // JsonSerializableGenerator // ************************************************************************** -StartConfig _$StartConfigFromJson(Map json) => StartConfig() - ..network = json['network'] as String - ..address = json['address'] as String - ..storage = json['storage'] as String - ..storageDir = json['storageDir'] as String - ..refreshInterval = json['refreshInterval'] as int - ..apiToken = json['apiToken'] as String; +StartConfig _$StartConfigFromJson(Map json) => StartConfig( + storage: json['storage'] as String? ?? '', + storageDir: json['storageDir'] as String? ?? '', + ); Map _$StartConfigToJson(StartConfig instance) => { - 'network': instance.network, - 'address': instance.address, 'storage': instance.storage, 'storageDir': instance.storageDir, - 'refreshInterval': instance.refreshInterval, - 'apiToken': instance.apiToken, }; diff --git a/ui/flutter/lib/app/modules/app/controllers/app_controller.dart b/ui/flutter/lib/app/modules/app/controllers/app_controller.dart index f6afe361..6be23258 100644 --- a/ui/flutter/lib/app/modules/app/controllers/app_controller.dart +++ b/ui/flutter/lib/app/modules/app/controllers/app_controller.dart @@ -14,10 +14,8 @@ import 'package:uri_to_file/uri_to_file.dart'; import 'package:url_launcher/url_launcher.dart'; import 'package:window_manager/window_manager.dart'; -import '../../../../api/api.dart'; +import '../../../../api/libgopeed_boot.dart'; import '../../../../api/model/downloader_config.dart'; -import '../../../../core/common/start_config.dart'; -import '../../../../core/libgopeed_boot.dart'; import '../../../../database/database.dart'; import '../../../../database/entity.dart'; import '../../../../i18n/message.dart'; @@ -74,12 +72,9 @@ final allTrackerSubscribeUrlCdns = Map.fromIterable(allTrackerSubscribeUrls, }); class AppController extends GetxController with WindowListener, TrayListener { - static StartConfig? _defaultStartConfig; - final autoStartup = false.obs; - final startConfig = StartConfig().obs; - final runningPort = 0.obs; final downloaderConfig = DownloaderConfig().obs; + final httpRunningPort = 0.obs; late AppLinks _appLinks; StreamSubscription? _linkSubscription; @@ -111,7 +106,7 @@ class AppController extends GetxController with WindowListener, TrayListener { void onClose() { _linkSubscription?.cancel(); trayManager.removeListener(this); - LibgopeedBoot.instance.stop(); + LibgopeedBoot.instance.close(); } @override @@ -218,11 +213,12 @@ class AppController extends GetxController with WindowListener, TrayListener { ), MenuItem( label: "startAll".tr, - onClick: (menuItem) async => {continueAllTasks()}, + onClick: (menuItem) async => + {LibgopeedBoot.instance.continueTasks(null)}, ), MenuItem( label: "pauseAll".tr, - onClick: (menuItem) async => {pauseAllTasks()}, + onClick: (menuItem) async => {LibgopeedBoot.instance.pauseTasks(null)}, ), MenuItem( label: 'setting'.tr, @@ -247,7 +243,7 @@ class AppController extends GetxController with WindowListener, TrayListener { label: 'exit'.tr, onClick: (menuItem) async { try { - await LibgopeedBoot.instance.stop(); + await LibgopeedBoot.instance.close(); } catch (e) { logger.w("libgopeed stop fail", e); } @@ -313,43 +309,9 @@ class AppController extends GetxController with WindowListener, TrayListener { await Get.rootDelegate.offAndToNamed(Routes.CREATE, arguments: path); } - String runningAddress() { - if (startConfig.value.network == 'unix') { - return startConfig.value.address; - } - return '${startConfig.value.address.split(':').first}:$runningPort'; - } - - Future _initDefaultStartConfig() async { - if (_defaultStartConfig != null) { - return _defaultStartConfig!; - } - _defaultStartConfig = StartConfig(); - if (!Util.supportUnixSocket()) { - // not support unix socket, use tcp - _defaultStartConfig!.network = "tcp"; - _defaultStartConfig!.address = "127.0.0.1:0"; - } else { - _defaultStartConfig!.network = "unix"; - _defaultStartConfig!.address = - "${(await getTemporaryDirectory()).path}/$unixSocketPath"; - } - _defaultStartConfig!.apiToken = ''; - return _defaultStartConfig!; - } - - Future loadStartConfig() async { - final defaultCfg = await _initDefaultStartConfig(); - final saveCfg = Database.instance.getStartConfig(); - startConfig.value.network = saveCfg?.network ?? defaultCfg.network; - startConfig.value.address = saveCfg?.address ?? defaultCfg.address; - startConfig.value.apiToken = saveCfg?.apiToken ?? defaultCfg.apiToken; - return startConfig.value; - } - Future loadDownloaderConfig() async { try { - downloaderConfig.value = await getConfig(); + downloaderConfig.value = await LibgopeedBoot.instance.getConfig(); } catch (e) { logger.w("load downloader config fail", e, StackTrace.current); downloaderConfig.value = DownloaderConfig(); @@ -382,7 +344,7 @@ class AppController extends GetxController with WindowListener, TrayListener { }); refreshTrackers(); - await saveConfig(); + await LibgopeedBoot.instance.putConfig(downloaderConfig.value); } refreshTrackers() { @@ -411,7 +373,7 @@ class AppController extends GetxController with WindowListener, TrayListener { } Future> _fetchTrackers(String subscribeUrl) async { - final resp = await proxyRequest(subscribeUrl); + final resp = await LibgopeedBoot.instance.proxyRequest(subscribeUrl); if (resp.statusCode != 200) { throw Exception( 'Failed to get trackers, status code: ${resp.statusCode}'); @@ -468,12 +430,4 @@ class AppController extends GetxController with WindowListener, TrayListener { args: ['--${Args.flagHidden}']); autoStartup.value = await launchAtStartup.isEnabled(); } - - Future saveConfig() async { - Database.instance.saveStartConfig(StartConfigEntity( - network: startConfig.value.network, - address: startConfig.value.address, - apiToken: startConfig.value.apiToken)); - await putConfig(downloaderConfig.value); - } } diff --git a/ui/flutter/lib/app/modules/create/views/create_view.dart b/ui/flutter/lib/app/modules/create/views/create_view.dart index cf4e16a2..b3e3e150 100644 --- a/ui/flutter/lib/app/modules/create/views/create_view.dart +++ b/ui/flutter/lib/app/modules/create/views/create_view.dart @@ -7,7 +7,7 @@ import 'package:get/get.dart'; import 'package:path/path.dart' as path; import 'package:rounded_loading_button_plus/rounded_loading_button.dart'; -import '../../../../api/api.dart'; +import '../../../../api/libgopeed_boot.dart'; import '../../../../api/model/create_task.dart'; import '../../../../api/model/options.dart'; import '../../../../api/model/request.dart'; @@ -594,7 +594,7 @@ class CreateView extends GetView { final isDirect = controller.directDownload.value || isMultiLine; if (isDirect) { await Future.wait(urls.map((url) { - return createTask(CreateTask( + return LibgopeedBoot.instance.createTask(CreateTask( req: Request( url: url, extra: parseReqExtra(url), @@ -610,7 +610,7 @@ class CreateView extends GetView { })); Get.rootDelegate.offNamed(Routes.TASK); } else { - final rr = await resolve(Request( + final rr = await LibgopeedBoot.instance.resolve(Request( url: submitUrl, extra: parseReqExtra(_urlController.text), proxy: parseProxy(), @@ -741,23 +741,28 @@ class CreateView extends GetView { await Future.wait( controller.selectedIndexes.map((index) { final file = rr.res.files[index]; - return createTask(CreateTask( - req: file.req!..proxy = parseProxy(), - opt: Options( - name: file.name, - path: path.join(_pathController.text, - rr.res.name, file.path), - selectFiles: [], - extra: optExtra))); + return LibgopeedBoot.instance.createTask( + CreateTask( + req: file.req!..proxy = parseProxy(), + opt: Options( + name: file.name, + path: path.join( + _pathController.text, + rr.res.name, + file.path), + selectFiles: [], + extra: optExtra))); })); } else { - await createTask(CreateTask( - rid: rr.id, - opt: Options( - name: _renameController.text, - path: _pathController.text, - selectFiles: controller.selectedIndexes, - extra: optExtra))); + await LibgopeedBoot.instance.createTask( + CreateTask( + rid: rr.id, + opt: Options( + name: _renameController.text, + path: _pathController.text, + selectFiles: + controller.selectedIndexes, + extra: optExtra))); } Get.back(); Get.rootDelegate.offNamed(Routes.TASK); diff --git a/ui/flutter/lib/app/modules/extension/controllers/extension_controller.dart b/ui/flutter/lib/app/modules/extension/controllers/extension_controller.dart index 54b4c3f6..dc197b3a 100644 --- a/ui/flutter/lib/app/modules/extension/controllers/extension_controller.dart +++ b/ui/flutter/lib/app/modules/extension/controllers/extension_controller.dart @@ -1,6 +1,6 @@ import 'package:get/get.dart'; -import 'package:gopeed/api/api.dart'; +import '../../../../api/libgopeed_boot.dart'; import '../../../../api/model/extension.dart'; class ExtensionController extends GetxController { @@ -17,12 +17,13 @@ class ExtensionController extends GetxController { } Future load() async { - extensions.value = await getExtensions(); + extensions.value = await LibgopeedBoot.instance.getExtensions(); } Future checkUpdate() async { for (final ext in extensions) { - final resp = await upgradeCheckExtension(ext.identity); + final resp = + await LibgopeedBoot.instance.upgradeCheckExtension(ext.identity); if (resp.newVersion.isNotEmpty) { updateFlags[ext.identity] = resp.newVersion; } diff --git a/ui/flutter/lib/app/modules/extension/views/extension_view.dart b/ui/flutter/lib/app/modules/extension/views/extension_view.dart index 0a9dbe4a..a03c67de 100644 --- a/ui/flutter/lib/app/modules/extension/views/extension_view.dart +++ b/ui/flutter/lib/app/modules/extension/views/extension_view.dart @@ -11,7 +11,8 @@ import 'package:path/path.dart' as path; import 'package:rounded_loading_button_plus/rounded_loading_button.dart'; import 'package:url_launcher/url_launcher.dart'; -import '../../../../api/api.dart'; +import '../../../../api/entry/libgopeed_boot_web.dart'; +import '../../../../api/libgopeed_boot.dart'; import '../../../../api/model/extension.dart'; import '../../../../api/model/install_extension.dart'; import '../../../../api/model/switch_extension.dart'; @@ -78,8 +79,9 @@ class ExtensionView extends GetView { } _installBtnController.start(); try { - await installExtension(InstallExtension( - url: _installUrlController.text)); + await LibgopeedBoot.instance.installExtension( + InstallExtension( + url: _installUrlController.text)); Get.snackbar('tip'.tr, 'extensionInstallSuccess'.tr); await controller.load(); } catch (e) { @@ -98,7 +100,7 @@ class ExtensionView extends GetView { if (dir != null) { MacSecureUtil.saveBookmark(dir); try { - await installExtension( + await LibgopeedBoot.instance.installExtension( InstallExtension(devMode: true, url: dir)); Get.snackbar( 'tip'.tr, 'extensionInstallSuccess'.tr); @@ -133,8 +135,10 @@ class ExtensionView extends GetView { ) : Util.isWeb() ? Image.network( - join( - '/fs/extensions/${extension.identity}/${extension.icon}'), + (LibgopeedBoot.instance + as LibgopeedBootWeb) + .join( + '/fs/extensions/${extension.identity}/${extension.icon}'), width: 48, height: 48, ) @@ -155,9 +159,9 @@ class ExtensionView extends GetView { value: !extension.disabled, onChanged: (value) async { try { - await switchExtension( - extension.identity, - SwitchExtension(status: value)); + await LibgopeedBoot.instance + .switchExtension(extension.identity, + SwitchExtension(status: value)); await controller.load(); } catch (e) { showErrorMessage(e); @@ -354,10 +358,11 @@ class ExtensionView extends GetView { try { confrimController.start(); if (formKey.currentState?.saveAndValidate() == true) { - await updateExtensionSettings( - extension.identity, - UpdateExtensionSettings( - settings: formKey.currentState!.value)); + await LibgopeedBoot.instance + .updateExtensionSettings( + extension.identity, + UpdateExtensionSettings( + settings: formKey.currentState!.value)); await controller.load(); Get.back(); } @@ -454,7 +459,8 @@ class ExtensionView extends GetView { ), onPressed: () async { try { - await deleteExtension(extension.identity); + await LibgopeedBoot.instance + .deleteExtension(extension.identity); await controller.load(); Get.back(); } catch (e) { @@ -487,18 +493,19 @@ class ExtensionView extends GetView { onPressed: () async { confrimController.start(); try { - await updateExtension(extension.identity); + await LibgopeedBoot.instance + .upgradeExtension(extension.identity); await controller.load(); controller.updateFlags.remove(extension.identity); Get.back(); - showMessage('tip'.tr, 'extensionUpdateSuccess'.tr); + showMessage('tip'.tr, 'extensionUpgradeSuccess'.tr); } catch (e) { showErrorMessage(e); } finally { confrimController.stop(); } }, - child: Text('newVersionUpdate'.tr), + child: Text('newVersionUpgrade'.tr), ), ], )); diff --git a/ui/flutter/lib/app/modules/setting/controllers/setting_controller.dart b/ui/flutter/lib/app/modules/setting/controllers/setting_controller.dart index 3f1995c0..844e3a3f 100644 --- a/ui/flutter/lib/app/modules/setting/controllers/setting_controller.dart +++ b/ui/flutter/lib/app/modules/setting/controllers/setting_controller.dart @@ -1,7 +1,8 @@ import 'dart:convert'; import 'package:get/get.dart'; -import 'package:gopeed/api/api.dart'; + +import '../../../../api/libgopeed_boot.dart'; class SettingController extends GetxController { final tapStatues = {}.obs; @@ -28,12 +29,13 @@ class SettingController extends GetxController { void fetchLatestVersion() async { String? releaseDataStr; try { - releaseDataStr = (await proxyRequest( + releaseDataStr = (await LibgopeedBoot.instance.proxyRequest( "https://api.github.com/repos/GopeedLab/gopeed/releases/latest")) .data; } catch (e) { - releaseDataStr = - (await proxyRequest("https://gopeed.com/api/release")).data; + releaseDataStr = (await LibgopeedBoot.instance + .proxyRequest("https://gopeed.com/api/release")) + .data; } if (releaseDataStr == null) { return; diff --git a/ui/flutter/lib/app/modules/setting/views/setting_view.dart b/ui/flutter/lib/app/modules/setting/views/setting_view.dart index afa7e231..9dc3313e 100644 --- a/ui/flutter/lib/app/modules/setting/views/setting_view.dart +++ b/ui/flutter/lib/app/modules/setting/views/setting_view.dart @@ -10,6 +10,7 @@ import 'package:intl/intl.dart'; import 'package:launch_at_startup/launch_at_startup.dart'; import 'package:url_launcher/url_launcher.dart'; +import '../../../../api/libgopeed_boot.dart'; import '../../../../api/model/downloader_config.dart'; import '../../../../i18n/message.dart'; import '../../../../util/input_formatter.dart'; @@ -35,7 +36,6 @@ class SettingView extends GetView { Widget build(BuildContext context) { final appController = Get.find(); final downloaderCfg = appController.downloaderConfig; - final startCfg = appController.startConfig; Timer? timer; Future debounceSave( @@ -51,8 +51,8 @@ class SettingView extends GetView { return; } } - appController - .saveConfig() + LibgopeedBoot.instance + .putConfig(downloaderCfg.value) .then((_) => completer.complete(true)) .onError(completer.completeError); if (needRestart) { @@ -530,7 +530,7 @@ class SettingView extends GetView { launchUrl(Uri.parse('https://gopeed.com'), mode: LaunchMode.externalApplication); }, - child: Text('newVersionUpdate'.tr), + child: Text('newVersionUpgrade'.tr), ), ], )); @@ -637,7 +637,7 @@ class SettingView extends GetView { final portController = TextEditingController(text: port); updateAddress() async { final newAddress = '${ipController.text}:${portController.text}'; - if (newAddress != startCfg.value.address) { + if (newAddress != proxy.host) { proxy.host = newAddress; await debounceSave(); @@ -718,152 +718,152 @@ class SettingView extends GetView { ); // advanced config API items start - final buildApiProtocol = _buildConfigItem( - 'protocol', - () => startCfg.value.network == 'tcp' - ? 'TCP ${startCfg.value.address}' - : 'Unix', - (Key key) { - final items = [ - SizedBox( - width: 80, - child: DropdownButtonFormField( - value: startCfg.value.network, - onChanged: Util.isDesktop() - ? (value) async { - startCfg.update((val) { - val!.network = value!; - }); + // final buildApiProtocol = _buildConfigItem( + // 'protocol', + // () => startCfg.value.host == 'tcp' + // ? 'TCP ${startCfg.value.address}' + // : 'Unix', + // (Key key) { + // final items = [ + // SizedBox( + // width: 80, + // child: DropdownButtonFormField( + // value: startCfg.value.host, + // onChanged: Util.isDesktop() + // ? (value) async { + // startCfg.update((val) { + // val!.host = value!; + // }); - await debounceSave(needRestart: true); - } - : null, - items: [ - const DropdownMenuItem( - value: 'tcp', - child: Text('TCP'), - ), - Util.supportUnixSocket() - ? const DropdownMenuItem( - value: 'unix', - child: Text('Unix'), - ) - : null, - ].where((e) => e != null).map((e) => e!).toList(), - ), - ) - ]; - if (Util.isDesktop() && startCfg.value.network == 'tcp') { - final arr = startCfg.value.address.split(':'); - var ip = '127.0.0.1'; - var port = '0'; - if (arr.length > 1) { - ip = arr[0]; - port = arr[1]; - } + // await debounceSave(needRestart: true); + // } + // : null, + // items: [ + // const DropdownMenuItem( + // value: 'tcp', + // child: Text('TCP'), + // ), + // Util.supportUnixSocket() + // ? const DropdownMenuItem( + // value: 'unix', + // child: Text('Unix'), + // ) + // : null, + // ].where((e) => e != null).map((e) => e!).toList(), + // ), + // ) + // ]; + // if (Util.isDesktop() && startCfg.value.host == 'tcp') { + // final arr = startCfg.value.address.split(':'); + // var ip = '127.0.0.1'; + // var port = '0'; + // if (arr.length > 1) { + // ip = arr[0]; + // port = arr[1]; + // } - final ipController = TextEditingController(text: ip); - final portController = TextEditingController(text: port); - updateAddress() async { - if (ipController.text.isEmpty || portController.text.isEmpty) { - return; - } - final newAddress = '${ipController.text}:${portController.text}'; - if (newAddress != startCfg.value.address) { - startCfg.value.address = newAddress; + // final ipController = TextEditingController(text: ip); + // final portController = TextEditingController(text: port); + // updateAddress() async { + // if (ipController.text.isEmpty || portController.text.isEmpty) { + // return; + // } + // final newAddress = '${ipController.text}:${portController.text}'; + // if (newAddress != startCfg.value.address) { + // startCfg.value.address = newAddress; - final saved = await debounceSave( - check: () async { - // Check if address already in use - final configIp = ipController.text; - final configPort = int.parse(portController.text); - if (configPort == 0) { - return ''; - } - try { - final socket = await Socket.connect(configIp, configPort, - timeout: const Duration(seconds: 3)); - socket.close(); - return 'portInUse' - .trParams({'port': configPort.toString()}); - } catch (e) { - return ''; - } - }, - needRestart: true); + // final saved = await debounceSave( + // check: () async { + // // Check if address already in use + // final configIp = ipController.text; + // final configPort = int.parse(portController.text); + // if (configPort == 0) { + // return ''; + // } + // try { + // final socket = await Socket.connect(configIp, configPort, + // timeout: const Duration(seconds: 3)); + // socket.close(); + // return 'portInUse' + // .trParams({'port': configPort.toString()}); + // } catch (e) { + // return ''; + // } + // }, + // needRestart: true); - // If save failed, restore the old address - if (!saved) { - final oldAddress = - (await appController.loadStartConfig()).address; - startCfg.update((val) async { - val!.address = oldAddress; - }); - } - } - } + // // If save failed, restore the old address + // if (!saved) { + // // final oldAddress = + // // (await appController.loadStartConfig()).address; + // // startCfg.update((val) async { + // // val!.address = oldAddress; + // // }); + // } + // } + // } - ipController.addListener(updateAddress); - portController.addListener(updateAddress); - items.addAll([ - const Padding(padding: EdgeInsets.only(left: 20)), - Flexible( - child: TextFormField( - controller: ipController, - decoration: const InputDecoration( - labelText: 'IP', - contentPadding: EdgeInsets.all(0.0), - ), - keyboardType: TextInputType.number, - inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp('[0-9.]')), - ], - ), - ), - const Padding(padding: EdgeInsets.only(left: 10)), - Flexible( - child: TextFormField( - controller: portController, - decoration: InputDecoration( - labelText: 'port'.tr, - contentPadding: const EdgeInsets.all(0.0), - ), - keyboardType: TextInputType.number, - inputFormatters: [ - FilteringTextInputFormatter.digitsOnly, - NumericalRangeFormatter(min: 0, max: 65535), - ], - ), - ), - ]); - } + // ipController.addListener(updateAddress); + // portController.addListener(updateAddress); + // items.addAll([ + // const Padding(padding: EdgeInsets.only(left: 20)), + // Flexible( + // child: TextFormField( + // controller: ipController, + // decoration: const InputDecoration( + // labelText: 'IP', + // contentPadding: EdgeInsets.all(0.0), + // ), + // keyboardType: TextInputType.number, + // inputFormatters: [ + // FilteringTextInputFormatter.allow(RegExp('[0-9.]')), + // ], + // ), + // ), + // const Padding(padding: EdgeInsets.only(left: 10)), + // Flexible( + // child: TextFormField( + // controller: portController, + // decoration: InputDecoration( + // labelText: 'port'.tr, + // contentPadding: const EdgeInsets.all(0.0), + // ), + // keyboardType: TextInputType.number, + // inputFormatters: [ + // FilteringTextInputFormatter.digitsOnly, + // NumericalRangeFormatter(min: 0, max: 65535), + // ], + // ), + // ), + // ]); + // } - return Form( - child: Row( - children: items, - ), - ); - }, - ); - final buildApiToken = _buildConfigItem('apiToken', - () => startCfg.value.apiToken.isEmpty ? 'notSet'.tr : 'set'.tr, - (Key key) { - final apiTokenController = - TextEditingController(text: startCfg.value.apiToken); - apiTokenController.addListener(() async { - if (apiTokenController.text != startCfg.value.apiToken) { - startCfg.value.apiToken = apiTokenController.text; + // return Form( + // child: Row( + // children: items, + // ), + // ); + // }, + // ); + // final buildApiToken = _buildConfigItem('apiToken', + // () => startCfg.value.apiToken.isEmpty ? 'notSet'.tr : 'set'.tr, + // (Key key) { + // final apiTokenController = + // TextEditingController(text: startCfg.value.apiToken); + // apiTokenController.addListener(() async { + // if (apiTokenController.text != startCfg.value.apiToken) { + // startCfg.value.apiToken = apiTokenController.text; - await debounceSave(needRestart: true); - } - }); - return TextField( - key: key, - obscureText: true, - controller: apiTokenController, - focusNode: FocusNode(), - ); - }); + // await debounceSave(needRestart: true); + // } + // }); + // return TextField( + // key: key, + // obscureText: true, + // controller: apiTokenController, + // focusNode: FocusNode(), + // ); + // }); // advanced config log items start buildLogsDir() { @@ -993,16 +993,16 @@ class SettingView extends GetView { child: Column( children: _addDivider([buildProxy()]), )), - const Text('API'), - Card( - child: Column( - children: _addDivider([ - buildApiProtocol(), - Util.isDesktop() && startCfg.value.network == 'tcp' - ? buildApiToken() - : null, - ]), - )), + // const Text('API'), + // Card( + // child: Column( + // children: _addDivider([ + // buildApiProtocol(), + // Util.isDesktop() && startCfg.value.host == 'tcp' + // ? buildApiToken() + // : null, + // ]), + // )), Text('developer'.tr), Card( child: Column( diff --git a/ui/flutter/lib/app/modules/task/controllers/task_files_controller.dart b/ui/flutter/lib/app/modules/task/controllers/task_files_controller.dart index 3eadf232..0af67757 100644 --- a/ui/flutter/lib/app/modules/task/controllers/task_files_controller.dart +++ b/ui/flutter/lib/app/modules/task/controllers/task_files_controller.dart @@ -1,5 +1,5 @@ import 'package:get/get.dart'; -import '../../../../api/api.dart'; +import '../../../../api/libgopeed_boot.dart'; import '../../../../api/model/resource.dart'; import '../../../../api/model/task.dart'; @@ -31,7 +31,7 @@ class TaskFilesController extends GetxController { super.onInit(); final taskId = Get.rootDelegate.parameters['id']; - final tasks = await getTasks([]); + final tasks = await LibgopeedBoot.instance.getTasks(null); task.value = tasks.firstWhere((element) => element.id == taskId); parseDirMap(task.value!.meta.res!.files); toDir("/"); diff --git a/ui/flutter/lib/app/modules/task/controllers/task_list_controller.dart b/ui/flutter/lib/app/modules/task/controllers/task_list_controller.dart index bca35967..883b790d 100644 --- a/ui/flutter/lib/app/modules/task/controllers/task_list_controller.dart +++ b/ui/flutter/lib/app/modules/task/controllers/task_list_controller.dart @@ -2,8 +2,9 @@ import 'dart:async'; import 'package:get/get.dart'; -import '../../../../api/api.dart'; +import '../../../../api/libgopeed_boot.dart'; import '../../../../api/model/task.dart'; +import '../../../../api/model/task_filter.dart'; abstract class TaskListController extends GetxController { List statuses; @@ -44,7 +45,8 @@ abstract class TaskListController extends GetxController { } getTasksState() async { - final tasks = await getTasks(statuses); + final tasks = + await LibgopeedBoot.instance.getTasks(TaskFilter(statuses: statuses)); // sort tasks by create time tasks.sort(compare); this.tasks.value = tasks; diff --git a/ui/flutter/lib/app/modules/task/views/task_files_view.dart b/ui/flutter/lib/app/modules/task/views/task_files_view.dart index 0cd38d4d..18d02edb 100644 --- a/ui/flutter/lib/app/modules/task/views/task_files_view.dart +++ b/ui/flutter/lib/app/modules/task/views/task_files_view.dart @@ -5,7 +5,8 @@ import 'package:path/path.dart'; import 'package:share_plus/share_plus.dart'; import 'package:url_launcher/url_launcher.dart'; -import '../../../../api/api.dart' as api; +import '../../../../api/entry/libgopeed_boot_web.dart'; +import '../../../../api/libgopeed_boot.dart'; import '../../../../util/browser_download/browser_download.dart'; import '../../../../util/file_icon.dart'; import '../../../../util/icons.dart'; @@ -84,8 +85,10 @@ class TaskFilesView extends GetView { mainAxisAlignment: MainAxisAlignment.end, children: Util.isWeb() ? () { - final accessUrl = api.join( - "/fs/tasks/${controller.task.value!.id}$fileRelativePath"); + final accessUrl = (LibgopeedBoot + .instance as LibgopeedBootWeb) + .join( + "/fs/tasks/${controller.task.value!.id}$fileRelativePath"); return [ IconButton( icon: diff --git a/ui/flutter/lib/app/views/buid_task_list_view.dart b/ui/flutter/lib/app/views/buid_task_list_view.dart index cb630efa..4f73576f 100644 --- a/ui/flutter/lib/app/views/buid_task_list_view.dart +++ b/ui/flutter/lib/app/views/buid_task_list_view.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:styled_widget/styled_widget.dart'; -import '../../api/api.dart'; +import '../../api/libgopeed_boot.dart'; import '../../api/model/task.dart'; import '../../util/file_icon.dart'; import '../../util/icons.dart'; @@ -95,8 +95,9 @@ class BuildTaskListView extends GetView { try { final force = !appController .downloaderConfig.value.extra.lastDeleteTaskKeep; - await appController.saveConfig(); - await deleteTask(id, force); + LibgopeedBoot.instance + .putConfig(appController.downloaderConfig.value); + await LibgopeedBoot.instance.deleteTask(id, force); Get.back(); } catch (e) { showErrorMessage(e); @@ -122,7 +123,7 @@ class BuildTaskListView extends GetView { icon: const Icon(Icons.pause), onPressed: () async { try { - await pauseTask(task.id); + await LibgopeedBoot.instance.pauseTask(task.id); } catch (e) { showErrorMessage(e); } @@ -133,7 +134,7 @@ class BuildTaskListView extends GetView { icon: const Icon(Icons.play_arrow), onPressed: () async { try { - await continueTask(task.id); + await LibgopeedBoot.instance.continueTask(task.id); } catch (e) { showErrorMessage(e); } diff --git a/ui/flutter/lib/core/common/libgopeed_channel.dart b/ui/flutter/lib/core/common/libgopeed_channel.dart deleted file mode 100644 index a94d3744..00000000 --- a/ui/flutter/lib/core/common/libgopeed_channel.dart +++ /dev/null @@ -1,23 +0,0 @@ -import 'dart:convert'; - -import 'package:flutter/services.dart'; - -import 'libgopeed_interface.dart'; -import 'start_config.dart'; - -class LibgopeedChannel implements LibgopeedInterface { - static const _channel = MethodChannel('gopeed.com/libgopeed'); - - @override - Future start(StartConfig cfg) async { - final port = await _channel.invokeMethod('start', { - 'cfg': jsonEncode(cfg), - }); - return port as int; - } - - @override - Future stop() async { - return await _channel.invokeMethod('stop'); - } -} diff --git a/ui/flutter/lib/core/common/libgopeed_ffi.dart b/ui/flutter/lib/core/common/libgopeed_ffi.dart deleted file mode 100644 index ae2db5f9..00000000 --- a/ui/flutter/lib/core/common/libgopeed_ffi.dart +++ /dev/null @@ -1,37 +0,0 @@ -import 'dart:async'; -import 'dart:convert'; -import 'dart:ffi'; - -import 'package:ffi/ffi.dart'; - -import '../ffi/libgopeed_bind.dart'; -import 'libgopeed_interface.dart'; -import 'start_config.dart'; - -class LibgopeedFFi implements LibgopeedInterface { - late LibgopeedBind _libgopeed; - - LibgopeedFFi(LibgopeedBind libgopeed) { - _libgopeed = libgopeed; - } - - @override - Future start(StartConfig cfg) { - var completer = Completer(); - var result = _libgopeed.Start(jsonEncode(cfg).toNativeUtf8().cast()); - if (result.r1 != nullptr) { - completer.completeError(Exception(result.r1.cast().toDartString())); - } else { - completer.complete(result.r0); - } - return completer.future; - } - - @override - Future stop() { - var completer = Completer(); - _libgopeed.Stop(); - completer.complete(); - return completer.future; - } -} diff --git a/ui/flutter/lib/core/common/libgopeed_interface.dart b/ui/flutter/lib/core/common/libgopeed_interface.dart deleted file mode 100644 index 559d799f..00000000 --- a/ui/flutter/lib/core/common/libgopeed_interface.dart +++ /dev/null @@ -1,7 +0,0 @@ -import 'start_config.dart'; - -abstract class LibgopeedInterface { - Future start(StartConfig cfg); - - Future stop(); -} diff --git a/ui/flutter/lib/core/entry/libgopeed_boot_browser.dart b/ui/flutter/lib/core/entry/libgopeed_boot_browser.dart deleted file mode 100644 index 05efe963..00000000 --- a/ui/flutter/lib/core/entry/libgopeed_boot_browser.dart +++ /dev/null @@ -1,18 +0,0 @@ -import 'dart:async'; - -import '../common/start_config.dart'; - -import '../libgopeed_boot.dart'; - -LibgopeedBoot create() => LibgopeedBootBrowser(); - -class LibgopeedBootBrowser implements LibgopeedBoot { - // do nothing - @override - Future start(StartConfig cfg) async { - return 0; - } - - @override - Future stop() async {} -} diff --git a/ui/flutter/lib/core/entry/libgopeed_boot_native.dart b/ui/flutter/lib/core/entry/libgopeed_boot_native.dart deleted file mode 100644 index c03f004c..00000000 --- a/ui/flutter/lib/core/entry/libgopeed_boot_native.dart +++ /dev/null @@ -1,49 +0,0 @@ -import 'dart:async'; -import 'dart:ffi'; -import 'dart:io'; - -import '../../util/util.dart'; -import '../common/libgopeed_channel.dart'; -import '../common/libgopeed_ffi.dart'; -import '../common/libgopeed_interface.dart'; -import '../common/start_config.dart'; -import '../ffi/libgopeed_bind.dart'; -import '../libgopeed_boot.dart'; - -LibgopeedBoot create() => LibgopeedBootNative(); - -class LibgopeedBootNative implements LibgopeedBoot { - late LibgopeedInterface _libgopeed; - - LibgopeedBootNative() { - if (Util.isDesktop()) { - var libName = "libgopeed."; - if (Platform.isWindows) { - libName += "dll"; - } - if (Platform.isMacOS) { - libName += "dylib"; - } - if (Platform.isLinux) { - libName += "so"; - } - _libgopeed = LibgopeedFFi(LibgopeedBind(DynamicLibrary.open(libName))); - } else { - _libgopeed = LibgopeedChannel(); - } - } - - @override - Future start(StartConfig cfg) async { - cfg.storage = 'bolt'; - cfg.storageDir = Util.getStorageDir(); - cfg.refreshInterval = 0; - var port = await _libgopeed.start(cfg); - return port; - } - - @override - Future stop() async { - await _libgopeed.stop(); - } -} diff --git a/ui/flutter/lib/core/ffi/libgopeed_bind.dart b/ui/flutter/lib/core/ffi/libgopeed_bind.dart deleted file mode 100644 index 53ddedb7..00000000 --- a/ui/flutter/lib/core/ffi/libgopeed_bind.dart +++ /dev/null @@ -1,1034 +0,0 @@ -// AUTO GENERATED FILE, DO NOT EDIT. -// -// Generated by `package:ffigen`. -// ignore_for_file: type=lint -import 'dart:ffi' as ffi; - -/// Bindings to gopeed library. -class LibgopeedBind { - /// Holds the symbol lookup function. - final ffi.Pointer Function(String symbolName) - _lookup; - - /// The symbols are looked up in [dynamicLibrary]. - LibgopeedBind(ffi.DynamicLibrary dynamicLibrary) - : _lookup = dynamicLibrary.lookup; - - /// The symbols are looked up with [lookup]. - LibgopeedBind.fromLookup( - ffi.Pointer Function(String symbolName) - lookup) - : _lookup = lookup; - - void __va_start( - ffi.Pointer arg0, - ) { - return ___va_start( - arg0, - ); - } - - late final ___va_startPtr = - _lookup)>>( - '__va_start'); - late final ___va_start = - ___va_startPtr.asFunction)>(); - - void __security_init_cookie() { - return ___security_init_cookie(); - } - - late final ___security_init_cookiePtr = - _lookup>( - '__security_init_cookie'); - late final ___security_init_cookie = - ___security_init_cookiePtr.asFunction(); - - void __security_check_cookie( - int _StackCookie, - ) { - return ___security_check_cookie( - _StackCookie, - ); - } - - late final ___security_check_cookiePtr = - _lookup>( - '__security_check_cookie'); - late final ___security_check_cookie = - ___security_check_cookiePtr.asFunction(); - - void __report_gsfailure( - int _StackCookie, - ) { - return ___report_gsfailure( - _StackCookie, - ); - } - - late final ___report_gsfailurePtr = - _lookup>( - '__report_gsfailure'); - late final ___report_gsfailure = - ___report_gsfailurePtr.asFunction(); - - late final ffi.Pointer ___security_cookie = - _lookup('__security_cookie'); - - int get __security_cookie => ___security_cookie.value; - - set __security_cookie(int value) => ___security_cookie.value = value; - - void _invalid_parameter_noinfo() { - return __invalid_parameter_noinfo(); - } - - late final __invalid_parameter_noinfoPtr = - _lookup>( - '_invalid_parameter_noinfo'); - late final __invalid_parameter_noinfo = - __invalid_parameter_noinfoPtr.asFunction(); - - void _invalid_parameter_noinfo_noreturn() { - return __invalid_parameter_noinfo_noreturn(); - } - - late final __invalid_parameter_noinfo_noreturnPtr = - _lookup>( - '_invalid_parameter_noinfo_noreturn'); - late final __invalid_parameter_noinfo_noreturn = - __invalid_parameter_noinfo_noreturnPtr.asFunction(); - - void _invoke_watson( - ffi.Pointer _Expression, - ffi.Pointer _FunctionName, - ffi.Pointer _FileName, - int _LineNo, - int _Reserved, - ) { - return __invoke_watson( - _Expression, - _FunctionName, - _FileName, - _LineNo, - _Reserved, - ); - } - - late final __invoke_watsonPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer, - ffi.UnsignedInt, - ffi.UintPtr)>>('_invoke_watson'); - late final __invoke_watson = __invoke_watsonPtr.asFunction< - void Function(ffi.Pointer, ffi.Pointer, - ffi.Pointer, int, int)>(); - - ffi.Pointer _errno() { - return __errno(); - } - - late final __errnoPtr = - _lookup Function()>>('_errno'); - late final __errno = __errnoPtr.asFunction Function()>(); - - int _set_errno( - int _Value, - ) { - return __set_errno( - _Value, - ); - } - - late final __set_errnoPtr = - _lookup>('_set_errno'); - late final __set_errno = __set_errnoPtr.asFunction(); - - int _get_errno( - ffi.Pointer _Value, - ) { - return __get_errno( - _Value, - ); - } - - late final __get_errnoPtr = - _lookup)>>( - '_get_errno'); - late final __get_errno = - __get_errnoPtr.asFunction)>(); - - int __threadid() { - return ___threadid(); - } - - late final ___threadidPtr = - _lookup>('__threadid'); - late final ___threadid = ___threadidPtr.asFunction(); - - int __threadhandle() { - return ___threadhandle(); - } - - late final ___threadhandlePtr = - _lookup>('__threadhandle'); - late final ___threadhandle = ___threadhandlePtr.asFunction(); - - double cabs( - _Dcomplex _Z, - ) { - return _cabs( - _Z, - ); - } - - late final _cabsPtr = - _lookup>('cabs'); - late final _cabs = _cabsPtr.asFunction(); - - _Dcomplex cacos( - _Dcomplex _Z, - ) { - return _cacos( - _Z, - ); - } - - late final _cacosPtr = - _lookup>('cacos'); - late final _cacos = _cacosPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); - - _Dcomplex cacosh( - _Dcomplex _Z, - ) { - return _cacosh( - _Z, - ); - } - - late final _cacoshPtr = - _lookup>('cacosh'); - late final _cacosh = _cacoshPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); - - double carg( - _Dcomplex _Z, - ) { - return _carg( - _Z, - ); - } - - late final _cargPtr = - _lookup>('carg'); - late final _carg = _cargPtr.asFunction(); - - _Dcomplex casin( - _Dcomplex _Z, - ) { - return _casin( - _Z, - ); - } - - late final _casinPtr = - _lookup>('casin'); - late final _casin = _casinPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); - - _Dcomplex casinh( - _Dcomplex _Z, - ) { - return _casinh( - _Z, - ); - } - - late final _casinhPtr = - _lookup>('casinh'); - late final _casinh = _casinhPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); - - _Dcomplex catan( - _Dcomplex _Z, - ) { - return _catan( - _Z, - ); - } - - late final _catanPtr = - _lookup>('catan'); - late final _catan = _catanPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); - - _Dcomplex catanh( - _Dcomplex _Z, - ) { - return _catanh( - _Z, - ); - } - - late final _catanhPtr = - _lookup>('catanh'); - late final _catanh = _catanhPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); - - _Dcomplex ccos( - _Dcomplex _Z, - ) { - return _ccos( - _Z, - ); - } - - late final _ccosPtr = - _lookup>('ccos'); - late final _ccos = _ccosPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); - - _Dcomplex ccosh( - _Dcomplex _Z, - ) { - return _ccosh( - _Z, - ); - } - - late final _ccoshPtr = - _lookup>('ccosh'); - late final _ccosh = _ccoshPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); - - _Dcomplex cexp( - _Dcomplex _Z, - ) { - return _cexp( - _Z, - ); - } - - late final _cexpPtr = - _lookup>('cexp'); - late final _cexp = _cexpPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); - - double cimag( - _Dcomplex _Z, - ) { - return _cimag( - _Z, - ); - } - - late final _cimagPtr = - _lookup>('cimag'); - late final _cimag = _cimagPtr.asFunction(); - - _Dcomplex clog( - _Dcomplex _Z, - ) { - return _clog( - _Z, - ); - } - - late final _clogPtr = - _lookup>('clog'); - late final _clog = _clogPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); - - _Dcomplex clog10( - _Dcomplex _Z, - ) { - return _clog10( - _Z, - ); - } - - late final _clog10Ptr = - _lookup>('clog10'); - late final _clog10 = _clog10Ptr.asFunction<_Dcomplex Function(_Dcomplex)>(); - - _Dcomplex conj( - _Dcomplex _Z, - ) { - return _conj( - _Z, - ); - } - - late final _conjPtr = - _lookup>('conj'); - late final _conj = _conjPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); - - _Dcomplex cpow( - _Dcomplex _X, - _Dcomplex _Y, - ) { - return _cpow( - _X, - _Y, - ); - } - - late final _cpowPtr = - _lookup>( - 'cpow'); - late final _cpow = - _cpowPtr.asFunction<_Dcomplex Function(_Dcomplex, _Dcomplex)>(); - - _Dcomplex cproj( - _Dcomplex _Z, - ) { - return _cproj( - _Z, - ); - } - - late final _cprojPtr = - _lookup>('cproj'); - late final _cproj = _cprojPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); - - double creal( - _Dcomplex _Z, - ) { - return _creal( - _Z, - ); - } - - late final _crealPtr = - _lookup>('creal'); - late final _creal = _crealPtr.asFunction(); - - _Dcomplex csin( - _Dcomplex _Z, - ) { - return _csin( - _Z, - ); - } - - late final _csinPtr = - _lookup>('csin'); - late final _csin = _csinPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); - - _Dcomplex csinh( - _Dcomplex _Z, - ) { - return _csinh( - _Z, - ); - } - - late final _csinhPtr = - _lookup>('csinh'); - late final _csinh = _csinhPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); - - _Dcomplex csqrt( - _Dcomplex _Z, - ) { - return _csqrt( - _Z, - ); - } - - late final _csqrtPtr = - _lookup>('csqrt'); - late final _csqrt = _csqrtPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); - - _Dcomplex ctan( - _Dcomplex _Z, - ) { - return _ctan( - _Z, - ); - } - - late final _ctanPtr = - _lookup>('ctan'); - late final _ctan = _ctanPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); - - _Dcomplex ctanh( - _Dcomplex _Z, - ) { - return _ctanh( - _Z, - ); - } - - late final _ctanhPtr = - _lookup>('ctanh'); - late final _ctanh = _ctanhPtr.asFunction<_Dcomplex Function(_Dcomplex)>(); - - double norm( - _Dcomplex _Z, - ) { - return _norm( - _Z, - ); - } - - late final _normPtr = - _lookup>('norm'); - late final _norm = _normPtr.asFunction(); - - double cabsf( - _Fcomplex _Z, - ) { - return _cabsf( - _Z, - ); - } - - late final _cabsfPtr = - _lookup>('cabsf'); - late final _cabsf = _cabsfPtr.asFunction(); - - _Fcomplex cacosf( - _Fcomplex _Z, - ) { - return _cacosf( - _Z, - ); - } - - late final _cacosfPtr = - _lookup>('cacosf'); - late final _cacosf = _cacosfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); - - _Fcomplex cacoshf( - _Fcomplex _Z, - ) { - return _cacoshf( - _Z, - ); - } - - late final _cacoshfPtr = - _lookup>('cacoshf'); - late final _cacoshf = _cacoshfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); - - double cargf( - _Fcomplex _Z, - ) { - return _cargf( - _Z, - ); - } - - late final _cargfPtr = - _lookup>('cargf'); - late final _cargf = _cargfPtr.asFunction(); - - _Fcomplex casinf( - _Fcomplex _Z, - ) { - return _casinf( - _Z, - ); - } - - late final _casinfPtr = - _lookup>('casinf'); - late final _casinf = _casinfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); - - _Fcomplex casinhf( - _Fcomplex _Z, - ) { - return _casinhf( - _Z, - ); - } - - late final _casinhfPtr = - _lookup>('casinhf'); - late final _casinhf = _casinhfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); - - _Fcomplex catanf( - _Fcomplex _Z, - ) { - return _catanf( - _Z, - ); - } - - late final _catanfPtr = - _lookup>('catanf'); - late final _catanf = _catanfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); - - _Fcomplex catanhf( - _Fcomplex _Z, - ) { - return _catanhf( - _Z, - ); - } - - late final _catanhfPtr = - _lookup>('catanhf'); - late final _catanhf = _catanhfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); - - _Fcomplex ccosf( - _Fcomplex _Z, - ) { - return _ccosf( - _Z, - ); - } - - late final _ccosfPtr = - _lookup>('ccosf'); - late final _ccosf = _ccosfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); - - _Fcomplex ccoshf( - _Fcomplex _Z, - ) { - return _ccoshf( - _Z, - ); - } - - late final _ccoshfPtr = - _lookup>('ccoshf'); - late final _ccoshf = _ccoshfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); - - _Fcomplex cexpf( - _Fcomplex _Z, - ) { - return _cexpf( - _Z, - ); - } - - late final _cexpfPtr = - _lookup>('cexpf'); - late final _cexpf = _cexpfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); - - double cimagf( - _Fcomplex _Z, - ) { - return _cimagf( - _Z, - ); - } - - late final _cimagfPtr = - _lookup>('cimagf'); - late final _cimagf = _cimagfPtr.asFunction(); - - _Fcomplex clogf( - _Fcomplex _Z, - ) { - return _clogf( - _Z, - ); - } - - late final _clogfPtr = - _lookup>('clogf'); - late final _clogf = _clogfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); - - _Fcomplex clog10f( - _Fcomplex _Z, - ) { - return _clog10f( - _Z, - ); - } - - late final _clog10fPtr = - _lookup>('clog10f'); - late final _clog10f = _clog10fPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); - - _Fcomplex conjf( - _Fcomplex _Z, - ) { - return _conjf( - _Z, - ); - } - - late final _conjfPtr = - _lookup>('conjf'); - late final _conjf = _conjfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); - - _Fcomplex cpowf( - _Fcomplex _X, - _Fcomplex _Y, - ) { - return _cpowf( - _X, - _Y, - ); - } - - late final _cpowfPtr = - _lookup>( - 'cpowf'); - late final _cpowf = - _cpowfPtr.asFunction<_Fcomplex Function(_Fcomplex, _Fcomplex)>(); - - _Fcomplex cprojf( - _Fcomplex _Z, - ) { - return _cprojf( - _Z, - ); - } - - late final _cprojfPtr = - _lookup>('cprojf'); - late final _cprojf = _cprojfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); - - double crealf( - _Fcomplex _Z, - ) { - return _crealf( - _Z, - ); - } - - late final _crealfPtr = - _lookup>('crealf'); - late final _crealf = _crealfPtr.asFunction(); - - _Fcomplex csinf( - _Fcomplex _Z, - ) { - return _csinf( - _Z, - ); - } - - late final _csinfPtr = - _lookup>('csinf'); - late final _csinf = _csinfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); - - _Fcomplex csinhf( - _Fcomplex _Z, - ) { - return _csinhf( - _Z, - ); - } - - late final _csinhfPtr = - _lookup>('csinhf'); - late final _csinhf = _csinhfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); - - _Fcomplex csqrtf( - _Fcomplex _Z, - ) { - return _csqrtf( - _Z, - ); - } - - late final _csqrtfPtr = - _lookup>('csqrtf'); - late final _csqrtf = _csqrtfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); - - _Fcomplex ctanf( - _Fcomplex _Z, - ) { - return _ctanf( - _Z, - ); - } - - late final _ctanfPtr = - _lookup>('ctanf'); - late final _ctanf = _ctanfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); - - _Fcomplex ctanhf( - _Fcomplex _Z, - ) { - return _ctanhf( - _Z, - ); - } - - late final _ctanhfPtr = - _lookup>('ctanhf'); - late final _ctanhf = _ctanhfPtr.asFunction<_Fcomplex Function(_Fcomplex)>(); - - double normf( - _Fcomplex _Z, - ) { - return _normf( - _Z, - ); - } - - late final _normfPtr = - _lookup>('normf'); - late final _normf = _normfPtr.asFunction(); - - _Dcomplex _Cbuild( - double _Re, - double _Im, - ) { - return __Cbuild( - _Re, - _Im, - ); - } - - late final __CbuildPtr = - _lookup>( - '_Cbuild'); - late final __Cbuild = - __CbuildPtr.asFunction<_Dcomplex Function(double, double)>(); - - _Dcomplex _Cmulcc( - _Dcomplex _X, - _Dcomplex _Y, - ) { - return __Cmulcc( - _X, - _Y, - ); - } - - late final __CmulccPtr = - _lookup>( - '_Cmulcc'); - late final __Cmulcc = - __CmulccPtr.asFunction<_Dcomplex Function(_Dcomplex, _Dcomplex)>(); - - _Dcomplex _Cmulcr( - _Dcomplex _X, - double _Y, - ) { - return __Cmulcr( - _X, - _Y, - ); - } - - late final __CmulcrPtr = - _lookup>( - '_Cmulcr'); - late final __Cmulcr = - __CmulcrPtr.asFunction<_Dcomplex Function(_Dcomplex, double)>(); - - _Fcomplex _FCbuild( - double _Re, - double _Im, - ) { - return __FCbuild( - _Re, - _Im, - ); - } - - late final __FCbuildPtr = - _lookup>( - '_FCbuild'); - late final __FCbuild = - __FCbuildPtr.asFunction<_Fcomplex Function(double, double)>(); - - _Fcomplex _FCmulcc( - _Fcomplex _X, - _Fcomplex _Y, - ) { - return __FCmulcc( - _X, - _Y, - ); - } - - late final __FCmulccPtr = - _lookup>( - '_FCmulcc'); - late final __FCmulcc = - __FCmulccPtr.asFunction<_Fcomplex Function(_Fcomplex, _Fcomplex)>(); - - _Fcomplex _FCmulcr( - _Fcomplex _X, - double _Y, - ) { - return __FCmulcr( - _X, - _Y, - ); - } - - late final __FCmulcrPtr = - _lookup>( - '_FCmulcr'); - late final __FCmulcr = - __FCmulcrPtr.asFunction<_Fcomplex Function(_Fcomplex, double)>(); - - Start_return Start( - ffi.Pointer cfg, - ) { - return _Start( - cfg, - ); - } - - late final _StartPtr = - _lookup)>>( - 'Start'); - late final _Start = - _StartPtr.asFunction)>(); - - void Stop() { - return _Stop(); - } - - late final _StopPtr = - _lookup>('Stop'); - late final _Stop = _StopPtr.asFunction(); -} - -typedef va_list = ffi.Pointer; - -final class __crt_locale_data_public extends ffi.Struct { - external ffi.Pointer _locale_pctype; - - @ffi.Int() - external int _locale_mb_cur_max; - - @ffi.UnsignedInt() - external int _locale_lc_codepage; -} - -final class __crt_locale_pointers extends ffi.Struct { - external ffi.Pointer<__crt_locale_data> locinfo; - - external ffi.Pointer<__crt_multibyte_data> mbcinfo; -} - -final class __crt_locale_data extends ffi.Opaque {} - -final class __crt_multibyte_data extends ffi.Opaque {} - -final class _Mbstatet extends ffi.Struct { - @ffi.UnsignedLong() - external int _Wchar; - - @ffi.UnsignedShort() - external int _Byte; - - @ffi.UnsignedShort() - external int _State; -} - -typedef errno_t = ffi.Int; - -final class _GoString_ extends ffi.Struct { - external ffi.Pointer p; - - @ptrdiff_t() - external int n; -} - -typedef ptrdiff_t = ffi.LongLong; - -final class _C_double_complex extends ffi.Struct { - @ffi.Array.multi([2]) - external ffi.Array _Val; -} - -final class _C_float_complex extends ffi.Struct { - @ffi.Array.multi([2]) - external ffi.Array _Val; -} - -final class _C_ldouble_complex extends ffi.Opaque {} - -typedef _Dcomplex = _C_double_complex; -typedef _Fcomplex = _C_float_complex; - -final class GoInterface extends ffi.Struct { - external ffi.Pointer t; - - external ffi.Pointer v; -} - -final class GoSlice extends ffi.Struct { - external ffi.Pointer data; - - @GoInt() - external int len; - - @GoInt() - external int cap; -} - -typedef GoInt = GoInt64; -typedef GoInt64 = ffi.LongLong; - -final class Start_return extends ffi.Struct { - @GoInt() - external int r0; - - external ffi.Pointer r1; -} - -const int _VCRT_COMPILER_PREPROCESSOR = 1; - -const int _SAL_VERSION = 20; - -const int __SAL_H_VERSION = 180000000; - -const int _USE_DECLSPECS_FOR_SAL = 0; - -const int _USE_ATTRIBUTES_FOR_SAL = 0; - -const int _CRT_PACKING = 8; - -const int _VCRUNTIME_DISABLED_WARNINGS = 4514; - -const int _HAS_EXCEPTIONS = 1; - -const int _WCHAR_T_DEFINED = 1; - -const int NULL = 0; - -const int _HAS_CXX17 = 0; - -const int _HAS_CXX20 = 0; - -const int _HAS_CXX23 = 0; - -const int _HAS_NODISCARD = 1; - -const int _UCRT_DISABLED_WARNINGS = 4324; - -const int _ARGMAX = 100; - -const int _TRUNCATE = -1; - -const int _CRT_INT_MAX = 2147483647; - -const int _CRT_SIZE_MAX = -1; - -const String __FILEW__ = 'C'; - -const int _CRT_FUNCTIONS_REQUIRED = 1; - -const int _CRT_HAS_CXX17 = 0; - -const int _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE = 1; - -const int _CRT_BUILD_DESKTOP_APP = 1; - -const int _CRT_INTERNAL_NONSTDC_NAMES = 1; - -const int __STDC_SECURE_LIB__ = 200411; - -const int __GOT_SECURE_LIB__ = 200411; - -const int __STDC_WANT_SECURE_LIB__ = 1; - -const int _SECURECRT_FILL_BUFFER_PATTERN = 254; - -const int _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES = 0; - -const int _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT = 0; - -const int _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES = 1; - -const int _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY = 0; - -const int _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES_MEMORY = 0; diff --git a/ui/flutter/lib/i18n/langs/en_us.dart b/ui/flutter/lib/i18n/langs/en_us.dart index 6af60fa4..6dc9cfcb 100644 --- a/ui/flutter/lib/i18n/langs/en_us.dart +++ b/ui/flutter/lib/i18n/langs/en_us.dart @@ -71,12 +71,12 @@ const enUS = { 'deleteTaskTip': 'Keep downloaded files', 'delete': 'Delete', 'newVersionTitle': 'Discover new version @version', - 'newVersionUpdate': 'Update Now', + 'newVersionUpgrade': 'Update Now', 'newVersionLater': 'Later', 'extensions': 'Extensions', 'extensionInstallUrl': 'Install URL', 'extensionInstallSuccess': 'Installed successfully', - 'extensionUpdateSuccess': 'Updated successfully', + 'extensionUpgradeSuccess': 'Updated successfully', 'extensionDelete': 'Delete Extension', 'extensionAlreadyLatest': 'It\'s already the latest version', 'extensionFind': 'Find Extensions', diff --git a/ui/flutter/lib/i18n/langs/es_es.dart b/ui/flutter/lib/i18n/langs/es_es.dart index 22219bc7..6aefd6d5 100644 --- a/ui/flutter/lib/i18n/langs/es_es.dart +++ b/ui/flutter/lib/i18n/langs/es_es.dart @@ -21,9 +21,11 @@ const esES = { 'downloadLinkValid': 'Por favor, introduce el enlace de descarga', 'downloadLinkHit': 'Por favor, introduce el enlace de descarga, se admite HTTP/HTTPS/MAGNET@append', - 'downloadLinkHitDesktop': ', o arrastra el archivo torrent aquí directamente', + 'downloadLinkHitDesktop': + ', o arrastra el archivo torrent aquí directamente', 'download': 'Descargar', - 'noFileSelected': 'Por favor, selecciona al menos un archivo para continuar.', + 'noFileSelected': + 'Por favor, selecciona al menos un archivo para continuar.', 'noStoragePermission': 'Se requiere permiso de almacenamiento', 'selectFile': 'Seleccionar Archivo', 'rename': 'Renombrar', @@ -43,7 +45,8 @@ const esES = { 'updateDaily': 'Actualizar diariamente', 'lastUpdate': 'Última actualización: @time', 'addTracker': 'Añadir Tracker', - 'addTrackerHit': 'Por favor, introduce la URL del servidor tracker, una por línea', + 'addTrackerHit': + 'Por favor, introduce la URL del servidor tracker, una por línea', 'ui': 'Interfaz', 'theme': 'Tema', 'themeSystem': 'Sistema', @@ -67,12 +70,12 @@ const esES = { 'deleteTaskTip': 'Mantener archivos descargados', 'delete': 'Eliminar', 'newVersionTitle': 'Nueva versión @version disponible', - 'newVersionUpdate': 'Actualizar Ahora', + 'newVersionUpgrade': 'Actualizar Ahora', 'newVersionLater': 'Más tarde', 'extensions': 'Extensiones', 'extensionInstallUrl': 'URL de instalación', 'extensionInstallSuccess': 'Instalado con éxito', - 'extensionUpdateSuccess': 'Actualizado con éxito', + 'extensionUpgradeSuccess': 'Actualizado con éxito', 'extensionDelete': 'Eliminar Extensión', 'extensionAlreadyLatest': 'Ya es la versión más reciente', 'extensionFind': 'Buscar Extensiones', @@ -105,4 +108,4 @@ const esES = { 'downloadPath': 'Ruta de Descarga', 'skipVerifyCert': 'Omitir Verificación de Certificado', }, -}; \ No newline at end of file +}; diff --git a/ui/flutter/lib/i18n/langs/fa_ir.dart b/ui/flutter/lib/i18n/langs/fa_ir.dart index b9825baa..72966e9c 100644 --- a/ui/flutter/lib/i18n/langs/fa_ir.dart +++ b/ui/flutter/lib/i18n/langs/fa_ir.dart @@ -55,7 +55,7 @@ const faIR = { 'deleteTaskTip': 'فایل های دانلود شده را نگه دارد', 'delete': 'پاک کردن', 'newVersionTitle': '@version عنوان: کشف نسخه جدید', - 'newVersionUpdate': 'بروزرسانی', + 'newVersionUpgrade': 'بروزرسانی', 'newVersionLater': 'بعداً', 'thanks': 'تشکر', 'thanksDesc': diff --git a/ui/flutter/lib/i18n/langs/fr_fr.dart b/ui/flutter/lib/i18n/langs/fr_fr.dart index e5e94c3d..de420bdd 100644 --- a/ui/flutter/lib/i18n/langs/fr_fr.dart +++ b/ui/flutter/lib/i18n/langs/fr_fr.dart @@ -19,10 +19,12 @@ const frFR = { 'advancedOptions': 'Options avancées', 'downloadLink': 'Lien de téléchargement', 'downloadLinkValid': 'Veuillez entrer le lien de téléchargement', - 'downloadLinkHit': 'Veuillez entrer le lien de téléchargement, HTTP/HTTPS/MAGNET pris en charge', + 'downloadLinkHit': + 'Veuillez entrer le lien de téléchargement, HTTP/HTTPS/MAGNET pris en charge', 'downloadLinkHitDesktop': ', ou glissez directement le fichier torrent ici', 'download': 'Télécharger', - 'noFileSelected': 'Veuillez sélectionner au moins un fichier pour continuer.', + 'noFileSelected': + 'Veuillez sélectionner au moins un fichier pour continuer.', 'noStoragePermission': 'Permission de stockage requise', 'selectFile': 'Sélectionner un fichier', 'rename': 'Renommer', @@ -32,16 +34,19 @@ const frFR = { 'downloadDir': 'Répertoire de téléchargement', 'downloadDirValid': 'Veuillez sélectionner le répertoire de téléchargement', 'connections': 'Connexions', - 'useServerCtime': 'Utiliser l\'heure du serveur pour la création de fichier', + 'useServerCtime': + 'Utiliser l\'heure du serveur pour la création de fichier', 'maxRunning': 'Tâches en cours maximum', 'items': '@count éléments', 'subscribeTracker': 'S\'abonner au tracker', - 'subscribeFail': 'Abonnement échoué, veuillez vérifier le réseau ou réessayer plus tard', + 'subscribeFail': + 'Abonnement échoué, veuillez vérifier le réseau ou réessayer plus tard', 'update': 'Mettre à jour', 'updateDaily': 'Mettre à jour quotidiennement', 'lastUpdate': 'Dernière mise à jour : @time', 'addTracker': 'Ajouter un tracker', - 'addTrackerHit': 'Veuillez entrer l\'URL du serveur de tracker, une par ligne', + 'addTrackerHit': + 'Veuillez entrer l\'URL du serveur de tracker, une par ligne', 'ui': 'Interface utilisateur', 'theme': 'Thème', 'themeSystem': 'Système', @@ -65,12 +70,12 @@ const frFR = { 'deleteTaskTip': 'Conserver les fichiers téléchargés', 'delete': 'Supprimer', 'newVersionTitle': 'Nouvelle version @version disponible', - 'newVersionUpdate': 'Mettre à jour maintenant', + 'newVersionUpgrade': 'Mettre à jour maintenant', 'newVersionLater': 'Plus tard', 'extensions': 'Extensions', 'extensionInstallUrl': 'URL d\'installation', 'extensionInstallSuccess': 'Installé avec succès', - 'extensionUpdateSuccess': 'Mis à jour avec succès', + 'extensionUpgradeSuccess': 'Mis à jour avec succès', 'extensionDelete': 'Supprimer l\'extension', 'extensionAlreadyLatest': 'C\'est déjà la dernière version', 'extensionFind': 'Trouver des extensions', @@ -89,7 +94,8 @@ const frFR = { 'username': 'Nom d\'utilisateur', 'password': 'Mot de passe', 'thanks': 'Merci', - 'thanksDesc': 'Merci à tous les contributeurs qui ont aidé à construire et développer la communauté Gopeed !', + 'thanksDesc': + 'Merci à tous les contributeurs qui ont aidé à construire et développer la communauté Gopeed !', 'browserExtension': 'Extension du navigateur', 'launchAtStartup': 'Lancer au démarrage', 'skipVerifyCert': 'Bypass Verifikasi Sertifikat', diff --git a/ui/flutter/lib/i18n/langs/id_id.dart b/ui/flutter/lib/i18n/langs/id_id.dart index c58a4ed1..de8fa0ee 100644 --- a/ui/flutter/lib/i18n/langs/id_id.dart +++ b/ui/flutter/lib/i18n/langs/id_id.dart @@ -22,7 +22,8 @@ const idID = { 'downloadLinkValid': 'Silakan masukkan tautan unduhan', 'downloadLinkHit': 'Tolong masukkan tautan unduhan, HTTP/HTTPS/MAGNET didukung@append', - 'downloadLinkHitDesktop': ', atau seret file torrent ke sini secara langsung', + 'downloadLinkHitDesktop': + ', atau seret file torrent ke sini secara langsung', 'download': 'Download', 'noFileSelected': 'Silakan pilih setidaknya satu file untuk melanjutkan.', 'noStoragePermission': 'Izin penyimpanan diperlukan', @@ -71,12 +72,12 @@ const idID = { 'deleteTaskTip': 'Simpan file yang terunduh', 'delete': 'Hapus', 'newVersionTitle': 'Temukan versi batu @version', - 'newVersionUpdate': 'Perbarui Sekarang', + 'newVersionUpgrade': 'Perbarui Sekarang', 'newVersionLater': 'Nanti', 'extensions': 'Ekstensi', 'extensionInstallUrl': 'URL Instal', 'extensionInstallSuccess': 'Diinstal dengan sukses', - 'extensionUpdateSuccess': 'Diperbaruhi dengan sukses', + 'extensionUpgradeSuccess': 'Diperbaruhi dengan sukses', 'extensionDelete': 'Hapus Ekstensi', 'extensionAlreadyLatest': 'Ini sudah versi terbaru', 'extensionFind': 'Temukan Ekstensi', diff --git a/ui/flutter/lib/i18n/langs/it_it.dart b/ui/flutter/lib/i18n/langs/it_it.dart index 3c53c31d..2372a6ef 100644 --- a/ui/flutter/lib/i18n/langs/it_it.dart +++ b/ui/flutter/lib/i18n/langs/it_it.dart @@ -68,12 +68,12 @@ const itIT = { 'deleteTaskTip': 'Conserva i file scaricati', 'delete': 'Elimina', 'newVersionTitle': 'Scopri la nuova versione @version', - 'newVersionUpdate': 'Aggiorna ora', + 'newVersionUpgrade': 'Aggiorna ora', 'newVersionLater': 'Dopo', 'extensions': 'Estensioni', 'extensionInstallUrl': 'Installa URL', 'extensionInstallSuccess': 'Installato con successo', - 'extensionUpdateSuccess': 'Aggiornato con successo', + 'extensionUpgradeSuccess': 'Aggiornato con successo', 'extensionDelete': 'Elimina estensione', 'extensionAlreadyLatest': "È già l'ultima versione", 'extensionFind': 'Trova estensioni', diff --git a/ui/flutter/lib/i18n/langs/ja_jp.dart b/ui/flutter/lib/i18n/langs/ja_jp.dart index 26bc3111..5d0233ba 100644 --- a/ui/flutter/lib/i18n/langs/ja_jp.dart +++ b/ui/flutter/lib/i18n/langs/ja_jp.dart @@ -57,7 +57,7 @@ const jaJP = { 'deleteTaskTip': 'ダウンロードしたファイルを保持', 'delete': '削除', 'newVersionTitle': '新しいバージョン @version を発見する', - 'newVersionUpdate': 'アップデート', + 'newVersionUpgrade': 'アップデート', 'newVersionLater': '後で', 'thanks': '感謝', 'thanksDesc': 'Gopeedコミュニティの建設に協力してくださったすべての貢献者の方々に感謝します!', diff --git a/ui/flutter/lib/i18n/langs/pl_pl.dart b/ui/flutter/lib/i18n/langs/pl_pl.dart index 6327da1c..70120a2c 100644 --- a/ui/flutter/lib/i18n/langs/pl_pl.dart +++ b/ui/flutter/lib/i18n/langs/pl_pl.dart @@ -66,12 +66,12 @@ const plPL = { 'deleteTaskTip': 'Zachowaj pobrane pliki', 'delete': 'Usuń', 'newVersionTitle': 'Sprawdź aktualizację @version', - 'newVersionUpdate': 'Aktualizuj teraz', + 'newVersionUpgrade': 'Aktualizuj teraz', 'newVersionLater': 'Później', 'extensions': 'Wtyczki', 'extensionInstallUrl': 'Instaluj z url', 'extensionInstallSuccess': 'Instalacja zakończona', - 'extensionUpdateSuccess': 'Aktualizacja zakończona', + 'extensionUpgradeSuccess': 'Aktualizacja zakończona', 'extensionDelete': 'Usuń wtyczkę', 'extensionAlreadyLatest': 'Wtyczka w aktualnej wersji', 'extensionFind': 'Wyszukaj wtyczkę', diff --git a/ui/flutter/lib/i18n/langs/ru_ru.dart b/ui/flutter/lib/i18n/langs/ru_ru.dart index e5a6f365..b41d4b5e 100644 --- a/ui/flutter/lib/i18n/langs/ru_ru.dart +++ b/ui/flutter/lib/i18n/langs/ru_ru.dart @@ -61,11 +61,11 @@ const ruRU = { 'deleteTaskTip': 'Сохранить загруженные файлы', 'delete': 'Удалить', 'newVersionTitle': 'Обнаружена новая версия @version', - 'newVersionUpdate': 'Обновить', + 'newVersionUpgrade': 'Обновить', 'newVersionLater': 'позже', 'extensions': 'Расширения', 'extensionInstallSuccess': 'Установка завершена', - 'extensionUpdateSuccess': 'Обновление завершено', + 'extensionUpgradeSuccess': 'Обновление завершено', 'extensionDelete': 'Удалить расширение', 'extensionAlreadyLatest': 'Это последняя версия', 'extensionFind': 'Найти расширения', diff --git a/ui/flutter/lib/i18n/langs/ta_ta.dart b/ui/flutter/lib/i18n/langs/ta_ta.dart index e9e78338..4ff07c71 100644 --- a/ui/flutter/lib/i18n/langs/ta_ta.dart +++ b/ui/flutter/lib/i18n/langs/ta_ta.dart @@ -21,7 +21,8 @@ const taTA = { 'downloadLinkValid': 'பதிவிறக்க இணைப்பை உள்ளிடவும்', 'downloadLinkHit': 'பதிவிறக்க இணைப்பை உள்ளிடவும், HTTP/HTTPS/MAGNET ஆகியவற்றை ஏற்கும்@append', - 'downloadLinkHitDesktop': ', அல்லது torrent கோப்பை நேரடியாக இங்கே இழுக்கவும்', + 'downloadLinkHitDesktop': + ', அல்லது torrent கோப்பை நேரடியாக இங்கே இழுக்கவும்', 'download': 'பதிவிறக்கு', 'noFileSelected': 'குறைந்தபட்சம் ஒரு கோப்பைத் தேர்ந்தெடுக்கவும்.', 'noStoragePermission': 'சேமிப்பக அனுமதி தேவை', @@ -67,12 +68,12 @@ const taTA = { 'deleteTaskTip': 'பதிவிறக்கம் செய்யப்பட்ட கோப்புகளை வைத்திரு', 'delete': 'நீக்கு', 'newVersionTitle': 'புதிய பதிப்பைக் கண்டறியவும் @version', - 'newVersionUpdate': 'இப்பொழுது புதுப்பி', + 'newVersionUpgrade': 'இப்பொழுது புதுப்பி', 'newVersionLater': 'பின்னர்', 'extensions': 'நீட்டிப்புகள்', 'extensionInstallUrl': 'நிறுவப்படும் URL', 'extensionInstallSuccess': 'வெற்றிகரமாக நிறுவப்பட்டது', - 'extensionUpdateSuccess': 'வெற்றிகரமாக புதுப்பிக்கப்பட்டது', + 'extensionUpgradeSuccess': 'வெற்றிகரமாக புதுப்பிக்கப்பட்டது', 'extensionDelete': 'நீட்டிப்பை நீக்கு', 'extensionAlreadyLatest': 'இது ஏற்கனவே சமீபத்திய பதிப்பாகும்', 'extensionFind': 'நீட்டிப்புகளைக் கண்டறியவும்', diff --git a/ui/flutter/lib/i18n/langs/tr_tr.dart b/ui/flutter/lib/i18n/langs/tr_tr.dart index 5c791216..13bf472c 100644 --- a/ui/flutter/lib/i18n/langs/tr_tr.dart +++ b/ui/flutter/lib/i18n/langs/tr_tr.dart @@ -20,8 +20,10 @@ const trTR = { 'followSettings': 'Ayarları takip et', 'downloadLink': 'İndirme bağlantısı', 'downloadLinkValid': 'Lütfen indirme bağlantısını girin', - 'downloadLinkHit': 'Lütfen indirme bağlantısını girin, HTTP/HTTPS/MAGNET desteklenir@append', - 'downloadLinkHitDesktop': ', veya torrent dosyasını doğrudan buraya sürükleyin', + 'downloadLinkHit': + 'Lütfen indirme bağlantısını girin, HTTP/HTTPS/MAGNET desteklenir@append', + 'downloadLinkHitDesktop': + ', veya torrent dosyasını doğrudan buraya sürükleyin', 'download': 'İndir', 'noFileSelected': 'Devam etmek için lütfen en az bir dosya seçin.', 'noStoragePermission': 'Depolama izni gerekli', @@ -38,12 +40,14 @@ const trTR = { 'defaultDirectDownload': 'Doğrudan indir seçili olsun', 'items': '@count tane', 'subscribeTracker': 'İzleyiciye abone ol', - 'subscribeFail': 'Abone olunamadı, lütfen ağı kontrol edin veya daha sonra tekrar deneyin', + 'subscribeFail': + 'Abone olunamadı, lütfen ağı kontrol edin veya daha sonra tekrar deneyin', 'update': 'Güncelle', 'updateDaily': 'Günlük olarak güncelle', 'lastUpdate': 'Son güncellenme tarihi: @time', 'addTracker': 'İzleyici ekle', - 'addTrackerHit': 'Lütfen her satıra bir tane olmak üzere izleyici sunucusu bağlantısını girin', + 'addTrackerHit': + 'Lütfen her satıra bir tane olmak üzere izleyici sunucusu bağlantısını girin', 'ui': 'Arayüz', 'theme': 'Tema', 'themeSystem': 'Sistem', @@ -58,7 +62,8 @@ const trTR = { 'apiToken': 'API anahtarı', 'notSet': 'AYARLI DEĞİL', 'set': 'AYARLI', - 'portInUse': 'Bağlantı noktası [@port] kullanımda, lütfen bağlantı noktasını değiştirin', + 'portInUse': + 'Bağlantı noktası [@port] kullanımda, lütfen bağlantı noktasını değiştirin', 'effectAfterRestart': 'Yeniden başlatma sonrası etki edecektir', 'developer': 'Geliştirici', 'logDirectory': 'Kayıt dizini', @@ -69,12 +74,12 @@ const trTR = { 'deleteTaskTip': 'İndirilen dosyaları sakla', 'delete': 'Sil', 'newVersionTitle': 'Yeni sürümü keşfet @version', - 'newVersionUpdate': 'Şimdi güncelle', + 'newVersionUpgrade': 'Şimdi güncelle', 'newVersionLater': 'Sonra', 'extensions': 'Uzantılar', 'extensionInstallUrl': 'İndirme bağlantısı', 'extensionInstallSuccess': 'Başarıyla indirildi', - 'extensionUpdateSuccess': 'Başarıyla güncellendi', + 'extensionUpgradeSuccess': 'Başarıyla güncellendi', 'extensionDelete': 'Uzantıyı sil', 'extensionAlreadyLatest': 'Bu zaten en son sürüm', 'extensionFind': 'Uzantı ara', @@ -93,7 +98,8 @@ const trTR = { 'username': 'Kullanıcı adı', 'password': 'Şifre', 'thanks': 'Teşekkürler', - 'thanksDesc': 'Gopeed topluluğunun oluşmasına ve gelişmesine yardımcı olan tüm katılımcılara teşekkürler!', + 'thanksDesc': + 'Gopeed topluluğunun oluşmasına ve gelişmesine yardımcı olan tüm katılımcılara teşekkürler!', 'browserExtension': 'Tarayıcı uzantısı', 'launchAtStartup': 'Başlangıçta başlat', 'seedConfig': 'Seed ayarları', diff --git a/ui/flutter/lib/i18n/langs/vi_vn.dart b/ui/flutter/lib/i18n/langs/vi_vn.dart index de182fa8..62a4c484 100644 --- a/ui/flutter/lib/i18n/langs/vi_vn.dart +++ b/ui/flutter/lib/i18n/langs/vi_vn.dart @@ -65,12 +65,12 @@ const viVN = { 'deleteTaskTip': 'Giữ các tệp đã tải về', 'delete': 'Xóa', 'newVersionTitle': 'Khám phá phiên bản mới @version', - 'newVersionUpdate': 'Cập nhật ngay', + 'newVersionUpgrade': 'Cập nhật ngay', 'newVersionLater': 'Sau', 'extensions': 'Tiện ích mở rộng', 'extensionInstallUrl': 'Liên kết cài đặt', 'extensionInstallSuccess': 'Cài đặt thành công', - 'extensionUpdateSuccess': 'Cập nhật thành công', + 'extensionUpgradeSuccess': 'Cập nhật thành công', 'extensionDelete': 'Xóa tiện ích mở rộng', 'extensionAlreadyLatest': 'Đây đã là phiên bản mới nhất', 'extensionFind': 'Tìm tiện ích mở rộng', diff --git a/ui/flutter/lib/i18n/langs/zh_cn.dart b/ui/flutter/lib/i18n/langs/zh_cn.dart index a84dee90..0df25dc2 100644 --- a/ui/flutter/lib/i18n/langs/zh_cn.dart +++ b/ui/flutter/lib/i18n/langs/zh_cn.dart @@ -69,12 +69,12 @@ const zhCN = { 'deleteTaskTip': '保留已下载的文件', 'delete': '删除', 'newVersionTitle': '发现新版本 @version', - 'newVersionUpdate': '立即更新', + 'newVersionUpgrade': '立即更新', 'newVersionLater': '稍后再说', 'extensions': '扩展', 'extensionInstallUrl': '安装链接', 'extensionInstallSuccess': '安装成功', - 'extensionUpdateSuccess': '更新成功', + 'extensionUpgradeSuccess': '更新成功', 'extensionDelete': '删除扩展', 'extensionAlreadyLatest': '已经是最新版本', 'extensionFind': '获取扩展', diff --git a/ui/flutter/lib/i18n/langs/zh_tw.dart b/ui/flutter/lib/i18n/langs/zh_tw.dart index 0a4ce12a..5a369607 100644 --- a/ui/flutter/lib/i18n/langs/zh_tw.dart +++ b/ui/flutter/lib/i18n/langs/zh_tw.dart @@ -69,12 +69,12 @@ const zhTW = { 'deleteTaskTip': '保留已下載的檔案', 'delete': '刪除', 'newVersionTitle': '發現新版本 @version', - 'newVersionUpdate': '立即更新', + 'newVersionUpgrade': '立即更新', 'newVersionLater': '稍後', 'extensions': '擴充功能', 'extensionInstallUrl': '安裝 URL', 'extensionInstallSuccess': '安裝成功', - 'extensionUpdateSuccess': '更新成功', + 'extensionUpgradeSuccess': '更新成功', 'extensionDelete': '刪除擴充功能', 'extensionAlreadyLatest': '已是最新版本', 'extensionFind': '尋找擴充功能', diff --git a/ui/flutter/lib/main.dart b/ui/flutter/lib/main.dart index 06b14f4f..f3ccfe2a 100644 --- a/ui/flutter/lib/main.dart +++ b/ui/flutter/lib/main.dart @@ -2,12 +2,12 @@ import 'package:args/args.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; +import 'package:gopeed/api/native/model/start_config.dart'; import 'package:window_manager/window_manager.dart'; -import 'api/api.dart' as api; import 'app/modules/app/controllers/app_controller.dart'; import 'app/modules/app/views/app_view.dart'; -import 'core/libgopeed_boot.dart'; +import 'api/libgopeed_boot.dart'; import 'database/database.dart'; import 'i18n/message.dart'; import 'util/locale_manager.dart'; @@ -73,10 +73,10 @@ Future init(Args args) async { final controller = Get.put(AppController()); try { - await controller.loadStartConfig(); - final startCfg = controller.startConfig.value; - controller.runningPort.value = await LibgopeedBoot.instance.start(startCfg); - api.init(startCfg.network, controller.runningAddress(), startCfg.apiToken); + await LibgopeedBoot.instance.init(StartConfig( + storage: "bolt", + storageDir: Util.getStorageDir(), + )); } catch (e) { logger.e("libgopeed init fail", e); } diff --git a/ui/flutter/lib/util/extensions.dart b/ui/flutter/lib/util/extensions.dart new file mode 100644 index 00000000..b3595311 --- /dev/null +++ b/ui/flutter/lib/util/extensions.dart @@ -0,0 +1,10 @@ +extension ApplyExtension on T { + T apply(void Function(T) fn) { + fn(this); + return this; + } +} + +extension LetExtension on T { + R let(R Function(T) fn) => fn(this); +} diff --git a/ui/flutter/pubspec.lock b/ui/flutter/pubspec.lock index acba5649..0bda0896 100644 --- a/ui/flutter/pubspec.lock +++ b/ui/flutter/pubspec.lock @@ -293,18 +293,18 @@ packages: dependency: "direct dev" description: name: ffigen - sha256: d3e76c2ad48a4e7f93a29a162006f00eba46ce7c08194a77bb5c5e97d1b5ff0a + sha256: dead012f29db2be71ea152458f5eab600de98fbc244e01088ae6bf2616bceca7 url: "https://pub.dev" source: hosted - version: "8.0.2" + version: "11.0.0" file: dependency: transitive description: name: file - sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 url: "https://pub.dev" source: hosted - version: "6.1.4" + version: "7.0.1" file_picker: dependency: "direct main" description: @@ -525,30 +525,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.2.2" - leak_tracker: - dependency: transitive - description: - name: leak_tracker - sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" - url: "https://pub.dev" - source: hosted - version: "10.0.0" - leak_tracker_flutter_testing: - dependency: transitive - description: - name: leak_tracker_flutter_testing - sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 - url: "https://pub.dev" - source: hosted - version: "2.0.1" - leak_tracker_testing: - dependency: transitive - description: - name: leak_tracker_testing - sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 - url: "https://pub.dev" - source: hosted - version: "2.0.1" lecle_downloads_path_provider: dependency: "direct main" description: @@ -617,18 +593,18 @@ packages: dependency: transitive description: name: matcher - sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" url: "https://pub.dev" source: hosted - version: "0.12.16+1" + version: "0.12.16" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" url: "https://pub.dev" source: hosted - version: "0.8.0" + version: "0.5.0" math_expressions: dependency: transitive description: @@ -649,10 +625,10 @@ packages: dependency: transitive description: name: meta - sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.10.0" mime: dependency: transitive description: @@ -697,10 +673,10 @@ packages: dependency: "direct main" description: name: path - sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.8.3" path_provider: dependency: "direct main" description: @@ -1203,14 +1179,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - vm_service: - dependency: transitive - description: - name: vm_service - sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 - url: "https://pub.dev" - source: hosted - version: "13.0.0" watcher: dependency: transitive description: diff --git a/ui/flutter/pubspec.yaml b/ui/flutter/pubspec.yaml index 12ab9030..acc3391d 100644 --- a/ui/flutter/pubspec.yaml +++ b/ui/flutter/pubspec.yaml @@ -18,7 +18,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev version: 1.6.3+1 environment: - sdk: '>=3.0.0 <4.0.0' + sdk: ">=3.0.0 <4.0.0" # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions @@ -85,7 +85,7 @@ dev_dependencies: # package. See that file for information about deactivating specific lint # rules and activating additional ones. flutter_lints: ^2.0.0 - ffigen: ^8.0.2 + ffigen: ^11.0.0 # build json model: dart run build_runner build --delete-conflicting-outputs build_runner: ^2.2.1 json_serializable: ^6.3.2 @@ -150,7 +150,7 @@ flutter_icons: ffigen: name: LibgopeedBind description: Bindings to gopeed library. - output: 'lib/core/ffi/libgopeed_bind.dart' + output: "lib/api/native/ffi/libgopeed_bind.dart" headers: entry-points: - - 'include/libgopeed.h' + - "include/libgopeed.h"