commit 702fa92a4a475bbfae15858e670c1d8fbfbdf6bd
parent acddc7349c227e350a052b1ab2cf7e0b9dc6d00b
Author: Marc Stibane <marc@taler.net>
Date: Tue, 11 Mar 2025 21:46:29 +0100
cleanup _preprocessed
Diffstat:
4 files changed, 14 insertions(+), 395 deletions(-)
diff --git a/QuickJS-rt.xcodeproj/project.pbxproj b/QuickJS-rt.xcodeproj/project.pbxproj
@@ -590,7 +590,6 @@
4E579B2729702E54007B89A4 /* libunicode.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E328EB2296CCB85006D0E3C /* libunicode.a */; platformFilter = ios; };
4E579B2829702E54007B89A4 /* libwallet_core.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4EE21223296DBC7D000D7228 /* libwallet_core.a */; platformFilter = ios; };
4E579B2929702F58007B89A4 /* FTalerWalletcore.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E579B1029702103007B89A4 /* FTalerWalletcore.h */; settings = {ATTRIBUTES = (Public, ); }; };
- 4E579B2A29702F7C007B89A4 /* taler_wallet_core_lib_preprocessed.h in Headers */ = {isa = PBXBuildFile; fileRef = 4EBF870C296EF4D400241F24 /* taler_wallet_core_lib_preprocessed.h */; settings = {ATTRIBUTES = (Public, ); }; };
4E579B2C29702FFE007B89A4 /* FTalerWalletcore-Bridging-Header.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E579B2B29702FFE007B89A4 /* FTalerWalletcore-Bridging-Header.h */; settings = {ATTRIBUTES = (Public, ); }; };
4E5813B62A6086DB00FE5BCB /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E5813B52A6086DB00FE5BCB /* libsqlite3.tbd */; platformFilter = ios; settings = {ATTRIBUTES = (Required, ); }; };
4E5C307F296C7DAA0031A049 /* aesni.c in Sources */ = {isa = PBXBuildFile; fileRef = 4E5C307D296C7DAA0031A049 /* aesni.c */; };
@@ -780,6 +779,8 @@
4EE21264296DC237000D7228 /* libtart.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E328E7D296CC0BC006D0E3C /* libtart.a */; };
4EE21265296DC237000D7228 /* libunicode.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E328EB2296CCB85006D0E3C /* libunicode.a */; };
4EE21266296DC288000D7228 /* libwallet_core.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4EE21223296DBC7D000D7228 /* libwallet_core.a */; };
+ 4EE9E2002D801AF100365E72 /* taler_wallet_core_lib.h in Headers */ = {isa = PBXBuildFile; fileRef = 4EE9E1FF2D801AF100365E72 /* taler_wallet_core_lib.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 4EE9E2022D801B2000365E72 /* quickjs-http.h in Headers */ = {isa = PBXBuildFile; fileRef = 4EE9E2012D801B2000365E72 /* quickjs-http.h */; settings = {ATTRIBUTES = (Public, ); }; };
4EED1C45296DECE300915572 /* prelude.c in Sources */ = {isa = PBXBuildFile; fileRef = 4EED1C44296DECE300915572 /* prelude.c */; };
4EED1C47296DED8100915572 /* wallet_core.c in Sources */ = {isa = PBXBuildFile; fileRef = 4EED1C46296DED8000915572 /* wallet_core.c */; };
/* End PBXBuildFile section */
@@ -1626,12 +1627,13 @@
4E81B1A32B5F055F00579826 /* ares__htable_szvp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ares__htable_szvp.c; sourceTree = "<group>"; };
4EABFFA92B8CE3920080EA6F /* quickjs-libc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "quickjs-libc.c"; path = "quickjs/quickjs-libc.c"; sourceTree = "<group>"; };
4EABFFAC2B8CE3A10080EA6F /* quickjs-http.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "quickjs-http.c"; path = "quickjs/quickjs-http.c"; sourceTree = "<group>"; };
- 4EBF870C296EF4D400241F24 /* taler_wallet_core_lib_preprocessed.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = taler_wallet_core_lib_preprocessed.h; sourceTree = "<group>"; };
4EE211FB296DB6D1000D7228 /* libprelude.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libprelude.a; sourceTree = BUILT_PRODUCTS_DIR; };
4EE21223296DBC7D000D7228 /* libwallet_core.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libwallet_core.a; sourceTree = BUILT_PRODUCTS_DIR; };
4EE21233296DBEE1000D7228 /* libtalerwalletcore.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libtalerwalletcore.a; sourceTree = BUILT_PRODUCTS_DIR; };
4EE2123A296DBF17000D7228 /* taler_wallet_core_lib.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = taler_wallet_core_lib.c; sourceTree = "<group>"; };
4EE21267296DC91A000D7228 /* builds */ = {isa = PBXFileReference; lastKnownFileType = folder; path = builds; sourceTree = "<group>"; };
+ 4EE9E1FF2D801AF100365E72 /* taler_wallet_core_lib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = taler_wallet_core_lib.h; sourceTree = "<group>"; };
+ 4EE9E2012D801B2000365E72 /* quickjs-http.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "quickjs-http.h"; path = "quickjs/quickjs-http.h"; sourceTree = "<group>"; };
4EED1C44296DECE300915572 /* prelude.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = prelude.c; sourceTree = DERIVED_FILE_DIR; };
4EED1C46296DED8000915572 /* wallet_core.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wallet_core.c; sourceTree = DERIVED_FILE_DIR; };
/* End PBXFileReference section */
@@ -2533,6 +2535,7 @@
children = (
4E328EE3296CCF17006D0E3C /* quickjs.c */,
4EABFFA92B8CE3920080EA6F /* quickjs-libc.c */,
+ 4EE9E2012D801B2000365E72 /* quickjs-http.h */,
4EABFFAC2B8CE3A10080EA6F /* quickjs-http.c */,
);
name = quickjs;
@@ -2837,7 +2840,7 @@
isa = PBXGroup;
children = (
4EE2123A296DBF17000D7228 /* taler_wallet_core_lib.c */,
- 4EBF870C296EF4D400241F24 /* taler_wallet_core_lib_preprocessed.h */,
+ 4EE9E1FF2D801AF100365E72 /* taler_wallet_core_lib.h */,
);
name = talerwalletcore;
sourceTree = "<group>";
@@ -2919,9 +2922,10 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
- 4E579B2A29702F7C007B89A4 /* taler_wallet_core_lib_preprocessed.h in Headers */,
- 4E579B2C29702FFE007B89A4 /* FTalerWalletcore-Bridging-Header.h in Headers */,
4E579B2929702F58007B89A4 /* FTalerWalletcore.h in Headers */,
+ 4E579B2C29702FFE007B89A4 /* FTalerWalletcore-Bridging-Header.h in Headers */,
+ 4EE9E2002D801AF100365E72 /* taler_wallet_core_lib.h in Headers */,
+ 4EE9E2022D801B2000365E72 /* quickjs-http.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/taler_wallet_core_lib.h b/taler_wallet_core_lib.h
@@ -25,8 +25,11 @@
#ifndef _TALER_WALLET_LIB_H
#define _TALER_WALLET_LIB_H
+#if TARGET_OS_IPHONE
+#include "quickjs-http.h"
+#else
#include "quickjs/quickjs-http.h"
-
+#endif
/**
* Opaque handle to a Taler wallet-core instance.
*/
diff --git a/taler_wallet_core_lib_preprocessed.h b/taler_wallet_core_lib_preprocessed.h
@@ -1,388 +0,0 @@
-/*
- This file is part of GNU Taler
- Copyright (C) 2014-2022 Taler Systems SA
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License along with
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
-/**
- * C interface to the functionality of wallet-core.
- *
- * Currently, the underlying implementation uses the JS implementation of
- * wallet-core, but this may (or may not) change in the future.
- *
- * @author Florian Dold
- */
-#ifndef _TALER_WALLET_LIB_H
-#define _TALER_WALLET_LIB_H
-
-/*
- This file is part of GNU Taler
- Copyright (C) 2024 Taler Systems SA
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License along with
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
-
-// ## Native HTTP client library support.
-
-// Considerations:
-// - the API is designed for the HTTP client implementation
-// to run in its own thread and *not* be integrated with the
-// application's main event loop.
-// - focus on small API
-// - not a generic HTTP client, only supposed to serve the needs
-// of a JS runtime
-// - only very tiny subset of HTTP supported
-// - no request/response streaming
-// - should be appropriate to implement a JS HTTP fetch function
-// in the style of WHATWG fetch
-// - no focus on ABI compatibility whatsoever
-
-
-#ifndef _QUICKJS_HTTP_H
-#define _QUICKJS_HTTP_H
-
-#include <stdint.h>
-#include <limits.h>
-#include <stddef.h>
-
-// Forward declaration;
-struct JSHttpResponseInfo;
-
-/**
- * Callback called when an HTTP response has arrived.
- *
- * IMPORTANT: May be called from an arbitrary thread.
- */
-typedef void (*JSHttpResponseCb)(void *cls, struct JSHttpResponseInfo *resp);
-
-enum JSHttpRedirectFlag {
- /**
- * Handle redirects transparently.
- */
- JS_HTTP_REDIRECT_TRANSPARENT = 0,
- /**
- * Redirect status codes are returned to the client.
- * The client can choose to follow them manually (or not).
- */
- JS_HTTP_REDIRECT_MANUAL = 1,
- /**
- * All redirect status codes result in an error.
- */
- JS_HTTP_REDIRECT_ERROR = 2,
-};
-
-/**
- * Info needed to start a new HTTP request.
- */
-struct JSHttpRequestInfo {
- /**
- * Callback called with the response for the request.
- */
- JSHttpResponseCb response_cb;
-
- /**
- * Closure for response_cb.
- */
- void *response_cb_cls;
-
- /**
- * Request URL.
- */
- const char *url;
-
- /**
- * Request method.
- */
- const char *method;
-
- /**
- * Null-terminated array of request headers.
- */
- char **request_headers;
-
- /**
- * 0: Handle redirects transparently.
- * 1: Handle redirects manually.
- * 2: Redirects result in an error.
- */
- enum JSHttpRedirectFlag redirect;
-
- /**
- * Request timeout in milliseconds.
- *
- * When 0 is specified, the timeout is the default request
- * timeout for the platform.
- *
- * When -1 is specified, there is no timeout. This might not be
- * supported on all platforms.
- */
- int timeout_ms;
-
- /**
- * Enable debug output for this request.
- */
- int debug;
-
- /**
- * Request body or NULL.
- */
- void *req_body;
-
- /**
- * Length or request body or 0.
- */
- size_t req_body_len;
-};
-
-/**
- * Contents of an HTTP response.
- */
-struct JSHttpResponseInfo {
-
- /**
- * Request that this is a response to.
- *
- * (Think of the request ID like a file descriptor number).
- */
- int request_id;
-
- /**
- * HTTP response status code or 0 on error.
- */
- int status;
-
- /**
- * When status is 0, error message.
- */
- char *errmsg;
-
- /**
- * Array of `num_response_headers` response headers.
- */
- char **response_headers;
-
- /**
- * Number of response headers.
- */
- int num_response_headers;
-
- /**
- * Response body or NULL.
- */
- void *body;
-
- /**
- * Length of the response body or 0.
- */
- size_t body_len;
-};
-
-/**
- * Callback called when an HTTP response has arrived.
- *
- * IMPORTANT: May be called from an arbitrary thread.
- */
-typedef void (*JSHttpResponseCb)(void *cls, struct JSHttpResponseInfo *resp);
-
-/**
- * Function to create a new HTTP fetch request.
- * The request can still be configured until it is started.
- * An identifier for the request will be written to @a handle.
- *
- * @return negative number on error, positive request_id on success
- */
-typedef int (*JSHttpReqCreateFn)(void *cls, struct JSHttpRequestInfo *req_info);
-
-/**
- * Cancel a request. The request_id will become invalid
- * and the callback won't be called with request_id.
- */
-typedef int (*JSHttpReqCancelFn)(void *cls, int request_id);
-
-struct JSHttpClientImplementation {
- /**
- * Opaque closure passed to client functions.
- */
- void *cls;
- JSHttpReqCreateFn req_create;
- JSHttpReqCancelFn req_cancel;
-};
-
-struct JSHttpClientImplementation *
-js_curl_http_client_create(void);
-
-void
-js_curl_http_client_destroy(struct JSHttpClientImplementation *impl);
-
-#endif /* _QUICKJS_HTTP_H */
-
-/**
- * Opaque handle to a Taler wallet-core instance.
- */
-struct TALER_WALLET_Instance;
-
-/**
- * Handler for messages from the wallet.
- *
- * @param handler_p opaque closure for the message handler
- * @param message message from wallet-core as a JSON string
- */
-typedef void (*TALER_WALLET_MessageHandlerFn)(void *handler_p, const char *message);
-
-enum TALER_WALLET_LogLevel {
- TALER_WALLET_LOG_TRACE = 1,
- TALER_WALLET_LOG_INFO = 2,
- TALER_WALLET_LOG_MESSAGE = 3,
- TALER_WALLET_LOG_WARN = 4,
- TALER_WALLET_LOG_ERROR = 5
-};
-
-/**
- * Handler for log message from wallet-core.
- *
- * @param log_p opaque closure for the log handler
- * @param level log level of the log message
- * @param tag log tag (usually the file from which the message gets logged)
- * @param msg the log message
- */
-typedef void (*TALER_WALLET_LogHandlerFn)(void *log_p,
- enum TALER_WALLET_LogLevel level,
- const char *tag,
- const char *msg);
-
-/**
- * Create a new wallet-core instance..
- */
-struct TALER_WALLET_Instance *
-TALER_WALLET_create(void);
-
-/**
- * Set a handler for notification and response messages.
- * Must be called before the wallet runs.
- *
- * Caution: The handler will be called from a different thread.
- */
-void
-TALER_WALLET_set_message_handler(struct TALER_WALLET_Instance *twi,
- TALER_WALLET_MessageHandlerFn handler_f,
- void *handler_p);
-
-/**
- * Set a handler for log messages from wallet-core.
- * Must be called before the wallet runs.
- *
- * Caution: The log message handler will be called from a different thread.
- */
-void
-TALER_WALLET_set_log_handler(struct TALER_WALLET_Instance *twi,
- TALER_WALLET_LogHandlerFn handler_f,
- void *handler_p);
-
-/**
- * Set/override the JS file with the wallet-core implementation.
- * Must be called before the wallet runs.
- */
-// FIXME: Not implemented!
-//void
-//TALER_WALLET_set_jsfile(struct TALER_WALLET_Instance *twi,
-// const char *filename);
-
-/**
- * Send a message to wallet-core.
- *
- * Responses will be sent asynchronously to the message handler
- * set with #TALER_WALLET_set_message_handler.
- */
-int
-TALER_WALLET_send_request(struct TALER_WALLET_Instance *twi,
- const char *request);
-
-/**
- * Run wallet-core in a thread.
- *
- * This function creates a new thread and returns immediately.
- *
- * Returns 0 on success or a non-zero error code otherwise.
- */
-int
-TALER_WALLET_run(struct TALER_WALLET_Instance *twi);
-
-/**
- * Block until the wallet returns.
- */
-void
-TALER_WALLET_join(struct TALER_WALLET_Instance *twi);
-
-/**
- * Destroy the wallet handle and free resources associated with it.
- *
- * Note that for a graceful shutdown of the wallet,
- * an appropriate shutdown message should be sent first,
- * and destroy() should only be called after the wallet has
- * sent a response to the shutdown message.
- */
-//void
-//TALER_WALLET_destroy(struct TALER_WALLET_Instance *twi);
-
-/**
- * Handler for messages that should be logged.
- *
- * @param stream NOT YET IMPLEMENTED: indicator for the stream that
- * the message is coming from,
- */
-typedef void (*TALER_LogFn)(void *handler_p, int stream, const char *msg);
-
-/**
- * Redirect stderr and stdout to a function.
- *
- * Workaround for platforms where stderr is not visible in logs.
- *
- * @return 0 on success, error code otherwise
- */
-int
-TALER_start_redirect_std(TALER_LogFn logfn, void *handler_p);
-
-/**
- * Set the HTTP client implementation to be used by the wallet.
- *
- * @param twi wallet-core instance
- * @param impl HTTP client implementation
- */
-void
-TALER_set_http_client_implementation(struct TALER_WALLET_Instance *twi,
- struct JSHttpClientImplementation *impl);
-
-#pragma mark -
-/**
- * Build JSHttpClientImplementation struct for native HTTP client implementation to be used by the wallet.
- *
- * @param req_create HTTP client implementation
- * @param req_cancel HTTP client implementation
- * @param handler_p Pointer to Handler's "this"
- */
-struct JSHttpClientImplementation *
-TALER_pack_http_client_implementation(JSHttpReqCreateFn req_create,
- JSHttpReqCancelFn req_cancel,
- void *handler_p);
-
-#endif /*_TALER_WALLET_LIB_H */
diff --git a/xcode/FTalerWalletcore-Bridging-Header.h b/xcode/FTalerWalletcore-Bridging-Header.h
@@ -1 +1 @@
-#import "taler_wallet_core_lib_preprocessed.h"
+#import "taler_wallet_core_lib.h"