@lynx-js/lynx-library-headers 0.0.1-alpha.4 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -0
- package/package.json +3 -26
- package/README.md +0 -53
- package/include/base/include/value/lynx_api_types.h +0 -57
- package/include/base/include/value/lynx_value_api.h +0 -204
- package/include/base/include/value/lynx_value_types.h +0 -73
- package/include/capi/lynx_env_capi.h +0 -47
- package/include/capi/lynx_event_reporter_service_capi.h +0 -67
- package/include/capi/lynx_export.h +0 -27
- package/include/capi/lynx_extension_module_capi.h +0 -148
- package/include/capi/lynx_extension_module_types_capi.h +0 -17
- package/include/capi/lynx_generic_resource_fetcher_capi.h +0 -124
- package/include/capi/lynx_group_capi.h +0 -42
- package/include/capi/lynx_http_service_capi.h +0 -113
- package/include/capi/lynx_load_meta_capi.h +0 -52
- package/include/capi/lynx_log_capi.h +0 -69
- package/include/capi/lynx_memory_capi.h +0 -28
- package/include/capi/lynx_native_module_capi.h +0 -51
- package/include/capi/lynx_native_view_capi.h +0 -163
- package/include/capi/lynx_resource_request_capi.h +0 -71
- package/include/capi/lynx_resource_response_capi.h +0 -92
- package/include/capi/lynx_runtime_lifecycle_observer_capi.h +0 -62
- package/include/capi/lynx_security_service_capi.h +0 -52
- package/include/capi/lynx_service_center_capi.h +0 -50
- package/include/capi/lynx_template_bundle_capi.h +0 -39
- package/include/capi/lynx_template_data_capi.h +0 -33
- package/include/capi/lynx_trace_capi.h +0 -62
- package/include/capi/lynx_trail_service_capi.h +0 -35
- package/include/capi/lynx_types.h +0 -750
- package/include/capi/lynx_update_meta_capi.h +0 -33
- package/include/capi/lynx_view_builder_capi.h +0 -113
- package/include/capi/lynx_view_capi.h +0 -174
- package/include/capi/lynx_view_client_capi.h +0 -81
- package/include/capi/lynx_vsync_monitor_capi.h +0 -38
- package/include/capi/lynx_windowless_renderer_capi.h +0 -213
- package/include/js_native_api.h +0 -608
- package/include/js_native_api_types.h +0 -202
- package/include/lynx/base/include/value/lynx_api_types.h +0 -57
- package/include/lynx/base/include/value/lynx_value_api.h +0 -204
- package/include/lynx/base/include/value/lynx_value_types.h +0 -73
- package/include/lynx/extension.h +0 -6
- package/include/lynx/platform/embedder/public/capi/lynx_env_capi.h +0 -47
- package/include/lynx/platform/embedder/public/capi/lynx_event_reporter_service_capi.h +0 -67
- package/include/lynx/platform/embedder/public/capi/lynx_export.h +0 -27
- package/include/lynx/platform/embedder/public/capi/lynx_extension_module_capi.h +0 -148
- package/include/lynx/platform/embedder/public/capi/lynx_extension_module_types_capi.h +0 -17
- package/include/lynx/platform/embedder/public/capi/lynx_generic_resource_fetcher_capi.h +0 -124
- package/include/lynx/platform/embedder/public/capi/lynx_group_capi.h +0 -42
- package/include/lynx/platform/embedder/public/capi/lynx_http_service_capi.h +0 -113
- package/include/lynx/platform/embedder/public/capi/lynx_load_meta_capi.h +0 -52
- package/include/lynx/platform/embedder/public/capi/lynx_log_capi.h +0 -69
- package/include/lynx/platform/embedder/public/capi/lynx_memory_capi.h +0 -28
- package/include/lynx/platform/embedder/public/capi/lynx_native_module_capi.h +0 -51
- package/include/lynx/platform/embedder/public/capi/lynx_native_view_capi.h +0 -163
- package/include/lynx/platform/embedder/public/capi/lynx_resource_request_capi.h +0 -71
- package/include/lynx/platform/embedder/public/capi/lynx_resource_response_capi.h +0 -92
- package/include/lynx/platform/embedder/public/capi/lynx_runtime_lifecycle_observer_capi.h +0 -62
- package/include/lynx/platform/embedder/public/capi/lynx_security_service_capi.h +0 -52
- package/include/lynx/platform/embedder/public/capi/lynx_service_center_capi.h +0 -50
- package/include/lynx/platform/embedder/public/capi/lynx_template_bundle_capi.h +0 -39
- package/include/lynx/platform/embedder/public/capi/lynx_template_data_capi.h +0 -33
- package/include/lynx/platform/embedder/public/capi/lynx_trace_capi.h +0 -62
- package/include/lynx/platform/embedder/public/capi/lynx_trail_service_capi.h +0 -35
- package/include/lynx/platform/embedder/public/capi/lynx_types.h +0 -750
- package/include/lynx/platform/embedder/public/capi/lynx_update_meta_capi.h +0 -33
- package/include/lynx/platform/embedder/public/capi/lynx_view_builder_capi.h +0 -113
- package/include/lynx/platform/embedder/public/capi/lynx_view_capi.h +0 -174
- package/include/lynx/platform/embedder/public/capi/lynx_view_client_capi.h +0 -81
- package/include/lynx/platform/embedder/public/capi/lynx_vsync_monitor_capi.h +0 -38
- package/include/lynx/platform/embedder/public/capi/lynx_windowless_renderer_capi.h +0 -213
- package/include/lynx/platform/embedder/public/lynx_env.h +0 -104
- package/include/lynx/platform/embedder/public/lynx_event_reporter_service.h +0 -96
- package/include/lynx/platform/embedder/public/lynx_event_simulation_proxy.h +0 -31
- package/include/lynx/platform/embedder/public/lynx_extension_module.h +0 -521
- package/include/lynx/platform/embedder/public/lynx_generic_resource_fetcher.h +0 -178
- package/include/lynx/platform/embedder/public/lynx_group.h +0 -70
- package/include/lynx/platform/embedder/public/lynx_http_service.h +0 -211
- package/include/lynx/platform/embedder/public/lynx_load_meta.h +0 -120
- package/include/lynx/platform/embedder/public/lynx_native_module.h +0 -9
- package/include/lynx/platform/embedder/public/lynx_native_view.h +0 -201
- package/include/lynx/platform/embedder/public/lynx_resource_request.h +0 -56
- package/include/lynx/platform/embedder/public/lynx_resource_response.h +0 -63
- package/include/lynx/platform/embedder/public/lynx_runtime_lifecycle_observer.h +0 -102
- package/include/lynx/platform/embedder/public/lynx_security_service.h +0 -78
- package/include/lynx/platform/embedder/public/lynx_service_center.h +0 -64
- package/include/lynx/platform/embedder/public/lynx_template_bundle.h +0 -65
- package/include/lynx/platform/embedder/public/lynx_template_data.h +0 -104
- package/include/lynx/platform/embedder/public/lynx_trail_service.h +0 -81
- package/include/lynx/platform/embedder/public/lynx_update_meta.h +0 -56
- package/include/lynx/platform/embedder/public/lynx_value.h +0 -270
- package/include/lynx/platform/embedder/public/lynx_view.h +0 -364
- package/include/lynx/platform/embedder/public/lynx_view_client.h +0 -226
- package/include/lynx/platform/embedder/public/lynx_vsync_monitor.h +0 -70
- package/include/lynx/platform/embedder/public/lynx_windowless_renderer.h +0 -302
- package/include/lynx/registration.h +0 -178
- package/include/lynx_env.h +0 -104
- package/include/lynx_event_reporter_service.h +0 -96
- package/include/lynx_event_simulation_proxy.h +0 -31
- package/include/lynx_extension.h +0 -10
- package/include/lynx_extension_module.h +0 -521
- package/include/lynx_generic_resource_fetcher.h +0 -178
- package/include/lynx_group.h +0 -70
- package/include/lynx_http_service.h +0 -211
- package/include/lynx_load_meta.h +0 -120
- package/include/lynx_native_module.h +0 -9
- package/include/lynx_native_view.h +0 -201
- package/include/lynx_resource_request.h +0 -56
- package/include/lynx_resource_response.h +0 -63
- package/include/lynx_runtime_lifecycle_observer.h +0 -102
- package/include/lynx_security_service.h +0 -78
- package/include/lynx_service_center.h +0 -64
- package/include/lynx_template_bundle.h +0 -65
- package/include/lynx_template_data.h +0 -104
- package/include/lynx_trail_service.h +0 -81
- package/include/lynx_update_meta.h +0 -56
- package/include/lynx_value.h +0 -270
- package/include/lynx_view.h +0 -364
- package/include/lynx_view_client.h +0 -226
- package/include/lynx_vsync_monitor.h +0 -70
- package/include/lynx_windowless_renderer.h +0 -302
- package/include/napi-inl.deprecated.h +0 -186
- package/include/napi-inl.h +0 -6607
- package/include/napi.h +0 -3208
- package/include/node_api.h +0 -276
- package/include/node_api_types.h +0 -59
- package/include/third_party/weak-node-api/headers/js_native_api.h +0 -608
- package/include/third_party/weak-node-api/headers/js_native_api_types.h +0 -202
- package/include/third_party/weak-node-api/headers/napi-inl.deprecated.h +0 -186
- package/include/third_party/weak-node-api/headers/napi-inl.h +0 -6607
- package/include/third_party/weak-node-api/headers/napi.h +0 -3208
- package/include/third_party/weak-node-api/headers/node_api.h +0 -276
- package/include/third_party/weak-node-api/headers/node_api_types.h +0 -59
- package/include/third_party/weak-node-api/headers/weak_napi_defines.h +0 -331
- package/include/third_party/weak-node-api/headers/weak_napi_undefs.h +0 -282
- package/include/weak_napi_defines.h +0 -331
- package/include/weak_napi_undefs.h +0 -282
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 The Lynx Authors. All rights reserved.
|
|
2
|
-
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
-
// LICENSE file in the root directory of this source tree.
|
|
4
|
-
|
|
5
|
-
#ifndef PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_EXTENSION_MODULE_CAPI_H_
|
|
6
|
-
#define PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_EXTENSION_MODULE_CAPI_H_
|
|
7
|
-
|
|
8
|
-
#include <stdint.h>
|
|
9
|
-
|
|
10
|
-
#include "lynx_export.h"
|
|
11
|
-
#include "lynx_extension_module_types_capi.h"
|
|
12
|
-
#include "lynx_generic_resource_fetcher_capi.h"
|
|
13
|
-
#include "lynx_native_module_capi.h"
|
|
14
|
-
#include "lynx_view_capi.h"
|
|
15
|
-
#include "third_party/weak-node-api/headers/node_api.h"
|
|
16
|
-
#ifdef USE_WEAK_SUFFIX_NAPI
|
|
17
|
-
#include "third_party/weak-node-api/headers/weak_napi_defines.h"
|
|
18
|
-
#endif
|
|
19
|
-
|
|
20
|
-
LYNX_EXTERN_C_BEGIN
|
|
21
|
-
|
|
22
|
-
typedef struct lynx_vsync_observer_t lynx_vsync_observer_t;
|
|
23
|
-
|
|
24
|
-
typedef void (*vsync_observer_callback)(void* user_data, int64_t, int64_t);
|
|
25
|
-
|
|
26
|
-
// To synchronize with a given VSync, a callback is set, which is called back
|
|
27
|
-
// when the next VSync signal arrives. This callback will be called before any
|
|
28
|
-
// normal callback.
|
|
29
|
-
LYNX_CAPI_EXPORT void lynx_vsync_observer_request_before_animation_frame(
|
|
30
|
-
lynx_vsync_observer_t*, uintptr_t id, vsync_observer_callback callback,
|
|
31
|
-
void* user_data);
|
|
32
|
-
// To synchronize with a given VSync, a callback is set, which is normal
|
|
33
|
-
// callback and is called back when the next VSync signal arrives.
|
|
34
|
-
LYNX_CAPI_EXPORT void lynx_vsync_observer_request_animation_frame(
|
|
35
|
-
lynx_vsync_observer_t*, uintptr_t id, vsync_observer_callback callback,
|
|
36
|
-
void* user_data);
|
|
37
|
-
// To synchronize with a given VSync, a callback is set, which is called back
|
|
38
|
-
// when the next VSync signal arrives. This callback will be called after any
|
|
39
|
-
// normal callback.
|
|
40
|
-
LYNX_CAPI_EXPORT void
|
|
41
|
-
lynx_vsync_observer_register_after_animation_frame_listener(
|
|
42
|
-
lynx_vsync_observer_t*, vsync_observer_callback callback, void* user_data);
|
|
43
|
-
|
|
44
|
-
typedef void (*lynx_extension_module_on_lynx_view_create_func)(
|
|
45
|
-
lynx_extension_module_t*, lynx_view_t*);
|
|
46
|
-
typedef void (*lynx_extension_module_on_lynx_view_destroy_func)(
|
|
47
|
-
lynx_extension_module_t*);
|
|
48
|
-
typedef void (*lynx_extension_module_on_runtime_init_func)(
|
|
49
|
-
lynx_extension_module_t*);
|
|
50
|
-
typedef void (*lynx_extension_module_on_runtime_attach_func)(
|
|
51
|
-
lynx_extension_module_t*, napi_env, lynx_vsync_observer_t*);
|
|
52
|
-
typedef void (*lynx_extension_module_on_runtime_ready_func)(
|
|
53
|
-
lynx_extension_module_t*, napi_env, napi_value, const char* url);
|
|
54
|
-
typedef void (*lynx_extension_module_on_runtime_detach_func)(
|
|
55
|
-
lynx_extension_module_t*);
|
|
56
|
-
typedef void (*lynx_extension_module_on_enter_foreground_func)(
|
|
57
|
-
lynx_extension_module_t*);
|
|
58
|
-
typedef void (*lynx_extension_module_on_enter_background_func)(
|
|
59
|
-
lynx_extension_module_t*);
|
|
60
|
-
typedef void (*lynx_extension_module_on_destroy_func)(lynx_extension_module_t*);
|
|
61
|
-
typedef void (*lynx_extension_module_post_task_func)(void* user_data);
|
|
62
|
-
|
|
63
|
-
// Creates a lynx_extension_module_t instance. It associates the provided
|
|
64
|
-
// user data with the module, which can be retrieved later using
|
|
65
|
-
// `lynx_extension_module_get_user_data`.
|
|
66
|
-
LYNX_CAPI_EXPORT lynx_extension_module_t* lynx_extension_module_create(
|
|
67
|
-
void* user_data);
|
|
68
|
-
|
|
69
|
-
// Creates a lynx_extension_module_t instance with a finalizer. It associates
|
|
70
|
-
// the provided user data with the module, which can be retrieved later using
|
|
71
|
-
// `lynx_extension_module_get_user_data`. The finalizer function will be called
|
|
72
|
-
// when the module is released.
|
|
73
|
-
LYNX_CAPI_EXPORT lynx_extension_module_t*
|
|
74
|
-
lynx_extension_module_create_with_finalizer(
|
|
75
|
-
void* user_data, void (*finalizer)(lynx_extension_module_t*, void*));
|
|
76
|
-
|
|
77
|
-
LYNX_CAPI_EXPORT void* lynx_extension_module_get_user_data(
|
|
78
|
-
lynx_extension_module_t*);
|
|
79
|
-
// Binds a lynx_view_create state function to lynx_extension_module_t. This
|
|
80
|
-
// function will be invoked on lynx_view_t create. It is always called on the
|
|
81
|
-
// main thread.
|
|
82
|
-
LYNX_CAPI_EXPORT void lynx_extension_module_bind_lynx_view_create(
|
|
83
|
-
lynx_extension_module_t*,
|
|
84
|
-
lynx_extension_module_on_lynx_view_create_func func);
|
|
85
|
-
// Binds a lynx_view_destroy state function to lynx_extension_module_t. This
|
|
86
|
-
// function will be invoked on lynx_view_t destroy. It is always called on the
|
|
87
|
-
// main thread.
|
|
88
|
-
LYNX_CAPI_EXPORT void lynx_extension_module_bind_lynx_view_destroy(
|
|
89
|
-
lynx_extension_module_t*,
|
|
90
|
-
lynx_extension_module_on_lynx_view_destroy_func func);
|
|
91
|
-
// Binds a runtime_init state function to lynx_extension_module_t. This
|
|
92
|
-
// function will be invoked on runtime init. It is always called on the main
|
|
93
|
-
// thread.
|
|
94
|
-
LYNX_CAPI_EXPORT void lynx_extension_module_bind_runtime_init(
|
|
95
|
-
lynx_extension_module_t*, lynx_extension_module_on_runtime_init_func func);
|
|
96
|
-
// Binds a runtime_attach state function to lynx_extension_module_t. This
|
|
97
|
-
// function will be invoked on runtime attached. It is always called on the BTS
|
|
98
|
-
// thread.
|
|
99
|
-
LYNX_CAPI_EXPORT void lynx_extension_module_bind_runtime_attach(
|
|
100
|
-
lynx_extension_module_t*,
|
|
101
|
-
lynx_extension_module_on_runtime_attach_func func);
|
|
102
|
-
// Binds a runtime_ready state function to lynx_extension_module_t. This
|
|
103
|
-
// function will be invoked on runtime ready. It is always called on the BTS
|
|
104
|
-
// thread.
|
|
105
|
-
LYNX_CAPI_EXPORT void lynx_extension_module_bind_runtime_ready(
|
|
106
|
-
lynx_extension_module_t*, lynx_extension_module_on_runtime_ready_func func);
|
|
107
|
-
// Binds a runtime_detach state function to lynx_extension_module_t. This
|
|
108
|
-
// function will be invoked on runtime detached. It is always called on the BTS
|
|
109
|
-
// thread.
|
|
110
|
-
LYNX_CAPI_EXPORT void lynx_extension_module_bind_runtime_detach(
|
|
111
|
-
lynx_extension_module_t*,
|
|
112
|
-
lynx_extension_module_on_runtime_detach_func func);
|
|
113
|
-
// Binds application did enter foreground state function to
|
|
114
|
-
// lynx_extension_module_t.
|
|
115
|
-
LYNX_CAPI_EXPORT void lynx_extension_module_bind_enter_foreground(
|
|
116
|
-
lynx_extension_module_t*,
|
|
117
|
-
lynx_extension_module_on_enter_foreground_func func);
|
|
118
|
-
// Binds application did enter background state function to
|
|
119
|
-
// lynx_extension_module_t.
|
|
120
|
-
LYNX_CAPI_EXPORT void lynx_extension_module_bind_enter_background(
|
|
121
|
-
lynx_extension_module_t*,
|
|
122
|
-
lynx_extension_module_on_enter_background_func func);
|
|
123
|
-
// Binds on lynx_extension_module_t instance destroy state. It will be called
|
|
124
|
-
// before the lynx_extension_module_t is released.
|
|
125
|
-
LYNX_CAPI_EXPORT void lynx_extension_module_bind_on_destroy(
|
|
126
|
-
lynx_extension_module_t*, lynx_extension_module_on_destroy_func func);
|
|
127
|
-
// Set a napi_module_creator into lynx_extension_module_t. napi_module_creator
|
|
128
|
-
// can be used to create modules that bind napi exports.
|
|
129
|
-
LYNX_CAPI_EXPORT void lynx_extension_module_set_napi_module_creator(
|
|
130
|
-
lynx_extension_module_t*, napi_module_creator creator);
|
|
131
|
-
// Post task to Runtime thread.
|
|
132
|
-
LYNX_CAPI_EXPORT void lynx_extension_module_post_task_to_runtime(
|
|
133
|
-
lynx_extension_module_t*, lynx_extension_module_post_task_func func,
|
|
134
|
-
void* user_data);
|
|
135
|
-
// Is running tasks on current thread.
|
|
136
|
-
LYNX_CAPI_EXPORT bool lynx_extension_module_is_running_on_bts_thread(
|
|
137
|
-
lynx_extension_module_t*);
|
|
138
|
-
|
|
139
|
-
LYNX_CAPI_EXPORT void lynx_extension_module_ref(lynx_extension_module_t*);
|
|
140
|
-
LYNX_CAPI_EXPORT void lynx_extension_module_unref(lynx_extension_module_t*);
|
|
141
|
-
|
|
142
|
-
LYNX_EXTERN_C_END
|
|
143
|
-
|
|
144
|
-
#ifdef USE_WEAK_SUFFIX_NAPI
|
|
145
|
-
#include "third_party/weak-node-api/headers/weak_napi_undefs.h"
|
|
146
|
-
#endif
|
|
147
|
-
|
|
148
|
-
#endif // PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_EXTENSION_MODULE_CAPI_H_
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 The Lynx Authors. All rights reserved.
|
|
2
|
-
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
-
// LICENSE file in the root directory of this source tree.
|
|
4
|
-
#ifndef PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_EXTENSION_MODULE_TYPES_CAPI_H_
|
|
5
|
-
#define PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_EXTENSION_MODULE_TYPES_CAPI_H_
|
|
6
|
-
|
|
7
|
-
#include "lynx_export.h"
|
|
8
|
-
|
|
9
|
-
LYNX_EXTERN_C_BEGIN
|
|
10
|
-
|
|
11
|
-
typedef struct lynx_extension_module_t lynx_extension_module_t;
|
|
12
|
-
|
|
13
|
-
typedef lynx_extension_module_t* (*extension_module_creator)(void* opaque);
|
|
14
|
-
|
|
15
|
-
LYNX_EXTERN_C_END
|
|
16
|
-
|
|
17
|
-
#endif // PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_EXTENSION_MODULE_TYPES_CAPI_H_
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 The Lynx Authors. All rights reserved.
|
|
2
|
-
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
-
// LICENSE file in the root directory of this source tree.
|
|
4
|
-
#ifndef PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_GENERIC_RESOURCE_FETCHER_CAPI_H_
|
|
5
|
-
#define PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_GENERIC_RESOURCE_FETCHER_CAPI_H_
|
|
6
|
-
|
|
7
|
-
#include "lynx_export.h"
|
|
8
|
-
#include "lynx_resource_request_capi.h"
|
|
9
|
-
#include "lynx_resource_response_capi.h"
|
|
10
|
-
|
|
11
|
-
LYNX_EXTERN_C_BEGIN
|
|
12
|
-
|
|
13
|
-
typedef struct lynx_generic_resource_fetcher_t lynx_generic_resource_fetcher_t;
|
|
14
|
-
|
|
15
|
-
// Function pointer type for the resource fetching callback. This type defines a
|
|
16
|
-
// callback function used to fetch resources. The callback takes a pointer to a
|
|
17
|
-
// generic resource fetcher, a resource request, and a resource response object.
|
|
18
|
-
// It is responsible for populating the response based on the request.
|
|
19
|
-
typedef void (*fetch_resource_func)(lynx_generic_resource_fetcher_t*,
|
|
20
|
-
lynx_resource_request_t* request,
|
|
21
|
-
lynx_resource_response_t* response);
|
|
22
|
-
|
|
23
|
-
// Function pointer type for the resource fetch cancellation callback. This type
|
|
24
|
-
// defines a callback function used to cancel an ongoing resource fetch request.
|
|
25
|
-
// The callback takes a pointer to a generic resource fetcher and the unique
|
|
26
|
-
// identifier of the resource request to be cancelled.
|
|
27
|
-
typedef void (*cancel_fetch_func)(lynx_generic_resource_fetcher_t*,
|
|
28
|
-
lynx_resource_request_id request_id);
|
|
29
|
-
|
|
30
|
-
// Function pointer type for the URL interception callback. This type defines a
|
|
31
|
-
// callback function used to intercept and potentially redirect a resource URL
|
|
32
|
-
// before it is fetched. The callback receives the original URL and returns a
|
|
33
|
-
// new URL. The caller is responsible for freeing the returned string using
|
|
34
|
-
// `free()`.
|
|
35
|
-
typedef char* (*lynx_resource_intercept_func)(const char* url,
|
|
36
|
-
bool should_decode,
|
|
37
|
-
void* user_data);
|
|
38
|
-
|
|
39
|
-
// Creates a new generic resource fetcher instance. This function allocates and
|
|
40
|
-
// initializes a new generic resource fetcher object. It associates the provided
|
|
41
|
-
// user data with the fetcher, which can be retrieved later using
|
|
42
|
-
// `lynx_generic_resource_fetcher_get_user_data`.
|
|
43
|
-
LYNX_CAPI_EXPORT lynx_generic_resource_fetcher_t*
|
|
44
|
-
lynx_generic_resource_fetcher_create(void* user_data);
|
|
45
|
-
|
|
46
|
-
// Creates a new generic resource fetcher instance with a finalizer. This
|
|
47
|
-
// function allocates and initializes a new generic resource fetcher object. It
|
|
48
|
-
// associates the provided user data with the fetcher and sets a finalizer
|
|
49
|
-
// function that will be called when the fetcher is released.
|
|
50
|
-
LYNX_CAPI_EXPORT lynx_generic_resource_fetcher_t*
|
|
51
|
-
lynx_generic_resource_fetcher_create_with_finalizer(
|
|
52
|
-
void* user_data,
|
|
53
|
-
void (*finalizer)(lynx_generic_resource_fetcher_t*, void*));
|
|
54
|
-
|
|
55
|
-
LYNX_CAPI_EXPORT void* lynx_generic_resource_fetcher_get_user_data(
|
|
56
|
-
lynx_generic_resource_fetcher_t*);
|
|
57
|
-
|
|
58
|
-
// Binds a resource fetching callback to a generic resource fetcher. This
|
|
59
|
-
// function sets the resource fetching callback function for the given generic
|
|
60
|
-
// resource fetcher instance. The callback will be invoked when a resource needs
|
|
61
|
-
// to be fetched.
|
|
62
|
-
LYNX_CAPI_EXPORT void lynx_generic_resource_fetcher_bind_fetch_resource(
|
|
63
|
-
lynx_generic_resource_fetcher_t*, fetch_resource_func f);
|
|
64
|
-
|
|
65
|
-
// Binds a resource path fetching callback to a generic resource fetcher. This
|
|
66
|
-
// function sets the resource path fetching callback function for the given
|
|
67
|
-
// generic resource fetcher instance. The callback will be invoked when the path
|
|
68
|
-
// of a resource needs to be fetched.
|
|
69
|
-
LYNX_CAPI_EXPORT void lynx_generic_resource_fetcher_bind_fetch_resource_path(
|
|
70
|
-
lynx_generic_resource_fetcher_t*, fetch_resource_func f);
|
|
71
|
-
|
|
72
|
-
// Binds a resource fetch cancellation callback to a generic resource fetcher.
|
|
73
|
-
// This function sets the resource fetch cancellation callback function for the
|
|
74
|
-
// given generic resource fetcher instance. The callback will be invoked when a
|
|
75
|
-
// resource fetch request needs to be cancelled.
|
|
76
|
-
LYNX_CAPI_EXPORT void lynx_generic_resource_fetcher_bind_cancel_fetch(
|
|
77
|
-
lynx_generic_resource_fetcher_t*, cancel_fetch_func f);
|
|
78
|
-
|
|
79
|
-
// Binds a URL interception callback to a generic resource fetcher. This
|
|
80
|
-
// function sets the URL interception callback for the given fetcher instance.
|
|
81
|
-
// The callback will be invoked to transform a URL before a resource request is
|
|
82
|
-
// made, using the generic `user_data` provided during the fetcher's creation.
|
|
83
|
-
LYNX_CAPI_EXPORT void lynx_generic_resource_fetcher_bind_intercept_func(
|
|
84
|
-
lynx_generic_resource_fetcher_t* fetcher,
|
|
85
|
-
lynx_resource_intercept_func func);
|
|
86
|
-
|
|
87
|
-
// Releases a generic resource fetcher instance. This function deallocates the
|
|
88
|
-
// memory used by the given generic resource fetcher instance and calls the
|
|
89
|
-
// finalizer function if one was set during creation. After calling this
|
|
90
|
-
// function, the provided pointer becomes invalid.
|
|
91
|
-
LYNX_CAPI_EXPORT void lynx_generic_resource_fetcher_release(
|
|
92
|
-
lynx_generic_resource_fetcher_t*);
|
|
93
|
-
|
|
94
|
-
// -----------------------------------------------------------------------------
|
|
95
|
-
// The following functions are provided for an ExtensionModule to invoke the
|
|
96
|
-
// corresponding resource fetching capabilities of the host environment.
|
|
97
|
-
// -----------------------------------------------------------------------------
|
|
98
|
-
|
|
99
|
-
// Invokes the fetch resource function bound to the generic resource fetcher.
|
|
100
|
-
LYNX_CAPI_EXPORT void lynx_generic_resource_fetcher_fetch_resource(
|
|
101
|
-
lynx_generic_resource_fetcher_t*, lynx_resource_request_t*,
|
|
102
|
-
lynx_resource_response_t*);
|
|
103
|
-
|
|
104
|
-
// Invokes the fetch resource path function bound to the generic resource
|
|
105
|
-
// fetcher.
|
|
106
|
-
LYNX_CAPI_EXPORT void lynx_generic_resource_fetcher_fetch_resource_path(
|
|
107
|
-
lynx_generic_resource_fetcher_t*, lynx_resource_request_t*,
|
|
108
|
-
lynx_resource_response_t*);
|
|
109
|
-
|
|
110
|
-
// Invokes the cancel fetch function bound to the generic resource fetcher.
|
|
111
|
-
LYNX_CAPI_EXPORT void lynx_generic_resource_fetcher_cancel_fetch(
|
|
112
|
-
lynx_generic_resource_fetcher_t*, lynx_resource_request_id);
|
|
113
|
-
|
|
114
|
-
// Invokes the intercept function bound to the generic resource fetcher.
|
|
115
|
-
// The caller is responsible for freeing the returned string using
|
|
116
|
-
// `lynx_free()`.
|
|
117
|
-
LYNX_CAPI_EXPORT char* lynx_generic_resource_fetcher_intercept(
|
|
118
|
-
lynx_generic_resource_fetcher_t*, const char* url, bool should_decode);
|
|
119
|
-
|
|
120
|
-
// -----------------------------------------------------------------------------
|
|
121
|
-
|
|
122
|
-
LYNX_EXTERN_C_END
|
|
123
|
-
|
|
124
|
-
#endif // PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_GENERIC_RESOURCE_FETCHER_CAPI_H_
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 The Lynx Authors. All rights reserved.
|
|
2
|
-
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
-
// LICENSE file in the root directory of this source tree.
|
|
4
|
-
#ifndef PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_GROUP_CAPI_H_
|
|
5
|
-
#define PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_GROUP_CAPI_H_
|
|
6
|
-
|
|
7
|
-
#include <stddef.h>
|
|
8
|
-
|
|
9
|
-
#include "lynx_export.h"
|
|
10
|
-
|
|
11
|
-
LYNX_EXTERN_C_BEGIN
|
|
12
|
-
|
|
13
|
-
typedef struct lynx_group_t lynx_group_t;
|
|
14
|
-
|
|
15
|
-
#define LYNX_SINGLE_GROUP "-1"
|
|
16
|
-
|
|
17
|
-
// Create a group with the given. A unique ID will be generated as group ID.
|
|
18
|
-
LYNX_CAPI_EXPORT lynx_group_t* lynx_group_create(const char* name);
|
|
19
|
-
|
|
20
|
-
// Create a group with the given name and ID. If the ID is not provided, a
|
|
21
|
-
// unique ID will be generated. The ID should ideally be set to
|
|
22
|
-
// `LYNX_SINGLE_GROUP` Other values are considered experimental features and
|
|
23
|
-
// should be used with caution.
|
|
24
|
-
LYNX_CAPI_EXPORT lynx_group_t* lynx_group_create_with_id(const char* name,
|
|
25
|
-
const char* id);
|
|
26
|
-
|
|
27
|
-
// Sets the preload JavaScript file paths for a lynx group. This function allows
|
|
28
|
-
// you to specify an array of JavaScript file paths that should be preloaded for
|
|
29
|
-
// a given lynx group.
|
|
30
|
-
LYNX_CAPI_EXPORT void lynx_group_set_preload_js_paths(lynx_group_t*,
|
|
31
|
-
const char* paths[],
|
|
32
|
-
size_t size);
|
|
33
|
-
// Enables or disables the JavaScript group thread for a lynx group.
|
|
34
|
-
LYNX_CAPI_EXPORT void lynx_group_set_enable_js_group_thread(lynx_group_t*,
|
|
35
|
-
int enable);
|
|
36
|
-
|
|
37
|
-
// Release the lynx group.
|
|
38
|
-
LYNX_CAPI_EXPORT void lynx_group_release(lynx_group_t*);
|
|
39
|
-
|
|
40
|
-
LYNX_EXTERN_C_END
|
|
41
|
-
|
|
42
|
-
#endif // PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_GROUP_CAPI_H_
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 The Lynx Authors. All rights reserved.
|
|
2
|
-
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
-
// LICENSE file in the root directory of this source tree.
|
|
4
|
-
#ifndef PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_HTTP_SERVICE_CAPI_H_
|
|
5
|
-
#define PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_HTTP_SERVICE_CAPI_H_
|
|
6
|
-
|
|
7
|
-
#include <stdint.h>
|
|
8
|
-
#include <stdlib.h>
|
|
9
|
-
|
|
10
|
-
#include "lynx_export.h"
|
|
11
|
-
|
|
12
|
-
LYNX_EXTERN_C_BEGIN
|
|
13
|
-
|
|
14
|
-
// Forward declaration of the lynx_http_request_t struct.
|
|
15
|
-
typedef struct lynx_http_request_t lynx_http_request_t;
|
|
16
|
-
// Retrieves the URL associated with the HTTP request. This function extracts
|
|
17
|
-
// and returns the URL of the specified HTTP request. The caller should not free
|
|
18
|
-
// the returned pointer.
|
|
19
|
-
LYNX_CAPI_EXPORT const char* lynx_http_request_get_url(lynx_http_request_t*);
|
|
20
|
-
// Retrieves the HTTP method of the specified request. This function extracts
|
|
21
|
-
// and returns the HTTP method (such as "GET", "POST", "PUT", etc.) associated
|
|
22
|
-
// with the given HTTP request. The caller should not free the returned pointer.
|
|
23
|
-
LYNX_CAPI_EXPORT const char* lynx_http_request_get_method(lynx_http_request_t*);
|
|
24
|
-
// Retrieves the HTTP method of the specified request. This function extracts
|
|
25
|
-
// and returns the HTTP method (such as "GET", "POST", "PUT", etc.) associated
|
|
26
|
-
// with the given HTTP request. The caller should not free the returned pointer.
|
|
27
|
-
LYNX_CAPI_EXPORT size_t lynx_http_request_get_body(lynx_http_request_t*,
|
|
28
|
-
const uint8_t** data);
|
|
29
|
-
// Retrieves the number of headers in the specified HTTP request. This function
|
|
30
|
-
// counts and returns the number of headers associated with the given HTTP
|
|
31
|
-
// request. The returned value can be used to iterate over all headers using
|
|
32
|
-
// `lynx_http_request_get_header`.
|
|
33
|
-
LYNX_CAPI_EXPORT size_t
|
|
34
|
-
lynx_http_request_get_header_count(lynx_http_request_t*);
|
|
35
|
-
// Retrieves a header from the specified HTTP request by index. This function
|
|
36
|
-
// fetches the header key and value at the given index from the HTTP request.
|
|
37
|
-
// The index should be in the range `[0,
|
|
38
|
-
// lynx_http_request_get_header_count(request))`. The caller should not free the
|
|
39
|
-
// returned pointers, as their lifetimes are managed by the
|
|
40
|
-
// `lynx_http_request_t` object.
|
|
41
|
-
LYNX_CAPI_EXPORT void lynx_http_request_get_header(lynx_http_request_t*,
|
|
42
|
-
uint32_t index,
|
|
43
|
-
const char** key,
|
|
44
|
-
const char** value);
|
|
45
|
-
// Releases the resources associated with an HTTP request.
|
|
46
|
-
LYNX_CAPI_EXPORT void lynx_http_request_release(lynx_http_request_t*);
|
|
47
|
-
|
|
48
|
-
// Forward declaration of the lynx_http_response_t struct.
|
|
49
|
-
typedef struct lynx_http_response_t lynx_http_response_t;
|
|
50
|
-
// Sets the URL of an HTTP response. This function allows you to specify the URL
|
|
51
|
-
// of the given HTTP response object.
|
|
52
|
-
LYNX_CAPI_EXPORT void lynx_http_response_set_url(lynx_http_response_t*,
|
|
53
|
-
const char* url);
|
|
54
|
-
// Sets the status code of an HTTP response. This function allows you to specify
|
|
55
|
-
// the status code of the given HTTP response object. Status codes are used to
|
|
56
|
-
// indicate the outcome of an HTTP request, such as 200 for success, 404 for not
|
|
57
|
-
// found, etc.
|
|
58
|
-
LYNX_CAPI_EXPORT void lynx_http_response_set_status_code(lynx_http_response_t*,
|
|
59
|
-
int status_code);
|
|
60
|
-
// Sets the status text of an HTTP response. This function allows you to specify
|
|
61
|
-
// the status text associated with the HTTP response. The status text provides a
|
|
62
|
-
// human - readable description corresponding to the status code. For example,
|
|
63
|
-
// "OK" for status code 200, "Not Found" for status code 404. The caller should
|
|
64
|
-
// not free the memory of the passed `status_text` pointer.
|
|
65
|
-
LYNX_CAPI_EXPORT void lynx_http_response_set_status_text(
|
|
66
|
-
lynx_http_response_t*, const char* status_text);
|
|
67
|
-
// Adds a header to the specified HTTP response. This function allows you to add
|
|
68
|
-
// a new header to the given HTTP response object. Headers are used to provide
|
|
69
|
-
// additional information about the response, such as content type, caching
|
|
70
|
-
// directives, etc.
|
|
71
|
-
LYNX_CAPI_EXPORT void lynx_http_response_add_header(lynx_http_response_t*,
|
|
72
|
-
const char* key,
|
|
73
|
-
const char* value);
|
|
74
|
-
// Sets the body content of an HTTP response. This function allows you to
|
|
75
|
-
// specify the body content of the given HTTP response object. You can also
|
|
76
|
-
// provide a custom destructor function to handle the cleanup of the content
|
|
77
|
-
// memory, and pass an opaque pointer for additional context.
|
|
78
|
-
LYNX_CAPI_EXPORT void lynx_http_response_set_body(
|
|
79
|
-
lynx_http_response_t*, uint8_t* content, size_t length,
|
|
80
|
-
void (*dtor)(uint8_t*, size_t, void*), void* opaque);
|
|
81
|
-
// Triggers the callback associated with an HTTP response. This function invokes
|
|
82
|
-
// the callback that is related to the specified HTTP response object. This
|
|
83
|
-
// function must be called when the response is ready or failed.
|
|
84
|
-
LYNX_CAPI_EXPORT void lynx_http_response_callback(lynx_http_response_t*);
|
|
85
|
-
// Releases the resources associated with an HTTP response.
|
|
86
|
-
LYNX_CAPI_EXPORT void lynx_http_response_release(lynx_http_response_t*);
|
|
87
|
-
|
|
88
|
-
typedef struct lynx_http_service_t lynx_http_service_t;
|
|
89
|
-
// Define a function pointer type for HTTP request handling.
|
|
90
|
-
typedef void (*lynx_http_request_func)(lynx_http_service_t*,
|
|
91
|
-
lynx_http_request_t* request,
|
|
92
|
-
lynx_http_response_t* response);
|
|
93
|
-
// Creates a new HTTP service instance.
|
|
94
|
-
LYNX_CAPI_EXPORT lynx_http_service_t* lynx_http_service_create(void* user_data);
|
|
95
|
-
// Create a new HTTP service instance with a finalizer.
|
|
96
|
-
// The finalizer will be called when the service is released.
|
|
97
|
-
// The instance's lifecycle is based on reference count.
|
|
98
|
-
LYNX_CAPI_EXPORT lynx_http_service_t* lynx_http_service_create_with_finalizer(
|
|
99
|
-
void* user_data, void (*finalizer)(lynx_http_service_t*, void*));
|
|
100
|
-
// Retrieves the user data associated with an HTTP service.
|
|
101
|
-
LYNX_CAPI_EXPORT void* lynx_http_service_get_user_data(lynx_http_service_t*);
|
|
102
|
-
// Binds an HTTP request handling function to an HTTP service. This function
|
|
103
|
-
// associates the specified HTTP request handling function with the given HTTP
|
|
104
|
-
// service. Whenever an HTTP request is received by the service, the bound
|
|
105
|
-
// function will be invoked to process the request.
|
|
106
|
-
LYNX_CAPI_EXPORT void lynx_http_service_bind(lynx_http_service_t*,
|
|
107
|
-
lynx_http_request_func f);
|
|
108
|
-
// Releases the resources associated with an HTTP service.
|
|
109
|
-
LYNX_CAPI_EXPORT void lynx_http_service_release(lynx_http_service_t*);
|
|
110
|
-
|
|
111
|
-
LYNX_EXTERN_C_END
|
|
112
|
-
|
|
113
|
-
#endif // PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_HTTP_SERVICE_CAPI_H_
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 The Lynx Authors. All rights reserved.
|
|
2
|
-
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
-
// LICENSE file in the root directory of this source tree.
|
|
4
|
-
#ifndef PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_LOAD_META_CAPI_H_
|
|
5
|
-
#define PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_LOAD_META_CAPI_H_
|
|
6
|
-
|
|
7
|
-
#include "lynx_export.h"
|
|
8
|
-
#include "lynx_template_bundle_capi.h"
|
|
9
|
-
#include "lynx_template_data_capi.h"
|
|
10
|
-
|
|
11
|
-
LYNX_EXTERN_C_BEGIN
|
|
12
|
-
|
|
13
|
-
// LynxLoadMeta is the metadata structure used by LynxView to load templates. It
|
|
14
|
-
// will be used as the input parameter of loadTemplate. Users can use
|
|
15
|
-
// LynxLoadMeta to specify many parameters of loading templates, such as
|
|
16
|
-
// specifying template content, template initial data, and other additional
|
|
17
|
-
// configuration information. url, binary_data, bundle are the required
|
|
18
|
-
// parameters for template loading. You can pass only one or all of them. The
|
|
19
|
-
// priority relationship is as follows: bundle > binary_data > url.
|
|
20
|
-
typedef struct lynx_load_meta_t lynx_load_meta_t;
|
|
21
|
-
|
|
22
|
-
LYNX_CAPI_EXPORT lynx_load_meta_t* lynx_load_meta_create();
|
|
23
|
-
|
|
24
|
-
// The file path of the template.
|
|
25
|
-
LYNX_CAPI_EXPORT void lynx_load_meta_set_url(lynx_load_meta_t*, const char*);
|
|
26
|
-
|
|
27
|
-
// The binary file data of the template. You can also
|
|
28
|
-
// provide a custom destructor function to handle the cleanup of the content
|
|
29
|
-
// memory, and pass an opaque pointer for additional context.
|
|
30
|
-
LYNX_CAPI_EXPORT void lynx_load_meta_set_binary_data(
|
|
31
|
-
lynx_load_meta_t*, uint8_t* content, size_t length,
|
|
32
|
-
void (*dtor)(uint8_t*, size_t, void*), void* opaque);
|
|
33
|
-
|
|
34
|
-
// TemplateBundle object parsed in advance by the template's binary file data
|
|
35
|
-
LYNX_CAPI_EXPORT void lynx_load_meta_set_template_bundle(
|
|
36
|
-
lynx_load_meta_t*, lynx_template_bundle_t*);
|
|
37
|
-
|
|
38
|
-
// Set the initial data for the template. Initial data specified by the client
|
|
39
|
-
// during the first screen loading process
|
|
40
|
-
LYNX_CAPI_EXPORT void lynx_load_meta_set_initial_data(lynx_load_meta_t*,
|
|
41
|
-
lynx_template_data_t*);
|
|
42
|
-
|
|
43
|
-
// Set the global props data for the template.
|
|
44
|
-
LYNX_CAPI_EXPORT void lynx_load_meta_set_global_props(lynx_load_meta_t*,
|
|
45
|
-
lynx_template_data_t*);
|
|
46
|
-
|
|
47
|
-
// Release the load meta.
|
|
48
|
-
LYNX_CAPI_EXPORT void lynx_load_meta_release(lynx_load_meta_t*);
|
|
49
|
-
|
|
50
|
-
LYNX_EXTERN_C_END
|
|
51
|
-
|
|
52
|
-
#endif // PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_LOAD_META_CAPI_H_
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 The Lynx Authors. All rights reserved.
|
|
2
|
-
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
-
// LICENSE file in the root directory of this source tree.
|
|
4
|
-
|
|
5
|
-
#ifndef PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_LOG_CAPI_H_
|
|
6
|
-
#define PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_LOG_CAPI_H_
|
|
7
|
-
|
|
8
|
-
#include "lynx_export.h"
|
|
9
|
-
|
|
10
|
-
LYNX_EXTERN_C_BEGIN
|
|
11
|
-
|
|
12
|
-
// Defines the log levels for the Lynx logging system.
|
|
13
|
-
typedef enum lynx_log_level_e {
|
|
14
|
-
LYNX_LOG_VERBOSE = 0,
|
|
15
|
-
LYNX_LOG_DEBUG,
|
|
16
|
-
LYNX_LOG_INFO,
|
|
17
|
-
LYNX_LOG_WARNING,
|
|
18
|
-
LYNX_LOG_ERROR,
|
|
19
|
-
LYNX_LOG_FATAL,
|
|
20
|
-
} lynx_log_level_e;
|
|
21
|
-
|
|
22
|
-
// Callback function type for receiving Lynx log messages.
|
|
23
|
-
// @param level The severity level of the log message.
|
|
24
|
-
// @param tag A string identifying the source or context of the log message.
|
|
25
|
-
// @param msg The actual log message content.
|
|
26
|
-
typedef void (*lynx_log_callback_t)(lynx_log_level_e level, const char* tag,
|
|
27
|
-
const char* msg);
|
|
28
|
-
|
|
29
|
-
// Initializes the Lynx logging system with a custom callback.
|
|
30
|
-
// @param callback The function pointer to be invoked for logging.
|
|
31
|
-
LYNX_CAPI_EXPORT void lynx_log_init(lynx_log_callback_t callback);
|
|
32
|
-
|
|
33
|
-
// Sets the minimum severity level for logs to be output.
|
|
34
|
-
// Logs with a level lower than this will be ignored.
|
|
35
|
-
// @param min_log_level The minimum log level to set.
|
|
36
|
-
LYNX_CAPI_EXPORT void lynx_log_set_minimum_level(
|
|
37
|
-
lynx_log_level_e min_log_level);
|
|
38
|
-
|
|
39
|
-
// Retrieves the current minimum log level.
|
|
40
|
-
// @return The current minimum log level.
|
|
41
|
-
LYNX_CAPI_EXPORT lynx_log_level_e lynx_log_get_minimum_level();
|
|
42
|
-
|
|
43
|
-
// Writes a log message to the Lynx logging system.
|
|
44
|
-
// This function supports printf-style formatting.
|
|
45
|
-
// @param level The log level for the message.
|
|
46
|
-
// @param tag A tag to identify the source of the log message.
|
|
47
|
-
// @param format The printf-style format string.
|
|
48
|
-
// @param ... Additional arguments for the format string.
|
|
49
|
-
LYNX_CAPI_EXPORT void lynx_log_write_detailed(lynx_log_level_e level,
|
|
50
|
-
const char* tag, const char* file,
|
|
51
|
-
int line, const char* format,
|
|
52
|
-
...);
|
|
53
|
-
|
|
54
|
-
#ifdef __FILE_NAME__
|
|
55
|
-
#define __LYNX_CAPI_LOG_FILE__ __FILE_NAME__
|
|
56
|
-
#else
|
|
57
|
-
#define __LYNX_CAPI_LOG_FILE__ __FILE__
|
|
58
|
-
#endif
|
|
59
|
-
|
|
60
|
-
// The primary logging macro for external C-API consumers.
|
|
61
|
-
// This captures the file and line number automatically.
|
|
62
|
-
// Example: LYNX_CAPI_LOG(LYNX_LOG_INFO, "MyTag", "User ID: %d", 123);
|
|
63
|
-
#define LYNX_CAPI_LOG(level, tag, format, ...) \
|
|
64
|
-
lynx_log_write_detailed(level, tag, __LYNX_CAPI_LOG_FILE__, __LINE__, \
|
|
65
|
-
format, ##__VA_ARGS__)
|
|
66
|
-
|
|
67
|
-
LYNX_EXTERN_C_END
|
|
68
|
-
|
|
69
|
-
#endif // PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_LOG_CAPI_H_
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 The Lynx Authors. All rights reserved.
|
|
2
|
-
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
-
// LICENSE file in the root directory of this source tree.
|
|
4
|
-
|
|
5
|
-
#ifndef PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_MEMORY_CAPI_H_
|
|
6
|
-
#define PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_MEMORY_CAPI_H_
|
|
7
|
-
|
|
8
|
-
#include <stddef.h>
|
|
9
|
-
|
|
10
|
-
#include "lynx_export.h"
|
|
11
|
-
|
|
12
|
-
LYNX_EXTERN_C_BEGIN
|
|
13
|
-
|
|
14
|
-
// Allocates memory of `size` bytes. The memory is not initialized.
|
|
15
|
-
// The returned pointer must be deallocated with `lynx_free()`.
|
|
16
|
-
LYNX_CAPI_EXPORT void* lynx_malloc(size_t size);
|
|
17
|
-
|
|
18
|
-
// Deallocates the memory previously allocated by `lynx_malloc()` or
|
|
19
|
-
// `lynx_strdup()`. If `ptr` is a null pointer, no operation is performed.
|
|
20
|
-
LYNX_CAPI_EXPORT void lynx_free(void* ptr);
|
|
21
|
-
|
|
22
|
-
// Duplicates the string `s`. Memory for the new string is obtained with
|
|
23
|
-
// `lynx_malloc()`, and can be freed with `lynx_free()`.
|
|
24
|
-
LYNX_CAPI_EXPORT char* lynx_strdup(const char* s);
|
|
25
|
-
|
|
26
|
-
LYNX_EXTERN_C_END
|
|
27
|
-
|
|
28
|
-
#endif // PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_MEMORY_CAPI_H_
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 The Lynx Authors. All rights reserved.
|
|
2
|
-
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
-
// LICENSE file in the root directory of this source tree.
|
|
4
|
-
#ifndef PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_NATIVE_MODULE_CAPI_H_
|
|
5
|
-
#define PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_NATIVE_MODULE_CAPI_H_
|
|
6
|
-
|
|
7
|
-
#include "lynx_export.h"
|
|
8
|
-
#include "third_party/weak-node-api/headers/node_api.h"
|
|
9
|
-
|
|
10
|
-
#ifdef USE_WEAK_SUFFIX_NAPI
|
|
11
|
-
#include "third_party/weak-node-api/headers/weak_napi_defines.h"
|
|
12
|
-
#endif
|
|
13
|
-
|
|
14
|
-
LYNX_EXTERN_C_BEGIN
|
|
15
|
-
|
|
16
|
-
#define LYNX_NAPI_ENV_LYNX_VIEW_TAG 0xAC7F
|
|
17
|
-
|
|
18
|
-
typedef napi_value (*napi_module_creator)(napi_env, napi_value exports,
|
|
19
|
-
const char* module_name,
|
|
20
|
-
void* opaque);
|
|
21
|
-
|
|
22
|
-
// Stores a data with key to the global map.
|
|
23
|
-
LYNX_CAPI_EXPORT void lynx_napi_set_instance_data(napi_env env, uint64_t key,
|
|
24
|
-
void* data,
|
|
25
|
-
napi_finalize finalize_cb,
|
|
26
|
-
void* finalize_hint);
|
|
27
|
-
LYNX_CAPI_EXPORT void lynx_napi_get_instance_data(napi_env env, uint64_t key,
|
|
28
|
-
void** data);
|
|
29
|
-
|
|
30
|
-
// Runs a script from the provided source content in the given NAPI
|
|
31
|
-
// environment. This is not part of the standard NAPI surface, but Lynx needs
|
|
32
|
-
// to expose it as an embedder-specific helper for loading and evaluating script
|
|
33
|
-
// content with explicit source metadata. `filename` is used for script
|
|
34
|
-
// identification in diagnostics and stack traces.
|
|
35
|
-
LYNX_CAPI_EXPORT napi_status
|
|
36
|
-
lynx_napi_run_script_from_file(napi_env env, const char* script, size_t length,
|
|
37
|
-
const char* filename, napi_value* result);
|
|
38
|
-
|
|
39
|
-
// Reports the current exception associated with the given NAPI environment and
|
|
40
|
-
// then clears the recorded exception state. This is also a Lynx-specific
|
|
41
|
-
// extension instead of a standard NAPI API, provided because the embedder needs
|
|
42
|
-
// an explicit hook to consume and reset pending exception information.
|
|
43
|
-
LYNX_CAPI_EXPORT void lynx_napi_report_and_clear_exception(napi_env env);
|
|
44
|
-
|
|
45
|
-
LYNX_EXTERN_C_END
|
|
46
|
-
|
|
47
|
-
#ifdef USE_WEAK_SUFFIX_NAPI
|
|
48
|
-
#include "third_party/weak-node-api/headers/weak_napi_undefs.h"
|
|
49
|
-
#endif
|
|
50
|
-
|
|
51
|
-
#endif // PLATFORM_EMBEDDER_PUBLIC_CAPI_LYNX_NATIVE_MODULE_CAPI_H_
|