@kungfu-tech/libnode-win32-x64 0.0.0-bootstrap.0 → 22.22.3-kf.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/LICENSE +201 -0
- package/README.md +3 -0
- package/dist/node/include/acorn_version.h +6 -0
- package/dist/node/include/aliased_buffer-inl.h +244 -0
- package/dist/node/include/aliased_buffer.h +206 -0
- package/dist/node/include/aliased_struct-inl.h +54 -0
- package/dist/node/include/aliased_struct.h +63 -0
- package/dist/node/include/amaro_version.h +6 -0
- package/dist/node/include/async_context_frame.h +33 -0
- package/dist/node/include/async_wrap-inl.h +96 -0
- package/dist/node/include/async_wrap.h +243 -0
- package/dist/node/include/base_object-inl.h +335 -0
- package/dist/node/include/base_object.h +342 -0
- package/dist/node/include/base_object_types.h +74 -0
- package/dist/node/include/blob_serializer_deserializer-inl.h +385 -0
- package/dist/node/include/blob_serializer_deserializer.h +132 -0
- package/dist/node/include/callback_queue-inl.h +97 -0
- package/dist/node/include/callback_queue.h +79 -0
- package/dist/node/include/cares_wrap.h +447 -0
- package/dist/node/include/cjs_module_lexer_version.h +6 -0
- package/dist/node/include/cleanup_queue-inl.h +36 -0
- package/dist/node/include/cleanup_queue.h +79 -0
- package/dist/node/include/compile_cache.h +104 -0
- package/dist/node/include/connect_wrap.h +26 -0
- package/dist/node/include/connection_wrap.h +30 -0
- package/dist/node/include/cppgc/allocation.h +310 -0
- package/dist/node/include/cppgc/common.h +28 -0
- package/dist/node/include/cppgc/cross-thread-persistent.h +466 -0
- package/dist/node/include/cppgc/custom-space.h +97 -0
- package/dist/node/include/cppgc/default-platform.h +67 -0
- package/dist/node/include/cppgc/ephemeron-pair.h +30 -0
- package/dist/node/include/cppgc/explicit-management.h +100 -0
- package/dist/node/include/cppgc/garbage-collected.h +106 -0
- package/dist/node/include/cppgc/heap-consistency.h +309 -0
- package/dist/node/include/cppgc/heap-handle.h +48 -0
- package/dist/node/include/cppgc/heap-state.h +82 -0
- package/dist/node/include/cppgc/heap-statistics.h +120 -0
- package/dist/node/include/cppgc/heap.h +202 -0
- package/dist/node/include/cppgc/internal/api-constants.h +87 -0
- package/dist/node/include/cppgc/internal/atomic-entry-flag.h +48 -0
- package/dist/node/include/cppgc/internal/base-page-handle.h +45 -0
- package/dist/node/include/cppgc/internal/caged-heap-local-data.h +121 -0
- package/dist/node/include/cppgc/internal/caged-heap.h +68 -0
- package/dist/node/include/cppgc/internal/compiler-specific.h +38 -0
- package/dist/node/include/cppgc/internal/finalizer-trait.h +93 -0
- package/dist/node/include/cppgc/internal/gc-info.h +148 -0
- package/dist/node/include/cppgc/internal/logging.h +50 -0
- package/dist/node/include/cppgc/internal/member-storage.h +256 -0
- package/dist/node/include/cppgc/internal/name-trait.h +137 -0
- package/dist/node/include/cppgc/internal/persistent-node.h +214 -0
- package/dist/node/include/cppgc/internal/pointer-policies.h +243 -0
- package/dist/node/include/cppgc/internal/write-barrier.h +487 -0
- package/dist/node/include/cppgc/liveness-broker.h +78 -0
- package/dist/node/include/cppgc/macros.h +35 -0
- package/dist/node/include/cppgc/member.h +629 -0
- package/dist/node/include/cppgc/name-provider.h +65 -0
- package/dist/node/include/cppgc/object-size-trait.h +58 -0
- package/dist/node/include/cppgc/persistent.h +377 -0
- package/dist/node/include/cppgc/platform.h +163 -0
- package/dist/node/include/cppgc/prefinalizer.h +75 -0
- package/dist/node/include/cppgc/process-heap-statistics.h +36 -0
- package/dist/node/include/cppgc/sentinel-pointer.h +39 -0
- package/dist/node/include/cppgc/source-location.h +16 -0
- package/dist/node/include/cppgc/testing.h +106 -0
- package/dist/node/include/cppgc/trace-trait.h +128 -0
- package/dist/node/include/cppgc/type-traits.h +271 -0
- package/dist/node/include/cppgc/visitor.h +504 -0
- package/dist/node/include/crypto/crypto_aes.h +88 -0
- package/dist/node/include/crypto/crypto_bio.h +193 -0
- package/dist/node/include/crypto/crypto_cipher.h +293 -0
- package/dist/node/include/crypto/crypto_clienthello-inl.h +90 -0
- package/dist/node/include/crypto/crypto_clienthello.h +131 -0
- package/dist/node/include/crypto/crypto_common.h +64 -0
- package/dist/node/include/crypto/crypto_context.h +171 -0
- package/dist/node/include/crypto/crypto_dh.h +126 -0
- package/dist/node/include/crypto/crypto_dsa.h +52 -0
- package/dist/node/include/crypto/crypto_ec.h +164 -0
- package/dist/node/include/crypto/crypto_hash.h +91 -0
- package/dist/node/include/crypto/crypto_hkdf.h +61 -0
- package/dist/node/include/crypto/crypto_hmac.h +92 -0
- package/dist/node/include/crypto/crypto_keygen.h +299 -0
- package/dist/node/include/crypto/crypto_keys.h +392 -0
- package/dist/node/include/crypto/crypto_pbkdf2.h +74 -0
- package/dist/node/include/crypto/crypto_random.h +124 -0
- package/dist/node/include/crypto/crypto_rsa.h +136 -0
- package/dist/node/include/crypto/crypto_scrypt.h +85 -0
- package/dist/node/include/crypto/crypto_sig.h +165 -0
- package/dist/node/include/crypto/crypto_spkac.h +21 -0
- package/dist/node/include/crypto/crypto_timing.h +20 -0
- package/dist/node/include/crypto/crypto_tls.h +305 -0
- package/dist/node/include/crypto/crypto_util.h +725 -0
- package/dist/node/include/crypto/crypto_x509.h +140 -0
- package/dist/node/include/dataqueue/queue.h +306 -0
- package/dist/node/include/debug_utils-inl.h +278 -0
- package/dist/node/include/debug_utils.h +196 -0
- package/dist/node/include/diagnosticfilename-inl.h +33 -0
- package/dist/node/include/embedded_data.h +17 -0
- package/dist/node/include/encoding_binding.h +61 -0
- package/dist/node/include/env-inl.h +984 -0
- package/dist/node/include/env.h +1287 -0
- package/dist/node/include/env_properties.h +540 -0
- package/dist/node/include/handle_wrap.h +123 -0
- package/dist/node/include/histogram-inl.h +107 -0
- package/dist/node/include/histogram.h +279 -0
- package/dist/node/include/inspector/io_agent.h +30 -0
- package/dist/node/include/inspector/main_thread_interface.h +116 -0
- package/dist/node/include/inspector/network_agent.h +94 -0
- package/dist/node/include/inspector/network_inspector.h +45 -0
- package/dist/node/include/inspector/network_requests_buffer.h +195 -0
- package/dist/node/include/inspector/network_resource_manager.h +29 -0
- package/dist/node/include/inspector/node_json.h +24 -0
- package/dist/node/include/inspector/node_string.h +101 -0
- package/dist/node/include/inspector/protocol_helper.h +27 -0
- package/dist/node/include/inspector/runtime_agent.h +41 -0
- package/dist/node/include/inspector/target_agent.h +75 -0
- package/dist/node/include/inspector/tracing_agent.h +43 -0
- package/dist/node/include/inspector/worker_agent.h +40 -0
- package/dist/node/include/inspector/worker_inspector.h +124 -0
- package/dist/node/include/inspector_agent.h +165 -0
- package/dist/node/include/inspector_io.h +78 -0
- package/dist/node/include/inspector_profiler.h +149 -0
- package/dist/node/include/inspector_socket.h +60 -0
- package/dist/node/include/inspector_socket_server.h +110 -0
- package/dist/node/include/js_native_api.h +607 -0
- package/dist/node/include/js_native_api_types.h +226 -0
- package/dist/node/include/js_native_api_v8.h +485 -0
- package/dist/node/include/js_native_api_v8_internals.h +45 -0
- package/dist/node/include/js_stream.h +52 -0
- package/dist/node/include/json_utils.h +172 -0
- package/dist/node/include/large_pages/node_large_page.h +34 -0
- package/dist/node/include/libplatform/libplatform-export.h +29 -0
- package/dist/node/include/libplatform/libplatform.h +112 -0
- package/dist/node/include/libplatform/v8-tracing.h +333 -0
- package/dist/node/include/memory_tracker-inl.h +359 -0
- package/dist/node/include/memory_tracker.h +289 -0
- package/dist/node/include/module_wrap.h +216 -0
- package/dist/node/include/node.h +1593 -0
- package/dist/node/include/node_api.h +265 -0
- package/dist/node/include/node_api_internals.h +48 -0
- package/dist/node/include/node_api_types.h +56 -0
- package/dist/node/include/node_binding.h +161 -0
- package/dist/node/include/node_blob.h +159 -0
- package/dist/node/include/node_bob-inl.h +36 -0
- package/dist/node/include/node_bob.h +107 -0
- package/dist/node/include/node_buffer.h +92 -0
- package/dist/node/include/node_builtins.h +220 -0
- package/dist/node/include/node_config_file.h +46 -0
- package/dist/node/include/node_constants.h +82 -0
- package/dist/node/include/node_context_data.h +168 -0
- package/dist/node/include/node_contextify.h +204 -0
- package/dist/node/include/node_crypto.h +56 -0
- package/dist/node/include/node_debug.h +30 -0
- package/dist/node/include/node_dir.h +52 -0
- package/dist/node/include/node_dotenv.h +45 -0
- package/dist/node/include/node_errors.h +380 -0
- package/dist/node/include/node_exit_code.h +54 -0
- package/dist/node/include/node_external_reference.h +165 -0
- package/dist/node/include/node_file-inl.h +406 -0
- package/dist/node/include/node_file.h +537 -0
- package/dist/node/include/node_http2.h +1177 -0
- package/dist/node/include/node_http2_state.h +159 -0
- package/dist/node/include/node_http_common-inl.h +202 -0
- package/dist/node/include/node_http_common.h +535 -0
- package/dist/node/include/node_i18n.h +132 -0
- package/dist/node/include/node_internals.h +483 -0
- package/dist/node/include/node_main_instance.h +67 -0
- package/dist/node/include/node_mem-inl.h +113 -0
- package/dist/node/include/node_mem.h +45 -0
- package/dist/node/include/node_messaging.h +389 -0
- package/dist/node/include/node_metadata.h +164 -0
- package/dist/node/include/node_modules.h +91 -0
- package/dist/node/include/node_mutex.h +323 -0
- package/dist/node/include/node_object_wrap.h +132 -0
- package/dist/node/include/node_options-inl.h +490 -0
- package/dist/node/include/node_options.h +615 -0
- package/dist/node/include/node_perf.h +166 -0
- package/dist/node/include/node_perf_common.h +102 -0
- package/dist/node/include/node_platform.h +238 -0
- package/dist/node/include/node_process-inl.h +26 -0
- package/dist/node/include/node_process.h +112 -0
- package/dist/node/include/node_realm-inl.h +151 -0
- package/dist/node/include/node_realm.h +183 -0
- package/dist/node/include/node_report.h +43 -0
- package/dist/node/include/node_revert.h +82 -0
- package/dist/node/include/node_root_certs.h +3520 -0
- package/dist/node/include/node_sea.h +74 -0
- package/dist/node/include/node_shadow_realm.h +46 -0
- package/dist/node/include/node_snapshot_builder.h +57 -0
- package/dist/node/include/node_snapshotable.h +174 -0
- package/dist/node/include/node_sockaddr-inl.h +257 -0
- package/dist/node/include/node_sockaddr.h +394 -0
- package/dist/node/include/node_sqlite.h +270 -0
- package/dist/node/include/node_stat_watcher.h +73 -0
- package/dist/node/include/node_task_runner.h +92 -0
- package/dist/node/include/node_threadsafe_cow-inl.h +54 -0
- package/dist/node/include/node_threadsafe_cow.h +105 -0
- package/dist/node/include/node_union_bytes.h +81 -0
- package/dist/node/include/node_url.h +96 -0
- package/dist/node/include/node_v8.h +77 -0
- package/dist/node/include/node_v8_platform-inl.h +185 -0
- package/dist/node/include/node_version.h +110 -0
- package/dist/node/include/node_wasi.h +184 -0
- package/dist/node/include/node_wasm_web_api.h +55 -0
- package/dist/node/include/node_watchdog.h +154 -0
- package/dist/node/include/node_webstorage.h +60 -0
- package/dist/node/include/node_worker.h +158 -0
- package/dist/node/include/path.h +33 -0
- package/dist/node/include/permission/addon_permission.h +31 -0
- package/dist/node/include/permission/child_process_permission.h +31 -0
- package/dist/node/include/permission/fs_permission.h +167 -0
- package/dist/node/include/permission/inspector_permission.h +31 -0
- package/dist/node/include/permission/permission.h +138 -0
- package/dist/node/include/permission/permission_base.h +65 -0
- package/dist/node/include/permission/wasi_permission.h +31 -0
- package/dist/node/include/permission/worker_permission.h +31 -0
- package/dist/node/include/pipe_wrap.h +80 -0
- package/dist/node/include/quic/application.h +159 -0
- package/dist/node/include/quic/bindingdata.h +272 -0
- package/dist/node/include/quic/cid.h +127 -0
- package/dist/node/include/quic/data.h +148 -0
- package/dist/node/include/quic/defs.h +245 -0
- package/dist/node/include/quic/endpoint.h +458 -0
- package/dist/node/include/quic/http3.h +15 -0
- package/dist/node/include/quic/logstream.h +81 -0
- package/dist/node/include/quic/packet.h +152 -0
- package/dist/node/include/quic/preferredaddress.h +72 -0
- package/dist/node/include/quic/session.h +443 -0
- package/dist/node/include/quic/sessionticket.h +108 -0
- package/dist/node/include/quic/streams.h +232 -0
- package/dist/node/include/quic/tlscontext.h +227 -0
- package/dist/node/include/quic/tokens.h +256 -0
- package/dist/node/include/quic/transportparams.h +165 -0
- package/dist/node/include/req_wrap-inl.h +171 -0
- package/dist/node/include/req_wrap.h +77 -0
- package/dist/node/include/spawn_sync.h +243 -0
- package/dist/node/include/stream_base-inl.h +173 -0
- package/dist/node/include/stream_base.h +478 -0
- package/dist/node/include/stream_pipe.h +76 -0
- package/dist/node/include/stream_wrap.h +132 -0
- package/dist/node/include/string_bytes.h +113 -0
- package/dist/node/include/string_decoder-inl.h +31 -0
- package/dist/node/include/string_decoder.h +49 -0
- package/dist/node/include/tcp_wrap.h +105 -0
- package/dist/node/include/threadpoolwork-inl.h +70 -0
- package/dist/node/include/timer_wrap-inl.h +32 -0
- package/dist/node/include/timer_wrap.h +85 -0
- package/dist/node/include/timers.h +70 -0
- package/dist/node/include/tracing/agent.h +195 -0
- package/dist/node/include/tracing/node_trace_buffer.h +83 -0
- package/dist/node/include/tracing/node_trace_writer.h +75 -0
- package/dist/node/include/tracing/trace_event.h +722 -0
- package/dist/node/include/tracing/trace_event_common.h +1109 -0
- package/dist/node/include/tracing/traced_value.h +129 -0
- package/dist/node/include/tty_wrap.h +65 -0
- package/dist/node/include/udp_wrap.h +230 -0
- package/dist/node/include/undici_version.h +6 -0
- package/dist/node/include/util-inl.h +700 -0
- package/dist/node/include/util.h +1021 -0
- package/dist/node/include/uv/aix.h +32 -0
- package/dist/node/include/uv/bsd.h +34 -0
- package/dist/node/include/uv/darwin.h +61 -0
- package/dist/node/include/uv/errno.h +483 -0
- package/dist/node/include/uv/linux.h +34 -0
- package/dist/node/include/uv/os390.h +33 -0
- package/dist/node/include/uv/posix.h +31 -0
- package/dist/node/include/uv/sunos.h +44 -0
- package/dist/node/include/uv/threadpool.h +37 -0
- package/dist/node/include/uv/tree.h +521 -0
- package/dist/node/include/uv/unix.h +512 -0
- package/dist/node/include/uv/version.h +43 -0
- package/dist/node/include/uv/win.h +698 -0
- package/dist/node/include/uv.h +1990 -0
- package/dist/node/include/v8-array-buffer.h +525 -0
- package/dist/node/include/v8-callbacks.h +462 -0
- package/dist/node/include/v8-container.h +183 -0
- package/dist/node/include/v8-context.h +485 -0
- package/dist/node/include/v8-cppgc.h +245 -0
- package/dist/node/include/v8-data.h +80 -0
- package/dist/node/include/v8-date.h +48 -0
- package/dist/node/include/v8-debug.h +168 -0
- package/dist/node/include/v8-embedder-heap.h +82 -0
- package/dist/node/include/v8-embedder-state-scope.h +52 -0
- package/dist/node/include/v8-exception.h +223 -0
- package/dist/node/include/v8-extension.h +62 -0
- package/dist/node/include/v8-external.h +37 -0
- package/dist/node/include/v8-fast-api-calls.h +984 -0
- package/dist/node/include/v8-forward.h +82 -0
- package/dist/node/include/v8-function-callback.h +607 -0
- package/dist/node/include/v8-function.h +140 -0
- package/dist/node/include/v8-handle-base.h +137 -0
- package/dist/node/include/v8-initialization.h +289 -0
- package/dist/node/include/v8-inspector-protocol.h +13 -0
- package/dist/node/include/v8-inspector.h +419 -0
- package/dist/node/include/v8-internal.h +1397 -0
- package/dist/node/include/v8-isolate.h +1767 -0
- package/dist/node/include/v8-json.h +47 -0
- package/dist/node/include/v8-local-handle.h +758 -0
- package/dist/node/include/v8-locker.h +138 -0
- package/dist/node/include/v8-maybe.h +160 -0
- package/dist/node/include/v8-memory-span.h +198 -0
- package/dist/node/include/v8-message.h +233 -0
- package/dist/node/include/v8-metrics.h +264 -0
- package/dist/node/include/v8-microtask-queue.h +157 -0
- package/dist/node/include/v8-microtask.h +28 -0
- package/dist/node/include/v8-object.h +824 -0
- package/dist/node/include/v8-persistent-handle.h +582 -0
- package/dist/node/include/v8-platform.h +1358 -0
- package/dist/node/include/v8-primitive-object.h +118 -0
- package/dist/node/include/v8-primitive.h +877 -0
- package/dist/node/include/v8-profiler.h +1302 -0
- package/dist/node/include/v8-promise.h +174 -0
- package/dist/node/include/v8-proxy.h +50 -0
- package/dist/node/include/v8-regexp.h +106 -0
- package/dist/node/include/v8-script.h +904 -0
- package/dist/node/include/v8-snapshot.h +266 -0
- package/dist/node/include/v8-source-location.h +92 -0
- package/dist/node/include/v8-statistics.h +238 -0
- package/dist/node/include/v8-template.h +1297 -0
- package/dist/node/include/v8-traced-handle.h +432 -0
- package/dist/node/include/v8-typed-array.h +390 -0
- package/dist/node/include/v8-unwinder-state.h +31 -0
- package/dist/node/include/v8-unwinder.h +132 -0
- package/dist/node/include/v8-util.h +665 -0
- package/dist/node/include/v8-value-serializer-version.h +24 -0
- package/dist/node/include/v8-value-serializer.h +316 -0
- package/dist/node/include/v8-value.h +655 -0
- package/dist/node/include/v8-version-string.h +38 -0
- package/dist/node/include/v8-version.h +20 -0
- package/dist/node/include/v8-wasm-trap-handler-posix.h +31 -0
- package/dist/node/include/v8-wasm-trap-handler-win.h +28 -0
- package/dist/node/include/v8-wasm.h +201 -0
- package/dist/node/include/v8-weak-callback-info.h +80 -0
- package/dist/node/include/v8.h +88 -0
- package/dist/node/include/v8config.h +981 -0
- package/dist/node/include/zlib_version.h +6 -0
- package/dist/node/libnode.dll +0 -0
- package/dist/node/libnode.lib +0 -0
- package/dist/node/libnodebuildinfo.json +10 -0
- package/dist/node/link_node.lib +0 -0
- package/dist/node/link_node.node +0 -0
- package/index.js +5 -0
- package/libnode.release.json +8 -0
- package/package.json +29 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* Copyright libuv project contributors. All rights reserved.
|
|
2
|
+
*
|
|
3
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
* of this software and associated documentation files (the "Software"), to
|
|
5
|
+
* deal in the Software without restriction, including without limitation the
|
|
6
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
7
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
* furnished to do so, subject to the following conditions:
|
|
9
|
+
*
|
|
10
|
+
* The above copyright notice and this permission notice shall be included in
|
|
11
|
+
* all copies or substantial portions of the Software.
|
|
12
|
+
*
|
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
18
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
19
|
+
* IN THE SOFTWARE.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
#ifndef UV_POSIX_H
|
|
23
|
+
#define UV_POSIX_H
|
|
24
|
+
|
|
25
|
+
#define UV_PLATFORM_LOOP_FIELDS \
|
|
26
|
+
struct pollfd* poll_fds; \
|
|
27
|
+
size_t poll_fds_used; \
|
|
28
|
+
size_t poll_fds_size; \
|
|
29
|
+
unsigned char poll_fds_iterating; \
|
|
30
|
+
|
|
31
|
+
#endif /* UV_POSIX_H */
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
|
2
|
+
*
|
|
3
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
* of this software and associated documentation files (the "Software"), to
|
|
5
|
+
* deal in the Software without restriction, including without limitation the
|
|
6
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
7
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
* furnished to do so, subject to the following conditions:
|
|
9
|
+
*
|
|
10
|
+
* The above copyright notice and this permission notice shall be included in
|
|
11
|
+
* all copies or substantial portions of the Software.
|
|
12
|
+
*
|
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
18
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
19
|
+
* IN THE SOFTWARE.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
#ifndef UV_SUNOS_H
|
|
23
|
+
#define UV_SUNOS_H
|
|
24
|
+
|
|
25
|
+
#include <sys/port.h>
|
|
26
|
+
#include <port.h>
|
|
27
|
+
|
|
28
|
+
/* For the sake of convenience and reduced #ifdef-ery in src/unix/sunos.c,
|
|
29
|
+
* add the fs_event fields even when this version of SunOS doesn't support
|
|
30
|
+
* file watching.
|
|
31
|
+
*/
|
|
32
|
+
#define UV_PLATFORM_LOOP_FIELDS \
|
|
33
|
+
uv__io_t fs_event_watcher; \
|
|
34
|
+
int fs_fd; \
|
|
35
|
+
|
|
36
|
+
#if defined(PORT_SOURCE_FILE)
|
|
37
|
+
|
|
38
|
+
# define UV_PLATFORM_FS_EVENT_FIELDS \
|
|
39
|
+
file_obj_t fo; \
|
|
40
|
+
int fd; \
|
|
41
|
+
|
|
42
|
+
#endif /* defined(PORT_SOURCE_FILE) */
|
|
43
|
+
|
|
44
|
+
#endif /* UV_SUNOS_H */
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
|
2
|
+
*
|
|
3
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
* of this software and associated documentation files (the "Software"), to
|
|
5
|
+
* deal in the Software without restriction, including without limitation the
|
|
6
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
7
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
* furnished to do so, subject to the following conditions:
|
|
9
|
+
*
|
|
10
|
+
* The above copyright notice and this permission notice shall be included in
|
|
11
|
+
* all copies or substantial portions of the Software.
|
|
12
|
+
*
|
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
18
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
19
|
+
* IN THE SOFTWARE.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/*
|
|
23
|
+
* This file is private to libuv. It provides common functionality to both
|
|
24
|
+
* Windows and Unix backends.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
#ifndef UV_THREADPOOL_H_
|
|
28
|
+
#define UV_THREADPOOL_H_
|
|
29
|
+
|
|
30
|
+
struct uv__work {
|
|
31
|
+
void (*work)(struct uv__work *w);
|
|
32
|
+
void (*done)(struct uv__work *w, int status);
|
|
33
|
+
struct uv_loop_s* loop;
|
|
34
|
+
struct uv__queue wq;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
#endif /* UV_THREADPOOL_H_ */
|
|
@@ -0,0 +1,521 @@
|
|
|
1
|
+
/*-
|
|
2
|
+
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
|
6
|
+
* modification, are permitted provided that the following conditions
|
|
7
|
+
* are met:
|
|
8
|
+
* 1. Redistributions of source code must retain the above copyright
|
|
9
|
+
* notice, this list of conditions and the following disclaimer.
|
|
10
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
12
|
+
* documentation and/or other materials provided with the distribution.
|
|
13
|
+
*
|
|
14
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
15
|
+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
16
|
+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
17
|
+
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
18
|
+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
19
|
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
20
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
21
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
22
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
23
|
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
#ifndef UV_TREE_H_
|
|
27
|
+
#define UV_TREE_H_
|
|
28
|
+
|
|
29
|
+
#ifndef UV__UNUSED
|
|
30
|
+
# if __GNUC__
|
|
31
|
+
# define UV__UNUSED __attribute__((unused))
|
|
32
|
+
# else
|
|
33
|
+
# define UV__UNUSED
|
|
34
|
+
# endif
|
|
35
|
+
#endif
|
|
36
|
+
|
|
37
|
+
/*
|
|
38
|
+
* This file defines data structures for red-black trees.
|
|
39
|
+
* A red-black tree is a binary search tree with the node color as an
|
|
40
|
+
* extra attribute. It fulfills a set of conditions:
|
|
41
|
+
* - every search path from the root to a leaf consists of the
|
|
42
|
+
* same number of black nodes,
|
|
43
|
+
* - each red node (except for the root) has a black parent,
|
|
44
|
+
* - each leaf node is black.
|
|
45
|
+
*
|
|
46
|
+
* Every operation on a red-black tree is bounded as O(lg n).
|
|
47
|
+
* The maximum height of a red-black tree is 2lg (n+1).
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
/* Macros that define a red-black tree */
|
|
51
|
+
#define RB_HEAD(name, type) \
|
|
52
|
+
struct name { \
|
|
53
|
+
struct type *rbh_root; /* root of the tree */ \
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
#define RB_INITIALIZER(root) \
|
|
57
|
+
{ NULL }
|
|
58
|
+
|
|
59
|
+
#define RB_INIT(root) do { \
|
|
60
|
+
(root)->rbh_root = NULL; \
|
|
61
|
+
} while (/*CONSTCOND*/ 0)
|
|
62
|
+
|
|
63
|
+
#define RB_BLACK 0
|
|
64
|
+
#define RB_RED 1
|
|
65
|
+
#define RB_ENTRY(type) \
|
|
66
|
+
struct { \
|
|
67
|
+
struct type *rbe_left; /* left element */ \
|
|
68
|
+
struct type *rbe_right; /* right element */ \
|
|
69
|
+
struct type *rbe_parent; /* parent element */ \
|
|
70
|
+
int rbe_color; /* node color */ \
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
#define RB_LEFT(elm, field) (elm)->field.rbe_left
|
|
74
|
+
#define RB_RIGHT(elm, field) (elm)->field.rbe_right
|
|
75
|
+
#define RB_PARENT(elm, field) (elm)->field.rbe_parent
|
|
76
|
+
#define RB_COLOR(elm, field) (elm)->field.rbe_color
|
|
77
|
+
#define RB_ROOT(head) (head)->rbh_root
|
|
78
|
+
#define RB_EMPTY(head) (RB_ROOT(head) == NULL)
|
|
79
|
+
|
|
80
|
+
#define RB_SET(elm, parent, field) do { \
|
|
81
|
+
RB_PARENT(elm, field) = parent; \
|
|
82
|
+
RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL; \
|
|
83
|
+
RB_COLOR(elm, field) = RB_RED; \
|
|
84
|
+
} while (/*CONSTCOND*/ 0)
|
|
85
|
+
|
|
86
|
+
#define RB_SET_BLACKRED(black, red, field) do { \
|
|
87
|
+
RB_COLOR(black, field) = RB_BLACK; \
|
|
88
|
+
RB_COLOR(red, field) = RB_RED; \
|
|
89
|
+
} while (/*CONSTCOND*/ 0)
|
|
90
|
+
|
|
91
|
+
#ifndef RB_AUGMENT
|
|
92
|
+
#define RB_AUGMENT(x) do {} while (0)
|
|
93
|
+
#endif
|
|
94
|
+
|
|
95
|
+
#define RB_ROTATE_LEFT(head, elm, tmp, field) do { \
|
|
96
|
+
(tmp) = RB_RIGHT(elm, field); \
|
|
97
|
+
if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field)) != NULL) { \
|
|
98
|
+
RB_PARENT(RB_LEFT(tmp, field), field) = (elm); \
|
|
99
|
+
} \
|
|
100
|
+
RB_AUGMENT(elm); \
|
|
101
|
+
if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \
|
|
102
|
+
if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \
|
|
103
|
+
RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \
|
|
104
|
+
else \
|
|
105
|
+
RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \
|
|
106
|
+
} else \
|
|
107
|
+
(head)->rbh_root = (tmp); \
|
|
108
|
+
RB_LEFT(tmp, field) = (elm); \
|
|
109
|
+
RB_PARENT(elm, field) = (tmp); \
|
|
110
|
+
RB_AUGMENT(tmp); \
|
|
111
|
+
if ((RB_PARENT(tmp, field))) \
|
|
112
|
+
RB_AUGMENT(RB_PARENT(tmp, field)); \
|
|
113
|
+
} while (/*CONSTCOND*/ 0)
|
|
114
|
+
|
|
115
|
+
#define RB_ROTATE_RIGHT(head, elm, tmp, field) do { \
|
|
116
|
+
(tmp) = RB_LEFT(elm, field); \
|
|
117
|
+
if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field)) != NULL) { \
|
|
118
|
+
RB_PARENT(RB_RIGHT(tmp, field), field) = (elm); \
|
|
119
|
+
} \
|
|
120
|
+
RB_AUGMENT(elm); \
|
|
121
|
+
if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \
|
|
122
|
+
if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \
|
|
123
|
+
RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \
|
|
124
|
+
else \
|
|
125
|
+
RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \
|
|
126
|
+
} else \
|
|
127
|
+
(head)->rbh_root = (tmp); \
|
|
128
|
+
RB_RIGHT(tmp, field) = (elm); \
|
|
129
|
+
RB_PARENT(elm, field) = (tmp); \
|
|
130
|
+
RB_AUGMENT(tmp); \
|
|
131
|
+
if ((RB_PARENT(tmp, field))) \
|
|
132
|
+
RB_AUGMENT(RB_PARENT(tmp, field)); \
|
|
133
|
+
} while (/*CONSTCOND*/ 0)
|
|
134
|
+
|
|
135
|
+
/* Generates prototypes and inline functions */
|
|
136
|
+
#define RB_PROTOTYPE(name, type, field, cmp) \
|
|
137
|
+
RB_PROTOTYPE_INTERNAL(name, type, field, cmp,)
|
|
138
|
+
#define RB_PROTOTYPE_STATIC(name, type, field, cmp) \
|
|
139
|
+
RB_PROTOTYPE_INTERNAL(name, type, field, cmp, UV__UNUSED static)
|
|
140
|
+
#define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr) \
|
|
141
|
+
attr void name##_RB_INSERT_COLOR(struct name *, struct type *); \
|
|
142
|
+
attr void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *);\
|
|
143
|
+
attr struct type *name##_RB_REMOVE(struct name *, struct type *); \
|
|
144
|
+
attr struct type *name##_RB_INSERT(struct name *, struct type *); \
|
|
145
|
+
attr struct type *name##_RB_FIND(struct name *, struct type *); \
|
|
146
|
+
attr struct type *name##_RB_NFIND(struct name *, struct type *); \
|
|
147
|
+
attr struct type *name##_RB_NEXT(struct type *); \
|
|
148
|
+
attr struct type *name##_RB_PREV(struct type *); \
|
|
149
|
+
attr struct type *name##_RB_MINMAX(struct name *, int); \
|
|
150
|
+
\
|
|
151
|
+
|
|
152
|
+
/* Main rb operation.
|
|
153
|
+
* Moves node close to the key of elm to top
|
|
154
|
+
*/
|
|
155
|
+
#define RB_GENERATE(name, type, field, cmp) \
|
|
156
|
+
RB_GENERATE_INTERNAL(name, type, field, cmp,)
|
|
157
|
+
#define RB_GENERATE_STATIC(name, type, field, cmp) \
|
|
158
|
+
RB_GENERATE_INTERNAL(name, type, field, cmp, UV__UNUSED static)
|
|
159
|
+
#define RB_GENERATE_INTERNAL(name, type, field, cmp, attr) \
|
|
160
|
+
attr void \
|
|
161
|
+
name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \
|
|
162
|
+
{ \
|
|
163
|
+
struct type *parent, *gparent, *tmp; \
|
|
164
|
+
while ((parent = RB_PARENT(elm, field)) != NULL && \
|
|
165
|
+
RB_COLOR(parent, field) == RB_RED) { \
|
|
166
|
+
gparent = RB_PARENT(parent, field); \
|
|
167
|
+
if (parent == RB_LEFT(gparent, field)) { \
|
|
168
|
+
tmp = RB_RIGHT(gparent, field); \
|
|
169
|
+
if (tmp && RB_COLOR(tmp, field) == RB_RED) { \
|
|
170
|
+
RB_COLOR(tmp, field) = RB_BLACK; \
|
|
171
|
+
RB_SET_BLACKRED(parent, gparent, field); \
|
|
172
|
+
elm = gparent; \
|
|
173
|
+
continue; \
|
|
174
|
+
} \
|
|
175
|
+
if (RB_RIGHT(parent, field) == elm) { \
|
|
176
|
+
RB_ROTATE_LEFT(head, parent, tmp, field); \
|
|
177
|
+
tmp = parent; \
|
|
178
|
+
parent = elm; \
|
|
179
|
+
elm = tmp; \
|
|
180
|
+
} \
|
|
181
|
+
RB_SET_BLACKRED(parent, gparent, field); \
|
|
182
|
+
RB_ROTATE_RIGHT(head, gparent, tmp, field); \
|
|
183
|
+
} else { \
|
|
184
|
+
tmp = RB_LEFT(gparent, field); \
|
|
185
|
+
if (tmp && RB_COLOR(tmp, field) == RB_RED) { \
|
|
186
|
+
RB_COLOR(tmp, field) = RB_BLACK; \
|
|
187
|
+
RB_SET_BLACKRED(parent, gparent, field); \
|
|
188
|
+
elm = gparent; \
|
|
189
|
+
continue; \
|
|
190
|
+
} \
|
|
191
|
+
if (RB_LEFT(parent, field) == elm) { \
|
|
192
|
+
RB_ROTATE_RIGHT(head, parent, tmp, field); \
|
|
193
|
+
tmp = parent; \
|
|
194
|
+
parent = elm; \
|
|
195
|
+
elm = tmp; \
|
|
196
|
+
} \
|
|
197
|
+
RB_SET_BLACKRED(parent, gparent, field); \
|
|
198
|
+
RB_ROTATE_LEFT(head, gparent, tmp, field); \
|
|
199
|
+
} \
|
|
200
|
+
} \
|
|
201
|
+
RB_COLOR(head->rbh_root, field) = RB_BLACK; \
|
|
202
|
+
} \
|
|
203
|
+
\
|
|
204
|
+
attr void \
|
|
205
|
+
name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, \
|
|
206
|
+
struct type *elm) \
|
|
207
|
+
{ \
|
|
208
|
+
struct type *tmp; \
|
|
209
|
+
while ((elm == NULL || RB_COLOR(elm, field) == RB_BLACK) && \
|
|
210
|
+
elm != RB_ROOT(head)) { \
|
|
211
|
+
if (RB_LEFT(parent, field) == elm) { \
|
|
212
|
+
tmp = RB_RIGHT(parent, field); \
|
|
213
|
+
if (RB_COLOR(tmp, field) == RB_RED) { \
|
|
214
|
+
RB_SET_BLACKRED(tmp, parent, field); \
|
|
215
|
+
RB_ROTATE_LEFT(head, parent, tmp, field); \
|
|
216
|
+
tmp = RB_RIGHT(parent, field); \
|
|
217
|
+
} \
|
|
218
|
+
if ((RB_LEFT(tmp, field) == NULL || \
|
|
219
|
+
RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) && \
|
|
220
|
+
(RB_RIGHT(tmp, field) == NULL || \
|
|
221
|
+
RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) { \
|
|
222
|
+
RB_COLOR(tmp, field) = RB_RED; \
|
|
223
|
+
elm = parent; \
|
|
224
|
+
parent = RB_PARENT(elm, field); \
|
|
225
|
+
} else { \
|
|
226
|
+
if (RB_RIGHT(tmp, field) == NULL || \
|
|
227
|
+
RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK) { \
|
|
228
|
+
struct type *oleft; \
|
|
229
|
+
if ((oleft = RB_LEFT(tmp, field)) \
|
|
230
|
+
!= NULL) \
|
|
231
|
+
RB_COLOR(oleft, field) = RB_BLACK; \
|
|
232
|
+
RB_COLOR(tmp, field) = RB_RED; \
|
|
233
|
+
RB_ROTATE_RIGHT(head, tmp, oleft, field); \
|
|
234
|
+
tmp = RB_RIGHT(parent, field); \
|
|
235
|
+
} \
|
|
236
|
+
RB_COLOR(tmp, field) = RB_COLOR(parent, field); \
|
|
237
|
+
RB_COLOR(parent, field) = RB_BLACK; \
|
|
238
|
+
if (RB_RIGHT(tmp, field)) \
|
|
239
|
+
RB_COLOR(RB_RIGHT(tmp, field), field) = RB_BLACK; \
|
|
240
|
+
RB_ROTATE_LEFT(head, parent, tmp, field); \
|
|
241
|
+
elm = RB_ROOT(head); \
|
|
242
|
+
break; \
|
|
243
|
+
} \
|
|
244
|
+
} else { \
|
|
245
|
+
tmp = RB_LEFT(parent, field); \
|
|
246
|
+
if (RB_COLOR(tmp, field) == RB_RED) { \
|
|
247
|
+
RB_SET_BLACKRED(tmp, parent, field); \
|
|
248
|
+
RB_ROTATE_RIGHT(head, parent, tmp, field); \
|
|
249
|
+
tmp = RB_LEFT(parent, field); \
|
|
250
|
+
} \
|
|
251
|
+
if ((RB_LEFT(tmp, field) == NULL || \
|
|
252
|
+
RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) && \
|
|
253
|
+
(RB_RIGHT(tmp, field) == NULL || \
|
|
254
|
+
RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) { \
|
|
255
|
+
RB_COLOR(tmp, field) = RB_RED; \
|
|
256
|
+
elm = parent; \
|
|
257
|
+
parent = RB_PARENT(elm, field); \
|
|
258
|
+
} else { \
|
|
259
|
+
if (RB_LEFT(tmp, field) == NULL || \
|
|
260
|
+
RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) { \
|
|
261
|
+
struct type *oright; \
|
|
262
|
+
if ((oright = RB_RIGHT(tmp, field)) \
|
|
263
|
+
!= NULL) \
|
|
264
|
+
RB_COLOR(oright, field) = RB_BLACK; \
|
|
265
|
+
RB_COLOR(tmp, field) = RB_RED; \
|
|
266
|
+
RB_ROTATE_LEFT(head, tmp, oright, field); \
|
|
267
|
+
tmp = RB_LEFT(parent, field); \
|
|
268
|
+
} \
|
|
269
|
+
RB_COLOR(tmp, field) = RB_COLOR(parent, field); \
|
|
270
|
+
RB_COLOR(parent, field) = RB_BLACK; \
|
|
271
|
+
if (RB_LEFT(tmp, field)) \
|
|
272
|
+
RB_COLOR(RB_LEFT(tmp, field), field) = RB_BLACK; \
|
|
273
|
+
RB_ROTATE_RIGHT(head, parent, tmp, field); \
|
|
274
|
+
elm = RB_ROOT(head); \
|
|
275
|
+
break; \
|
|
276
|
+
} \
|
|
277
|
+
} \
|
|
278
|
+
} \
|
|
279
|
+
if (elm) \
|
|
280
|
+
RB_COLOR(elm, field) = RB_BLACK; \
|
|
281
|
+
} \
|
|
282
|
+
\
|
|
283
|
+
attr struct type * \
|
|
284
|
+
name##_RB_REMOVE(struct name *head, struct type *elm) \
|
|
285
|
+
{ \
|
|
286
|
+
struct type *child, *parent, *old = elm; \
|
|
287
|
+
int color; \
|
|
288
|
+
if (RB_LEFT(elm, field) == NULL) \
|
|
289
|
+
child = RB_RIGHT(elm, field); \
|
|
290
|
+
else if (RB_RIGHT(elm, field) == NULL) \
|
|
291
|
+
child = RB_LEFT(elm, field); \
|
|
292
|
+
else { \
|
|
293
|
+
struct type *left; \
|
|
294
|
+
elm = RB_RIGHT(elm, field); \
|
|
295
|
+
while ((left = RB_LEFT(elm, field)) != NULL) \
|
|
296
|
+
elm = left; \
|
|
297
|
+
child = RB_RIGHT(elm, field); \
|
|
298
|
+
parent = RB_PARENT(elm, field); \
|
|
299
|
+
color = RB_COLOR(elm, field); \
|
|
300
|
+
if (child) \
|
|
301
|
+
RB_PARENT(child, field) = parent; \
|
|
302
|
+
if (parent) { \
|
|
303
|
+
if (RB_LEFT(parent, field) == elm) \
|
|
304
|
+
RB_LEFT(parent, field) = child; \
|
|
305
|
+
else \
|
|
306
|
+
RB_RIGHT(parent, field) = child; \
|
|
307
|
+
RB_AUGMENT(parent); \
|
|
308
|
+
} else \
|
|
309
|
+
RB_ROOT(head) = child; \
|
|
310
|
+
if (RB_PARENT(elm, field) == old) \
|
|
311
|
+
parent = elm; \
|
|
312
|
+
(elm)->field = (old)->field; \
|
|
313
|
+
if (RB_PARENT(old, field)) { \
|
|
314
|
+
if (RB_LEFT(RB_PARENT(old, field), field) == old) \
|
|
315
|
+
RB_LEFT(RB_PARENT(old, field), field) = elm; \
|
|
316
|
+
else \
|
|
317
|
+
RB_RIGHT(RB_PARENT(old, field), field) = elm; \
|
|
318
|
+
RB_AUGMENT(RB_PARENT(old, field)); \
|
|
319
|
+
} else \
|
|
320
|
+
RB_ROOT(head) = elm; \
|
|
321
|
+
RB_PARENT(RB_LEFT(old, field), field) = elm; \
|
|
322
|
+
if (RB_RIGHT(old, field)) \
|
|
323
|
+
RB_PARENT(RB_RIGHT(old, field), field) = elm; \
|
|
324
|
+
if (parent) { \
|
|
325
|
+
left = parent; \
|
|
326
|
+
do { \
|
|
327
|
+
RB_AUGMENT(left); \
|
|
328
|
+
} while ((left = RB_PARENT(left, field)) != NULL); \
|
|
329
|
+
} \
|
|
330
|
+
goto color; \
|
|
331
|
+
} \
|
|
332
|
+
parent = RB_PARENT(elm, field); \
|
|
333
|
+
color = RB_COLOR(elm, field); \
|
|
334
|
+
if (child) \
|
|
335
|
+
RB_PARENT(child, field) = parent; \
|
|
336
|
+
if (parent) { \
|
|
337
|
+
if (RB_LEFT(parent, field) == elm) \
|
|
338
|
+
RB_LEFT(parent, field) = child; \
|
|
339
|
+
else \
|
|
340
|
+
RB_RIGHT(parent, field) = child; \
|
|
341
|
+
RB_AUGMENT(parent); \
|
|
342
|
+
} else \
|
|
343
|
+
RB_ROOT(head) = child; \
|
|
344
|
+
color: \
|
|
345
|
+
if (color == RB_BLACK) \
|
|
346
|
+
name##_RB_REMOVE_COLOR(head, parent, child); \
|
|
347
|
+
return (old); \
|
|
348
|
+
} \
|
|
349
|
+
\
|
|
350
|
+
/* Inserts a node into the RB tree */ \
|
|
351
|
+
attr struct type * \
|
|
352
|
+
name##_RB_INSERT(struct name *head, struct type *elm) \
|
|
353
|
+
{ \
|
|
354
|
+
struct type *tmp; \
|
|
355
|
+
struct type *parent = NULL; \
|
|
356
|
+
int comp = 0; \
|
|
357
|
+
tmp = RB_ROOT(head); \
|
|
358
|
+
while (tmp) { \
|
|
359
|
+
parent = tmp; \
|
|
360
|
+
comp = (cmp)(elm, parent); \
|
|
361
|
+
if (comp < 0) \
|
|
362
|
+
tmp = RB_LEFT(tmp, field); \
|
|
363
|
+
else if (comp > 0) \
|
|
364
|
+
tmp = RB_RIGHT(tmp, field); \
|
|
365
|
+
else \
|
|
366
|
+
return (tmp); \
|
|
367
|
+
} \
|
|
368
|
+
RB_SET(elm, parent, field); \
|
|
369
|
+
if (parent != NULL) { \
|
|
370
|
+
if (comp < 0) \
|
|
371
|
+
RB_LEFT(parent, field) = elm; \
|
|
372
|
+
else \
|
|
373
|
+
RB_RIGHT(parent, field) = elm; \
|
|
374
|
+
RB_AUGMENT(parent); \
|
|
375
|
+
} else \
|
|
376
|
+
RB_ROOT(head) = elm; \
|
|
377
|
+
name##_RB_INSERT_COLOR(head, elm); \
|
|
378
|
+
return (NULL); \
|
|
379
|
+
} \
|
|
380
|
+
\
|
|
381
|
+
/* Finds the node with the same key as elm */ \
|
|
382
|
+
attr struct type * \
|
|
383
|
+
name##_RB_FIND(struct name *head, struct type *elm) \
|
|
384
|
+
{ \
|
|
385
|
+
struct type *tmp = RB_ROOT(head); \
|
|
386
|
+
int comp; \
|
|
387
|
+
while (tmp) { \
|
|
388
|
+
comp = cmp(elm, tmp); \
|
|
389
|
+
if (comp < 0) \
|
|
390
|
+
tmp = RB_LEFT(tmp, field); \
|
|
391
|
+
else if (comp > 0) \
|
|
392
|
+
tmp = RB_RIGHT(tmp, field); \
|
|
393
|
+
else \
|
|
394
|
+
return (tmp); \
|
|
395
|
+
} \
|
|
396
|
+
return (NULL); \
|
|
397
|
+
} \
|
|
398
|
+
\
|
|
399
|
+
/* Finds the first node greater than or equal to the search key */ \
|
|
400
|
+
attr struct type * \
|
|
401
|
+
name##_RB_NFIND(struct name *head, struct type *elm) \
|
|
402
|
+
{ \
|
|
403
|
+
struct type *tmp = RB_ROOT(head); \
|
|
404
|
+
struct type *res = NULL; \
|
|
405
|
+
int comp; \
|
|
406
|
+
while (tmp) { \
|
|
407
|
+
comp = cmp(elm, tmp); \
|
|
408
|
+
if (comp < 0) { \
|
|
409
|
+
res = tmp; \
|
|
410
|
+
tmp = RB_LEFT(tmp, field); \
|
|
411
|
+
} \
|
|
412
|
+
else if (comp > 0) \
|
|
413
|
+
tmp = RB_RIGHT(tmp, field); \
|
|
414
|
+
else \
|
|
415
|
+
return (tmp); \
|
|
416
|
+
} \
|
|
417
|
+
return (res); \
|
|
418
|
+
} \
|
|
419
|
+
\
|
|
420
|
+
/* ARGSUSED */ \
|
|
421
|
+
attr struct type * \
|
|
422
|
+
name##_RB_NEXT(struct type *elm) \
|
|
423
|
+
{ \
|
|
424
|
+
if (RB_RIGHT(elm, field)) { \
|
|
425
|
+
elm = RB_RIGHT(elm, field); \
|
|
426
|
+
while (RB_LEFT(elm, field)) \
|
|
427
|
+
elm = RB_LEFT(elm, field); \
|
|
428
|
+
} else { \
|
|
429
|
+
if (RB_PARENT(elm, field) && \
|
|
430
|
+
(elm == RB_LEFT(RB_PARENT(elm, field), field))) \
|
|
431
|
+
elm = RB_PARENT(elm, field); \
|
|
432
|
+
else { \
|
|
433
|
+
while (RB_PARENT(elm, field) && \
|
|
434
|
+
(elm == RB_RIGHT(RB_PARENT(elm, field), field))) \
|
|
435
|
+
elm = RB_PARENT(elm, field); \
|
|
436
|
+
elm = RB_PARENT(elm, field); \
|
|
437
|
+
} \
|
|
438
|
+
} \
|
|
439
|
+
return (elm); \
|
|
440
|
+
} \
|
|
441
|
+
\
|
|
442
|
+
/* ARGSUSED */ \
|
|
443
|
+
attr struct type * \
|
|
444
|
+
name##_RB_PREV(struct type *elm) \
|
|
445
|
+
{ \
|
|
446
|
+
if (RB_LEFT(elm, field)) { \
|
|
447
|
+
elm = RB_LEFT(elm, field); \
|
|
448
|
+
while (RB_RIGHT(elm, field)) \
|
|
449
|
+
elm = RB_RIGHT(elm, field); \
|
|
450
|
+
} else { \
|
|
451
|
+
if (RB_PARENT(elm, field) && \
|
|
452
|
+
(elm == RB_RIGHT(RB_PARENT(elm, field), field))) \
|
|
453
|
+
elm = RB_PARENT(elm, field); \
|
|
454
|
+
else { \
|
|
455
|
+
while (RB_PARENT(elm, field) && \
|
|
456
|
+
(elm == RB_LEFT(RB_PARENT(elm, field), field))) \
|
|
457
|
+
elm = RB_PARENT(elm, field); \
|
|
458
|
+
elm = RB_PARENT(elm, field); \
|
|
459
|
+
} \
|
|
460
|
+
} \
|
|
461
|
+
return (elm); \
|
|
462
|
+
} \
|
|
463
|
+
\
|
|
464
|
+
attr struct type * \
|
|
465
|
+
name##_RB_MINMAX(struct name *head, int val) \
|
|
466
|
+
{ \
|
|
467
|
+
struct type *tmp = RB_ROOT(head); \
|
|
468
|
+
struct type *parent = NULL; \
|
|
469
|
+
while (tmp) { \
|
|
470
|
+
parent = tmp; \
|
|
471
|
+
if (val < 0) \
|
|
472
|
+
tmp = RB_LEFT(tmp, field); \
|
|
473
|
+
else \
|
|
474
|
+
tmp = RB_RIGHT(tmp, field); \
|
|
475
|
+
} \
|
|
476
|
+
return (parent); \
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
#define RB_NEGINF -1
|
|
480
|
+
#define RB_INF 1
|
|
481
|
+
|
|
482
|
+
#define RB_INSERT(name, x, y) name##_RB_INSERT(x, y)
|
|
483
|
+
#define RB_REMOVE(name, x, y) name##_RB_REMOVE(x, y)
|
|
484
|
+
#define RB_FIND(name, x, y) name##_RB_FIND(x, y)
|
|
485
|
+
#define RB_NFIND(name, x, y) name##_RB_NFIND(x, y)
|
|
486
|
+
#define RB_NEXT(name, x) name##_RB_NEXT(x)
|
|
487
|
+
#define RB_PREV(name, x) name##_RB_PREV(x)
|
|
488
|
+
#define RB_MIN(name, x) name##_RB_MINMAX(x, RB_NEGINF)
|
|
489
|
+
#define RB_MAX(name, x) name##_RB_MINMAX(x, RB_INF)
|
|
490
|
+
|
|
491
|
+
#define RB_FOREACH(x, name, head) \
|
|
492
|
+
for ((x) = RB_MIN(name, head); \
|
|
493
|
+
(x) != NULL; \
|
|
494
|
+
(x) = name##_RB_NEXT(x))
|
|
495
|
+
|
|
496
|
+
#define RB_FOREACH_FROM(x, name, y) \
|
|
497
|
+
for ((x) = (y); \
|
|
498
|
+
((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \
|
|
499
|
+
(x) = (y))
|
|
500
|
+
|
|
501
|
+
#define RB_FOREACH_SAFE(x, name, head, y) \
|
|
502
|
+
for ((x) = RB_MIN(name, head); \
|
|
503
|
+
((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \
|
|
504
|
+
(x) = (y))
|
|
505
|
+
|
|
506
|
+
#define RB_FOREACH_REVERSE(x, name, head) \
|
|
507
|
+
for ((x) = RB_MAX(name, head); \
|
|
508
|
+
(x) != NULL; \
|
|
509
|
+
(x) = name##_RB_PREV(x))
|
|
510
|
+
|
|
511
|
+
#define RB_FOREACH_REVERSE_FROM(x, name, y) \
|
|
512
|
+
for ((x) = (y); \
|
|
513
|
+
((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \
|
|
514
|
+
(x) = (y))
|
|
515
|
+
|
|
516
|
+
#define RB_FOREACH_REVERSE_SAFE(x, name, head, y) \
|
|
517
|
+
for ((x) = RB_MAX(name, head); \
|
|
518
|
+
((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \
|
|
519
|
+
(x) = (y))
|
|
520
|
+
|
|
521
|
+
#endif /* UV_TREE_H_ */
|