From 5c3e2192c49c5ecb3d74226d3b9a11a464cb109d Mon Sep 17 00:00:00 2001
From: lyblsgo <lyblsgo@163.com>
Date: 星期二, 25 四月 2023 14:48:31 +0800
Subject: [PATCH] add glog && tclap; rm some deps
---
funasr/runtime/onnxruntime/include/tclap/ArgException.h | 213
funasr/runtime/onnxruntime/include/tclap/MultiSwitchArg.h | 217
funasr/runtime/onnxruntime/include/tclap/UnlabeledMultiArg.h | 304
funasr/runtime/onnxruntime/third_party/glog/BUILD.bazel | 22
funasr/runtime/onnxruntime/include/tclap/Constraint.h | 78
funasr/runtime/onnxruntime/third_party/glog/CMakeLists.txt | 941 ++
funasr/runtime/onnxruntime/third_party/glog/src/googletest.h | 654 +
funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_windows-inl.h | 51
funasr/runtime/onnxruntime/third_party/glog/src/cleanup_with_relative_prefix_unittest.cc | 97
funasr/runtime/onnxruntime/third_party/glog/src/logging_unittest.out | 150
funasr/runtime/onnxruntime/src/tokenizer.h | 2
funasr/runtime/onnxruntime/third_party/glog/.gitattributes | 1
funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_generic-inl.h | 64
funasr/runtime/onnxruntime/third_party/glog/.github/workflows/cifuzz.yml | 26
funasr/runtime/onnxruntime/third_party/glog/cmake/RunCleanerTest3.cmake | 28
funasr/runtime/onnxruntime/src/precomp.h | 5
funasr/runtime/onnxruntime/third_party/glog/src/utilities.h | 217
funasr/runtime/onnxruntime/third_party/glog/.github/workflows/windows.yml | 224
funasr/runtime/onnxruntime/third_party/glog/ChangeLog | 109
funasr/runtime/onnxruntime/third_party/glog/src/demangle_unittest.txt | 145
funasr/runtime/onnxruntime/third_party/glog/src/logging_unittest.err | 308
funasr/runtime/onnxruntime/include/tclap/IgnoreRestVisitor.h | 54
funasr/runtime/onnxruntime/third_party/glog/src/config.h.cmake.in | 177
funasr/runtime/onnxruntime/include/tclap/StandardTraits.h | 63
funasr/runtime/onnxruntime/third_party/glog/.github/workflows/macos.yml | 83
funasr/runtime/onnxruntime/third_party/glog/src/glog/raw_logging.h.in | 179
funasr/runtime/onnxruntime/include/tclap/HelpVisitor.h | 78
funasr/runtime/onnxruntime/third_party/glog/.github/workflows/android.yml | 55
funasr/runtime/onnxruntime/third_party/glog/README.rst | 890 ++
funasr/runtime/onnxruntime/third_party/glog/.clang-format | 168
funasr/runtime/onnxruntime/third_party/glog/src/logging_striplog_test.sh | 79
funasr/runtime/onnxruntime/third_party/glog/AUTHORS | 29
funasr/runtime/onnxruntime/third_party/glog/src/symbolize.cc | 956 ++
funasr/runtime/onnxruntime/include/tclap/Arg.h | 683 +
funasr/runtime/onnxruntime/include/tclap/Visitor.h | 57
funasr/runtime/onnxruntime/CMakeLists.txt | 14
funasr/runtime/onnxruntime/third_party/glog/src/glog/vlog_is_on.h.in | 120
funasr/runtime/onnxruntime/third_party/glog/src/utilities.cc | 400
funasr/runtime/onnxruntime/third_party/glog/.github/workflows/emscripten.yml | 52
funasr/runtime/onnxruntime/third_party/glog/CONTRIBUTORS | 52
funasr/runtime/onnxruntime/third_party/glog/src/windows/port.cc | 75
funasr/runtime/onnxruntime/third_party/glog/bazel/example/main.cc | 22
funasr/runtime/onnxruntime/third_party/glog/src/utilities_unittest.cc | 58
funasr/runtime/onnxruntime/third_party/glog/libglog.pc.in | 11
funasr/runtime/onnxruntime/include/tclap/OptionalUnlabeledTracker.h | 64
funasr/runtime/onnxruntime/third_party/glog/src/raw_logging.cc | 179
funasr/runtime/onnxruntime/src/funasr-onnx-offline.cpp | 18
funasr/runtime/onnxruntime/third_party/glog/glog-config.cmake.in | 13
funasr/runtime/onnxruntime/third_party/glog/src/base/googleinit.h | 51
funasr/runtime/onnxruntime/include/tclap/StdOutput.h | 300
funasr/runtime/onnxruntime/third_party/glog/src/mock-log_unittest.cc | 108
funasr/runtime/onnxruntime/third_party/glog/src/symbolize_unittest.cc | 468 +
funasr/runtime/onnxruntime/third_party/glog/.github/workflows/linux.yml | 143
funasr/runtime/onnxruntime/third_party/glog/cmake/GetCacheVariables.cmake | 70
funasr/runtime/onnxruntime/third_party/glog/src/demangle.cc | 1310 ++
funasr/runtime/onnxruntime/third_party/glog/src/package_config_unittest/working_config/glog_package_config.cc | 6
funasr/runtime/onnxruntime/src/CMakeLists.txt | 4
funasr/runtime/onnxruntime/third_party/glog/src/stl_logging_unittest.cc | 114
funasr/runtime/onnxruntime/third_party/glog/src/logging_striptest10.cc | 35
funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_x86-inl.h | 159
funasr/runtime/onnxruntime/include/tclap/sstream.h | 50
funasr/runtime/onnxruntime/third_party/glog/src/package_config_unittest/working_config/CMakeLists.txt | 8
funasr/runtime/onnxruntime/src/fsmn-vad.cpp | 18
funasr/runtime/onnxruntime/third_party/glog/src/signalhandler_unittest.cc | 113
funasr/runtime/onnxruntime/third_party/glog/.bazelci/presubmit.yml | 62
funasr/runtime/onnxruntime/third_party/glog/src/demangle.h | 85
funasr/runtime/onnxruntime/third_party/glog/COPYING | 65
funasr/runtime/onnxruntime/third_party/glog/src/cleanup_with_absolute_prefix_unittest.cc | 101
funasr/runtime/onnxruntime/include/tclap/DocBookOutput.h | 303
funasr/runtime/onnxruntime/third_party/glog/glog-modules.cmake.in | 18
funasr/runtime/onnxruntime/third_party/glog/src/logging_unittest.cc | 1491 +++
funasr/runtime/onnxruntime/include/tclap/ArgTraits.h | 122
funasr/runtime/onnxruntime/include/tclap/UnlabeledValueArg.h | 343
funasr/runtime/onnxruntime/third_party/glog/src/windows/port.h | 181
funasr/runtime/onnxruntime/third_party/glog/.clang-tidy | 59
funasr/runtime/onnxruntime/include/tclap/CmdLine.h | 657 +
funasr/runtime/onnxruntime/third_party/glog/cmake/DetermineGflagsNamespace.cmake | 69
funasr/runtime/onnxruntime/third_party/glog/src/logging.cc | 2678 ++++++
funasr/runtime/onnxruntime/third_party/glog/src/glog/log_severity.h | 98
funasr/runtime/onnxruntime/include/tclap/CmdLineInterface.h | 153
funasr/runtime/onnxruntime/third_party/glog/src/cleanup_immediately_unittest.cc | 96
funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_libunwind-inl.h | 93
funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_powerpc-inl.h | 133
funasr/runtime/onnxruntime/include/tclap/ValuesConstraint.h | 134
funasr/runtime/onnxruntime/third_party/glog/bazel/glog.bzl | 307
funasr/runtime/onnxruntime/include/tclap/ZshCompletionOutput.h | 336
funasr/runtime/onnxruntime/third_party/glog/src/symbolize.h | 152
funasr/runtime/onnxruntime/include/tclap/VersionVisitor.h | 81
funasr/runtime/onnxruntime/third_party/glog/cmake/RunCleanerTest1.cmake | 22
funasr/runtime/onnxruntime/third_party/glog/src/fuzz_demangle.cc | 32
funasr/runtime/onnxruntime/third_party/glog/src/demangle_unittest.sh | 95
funasr/runtime/onnxruntime/third_party/glog/src/stacktrace.h | 61
funasr/runtime/onnxruntime/third_party/glog/src/windows/dirent.h | 1145 ++
funasr/runtime/onnxruntime/third_party/glog/src/logging_striptest2.cc | 35
funasr/runtime/onnxruntime/third_party/glog/src/demangle_unittest.cc | 170
funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_unittest.cc | 245
funasr/runtime/onnxruntime/third_party/glog/cmake/TestPackageConfig.cmake | 40
funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_unwind-inl.h | 106
funasr/runtime/onnxruntime/third_party/glog/cmake/TestInitPackageConfig.cmake | 11
funasr/runtime/onnxruntime/third_party/glog/bazel/example/BUILD.bazel | 9
funasr/runtime/onnxruntime/third_party/glog/src/base/mutex.h | 333
funasr/runtime/onnxruntime/third_party/glog/src/signalhandler.cc | 412
funasr/runtime/onnxruntime/third_party/glog/cmake/FindUnwind.cmake | 61
funasr/runtime/onnxruntime/include/tclap/CmdLineOutput.h | 77
funasr/runtime/onnxruntime/third_party/glog/src/vlog_is_on.cc | 294
funasr/runtime/onnxruntime/include/tclap/MultiArg.h | 433
funasr/runtime/onnxruntime/include/tclap/XorHandler.h | 168
/dev/null | 1
funasr/runtime/onnxruntime/third_party/glog/src/signalhandler_unittest.sh | 131
funasr/runtime/onnxruntime/third_party/glog/src/glog/logging.h.in | 1842 ++++
funasr/runtime/onnxruntime/third_party/glog/src/glog/platform.h | 60
funasr/runtime/onnxruntime/third_party/glog/src/logging_striptest_main.cc | 73
funasr/runtime/onnxruntime/third_party/glog/src/mock-log.h | 155
funasr/runtime/onnxruntime/third_party/glog/src/glog/stl_logging.h.in | 177
funasr/runtime/onnxruntime/third_party/glog/src/base/commandlineflags.h | 148
funasr/runtime/onnxruntime/third_party/glog/cmake/RunCleanerTest2.cmake | 22
funasr/runtime/onnxruntime/include/tclap/SwitchArg.h | 273
funasr/runtime/onnxruntime/third_party/glog/WORKSPACE | 18
funasr/runtime/onnxruntime/include/tclap/ValueArg.h | 430
119 files changed, 26,319 insertions(+), 19 deletions(-)
diff --git a/funasr/runtime/onnxruntime/CMakeLists.txt b/funasr/runtime/onnxruntime/CMakeLists.txt
index 9879c4a..25b816f 100644
--- a/funasr/runtime/onnxruntime/CMakeLists.txt
+++ b/funasr/runtime/onnxruntime/CMakeLists.txt
@@ -1,6 +1,8 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
-project(FunASRonnx)
+project(FunASROnnx)
+
+option(ENABLE_GLOG "Whether to build glog" ON)
# set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 14 CACHE STRING "The C++ version to be used.")
@@ -26,7 +28,15 @@
endif()
include_directories(${PROJECT_SOURCE_DIR}/third_party/kaldi-native-fbank)
+include_directories(${PROJECT_SOURCE_DIR}/third_party/yaml-cpp/include)
add_subdirectory(third_party/yaml-cpp)
add_subdirectory(third_party/kaldi-native-fbank/kaldi-native-fbank/csrc)
add_subdirectory(src)
+
+if(ENABLE_GLOG)
+ include_directories(${PROJECT_SOURCE_DIR}/third_party/glog)
+ set(BUILD_TESTING OFF)
+ add_subdirectory(third_party/glog)
+endif()
+
diff --git a/funasr/runtime/onnxruntime/include/kaldi-native-fbank/csrc/feature-fbank.h b/funasr/runtime/onnxruntime/include/kaldi-native-fbank/csrc/feature-fbank.h
deleted file mode 100644
index 0786aad..0000000
--- a/funasr/runtime/onnxruntime/include/kaldi-native-fbank/csrc/feature-fbank.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- * Copyright (c) 2022 Xiaomi Corporation (authors: Fangjun Kuang)
- *
- * See LICENSE for clarification regarding multiple authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// This file is copied/modified from kaldi/src/feat/feature-fbank.h
-
-#ifndef KALDI_NATIVE_FBANK_CSRC_FEATURE_FBANK_H_
-#define KALDI_NATIVE_FBANK_CSRC_FEATURE_FBANK_H_
-
-#include <map>
-#include <string>
-#include <vector>
-
-#include "kaldi-native-fbank/csrc/feature-window.h"
-#include "kaldi-native-fbank/csrc/mel-computations.h"
-#include "kaldi-native-fbank/csrc/rfft.h"
-
-namespace knf {
-
-struct FbankOptions {
- FrameExtractionOptions frame_opts;
- MelBanksOptions mel_opts;
- // append an extra dimension with energy to the filter banks
- bool use_energy = false;
- float energy_floor = 0.0f; // active iff use_energy==true
-
- // If true, compute log_energy before preemphasis and windowing
- // If false, compute log_energy after preemphasis ans windowing
- bool raw_energy = true; // active iff use_energy==true
-
- // If true, put energy last (if using energy)
- // If false, put energy first
- bool htk_compat = false; // active iff use_energy==true
-
- // if true (default), produce log-filterbank, else linear
- bool use_log_fbank = true;
-
- // if true (default), use power in filterbank
- // analysis, else magnitude.
- bool use_power = true;
-
- FbankOptions() { mel_opts.num_bins = 23; }
-
- std::string ToString() const {
- std::ostringstream os;
- os << "frame_opts: \n";
- os << frame_opts << "\n";
- os << "\n";
-
- os << "mel_opts: \n";
- os << mel_opts << "\n";
-
- os << "use_energy: " << use_energy << "\n";
- os << "energy_floor: " << energy_floor << "\n";
- os << "raw_energy: " << raw_energy << "\n";
- os << "htk_compat: " << htk_compat << "\n";
- os << "use_log_fbank: " << use_log_fbank << "\n";
- os << "use_power: " << use_power << "\n";
- return os.str();
- }
-};
-
-std::ostream &operator<<(std::ostream &os, const FbankOptions &opts);
-
-class FbankComputer {
- public:
- using Options = FbankOptions;
-
- explicit FbankComputer(const FbankOptions &opts);
- ~FbankComputer();
-
- int32_t Dim() const {
- return opts_.mel_opts.num_bins + (opts_.use_energy ? 1 : 0);
- }
-
- // if true, compute log_energy_pre_window but after dithering and dc removal
- bool NeedRawLogEnergy() const { return opts_.use_energy && opts_.raw_energy; }
-
- const FrameExtractionOptions &GetFrameOptions() const {
- return opts_.frame_opts;
- }
-
- const FbankOptions &GetOptions() const { return opts_; }
-
- /**
- Function that computes one frame of features from
- one frame of signal.
-
- @param [in] signal_raw_log_energy The log-energy of the frame of the signal
- prior to windowing and pre-emphasis, or
- log(numeric_limits<float>::min()), whichever is greater. Must be
- ignored by this function if this class returns false from
- this->NeedsRawLogEnergy().
- @param [in] vtln_warp The VTLN warping factor that the user wants
- to be applied when computing features for this utterance. Will
- normally be 1.0, meaning no warping is to be done. The value will
- be ignored for feature types that don't support VLTN, such as
- spectrogram features.
- @param [in] signal_frame One frame of the signal,
- as extracted using the function ExtractWindow() using the options
- returned by this->GetFrameOptions(). The function will use the
- vector as a workspace, which is why it's a non-const pointer.
- @param [out] feature Pointer to a vector of size this->Dim(), to which
- the computed feature will be written. It should be pre-allocated.
- */
- void Compute(float signal_raw_log_energy, float vtln_warp,
- std::vector<float> *signal_frame, float *feature);
-
- private:
- const MelBanks *GetMelBanks(float vtln_warp);
-
- FbankOptions opts_;
- float log_energy_floor_;
- std::map<float, MelBanks *> mel_banks_; // float is VTLN coefficient.
- Rfft rfft_;
-};
-
-} // namespace knf
-
-#endif // KALDI_NATIVE_FBANK_CSRC_FEATURE_FBANK_H_
diff --git a/funasr/runtime/onnxruntime/include/kaldi-native-fbank/csrc/online-feature.h b/funasr/runtime/onnxruntime/include/kaldi-native-fbank/csrc/online-feature.h
deleted file mode 100644
index 5ca5511..0000000
--- a/funasr/runtime/onnxruntime/include/kaldi-native-fbank/csrc/online-feature.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/**
- * Copyright (c) 2022 Xiaomi Corporation (authors: Fangjun Kuang)
- *
- * See LICENSE for clarification regarding multiple authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// The content in this file is copied/modified from
-// This file is copied/modified from kaldi/src/feat/online-feature.h
-#ifndef KALDI_NATIVE_FBANK_CSRC_ONLINE_FEATURE_H_
-#define KALDI_NATIVE_FBANK_CSRC_ONLINE_FEATURE_H_
-
-#include <cstdint>
-#include <deque>
-#include <vector>
-
-#include "kaldi-native-fbank/csrc/feature-fbank.h"
-
-namespace knf {
-
-/// This class serves as a storage for feature vectors with an option to limit
-/// the memory usage by removing old elements. The deleted frames indices are
-/// "remembered" so that regardless of the MAX_ITEMS setting, the user always
-/// provides the indices as if no deletion was being performed.
-/// This is useful when processing very long recordings which would otherwise
-/// cause the memory to eventually blow up when the features are not being
-/// removed.
-class RecyclingVector {
- public:
- /// By default it does not remove any elements.
- explicit RecyclingVector(int32_t items_to_hold = -1);
-
- ~RecyclingVector() = default;
- RecyclingVector(const RecyclingVector &) = delete;
- RecyclingVector &operator=(const RecyclingVector &) = delete;
-
- // The pointer is owned by RecyclingVector
- // Users should not free it
- const float *At(int32_t index) const;
-
- void PushBack(std::vector<float> item);
-
- /// This method returns the size as if no "recycling" had happened,
- /// i.e. equivalent to the number of times the PushBack method has been
- /// called.
- int32_t Size() const;
-
- private:
- std::deque<std::vector<float>> items_;
- int32_t items_to_hold_;
- int32_t first_available_index_;
-};
-
-/// This is a templated class for online feature extraction;
-/// it's templated on a class like MfccComputer or PlpComputer
-/// that does the basic feature extraction.
-template <class C>
-class OnlineGenericBaseFeature {
- public:
- // Constructor from options class
- explicit OnlineGenericBaseFeature(const typename C::Options &opts);
-
- int32_t Dim() const { return computer_.Dim(); }
-
- float FrameShiftInSeconds() const {
- return computer_.GetFrameOptions().frame_shift_ms / 1000.0f;
- }
-
- int32_t NumFramesReady() const { return features_.Size(); }
-
- // Note: IsLastFrame() will only ever return true if you have called
- // InputFinished() (and this frame is the last frame).
- bool IsLastFrame(int32_t frame) const {
- return input_finished_ && frame == NumFramesReady() - 1;
- }
-
- const float *GetFrame(int32_t frame) const { return features_.At(frame); }
-
- // This would be called from the application, when you get
- // more wave data. Note: the sampling_rate is only provided so
- // the code can assert that it matches the sampling rate
- // expected in the options.
- //
- // @param sampling_rate The sampling_rate of the input waveform
- // @param waveform Pointer to a 1-D array of size n
- // @param n Number of entries in waveform
- void AcceptWaveform(float sampling_rate, const float *waveform, int32_t n);
-
- // InputFinished() tells the class you won't be providing any
- // more waveform. This will help flush out the last frame or two
- // of features, in the case where snip-edges == false; it also
- // affects the return value of IsLastFrame().
- void InputFinished();
-
- private:
- // This function computes any additional feature frames that it is possible to
- // compute from 'waveform_remainder_', which at this point may contain more
- // than just a remainder-sized quantity (because AcceptWaveform() appends to
- // waveform_remainder_ before calling this function). It adds these feature
- // frames to features_, and shifts off any now-unneeded samples of input from
- // waveform_remainder_ while incrementing waveform_offset_ by the same amount.
- void ComputeFeatures();
-
- C computer_; // class that does the MFCC or PLP or filterbank computation
-
- FeatureWindowFunction window_function_;
-
- // features_ is the Mfcc or Plp or Fbank features that we have already
- // computed.
-
- RecyclingVector features_;
-
- // True if the user has called "InputFinished()"
- bool input_finished_;
-
- // waveform_offset_ is the number of samples of waveform that we have
- // already discarded, i.e. that were prior to 'waveform_remainder_'.
- int64_t waveform_offset_;
-
- // waveform_remainder_ is a short piece of waveform that we may need to keep
- // after extracting all the whole frames we can (whatever length of feature
- // will be required for the next phase of computation).
- // It is a 1-D tensor
- std::vector<float> waveform_remainder_;
-};
-
-using OnlineFbank = OnlineGenericBaseFeature<FbankComputer>;
-
-} // namespace knf
-
-#endif // KALDI_NATIVE_FBANK_CSRC_ONLINE_FEATURE_H_
diff --git a/funasr/runtime/onnxruntime/include/tclap/Arg.h b/funasr/runtime/onnxruntime/include/tclap/Arg.h
new file mode 100644
index 0000000..f8c4a5f
--- /dev/null
+++ b/funasr/runtime/onnxruntime/include/tclap/Arg.h
@@ -0,0 +1,683 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
+/******************************************************************************
+ *
+ * file: Arg.h
+ *
+ * Copyright (c) 2003, Michael E. Smoot .
+ * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno .
+ * Copyright (c) 2017 Google Inc.
+ * All rights reserved.
+ *
+ * See the file COPYING in the top directory of this distribution for
+ * more information.
+ *
+ * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+
+#ifndef TCLAP_ARGUMENT_H
+#define TCLAP_ARGUMENT_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string>
+#include <vector>
+#include <list>
+#include <iostream>
+#include <iomanip>
+#include <cstdio>
+
+#include <tclap/sstream.h>
+
+#include <tclap/ArgException.h>
+#include <tclap/Visitor.h>
+#include <tclap/CmdLineInterface.h>
+#include <tclap/ArgTraits.h>
+#include <tclap/StandardTraits.h>
+
+namespace TCLAP {
+
+/**
+ * A virtual base class that defines the essential data for all arguments.
+ * This class, or one of its existing children, must be subclassed to do
+ * anything.
+ */
+class Arg
+{
+ private:
+ /**
+ * Prevent accidental copying.
+ */
+ Arg(const Arg& rhs);
+
+ /**
+ * Prevent accidental copying.
+ */
+ Arg& operator=(const Arg& rhs);
+
+ /**
+ * Indicates whether the rest of the arguments should be ignored.
+ */
+ static bool& ignoreRestRef() { static bool ign = false; return ign; }
+
+ /**
+ * The delimiter that separates an argument flag/name from the
+ * value.
+ */
+ static char& delimiterRef() { static char delim = ' '; return delim; }
+
+ protected:
+
+ /**
+ * The single char flag used to identify the argument.
+ * This value (preceded by a dash {-}), can be used to identify
+ * an argument on the command line. The _flag can be blank,
+ * in fact this is how unlabeled args work. Unlabeled args must
+ * override appropriate functions to get correct handling. Note
+ * that the _flag does NOT include the dash as part of the flag.
+ */
+ std::string _flag;
+
+ /**
+ * A single word namd identifying the argument.
+ * This value (preceded by two dashed {--}) can also be used
+ * to identify an argument on the command line. Note that the
+ * _name does NOT include the two dashes as part of the _name. The
+ * _name cannot be blank.
+ */
+ std::string _name;
+
+ /**
+ * Description of the argument.
+ */
+ std::string _description;
+
+ /**
+ * Indicating whether the argument is required.
+ */
+ bool _required;
+
+ /**
+ * Label to be used in usage description. Normally set to
+ * "required", but can be changed when necessary.
+ */
+ std::string _requireLabel;
+
+ /**
+ * Indicates whether a value is required for the argument.
+ * Note that the value may be required but the argument/value
+ * combination may not be, as specified by _required.
+ */
+ bool _valueRequired;
+
+ /**
+ * Indicates whether the argument has been set.
+ * Indicates that a value on the command line has matched the
+ * name/flag of this argument and the values have been set accordingly.
+ */
+ bool _alreadySet;
+
+ /**
+ * A pointer to a visitor object.
+ * The visitor allows special handling to occur as soon as the
+ * argument is matched. This defaults to NULL and should not
+ * be used unless absolutely necessary.
+ */
+ Visitor* _visitor;
+
+ /**
+ * Whether this argument can be ignored, if desired.
+ */
+ bool _ignoreable;
+
+ /**
+ * Indicates that the arg was set as part of an XOR and not on the
+ * command line.
+ */
+ bool _xorSet;
+
+ bool _acceptsMultipleValues;
+
+ /**
+ * Performs the special handling described by the Visitor.
+ */
+ void _checkWithVisitor() const;
+
+ /**
+ * Primary constructor. YOU (yes you) should NEVER construct an Arg
+ * directly, this is a base class that is extended by various children
+ * that are meant to be used. Use SwitchArg, ValueArg, MultiArg,
+ * UnlabeledValueArg, or UnlabeledMultiArg instead.
+ *
+ * \param flag - The flag identifying the argument.
+ * \param name - The name identifying the argument.
+ * \param desc - The description of the argument, used in the usage.
+ * \param req - Whether the argument is required.
+ * \param valreq - Whether the a value is required for the argument.
+ * \param v - The visitor checked by the argument. Defaults to NULL.
+ */
+ Arg( const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ bool req,
+ bool valreq,
+ Visitor* v = NULL );
+
+ public:
+ /**
+ * Destructor.
+ */
+ virtual ~Arg();
+
+ /**
+ * Adds this to the specified list of Args.
+ * \param argList - The list to add this to.
+ */
+ virtual void addToList( std::list<Arg*>& argList ) const;
+
+ /**
+ * Begin ignoring arguments since the "--" argument was specified.
+ */
+ static void beginIgnoring() { ignoreRestRef() = true; }
+
+ /**
+ * Whether to ignore the rest.
+ */
+ static bool ignoreRest() { return ignoreRestRef(); }
+
+ /**
+ * The delimiter that separates an argument flag/name from the
+ * value.
+ */
+ static char delimiter() { return delimiterRef(); }
+
+ /**
+ * The char used as a place holder when SwitchArgs are combined.
+ * Currently set to the bell char (ASCII 7).
+ */
+ static char blankChar() { return (char)7; }
+
+ /**
+ * The char that indicates the beginning of a flag. Defaults to '-', but
+ * clients can define TCLAP_FLAGSTARTCHAR to override.
+ */
+#ifndef TCLAP_FLAGSTARTCHAR
+#define TCLAP_FLAGSTARTCHAR '-'
+#endif
+ static char flagStartChar() { return TCLAP_FLAGSTARTCHAR; }
+
+ /**
+ * The sting that indicates the beginning of a flag. Defaults to "-", but
+ * clients can define TCLAP_FLAGSTARTSTRING to override. Should be the same
+ * as TCLAP_FLAGSTARTCHAR.
+ */
+#ifndef TCLAP_FLAGSTARTSTRING
+#define TCLAP_FLAGSTARTSTRING "-"
+#endif
+ static const std::string flagStartString() { return TCLAP_FLAGSTARTSTRING; }
+
+ /**
+ * The sting that indicates the beginning of a name. Defaults to "--", but
+ * clients can define TCLAP_NAMESTARTSTRING to override.
+ */
+#ifndef TCLAP_NAMESTARTSTRING
+#define TCLAP_NAMESTARTSTRING "--"
+#endif
+ static const std::string nameStartString() { return TCLAP_NAMESTARTSTRING; }
+
+ /**
+ * The name used to identify the ignore rest argument.
+ */
+ static const std::string ignoreNameString() { return "ignore_rest"; }
+
+ /**
+ * Sets the delimiter for all arguments.
+ * \param c - The character that delimits flags/names from values.
+ */
+ static void setDelimiter( char c ) { delimiterRef() = c; }
+
+ /**
+ * Pure virtual method meant to handle the parsing and value assignment
+ * of the string on the command line.
+ * \param i - Pointer the the current argument in the list.
+ * \param args - Mutable list of strings. What is
+ * passed in from main.
+ */
+ virtual bool processArg(int *i, std::vector<std::string>& args) = 0;
+
+ /**
+ * Operator ==.
+ * Equality operator. Must be virtual to handle unlabeled args.
+ * \param a - The Arg to be compared to this.
+ */
+ virtual bool operator==(const Arg& a) const;
+
+ /**
+ * Returns the argument flag.
+ */
+ const std::string& getFlag() const;
+
+ /**
+ * Returns the argument name.
+ */
+ const std::string& getName() const;
+
+ /**
+ * Returns the argument description.
+ */
+ std::string getDescription() const;
+
+ /**
+ * Indicates whether the argument is required.
+ */
+ virtual bool isRequired() const;
+
+ /**
+ * Sets _required to true. This is used by the XorHandler.
+ * You really have no reason to ever use it.
+ */
+ void forceRequired();
+
+ /**
+ * Sets the _alreadySet value to true. This is used by the XorHandler.
+ * You really have no reason to ever use it.
+ */
+ void xorSet();
+
+ /**
+ * Indicates whether a value must be specified for argument.
+ */
+ bool isValueRequired() const;
+
+ /**
+ * Indicates whether the argument has already been set. Only true
+ * if the arg has been matched on the command line.
+ */
+ bool isSet() const;
+
+ /**
+ * Indicates whether the argument can be ignored, if desired.
+ */
+ bool isIgnoreable() const;
+
+ /**
+ * A method that tests whether a string matches this argument.
+ * This is generally called by the processArg() method. This
+ * method could be re-implemented by a child to change how
+ * arguments are specified on the command line.
+ * \param s - The string to be compared to the flag/name to determine
+ * whether the arg matches.
+ */
+ virtual bool argMatches( const std::string& s ) const;
+
+ /**
+ * Returns a simple string representation of the argument.
+ * Primarily for debugging.
+ */
+ virtual std::string toString() const;
+
+ /**
+ * Returns a short ID for the usage.
+ * \param valueId - The value used in the id.
+ */
+ virtual std::string shortID( const std::string& valueId = "val" ) const;
+
+ /**
+ * Returns a long ID for the usage.
+ * \param valueId - The value used in the id.
+ */
+ virtual std::string longID( const std::string& valueId = "val" ) const;
+
+ /**
+ * Trims a value off of the flag.
+ * \param flag - The string from which the flag and value will be
+ * trimmed. Contains the flag once the value has been trimmed.
+ * \param value - Where the value trimmed from the string will
+ * be stored.
+ */
+ virtual void trimFlag( std::string& flag, std::string& value ) const;
+
+ /**
+ * Checks whether a given string has blank chars, indicating that
+ * it is a combined SwitchArg. If so, return true, otherwise return
+ * false.
+ * \param s - string to be checked.
+ */
+ bool _hasBlanks( const std::string& s ) const;
+
+ /**
+ * Sets the requireLabel. Used by XorHandler. You shouldn't ever
+ * use this.
+ * \param s - Set the requireLabel to this value.
+ */
+ void setRequireLabel( const std::string& s );
+
+ /**
+ * Used for MultiArgs and XorHandler to determine whether args
+ * can still be set.
+ */
+ virtual bool allowMore();
+
+ /**
+ * Use by output classes to determine whether an Arg accepts
+ * multiple values.
+ */
+ virtual bool acceptsMultipleValues();
+
+ /**
+ * Clears the Arg object and allows it to be reused by new
+ * command lines.
+ */
+ virtual void reset();
+};
+
+/**
+ * Typedef of an Arg list iterator.
+ */
+typedef std::list<Arg*>::const_iterator ArgListIterator;
+
+/**
+ * Typedef of an Arg vector iterator.
+ */
+typedef std::vector<Arg*>::const_iterator ArgVectorIterator;
+
+/**
+ * Typedef of a Visitor list iterator.
+ */
+typedef std::list<Visitor*>::const_iterator VisitorListIterator;
+
+/*
+ * Extract a value of type T from it's string representation contained
+ * in strVal. The ValueLike parameter used to select the correct
+ * specialization of ExtractValue depending on the value traits of T.
+ * ValueLike traits use operator>> to assign the value from strVal.
+ */
+template<typename T> void
+ExtractValue(T &destVal, const std::string& strVal, ValueLike vl)
+{
+ static_cast<void>(vl); // Avoid warning about unused vl
+ istringstream is(strVal.c_str());
+
+ int valuesRead = 0;
+ while ( is.good() ) {
+ if ( is.peek() != EOF )
+#ifdef TCLAP_SETBASE_ZERO
+ is >> std::setbase(0) >> destVal;
+#else
+ is >> destVal;
+#endif
+ else
+ break;
+
+ valuesRead++;
+ }
+
+ if ( is.fail() )
+ throw( ArgParseException("Couldn't read argument value "
+ "from string '" + strVal + "'"));
+
+
+ if ( valuesRead > 1 )
+ throw( ArgParseException("More than one valid value parsed from "
+ "string '" + strVal + "'"));
+
+}
+
+/*
+ * Extract a value of type T from it's string representation contained
+ * in strVal. The ValueLike parameter used to select the correct
+ * specialization of ExtractValue depending on the value traits of T.
+ * StringLike uses assignment (operator=) to assign from strVal.
+ */
+template<typename T> void
+ExtractValue(T &destVal, const std::string& strVal, StringLike sl)
+{
+ static_cast<void>(sl); // Avoid warning about unused sl
+ SetString(destVal, strVal);
+}
+
+//////////////////////////////////////////////////////////////////////
+//BEGIN Arg.cpp
+//////////////////////////////////////////////////////////////////////
+
+inline Arg::Arg(const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ bool req,
+ bool valreq,
+ Visitor* v) :
+ _flag(flag),
+ _name(name),
+ _description(desc),
+ _required(req),
+ _requireLabel("required"),
+ _valueRequired(valreq),
+ _alreadySet(false),
+ _visitor( v ),
+ _ignoreable(true),
+ _xorSet(false),
+ _acceptsMultipleValues(false)
+{
+ if ( _flag.length() > 1 )
+ throw(SpecificationException(
+ "Argument flag can only be one character long", toString() ) );
+
+ if ( _name != ignoreNameString() &&
+ ( _flag == Arg::flagStartString() ||
+ _flag == Arg::nameStartString() ||
+ _flag == " " ) )
+ throw(SpecificationException("Argument flag cannot be either '" +
+ Arg::flagStartString() + "' or '" +
+ Arg::nameStartString() + "' or a space.",
+ toString() ) );
+
+ if ( ( _name.substr( 0, Arg::flagStartString().length() ) == Arg::flagStartString() ) ||
+ ( _name.substr( 0, Arg::nameStartString().length() ) == Arg::nameStartString() ) ||
+ ( _name.find( " ", 0 ) != std::string::npos ) )
+ throw(SpecificationException("Argument name begin with either '" +
+ Arg::flagStartString() + "' or '" +
+ Arg::nameStartString() + "' or space.",
+ toString() ) );
+
+}
+
+inline Arg::~Arg() { }
+
+inline std::string Arg::shortID( const std::string& valueId ) const
+{
+ std::string id = "";
+
+ if ( _flag != "" )
+ id = Arg::flagStartString() + _flag;
+ else
+ id = Arg::nameStartString() + _name;
+
+ if ( _valueRequired )
+ id += std::string( 1, Arg::delimiter() ) + "<" + valueId + ">";
+
+ if ( !_required )
+ id = "[" + id + "]";
+
+ return id;
+}
+
+inline std::string Arg::longID( const std::string& valueId ) const
+{
+ std::string id = "";
+
+ if ( _flag != "" )
+ {
+ id += Arg::flagStartString() + _flag;
+
+ if ( _valueRequired )
+ id += std::string( 1, Arg::delimiter() ) + "<" + valueId + ">";
+
+ id += ", ";
+ }
+
+ id += Arg::nameStartString() + _name;
+
+ if ( _valueRequired )
+ id += std::string( 1, Arg::delimiter() ) + "<" + valueId + ">";
+
+ return id;
+
+}
+
+inline bool Arg::operator==(const Arg& a) const
+{
+ if ( ( _flag != "" && _flag == a._flag ) || _name == a._name)
+ return true;
+ else
+ return false;
+}
+
+inline std::string Arg::getDescription() const
+{
+ std::string desc = "";
+ if ( _required )
+ desc = "(" + _requireLabel + ") ";
+
+// if ( _valueRequired )
+// desc += "(value required) ";
+
+ desc += _description;
+ return desc;
+}
+
+inline const std::string& Arg::getFlag() const { return _flag; }
+
+inline const std::string& Arg::getName() const { return _name; }
+
+inline bool Arg::isRequired() const { return _required; }
+
+inline bool Arg::isValueRequired() const { return _valueRequired; }
+
+inline bool Arg::isSet() const
+{
+ if ( _alreadySet && !_xorSet )
+ return true;
+ else
+ return false;
+}
+
+inline bool Arg::isIgnoreable() const { return _ignoreable; }
+
+inline void Arg::setRequireLabel( const std::string& s)
+{
+ _requireLabel = s;
+}
+
+inline bool Arg::argMatches( const std::string& argFlag ) const
+{
+ if ( ( argFlag == Arg::flagStartString() + _flag && _flag != "" ) ||
+ argFlag == Arg::nameStartString() + _name )
+ return true;
+ else
+ return false;
+}
+
+inline std::string Arg::toString() const
+{
+ std::string s = "";
+
+ if ( _flag != "" )
+ s += Arg::flagStartString() + _flag + " ";
+
+ s += "(" + Arg::nameStartString() + _name + ")";
+
+ return s;
+}
+
+inline void Arg::_checkWithVisitor() const
+{
+ if ( _visitor != NULL )
+ _visitor->visit();
+}
+
+/**
+ * Implementation of trimFlag.
+ */
+inline void Arg::trimFlag(std::string& flag, std::string& value) const
+{
+ int stop = 0;
+ for ( int i = 0; static_cast<unsigned int>(i) < flag.length(); i++ )
+ if ( flag[i] == Arg::delimiter() )
+ {
+ stop = i;
+ break;
+ }
+
+ if ( stop > 1 )
+ {
+ value = flag.substr(stop+1);
+ flag = flag.substr(0,stop);
+ }
+
+}
+
+/**
+ * Implementation of _hasBlanks.
+ */
+inline bool Arg::_hasBlanks( const std::string& s ) const
+{
+ for ( int i = 1; static_cast<unsigned int>(i) < s.length(); i++ )
+ if ( s[i] == Arg::blankChar() )
+ return true;
+
+ return false;
+}
+
+inline void Arg::forceRequired()
+{
+ _required = true;
+}
+
+inline void Arg::xorSet()
+{
+ _alreadySet = true;
+ _xorSet = true;
+}
+
+/**
+ * Overridden by Args that need to added to the end of the list.
+ */
+inline void Arg::addToList( std::list<Arg*>& argList ) const
+{
+ argList.push_front( const_cast<Arg*>(this) );
+}
+
+inline bool Arg::allowMore()
+{
+ return false;
+}
+
+inline bool Arg::acceptsMultipleValues()
+{
+ return _acceptsMultipleValues;
+}
+
+inline void Arg::reset()
+{
+ _xorSet = false;
+ _alreadySet = false;
+}
+
+//////////////////////////////////////////////////////////////////////
+//END Arg.cpp
+//////////////////////////////////////////////////////////////////////
+
+} //namespace TCLAP
+
+#endif
+
diff --git a/funasr/runtime/onnxruntime/include/tclap/ArgException.h b/funasr/runtime/onnxruntime/include/tclap/ArgException.h
new file mode 100644
index 0000000..1e0f659
--- /dev/null
+++ b/funasr/runtime/onnxruntime/include/tclap/ArgException.h
@@ -0,0 +1,213 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
+/******************************************************************************
+ *
+ * file: ArgException.h
+ *
+ * Copyright (c) 2003, Michael E. Smoot .
+ * Copyright (c) 2017 Google LLC
+ * All rights reserved.
+ *
+ * See the file COPYING in the top directory of this distribution for
+ * more information.
+ *
+ * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+
+#ifndef TCLAP_ARG_EXCEPTION_H
+#define TCLAP_ARG_EXCEPTION_H
+
+#include <string>
+#include <exception>
+
+namespace TCLAP {
+
+/**
+ * A simple class that defines and argument exception. Should be caught
+ * whenever a CmdLine is created and parsed.
+ */
+class ArgException : public std::exception
+{
+ public:
+
+ /**
+ * Constructor.
+ * \param text - The text of the exception.
+ * \param id - The text identifying the argument source.
+ * \param td - Text describing the type of ArgException it is.
+ * of the exception.
+ */
+ ArgException( const std::string& text = "undefined exception",
+ const std::string& id = "undefined",
+ const std::string& td = "Generic ArgException")
+ : std::exception(),
+ _errorText(text),
+ _argId( id ),
+ _typeDescription(td)
+ { }
+
+ /**
+ * Destructor.
+ */
+ virtual ~ArgException() throw() { }
+
+ /**
+ * Returns the error text.
+ */
+ std::string error() const { return ( _errorText ); }
+
+ /**
+ * Returns the argument id.
+ */
+ std::string argId() const
+ {
+ if ( _argId == "undefined" )
+ return " ";
+ else
+ return ( "Argument: " + _argId );
+ }
+
+ /**
+ * Returns the arg id and error text.
+ */
+ const char* what() const throw()
+ {
+ static std::string ex;
+ ex = _argId + " -- " + _errorText;
+ return ex.c_str();
+ }
+
+ /**
+ * Returns the type of the exception. Used to explain and distinguish
+ * between different child exceptions.
+ */
+ std::string typeDescription() const
+ {
+ return _typeDescription;
+ }
+
+
+ private:
+
+ /**
+ * The text of the exception message.
+ */
+ std::string _errorText;
+
+ /**
+ * The argument related to this exception.
+ */
+ std::string _argId;
+
+ /**
+ * Describes the type of the exception. Used to distinguish
+ * between different child exceptions.
+ */
+ std::string _typeDescription;
+
+};
+
+/**
+ * Thrown from within the child Arg classes when it fails to properly
+ * parse the argument it has been passed.
+ */
+class ArgParseException : public ArgException
+{
+ public:
+ /**
+ * Constructor.
+ * \param text - The text of the exception.
+ * \param id - The text identifying the argument source
+ * of the exception.
+ */
+ ArgParseException( const std::string& text = "undefined exception",
+ const std::string& id = "undefined" )
+ : ArgException( text,
+ id,
+ std::string( "Exception found while parsing " ) +
+ std::string( "the value the Arg has been passed." ))
+ { }
+};
+
+/**
+ * Thrown from CmdLine when the arguments on the command line are not
+ * properly specified, e.g. too many arguments, required argument missing, etc.
+ */
+class CmdLineParseException : public ArgException
+{
+ public:
+ /**
+ * Constructor.
+ * \param text - The text of the exception.
+ * \param id - The text identifying the argument source
+ * of the exception.
+ */
+ CmdLineParseException( const std::string& text = "undefined exception",
+ const std::string& id = "undefined" )
+ : ArgException( text,
+ id,
+ std::string( "Exception found when the values ") +
+ std::string( "on the command line do not meet ") +
+ std::string( "the requirements of the defined ") +
+ std::string( "Args." ))
+ { }
+};
+
+/**
+ * Thrown from Arg and CmdLine when an Arg is improperly specified, e.g.
+ * same flag as another Arg, same name, etc.
+ */
+class SpecificationException : public ArgException
+{
+ public:
+ /**
+ * Constructor.
+ * \param text - The text of the exception.
+ * \param id - The text identifying the argument source
+ * of the exception.
+ */
+ SpecificationException( const std::string& text = "undefined exception",
+ const std::string& id = "undefined" )
+ : ArgException( text,
+ id,
+ std::string("Exception found when an Arg object ")+
+ std::string("is improperly defined by the ") +
+ std::string("developer." ))
+ { }
+
+};
+
+/**
+ * Thrown when TCLAP thinks the program should exit.
+ *
+ * For example after parse error this exception will be thrown (and
+ * normally caught). This allows any resource to be clened properly
+ * before exit.
+ *
+ * If exception handling is disabled (CmdLine::setExceptionHandling),
+ * this exception will propagate to the call site, allowing the
+ * program to catch it and avoid program termination, or do it's own
+ * cleanup. See for example, https://sourceforge.net/p/tclap/bugs/29.
+ */
+class ExitException {
+public:
+ ExitException(int estat) : _estat(estat) {}
+
+ int getExitStatus() const { return _estat; }
+
+private:
+ int _estat;
+};
+
+} // namespace TCLAP
+
+#endif
+
diff --git a/funasr/runtime/onnxruntime/include/tclap/ArgTraits.h b/funasr/runtime/onnxruntime/include/tclap/ArgTraits.h
new file mode 100644
index 0000000..0ccf5e3
--- /dev/null
+++ b/funasr/runtime/onnxruntime/include/tclap/ArgTraits.h
@@ -0,0 +1,122 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
+/******************************************************************************
+ *
+ * file: ArgTraits.h
+ *
+ * Copyright (c) 2007, Daniel Aarno, Michael E. Smoot .
+ * Copyright (c) 2017 Google LLC
+ * All rights reserved.
+ *
+ * See the file COPYING in the top directory of this distribution for
+ * more information.
+ *
+ * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+// This is an internal tclap file, you should probably not have to
+// include this directly
+
+#ifndef TCLAP_ARGTRAITS_H
+#define TCLAP_ARGTRAITS_H
+
+namespace TCLAP {
+
+// We use two empty structs to get compile type specialization
+// function to work
+
+/**
+ * A value like argument value type is a value that can be set using
+ * operator>>. This is the default value type.
+ */
+struct ValueLike {
+ typedef ValueLike ValueCategory;
+ virtual ~ValueLike() {}
+};
+
+/**
+ * A string like argument value type is a value that can be set using
+ * operator=(string). Useful if the value type contains spaces which
+ * will be broken up into individual tokens by operator>>.
+ */
+struct StringLike {
+ virtual ~StringLike() {}
+};
+
+/**
+ * A class can inherit from this object to make it have string like
+ * traits. This is a compile time thing and does not add any overhead
+ * to the inherenting class.
+ */
+struct StringLikeTrait {
+ typedef StringLike ValueCategory;
+ virtual ~StringLikeTrait() {}
+};
+
+/**
+ * A class can inherit from this object to make it have value like
+ * traits. This is a compile time thing and does not add any overhead
+ * to the inherenting class.
+ */
+struct ValueLikeTrait {
+ typedef ValueLike ValueCategory;
+ virtual ~ValueLikeTrait() {}
+};
+
+/**
+ * Arg traits are used to get compile type specialization when parsing
+ * argument values. Using an ArgTraits you can specify the way that
+ * values gets assigned to any particular type during parsing. The two
+ * supported types are StringLike and ValueLike. ValueLike is the
+ * default and means that operator>> will be used to assign values to
+ * the type.
+ */
+template<typename T>
+class ArgTraits {
+ // This is a bit silly, but what we want to do is:
+ // 1) If there exists a specialization of ArgTraits for type X,
+ // use it.
+ //
+ // 2) If no specialization exists but X has the typename
+ // X::ValueCategory, use the specialization for X::ValueCategory.
+ //
+ // 3) If neither (1) nor (2) defines the trait, use the default
+ // which is ValueLike.
+
+ // This is the "how":
+ //
+ // test<T>(0) (where 0 is the NULL ptr) will match
+ // test(typename C::ValueCategory*) iff type T has the
+ // corresponding typedef. If it does not test(...) will be
+ // matched. This allows us to determine if T::ValueCategory
+ // exists by checking the sizeof for the test function (return
+ // value must have different sizeof).
+ template<typename C> static short test(typename C::ValueCategory*);
+ template<typename C> static long test(...);
+ static const bool hasTrait = sizeof(test<T>(0)) == sizeof(short);
+
+ template <typename C, bool>
+ struct DefaultArgTrait {
+ typedef ValueLike ValueCategory;
+ };
+
+ template <typename C>
+ struct DefaultArgTrait<C, true> {
+ typedef typename C::ValueCategory ValueCategory;
+ };
+
+public:
+ typedef typename DefaultArgTrait<T, hasTrait>::ValueCategory ValueCategory;
+};
+
+} // namespace
+
+#endif
+
diff --git a/funasr/runtime/onnxruntime/include/tclap/CmdLine.h b/funasr/runtime/onnxruntime/include/tclap/CmdLine.h
new file mode 100644
index 0000000..dc49bae
--- /dev/null
+++ b/funasr/runtime/onnxruntime/include/tclap/CmdLine.h
@@ -0,0 +1,657 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
+/******************************************************************************
+ *
+ * file: CmdLine.h
+ *
+ * Copyright (c) 2003, Michael E. Smoot .
+ * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
+ * All rights reserved.
+ *
+ * See the file COPYING in the top directory of this distribution for
+ * more information.
+ *
+ * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+#ifndef TCLAP_CMDLINE_H
+#define TCLAP_CMDLINE_H
+
+#include <tclap/SwitchArg.h>
+#include <tclap/MultiSwitchArg.h>
+#include <tclap/UnlabeledValueArg.h>
+#include <tclap/UnlabeledMultiArg.h>
+
+#include <tclap/XorHandler.h>
+#include <tclap/HelpVisitor.h>
+#include <tclap/VersionVisitor.h>
+#include <tclap/IgnoreRestVisitor.h>
+
+#include <tclap/CmdLineOutput.h>
+#include <tclap/StdOutput.h>
+
+#include <tclap/Constraint.h>
+#include <tclap/ValuesConstraint.h>
+
+#include <string>
+#include <vector>
+#include <list>
+#include <iostream>
+#include <iomanip>
+#include <algorithm>
+#include <stdlib.h> // Needed for exit(), which isn't defined in some envs.
+
+namespace TCLAP {
+
+template<typename T> void DelPtr(T ptr)
+{
+ delete ptr;
+}
+
+template<typename C> void ClearContainer(C &c)
+{
+ typedef typename C::value_type value_type;
+ std::for_each(c.begin(), c.end(), DelPtr<value_type>);
+ c.clear();
+}
+
+
+/**
+ * The base class that manages the command line definition and passes
+ * along the parsing to the appropriate Arg classes.
+ */
+class CmdLine : public CmdLineInterface
+{
+ protected:
+
+ /**
+ * The list of arguments that will be tested against the
+ * command line.
+ */
+ std::list<Arg*> _argList;
+
+ /**
+ * The name of the program. Set to argv[0].
+ */
+ std::string _progName;
+
+ /**
+ * A message used to describe the program. Used in the usage output.
+ */
+ std::string _message;
+
+ /**
+ * The version to be displayed with the --version switch.
+ */
+ std::string _version;
+
+ /**
+ * The number of arguments that are required to be present on
+ * the command line. This is set dynamically, based on the
+ * Args added to the CmdLine object.
+ */
+ int _numRequired;
+
+ /**
+ * The character that is used to separate the argument flag/name
+ * from the value. Defaults to ' ' (space).
+ */
+ char _delimiter;
+
+ /**
+ * The handler that manages xoring lists of args.
+ */
+ XorHandler _xorHandler;
+
+ /**
+ * A list of Args to be explicitly deleted when the destructor
+ * is called. At the moment, this only includes the three default
+ * Args.
+ */
+ std::list<Arg*> _argDeleteOnExitList;
+
+ /**
+ * A list of Visitors to be explicitly deleted when the destructor
+ * is called. At the moment, these are the Visitors created for the
+ * default Args.
+ */
+ std::list<Visitor*> _visitorDeleteOnExitList;
+
+ /**
+ * Object that handles all output for the CmdLine.
+ */
+ CmdLineOutput* _output;
+
+ /**
+ * Should CmdLine handle parsing exceptions internally?
+ */
+ bool _handleExceptions;
+
+ /**
+ * Throws an exception listing the missing args.
+ */
+ void missingArgsException();
+
+ /**
+ * Checks whether a name/flag string matches entirely matches
+ * the Arg::blankChar. Used when multiple switches are combined
+ * into a single argument.
+ * \param s - The message to be used in the usage.
+ */
+ bool _emptyCombined(const std::string& s);
+
+ /**
+ * Perform a delete ptr; operation on ptr when this object is deleted.
+ */
+ void deleteOnExit(Arg* ptr);
+
+ /**
+ * Perform a delete ptr; operation on ptr when this object is deleted.
+ */
+ void deleteOnExit(Visitor* ptr);
+
+private:
+
+ /**
+ * Prevent accidental copying.
+ */
+ CmdLine(const CmdLine& rhs);
+ CmdLine& operator=(const CmdLine& rhs);
+
+ /**
+ * Encapsulates the code common to the constructors
+ * (which is all of it).
+ */
+ void _constructor();
+
+
+ /**
+ * Is set to true when a user sets the output object. We use this so
+ * that we don't delete objects that are created outside of this lib.
+ */
+ bool _userSetOutput;
+
+ /**
+ * Whether or not to automatically create help and version switches.
+ */
+ bool _helpAndVersion;
+
+ /**
+ * Whether or not to ignore unmatched args.
+ */
+ bool _ignoreUnmatched;
+
+ public:
+
+ /**
+ * Command line constructor. Defines how the arguments will be
+ * parsed.
+ * \param message - The message to be used in the usage
+ * output.
+ * \param delimiter - The character that is used to separate
+ * the argument flag/name from the value. Defaults to ' ' (space).
+ * \param version - The version number to be used in the
+ * --version switch.
+ * \param helpAndVersion - Whether or not to create the Help and
+ * Version switches. Defaults to true.
+ */
+ CmdLine(const std::string& message,
+ const char delimiter = ' ',
+ const std::string& version = "none",
+ bool helpAndVersion = true);
+
+ /**
+ * Deletes any resources allocated by a CmdLine object.
+ */
+ virtual ~CmdLine();
+
+ /**
+ * Adds an argument to the list of arguments to be parsed.
+ * \param a - Argument to be added.
+ */
+ void add( Arg& a );
+
+ /**
+ * An alternative add. Functionally identical.
+ * \param a - Argument to be added.
+ */
+ void add( Arg* a );
+
+ /**
+ * Add two Args that will be xor'd. If this method is used, add does
+ * not need to be called.
+ * \param a - Argument to be added and xor'd.
+ * \param b - Argument to be added and xor'd.
+ */
+ void xorAdd( Arg& a, Arg& b );
+
+ /**
+ * Add a list of Args that will be xor'd. If this method is used,
+ * add does not need to be called.
+ * \param xors - List of Args to be added and xor'd.
+ */
+ void xorAdd( const std::vector<Arg*>& xors );
+
+ /**
+ * Parses the command line.
+ * \param argc - Number of arguments.
+ * \param argv - Array of arguments.
+ */
+ void parse(int argc, const char * const * argv);
+
+ /**
+ * Parses the command line.
+ * \param args - A vector of strings representing the args.
+ * args[0] is still the program name.
+ */
+ void parse(std::vector<std::string>& args);
+
+ /**
+ *
+ */
+ CmdLineOutput* getOutput();
+
+ /**
+ *
+ */
+ void setOutput(CmdLineOutput* co);
+
+ /**
+ *
+ */
+ std::string& getVersion();
+
+ /**
+ *
+ */
+ std::string& getProgramName();
+
+ /**
+ *
+ */
+ std::list<Arg*>& getArgList();
+
+ /**
+ *
+ */
+ XorHandler& getXorHandler();
+
+ /**
+ *
+ */
+ char getDelimiter();
+
+ /**
+ *
+ */
+ std::string& getMessage();
+
+ /**
+ *
+ */
+ bool hasHelpAndVersion();
+
+ /**
+ * Disables or enables CmdLine's internal parsing exception handling.
+ *
+ * @param state Should CmdLine handle parsing exceptions internally?
+ */
+ void setExceptionHandling(const bool state);
+
+ /**
+ * Returns the current state of the internal exception handling.
+ *
+ * @retval true Parsing exceptions are handled internally.
+ * @retval false Parsing exceptions are propagated to the caller.
+ */
+ bool getExceptionHandling() const;
+
+ /**
+ * Allows the CmdLine object to be reused.
+ */
+ void reset();
+
+ /**
+ * Allows unmatched args to be ignored. By default false.
+ *
+ * @param ignore If true the cmdline will ignore any unmatched args
+ * and if false it will behave as normal.
+ */
+ void ignoreUnmatched(const bool ignore);
+};
+
+
+///////////////////////////////////////////////////////////////////////////////
+//Begin CmdLine.cpp
+///////////////////////////////////////////////////////////////////////////////
+
+inline CmdLine::CmdLine(const std::string& m,
+ char delim,
+ const std::string& v,
+ bool help )
+ :
+ _argList(std::list<Arg*>()),
+ _progName("not_set_yet"),
+ _message(m),
+ _version(v),
+ _numRequired(0),
+ _delimiter(delim),
+ _xorHandler(XorHandler()),
+ _argDeleteOnExitList(std::list<Arg*>()),
+ _visitorDeleteOnExitList(std::list<Visitor*>()),
+ _output(0),
+ _handleExceptions(true),
+ _userSetOutput(false),
+ _helpAndVersion(help),
+ _ignoreUnmatched(false)
+{
+ _constructor();
+}
+
+inline CmdLine::~CmdLine()
+{
+ ClearContainer(_argDeleteOnExitList);
+ ClearContainer(_visitorDeleteOnExitList);
+
+ if ( !_userSetOutput ) {
+ delete _output;
+ _output = 0;
+ }
+}
+
+inline void CmdLine::_constructor()
+{
+ _output = new StdOutput;
+
+ Arg::setDelimiter( _delimiter );
+
+ Visitor* v;
+
+ if ( _helpAndVersion )
+ {
+ v = new HelpVisitor( this, &_output );
+ SwitchArg* help = new SwitchArg("h","help",
+ "Displays usage information and exits.",
+ false, v);
+ add( help );
+ deleteOnExit(help);
+ deleteOnExit(v);
+
+ v = new VersionVisitor( this, &_output );
+ SwitchArg* vers = new SwitchArg("","version",
+ "Displays version information and exits.",
+ false, v);
+ add( vers );
+ deleteOnExit(vers);
+ deleteOnExit(v);
+ }
+
+ v = new IgnoreRestVisitor();
+ SwitchArg* ignore = new SwitchArg(Arg::flagStartString(),
+ Arg::ignoreNameString(),
+ "Ignores the rest of the labeled arguments following this flag.",
+ false, v);
+ add( ignore );
+ deleteOnExit(ignore);
+ deleteOnExit(v);
+}
+
+inline void CmdLine::xorAdd( const std::vector<Arg*>& ors )
+{
+ _xorHandler.add( ors );
+
+ for (ArgVectorIterator it = ors.begin(); it != ors.end(); it++)
+ {
+ (*it)->forceRequired();
+ (*it)->setRequireLabel( "OR required" );
+ add( *it );
+ }
+}
+
+inline void CmdLine::xorAdd( Arg& a, Arg& b )
+{
+ std::vector<Arg*> ors;
+ ors.push_back( &a );
+ ors.push_back( &b );
+ xorAdd( ors );
+}
+
+inline void CmdLine::add( Arg& a )
+{
+ add( &a );
+}
+
+inline void CmdLine::add( Arg* a )
+{
+ for( ArgListIterator it = _argList.begin(); it != _argList.end(); it++ )
+ if ( *a == *(*it) )
+ throw( SpecificationException(
+ "Argument with same flag/name already exists!",
+ a->longID() ) );
+
+ a->addToList( _argList );
+
+ if ( a->isRequired() )
+ _numRequired++;
+}
+
+
+inline void CmdLine::parse(int argc, const char * const * argv)
+{
+ // this step is necessary so that we have easy access to
+ // mutable strings.
+ std::vector<std::string> args;
+ for (int i = 0; i < argc; i++)
+ args.push_back(argv[i]);
+
+ parse(args);
+}
+
+inline void CmdLine::parse(std::vector<std::string>& args)
+{
+ bool shouldExit = false;
+ int estat = 0;
+ try {
+ if (args.empty()) {
+ // https://sourceforge.net/p/tclap/bugs/30/
+ throw CmdLineParseException("The args vector must not be empty, "
+ "the first entry should contain the "
+ "program's name.");
+ }
+
+ _progName = args.front();
+ args.erase(args.begin());
+
+ int requiredCount = 0;
+
+ for (int i = 0; static_cast<unsigned int>(i) < args.size(); i++)
+ {
+ bool matched = false;
+ for (ArgListIterator it = _argList.begin();
+ it != _argList.end(); it++) {
+ if ( (*it)->processArg( &i, args ) )
+ {
+ requiredCount += _xorHandler.check( *it );
+ matched = true;
+ break;
+ }
+ }
+
+ // checks to see if the argument is an empty combined
+ // switch and if so, then we've actually matched it
+ if ( !matched && _emptyCombined( args[i] ) )
+ matched = true;
+
+ if ( !matched && !Arg::ignoreRest() && !_ignoreUnmatched)
+ throw(CmdLineParseException("Couldn't find match "
+ "for argument",
+ args[i]));
+ }
+
+ if ( requiredCount < _numRequired )
+ missingArgsException();
+
+ if ( requiredCount > _numRequired )
+ throw(CmdLineParseException("Too many arguments!"));
+
+ } catch ( ArgException& e ) {
+ // If we're not handling the exceptions, rethrow.
+ if ( !_handleExceptions) {
+ throw;
+ }
+
+ try {
+ _output->failure(*this,e);
+ } catch ( ExitException &ee ) {
+ estat = ee.getExitStatus();
+ shouldExit = true;
+ }
+ } catch (ExitException &ee) {
+ // If we're not handling the exceptions, rethrow.
+ if ( !_handleExceptions) {
+ throw;
+ }
+
+ estat = ee.getExitStatus();
+ shouldExit = true;
+ }
+
+ if (shouldExit)
+ exit(estat);
+}
+
+inline bool CmdLine::_emptyCombined(const std::string& s)
+{
+ if ( s.length() > 0 && s[0] != Arg::flagStartChar() )
+ return false;
+
+ for ( int i = 1; static_cast<unsigned int>(i) < s.length(); i++ )
+ if ( s[i] != Arg::blankChar() )
+ return false;
+
+ return true;
+}
+
+inline void CmdLine::missingArgsException()
+{
+ int count = 0;
+
+ std::string missingArgList;
+ for (ArgListIterator it = _argList.begin(); it != _argList.end(); it++)
+ {
+ if ( (*it)->isRequired() && !(*it)->isSet() )
+ {
+ missingArgList += (*it)->getName();
+ missingArgList += ", ";
+ count++;
+ }
+ }
+ missingArgList = missingArgList.substr(0,missingArgList.length()-2);
+
+ std::string msg;
+ if ( count > 1 )
+ msg = "Required arguments missing: ";
+ else
+ msg = "Required argument missing: ";
+
+ msg += missingArgList;
+
+ throw(CmdLineParseException(msg));
+}
+
+inline void CmdLine::deleteOnExit(Arg* ptr)
+{
+ _argDeleteOnExitList.push_back(ptr);
+}
+
+inline void CmdLine::deleteOnExit(Visitor* ptr)
+{
+ _visitorDeleteOnExitList.push_back(ptr);
+}
+
+inline CmdLineOutput* CmdLine::getOutput()
+{
+ return _output;
+}
+
+inline void CmdLine::setOutput(CmdLineOutput* co)
+{
+ if ( !_userSetOutput )
+ delete _output;
+ _userSetOutput = true;
+ _output = co;
+}
+
+inline std::string& CmdLine::getVersion()
+{
+ return _version;
+}
+
+inline std::string& CmdLine::getProgramName()
+{
+ return _progName;
+}
+
+inline std::list<Arg*>& CmdLine::getArgList()
+{
+ return _argList;
+}
+
+inline XorHandler& CmdLine::getXorHandler()
+{
+ return _xorHandler;
+}
+
+inline char CmdLine::getDelimiter()
+{
+ return _delimiter;
+}
+
+inline std::string& CmdLine::getMessage()
+{
+ return _message;
+}
+
+inline bool CmdLine::hasHelpAndVersion()
+{
+ return _helpAndVersion;
+}
+
+inline void CmdLine::setExceptionHandling(const bool state)
+{
+ _handleExceptions = state;
+}
+
+inline bool CmdLine::getExceptionHandling() const
+{
+ return _handleExceptions;
+}
+
+inline void CmdLine::reset()
+{
+ for( ArgListIterator it = _argList.begin(); it != _argList.end(); it++ )
+ (*it)->reset();
+
+ _progName.clear();
+}
+
+inline void CmdLine::ignoreUnmatched(const bool ignore)
+{
+ _ignoreUnmatched = ignore;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//End CmdLine.cpp
+///////////////////////////////////////////////////////////////////////////////
+
+
+
+} //namespace TCLAP
+#endif
diff --git a/funasr/runtime/onnxruntime/include/tclap/CmdLineInterface.h b/funasr/runtime/onnxruntime/include/tclap/CmdLineInterface.h
new file mode 100644
index 0000000..a9bdca0
--- /dev/null
+++ b/funasr/runtime/onnxruntime/include/tclap/CmdLineInterface.h
@@ -0,0 +1,153 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
+
+/******************************************************************************
+ *
+ * file: CmdLineInterface.h
+ *
+ * Copyright (c) 2003, Michael E. Smoot .
+ * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
+ * Copyright (c) 2017, Google LLC
+ * All rights reserved.
+ *
+ * See the file COPYING in the top directory of this distribution for
+ * more information.
+ *
+ * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+#ifndef TCLAP_COMMANDLINE_INTERFACE_H
+#define TCLAP_COMMANDLINE_INTERFACE_H
+
+#include <string>
+#include <vector>
+#include <list>
+#include <iostream>
+#include <algorithm>
+
+
+namespace TCLAP {
+
+class Arg;
+class CmdLineOutput;
+class XorHandler;
+
+/**
+ * The base class that manages the command line definition and passes
+ * along the parsing to the appropriate Arg classes.
+ */
+class CmdLineInterface
+{
+ public:
+
+ /**
+ * Destructor
+ */
+ virtual ~CmdLineInterface() {}
+
+ /**
+ * Adds an argument to the list of arguments to be parsed.
+ * \param a - Argument to be added.
+ */
+ virtual void add( Arg& a )=0;
+
+ /**
+ * An alternative add. Functionally identical.
+ * \param a - Argument to be added.
+ */
+ virtual void add( Arg* a )=0;
+
+ /**
+ * Add two Args that will be xor'd.
+ * If this method is used, add does
+ * not need to be called.
+ * \param a - Argument to be added and xor'd.
+ * \param b - Argument to be added and xor'd.
+ */
+ virtual void xorAdd( Arg& a, Arg& b )=0;
+
+ /**
+ * Add a list of Args that will be xor'd. If this method is used,
+ * add does not need to be called.
+ * \param xors - List of Args to be added and xor'd.
+ */
+ virtual void xorAdd( const std::vector<Arg*>& xors )=0;
+
+ /**
+ * Parses the command line.
+ * \param argc - Number of arguments.
+ * \param argv - Array of arguments.
+ */
+ virtual void parse(int argc, const char * const * argv)=0;
+
+ /**
+ * Parses the command line.
+ * \param args - A vector of strings representing the args.
+ * args[0] is still the program name.
+ */
+ void parse(std::vector<std::string>& args);
+
+ /**
+ * Returns the CmdLineOutput object.
+ */
+ virtual CmdLineOutput* getOutput()=0;
+
+ /**
+ * \param co - CmdLineOutput object that we want to use instead.
+ */
+ virtual void setOutput(CmdLineOutput* co)=0;
+
+ /**
+ * Returns the version string.
+ */
+ virtual std::string& getVersion()=0;
+
+ /**
+ * Returns the program name string.
+ */
+ virtual std::string& getProgramName()=0;
+
+ /**
+ * Returns the argList.
+ */
+ virtual std::list<Arg*>& getArgList()=0;
+
+ /**
+ * Returns the XorHandler.
+ */
+ virtual XorHandler& getXorHandler()=0;
+
+ /**
+ * Returns the delimiter string.
+ */
+ virtual char getDelimiter()=0;
+
+ /**
+ * Returns the message string.
+ */
+ virtual std::string& getMessage()=0;
+
+ /**
+ * Indicates whether or not the help and version switches were created
+ * automatically.
+ */
+ virtual bool hasHelpAndVersion()=0;
+
+ /**
+ * Resets the instance as if it had just been constructed so that the
+ * instance can be reused.
+ */
+ virtual void reset()=0;
+};
+
+} //namespace
+
+
+#endif
diff --git a/funasr/runtime/onnxruntime/include/tclap/CmdLineOutput.h b/funasr/runtime/onnxruntime/include/tclap/CmdLineOutput.h
new file mode 100644
index 0000000..cbc9a32
--- /dev/null
+++ b/funasr/runtime/onnxruntime/include/tclap/CmdLineOutput.h
@@ -0,0 +1,77 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
+
+
+/******************************************************************************
+ *
+ * file: CmdLineOutput.h
+ *
+ * Copyright (c) 2004, Michael E. Smoot
+ * Copyright (c) 2017, Google LLC
+ * All rights reserved.
+ *
+ * See the file COPYING in the top directory of this distribution for
+ * more information.
+ *
+ * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+#ifndef TCLAP_CMDLINEOUTPUT_H
+#define TCLAP_CMDLINEOUTPUT_H
+
+#include <string>
+#include <vector>
+#include <list>
+#include <iostream>
+#include <iomanip>
+#include <algorithm>
+
+namespace TCLAP {
+
+class CmdLineInterface;
+class ArgException;
+
+/**
+ * The interface that any output object must implement.
+ */
+class CmdLineOutput
+{
+
+ public:
+
+ /**
+ * Virtual destructor.
+ */
+ virtual ~CmdLineOutput() {}
+
+ /**
+ * Generates some sort of output for the USAGE.
+ * \param c - The CmdLine object the output is generated for.
+ */
+ virtual void usage(CmdLineInterface& c)=0;
+
+ /**
+ * Generates some sort of output for the version.
+ * \param c - The CmdLine object the output is generated for.
+ */
+ virtual void version(CmdLineInterface& c)=0;
+
+ /**
+ * Generates some sort of output for a failure.
+ * \param c - The CmdLine object the output is generated for.
+ * \param e - The ArgException that caused the failure.
+ */
+ virtual void failure( CmdLineInterface& c,
+ ArgException& e )=0;
+
+};
+
+} //namespace TCLAP
+#endif
diff --git a/funasr/runtime/onnxruntime/include/tclap/Constraint.h b/funasr/runtime/onnxruntime/include/tclap/Constraint.h
new file mode 100644
index 0000000..ff869cc
--- /dev/null
+++ b/funasr/runtime/onnxruntime/include/tclap/Constraint.h
@@ -0,0 +1,78 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
+
+/******************************************************************************
+ *
+ * file: Constraint.h
+ *
+ * Copyright (c) 2005, Michael E. Smoot
+ * Copyright (c) 2017, Google LLC
+ * All rights reserved.
+ *
+ * See the file COPYING in the top directory of this distribution for
+ * more information.
+ *
+ * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+#ifndef TCLAP_CONSTRAINT_H
+#define TCLAP_CONSTRAINT_H
+
+#include <string>
+#include <vector>
+#include <list>
+#include <iostream>
+#include <iomanip>
+#include <algorithm>
+#include <stdexcept>
+
+namespace TCLAP {
+
+/**
+ * The interface that defines the interaction between the Arg and Constraint.
+ */
+template<class T>
+class Constraint
+{
+
+ public:
+ /**
+ * Returns a description of the Constraint.
+ */
+ virtual std::string description() const =0;
+
+ /**
+ * Returns the short ID for the Constraint.
+ */
+ virtual std::string shortID() const =0;
+
+ /**
+ * The method used to verify that the value parsed from the command
+ * line meets the constraint.
+ * \param value - The value that will be checked.
+ */
+ virtual bool check(const T& value) const =0;
+
+ /**
+ * Destructor.
+ * Silences warnings about Constraint being a base class with virtual
+ * functions but without a virtual destructor.
+ */
+ virtual ~Constraint() { ; }
+
+ static std::string shortID(Constraint<T> *constraint) {
+ if (!constraint)
+ throw std::logic_error("Cannot create a ValueArg with a NULL constraint");
+ return constraint->shortID();
+ }
+};
+
+} //namespace TCLAP
+#endif
diff --git a/funasr/runtime/onnxruntime/include/tclap/DocBookOutput.h b/funasr/runtime/onnxruntime/include/tclap/DocBookOutput.h
new file mode 100644
index 0000000..80b10e5
--- /dev/null
+++ b/funasr/runtime/onnxruntime/include/tclap/DocBookOutput.h
@@ -0,0 +1,303 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
+/******************************************************************************
+ *
+ * file: DocBookOutput.h
+ *
+ * Copyright (c) 2004, Michael E. Smoot
+ * Copyright (c) 2017, Google LLC
+ * All rights reserved.
+ *
+ * See the file COPYING in the top directory of this distribution for
+ * more information.
+ *
+ * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+#ifndef TCLAP_DOCBOOKOUTPUT_H
+#define TCLAP_DOCBOOKOUTPUT_H
+
+#include <string>
+#include <vector>
+#include <list>
+#include <iostream>
+#include <algorithm>
+
+#include <tclap/CmdLineInterface.h>
+#include <tclap/CmdLineOutput.h>
+#include <tclap/XorHandler.h>
+#include <tclap/Arg.h>
+
+namespace TCLAP {
+
+/**
+ * A class that generates DocBook output for usage() method for the
+ * given CmdLine and its Args.
+ */
+class DocBookOutput : public CmdLineOutput
+{
+
+ public:
+
+ /**
+ * Prints the usage to stdout. Can be overridden to
+ * produce alternative behavior.
+ * \param c - The CmdLine object the output is generated for.
+ */
+ virtual void usage(CmdLineInterface& c);
+
+ /**
+ * Prints the version to stdout. Can be overridden
+ * to produce alternative behavior.
+ * \param c - The CmdLine object the output is generated for.
+ */
+ virtual void version(CmdLineInterface& c);
+
+ /**
+ * Prints (to stderr) an error message, short usage
+ * Can be overridden to produce alternative behavior.
+ * \param c - The CmdLine object the output is generated for.
+ * \param e - The ArgException that caused the failure.
+ */
+ virtual void failure(CmdLineInterface& c,
+ ArgException& e );
+
+ DocBookOutput() : theDelimiter('=') {}
+ protected:
+
+ /**
+ * Substitutes the char r for string x in string s.
+ * \param s - The string to operate on.
+ * \param r - The char to replace.
+ * \param x - What to replace r with.
+ */
+ void substituteSpecialChars( std::string& s, char r, std::string& x );
+ void removeChar( std::string& s, char r);
+ void basename( std::string& s );
+
+ void printShortArg(Arg* it);
+ void printLongArg(Arg* it);
+
+ char theDelimiter;
+};
+
+
+inline void DocBookOutput::version(CmdLineInterface& _cmd)
+{
+ std::cout << _cmd.getVersion() << std::endl;
+}
+
+inline void DocBookOutput::usage(CmdLineInterface& _cmd )
+{
+ std::list<Arg*> argList = _cmd.getArgList();
+ std::string progName = _cmd.getProgramName();
+ std::string xversion = _cmd.getVersion();
+ theDelimiter = _cmd.getDelimiter();
+ XorHandler xorHandler = _cmd.getXorHandler();
+ const std::vector< std::vector<Arg*> > xorList = xorHandler.getXorList();
+ basename(progName);
+
+ std::cout << "<?xml version='1.0'?>" << std::endl;
+ std::cout << "<!DOCTYPE refentry PUBLIC \"-//OASIS//DTD DocBook XML V4.2//EN\"" << std::endl;
+ std::cout << "\t\"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd\">" << std::endl << std::endl;
+
+ std::cout << "<refentry>" << std::endl;
+
+ std::cout << "<refmeta>" << std::endl;
+ std::cout << "<refentrytitle>" << progName << "</refentrytitle>" << std::endl;
+ std::cout << "<manvolnum>1</manvolnum>" << std::endl;
+ std::cout << "</refmeta>" << std::endl;
+
+ std::cout << "<refnamediv>" << std::endl;
+ std::cout << "<refname>" << progName << "</refname>" << std::endl;
+ std::cout << "<refpurpose>" << _cmd.getMessage() << "</refpurpose>" << std::endl;
+ std::cout << "</refnamediv>" << std::endl;
+
+ std::cout << "<refsynopsisdiv>" << std::endl;
+ std::cout << "<cmdsynopsis>" << std::endl;
+
+ std::cout << "<command>" << progName << "</command>" << std::endl;
+
+ // xor
+ for ( int i = 0; (unsigned int)i < xorList.size(); i++ )
+ {
+ std::cout << "<group choice='req'>" << std::endl;
+ for ( ArgVectorIterator it = xorList[i].begin();
+ it != xorList[i].end(); it++ )
+ printShortArg((*it));
+
+ std::cout << "</group>" << std::endl;
+ }
+
+ // rest of args
+ for (ArgListIterator it = argList.begin(); it != argList.end(); it++)
+ if ( !xorHandler.contains( (*it) ) )
+ printShortArg((*it));
+
+ std::cout << "</cmdsynopsis>" << std::endl;
+ std::cout << "</refsynopsisdiv>" << std::endl;
+
+ std::cout << "<refsect1>" << std::endl;
+ std::cout << "<title>Description</title>" << std::endl;
+ std::cout << "<para>" << std::endl;
+ std::cout << _cmd.getMessage() << std::endl;
+ std::cout << "</para>" << std::endl;
+ std::cout << "</refsect1>" << std::endl;
+
+ std::cout << "<refsect1>" << std::endl;
+ std::cout << "<title>Options</title>" << std::endl;
+
+ std::cout << "<variablelist>" << std::endl;
+
+ for (ArgListIterator it = argList.begin(); it != argList.end(); it++)
+ printLongArg((*it));
+
+ std::cout << "</variablelist>" << std::endl;
+ std::cout << "</refsect1>" << std::endl;
+
+ std::cout << "<refsect1>" << std::endl;
+ std::cout << "<title>Version</title>" << std::endl;
+ std::cout << "<para>" << std::endl;
+ std::cout << xversion << std::endl;
+ std::cout << "</para>" << std::endl;
+ std::cout << "</refsect1>" << std::endl;
+
+ std::cout << "</refentry>" << std::endl;
+
+}
+
+inline void DocBookOutput::failure( CmdLineInterface& _cmd,
+ ArgException& e )
+{
+ static_cast<void>(_cmd); // unused
+ std::cout << e.what() << std::endl;
+ throw ExitException(1);
+}
+
+inline void DocBookOutput::substituteSpecialChars( std::string& s,
+ char r,
+ std::string& x )
+{
+ size_t p;
+ while ( (p = s.find_first_of(r)) != std::string::npos )
+ {
+ s.erase(p,1);
+ s.insert(p,x);
+ }
+}
+
+inline void DocBookOutput::removeChar( std::string& s, char r)
+{
+ size_t p;
+ while ( (p = s.find_first_of(r)) != std::string::npos )
+ {
+ s.erase(p,1);
+ }
+}
+
+inline void DocBookOutput::basename( std::string& s )
+{
+ size_t p = s.find_last_of('/');
+ if ( p != std::string::npos )
+ {
+ s.erase(0, p + 1);
+ }
+}
+
+inline void DocBookOutput::printShortArg(Arg* a)
+{
+ std::string lt = "<";
+ std::string gt = ">";
+
+ std::string id = a->shortID();
+ substituteSpecialChars(id,'<',lt);
+ substituteSpecialChars(id,'>',gt);
+ removeChar(id,'[');
+ removeChar(id,']');
+
+ std::string choice = "opt";
+ if ( a->isRequired() )
+ choice = "plain";
+
+ std::cout << "<arg choice='" << choice << '\'';
+ if ( a->acceptsMultipleValues() )
+ std::cout << " rep='repeat'";
+
+
+ std::cout << '>';
+ if ( !a->getFlag().empty() )
+ std::cout << a->flagStartChar() << a->getFlag();
+ else
+ std::cout << a->nameStartString() << a->getName();
+ if ( a->isValueRequired() )
+ {
+ std::string arg = a->shortID();
+ removeChar(arg,'[');
+ removeChar(arg,']');
+ removeChar(arg,'<');
+ removeChar(arg,'>');
+ removeChar(arg,'.');
+ arg.erase(0, arg.find_last_of(theDelimiter) + 1);
+ std::cout << theDelimiter;
+ std::cout << "<replaceable>" << arg << "</replaceable>";
+ }
+ std::cout << "</arg>" << std::endl;
+
+}
+
+inline void DocBookOutput::printLongArg(Arg* a)
+{
+ std::string lt = "<";
+ std::string gt = ">";
+
+ std::string desc = a->getDescription();
+ substituteSpecialChars(desc,'<',lt);
+ substituteSpecialChars(desc,'>',gt);
+
+ std::cout << "<varlistentry>" << std::endl;
+
+ if ( !a->getFlag().empty() )
+ {
+ std::cout << "<term>" << std::endl;
+ std::cout << "<option>";
+ std::cout << a->flagStartChar() << a->getFlag();
+ std::cout << "</option>" << std::endl;
+ std::cout << "</term>" << std::endl;
+ }
+
+ std::cout << "<term>" << std::endl;
+ std::cout << "<option>";
+ std::cout << a->nameStartString() << a->getName();
+ if ( a->isValueRequired() )
+ {
+ std::string arg = a->shortID();
+ removeChar(arg,'[');
+ removeChar(arg,']');
+ removeChar(arg,'<');
+ removeChar(arg,'>');
+ removeChar(arg,'.');
+ arg.erase(0, arg.find_last_of(theDelimiter) + 1);
+ std::cout << theDelimiter;
+ std::cout << "<replaceable>" << arg << "</replaceable>";
+ }
+ std::cout << "</option>" << std::endl;
+ std::cout << "</term>" << std::endl;
+
+ std::cout << "<listitem>" << std::endl;
+ std::cout << "<para>" << std::endl;
+ std::cout << desc << std::endl;
+ std::cout << "</para>" << std::endl;
+ std::cout << "</listitem>" << std::endl;
+
+ std::cout << "</varlistentry>" << std::endl;
+}
+
+} //namespace TCLAP
+#endif
diff --git a/funasr/runtime/onnxruntime/include/tclap/HelpVisitor.h b/funasr/runtime/onnxruntime/include/tclap/HelpVisitor.h
new file mode 100644
index 0000000..5ee3756
--- /dev/null
+++ b/funasr/runtime/onnxruntime/include/tclap/HelpVisitor.h
@@ -0,0 +1,78 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
+
+/******************************************************************************
+ *
+ * file: HelpVisitor.h
+ *
+ * Copyright (c) 2003, Michael E. Smoot .
+ * All rights reserved.
+ *
+ * See the file COPYING in the top directory of this distribution for
+ * more information.
+ *
+ * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+#ifndef TCLAP_HELP_VISITOR_H
+#define TCLAP_HELP_VISITOR_H
+
+#include <tclap/CmdLineInterface.h>
+#include <tclap/CmdLineOutput.h>
+#include <tclap/Visitor.h>
+
+namespace TCLAP {
+
+/**
+ * A Visitor object that calls the usage method of the given CmdLineOutput
+ * object for the specified CmdLine object.
+ */
+class HelpVisitor: public Visitor
+{
+ private:
+ /**
+ * Prevent accidental copying.
+ */
+ HelpVisitor(const HelpVisitor& rhs);
+ HelpVisitor& operator=(const HelpVisitor& rhs);
+
+ protected:
+
+ /**
+ * The CmdLine the output will be generated for.
+ */
+ CmdLineInterface* _cmd;
+
+ /**
+ * The output object.
+ */
+ CmdLineOutput** _out;
+
+ public:
+
+ /**
+ * Constructor.
+ * \param cmd - The CmdLine the output will be generated for.
+ * \param out - The type of output.
+ */
+ HelpVisitor(CmdLineInterface* cmd, CmdLineOutput** out)
+ : Visitor(), _cmd( cmd ), _out( out ) { }
+
+ /**
+ * Calls the usage method of the CmdLineOutput for the
+ * specified CmdLine.
+ */
+ void visit() { (*_out)->usage(*_cmd); throw ExitException(0); }
+
+};
+
+}
+
+#endif
diff --git a/funasr/runtime/onnxruntime/include/tclap/IgnoreRestVisitor.h b/funasr/runtime/onnxruntime/include/tclap/IgnoreRestVisitor.h
new file mode 100644
index 0000000..1824c3c
--- /dev/null
+++ b/funasr/runtime/onnxruntime/include/tclap/IgnoreRestVisitor.h
@@ -0,0 +1,54 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
+
+/******************************************************************************
+ *
+ * file: IgnoreRestVisitor.h
+ *
+ * Copyright (c) 2003, Michael E. Smoot .
+ * All rights reserved.
+ *
+ * See the file COPYING in the top directory of this distribution for
+ * more information.
+ *
+ * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+
+#ifndef TCLAP_IGNORE_REST_VISITOR_H
+#define TCLAP_IGNORE_REST_VISITOR_H
+
+#include <tclap/Visitor.h>
+#include <tclap/Arg.h>
+
+namespace TCLAP {
+
+/**
+ * A Visitor that tells the CmdLine to begin ignoring arguments after
+ * this one is parsed.
+ */
+class IgnoreRestVisitor: public Visitor
+{
+ public:
+
+ /**
+ * Constructor.
+ */
+ IgnoreRestVisitor() : Visitor() {}
+
+ /**
+ * Sets Arg::_ignoreRest.
+ */
+ void visit() { Arg::beginIgnoring(); }
+};
+
+}
+
+#endif
diff --git a/funasr/runtime/onnxruntime/include/tclap/MultiArg.h b/funasr/runtime/onnxruntime/include/tclap/MultiArg.h
new file mode 100644
index 0000000..e0df8b9
--- /dev/null
+++ b/funasr/runtime/onnxruntime/include/tclap/MultiArg.h
@@ -0,0 +1,433 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
+/******************************************************************************
+ *
+ * file: MultiArg.h
+ *
+ * Copyright (c) 2003, Michael E. Smoot .
+ * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
+ * Copyright (c) 2017, Google LLC
+ * All rights reserved.
+ *
+ * See the file COPYING in the top directory of this distribution for
+ * more information.
+ *
+ * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+
+#ifndef TCLAP_MULTIPLE_ARGUMENT_H
+#define TCLAP_MULTIPLE_ARGUMENT_H
+
+#include <string>
+#include <vector>
+
+#include <tclap/Arg.h>
+#include <tclap/Constraint.h>
+
+namespace TCLAP {
+/**
+ * An argument that allows multiple values of type T to be specified. Very
+ * similar to a ValueArg, except a vector of values will be returned
+ * instead of just one.
+ */
+template<class T>
+class MultiArg : public Arg
+{
+public:
+ typedef std::vector<T> container_type;
+ typedef typename container_type::iterator iterator;
+ typedef typename container_type::const_iterator const_iterator;
+
+protected:
+
+ /**
+ * The list of values parsed from the CmdLine.
+ */
+ std::vector<T> _values;
+
+ /**
+ * The description of type T to be used in the usage.
+ */
+ std::string _typeDesc;
+
+ /**
+ * A list of constraint on this Arg.
+ */
+ Constraint<T>* _constraint;
+
+ /**
+ * Extracts the value from the string.
+ * Attempts to parse string as type T, if this fails an exception
+ * is thrown.
+ * \param val - The string to be read.
+ */
+ void _extractValue( const std::string& val );
+
+ /**
+ * Used by XorHandler to decide whether to keep parsing for this arg.
+ */
+ bool _allowMore;
+
+public:
+
+ /**
+ * Constructor.
+ * \param flag - The one character flag that identifies this
+ * argument on the command line.
+ * \param name - A one word name for the argument. Can be
+ * used as a long flag on the command line.
+ * \param desc - A description of what the argument is for or
+ * does.
+ * \param req - Whether the argument is required on the command
+ * line.
+ * \param typeDesc - A short, human readable description of the
+ * type that this object expects. This is used in the generation
+ * of the USAGE statement. The goal is to be helpful to the end user
+ * of the program.
+ * \param v - An optional visitor. You probably should not
+ * use this unless you have a very good reason.
+ */
+ MultiArg( const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ bool req,
+ const std::string& typeDesc,
+ Visitor* v = NULL);
+
+ /**
+ * Constructor.
+ * \param flag - The one character flag that identifies this
+ * argument on the command line.
+ * \param name - A one word name for the argument. Can be
+ * used as a long flag on the command line.
+ * \param desc - A description of what the argument is for or
+ * does.
+ * \param req - Whether the argument is required on the command
+ * line.
+ * \param typeDesc - A short, human readable description of the
+ * type that this object expects. This is used in the generation
+ * of the USAGE statement. The goal is to be helpful to the end user
+ * of the program.
+ * \param parser - A CmdLine parser object to add this Arg to
+ * \param v - An optional visitor. You probably should not
+ * use this unless you have a very good reason.
+ */
+ MultiArg( const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ bool req,
+ const std::string& typeDesc,
+ CmdLineInterface& parser,
+ Visitor* v = NULL );
+
+ /**
+ * Constructor.
+ * \param flag - The one character flag that identifies this
+ * argument on the command line.
+ * \param name - A one word name for the argument. Can be
+ * used as a long flag on the command line.
+ * \param desc - A description of what the argument is for or
+ * does.
+ * \param req - Whether the argument is required on the command
+ * line.
+ * \param constraint - A pointer to a Constraint object used
+ * to constrain this Arg.
+ * \param v - An optional visitor. You probably should not
+ * use this unless you have a very good reason.
+ */
+ MultiArg( const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ bool req,
+ Constraint<T>* constraint,
+ Visitor* v = NULL );
+
+ /**
+ * Constructor.
+ * \param flag - The one character flag that identifies this
+ * argument on the command line.
+ * \param name - A one word name for the argument. Can be
+ * used as a long flag on the command line.
+ * \param desc - A description of what the argument is for or
+ * does.
+ * \param req - Whether the argument is required on the command
+ * line.
+ * \param constraint - A pointer to a Constraint object used
+ * to constrain this Arg.
+ * \param parser - A CmdLine parser object to add this Arg to
+ * \param v - An optional visitor. You probably should not
+ * use this unless you have a very good reason.
+ */
+ MultiArg( const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ bool req,
+ Constraint<T>* constraint,
+ CmdLineInterface& parser,
+ Visitor* v = NULL );
+
+ /**
+ * Handles the processing of the argument.
+ * This re-implements the Arg version of this method to set the
+ * _value of the argument appropriately. It knows the difference
+ * between labeled and unlabeled.
+ * \param i - Pointer the the current argument in the list.
+ * \param args - Mutable list of strings. Passed from main().
+ */
+ virtual bool processArg(int* i, std::vector<std::string>& args);
+
+ /**
+ * Returns a vector of type T containing the values parsed from
+ * the command line.
+ */
+ const std::vector<T>& getValue() const { return _values; }
+
+ /**
+ * Returns an iterator over the values parsed from the command
+ * line.
+ */
+ const_iterator begin() const { return _values.begin(); }
+
+ /**
+ * Returns the end of the values parsed from the command
+ * line.
+ */
+ const_iterator end() const { return _values.end(); }
+
+ /**
+ * Returns the a short id string. Used in the usage.
+ * \param val - value to be used.
+ */
+ virtual std::string shortID(const std::string& val="val") const;
+
+ /**
+ * Returns the a long id string. Used in the usage.
+ * \param val - value to be used.
+ */
+ virtual std::string longID(const std::string& val="val") const;
+
+ /**
+ * Once we've matched the first value, then the arg is no longer
+ * required.
+ */
+ virtual bool isRequired() const;
+
+ virtual bool allowMore();
+
+ virtual void reset();
+
+private:
+ /**
+ * Prevent accidental copying
+ */
+ MultiArg(const MultiArg<T>& rhs);
+ MultiArg& operator=(const MultiArg<T>& rhs);
+
+};
+
+template<class T>
+MultiArg<T>::MultiArg(const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ bool req,
+ const std::string& typeDesc,
+ Visitor* v) :
+ Arg( flag, name, desc, req, true, v ),
+ _values(std::vector<T>()),
+ _typeDesc( typeDesc ),
+ _constraint( NULL ),
+ _allowMore(false)
+{
+ _acceptsMultipleValues = true;
+}
+
+template<class T>
+MultiArg<T>::MultiArg(const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ bool req,
+ const std::string& typeDesc,
+ CmdLineInterface& parser,
+ Visitor* v)
+: Arg( flag, name, desc, req, true, v ),
+ _values(std::vector<T>()),
+ _typeDesc( typeDesc ),
+ _constraint( NULL ),
+ _allowMore(false)
+{
+ parser.add( this );
+ _acceptsMultipleValues = true;
+}
+
+/**
+ *
+ */
+template<class T>
+MultiArg<T>::MultiArg(const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ bool req,
+ Constraint<T>* constraint,
+ Visitor* v)
+: Arg( flag, name, desc, req, true, v ),
+ _values(std::vector<T>()),
+ _typeDesc( Constraint<T>::shortID(constraint) ),
+ _constraint( constraint ),
+ _allowMore(false)
+{
+ _acceptsMultipleValues = true;
+}
+
+template<class T>
+MultiArg<T>::MultiArg(const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ bool req,
+ Constraint<T>* constraint,
+ CmdLineInterface& parser,
+ Visitor* v)
+: Arg( flag, name, desc, req, true, v ),
+ _values(std::vector<T>()),
+ _typeDesc( Constraint<T>::shortID(constraint) ),
+ _constraint( constraint ),
+ _allowMore(false)
+{
+ parser.add( this );
+ _acceptsMultipleValues = true;
+}
+
+template<class T>
+bool MultiArg<T>::processArg(int *i, std::vector<std::string>& args)
+{
+ if ( _ignoreable && Arg::ignoreRest() )
+ return false;
+
+ if ( _hasBlanks( args[*i] ) )
+ return false;
+
+ std::string flag = args[*i];
+ std::string value = "";
+
+ trimFlag( flag, value );
+
+ if ( argMatches( flag ) )
+ {
+ if ( Arg::delimiter() != ' ' && value == "" )
+ throw( ArgParseException(
+ "Couldn't find delimiter for this argument!",
+ toString() ) );
+
+ // always take the first one, regardless of start string
+ if ( value == "" )
+ {
+ (*i)++;
+ if ( static_cast<unsigned int>(*i) < args.size() )
+ _extractValue( args[*i] );
+ else
+ throw( ArgParseException("Missing a value for this argument!",
+ toString() ) );
+ }
+ else
+ _extractValue( value );
+
+ /*
+ // continuing taking the args until we hit one with a start string
+ while ( (unsigned int)(*i)+1 < args.size() &&
+ args[(*i)+1].find_first_of( Arg::flagStartString() ) != 0 &&
+ args[(*i)+1].find_first_of( Arg::nameStartString() ) != 0 )
+ _extractValue( args[++(*i)] );
+ */
+
+ _alreadySet = true;
+ _checkWithVisitor();
+
+ return true;
+ }
+ else
+ return false;
+}
+
+/**
+ *
+ */
+template<class T>
+std::string MultiArg<T>::shortID(const std::string& val) const
+{
+ static_cast<void>(val); // Ignore input, don't warn
+ return Arg::shortID(_typeDesc) + " ...";
+}
+
+/**
+ *
+ */
+template<class T>
+std::string MultiArg<T>::longID(const std::string& val) const
+{
+ static_cast<void>(val); // Ignore input, don't warn
+ return Arg::longID(_typeDesc) + " (accepted multiple times)";
+}
+
+/**
+ * Once we've matched the first value, then the arg is no longer
+ * required.
+ */
+template<class T>
+bool MultiArg<T>::isRequired() const
+{
+ if ( _required )
+ {
+ if ( _values.size() > 1 )
+ return false;
+ else
+ return true;
+ }
+ else
+ return false;
+
+}
+
+template<class T>
+void MultiArg<T>::_extractValue( const std::string& val )
+{
+ try {
+ T tmp;
+ ExtractValue(tmp, val, typename ArgTraits<T>::ValueCategory());
+ _values.push_back(tmp);
+ } catch( ArgParseException &e) {
+ throw ArgParseException(e.error(), toString());
+ }
+
+ if ( _constraint != NULL )
+ if ( ! _constraint->check( _values.back() ) )
+ throw( CmdLineParseException( "Value '" + val +
+ "' does not meet constraint: " +
+ _constraint->description(),
+ toString() ) );
+}
+
+template<class T>
+bool MultiArg<T>::allowMore()
+{
+ bool am = _allowMore;
+ _allowMore = true;
+ return am;
+}
+
+template<class T>
+void MultiArg<T>::reset()
+{
+ Arg::reset();
+ _values.clear();
+}
+
+} // namespace TCLAP
+
+#endif
diff --git a/funasr/runtime/onnxruntime/include/tclap/MultiSwitchArg.h b/funasr/runtime/onnxruntime/include/tclap/MultiSwitchArg.h
new file mode 100644
index 0000000..e333ea7
--- /dev/null
+++ b/funasr/runtime/onnxruntime/include/tclap/MultiSwitchArg.h
@@ -0,0 +1,217 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
+
+/******************************************************************************
+*
+* file: MultiSwitchArg.h
+*
+* Copyright (c) 2003, Michael E. Smoot .
+* Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
+* Copyright (c) 2005, Michael E. Smoot, Daniel Aarno, Erik Zeek.
+* Copyright (c) 2017, Google LLC
+* All rights reserved.
+*
+* See the file COPYING in the top directory of this distribution for
+* more information.
+*
+* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+* DEALINGS IN THE SOFTWARE.
+*
+*****************************************************************************/
+
+
+#ifndef TCLAP_MULTI_SWITCH_ARG_H
+#define TCLAP_MULTI_SWITCH_ARG_H
+
+#include <string>
+#include <vector>
+
+#include <tclap/SwitchArg.h>
+
+namespace TCLAP {
+
+/**
+* A multiple switch argument. If the switch is set on the command line, then
+* the getValue method will return the number of times the switch appears.
+*/
+class MultiSwitchArg : public SwitchArg
+{
+ protected:
+
+ /**
+ * The value of the switch.
+ */
+ int _value;
+
+ /**
+ * Used to support the reset() method so that ValueArg can be
+ * reset to their constructed value.
+ */
+ int _default;
+
+ public:
+
+ /**
+ * MultiSwitchArg constructor.
+ * \param flag - The one character flag that identifies this
+ * argument on the command line.
+ * \param name - A one word name for the argument. Can be
+ * used as a long flag on the command line.
+ * \param desc - A description of what the argument is for or
+ * does.
+ * \param init - Optional. The initial/default value of this Arg.
+ * Defaults to 0.
+ * \param v - An optional visitor. You probably should not
+ * use this unless you have a very good reason.
+ */
+ MultiSwitchArg(const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ int init = 0,
+ Visitor* v = NULL);
+
+
+ /**
+ * MultiSwitchArg constructor.
+ * \param flag - The one character flag that identifies this
+ * argument on the command line.
+ * \param name - A one word name for the argument. Can be
+ * used as a long flag on the command line.
+ * \param desc - A description of what the argument is for or
+ * does.
+ * \param parser - A CmdLine parser object to add this Arg to
+ * \param init - Optional. The initial/default value of this Arg.
+ * Defaults to 0.
+ * \param v - An optional visitor. You probably should not
+ * use this unless you have a very good reason.
+ */
+ MultiSwitchArg(const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ CmdLineInterface& parser,
+ int init = 0,
+ Visitor* v = NULL);
+
+
+ /**
+ * Handles the processing of the argument.
+ * This re-implements the SwitchArg version of this method to set the
+ * _value of the argument appropriately.
+ * \param i - Pointer the the current argument in the list.
+ * \param args - Mutable list of strings. Passed
+ * in from main().
+ */
+ virtual bool processArg(int* i, std::vector<std::string>& args);
+
+ /**
+ * Returns int, the number of times the switch has been set.
+ */
+ int getValue() const { return _value; }
+
+ /**
+ * Returns the shortID for this Arg.
+ */
+ std::string shortID(const std::string& val) const;
+
+ /**
+ * Returns the longID for this Arg.
+ */
+ std::string longID(const std::string& val) const;
+
+ void reset();
+
+};
+
+//////////////////////////////////////////////////////////////////////
+//BEGIN MultiSwitchArg.cpp
+//////////////////////////////////////////////////////////////////////
+inline MultiSwitchArg::MultiSwitchArg(const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ int init,
+ Visitor* v )
+: SwitchArg(flag, name, desc, false, v),
+_value( init ),
+_default( init )
+{ }
+
+inline MultiSwitchArg::MultiSwitchArg(const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ CmdLineInterface& parser,
+ int init,
+ Visitor* v )
+: SwitchArg(flag, name, desc, false, v),
+_value( init ),
+_default( init )
+{
+ parser.add( this );
+}
+
+inline bool MultiSwitchArg::processArg(int *i, std::vector<std::string>& args)
+{
+ if ( _ignoreable && Arg::ignoreRest() )
+ return false;
+
+ if ( argMatches( args[*i] ))
+ {
+ // so the isSet() method will work
+ _alreadySet = true;
+
+ // Matched argument: increment value.
+ ++_value;
+
+ _checkWithVisitor();
+
+ return true;
+ }
+ else if ( combinedSwitchesMatch( args[*i] ) )
+ {
+ // so the isSet() method will work
+ _alreadySet = true;
+
+ // Matched argument: increment value.
+ ++_value;
+
+ // Check for more in argument and increment value.
+ while ( combinedSwitchesMatch( args[*i] ) )
+ ++_value;
+
+ _checkWithVisitor();
+
+ return false;
+ }
+ else
+ return false;
+}
+
+inline std::string
+MultiSwitchArg::shortID(const std::string& val) const
+{
+ return Arg::shortID(val) + " ...";
+}
+
+inline std::string
+MultiSwitchArg::longID(const std::string& val) const
+{
+ return Arg::longID(val) + " (accepted multiple times)";
+}
+
+inline void
+MultiSwitchArg::reset()
+{
+ MultiSwitchArg::_value = MultiSwitchArg::_default;
+}
+
+//////////////////////////////////////////////////////////////////////
+//END MultiSwitchArg.cpp
+//////////////////////////////////////////////////////////////////////
+
+} //namespace TCLAP
+
+#endif
diff --git a/funasr/runtime/onnxruntime/include/tclap/OptionalUnlabeledTracker.h b/funasr/runtime/onnxruntime/include/tclap/OptionalUnlabeledTracker.h
new file mode 100644
index 0000000..aa64116
--- /dev/null
+++ b/funasr/runtime/onnxruntime/include/tclap/OptionalUnlabeledTracker.h
@@ -0,0 +1,64 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
+
+
+/******************************************************************************
+ *
+ * file: OptionalUnlabeledTracker.h
+ *
+ * Copyright (c) 2005, Michael E. Smoot .
+ * All rights reserved.
+ *
+ * See the file COPYING in the top directory of this distribution for
+ * more information.
+ *
+ * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+
+#ifndef TCLAP_OPTIONAL_UNLABELED_TRACKER_H
+#define TCLAP_OPTIONAL_UNLABELED_TRACKER_H
+
+#include <string>
+
+namespace TCLAP {
+
+class OptionalUnlabeledTracker
+{
+
+ public:
+
+ static void check( bool req, const std::string& argName );
+
+ static void gotOptional() { alreadyOptionalRef() = true; }
+
+ static bool& alreadyOptional() { return alreadyOptionalRef(); }
+
+ private:
+
+ static bool& alreadyOptionalRef() { static bool ct = false; return ct; }
+};
+
+
+inline void OptionalUnlabeledTracker::check( bool req, const std::string& argName )
+{
+ if ( OptionalUnlabeledTracker::alreadyOptional() )
+ throw( SpecificationException(
+ "You can't specify ANY Unlabeled Arg following an optional Unlabeled Arg",
+ argName ) );
+
+ if ( !req )
+ OptionalUnlabeledTracker::gotOptional();
+}
+
+
+} // namespace TCLAP
+
+#endif
diff --git a/funasr/runtime/onnxruntime/include/tclap/StandardTraits.h b/funasr/runtime/onnxruntime/include/tclap/StandardTraits.h
new file mode 100644
index 0000000..5864f77
--- /dev/null
+++ b/funasr/runtime/onnxruntime/include/tclap/StandardTraits.h
@@ -0,0 +1,63 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
+/******************************************************************************
+ *
+ * file: StandardTraits.h
+ *
+ * Copyright (c) 2007, Daniel Aarno, Michael E. Smoot .
+ * Copyright (c) 2017, Google LLC
+ * All rights reserved.
+ *
+ * See the file COPYING in the top directory of this distribution for
+ * more information.
+ *
+ * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+// This is an internal tclap file, you should probably not have to
+// include this directly
+
+#ifndef TCLAP_STANDARD_TRAITS_H
+#define TCLAP_STANDARD_TRAITS_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h> // To check for long long
+#endif
+
+// If Microsoft has already typedef'd wchar_t as an unsigned
+// short, then compiles will break because it's as if we're
+// creating ArgTraits twice for unsigned short. Thus...
+#ifdef _MSC_VER
+#ifndef _NATIVE_WCHAR_T_DEFINED
+#define TCLAP_DONT_DECLARE_WCHAR_T_ARGTRAITS
+#endif
+#endif
+
+namespace TCLAP {
+
+// Integer types (signed, unsigned and bool) and floating point types all
+// have value-like semantics.
+
+// Strings have string like argument traits.
+template<>
+struct ArgTraits<std::string> {
+ typedef StringLike ValueCategory;
+};
+
+template<typename T>
+void SetString(T &dst, const std::string &src)
+{
+ dst = src;
+}
+
+} // namespace
+
+#endif
+
diff --git a/funasr/runtime/onnxruntime/include/tclap/StdOutput.h b/funasr/runtime/onnxruntime/include/tclap/StdOutput.h
new file mode 100644
index 0000000..cfef79a
--- /dev/null
+++ b/funasr/runtime/onnxruntime/include/tclap/StdOutput.h
@@ -0,0 +1,300 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
+/******************************************************************************
+ *
+ * file: StdOutput.h
+ *
+ * Copyright (c) 2004, Michael E. Smoot
+ * Copyright (c) 2017, Google LLC
+ * All rights reserved.
+ *
+ * See the file COPYING in the top directory of this distribution for
+ * more information.
+ *
+ * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+#ifndef TCLAP_STDCMDLINEOUTPUT_H
+#define TCLAP_STDCMDLINEOUTPUT_H
+
+#include <string>
+#include <vector>
+#include <list>
+#include <iostream>
+#include <algorithm>
+
+#include <tclap/CmdLineInterface.h>
+#include <tclap/CmdLineOutput.h>
+#include <tclap/XorHandler.h>
+#include <tclap/Arg.h>
+
+namespace TCLAP {
+
+/**
+ * A class that isolates any output from the CmdLine object so that it
+ * may be easily modified.
+ */
+class StdOutput : public CmdLineOutput
+{
+
+ public:
+
+ /**
+ * Prints the usage to stdout. Can be overridden to
+ * produce alternative behavior.
+ * \param c - The CmdLine object the output is generated for.
+ */
+ virtual void usage(CmdLineInterface& c);
+
+ /**
+ * Prints the version to stdout. Can be overridden
+ * to produce alternative behavior.
+ * \param c - The CmdLine object the output is generated for.
+ */
+ virtual void version(CmdLineInterface& c);
+
+ /**
+ * Prints (to stderr) an error message, short usage
+ * Can be overridden to produce alternative behavior.
+ * \param c - The CmdLine object the output is generated for.
+ * \param e - The ArgException that caused the failure.
+ */
+ virtual void failure(CmdLineInterface& c,
+ ArgException& e );
+
+ protected:
+
+ /**
+ * Writes a brief usage message with short args.
+ * \param c - The CmdLine object the output is generated for.
+ * \param os - The stream to write the message to.
+ */
+ void _shortUsage( CmdLineInterface& c, std::ostream& os ) const;
+
+ /**
+ * Writes a longer usage message with long and short args,
+ * provides descriptions and prints message.
+ * \param c - The CmdLine object the output is generated for.
+ * \param os - The stream to write the message to.
+ */
+ void _longUsage( CmdLineInterface& c, std::ostream& os ) const;
+
+ /**
+ * This function inserts line breaks and indents long strings
+ * according the params input. It will only break lines at spaces,
+ * commas and pipes.
+ * \param os - The stream to be printed to.
+ * \param s - The string to be printed.
+ * \param maxWidth - The maxWidth allowed for the output line.
+ * \param indentSpaces - The number of spaces to indent the first line.
+ * \param secondLineOffset - The number of spaces to indent the second
+ * and all subsequent lines in addition to indentSpaces.
+ */
+ void spacePrint( std::ostream& os,
+ const std::string& s,
+ int maxWidth,
+ int indentSpaces,
+ int secondLineOffset ) const;
+
+};
+
+
+inline void StdOutput::version(CmdLineInterface& _cmd)
+{
+ std::string progName = _cmd.getProgramName();
+ std::string xversion = _cmd.getVersion();
+
+ std::cout << std::endl << progName << " version: "
+ << xversion << std::endl << std::endl;
+}
+
+inline void StdOutput::usage(CmdLineInterface& _cmd )
+{
+ std::cout << std::endl << "USAGE: " << std::endl << std::endl;
+
+ _shortUsage( _cmd, std::cout );
+
+ std::cout << std::endl << std::endl << "Where: " << std::endl << std::endl;
+
+ _longUsage( _cmd, std::cout );
+
+ std::cout << std::endl;
+
+}
+
+inline void StdOutput::failure( CmdLineInterface& _cmd,
+ ArgException& e )
+{
+ std::string progName = _cmd.getProgramName();
+
+ std::cerr << "PARSE ERROR: " << e.argId() << std::endl
+ << " " << e.error() << std::endl << std::endl;
+
+ if ( _cmd.hasHelpAndVersion() )
+ {
+ std::cerr << "Brief USAGE: " << std::endl;
+
+ _shortUsage( _cmd, std::cerr );
+
+ std::cerr << std::endl << "For complete USAGE and HELP type: "
+ << std::endl << " " << progName << " "
+ << Arg::nameStartString() << "help"
+ << std::endl << std::endl;
+ }
+ else
+ usage(_cmd);
+
+ throw ExitException(1);
+}
+
+inline void
+StdOutput::_shortUsage( CmdLineInterface& _cmd,
+ std::ostream& os ) const
+{
+ std::list<Arg*> argList = _cmd.getArgList();
+ std::string progName = _cmd.getProgramName();
+ XorHandler xorHandler = _cmd.getXorHandler();
+ std::vector< std::vector<Arg*> > xorList = xorHandler.getXorList();
+
+ std::string s = progName + " ";
+
+ // first the xor
+ for ( int i = 0; static_cast<unsigned int>(i) < xorList.size(); i++ )
+ {
+ s += " {";
+ for ( ArgVectorIterator it = xorList[i].begin();
+ it != xorList[i].end(); it++ )
+ s += (*it)->shortID() + "|";
+
+ s[s.length()-1] = '}';
+ }
+
+ // then the rest
+ for (ArgListIterator it = argList.begin(); it != argList.end(); it++)
+ if ( !xorHandler.contains( (*it) ) )
+ s += " " + (*it)->shortID();
+
+ // if the program name is too long, then adjust the second line offset
+ int secondLineOffset = static_cast<int>(progName.length()) + 2;
+ if ( secondLineOffset > 75/2 )
+ secondLineOffset = static_cast<int>(75/2);
+
+ spacePrint( os, s, 75, 3, secondLineOffset );
+}
+
+inline void
+StdOutput::_longUsage( CmdLineInterface& _cmd,
+ std::ostream& os ) const
+{
+ std::list<Arg*> argList = _cmd.getArgList();
+ std::string message = _cmd.getMessage();
+ XorHandler xorHandler = _cmd.getXorHandler();
+ std::vector< std::vector<Arg*> > xorList = xorHandler.getXorList();
+
+ // first the xor
+ for ( int i = 0; static_cast<unsigned int>(i) < xorList.size(); i++ )
+ {
+ for ( ArgVectorIterator it = xorList[i].begin();
+ it != xorList[i].end();
+ it++ )
+ {
+ spacePrint( os, (*it)->longID(), 75, 3, 3 );
+ spacePrint( os, (*it)->getDescription(), 75, 5, 0 );
+
+ if ( it+1 != xorList[i].end() )
+ spacePrint(os, "-- OR --", 75, 9, 0);
+ }
+ os << std::endl << std::endl;
+ }
+
+ // then the rest
+ for (ArgListIterator it = argList.begin(); it != argList.end(); it++)
+ if ( !xorHandler.contains( (*it) ) )
+ {
+ spacePrint( os, (*it)->longID(), 75, 3, 3 );
+ spacePrint( os, (*it)->getDescription(), 75, 5, 0 );
+ os << std::endl;
+ }
+
+ os << std::endl;
+
+ spacePrint( os, message, 75, 3, 0 );
+}
+
+inline void StdOutput::spacePrint( std::ostream& os,
+ const std::string& s,
+ int maxWidth,
+ int indentSpaces,
+ int secondLineOffset ) const
+{
+ int len = static_cast<int>(s.length());
+
+ if ( (len + indentSpaces > maxWidth) && maxWidth > 0 )
+ {
+ int allowedLen = maxWidth - indentSpaces;
+ int start = 0;
+ while ( start < len )
+ {
+ // find the substring length
+ // int stringLen = std::min<int>( len - start, allowedLen );
+ // doing it this way to support a VisualC++ 2005 bug
+ using namespace std;
+ int stringLen = min<int>( len - start, allowedLen );
+
+ // trim the length so it doesn't end in middle of a word
+ if ( stringLen == allowedLen )
+ while ( stringLen >= 0 &&
+ s[stringLen+start] != ' ' &&
+ s[stringLen+start] != ',' &&
+ s[stringLen+start] != '|' )
+ stringLen--;
+
+ // ok, the word is longer than the line, so just split
+ // wherever the line ends
+ if ( stringLen <= 0 )
+ stringLen = allowedLen;
+
+ // check for newlines
+ for ( int i = 0; i < stringLen; i++ )
+ if ( s[start+i] == '\n' )
+ stringLen = i+1;
+
+ // print the indent
+ for ( int i = 0; i < indentSpaces; i++ )
+ os << " ";
+
+ if ( start == 0 )
+ {
+ // handle second line offsets
+ indentSpaces += secondLineOffset;
+
+ // adjust allowed len
+ allowedLen -= secondLineOffset;
+ }
+
+ os << s.substr(start,stringLen) << std::endl;
+
+ // so we don't start a line with a space
+ while ( s[stringLen+start] == ' ' && start < len )
+ start++;
+
+ start += stringLen;
+ }
+ }
+ else
+ {
+ for ( int i = 0; i < indentSpaces; i++ )
+ os << " ";
+ os << s << std::endl;
+ }
+}
+
+} //namespace TCLAP
+#endif
diff --git a/funasr/runtime/onnxruntime/include/tclap/SwitchArg.h b/funasr/runtime/onnxruntime/include/tclap/SwitchArg.h
new file mode 100644
index 0000000..4ca130d
--- /dev/null
+++ b/funasr/runtime/onnxruntime/include/tclap/SwitchArg.h
@@ -0,0 +1,273 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
+/******************************************************************************
+ *
+ * file: SwitchArg.h
+ *
+ * Copyright (c) 2003, Michael E. Smoot .
+ * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
+ * Copyright (c) 2017, Google LLC
+ * All rights reserved.
+ *
+ * See the file COPYING in the top directory of this distribution for
+ * more information.
+ *
+ * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+
+#ifndef TCLAP_SWITCH_ARG_H
+#define TCLAP_SWITCH_ARG_H
+
+#include <string>
+#include <vector>
+
+#include <tclap/Arg.h>
+
+namespace TCLAP {
+
+/**
+ * A simple switch argument. If the switch is set on the command line, then
+ * the getValue method will return the opposite of the default value for the
+ * switch.
+ */
+class SwitchArg : public Arg
+{
+protected:
+
+ /**
+ * The value of the switch.
+ */
+ bool _value;
+
+ /**
+ * Used to support the reset() method so that ValueArg can be
+ * reset to their constructed value.
+ */
+ bool _default;
+
+public:
+
+ /**
+ * SwitchArg constructor.
+ * \param flag - The one character flag that identifies this
+ * argument on the command line.
+ * \param name - A one word name for the argument. Can be
+ * used as a long flag on the command line.
+ * \param desc - A description of what the argument is for or
+ * does.
+ * \param def - The default value for this Switch.
+ * \param v - An optional visitor. You probably should not
+ * use this unless you have a very good reason.
+ */
+ SwitchArg(const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ bool def = false,
+ Visitor* v = NULL);
+
+
+ /**
+ * SwitchArg constructor.
+ * \param flag - The one character flag that identifies this
+ * argument on the command line.
+ * \param name - A one word name for the argument. Can be
+ * used as a long flag on the command line.
+ * \param desc - A description of what the argument is for or
+ * does.
+ * \param parser - A CmdLine parser object to add this Arg to
+ * \param def - The default value for this Switch.
+ * \param v - An optional visitor. You probably should not
+ * use this unless you have a very good reason.
+ */
+ SwitchArg(const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ CmdLineInterface& parser,
+ bool def = false,
+ Visitor* v = NULL);
+
+
+ /**
+ * Handles the processing of the argument.
+ * This re-implements the Arg version of this method to set the
+ * _value of the argument appropriately.
+ * \param i - Pointer the the current argument in the list.
+ * \param args - Mutable list of strings. Passed
+ * in from main().
+ */
+ virtual bool processArg(int* i, std::vector<std::string>& args);
+
+ /**
+ * Checks a string to see if any of the chars in the string
+ * match the flag for this Switch.
+ */
+ bool combinedSwitchesMatch(std::string& combined);
+
+ /**
+ * Returns bool, whether or not the switch has been set.
+ */
+ bool getValue() const { return _value; }
+
+ /**
+ * A SwitchArg can be used as a boolean, indicating
+ * whether or not the switch has been set. This is the
+ * same as calling getValue()
+ */
+ operator bool() const { return _value; }
+
+ virtual void reset();
+
+private:
+ /**
+ * Checks to see if we've found the last match in
+ * a combined string.
+ */
+ bool lastCombined(std::string& combined);
+
+ /**
+ * Does the common processing of processArg.
+ */
+ void commonProcessing();
+};
+
+//////////////////////////////////////////////////////////////////////
+//BEGIN SwitchArg.cpp
+//////////////////////////////////////////////////////////////////////
+inline SwitchArg::SwitchArg(const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ bool default_val,
+ Visitor* v )
+ : Arg(flag, name, desc, false, false, v),
+ _value( default_val ),
+ _default( default_val )
+{ }
+
+inline SwitchArg::SwitchArg(const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ CmdLineInterface& parser,
+ bool default_val,
+ Visitor* v )
+ : Arg(flag, name, desc, false, false, v),
+ _value( default_val ),
+ _default(default_val)
+{
+ parser.add( this );
+}
+
+inline bool SwitchArg::lastCombined(std::string& combinedSwitches )
+{
+ for ( unsigned int i = 1; i < combinedSwitches.length(); i++ )
+ if ( combinedSwitches[i] != Arg::blankChar() )
+ return false;
+
+ return true;
+}
+
+inline bool SwitchArg::combinedSwitchesMatch(std::string& combinedSwitches )
+{
+ // make sure this is actually a combined switch
+ if ( combinedSwitches.length() > 0 &&
+ combinedSwitches[0] != Arg::flagStartString()[0] )
+ return false;
+
+ // make sure it isn't a long name
+ if ( combinedSwitches.substr( 0, Arg::nameStartString().length() ) ==
+ Arg::nameStartString() )
+ return false;
+
+ // make sure the delimiter isn't in the string
+ if ( combinedSwitches.find_first_of(Arg::delimiter()) != std::string::npos)
+ return false;
+
+ // ok, we're not specifying a ValueArg, so we know that we have
+ // a combined switch list.
+ for ( unsigned int i = 1; i < combinedSwitches.length(); i++ )
+ if ( _flag.length() > 0 &&
+ combinedSwitches[i] == _flag[0] &&
+ _flag[0] != Arg::flagStartString()[0] )
+ {
+ // update the combined switches so this one is no longer present
+ // this is necessary so that no unlabeled args are matched
+ // later in the processing.
+ //combinedSwitches.erase(i,1);
+ combinedSwitches[i] = Arg::blankChar();
+ return true;
+ }
+
+ // none of the switches passed in the list match.
+ return false;
+}
+
+inline void SwitchArg::commonProcessing()
+{
+ if ( _xorSet )
+ throw(CmdLineParseException(
+ "Mutually exclusive argument already set!", toString()));
+
+ if ( _alreadySet )
+ throw(CmdLineParseException("Argument already set!", toString()));
+
+ _alreadySet = true;
+
+ if ( _value == true )
+ _value = false;
+ else
+ _value = true;
+
+ _checkWithVisitor();
+}
+
+inline bool SwitchArg::processArg(int *i, std::vector<std::string>& args)
+{
+ if ( _ignoreable && Arg::ignoreRest() )
+ return false;
+
+ // if the whole string matches the flag or name string
+ if ( argMatches( args[*i] ) )
+ {
+ commonProcessing();
+
+ return true;
+ }
+ // if a substring matches the flag as part of a combination
+ else if ( combinedSwitchesMatch( args[*i] ) )
+ {
+ // check again to ensure we don't misinterpret
+ // this as a MultiSwitchArg
+ if ( combinedSwitchesMatch( args[*i] ) )
+ throw(CmdLineParseException("Argument already set!",
+ toString()));
+
+ commonProcessing();
+
+ // We only want to return true if we've found the last combined
+ // match in the string, otherwise we return true so that other
+ // switches in the combination will have a chance to match.
+ return lastCombined( args[*i] );
+ }
+ else
+ return false;
+}
+
+inline void SwitchArg::reset()
+{
+ Arg::reset();
+ _value = _default;
+}
+//////////////////////////////////////////////////////////////////////
+//End SwitchArg.cpp
+//////////////////////////////////////////////////////////////////////
+
+} //namespace TCLAP
+
+#endif
diff --git a/funasr/runtime/onnxruntime/include/tclap/UnlabeledMultiArg.h b/funasr/runtime/onnxruntime/include/tclap/UnlabeledMultiArg.h
new file mode 100644
index 0000000..48feb84
--- /dev/null
+++ b/funasr/runtime/onnxruntime/include/tclap/UnlabeledMultiArg.h
@@ -0,0 +1,304 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
+
+/******************************************************************************
+ *
+ * file: UnlabeledMultiArg.h
+ *
+ * Copyright (c) 2003, Michael E. Smoot.
+ * Copyright (c) 2017, Google LLC
+ * All rights reserved.
+ *
+ * See the file COPYING in the top directory of this distribution for
+ * more information.
+ *
+ * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+
+#ifndef TCLAP_MULTIPLE_UNLABELED_ARGUMENT_H
+#define TCLAP_MULTIPLE_UNLABELED_ARGUMENT_H
+
+#include <string>
+#include <vector>
+
+#include <tclap/MultiArg.h>
+#include <tclap/OptionalUnlabeledTracker.h>
+
+namespace TCLAP {
+
+/**
+ * Just like a MultiArg, except that the arguments are unlabeled. Basically,
+ * this Arg will slurp up everything that hasn't been matched to another
+ * Arg.
+ */
+template<class T>
+class UnlabeledMultiArg : public MultiArg<T>
+{
+
+ // If compiler has two stage name lookup (as gcc >= 3.4 does)
+ // this is required to prevent undef. symbols
+ using MultiArg<T>::_ignoreable;
+ using MultiArg<T>::_hasBlanks;
+ using MultiArg<T>::_extractValue;
+ using MultiArg<T>::_typeDesc;
+ using MultiArg<T>::_name;
+ using MultiArg<T>::_description;
+ using MultiArg<T>::_alreadySet;
+ using MultiArg<T>::toString;
+
+ public:
+
+ /**
+ * Constructor.
+ * \param name - The name of the Arg. Note that this is used for
+ * identification, not as a long flag.
+ * \param desc - A description of what the argument is for or
+ * does.
+ * \param req - Whether the argument is required on the command
+ * line.
+ * \param typeDesc - A short, human readable description of the
+ * type that this object expects. This is used in the generation
+ * of the USAGE statement. The goal is to be helpful to the end user
+ * of the program.
+ * \param ignoreable - Whether or not this argument can be ignored
+ * using the "--" flag.
+ * \param v - An optional visitor. You probably should not
+ * use this unless you have a very good reason.
+ */
+ UnlabeledMultiArg( const std::string& name,
+ const std::string& desc,
+ bool req,
+ const std::string& typeDesc,
+ bool ignoreable = false,
+ Visitor* v = NULL );
+ /**
+ * Constructor.
+ * \param name - The name of the Arg. Note that this is used for
+ * identification, not as a long flag.
+ * \param desc - A description of what the argument is for or
+ * does.
+ * \param req - Whether the argument is required on the command
+ * line.
+ * \param typeDesc - A short, human readable description of the
+ * type that this object expects. This is used in the generation
+ * of the USAGE statement. The goal is to be helpful to the end user
+ * of the program.
+ * \param parser - A CmdLine parser object to add this Arg to
+ * \param ignoreable - Whether or not this argument can be ignored
+ * using the "--" flag.
+ * \param v - An optional visitor. You probably should not
+ * use this unless you have a very good reason.
+ */
+ UnlabeledMultiArg( const std::string& name,
+ const std::string& desc,
+ bool req,
+ const std::string& typeDesc,
+ CmdLineInterface& parser,
+ bool ignoreable = false,
+ Visitor* v = NULL );
+
+ /**
+ * Constructor.
+ * \param name - The name of the Arg. Note that this is used for
+ * identification, not as a long flag.
+ * \param desc - A description of what the argument is for or
+ * does.
+ * \param req - Whether the argument is required on the command
+ * line.
+ * \param constraint - A pointer to a Constraint object used
+ * to constrain this Arg.
+ * \param ignoreable - Whether or not this argument can be ignored
+ * using the "--" flag.
+ * \param v - An optional visitor. You probably should not
+ * use this unless you have a very good reason.
+ */
+ UnlabeledMultiArg( const std::string& name,
+ const std::string& desc,
+ bool req,
+ Constraint<T>* constraint,
+ bool ignoreable = false,
+ Visitor* v = NULL );
+
+ /**
+ * Constructor.
+ * \param name - The name of the Arg. Note that this is used for
+ * identification, not as a long flag.
+ * \param desc - A description of what the argument is for or
+ * does.
+ * \param req - Whether the argument is required on the command
+ * line.
+ * \param constraint - A pointer to a Constraint object used
+ * to constrain this Arg.
+ * \param parser - A CmdLine parser object to add this Arg to
+ * \param ignoreable - Whether or not this argument can be ignored
+ * using the "--" flag.
+ * \param v - An optional visitor. You probably should not
+ * use this unless you have a very good reason.
+ */
+ UnlabeledMultiArg( const std::string& name,
+ const std::string& desc,
+ bool req,
+ Constraint<T>* constraint,
+ CmdLineInterface& parser,
+ bool ignoreable = false,
+ Visitor* v = NULL );
+
+ /**
+ * Handles the processing of the argument.
+ * This re-implements the Arg version of this method to set the
+ * _value of the argument appropriately. It knows the difference
+ * between labeled and unlabeled.
+ * \param i - Pointer the the current argument in the list.
+ * \param args - Mutable list of strings. Passed from main().
+ */
+ virtual bool processArg(int* i, std::vector<std::string>& args);
+
+ /**
+ * Returns the a short id string. Used in the usage.
+ * \param val - value to be used.
+ */
+ virtual std::string shortID(const std::string& val="val") const;
+
+ /**
+ * Returns the a long id string. Used in the usage.
+ * \param val - value to be used.
+ */
+ virtual std::string longID(const std::string& val="val") const;
+
+ /**
+ * Operator ==.
+ * \param a - The Arg to be compared to this.
+ */
+ virtual bool operator==(const Arg& a) const;
+
+ /**
+ * Pushes this to back of list rather than front.
+ * \param argList - The list this should be added to.
+ */
+ virtual void addToList( std::list<Arg*>& argList ) const;
+};
+
+template<class T>
+UnlabeledMultiArg<T>::UnlabeledMultiArg(const std::string& name,
+ const std::string& desc,
+ bool req,
+ const std::string& typeDesc,
+ bool ignoreable,
+ Visitor* v)
+: MultiArg<T>("", name, desc, req, typeDesc, v)
+{
+ _ignoreable = ignoreable;
+ OptionalUnlabeledTracker::check(true, toString());
+}
+
+template<class T>
+UnlabeledMultiArg<T>::UnlabeledMultiArg(const std::string& name,
+ const std::string& desc,
+ bool req,
+ const std::string& typeDesc,
+ CmdLineInterface& parser,
+ bool ignoreable,
+ Visitor* v)
+: MultiArg<T>("", name, desc, req, typeDesc, v)
+{
+ _ignoreable = ignoreable;
+ OptionalUnlabeledTracker::check(true, toString());
+ parser.add( this );
+}
+
+
+template<class T>
+UnlabeledMultiArg<T>::UnlabeledMultiArg(const std::string& name,
+ const std::string& desc,
+ bool req,
+ Constraint<T>* constraint,
+ bool ignoreable,
+ Visitor* v)
+: MultiArg<T>("", name, desc, req, constraint, v)
+{
+ _ignoreable = ignoreable;
+ OptionalUnlabeledTracker::check(true, toString());
+}
+
+template<class T>
+UnlabeledMultiArg<T>::UnlabeledMultiArg(const std::string& name,
+ const std::string& desc,
+ bool req,
+ Constraint<T>* constraint,
+ CmdLineInterface& parser,
+ bool ignoreable,
+ Visitor* v)
+: MultiArg<T>("", name, desc, req, constraint, v)
+{
+ _ignoreable = ignoreable;
+ OptionalUnlabeledTracker::check(true, toString());
+ parser.add( this );
+}
+
+
+template<class T>
+bool UnlabeledMultiArg<T>::processArg(int *i, std::vector<std::string>& args)
+{
+
+ if ( _hasBlanks( args[*i] ) )
+ return false;
+
+ // never ignore an unlabeled multi arg
+
+
+ // always take the first value, regardless of the start string
+ _extractValue( args[(*i)] );
+
+ /*
+ // continue taking args until we hit the end or a start string
+ while ( (unsigned int)(*i)+1 < args.size() &&
+ args[(*i)+1].find_first_of( Arg::flagStartString() ) != 0 &&
+ args[(*i)+1].find_first_of( Arg::nameStartString() ) != 0 )
+ _extractValue( args[++(*i)] );
+ */
+
+ _alreadySet = true;
+
+ return true;
+}
+
+template<class T>
+std::string UnlabeledMultiArg<T>::shortID(const std::string& val) const
+{
+ static_cast<void>(val); // Ignore input, don't warn
+ return std::string("<") + _typeDesc + "> ...";
+}
+
+template<class T>
+std::string UnlabeledMultiArg<T>::longID(const std::string& val) const
+{
+ static_cast<void>(val); // Ignore input, don't warn
+ return std::string("<") + _typeDesc + "> (accepted multiple times)";
+}
+
+template<class T>
+bool UnlabeledMultiArg<T>::operator==(const Arg& a) const
+{
+ if ( _name == a.getName() || _description == a.getDescription() )
+ return true;
+ else
+ return false;
+}
+
+template<class T>
+void UnlabeledMultiArg<T>::addToList( std::list<Arg*>& argList ) const
+{
+ argList.push_back( const_cast<Arg*>(static_cast<const Arg* const>(this)) );
+}
+
+}
+
+#endif
diff --git a/funasr/runtime/onnxruntime/include/tclap/UnlabeledValueArg.h b/funasr/runtime/onnxruntime/include/tclap/UnlabeledValueArg.h
new file mode 100644
index 0000000..341a3c0
--- /dev/null
+++ b/funasr/runtime/onnxruntime/include/tclap/UnlabeledValueArg.h
@@ -0,0 +1,343 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
+
+/******************************************************************************
+ *
+ * file: UnlabeledValueArg.h
+ *
+ * Copyright (c) 2003, Michael E. Smoot .
+ * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
+ * Copyright (c) 2017, Google LLC
+ * All rights reserved.
+ *
+ * See the file COPYING in the top directory of this distribution for
+ * more information.
+ *
+ * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+
+#ifndef TCLAP_UNLABELED_VALUE_ARGUMENT_H
+#define TCLAP_UNLABELED_VALUE_ARGUMENT_H
+
+#include <string>
+#include <vector>
+
+#include <tclap/ValueArg.h>
+#include <tclap/OptionalUnlabeledTracker.h>
+
+
+namespace TCLAP {
+
+/**
+ * The basic unlabeled argument that parses a value.
+ * This is a template class, which means the type T defines the type
+ * that a given object will attempt to parse when an UnlabeledValueArg
+ * is reached in the list of args that the CmdLine iterates over.
+ */
+template<class T>
+class UnlabeledValueArg : public ValueArg<T>
+{
+
+ // If compiler has two stage name lookup (as gcc >= 3.4 does)
+ // this is required to prevent undef. symbols
+ using ValueArg<T>::_ignoreable;
+ using ValueArg<T>::_hasBlanks;
+ using ValueArg<T>::_extractValue;
+ using ValueArg<T>::_typeDesc;
+ using ValueArg<T>::_name;
+ using ValueArg<T>::_description;
+ using ValueArg<T>::_alreadySet;
+ using ValueArg<T>::toString;
+
+ public:
+
+ /**
+ * UnlabeledValueArg constructor.
+ * \param name - A one word name for the argument. Note that this is used for
+ * identification, not as a long flag.
+ * \param desc - A description of what the argument is for or
+ * does.
+ * \param req - Whether the argument is required on the command
+ * line.
+ * \param value - The default value assigned to this argument if it
+ * is not present on the command line.
+ * \param typeDesc - A short, human readable description of the
+ * type that this object expects. This is used in the generation
+ * of the USAGE statement. The goal is to be helpful to the end user
+ * of the program.
+ * \param ignoreable - Allows you to specify that this argument can be
+ * ignored if the '--' flag is set. This defaults to false (cannot
+ * be ignored) and should generally stay that way unless you have
+ * some special need for certain arguments to be ignored.
+ * \param v - Optional Visitor. You should leave this blank unless
+ * you have a very good reason.
+ */
+ UnlabeledValueArg( const std::string& name,
+ const std::string& desc,
+ bool req,
+ T value,
+ const std::string& typeDesc,
+ bool ignoreable = false,
+ Visitor* v = NULL);
+
+ /**
+ * UnlabeledValueArg constructor.
+ * \param name - A one word name for the argument. Note that this is used for
+ * identification, not as a long flag.
+ * \param desc - A description of what the argument is for or
+ * does.
+ * \param req - Whether the argument is required on the command
+ * line.
+ * \param value - The default value assigned to this argument if it
+ * is not present on the command line.
+ * \param typeDesc - A short, human readable description of the
+ * type that this object expects. This is used in the generation
+ * of the USAGE statement. The goal is to be helpful to the end user
+ * of the program.
+ * \param parser - A CmdLine parser object to add this Arg to
+ * \param ignoreable - Allows you to specify that this argument can be
+ * ignored if the '--' flag is set. This defaults to false (cannot
+ * be ignored) and should generally stay that way unless you have
+ * some special need for certain arguments to be ignored.
+ * \param v - Optional Visitor. You should leave this blank unless
+ * you have a very good reason.
+ */
+ UnlabeledValueArg( const std::string& name,
+ const std::string& desc,
+ bool req,
+ T value,
+ const std::string& typeDesc,
+ CmdLineInterface& parser,
+ bool ignoreable = false,
+ Visitor* v = NULL );
+
+ /**
+ * UnlabeledValueArg constructor.
+ * \param name - A one word name for the argument. Note that this is used for
+ * identification, not as a long flag.
+ * \param desc - A description of what the argument is for or
+ * does.
+ * \param req - Whether the argument is required on the command
+ * line.
+ * \param value - The default value assigned to this argument if it
+ * is not present on the command line.
+ * \param constraint - A pointer to a Constraint object used
+ * to constrain this Arg.
+ * \param ignoreable - Allows you to specify that this argument can be
+ * ignored if the '--' flag is set. This defaults to false (cannot
+ * be ignored) and should generally stay that way unless you have
+ * some special need for certain arguments to be ignored.
+ * \param v - Optional Visitor. You should leave this blank unless
+ * you have a very good reason.
+ */
+ UnlabeledValueArg( const std::string& name,
+ const std::string& desc,
+ bool req,
+ T value,
+ Constraint<T>* constraint,
+ bool ignoreable = false,
+ Visitor* v = NULL );
+
+
+ /**
+ * UnlabeledValueArg constructor.
+ * \param name - A one word name for the argument. Note that this is used for
+ * identification, not as a long flag.
+ * \param desc - A description of what the argument is for or
+ * does.
+ * \param req - Whether the argument is required on the command
+ * line.
+ * \param value - The default value assigned to this argument if it
+ * is not present on the command line.
+ * \param constraint - A pointer to a Constraint object used
+ * to constrain this Arg.
+ * \param parser - A CmdLine parser object to add this Arg to
+ * \param ignoreable - Allows you to specify that this argument can be
+ * ignored if the '--' flag is set. This defaults to false (cannot
+ * be ignored) and should generally stay that way unless you have
+ * some special need for certain arguments to be ignored.
+ * \param v - Optional Visitor. You should leave this blank unless
+ * you have a very good reason.
+ */
+ UnlabeledValueArg( const std::string& name,
+ const std::string& desc,
+ bool req,
+ T value,
+ Constraint<T>* constraint,
+ CmdLineInterface& parser,
+ bool ignoreable = false,
+ Visitor* v = NULL);
+
+ /**
+ * Handles the processing of the argument.
+ * This re-implements the Arg version of this method to set the
+ * _value of the argument appropriately. Handling specific to
+ * unlabeled arguments.
+ * \param i - Pointer the the current argument in the list.
+ * \param args - Mutable list of strings.
+ */
+ virtual bool processArg(int* i, std::vector<std::string>& args);
+
+ /**
+ * Overrides shortID for specific behavior.
+ */
+ virtual std::string shortID(const std::string& val="val") const;
+
+ /**
+ * Overrides longID for specific behavior.
+ */
+ virtual std::string longID(const std::string& val="val") const;
+
+ /**
+ * Overrides operator== for specific behavior.
+ */
+ virtual bool operator==(const Arg& a ) const;
+
+ /**
+ * Instead of pushing to the front of list, push to the back.
+ * \param argList - The list to add this to.
+ */
+ virtual void addToList( std::list<Arg*>& argList ) const;
+
+};
+
+/**
+ * Constructor implementation.
+ */
+template<class T>
+UnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name,
+ const std::string& desc,
+ bool req,
+ T val,
+ const std::string& typeDesc,
+ bool ignoreable,
+ Visitor* v)
+: ValueArg<T>("", name, desc, req, val, typeDesc, v)
+{
+ _ignoreable = ignoreable;
+
+ OptionalUnlabeledTracker::check(req, toString());
+
+}
+
+template<class T>
+UnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name,
+ const std::string& desc,
+ bool req,
+ T val,
+ const std::string& typeDesc,
+ CmdLineInterface& parser,
+ bool ignoreable,
+ Visitor* v)
+: ValueArg<T>("", name, desc, req, val, typeDesc, v)
+{
+ _ignoreable = ignoreable;
+ OptionalUnlabeledTracker::check(req, toString());
+ parser.add( this );
+}
+
+/**
+ * Constructor implementation.
+ */
+template<class T>
+UnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name,
+ const std::string& desc,
+ bool req,
+ T val,
+ Constraint<T>* constraint,
+ bool ignoreable,
+ Visitor* v)
+: ValueArg<T>("", name, desc, req, val, constraint, v)
+{
+ _ignoreable = ignoreable;
+ OptionalUnlabeledTracker::check(req, toString());
+}
+
+template<class T>
+UnlabeledValueArg<T>::UnlabeledValueArg(const std::string& name,
+ const std::string& desc,
+ bool req,
+ T val,
+ Constraint<T>* constraint,
+ CmdLineInterface& parser,
+ bool ignoreable,
+ Visitor* v)
+: ValueArg<T>("", name, desc, req, val, constraint, v)
+{
+ _ignoreable = ignoreable;
+ OptionalUnlabeledTracker::check(req, toString());
+ parser.add( this );
+}
+
+/**
+ * Implementation of processArg().
+ */
+template<class T>
+bool UnlabeledValueArg<T>::processArg(int *i, std::vector<std::string>& args)
+{
+
+ if ( _alreadySet )
+ return false;
+
+ if ( _hasBlanks( args[*i] ) )
+ return false;
+
+ // never ignore an unlabeled arg
+
+ _extractValue( args[*i] );
+ _alreadySet = true;
+ return true;
+}
+
+/**
+ * Overriding shortID for specific output.
+ */
+template<class T>
+std::string UnlabeledValueArg<T>::shortID(const std::string& val) const
+{
+ static_cast<void>(val); // Ignore input, don't warn
+ return std::string("<") + _typeDesc + ">";
+}
+
+/**
+ * Overriding longID for specific output.
+ */
+template<class T>
+std::string UnlabeledValueArg<T>::longID(const std::string& val) const
+{
+ static_cast<void>(val); // Ignore input, don't warn
+
+ // Ideally we would like to be able to use RTTI to return the name
+ // of the type required for this argument. However, g++ at least,
+ // doesn't appear to return terribly useful "names" of the types.
+ return std::string("<") + _typeDesc + ">";
+}
+
+/**
+ * Overriding operator== for specific behavior.
+ */
+template<class T>
+bool UnlabeledValueArg<T>::operator==(const Arg& a ) const
+{
+ if ( _name == a.getName() || _description == a.getDescription() )
+ return true;
+ else
+ return false;
+}
+
+template<class T>
+void UnlabeledValueArg<T>::addToList( std::list<Arg*>& argList ) const
+{
+ argList.push_back( const_cast<Arg*>(static_cast<const Arg* const>(this)) );
+}
+
+}
+#endif
diff --git a/funasr/runtime/onnxruntime/include/tclap/ValueArg.h b/funasr/runtime/onnxruntime/include/tclap/ValueArg.h
new file mode 100644
index 0000000..791d93f
--- /dev/null
+++ b/funasr/runtime/onnxruntime/include/tclap/ValueArg.h
@@ -0,0 +1,430 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
+/******************************************************************************
+ *
+ * file: ValueArg.h
+ *
+ * Copyright (c) 2003, Michael E. Smoot .
+ * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
+ * Copyright (c) 2017, Google LLC
+ * All rights reserved.
+ *
+ * See the file COPYING in the top directory of this distribution for
+ * more information.
+ *
+ * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+
+#ifndef TCLAP_VALUE_ARGUMENT_H
+#define TCLAP_VALUE_ARGUMENT_H
+
+#include <string>
+#include <vector>
+
+#include <tclap/Arg.h>
+#include <tclap/Constraint.h>
+
+namespace TCLAP {
+
+/**
+ * The basic labeled argument that parses a value.
+ * This is a template class, which means the type T defines the type
+ * that a given object will attempt to parse when the flag/name is matched
+ * on the command line. While there is nothing stopping you from creating
+ * an unflagged ValueArg, it is unwise and would cause significant problems.
+ * Instead use an UnlabeledValueArg.
+ */
+template<class T>
+class ValueArg : public Arg
+{
+protected:
+
+ /**
+ * The value parsed from the command line.
+ * Can be of any type, as long as the >> operator for the type
+ * is defined.
+ */
+ T _value;
+
+ /**
+ * Used to support the reset() method so that ValueArg can be
+ * reset to their constructed value.
+ */
+ T _default;
+
+ /**
+ * A human readable description of the type to be parsed.
+ * This is a hack, plain and simple. Ideally we would use RTTI to
+ * return the name of type T, but until there is some sort of
+ * consistent support for human readable names, we are left to our
+ * own devices.
+ */
+ std::string _typeDesc;
+
+ /**
+ * A Constraint this Arg must conform to.
+ */
+ Constraint<T>* _constraint;
+
+ /**
+ * Extracts the value from the string.
+ * Attempts to parse string as type T, if this fails an exception
+ * is thrown.
+ * \param val - value to be parsed.
+ */
+ void _extractValue( const std::string& val );
+
+public:
+
+ /**
+ * Labeled ValueArg constructor.
+ * You could conceivably call this constructor with a blank flag,
+ * but that would make you a bad person. It would also cause
+ * an exception to be thrown. If you want an unlabeled argument,
+ * use the other constructor.
+ * \param flag - The one character flag that identifies this
+ * argument on the command line.
+ * \param name - A one word name for the argument. Can be
+ * used as a long flag on the command line.
+ * \param desc - A description of what the argument is for or
+ * does.
+ * \param req - Whether the argument is required on the command
+ * line.
+ * \param value - The default value assigned to this argument if it
+ * is not present on the command line.
+ * \param typeDesc - A short, human readable description of the
+ * type that this object expects. This is used in the generation
+ * of the USAGE statement. The goal is to be helpful to the end user
+ * of the program.
+ * \param v - An optional visitor. You probably should not
+ * use this unless you have a very good reason.
+ */
+ ValueArg( const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ bool req,
+ T value,
+ const std::string& typeDesc,
+ Visitor* v = NULL);
+
+
+ /**
+ * Labeled ValueArg constructor.
+ * You could conceivably call this constructor with a blank flag,
+ * but that would make you a bad person. It would also cause
+ * an exception to be thrown. If you want an unlabeled argument,
+ * use the other constructor.
+ * \param flag - The one character flag that identifies this
+ * argument on the command line.
+ * \param name - A one word name for the argument. Can be
+ * used as a long flag on the command line.
+ * \param desc - A description of what the argument is for or
+ * does.
+ * \param req - Whether the argument is required on the command
+ * line.
+ * \param value - The default value assigned to this argument if it
+ * is not present on the command line.
+ * \param typeDesc - A short, human readable description of the
+ * type that this object expects. This is used in the generation
+ * of the USAGE statement. The goal is to be helpful to the end user
+ * of the program.
+ * \param parser - A CmdLine parser object to add this Arg to
+ * \param v - An optional visitor. You probably should not
+ * use this unless you have a very good reason.
+ */
+ ValueArg( const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ bool req,
+ T value,
+ const std::string& typeDesc,
+ CmdLineInterface& parser,
+ Visitor* v = NULL );
+
+ /**
+ * Labeled ValueArg constructor.
+ * You could conceivably call this constructor with a blank flag,
+ * but that would make you a bad person. It would also cause
+ * an exception to be thrown. If you want an unlabeled argument,
+ * use the other constructor.
+ * \param flag - The one character flag that identifies this
+ * argument on the command line.
+ * \param name - A one word name for the argument. Can be
+ * used as a long flag on the command line.
+ * \param desc - A description of what the argument is for or
+ * does.
+ * \param req - Whether the argument is required on the command
+ * line.
+ * \param value - The default value assigned to this argument if it
+ * is not present on the command line.
+ * \param constraint - A pointer to a Constraint object used
+ * to constrain this Arg.
+ * \param parser - A CmdLine parser object to add this Arg to.
+ * \param v - An optional visitor. You probably should not
+ * use this unless you have a very good reason.
+ */
+ ValueArg( const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ bool req,
+ T value,
+ Constraint<T>* constraint,
+ CmdLineInterface& parser,
+ Visitor* v = NULL );
+
+ /**
+ * Labeled ValueArg constructor.
+ * You could conceivably call this constructor with a blank flag,
+ * but that would make you a bad person. It would also cause
+ * an exception to be thrown. If you want an unlabeled argument,
+ * use the other constructor.
+ * \param flag - The one character flag that identifies this
+ * argument on the command line.
+ * \param name - A one word name for the argument. Can be
+ * used as a long flag on the command line.
+ * \param desc - A description of what the argument is for or
+ * does.
+ * \param req - Whether the argument is required on the command
+ * line.
+ * \param value - The default value assigned to this argument if it
+ * is not present on the command line.
+ * \param constraint - A pointer to a Constraint object used
+ * to constrain this Arg.
+ * \param v - An optional visitor. You probably should not
+ * use this unless you have a very good reason.
+ */
+ ValueArg( const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ bool req,
+ T value,
+ Constraint<T>* constraint,
+ Visitor* v = NULL );
+
+ /**
+ * Handles the processing of the argument.
+ * This re-implements the Arg version of this method to set the
+ * _value of the argument appropriately. It knows the difference
+ * between labeled and unlabeled.
+ * \param i - Pointer the the current argument in the list.
+ * \param args - Mutable list of strings. Passed
+ * in from main().
+ */
+ virtual bool processArg(int* i, std::vector<std::string>& args);
+
+ /**
+ * Returns the value of the argument.
+ */
+ const T& getValue() const { return _value; }
+
+ // TODO(macbishop): Non-const variant is deprecated, don't
+ // use. Remove in next major.
+ T& getValue() { return _value; }
+
+ /**
+ * A ValueArg can be used as as its value type (T) This is the
+ * same as calling getValue()
+ */
+ operator const T&() const { return getValue(); }
+
+ /**
+ * Specialization of shortID.
+ * \param val - value to be used.
+ */
+ virtual std::string shortID(const std::string& val = "val") const;
+
+ /**
+ * Specialization of longID.
+ * \param val - value to be used.
+ */
+ virtual std::string longID(const std::string& val = "val") const;
+
+ virtual void reset() ;
+
+private:
+ /**
+ * Prevent accidental copying
+ */
+ ValueArg(const ValueArg<T>& rhs);
+ ValueArg& operator=(const ValueArg<T>& rhs);
+};
+
+
+/**
+ * Constructor implementation.
+ */
+template<class T>
+ValueArg<T>::ValueArg(const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ bool req,
+ T val,
+ const std::string& typeDesc,
+ Visitor* v)
+ : Arg(flag, name, desc, req, true, v),
+ _value( val ),
+ _default( val ),
+ _typeDesc( typeDesc ),
+ _constraint( NULL )
+{ }
+
+template<class T>
+ValueArg<T>::ValueArg(const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ bool req,
+ T val,
+ const std::string& typeDesc,
+ CmdLineInterface& parser,
+ Visitor* v)
+ : Arg(flag, name, desc, req, true, v),
+ _value( val ),
+ _default( val ),
+ _typeDesc( typeDesc ),
+ _constraint( NULL )
+{
+ parser.add( this );
+}
+
+template<class T>
+ValueArg<T>::ValueArg(const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ bool req,
+ T val,
+ Constraint<T>* constraint,
+ Visitor* v)
+ : Arg(flag, name, desc, req, true, v),
+ _value( val ),
+ _default( val ),
+ _typeDesc( Constraint<T>::shortID(constraint) ),
+ _constraint( constraint )
+{ }
+
+template<class T>
+ValueArg<T>::ValueArg(const std::string& flag,
+ const std::string& name,
+ const std::string& desc,
+ bool req,
+ T val,
+ Constraint<T>* constraint,
+ CmdLineInterface& parser,
+ Visitor* v)
+ : Arg(flag, name, desc, req, true, v),
+ _value( val ),
+ _default( val ),
+ _typeDesc( Constraint<T>::shortID(constraint) ), // TODO(macbishop): Will crash
+ // if constraint is NULL
+ _constraint( constraint )
+{
+ parser.add( this );
+}
+
+/**
+ * Implementation of processArg().
+ */
+template<class T>
+bool ValueArg<T>::processArg(int *i, std::vector<std::string>& args)
+{
+ if ( _ignoreable && Arg::ignoreRest() )
+ return false;
+
+ if ( _hasBlanks( args[*i] ) )
+ return false;
+
+ std::string flag = args[*i];
+
+ std::string value = "";
+ trimFlag( flag, value );
+
+ if ( argMatches( flag ) )
+ {
+ if ( _alreadySet )
+ {
+ if ( _xorSet )
+ throw( CmdLineParseException("Mutually exclusive argument"
+ " already set!", toString()));
+ else
+ throw( CmdLineParseException("Argument already set!",
+ toString()) );
+ }
+
+ if ( Arg::delimiter() != ' ' && value == "" )
+ throw( ArgParseException("Couldn't find delimiter for this argument!",
+ toString() ) );
+
+ if ( value == "" )
+ {
+ (*i)++;
+ if ( static_cast<unsigned int>(*i) < args.size() )
+ _extractValue( args[*i] );
+ else
+ throw( ArgParseException("Missing a value for this argument!",
+ toString() ) );
+ }
+ else
+ _extractValue( value );
+
+ _alreadySet = true;
+ _checkWithVisitor();
+ return true;
+ }
+ else
+ return false;
+}
+
+/**
+ * Implementation of shortID.
+ */
+template<class T>
+std::string ValueArg<T>::shortID(const std::string& val) const
+{
+ static_cast<void>(val); // Ignore input, don't warn
+ return Arg::shortID( _typeDesc );
+}
+
+/**
+ * Implementation of longID.
+ */
+template<class T>
+std::string ValueArg<T>::longID(const std::string& val) const
+{
+ static_cast<void>(val); // Ignore input, don't warn
+ return Arg::longID( _typeDesc );
+}
+
+template<class T>
+void ValueArg<T>::_extractValue( const std::string& val )
+{
+ try {
+ ExtractValue(_value, val, typename ArgTraits<T>::ValueCategory());
+ } catch( ArgParseException &e) {
+ throw ArgParseException(e.error(), toString());
+ }
+
+ if ( _constraint != NULL )
+ if ( ! _constraint->check( _value ) )
+ throw( CmdLineParseException( "Value '" + val +
+ + "' does not meet constraint: "
+ + _constraint->description(),
+ toString() ) );
+}
+
+template<class T>
+void ValueArg<T>::reset()
+{
+ Arg::reset();
+ _value = _default;
+}
+
+} // namespace TCLAP
+
+#endif
diff --git a/funasr/runtime/onnxruntime/include/tclap/ValuesConstraint.h b/funasr/runtime/onnxruntime/include/tclap/ValuesConstraint.h
new file mode 100644
index 0000000..9851432
--- /dev/null
+++ b/funasr/runtime/onnxruntime/include/tclap/ValuesConstraint.h
@@ -0,0 +1,134 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
+
+
+/******************************************************************************
+ *
+ * file: ValuesConstraint.h
+ *
+ * Copyright (c) 2005, Michael E. Smoot
+ * Copyright (c) 2017, Google LLC
+ * All rights reserved.
+ *
+ * See the file COPYING in the top directory of this distribution for
+ * more information.
+ *
+ * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+#ifndef TCLAP_VALUESCONSTRAINT_H
+#define TCLAP_VALUESCONSTRAINT_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string>
+#include <vector>
+#include <tclap/Constraint.h>
+#include <tclap/sstream.h>
+
+namespace TCLAP {
+
+/**
+ * A Constraint that constrains the Arg to only those values specified
+ * in the constraint.
+ */
+template<class T>
+class ValuesConstraint : public Constraint<T>
+{
+
+ public:
+
+ /**
+ * Constructor.
+ * \param allowed - vector of allowed values.
+ */
+ ValuesConstraint(std::vector<T>const& allowed);
+
+ /**
+ * Virtual destructor.
+ */
+ virtual ~ValuesConstraint() {}
+
+ /**
+ * Returns a description of the Constraint.
+ */
+ virtual std::string description() const;
+
+ /**
+ * Returns the short ID for the Constraint.
+ */
+ virtual std::string shortID() const;
+
+ /**
+ * The method used to verify that the value parsed from the command
+ * line meets the constraint.
+ * \param value - The value that will be checked.
+ */
+ virtual bool check(const T& value) const;
+
+ protected:
+
+ /**
+ * The list of valid values.
+ */
+ std::vector<T> _allowed;
+
+ /**
+ * The string used to describe the allowed values of this constraint.
+ */
+ std::string _typeDesc;
+
+};
+
+template<class T>
+ValuesConstraint<T>::ValuesConstraint(std::vector<T> const& allowed)
+: _allowed(allowed),
+ _typeDesc("")
+{
+ for ( unsigned int i = 0; i < _allowed.size(); i++ )
+ {
+ std::ostringstream os;
+ os << _allowed[i];
+
+ std::string temp( os.str() );
+
+ if ( i > 0 )
+ _typeDesc += "|";
+ _typeDesc += temp;
+ }
+}
+
+template<class T>
+bool ValuesConstraint<T>::check( const T& val ) const
+{
+ if ( std::find(_allowed.begin(),_allowed.end(),val) == _allowed.end() )
+ return false;
+ else
+ return true;
+}
+
+template<class T>
+std::string ValuesConstraint<T>::shortID() const
+{
+ return _typeDesc;
+}
+
+template<class T>
+std::string ValuesConstraint<T>::description() const
+{
+ return _typeDesc;
+}
+
+
+} //namespace TCLAP
+#endif
+
diff --git a/funasr/runtime/onnxruntime/include/tclap/VersionVisitor.h b/funasr/runtime/onnxruntime/include/tclap/VersionVisitor.h
new file mode 100644
index 0000000..3ef8b58
--- /dev/null
+++ b/funasr/runtime/onnxruntime/include/tclap/VersionVisitor.h
@@ -0,0 +1,81 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
+/******************************************************************************
+ *
+ * file: VersionVisitor.h
+ *
+ * Copyright (c) 2003, Michael E. Smoot .
+ * All rights reserved.
+ *
+ * See the file COPYING in the top directory of this distribution for
+ * more information.
+ *
+ * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+
+#ifndef TCLAP_VERSION_VISITOR_H
+#define TCLAP_VERSION_VISITOR_H
+
+#include <tclap/CmdLineInterface.h>
+#include <tclap/CmdLineOutput.h>
+#include <tclap/Visitor.h>
+
+namespace TCLAP {
+
+/**
+ * A Visitor that will call the version method of the given CmdLineOutput
+ * for the specified CmdLine object and then exit.
+ */
+class VersionVisitor: public Visitor
+{
+ private:
+ /**
+ * Prevent accidental copying
+ */
+ VersionVisitor(const VersionVisitor& rhs);
+ VersionVisitor& operator=(const VersionVisitor& rhs);
+
+ protected:
+
+ /**
+ * The CmdLine of interest.
+ */
+ CmdLineInterface* _cmd;
+
+ /**
+ * The output object.
+ */
+ CmdLineOutput** _out;
+
+ public:
+
+ /**
+ * Constructor.
+ * \param cmd - The CmdLine the output is generated for.
+ * \param out - The type of output.
+ */
+ VersionVisitor( CmdLineInterface* cmd, CmdLineOutput** out )
+ : Visitor(), _cmd( cmd ), _out( out ) { }
+
+ /**
+ * Calls the version method of the output object using the
+ * specified CmdLine.
+ */
+ void visit() {
+ (*_out)->version(*_cmd);
+ throw ExitException(0);
+ }
+
+};
+
+}
+
+#endif
diff --git a/funasr/runtime/onnxruntime/include/tclap/Visitor.h b/funasr/runtime/onnxruntime/include/tclap/Visitor.h
new file mode 100644
index 0000000..2a7bfd1
--- /dev/null
+++ b/funasr/runtime/onnxruntime/include/tclap/Visitor.h
@@ -0,0 +1,57 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
+
+/******************************************************************************
+ *
+ * file: Visitor.h
+ *
+ * Copyright (c) 2003, Michael E. Smoot .
+ * Copyright (c) 2017, Google LLC
+ * All rights reserved.
+ *
+ * See the file COPYING in the top directory of this distribution for
+ * more information.
+ *
+ * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+
+#ifndef TCLAP_VISITOR_H
+#define TCLAP_VISITOR_H
+
+namespace TCLAP {
+
+/**
+ * A base class that defines the interface for visitors.
+ */
+class Visitor
+{
+ public:
+
+ /**
+ * Constructor. Does nothing.
+ */
+ Visitor() { }
+
+ /**
+ * Destructor. Does nothing.
+ */
+ virtual ~Visitor() { }
+
+ /**
+ * This method (to implemented by children) will be
+ * called when the visitor is visited.
+ */
+ virtual void visit() = 0;
+};
+
+}
+
+#endif
diff --git a/funasr/runtime/onnxruntime/include/tclap/XorHandler.h b/funasr/runtime/onnxruntime/include/tclap/XorHandler.h
new file mode 100644
index 0000000..e80f9ee
--- /dev/null
+++ b/funasr/runtime/onnxruntime/include/tclap/XorHandler.h
@@ -0,0 +1,168 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
+
+/******************************************************************************
+ *
+ * file: XorHandler.h
+ *
+ * Copyright (c) 2003, Michael E. Smoot .
+ * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
+ * All rights reserved.
+ *
+ * See the file COPYING in the top directory of this distribution for
+ * more information.
+ *
+ * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+#ifndef TCLAP_XORHANDLER_H
+#define TCLAP_XORHANDLER_H
+
+#include <tclap/Arg.h>
+#include <string>
+#include <vector>
+#include <algorithm>
+#include <iostream>
+
+namespace TCLAP {
+
+/**
+ * This class handles lists of Arg's that are to be XOR'd on the command
+ * line. This is used by CmdLine and you shouldn't ever use it.
+ */
+class XorHandler
+{
+ protected:
+
+ /**
+ * The list of of lists of Arg's to be or'd together.
+ */
+ std::vector< std::vector<Arg*> > _orList;
+
+ public:
+
+ /**
+ * Constructor. Does nothing.
+ */
+ XorHandler( ) : _orList(std::vector< std::vector<Arg*> >()) {}
+
+ /**
+ * Add a list of Arg*'s that will be xor'd together.
+ * \param ors - list of Arg* that will be xor'd.
+ */
+ void add( const std::vector<Arg*>& ors );
+
+ /**
+ * Checks whether the specified Arg is in one of the xor lists and
+ * if it does match one, returns the size of the xor list that the
+ * Arg matched. If the Arg matches, then it also sets the rest of
+ * the Arg's in the list. You shouldn't use this.
+ * \param a - The Arg to be checked.
+ */
+ int check( const Arg* a );
+
+ /**
+ * Returns the XOR specific short usage.
+ */
+ std::string shortUsage();
+
+ /**
+ * Prints the XOR specific long usage.
+ * \param os - Stream to print to.
+ */
+ void printLongUsage(std::ostream& os);
+
+ /**
+ * Simply checks whether the Arg is contained in one of the arg
+ * lists.
+ * \param a - The Arg to be checked.
+ */
+ bool contains( const Arg* a );
+
+ const std::vector< std::vector<Arg*> >& getXorList() const;
+
+};
+
+
+//////////////////////////////////////////////////////////////////////
+//BEGIN XOR.cpp
+//////////////////////////////////////////////////////////////////////
+inline void XorHandler::add( const std::vector<Arg*>& ors )
+{
+ _orList.push_back( ors );
+}
+
+inline int XorHandler::check( const Arg* a )
+{
+ // iterate over each XOR list
+ for ( int i = 0; static_cast<unsigned int>(i) < _orList.size(); i++ )
+ {
+ // if the XOR list contains the arg..
+ ArgVectorIterator ait = std::find( _orList[i].begin(),
+ _orList[i].end(), a );
+ if ( ait != _orList[i].end() )
+ {
+ // first check to see if a mutually exclusive switch
+ // has not already been set
+ for ( ArgVectorIterator it = _orList[i].begin();
+ it != _orList[i].end();
+ it++ )
+ if ( a != (*it) && (*it)->isSet() )
+ throw(CmdLineParseException(
+ "Mutually exclusive argument already set!",
+ (*it)->toString()));
+
+ // go through and set each arg that is not a
+ for ( ArgVectorIterator it = _orList[i].begin();
+ it != _orList[i].end();
+ it++ )
+ if ( a != (*it) )
+ (*it)->xorSet();
+
+ // return the number of required args that have now been set
+ if ( (*ait)->allowMore() )
+ return 0;
+ else
+ return static_cast<int>(_orList[i].size());
+ }
+ }
+
+ if ( a->isRequired() )
+ return 1;
+ else
+ return 0;
+}
+
+inline bool XorHandler::contains( const Arg* a )
+{
+ for ( int i = 0; static_cast<unsigned int>(i) < _orList.size(); i++ )
+ for ( ArgVectorIterator it = _orList[i].begin();
+ it != _orList[i].end();
+ it++ )
+ if ( a == (*it) )
+ return true;
+
+ return false;
+}
+
+inline const std::vector< std::vector<Arg*> >& XorHandler::getXorList() const
+{
+ return _orList;
+}
+
+
+
+//////////////////////////////////////////////////////////////////////
+//END XOR.cpp
+//////////////////////////////////////////////////////////////////////
+
+} //namespace TCLAP
+
+#endif
diff --git a/funasr/runtime/onnxruntime/include/tclap/ZshCompletionOutput.h b/funasr/runtime/onnxruntime/include/tclap/ZshCompletionOutput.h
new file mode 100644
index 0000000..5a9268c
--- /dev/null
+++ b/funasr/runtime/onnxruntime/include/tclap/ZshCompletionOutput.h
@@ -0,0 +1,336 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
+/******************************************************************************
+ *
+ * file: ZshCompletionOutput.h
+ *
+ * Copyright (c) 2006, Oliver Kiddle
+ * Copyright (c) 2017 Google Inc.
+ * All rights reserved.
+ *
+ * See the file COPYING in the top directory of this distribution for
+ * more information.
+ *
+ * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+#ifndef TCLAP_ZSHCOMPLETIONOUTPUT_H
+#define TCLAP_ZSHCOMPLETIONOUTPUT_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string>
+#include <vector>
+#include <list>
+#include <iostream>
+#include <map>
+
+#include <tclap/CmdLineInterface.h>
+#include <tclap/CmdLineOutput.h>
+#include <tclap/XorHandler.h>
+#include <tclap/Arg.h>
+#include <tclap/sstream.h>
+
+namespace TCLAP {
+
+/**
+ * A class that generates a Zsh completion function as output from the usage()
+ * method for the given CmdLine and its Args.
+ */
+class ZshCompletionOutput : public CmdLineOutput
+{
+
+ public:
+
+ ZshCompletionOutput();
+
+ /**
+ * Prints the usage to stdout. Can be overridden to
+ * produce alternative behavior.
+ * \param c - The CmdLine object the output is generated for.
+ */
+ virtual void usage(CmdLineInterface& c);
+
+ /**
+ * Prints the version to stdout. Can be overridden
+ * to produce alternative behavior.
+ * \param c - The CmdLine object the output is generated for.
+ */
+ virtual void version(CmdLineInterface& c);
+
+ /**
+ * Prints (to stderr) an error message, short usage
+ * Can be overridden to produce alternative behavior.
+ * \param c - The CmdLine object the output is generated for.
+ * \param e - The ArgException that caused the failure.
+ */
+ virtual void failure(CmdLineInterface& c,
+ ArgException& e );
+
+ protected:
+
+ void basename( std::string& s );
+ void quoteSpecialChars( std::string& s );
+
+ std::string getMutexList( CmdLineInterface& _cmd, Arg* a );
+ void printOption( Arg* it, std::string mutex );
+ void printArg( Arg* it );
+
+ std::map<std::string, std::string> common;
+ char theDelimiter;
+};
+
+ZshCompletionOutput::ZshCompletionOutput()
+: common(std::map<std::string, std::string>()),
+ theDelimiter('=')
+{
+ common["host"] = "_hosts";
+ common["hostname"] = "_hosts";
+ common["file"] = "_files";
+ common["filename"] = "_files";
+ common["user"] = "_users";
+ common["username"] = "_users";
+ common["directory"] = "_directories";
+ common["path"] = "_directories";
+ common["url"] = "_urls";
+}
+
+inline void ZshCompletionOutput::version(CmdLineInterface& _cmd)
+{
+ std::cout << _cmd.getVersion() << std::endl;
+}
+
+inline void ZshCompletionOutput::usage(CmdLineInterface& _cmd )
+{
+ std::list<Arg*> argList = _cmd.getArgList();
+ std::string progName = _cmd.getProgramName();
+ std::string xversion = _cmd.getVersion();
+ theDelimiter = _cmd.getDelimiter();
+ basename(progName);
+
+ std::cout << "#compdef " << progName << std::endl << std::endl <<
+ "# " << progName << " version " << _cmd.getVersion() << std::endl << std::endl <<
+ "_arguments -s -S";
+
+ for (ArgListIterator it = argList.begin(); it != argList.end(); it++)
+ {
+ if ( (*it)->shortID().at(0) == '<' )
+ printArg((*it));
+ else if ( (*it)->getFlag() != "-" )
+ printOption((*it), getMutexList(_cmd, *it));
+ }
+
+ std::cout << std::endl;
+}
+
+inline void ZshCompletionOutput::failure( CmdLineInterface& _cmd,
+ ArgException& e )
+{
+ static_cast<void>(_cmd); // unused
+ std::cout << e.what() << std::endl;
+}
+
+inline void ZshCompletionOutput::quoteSpecialChars( std::string& s )
+{
+ size_t idx = s.find_last_of(':');
+ while ( idx != std::string::npos )
+ {
+ s.insert(idx, 1, '\\');
+ idx = s.find_last_of(':', idx);
+ }
+ idx = s.find_last_of('\'');
+ while ( idx != std::string::npos )
+ {
+ s.insert(idx, "'\\'");
+ if (idx == 0)
+ idx = std::string::npos;
+ else
+ idx = s.find_last_of('\'', --idx);
+ }
+}
+
+inline void ZshCompletionOutput::basename( std::string& s )
+{
+ size_t p = s.find_last_of('/');
+ if ( p != std::string::npos )
+ {
+ s.erase(0, p + 1);
+ }
+}
+
+inline void ZshCompletionOutput::printArg(Arg* a)
+{
+ static int count = 1;
+
+ std::cout << " \\" << std::endl << " '";
+ if ( a->acceptsMultipleValues() )
+ std::cout << '*';
+ else
+ std::cout << count++;
+ std::cout << ':';
+ if ( !a->isRequired() )
+ std::cout << ':';
+
+ std::cout << a->getName() << ':';
+ std::map<std::string, std::string>::iterator compArg = common.find(a->getName());
+ if ( compArg != common.end() )
+ {
+ std::cout << compArg->second;
+ }
+ else
+ {
+ std::cout << "_guard \"^-*\" " << a->getName();
+ }
+ std::cout << '\'';
+}
+
+inline void ZshCompletionOutput::printOption(Arg* a, std::string mutex)
+{
+ std::string flag = a->flagStartChar() + a->getFlag();
+ std::string name = a->nameStartString() + a->getName();
+ std::string desc = a->getDescription();
+
+ // remove full stop and capitalization from description as
+ // this is the convention for zsh function
+ if (!desc.compare(0, 12, "(required) "))
+ {
+ desc.erase(0, 12);
+ }
+ if (!desc.compare(0, 15, "(OR required) "))
+ {
+ desc.erase(0, 15);
+ }
+ size_t len = desc.length();
+ if (len && desc.at(--len) == '.')
+ {
+ desc.erase(len);
+ }
+ if (len)
+ {
+ desc.replace(0, 1, 1, tolower(desc.at(0)));
+ }
+
+ std::cout << " \\" << std::endl << " '" << mutex;
+
+ if ( a->getFlag().empty() )
+ {
+ std::cout << name;
+ }
+ else
+ {
+ std::cout << "'{" << flag << ',' << name << "}'";
+ }
+ if ( theDelimiter == '=' && a->isValueRequired() )
+ std::cout << "=-";
+ quoteSpecialChars(desc);
+ std::cout << '[' << desc << ']';
+
+ if ( a->isValueRequired() )
+ {
+ std::string arg = a->shortID();
+ // Example arg: "[-A <integer>] ..."
+ size_t pos = arg.rfind(" ...");
+
+ if (pos != std::string::npos) {
+ arg.erase(pos);
+ }
+
+ arg.erase(0, arg.find_last_of(theDelimiter) + 1);
+ if ( arg.at(arg.length()-1) == ']' )
+ arg.erase(arg.length()-1);
+ if ( arg.at(arg.length()-1) == ']' )
+ {
+ arg.erase(arg.length()-1);
+ }
+ if ( arg.at(0) == '<' )
+ {
+ arg.erase(arg.length()-1);
+ arg.erase(0, 1);
+ }
+ size_t p = arg.find('|');
+ if ( p != std::string::npos )
+ {
+ do
+ {
+ arg.replace(p, 1, 1, ' ');
+ }
+ while ( (p = arg.find_first_of('|', p)) != std::string::npos );
+ quoteSpecialChars(arg);
+ std::cout << ": :(" << arg << ')';
+ }
+ else
+ {
+ std::cout << ':' << arg;
+ std::map<std::string, std::string>::iterator compArg = common.find(arg);
+ if ( compArg != common.end() )
+ {
+ std::cout << ':' << compArg->second;
+ }
+ }
+ }
+
+ std::cout << '\'';
+}
+
+inline std::string ZshCompletionOutput::getMutexList( CmdLineInterface& _cmd, Arg* a)
+{
+ XorHandler xorHandler = _cmd.getXorHandler();
+ std::vector< std::vector<Arg*> > xorList = xorHandler.getXorList();
+
+ if (a->getName() == "help" || a->getName() == "version")
+ {
+ return "(-)";
+ }
+
+ ostringstream list;
+ if ( a->acceptsMultipleValues() )
+ {
+ list << '*';
+ }
+
+ for ( int i = 0; static_cast<unsigned int>(i) < xorList.size(); i++ )
+ {
+ for ( ArgVectorIterator it = xorList[i].begin();
+ it != xorList[i].end();
+ it++)
+ if ( a == (*it) )
+ {
+ list << '(';
+ for ( ArgVectorIterator iu = xorList[i].begin();
+ iu != xorList[i].end();
+ iu++ )
+ {
+ bool notCur = (*iu) != a;
+ bool hasFlag = !(*iu)->getFlag().empty();
+ if ( iu != xorList[i].begin() && (notCur || hasFlag) )
+ list << ' ';
+ if (hasFlag)
+ list << (*iu)->flagStartChar() << (*iu)->getFlag() << ' ';
+ if ( notCur || hasFlag )
+ list << (*iu)->nameStartString() << (*iu)->getName();
+ }
+ list << ')';
+ return list.str();
+ }
+ }
+
+ // wasn't found in xor list
+ if (!a->getFlag().empty()) {
+ list << "(" << a->flagStartChar() << a->getFlag() << ' ' <<
+ a->nameStartString() << a->getName() << ')';
+ }
+
+ return list.str();
+}
+
+} //namespace TCLAP
+#endif
diff --git a/funasr/runtime/onnxruntime/include/tclap/sstream.h b/funasr/runtime/onnxruntime/include/tclap/sstream.h
new file mode 100644
index 0000000..0118b76
--- /dev/null
+++ b/funasr/runtime/onnxruntime/include/tclap/sstream.h
@@ -0,0 +1,50 @@
+// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
+
+/******************************************************************************
+ *
+ * file: sstream.h
+ *
+ * Copyright (c) 2003, Michael E. Smoot .
+ * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno .
+ * Copyright (c) 2017 Google Inc.
+ * All rights reserved.
+ *
+ * See the file COPYING in the top directory of this distribution for
+ * more information.
+ *
+ * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+#ifndef TCLAP_SSTREAM_H
+#define TCLAP_SSTREAM_H
+
+#if !defined(HAVE_STRSTREAM)
+// Assume sstream is available if strstream is not specified
+// (https://sourceforge.net/p/tclap/bugs/23/)
+#define HAVE_SSTREAM
+#endif
+
+#if defined(HAVE_SSTREAM)
+#include <sstream>
+namespace TCLAP {
+ typedef std::istringstream istringstream;
+ typedef std::ostringstream ostringstream;
+}
+#elif defined(HAVE_STRSTREAM)
+#include <strstream>
+namespace TCLAP {
+ typedef std::istrstream istringstream;
+ typedef std::ostrstream ostringstream;
+}
+#else
+#error "Need a stringstream (sstream or strstream) to compile!"
+#endif
+
+#endif // TCLAP_SSTREAM_H
diff --git a/funasr/runtime/onnxruntime/include/win_func.h b/funasr/runtime/onnxruntime/include/win_func.h
deleted file mode 100644
index 1baaae5..0000000
--- a/funasr/runtime/onnxruntime/include/win_func.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <time.h>
-#ifdef WIN32
-#include <windows.h>
-#else
-#include <sys/time.h>
-#endif
-#ifdef WIN32
-int gettimeofday(struct timeval* tp, void* tzp)
-{
- time_t clock;
- struct tm tm;
- SYSTEMTIME wtm;
-
- GetLocalTime(&wtm);
- tm.tm_year = wtm.wYear - 1900;
- tm.tm_mon = wtm.wMonth - 1;
- tm.tm_mday = wtm.wDay;
- tm.tm_hour = wtm.wHour;
- tm.tm_min = wtm.wMinute;
- tm.tm_sec = wtm.wSecond;
- tm.tm_isdst = -1;
-
- clock = mktime(&tm);
- tp->tv_sec = clock;
- tp->tv_usec = wtm.wMilliseconds * 1000;
- return (0);
-}
-#endif
\ No newline at end of file
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/anchor.h b/funasr/runtime/onnxruntime/include/yaml-cpp/anchor.h
deleted file mode 100644
index 06759c7..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/anchor.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include <cstddef>
-
-namespace YAML {
-typedef std::size_t anchor_t;
-const anchor_t NullAnchor = 0;
-}
-
-#endif // ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/binary.h b/funasr/runtime/onnxruntime/include/yaml-cpp/binary.h
deleted file mode 100644
index 29d5dbd..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/binary.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#ifndef BASE64_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define BASE64_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include <string>
-#include <vector>
-
-#include "yaml-cpp/dll.h"
-
-namespace YAML {
-YAML_CPP_API std::string EncodeBase64(const unsigned char *data,
- std::size_t size);
-YAML_CPP_API std::vector<unsigned char> DecodeBase64(const std::string &input);
-
-class YAML_CPP_API Binary {
- public:
- Binary() : m_unownedData(0), m_unownedSize(0) {}
- Binary(const unsigned char *data_, std::size_t size_)
- : m_unownedData(data_), m_unownedSize(size_) {}
-
- bool owned() const { return !m_unownedData; }
- std::size_t size() const { return owned() ? m_data.size() : m_unownedSize; }
- const unsigned char *data() const {
- return owned() ? &m_data[0] : m_unownedData;
- }
-
- void swap(std::vector<unsigned char> &rhs) {
- if (m_unownedData) {
- m_data.swap(rhs);
- rhs.clear();
- rhs.resize(m_unownedSize);
- std::copy(m_unownedData, m_unownedData + m_unownedSize, rhs.begin());
- m_unownedData = 0;
- m_unownedSize = 0;
- } else {
- m_data.swap(rhs);
- }
- }
-
- bool operator==(const Binary &rhs) const {
- const std::size_t s = size();
- if (s != rhs.size())
- return false;
- const unsigned char *d1 = data();
- const unsigned char *d2 = rhs.data();
- for (std::size_t i = 0; i < s; i++) {
- if (*d1++ != *d2++)
- return false;
- }
- return true;
- }
-
- bool operator!=(const Binary &rhs) const { return !(*this == rhs); }
-
- private:
- std::vector<unsigned char> m_data;
- const unsigned char *m_unownedData;
- std::size_t m_unownedSize;
-};
-}
-
-#endif // BASE64_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/contrib/anchordict.h b/funasr/runtime/onnxruntime/include/yaml-cpp/contrib/anchordict.h
deleted file mode 100644
index 78db9ec..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/contrib/anchordict.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include <vector>
-
-#include "../anchor.h"
-
-namespace YAML {
-/**
- * An object that stores and retrieves values correlating to {@link anchor_t}
- * values.
- *
- * <p>Efficient implementation that can make assumptions about how
- * {@code anchor_t} values are assigned by the {@link Parser} class.
- */
-template <class T>
-class AnchorDict {
- public:
- void Register(anchor_t anchor, T value) {
- if (anchor > m_data.size()) {
- m_data.resize(anchor);
- }
- m_data[anchor - 1] = value;
- }
-
- T Get(anchor_t anchor) const { return m_data[anchor - 1]; }
-
- private:
- std::vector<T> m_data;
-};
-}
-
-#endif // ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/contrib/graphbuilder.h b/funasr/runtime/onnxruntime/include/yaml-cpp/contrib/graphbuilder.h
deleted file mode 100644
index f0a38f2..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/contrib/graphbuilder.h
+++ /dev/null
@@ -1,149 +0,0 @@
-#ifndef GRAPHBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define GRAPHBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include "yaml-cpp/mark.h"
-#include <string>
-
-namespace YAML {
-class Parser;
-
-// GraphBuilderInterface
-// . Abstraction of node creation
-// . pParentNode is always NULL or the return value of one of the NewXXX()
-// functions.
-class GraphBuilderInterface {
- public:
- virtual ~GraphBuilderInterface() = 0;
-
- // Create and return a new node with a null value.
- virtual void *NewNull(const Mark &mark, void *pParentNode) = 0;
-
- // Create and return a new node with the given tag and value.
- virtual void *NewScalar(const Mark &mark, const std::string &tag,
- void *pParentNode, const std::string &value) = 0;
-
- // Create and return a new sequence node
- virtual void *NewSequence(const Mark &mark, const std::string &tag,
- void *pParentNode) = 0;
-
- // Add pNode to pSequence. pNode was created with one of the NewXxx()
- // functions and pSequence with NewSequence().
- virtual void AppendToSequence(void *pSequence, void *pNode) = 0;
-
- // Note that no moew entries will be added to pSequence
- virtual void SequenceComplete(void *pSequence) { (void)pSequence; }
-
- // Create and return a new map node
- virtual void *NewMap(const Mark &mark, const std::string &tag,
- void *pParentNode) = 0;
-
- // Add the pKeyNode => pValueNode mapping to pMap. pKeyNode and pValueNode
- // were created with one of the NewXxx() methods and pMap with NewMap().
- virtual void AssignInMap(void *pMap, void *pKeyNode, void *pValueNode) = 0;
-
- // Note that no more assignments will be made in pMap
- virtual void MapComplete(void *pMap) { (void)pMap; }
-
- // Return the node that should be used in place of an alias referencing
- // pNode (pNode by default)
- virtual void *AnchorReference(const Mark &mark, void *pNode) {
- (void)mark;
- return pNode;
- }
-};
-
-// Typesafe wrapper for GraphBuilderInterface. Assumes that Impl defines
-// Node, Sequence, and Map types. Sequence and Map must derive from Node
-// (unless Node is defined as void). Impl must also implement function with
-// all of the same names as the virtual functions in GraphBuilderInterface
-// -- including the ones with default implementations -- but with the
-// prototypes changed to accept an explicit Node*, Sequence*, or Map* where
-// appropriate.
-template <class Impl>
-class GraphBuilder : public GraphBuilderInterface {
- public:
- typedef typename Impl::Node Node;
- typedef typename Impl::Sequence Sequence;
- typedef typename Impl::Map Map;
-
- GraphBuilder(Impl &impl) : m_impl(impl) {
- Map *pMap = NULL;
- Sequence *pSeq = NULL;
- Node *pNode = NULL;
-
- // Type consistency checks
- pNode = pMap;
- pNode = pSeq;
- }
-
- GraphBuilderInterface &AsBuilderInterface() { return *this; }
-
- virtual void *NewNull(const Mark &mark, void *pParentNode) {
- return CheckType<Node>(m_impl.NewNull(mark, AsNode(pParentNode)));
- }
-
- virtual void *NewScalar(const Mark &mark, const std::string &tag,
- void *pParentNode, const std::string &value) {
- return CheckType<Node>(
- m_impl.NewScalar(mark, tag, AsNode(pParentNode), value));
- }
-
- virtual void *NewSequence(const Mark &mark, const std::string &tag,
- void *pParentNode) {
- return CheckType<Sequence>(
- m_impl.NewSequence(mark, tag, AsNode(pParentNode)));
- }
- virtual void AppendToSequence(void *pSequence, void *pNode) {
- m_impl.AppendToSequence(AsSequence(pSequence), AsNode(pNode));
- }
- virtual void SequenceComplete(void *pSequence) {
- m_impl.SequenceComplete(AsSequence(pSequence));
- }
-
- virtual void *NewMap(const Mark &mark, const std::string &tag,
- void *pParentNode) {
- return CheckType<Map>(m_impl.NewMap(mark, tag, AsNode(pParentNode)));
- }
- virtual void AssignInMap(void *pMap, void *pKeyNode, void *pValueNode) {
- m_impl.AssignInMap(AsMap(pMap), AsNode(pKeyNode), AsNode(pValueNode));
- }
- virtual void MapComplete(void *pMap) { m_impl.MapComplete(AsMap(pMap)); }
-
- virtual void *AnchorReference(const Mark &mark, void *pNode) {
- return CheckType<Node>(m_impl.AnchorReference(mark, AsNode(pNode)));
- }
-
- private:
- Impl &m_impl;
-
- // Static check for pointer to T
- template <class T, class U>
- static T *CheckType(U *p) {
- return p;
- }
-
- static Node *AsNode(void *pNode) { return static_cast<Node *>(pNode); }
- static Sequence *AsSequence(void *pSeq) {
- return static_cast<Sequence *>(pSeq);
- }
- static Map *AsMap(void *pMap) { return static_cast<Map *>(pMap); }
-};
-
-void *BuildGraphOfNextDocument(Parser &parser,
- GraphBuilderInterface &graphBuilder);
-
-template <class Impl>
-typename Impl::Node *BuildGraphOfNextDocument(Parser &parser, Impl &impl) {
- GraphBuilder<Impl> graphBuilder(impl);
- return static_cast<typename Impl::Node *>(
- BuildGraphOfNextDocument(parser, graphBuilder));
-}
-}
-
-#endif // GRAPHBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/dll.h b/funasr/runtime/onnxruntime/include/yaml-cpp/dll.h
deleted file mode 100644
index a32c06b..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/dll.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-// The following ifdef block is the standard way of creating macros which make
-// exporting from a DLL simpler. All files within this DLL are compiled with the
-// yaml_cpp_EXPORTS symbol defined on the command line. This symbol should not
-// be defined on any project that uses this DLL. This way any other project
-// whose source files include this file see YAML_CPP_API functions as being
-// imported from a DLL, whereas this DLL sees symbols defined with this macro as
-// being exported.
-#undef YAML_CPP_API
-
-#ifdef YAML_CPP_DLL // Using or Building YAML-CPP DLL (definition defined
- // manually)
-#ifdef yaml_cpp_EXPORTS // Building YAML-CPP DLL (definition created by CMake
- // or defined manually)
-// #pragma message( "Defining YAML_CPP_API for DLL export" )
-#define YAML_CPP_API __declspec(dllexport)
-#else // yaml_cpp_EXPORTS
-// #pragma message( "Defining YAML_CPP_API for DLL import" )
-#define YAML_CPP_API __declspec(dllimport)
-#endif // yaml_cpp_EXPORTS
-#else // YAML_CPP_DLL
-#define YAML_CPP_API
-#endif // YAML_CPP_DLL
-
-#endif // DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/emitfromevents.h b/funasr/runtime/onnxruntime/include/yaml-cpp/emitfromevents.h
deleted file mode 100644
index f14b051..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/emitfromevents.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include <stack>
-
-#include "yaml-cpp/anchor.h"
-#include "yaml-cpp/emitterstyle.h"
-#include "yaml-cpp/eventhandler.h"
-
-namespace YAML {
-struct Mark;
-} // namespace YAML
-
-namespace YAML {
-class Emitter;
-
-class EmitFromEvents : public EventHandler {
- public:
- EmitFromEvents(Emitter& emitter);
-
- virtual void OnDocumentStart(const Mark& mark);
- virtual void OnDocumentEnd();
-
- virtual void OnNull(const Mark& mark, anchor_t anchor);
- virtual void OnAlias(const Mark& mark, anchor_t anchor);
- virtual void OnScalar(const Mark& mark, const std::string& tag,
- anchor_t anchor, const std::string& value);
-
- virtual void OnSequenceStart(const Mark& mark, const std::string& tag,
- anchor_t anchor, EmitterStyle::value style);
- virtual void OnSequenceEnd();
-
- virtual void OnMapStart(const Mark& mark, const std::string& tag,
- anchor_t anchor, EmitterStyle::value style);
- virtual void OnMapEnd();
-
- private:
- void BeginNode();
- void EmitProps(const std::string& tag, anchor_t anchor);
-
- private:
- Emitter& m_emitter;
-
- struct State {
- enum value { WaitingForSequenceEntry, WaitingForKey, WaitingForValue };
- };
- std::stack<State::value> m_stateStack;
-};
-}
-
-#endif // EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/emitter.h b/funasr/runtime/onnxruntime/include/yaml-cpp/emitter.h
deleted file mode 100644
index ef92cc4..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/emitter.h
+++ /dev/null
@@ -1,254 +0,0 @@
-#ifndef EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include <cstddef>
-#include <memory>
-#include <sstream>
-#include <string>
-
-#include "yaml-cpp/binary.h"
-#include "yaml-cpp/dll.h"
-#include "yaml-cpp/emitterdef.h"
-#include "yaml-cpp/emittermanip.h"
-#include "yaml-cpp/noncopyable.h"
-#include "yaml-cpp/null.h"
-#include "yaml-cpp/ostream_wrapper.h"
-
-namespace YAML {
-class Binary;
-struct _Null;
-} // namespace YAML
-
-namespace YAML {
-class EmitterState;
-
-class YAML_CPP_API Emitter : private noncopyable {
- public:
- Emitter();
- explicit Emitter(std::ostream& stream);
- ~Emitter();
-
- // output
- const char* c_str() const;
- std::size_t size() const;
-
- // state checking
- bool good() const;
- const std::string GetLastError() const;
-
- // global setters
- bool SetOutputCharset(EMITTER_MANIP value);
- bool SetStringFormat(EMITTER_MANIP value);
- bool SetBoolFormat(EMITTER_MANIP value);
- bool SetIntBase(EMITTER_MANIP value);
- bool SetSeqFormat(EMITTER_MANIP value);
- bool SetMapFormat(EMITTER_MANIP value);
- bool SetIndent(std::size_t n);
- bool SetPreCommentIndent(std::size_t n);
- bool SetPostCommentIndent(std::size_t n);
- bool SetFloatPrecision(std::size_t n);
- bool SetDoublePrecision(std::size_t n);
-
- // local setters
- Emitter& SetLocalValue(EMITTER_MANIP value);
- Emitter& SetLocalIndent(const _Indent& indent);
- Emitter& SetLocalPrecision(const _Precision& precision);
-
- // overloads of write
- Emitter& Write(const std::string& str);
- Emitter& Write(bool b);
- Emitter& Write(char ch);
- Emitter& Write(const _Alias& alias);
- Emitter& Write(const _Anchor& anchor);
- Emitter& Write(const _Tag& tag);
- Emitter& Write(const _Comment& comment);
- Emitter& Write(const _Null& n);
- Emitter& Write(const Binary& binary);
-
- template <typename T>
- Emitter& WriteIntegralType(T value);
-
- template <typename T>
- Emitter& WriteStreamable(T value);
-
- private:
- template <typename T>
- void SetStreamablePrecision(std::stringstream&) {}
- std::size_t GetFloatPrecision() const;
- std::size_t GetDoublePrecision() const;
-
- void PrepareIntegralStream(std::stringstream& stream) const;
- void StartedScalar();
-
- private:
- void EmitBeginDoc();
- void EmitEndDoc();
- void EmitBeginSeq();
- void EmitEndSeq();
- void EmitBeginMap();
- void EmitEndMap();
- void EmitNewline();
- void EmitKindTag();
- void EmitTag(bool verbatim, const _Tag& tag);
-
- void PrepareNode(EmitterNodeType::value child);
- void PrepareTopNode(EmitterNodeType::value child);
- void FlowSeqPrepareNode(EmitterNodeType::value child);
- void BlockSeqPrepareNode(EmitterNodeType::value child);
-
- void FlowMapPrepareNode(EmitterNodeType::value child);
-
- void FlowMapPrepareLongKey(EmitterNodeType::value child);
- void FlowMapPrepareLongKeyValue(EmitterNodeType::value child);
- void FlowMapPrepareSimpleKey(EmitterNodeType::value child);
- void FlowMapPrepareSimpleKeyValue(EmitterNodeType::value child);
-
- void BlockMapPrepareNode(EmitterNodeType::value child);
-
- void BlockMapPrepareLongKey(EmitterNodeType::value child);
- void BlockMapPrepareLongKeyValue(EmitterNodeType::value child);
- void BlockMapPrepareSimpleKey(EmitterNodeType::value child);
- void BlockMapPrepareSimpleKeyValue(EmitterNodeType::value child);
-
- void SpaceOrIndentTo(bool requireSpace, std::size_t indent);
-
- const char* ComputeFullBoolName(bool b) const;
- bool CanEmitNewline() const;
-
- private:
- std::unique_ptr<EmitterState> m_pState;
- ostream_wrapper m_stream;
-};
-
-template <typename T>
-inline Emitter& Emitter::WriteIntegralType(T value) {
- if (!good())
- return *this;
-
- PrepareNode(EmitterNodeType::Scalar);
-
- std::stringstream stream;
- PrepareIntegralStream(stream);
- stream << value;
- m_stream << stream.str();
-
- StartedScalar();
-
- return *this;
-}
-
-template <typename T>
-inline Emitter& Emitter::WriteStreamable(T value) {
- if (!good())
- return *this;
-
- PrepareNode(EmitterNodeType::Scalar);
-
- std::stringstream stream;
- SetStreamablePrecision<T>(stream);
- stream << value;
- m_stream << stream.str();
-
- StartedScalar();
-
- return *this;
-}
-
-template <>
-inline void Emitter::SetStreamablePrecision<float>(std::stringstream& stream) {
- stream.precision(static_cast<std::streamsize>(GetFloatPrecision()));
-}
-
-template <>
-inline void Emitter::SetStreamablePrecision<double>(std::stringstream& stream) {
- stream.precision(static_cast<std::streamsize>(GetDoublePrecision()));
-}
-
-// overloads of insertion
-inline Emitter& operator<<(Emitter& emitter, const std::string& v) {
- return emitter.Write(v);
-}
-inline Emitter& operator<<(Emitter& emitter, bool v) {
- return emitter.Write(v);
-}
-inline Emitter& operator<<(Emitter& emitter, char v) {
- return emitter.Write(v);
-}
-inline Emitter& operator<<(Emitter& emitter, unsigned char v) {
- return emitter.Write(static_cast<char>(v));
-}
-inline Emitter& operator<<(Emitter& emitter, const _Alias& v) {
- return emitter.Write(v);
-}
-inline Emitter& operator<<(Emitter& emitter, const _Anchor& v) {
- return emitter.Write(v);
-}
-inline Emitter& operator<<(Emitter& emitter, const _Tag& v) {
- return emitter.Write(v);
-}
-inline Emitter& operator<<(Emitter& emitter, const _Comment& v) {
- return emitter.Write(v);
-}
-inline Emitter& operator<<(Emitter& emitter, const _Null& v) {
- return emitter.Write(v);
-}
-inline Emitter& operator<<(Emitter& emitter, const Binary& b) {
- return emitter.Write(b);
-}
-
-inline Emitter& operator<<(Emitter& emitter, const char* v) {
- return emitter.Write(std::string(v));
-}
-
-inline Emitter& operator<<(Emitter& emitter, int v) {
- return emitter.WriteIntegralType(v);
-}
-inline Emitter& operator<<(Emitter& emitter, unsigned int v) {
- return emitter.WriteIntegralType(v);
-}
-inline Emitter& operator<<(Emitter& emitter, short v) {
- return emitter.WriteIntegralType(v);
-}
-inline Emitter& operator<<(Emitter& emitter, unsigned short v) {
- return emitter.WriteIntegralType(v);
-}
-inline Emitter& operator<<(Emitter& emitter, long v) {
- return emitter.WriteIntegralType(v);
-}
-inline Emitter& operator<<(Emitter& emitter, unsigned long v) {
- return emitter.WriteIntegralType(v);
-}
-inline Emitter& operator<<(Emitter& emitter, long long v) {
- return emitter.WriteIntegralType(v);
-}
-inline Emitter& operator<<(Emitter& emitter, unsigned long long v) {
- return emitter.WriteIntegralType(v);
-}
-
-inline Emitter& operator<<(Emitter& emitter, float v) {
- return emitter.WriteStreamable(v);
-}
-inline Emitter& operator<<(Emitter& emitter, double v) {
- return emitter.WriteStreamable(v);
-}
-
-inline Emitter& operator<<(Emitter& emitter, EMITTER_MANIP value) {
- return emitter.SetLocalValue(value);
-}
-
-inline Emitter& operator<<(Emitter& emitter, _Indent indent) {
- return emitter.SetLocalIndent(indent);
-}
-
-inline Emitter& operator<<(Emitter& emitter, _Precision precision) {
- return emitter.SetLocalPrecision(precision);
-}
-}
-
-#endif // EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/emitterdef.h b/funasr/runtime/onnxruntime/include/yaml-cpp/emitterdef.h
deleted file mode 100644
index 0b42695..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/emitterdef.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef EMITTERDEF_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define EMITTERDEF_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-namespace YAML {
-struct EmitterNodeType {
- enum value { NoType, Property, Scalar, FlowSeq, BlockSeq, FlowMap, BlockMap };
-};
-}
-
-#endif // EMITTERDEF_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/emittermanip.h b/funasr/runtime/onnxruntime/include/yaml-cpp/emittermanip.h
deleted file mode 100644
index 89f7256..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/emittermanip.h
+++ /dev/null
@@ -1,137 +0,0 @@
-#ifndef EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include <string>
-
-namespace YAML {
-enum EMITTER_MANIP {
- // general manipulators
- Auto,
- TagByKind,
- Newline,
-
- // output character set
- EmitNonAscii,
- EscapeNonAscii,
-
- // string manipulators
- // Auto, // duplicate
- SingleQuoted,
- DoubleQuoted,
- Literal,
-
- // bool manipulators
- YesNoBool, // yes, no
- TrueFalseBool, // true, false
- OnOffBool, // on, off
- UpperCase, // TRUE, N
- LowerCase, // f, yes
- CamelCase, // No, Off
- LongBool, // yes, On
- ShortBool, // y, t
-
- // int manipulators
- Dec,
- Hex,
- Oct,
-
- // document manipulators
- BeginDoc,
- EndDoc,
-
- // sequence manipulators
- BeginSeq,
- EndSeq,
- Flow,
- Block,
-
- // map manipulators
- BeginMap,
- EndMap,
- Key,
- Value,
- // Flow, // duplicate
- // Block, // duplicate
- // Auto, // duplicate
- LongKey
-};
-
-struct _Indent {
- _Indent(int value_) : value(value_) {}
- int value;
-};
-
-inline _Indent Indent(int value) { return _Indent(value); }
-
-struct _Alias {
- _Alias(const std::string& content_) : content(content_) {}
- std::string content;
-};
-
-inline _Alias Alias(const std::string content) { return _Alias(content); }
-
-struct _Anchor {
- _Anchor(const std::string& content_) : content(content_) {}
- std::string content;
-};
-
-inline _Anchor Anchor(const std::string content) { return _Anchor(content); }
-
-struct _Tag {
- struct Type {
- enum value { Verbatim, PrimaryHandle, NamedHandle };
- };
-
- explicit _Tag(const std::string& prefix_, const std::string& content_,
- Type::value type_)
- : prefix(prefix_), content(content_), type(type_) {}
- std::string prefix;
- std::string content;
- Type::value type;
-};
-
-inline _Tag VerbatimTag(const std::string content) {
- return _Tag("", content, _Tag::Type::Verbatim);
-}
-
-inline _Tag LocalTag(const std::string content) {
- return _Tag("", content, _Tag::Type::PrimaryHandle);
-}
-
-inline _Tag LocalTag(const std::string& prefix, const std::string content) {
- return _Tag(prefix, content, _Tag::Type::NamedHandle);
-}
-
-inline _Tag SecondaryTag(const std::string content) {
- return _Tag("", content, _Tag::Type::NamedHandle);
-}
-
-struct _Comment {
- _Comment(const std::string& content_) : content(content_) {}
- std::string content;
-};
-
-inline _Comment Comment(const std::string content) { return _Comment(content); }
-
-struct _Precision {
- _Precision(int floatPrecision_, int doublePrecision_)
- : floatPrecision(floatPrecision_), doublePrecision(doublePrecision_) {}
-
- int floatPrecision;
- int doublePrecision;
-};
-
-inline _Precision FloatPrecision(int n) { return _Precision(n, -1); }
-
-inline _Precision DoublePrecision(int n) { return _Precision(-1, n); }
-
-inline _Precision Precision(int n) { return _Precision(n, n); }
-}
-
-#endif // EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/emitterstyle.h b/funasr/runtime/onnxruntime/include/yaml-cpp/emitterstyle.h
deleted file mode 100644
index 67bb398..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/emitterstyle.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef EMITTERSTYLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define EMITTERSTYLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-namespace YAML {
-struct EmitterStyle {
- enum value { Default, Block, Flow };
-};
-}
-
-#endif // EMITTERSTYLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/eventhandler.h b/funasr/runtime/onnxruntime/include/yaml-cpp/eventhandler.h
deleted file mode 100644
index efe381c..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/eventhandler.h
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include <string>
-
-#include "yaml-cpp/anchor.h"
-#include "yaml-cpp/emitterstyle.h"
-
-namespace YAML {
-struct Mark;
-
-class EventHandler {
- public:
- virtual ~EventHandler() {}
-
- virtual void OnDocumentStart(const Mark& mark) = 0;
- virtual void OnDocumentEnd() = 0;
-
- virtual void OnNull(const Mark& mark, anchor_t anchor) = 0;
- virtual void OnAlias(const Mark& mark, anchor_t anchor) = 0;
- virtual void OnScalar(const Mark& mark, const std::string& tag,
- anchor_t anchor, const std::string& value) = 0;
-
- virtual void OnSequenceStart(const Mark& mark, const std::string& tag,
- anchor_t anchor, EmitterStyle::value style) = 0;
- virtual void OnSequenceEnd() = 0;
-
- virtual void OnMapStart(const Mark& mark, const std::string& tag,
- anchor_t anchor, EmitterStyle::value style) = 0;
- virtual void OnMapEnd() = 0;
-};
-}
-
-#endif // EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/exceptions.h b/funasr/runtime/onnxruntime/include/yaml-cpp/exceptions.h
deleted file mode 100644
index 9c96859..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/exceptions.h
+++ /dev/null
@@ -1,267 +0,0 @@
-#ifndef EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include "yaml-cpp/mark.h"
-#include "yaml-cpp/traits.h"
-#include <sstream>
-#include <stdexcept>
-#include <string>
-
-// This is here for compatibility with older versions of Visual Studio
-// which don't support noexcept
-#ifdef _MSC_VER
- #define YAML_CPP_NOEXCEPT _NOEXCEPT
-#else
- #define YAML_CPP_NOEXCEPT noexcept
-#endif
-
-namespace YAML {
-// error messages
-namespace ErrorMsg {
-const char* const YAML_DIRECTIVE_ARGS =
- "YAML directives must have exactly one argument";
-const char* const YAML_VERSION = "bad YAML version: ";
-const char* const YAML_MAJOR_VERSION = "YAML major version too large";
-const char* const REPEATED_YAML_DIRECTIVE = "repeated YAML directive";
-const char* const TAG_DIRECTIVE_ARGS =
- "TAG directives must have exactly two arguments";
-const char* const REPEATED_TAG_DIRECTIVE = "repeated TAG directive";
-const char* const CHAR_IN_TAG_HANDLE =
- "illegal character found while scanning tag handle";
-const char* const TAG_WITH_NO_SUFFIX = "tag handle with no suffix";
-const char* const END_OF_VERBATIM_TAG = "end of verbatim tag not found";
-const char* const END_OF_MAP = "end of map not found";
-const char* const END_OF_MAP_FLOW = "end of map flow not found";
-const char* const END_OF_SEQ = "end of sequence not found";
-const char* const END_OF_SEQ_FLOW = "end of sequence flow not found";
-const char* const MULTIPLE_TAGS =
- "cannot assign multiple tags to the same node";
-const char* const MULTIPLE_ANCHORS =
- "cannot assign multiple anchors to the same node";
-const char* const MULTIPLE_ALIASES =
- "cannot assign multiple aliases to the same node";
-const char* const ALIAS_CONTENT =
- "aliases can't have any content, *including* tags";
-const char* const INVALID_HEX = "bad character found while scanning hex number";
-const char* const INVALID_UNICODE = "invalid unicode: ";
-const char* const INVALID_ESCAPE = "unknown escape character: ";
-const char* const UNKNOWN_TOKEN = "unknown token";
-const char* const DOC_IN_SCALAR = "illegal document indicator in scalar";
-const char* const EOF_IN_SCALAR = "illegal EOF in scalar";
-const char* const CHAR_IN_SCALAR = "illegal character in scalar";
-const char* const TAB_IN_INDENTATION =
- "illegal tab when looking for indentation";
-const char* const FLOW_END = "illegal flow end";
-const char* const BLOCK_ENTRY = "illegal block entry";
-const char* const MAP_KEY = "illegal map key";
-const char* const MAP_VALUE = "illegal map value";
-const char* const ALIAS_NOT_FOUND = "alias not found after *";
-const char* const ANCHOR_NOT_FOUND = "anchor not found after &";
-const char* const CHAR_IN_ALIAS =
- "illegal character found while scanning alias";
-const char* const CHAR_IN_ANCHOR =
- "illegal character found while scanning anchor";
-const char* const ZERO_INDENT_IN_BLOCK =
- "cannot set zero indentation for a block scalar";
-const char* const CHAR_IN_BLOCK = "unexpected character in block scalar";
-const char* const AMBIGUOUS_ANCHOR =
- "cannot assign the same alias to multiple nodes";
-const char* const UNKNOWN_ANCHOR = "the referenced anchor is not defined";
-
-const char* const INVALID_NODE =
- "invalid node; this may result from using a map iterator as a sequence "
- "iterator, or vice-versa";
-const char* const INVALID_SCALAR = "invalid scalar";
-const char* const KEY_NOT_FOUND = "key not found";
-const char* const BAD_CONVERSION = "bad conversion";
-const char* const BAD_DEREFERENCE = "bad dereference";
-const char* const BAD_SUBSCRIPT = "operator[] call on a scalar";
-const char* const BAD_PUSHBACK = "appending to a non-sequence";
-const char* const BAD_INSERT = "inserting in a non-convertible-to-map";
-
-const char* const UNMATCHED_GROUP_TAG = "unmatched group tag";
-const char* const UNEXPECTED_END_SEQ = "unexpected end sequence token";
-const char* const UNEXPECTED_END_MAP = "unexpected end map token";
-const char* const SINGLE_QUOTED_CHAR =
- "invalid character in single-quoted string";
-const char* const INVALID_ANCHOR = "invalid anchor";
-const char* const INVALID_ALIAS = "invalid alias";
-const char* const INVALID_TAG = "invalid tag";
-const char* const BAD_FILE = "bad file";
-
-template <typename T>
-inline const std::string KEY_NOT_FOUND_WITH_KEY(
- const T&, typename disable_if<is_numeric<T>>::type* = 0) {
- return KEY_NOT_FOUND;
-}
-
-inline const std::string KEY_NOT_FOUND_WITH_KEY(const std::string& key) {
- std::stringstream stream;
- stream << KEY_NOT_FOUND << ": " << key;
- return stream.str();
-}
-
-template <typename T>
-inline const std::string KEY_NOT_FOUND_WITH_KEY(
- const T& key, typename enable_if<is_numeric<T>>::type* = 0) {
- std::stringstream stream;
- stream << KEY_NOT_FOUND << ": " << key;
- return stream.str();
-}
-}
-
-class YAML_CPP_API Exception : public std::runtime_error {
- public:
- Exception(const Mark& mark_, const std::string& msg_)
- : std::runtime_error(build_what(mark_, msg_)), mark(mark_), msg(msg_) {}
- virtual ~Exception() YAML_CPP_NOEXCEPT;
-
- Exception(const Exception&) = default;
-
- Mark mark;
- std::string msg;
-
- private:
- static const std::string build_what(const Mark& mark,
- const std::string& msg) {
- if (mark.is_null()) {
- return msg.c_str();
- }
-
- std::stringstream output;
- output << "yaml-cpp: error at line " << mark.line + 1 << ", column "
- << mark.column + 1 << ": " << msg;
- return output.str();
- }
-};
-
-class YAML_CPP_API ParserException : public Exception {
- public:
- ParserException(const Mark& mark_, const std::string& msg_)
- : Exception(mark_, msg_) {}
- ParserException(const ParserException&) = default;
- virtual ~ParserException() YAML_CPP_NOEXCEPT;
-};
-
-class YAML_CPP_API RepresentationException : public Exception {
- public:
- RepresentationException(const Mark& mark_, const std::string& msg_)
- : Exception(mark_, msg_) {}
- RepresentationException(const RepresentationException&) = default;
- virtual ~RepresentationException() YAML_CPP_NOEXCEPT;
-};
-
-// representation exceptions
-class YAML_CPP_API InvalidScalar : public RepresentationException {
- public:
- InvalidScalar(const Mark& mark_)
- : RepresentationException(mark_, ErrorMsg::INVALID_SCALAR) {}
- InvalidScalar(const InvalidScalar&) = default;
- virtual ~InvalidScalar() YAML_CPP_NOEXCEPT;
-};
-
-class YAML_CPP_API KeyNotFound : public RepresentationException {
- public:
- template <typename T>
- KeyNotFound(const Mark& mark_, const T& key_)
- : RepresentationException(mark_, ErrorMsg::KEY_NOT_FOUND_WITH_KEY(key_)) {
- }
- KeyNotFound(const KeyNotFound&) = default;
- virtual ~KeyNotFound() YAML_CPP_NOEXCEPT;
-};
-
-template <typename T>
-class YAML_CPP_API TypedKeyNotFound : public KeyNotFound {
- public:
- TypedKeyNotFound(const Mark& mark_, const T& key_)
- : KeyNotFound(mark_, key_), key(key_) {}
- virtual ~TypedKeyNotFound() YAML_CPP_NOEXCEPT {}
-
- T key;
-};
-
-template <typename T>
-inline TypedKeyNotFound<T> MakeTypedKeyNotFound(const Mark& mark,
- const T& key) {
- return TypedKeyNotFound<T>(mark, key);
-}
-
-class YAML_CPP_API InvalidNode : public RepresentationException {
- public:
- InvalidNode()
- : RepresentationException(Mark::null_mark(), ErrorMsg::INVALID_NODE) {}
- InvalidNode(const InvalidNode&) = default;
- virtual ~InvalidNode() YAML_CPP_NOEXCEPT;
-};
-
-class YAML_CPP_API BadConversion : public RepresentationException {
- public:
- explicit BadConversion(const Mark& mark_)
- : RepresentationException(mark_, ErrorMsg::BAD_CONVERSION) {}
- BadConversion(const BadConversion&) = default;
- virtual ~BadConversion() YAML_CPP_NOEXCEPT;
-};
-
-template <typename T>
-class TypedBadConversion : public BadConversion {
- public:
- explicit TypedBadConversion(const Mark& mark_) : BadConversion(mark_) {}
-};
-
-class YAML_CPP_API BadDereference : public RepresentationException {
- public:
- BadDereference()
- : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_DEREFERENCE) {}
- BadDereference(const BadDereference&) = default;
- virtual ~BadDereference() YAML_CPP_NOEXCEPT;
-};
-
-class YAML_CPP_API BadSubscript : public RepresentationException {
- public:
- BadSubscript()
- : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_SUBSCRIPT) {}
- BadSubscript(const BadSubscript&) = default;
- virtual ~BadSubscript() YAML_CPP_NOEXCEPT;
-};
-
-class YAML_CPP_API BadPushback : public RepresentationException {
- public:
- BadPushback()
- : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_PUSHBACK) {}
- BadPushback(const BadPushback&) = default;
- virtual ~BadPushback() YAML_CPP_NOEXCEPT;
-};
-
-class YAML_CPP_API BadInsert : public RepresentationException {
- public:
- BadInsert()
- : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_INSERT) {}
- BadInsert(const BadInsert&) = default;
- virtual ~BadInsert() YAML_CPP_NOEXCEPT;
-};
-
-class YAML_CPP_API EmitterException : public Exception {
- public:
- EmitterException(const std::string& msg_)
- : Exception(Mark::null_mark(), msg_) {}
- EmitterException(const EmitterException&) = default;
- virtual ~EmitterException() YAML_CPP_NOEXCEPT;
-};
-
-class YAML_CPP_API BadFile : public Exception {
- public:
- BadFile() : Exception(Mark::null_mark(), ErrorMsg::BAD_FILE) {}
- BadFile(const BadFile&) = default;
- virtual ~BadFile() YAML_CPP_NOEXCEPT;
-};
-}
-
-#undef YAML_CPP_NOEXCEPT
-
-#endif // EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/mark.h b/funasr/runtime/onnxruntime/include/yaml-cpp/mark.h
deleted file mode 100644
index bf94b4f..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/mark.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include "yaml-cpp/dll.h"
-
-namespace YAML {
-struct YAML_CPP_API Mark {
- Mark() : pos(0), line(0), column(0) {}
-
- static const Mark null_mark() { return Mark(-1, -1, -1); }
-
- bool is_null() const { return pos == -1 && line == -1 && column == -1; }
-
- int pos;
- int line, column;
-
- private:
- Mark(int pos_, int line_, int column_)
- : pos(pos_), line(line_), column(column_) {}
-};
-}
-
-#endif // MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/node/convert.h b/funasr/runtime/onnxruntime/include/yaml-cpp/node/convert.h
deleted file mode 100644
index 45a878a..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/node/convert.h
+++ /dev/null
@@ -1,331 +0,0 @@
-#ifndef NODE_CONVERT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define NODE_CONVERT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include <array>
-#include <limits>
-#include <list>
-#include <map>
-#include <sstream>
-#include <vector>
-
-#include "yaml-cpp/binary.h"
-#include "yaml-cpp/node/impl.h"
-#include "yaml-cpp/node/iterator.h"
-#include "yaml-cpp/node/node.h"
-#include "yaml-cpp/node/type.h"
-#include "yaml-cpp/null.h"
-
-namespace YAML {
-class Binary;
-struct _Null;
-template <typename T>
-struct convert;
-} // namespace YAML
-
-namespace YAML {
-namespace conversion {
-inline bool IsInfinity(const std::string& input) {
- return input == ".inf" || input == ".Inf" || input == ".INF" ||
- input == "+.inf" || input == "+.Inf" || input == "+.INF";
-}
-
-inline bool IsNegativeInfinity(const std::string& input) {
- return input == "-.inf" || input == "-.Inf" || input == "-.INF";
-}
-
-inline bool IsNaN(const std::string& input) {
- return input == ".nan" || input == ".NaN" || input == ".NAN";
-}
-}
-
-// Node
-template <>
-struct convert<Node> {
- static Node encode(const Node& rhs) { return rhs; }
-
- static bool decode(const Node& node, Node& rhs) {
- rhs.reset(node);
- return true;
- }
-};
-
-// std::string
-template <>
-struct convert<std::string> {
- static Node encode(const std::string& rhs) { return Node(rhs); }
-
- static bool decode(const Node& node, std::string& rhs) {
- if (!node.IsScalar())
- return false;
- rhs = node.Scalar();
- return true;
- }
-};
-
-// C-strings can only be encoded
-template <>
-struct convert<const char*> {
- static Node encode(const char*& rhs) { return Node(rhs); }
-};
-
-template <std::size_t N>
-struct convert<const char[N]> {
- static Node encode(const char(&rhs)[N]) { return Node(rhs); }
-};
-
-template <>
-struct convert<_Null> {
- static Node encode(const _Null& /* rhs */) { return Node(); }
-
- static bool decode(const Node& node, _Null& /* rhs */) {
- return node.IsNull();
- }
-};
-
-#define YAML_DEFINE_CONVERT_STREAMABLE(type, negative_op) \
- template <> \
- struct convert<type> { \
- static Node encode(const type& rhs) { \
- std::stringstream stream; \
- stream.precision(std::numeric_limits<type>::digits10 + 1); \
- stream << rhs; \
- return Node(stream.str()); \
- } \
- \
- static bool decode(const Node& node, type& rhs) { \
- if (node.Type() != NodeType::Scalar) \
- return false; \
- const std::string& input = node.Scalar(); \
- std::stringstream stream(input); \
- stream.unsetf(std::ios::dec); \
- if ((stream >> std::noskipws >> rhs) && (stream >> std::ws).eof()) \
- return true; \
- if (std::numeric_limits<type>::has_infinity) { \
- if (conversion::IsInfinity(input)) { \
- rhs = std::numeric_limits<type>::infinity(); \
- return true; \
- } else if (conversion::IsNegativeInfinity(input)) { \
- rhs = negative_op std::numeric_limits<type>::infinity(); \
- return true; \
- } \
- } \
- \
- if (std::numeric_limits<type>::has_quiet_NaN && \
- conversion::IsNaN(input)) { \
- rhs = std::numeric_limits<type>::quiet_NaN(); \
- return true; \
- } \
- \
- return false; \
- } \
- }
-
-#define YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(type) \
- YAML_DEFINE_CONVERT_STREAMABLE(type, -)
-
-#define YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(type) \
- YAML_DEFINE_CONVERT_STREAMABLE(type, +)
-
-YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(int);
-YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(short);
-YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(long);
-YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(long long);
-YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned);
-YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned short);
-YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned long);
-YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned long long);
-
-YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(char);
-YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(signed char);
-YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED(unsigned char);
-
-YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(float);
-YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(double);
-YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(long double);
-
-#undef YAML_DEFINE_CONVERT_STREAMABLE_SIGNED
-#undef YAML_DEFINE_CONVERT_STREAMABLE_UNSIGNED
-#undef YAML_DEFINE_CONVERT_STREAMABLE
-
-// bool
-template <>
-struct convert<bool> {
- static Node encode(bool rhs) { return rhs ? Node("true") : Node("false"); }
-
- YAML_CPP_API static bool decode(const Node& node, bool& rhs);
-};
-
-// std::map
-template <typename K, typename V>
-struct convert<std::map<K, V>> {
- static Node encode(const std::map<K, V>& rhs) {
- Node node(NodeType::Map);
- for (typename std::map<K, V>::const_iterator it = rhs.begin();
- it != rhs.end(); ++it)
- node.force_insert(it->first, it->second);
- return node;
- }
-
- static bool decode(const Node& node, std::map<K, V>& rhs) {
- if (!node.IsMap())
- return false;
-
- rhs.clear();
- for (const_iterator it = node.begin(); it != node.end(); ++it)
-#if defined(__GNUC__) && __GNUC__ < 4
- // workaround for GCC 3:
- rhs[it->first.template as<K>()] = it->second.template as<V>();
-#else
- rhs[it->first.as<K>()] = it->second.as<V>();
-#endif
- return true;
- }
-};
-
-// std::vector
-template <typename T>
-struct convert<std::vector<T>> {
- static Node encode(const std::vector<T>& rhs) {
- Node node(NodeType::Sequence);
- for (typename std::vector<T>::const_iterator it = rhs.begin();
- it != rhs.end(); ++it)
- node.push_back(*it);
- return node;
- }
-
- static bool decode(const Node& node, std::vector<T>& rhs) {
- if (!node.IsSequence())
- return false;
-
- rhs.clear();
- for (const_iterator it = node.begin(); it != node.end(); ++it)
-#if defined(__GNUC__) && __GNUC__ < 4
- // workaround for GCC 3:
- rhs.push_back(it->template as<T>());
-#else
- rhs.push_back(it->as<T>());
-#endif
- return true;
- }
-};
-
-// std::list
-template <typename T>
-struct convert<std::list<T>> {
- static Node encode(const std::list<T>& rhs) {
- Node node(NodeType::Sequence);
- for (typename std::list<T>::const_iterator it = rhs.begin();
- it != rhs.end(); ++it)
- node.push_back(*it);
- return node;
- }
-
- static bool decode(const Node& node, std::list<T>& rhs) {
- if (!node.IsSequence())
- return false;
-
- rhs.clear();
- for (const_iterator it = node.begin(); it != node.end(); ++it)
-#if defined(__GNUC__) && __GNUC__ < 4
- // workaround for GCC 3:
- rhs.push_back(it->template as<T>());
-#else
- rhs.push_back(it->as<T>());
-#endif
- return true;
- }
-};
-
-// std::array
-template <typename T, std::size_t N>
-struct convert<std::array<T, N>> {
- static Node encode(const std::array<T, N>& rhs) {
- Node node(NodeType::Sequence);
- for (const auto& element : rhs) {
- node.push_back(element);
- }
- return node;
- }
-
- static bool decode(const Node& node, std::array<T, N>& rhs) {
- if (!isNodeValid(node)) {
- return false;
- }
-
- for (auto i = 0u; i < node.size(); ++i) {
-#if defined(__GNUC__) && __GNUC__ < 4
- // workaround for GCC 3:
- rhs[i] = node[i].template as<T>();
-#else
- rhs[i] = node[i].as<T>();
-#endif
- }
- return true;
- }
-
- private:
- static bool isNodeValid(const Node& node) {
- return node.IsSequence() && node.size() == N;
- }
-};
-
-// std::pair
-template <typename T, typename U>
-struct convert<std::pair<T, U>> {
- static Node encode(const std::pair<T, U>& rhs) {
- Node node(NodeType::Sequence);
- node.push_back(rhs.first);
- node.push_back(rhs.second);
- return node;
- }
-
- static bool decode(const Node& node, std::pair<T, U>& rhs) {
- if (!node.IsSequence())
- return false;
- if (node.size() != 2)
- return false;
-
-#if defined(__GNUC__) && __GNUC__ < 4
- // workaround for GCC 3:
- rhs.first = node[0].template as<T>();
-#else
- rhs.first = node[0].as<T>();
-#endif
-#if defined(__GNUC__) && __GNUC__ < 4
- // workaround for GCC 3:
- rhs.second = node[1].template as<U>();
-#else
- rhs.second = node[1].as<U>();
-#endif
- return true;
- }
-};
-
-// binary
-template <>
-struct convert<Binary> {
- static Node encode(const Binary& rhs) {
- return Node(EncodeBase64(rhs.data(), rhs.size()));
- }
-
- static bool decode(const Node& node, Binary& rhs) {
- if (!node.IsScalar())
- return false;
-
- std::vector<unsigned char> data = DecodeBase64(node.Scalar());
- if (data.empty() && !node.Scalar().empty())
- return false;
-
- rhs.swap(data);
- return true;
- }
-};
-}
-
-#endif // NODE_CONVERT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/bool_type.h b/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/bool_type.h
deleted file mode 100644
index 2c80705..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/bool_type.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef NODE_DETAIL_BOOL_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define NODE_DETAIL_BOOL_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-namespace YAML {
-namespace detail {
-struct unspecified_bool {
- struct NOT_ALLOWED;
- static void true_value(NOT_ALLOWED*) {}
-};
-typedef void (*unspecified_bool_type)(unspecified_bool::NOT_ALLOWED*);
-}
-}
-
-#define YAML_CPP_OPERATOR_BOOL() \
- operator YAML::detail::unspecified_bool_type() const { \
- return this->operator!() ? 0 \
- : &YAML::detail::unspecified_bool::true_value; \
- }
-
-#endif // NODE_DETAIL_BOOL_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/impl.h b/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/impl.h
deleted file mode 100644
index 09e55f8..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/impl.h
+++ /dev/null
@@ -1,185 +0,0 @@
-#ifndef NODE_DETAIL_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define NODE_DETAIL_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include "yaml-cpp/node/detail/node.h"
-#include "yaml-cpp/node/detail/node_data.h"
-#include <type_traits>
-
-namespace YAML {
-namespace detail {
-template <typename Key, typename Enable = void>
-struct get_idx {
- static node* get(const std::vector<node*>& /* sequence */,
- const Key& /* key */, shared_memory_holder /* pMemory */) {
- return 0;
- }
-};
-
-template <typename Key>
-struct get_idx<Key,
- typename std::enable_if<std::is_unsigned<Key>::value &&
- !std::is_same<Key, bool>::value>::type> {
- static node* get(const std::vector<node*>& sequence, const Key& key,
- shared_memory_holder /* pMemory */) {
- return key < sequence.size() ? sequence[key] : 0;
- }
-
- static node* get(std::vector<node*>& sequence, const Key& key,
- shared_memory_holder pMemory) {
- if (key > sequence.size() || (key > 0 && !sequence[key-1]->is_defined()))
- return 0;
- if (key == sequence.size())
- sequence.push_back(&pMemory->create_node());
- return sequence[key];
- }
-};
-
-template <typename Key>
-struct get_idx<Key, typename std::enable_if<std::is_signed<Key>::value>::type> {
- static node* get(const std::vector<node*>& sequence, const Key& key,
- shared_memory_holder pMemory) {
- return key >= 0 ? get_idx<std::size_t>::get(
- sequence, static_cast<std::size_t>(key), pMemory)
- : 0;
- }
- static node* get(std::vector<node*>& sequence, const Key& key,
- shared_memory_holder pMemory) {
- return key >= 0 ? get_idx<std::size_t>::get(
- sequence, static_cast<std::size_t>(key), pMemory)
- : 0;
- }
-};
-
-template <typename T>
-inline bool node::equals(const T& rhs, shared_memory_holder pMemory) {
- T lhs;
- if (convert<T>::decode(Node(*this, pMemory), lhs)) {
- return lhs == rhs;
- }
- return false;
-}
-
-inline bool node::equals(const char* rhs, shared_memory_holder pMemory) {
- return equals<std::string>(rhs, pMemory);
-}
-
-// indexing
-template <typename Key>
-inline node* node_data::get(const Key& key,
- shared_memory_holder pMemory) const {
- switch (m_type) {
- case NodeType::Map:
- break;
- case NodeType::Undefined:
- case NodeType::Null:
- return NULL;
- case NodeType::Sequence:
- if (node* pNode = get_idx<Key>::get(m_sequence, key, pMemory))
- return pNode;
- return NULL;
- case NodeType::Scalar:
- throw BadSubscript();
- }
-
- for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
- if (it->first->equals(key, pMemory)) {
- return it->second;
- }
- }
-
- return NULL;
-}
-
-template <typename Key>
-inline node& node_data::get(const Key& key, shared_memory_holder pMemory) {
- switch (m_type) {
- case NodeType::Map:
- break;
- case NodeType::Undefined:
- case NodeType::Null:
- case NodeType::Sequence:
- if (node* pNode = get_idx<Key>::get(m_sequence, key, pMemory)) {
- m_type = NodeType::Sequence;
- return *pNode;
- }
-
- convert_to_map(pMemory);
- break;
- case NodeType::Scalar:
- throw BadSubscript();
- }
-
- for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
- if (it->first->equals(key, pMemory)) {
- return *it->second;
- }
- }
-
- node& k = convert_to_node(key, pMemory);
- node& v = pMemory->create_node();
- insert_map_pair(k, v);
- return v;
-}
-
-template <typename Key>
-inline bool node_data::remove(const Key& key, shared_memory_holder pMemory) {
- if (m_type != NodeType::Map)
- return false;
-
- for (kv_pairs::iterator it = m_undefinedPairs.begin();
- it != m_undefinedPairs.end();) {
- kv_pairs::iterator jt = std::next(it);
- if (it->first->equals(key, pMemory))
- m_undefinedPairs.erase(it);
- it = jt;
- }
-
- for (node_map::iterator it = m_map.begin(); it != m_map.end(); ++it) {
- if (it->first->equals(key, pMemory)) {
- m_map.erase(it);
- return true;
- }
- }
-
- return false;
-}
-
-// map
-template <typename Key, typename Value>
-inline void node_data::force_insert(const Key& key, const Value& value,
- shared_memory_holder pMemory) {
- switch (m_type) {
- case NodeType::Map:
- break;
- case NodeType::Undefined:
- case NodeType::Null:
- case NodeType::Sequence:
- convert_to_map(pMemory);
- break;
- case NodeType::Scalar:
- throw BadInsert();
- }
-
- node& k = convert_to_node(key, pMemory);
- node& v = convert_to_node(value, pMemory);
- insert_map_pair(k, v);
-}
-
-template <typename T>
-inline node& node_data::convert_to_node(const T& rhs,
- shared_memory_holder pMemory) {
- Node value = convert<T>::encode(rhs);
- value.EnsureNodeExists();
- pMemory->merge(*value.m_pMemory);
- return *value.m_pNode;
-}
-}
-}
-
-#endif // NODE_DETAIL_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/iterator.h b/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/iterator.h
deleted file mode 100644
index deec8fb..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/iterator.h
+++ /dev/null
@@ -1,92 +0,0 @@
-#ifndef VALUE_DETAIL_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define VALUE_DETAIL_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include "yaml-cpp/dll.h"
-#include "yaml-cpp/node/node.h"
-#include "yaml-cpp/node/ptr.h"
-#include "yaml-cpp/node/detail/node_iterator.h"
-#include <cstddef>
-#include <iterator>
-
-namespace YAML {
-namespace detail {
-struct iterator_value;
-
-template <typename V>
-class iterator_base : public std::iterator<std::forward_iterator_tag, V,
- std::ptrdiff_t, V*, V> {
-
- private:
- template <typename>
- friend class iterator_base;
- struct enabler {};
- typedef node_iterator base_type;
-
- struct proxy {
- explicit proxy(const V& x) : m_ref(x) {}
- V* operator->() { return std::addressof(m_ref); }
- operator V*() { return std::addressof(m_ref); }
-
- V m_ref;
- };
-
- public:
- typedef typename iterator_base::value_type value_type;
-
- public:
- iterator_base() : m_iterator(), m_pMemory() {}
- explicit iterator_base(base_type rhs, shared_memory_holder pMemory)
- : m_iterator(rhs), m_pMemory(pMemory) {}
-
- template <class W>
- iterator_base(const iterator_base<W>& rhs,
- typename std::enable_if<std::is_convertible<W*, V*>::value,
- enabler>::type = enabler())
- : m_iterator(rhs.m_iterator), m_pMemory(rhs.m_pMemory) {}
-
- iterator_base<V>& operator++() {
- ++m_iterator;
- return *this;
- }
-
- iterator_base<V> operator++(int) {
- iterator_base<V> iterator_pre(*this);
- ++(*this);
- return iterator_pre;
- }
-
- template <typename W>
- bool operator==(const iterator_base<W>& rhs) const {
- return m_iterator == rhs.m_iterator;
- }
-
- template <typename W>
- bool operator!=(const iterator_base<W>& rhs) const {
- return m_iterator != rhs.m_iterator;
- }
-
- value_type operator*() const {
- const typename base_type::value_type& v = *m_iterator;
- if (v.pNode)
- return value_type(Node(*v, m_pMemory));
- if (v.first && v.second)
- return value_type(Node(*v.first, m_pMemory), Node(*v.second, m_pMemory));
- return value_type();
- }
-
- proxy operator->() const { return proxy(**this); }
-
- private:
- base_type m_iterator;
- shared_memory_holder m_pMemory;
-};
-}
-}
-
-#endif // VALUE_DETAIL_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/iterator_fwd.h b/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/iterator_fwd.h
deleted file mode 100644
index 5f1ffe7..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/iterator_fwd.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef VALUE_DETAIL_ITERATOR_FWD_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define VALUE_DETAIL_ITERATOR_FWD_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include "yaml-cpp/dll.h"
-#include <list>
-#include <utility>
-#include <vector>
-
-namespace YAML {
-
-namespace detail {
-struct iterator_value;
-template <typename V>
-class iterator_base;
-}
-
-typedef detail::iterator_base<detail::iterator_value> iterator;
-typedef detail::iterator_base<const detail::iterator_value> const_iterator;
-}
-
-#endif // VALUE_DETAIL_ITERATOR_FWD_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/memory.h b/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/memory.h
deleted file mode 100644
index 8f2bc26..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/memory.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef VALUE_DETAIL_MEMORY_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define VALUE_DETAIL_MEMORY_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include <set>
-
-#include "yaml-cpp/dll.h"
-#include "yaml-cpp/node/ptr.h"
-
-namespace YAML {
-namespace detail {
-class node;
-} // namespace detail
-} // namespace YAML
-
-namespace YAML {
-namespace detail {
-class YAML_CPP_API memory {
- public:
- node& create_node();
- void merge(const memory& rhs);
-
- private:
- typedef std::set<shared_node> Nodes;
- Nodes m_nodes;
-};
-
-class YAML_CPP_API memory_holder {
- public:
- memory_holder() : m_pMemory(new memory) {}
-
- node& create_node() { return m_pMemory->create_node(); }
- void merge(memory_holder& rhs);
-
- private:
- shared_memory m_pMemory;
-};
-}
-}
-
-#endif // VALUE_DETAIL_MEMORY_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/node.h b/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/node.h
deleted file mode 100644
index 8a776f6..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/node.h
+++ /dev/null
@@ -1,169 +0,0 @@
-#ifndef NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include "yaml-cpp/emitterstyle.h"
-#include "yaml-cpp/dll.h"
-#include "yaml-cpp/node/type.h"
-#include "yaml-cpp/node/ptr.h"
-#include "yaml-cpp/node/detail/node_ref.h"
-#include <set>
-
-namespace YAML {
-namespace detail {
-class node {
- public:
- node() : m_pRef(new node_ref) {}
- node(const node&) = delete;
- node& operator=(const node&) = delete;
-
- bool is(const node& rhs) const { return m_pRef == rhs.m_pRef; }
- const node_ref* ref() const { return m_pRef.get(); }
-
- bool is_defined() const { return m_pRef->is_defined(); }
- const Mark& mark() const { return m_pRef->mark(); }
- NodeType::value type() const { return m_pRef->type(); }
-
- const std::string& scalar() const { return m_pRef->scalar(); }
- const std::string& tag() const { return m_pRef->tag(); }
- EmitterStyle::value style() const { return m_pRef->style(); }
-
- template <typename T>
- bool equals(const T& rhs, shared_memory_holder pMemory);
- bool equals(const char* rhs, shared_memory_holder pMemory);
-
- void mark_defined() {
- if (is_defined())
- return;
-
- m_pRef->mark_defined();
- for (nodes::iterator it = m_dependencies.begin();
- it != m_dependencies.end(); ++it)
- (*it)->mark_defined();
- m_dependencies.clear();
- }
-
- void add_dependency(node& rhs) {
- if (is_defined())
- rhs.mark_defined();
- else
- m_dependencies.insert(&rhs);
- }
-
- void set_ref(const node& rhs) {
- if (rhs.is_defined())
- mark_defined();
- m_pRef = rhs.m_pRef;
- }
- void set_data(const node& rhs) {
- if (rhs.is_defined())
- mark_defined();
- m_pRef->set_data(*rhs.m_pRef);
- }
-
- void set_mark(const Mark& mark) { m_pRef->set_mark(mark); }
-
- void set_type(NodeType::value type) {
- if (type != NodeType::Undefined)
- mark_defined();
- m_pRef->set_type(type);
- }
- void set_null() {
- mark_defined();
- m_pRef->set_null();
- }
- void set_scalar(const std::string& scalar) {
- mark_defined();
- m_pRef->set_scalar(scalar);
- }
- void set_tag(const std::string& tag) {
- mark_defined();
- m_pRef->set_tag(tag);
- }
-
- // style
- void set_style(EmitterStyle::value style) {
- mark_defined();
- m_pRef->set_style(style);
- }
-
- // size/iterator
- std::size_t size() const { return m_pRef->size(); }
-
- const_node_iterator begin() const {
- return static_cast<const node_ref&>(*m_pRef).begin();
- }
- node_iterator begin() { return m_pRef->begin(); }
-
- const_node_iterator end() const {
- return static_cast<const node_ref&>(*m_pRef).end();
- }
- node_iterator end() { return m_pRef->end(); }
-
- // sequence
- void push_back(node& input, shared_memory_holder pMemory) {
- m_pRef->push_back(input, pMemory);
- input.add_dependency(*this);
- }
- void insert(node& key, node& value, shared_memory_holder pMemory) {
- m_pRef->insert(key, value, pMemory);
- key.add_dependency(*this);
- value.add_dependency(*this);
- }
-
- // indexing
- template <typename Key>
- node* get(const Key& key, shared_memory_holder pMemory) const {
- // NOTE: this returns a non-const node so that the top-level Node can wrap
- // it, and returns a pointer so that it can be NULL (if there is no such
- // key).
- return static_cast<const node_ref&>(*m_pRef).get(key, pMemory);
- }
- template <typename Key>
- node& get(const Key& key, shared_memory_holder pMemory) {
- node& value = m_pRef->get(key, pMemory);
- value.add_dependency(*this);
- return value;
- }
- template <typename Key>
- bool remove(const Key& key, shared_memory_holder pMemory) {
- return m_pRef->remove(key, pMemory);
- }
-
- node* get(node& key, shared_memory_holder pMemory) const {
- // NOTE: this returns a non-const node so that the top-level Node can wrap
- // it, and returns a pointer so that it can be NULL (if there is no such
- // key).
- return static_cast<const node_ref&>(*m_pRef).get(key, pMemory);
- }
- node& get(node& key, shared_memory_holder pMemory) {
- node& value = m_pRef->get(key, pMemory);
- key.add_dependency(*this);
- value.add_dependency(*this);
- return value;
- }
- bool remove(node& key, shared_memory_holder pMemory) {
- return m_pRef->remove(key, pMemory);
- }
-
- // map
- template <typename Key, typename Value>
- void force_insert(const Key& key, const Value& value,
- shared_memory_holder pMemory) {
- m_pRef->force_insert(key, value, pMemory);
- }
-
- private:
- shared_node_ref m_pRef;
- typedef std::set<node*> nodes;
- nodes m_dependencies;
-};
-}
-}
-
-#endif // NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/node_data.h b/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/node_data.h
deleted file mode 100644
index 50bcd74..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/node_data.h
+++ /dev/null
@@ -1,127 +0,0 @@
-#ifndef VALUE_DETAIL_NODE_DATA_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define VALUE_DETAIL_NODE_DATA_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include <list>
-#include <map>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "yaml-cpp/dll.h"
-#include "yaml-cpp/node/detail/node_iterator.h"
-#include "yaml-cpp/node/iterator.h"
-#include "yaml-cpp/node/ptr.h"
-#include "yaml-cpp/node/type.h"
-
-namespace YAML {
-namespace detail {
-class node;
-} // namespace detail
-} // namespace YAML
-
-namespace YAML {
-namespace detail {
-class YAML_CPP_API node_data {
- public:
- node_data();
- node_data(const node_data&) = delete;
- node_data& operator=(const node_data&) = delete;
-
- void mark_defined();
- void set_mark(const Mark& mark);
- void set_type(NodeType::value type);
- void set_tag(const std::string& tag);
- void set_null();
- void set_scalar(const std::string& scalar);
- void set_style(EmitterStyle::value style);
-
- bool is_defined() const { return m_isDefined; }
- const Mark& mark() const { return m_mark; }
- NodeType::value type() const {
- return m_isDefined ? m_type : NodeType::Undefined;
- }
- const std::string& scalar() const { return m_scalar; }
- const std::string& tag() const { return m_tag; }
- EmitterStyle::value style() const { return m_style; }
-
- // size/iterator
- std::size_t size() const;
-
- const_node_iterator begin() const;
- node_iterator begin();
-
- const_node_iterator end() const;
- node_iterator end();
-
- // sequence
- void push_back(node& node, shared_memory_holder pMemory);
- void insert(node& key, node& value, shared_memory_holder pMemory);
-
- // indexing
- template <typename Key>
- node* get(const Key& key, shared_memory_holder pMemory) const;
- template <typename Key>
- node& get(const Key& key, shared_memory_holder pMemory);
- template <typename Key>
- bool remove(const Key& key, shared_memory_holder pMemory);
-
- node* get(node& key, shared_memory_holder pMemory) const;
- node& get(node& key, shared_memory_holder pMemory);
- bool remove(node& key, shared_memory_holder pMemory);
-
- // map
- template <typename Key, typename Value>
- void force_insert(const Key& key, const Value& value,
- shared_memory_holder pMemory);
-
- public:
- static std::string empty_scalar;
-
- private:
- void compute_seq_size() const;
- void compute_map_size() const;
-
- void reset_sequence();
- void reset_map();
-
- void insert_map_pair(node& key, node& value);
- void convert_to_map(shared_memory_holder pMemory);
- void convert_sequence_to_map(shared_memory_holder pMemory);
-
- template <typename T>
- static node& convert_to_node(const T& rhs, shared_memory_holder pMemory);
-
- private:
- bool m_isDefined;
- Mark m_mark;
- NodeType::value m_type;
- std::string m_tag;
- EmitterStyle::value m_style;
-
- // scalar
- std::string m_scalar;
-
- // sequence
- typedef std::vector<node*> node_seq;
- node_seq m_sequence;
-
- mutable std::size_t m_seqSize;
-
- // map
- typedef std::vector<std::pair<node*, node*>> node_map;
- node_map m_map;
-
- typedef std::pair<node*, node*> kv_pair;
- typedef std::list<kv_pair> kv_pairs;
- mutable kv_pairs m_undefinedPairs;
-};
-}
-}
-
-#endif // VALUE_DETAIL_NODE_DATA_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/node_iterator.h b/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/node_iterator.h
deleted file mode 100644
index 088090f..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/node_iterator.h
+++ /dev/null
@@ -1,180 +0,0 @@
-#ifndef VALUE_DETAIL_NODE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define VALUE_DETAIL_NODE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include "yaml-cpp/dll.h"
-#include "yaml-cpp/node/ptr.h"
-#include <cstddef>
-#include <iterator>
-#include <memory>
-#include <map>
-#include <utility>
-#include <vector>
-
-namespace YAML {
-namespace detail {
-struct iterator_type {
- enum value { NoneType, Sequence, Map };
-};
-
-template <typename V>
-struct node_iterator_value : public std::pair<V*, V*> {
- typedef std::pair<V*, V*> kv;
-
- node_iterator_value() : kv(), pNode(0) {}
- explicit node_iterator_value(V& rhs) : kv(), pNode(&rhs) {}
- explicit node_iterator_value(V& key, V& value) : kv(&key, &value), pNode(0) {}
-
- V& operator*() const { return *pNode; }
- V& operator->() const { return *pNode; }
-
- V* pNode;
-};
-
-typedef std::vector<node*> node_seq;
-typedef std::vector<std::pair<node*, node*>> node_map;
-
-template <typename V>
-struct node_iterator_type {
- typedef node_seq::iterator seq;
- typedef node_map::iterator map;
-};
-
-template <typename V>
-struct node_iterator_type<const V> {
- typedef node_seq::const_iterator seq;
- typedef node_map::const_iterator map;
-};
-
-template <typename V>
-class node_iterator_base
- : public std::iterator<std::forward_iterator_tag, node_iterator_value<V>,
- std::ptrdiff_t, node_iterator_value<V>*,
- node_iterator_value<V>> {
- private:
- struct enabler {};
-
- struct proxy {
- explicit proxy(const node_iterator_value<V>& x) : m_ref(x) {}
- node_iterator_value<V>* operator->() { return std::addressof(m_ref); }
- operator node_iterator_value<V>*() { return std::addressof(m_ref); }
-
- node_iterator_value<V> m_ref;
- };
-
- public:
- typedef typename node_iterator_type<V>::seq SeqIter;
- typedef typename node_iterator_type<V>::map MapIter;
- typedef node_iterator_value<V> value_type;
-
- node_iterator_base()
- : m_type(iterator_type::NoneType), m_seqIt(), m_mapIt(), m_mapEnd() {}
- explicit node_iterator_base(SeqIter seqIt)
- : m_type(iterator_type::Sequence),
- m_seqIt(seqIt),
- m_mapIt(),
- m_mapEnd() {}
- explicit node_iterator_base(MapIter mapIt, MapIter mapEnd)
- : m_type(iterator_type::Map),
- m_seqIt(),
- m_mapIt(mapIt),
- m_mapEnd(mapEnd) {
- m_mapIt = increment_until_defined(m_mapIt);
- }
-
- template <typename W>
- node_iterator_base(const node_iterator_base<W>& rhs,
- typename std::enable_if<std::is_convertible<W*, V*>::value,
- enabler>::type = enabler())
- : m_type(rhs.m_type),
- m_seqIt(rhs.m_seqIt),
- m_mapIt(rhs.m_mapIt),
- m_mapEnd(rhs.m_mapEnd) {}
-
- template <typename>
- friend class node_iterator_base;
-
- template <typename W>
- bool operator==(const node_iterator_base<W>& rhs) const {
- if (m_type != rhs.m_type)
- return false;
-
- switch (m_type) {
- case iterator_type::NoneType:
- return true;
- case iterator_type::Sequence:
- return m_seqIt == rhs.m_seqIt;
- case iterator_type::Map:
- return m_mapIt == rhs.m_mapIt;
- }
- return true;
- }
-
- template <typename W>
- bool operator!=(const node_iterator_base<W>& rhs) const {
- return !(*this == rhs);
- }
-
- node_iterator_base<V>& operator++() {
- switch (m_type) {
- case iterator_type::NoneType:
- break;
- case iterator_type::Sequence:
- ++m_seqIt;
- break;
- case iterator_type::Map:
- ++m_mapIt;
- m_mapIt = increment_until_defined(m_mapIt);
- break;
- }
- return *this;
- }
-
- node_iterator_base<V> operator++(int) {
- node_iterator_base<V> iterator_pre(*this);
- ++(*this);
- return iterator_pre;
- }
-
- value_type operator*() const {
- switch (m_type) {
- case iterator_type::NoneType:
- return value_type();
- case iterator_type::Sequence:
- return value_type(**m_seqIt);
- case iterator_type::Map:
- return value_type(*m_mapIt->first, *m_mapIt->second);
- }
- return value_type();
- }
-
- proxy operator->() const { return proxy(**this); }
-
- MapIter increment_until_defined(MapIter it) {
- while (it != m_mapEnd && !is_defined(it))
- ++it;
- return it;
- }
-
- bool is_defined(MapIter it) const {
- return it->first->is_defined() && it->second->is_defined();
- }
-
- private:
- typename iterator_type::value m_type;
-
- SeqIter m_seqIt;
- MapIter m_mapIt, m_mapEnd;
-};
-
-typedef node_iterator_base<node> node_iterator;
-typedef node_iterator_base<const node> const_node_iterator;
-}
-}
-
-#endif // VALUE_DETAIL_NODE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/node_ref.h b/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/node_ref.h
deleted file mode 100644
index d8a94f8..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/node/detail/node_ref.h
+++ /dev/null
@@ -1,98 +0,0 @@
-#ifndef VALUE_DETAIL_NODE_REF_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define VALUE_DETAIL_NODE_REF_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include "yaml-cpp/dll.h"
-#include "yaml-cpp/node/type.h"
-#include "yaml-cpp/node/ptr.h"
-#include "yaml-cpp/node/detail/node_data.h"
-
-namespace YAML {
-namespace detail {
-class node_ref {
- public:
- node_ref() : m_pData(new node_data) {}
- node_ref(const node_ref&) = delete;
- node_ref& operator=(const node_ref&) = delete;
-
- bool is_defined() const { return m_pData->is_defined(); }
- const Mark& mark() const { return m_pData->mark(); }
- NodeType::value type() const { return m_pData->type(); }
- const std::string& scalar() const { return m_pData->scalar(); }
- const std::string& tag() const { return m_pData->tag(); }
- EmitterStyle::value style() const { return m_pData->style(); }
-
- void mark_defined() { m_pData->mark_defined(); }
- void set_data(const node_ref& rhs) { m_pData = rhs.m_pData; }
-
- void set_mark(const Mark& mark) { m_pData->set_mark(mark); }
- void set_type(NodeType::value type) { m_pData->set_type(type); }
- void set_tag(const std::string& tag) { m_pData->set_tag(tag); }
- void set_null() { m_pData->set_null(); }
- void set_scalar(const std::string& scalar) { m_pData->set_scalar(scalar); }
- void set_style(EmitterStyle::value style) { m_pData->set_style(style); }
-
- // size/iterator
- std::size_t size() const { return m_pData->size(); }
-
- const_node_iterator begin() const {
- return static_cast<const node_data&>(*m_pData).begin();
- }
- node_iterator begin() { return m_pData->begin(); }
-
- const_node_iterator end() const {
- return static_cast<const node_data&>(*m_pData).end();
- }
- node_iterator end() { return m_pData->end(); }
-
- // sequence
- void push_back(node& node, shared_memory_holder pMemory) {
- m_pData->push_back(node, pMemory);
- }
- void insert(node& key, node& value, shared_memory_holder pMemory) {
- m_pData->insert(key, value, pMemory);
- }
-
- // indexing
- template <typename Key>
- node* get(const Key& key, shared_memory_holder pMemory) const {
- return static_cast<const node_data&>(*m_pData).get(key, pMemory);
- }
- template <typename Key>
- node& get(const Key& key, shared_memory_holder pMemory) {
- return m_pData->get(key, pMemory);
- }
- template <typename Key>
- bool remove(const Key& key, shared_memory_holder pMemory) {
- return m_pData->remove(key, pMemory);
- }
-
- node* get(node& key, shared_memory_holder pMemory) const {
- return static_cast<const node_data&>(*m_pData).get(key, pMemory);
- }
- node& get(node& key, shared_memory_holder pMemory) {
- return m_pData->get(key, pMemory);
- }
- bool remove(node& key, shared_memory_holder pMemory) {
- return m_pData->remove(key, pMemory);
- }
-
- // map
- template <typename Key, typename Value>
- void force_insert(const Key& key, const Value& value,
- shared_memory_holder pMemory) {
- m_pData->force_insert(key, value, pMemory);
- }
-
- private:
- shared_node_data m_pData;
-};
-}
-}
-
-#endif // VALUE_DETAIL_NODE_REF_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/node/emit.h b/funasr/runtime/onnxruntime/include/yaml-cpp/node/emit.h
deleted file mode 100644
index 032268c..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/node/emit.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include <string>
-#include <iosfwd>
-
-#include "yaml-cpp/dll.h"
-
-namespace YAML {
-class Emitter;
-class Node;
-
-/**
- * Emits the node to the given {@link Emitter}. If there is an error in writing,
- * {@link Emitter#good} will return false.
- */
-YAML_CPP_API Emitter& operator<<(Emitter& out, const Node& node);
-
-/** Emits the node to the given output stream. */
-YAML_CPP_API std::ostream& operator<<(std::ostream& out, const Node& node);
-
-/** Converts the node to a YAML string. */
-YAML_CPP_API std::string Dump(const Node& node);
-} // namespace YAML
-
-#endif // NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/node/impl.h b/funasr/runtime/onnxruntime/include/yaml-cpp/node/impl.h
deleted file mode 100644
index 20c487a..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/node/impl.h
+++ /dev/null
@@ -1,448 +0,0 @@
-#ifndef NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include "yaml-cpp/node/node.h"
-#include "yaml-cpp/node/iterator.h"
-#include "yaml-cpp/node/detail/memory.h"
-#include "yaml-cpp/node/detail/node.h"
-#include "yaml-cpp/exceptions.h"
-#include <string>
-
-namespace YAML {
-inline Node::Node() : m_isValid(true), m_pNode(NULL) {}
-
-inline Node::Node(NodeType::value type)
- : m_isValid(true),
- m_pMemory(new detail::memory_holder),
- m_pNode(&m_pMemory->create_node()) {
- m_pNode->set_type(type);
-}
-
-template <typename T>
-inline Node::Node(const T& rhs)
- : m_isValid(true),
- m_pMemory(new detail::memory_holder),
- m_pNode(&m_pMemory->create_node()) {
- Assign(rhs);
-}
-
-inline Node::Node(const detail::iterator_value& rhs)
- : m_isValid(rhs.m_isValid),
- m_pMemory(rhs.m_pMemory),
- m_pNode(rhs.m_pNode) {}
-
-inline Node::Node(const Node& rhs)
- : m_isValid(rhs.m_isValid),
- m_pMemory(rhs.m_pMemory),
- m_pNode(rhs.m_pNode) {}
-
-inline Node::Node(Zombie) : m_isValid(false), m_pNode(NULL) {}
-
-inline Node::Node(detail::node& node, detail::shared_memory_holder pMemory)
- : m_isValid(true), m_pMemory(pMemory), m_pNode(&node) {}
-
-inline Node::~Node() {}
-
-inline void Node::EnsureNodeExists() const {
- if (!m_isValid)
- throw InvalidNode();
- if (!m_pNode) {
- m_pMemory.reset(new detail::memory_holder);
- m_pNode = &m_pMemory->create_node();
- m_pNode->set_null();
- }
-}
-
-inline bool Node::IsDefined() const {
- if (!m_isValid) {
- return false;
- }
- return m_pNode ? m_pNode->is_defined() : true;
-}
-
-inline Mark Node::Mark() const {
- if (!m_isValid) {
- throw InvalidNode();
- }
- return m_pNode ? m_pNode->mark() : Mark::null_mark();
-}
-
-inline NodeType::value Node::Type() const {
- if (!m_isValid)
- throw InvalidNode();
- return m_pNode ? m_pNode->type() : NodeType::Null;
-}
-
-// access
-
-// template helpers
-template <typename T, typename S>
-struct as_if {
- explicit as_if(const Node& node_) : node(node_) {}
- const Node& node;
-
- T operator()(const S& fallback) const {
- if (!node.m_pNode)
- return fallback;
-
- T t;
- if (convert<T>::decode(node, t))
- return t;
- return fallback;
- }
-};
-
-template <typename S>
-struct as_if<std::string, S> {
- explicit as_if(const Node& node_) : node(node_) {}
- const Node& node;
-
- std::string operator()(const S& fallback) const {
- if (node.Type() != NodeType::Scalar)
- return fallback;
- return node.Scalar();
- }
-};
-
-template <typename T>
-struct as_if<T, void> {
- explicit as_if(const Node& node_) : node(node_) {}
- const Node& node;
-
- T operator()() const {
- if (!node.m_pNode)
- throw TypedBadConversion<T>(node.Mark());
-
- T t;
- if (convert<T>::decode(node, t))
- return t;
- throw TypedBadConversion<T>(node.Mark());
- }
-};
-
-template <>
-struct as_if<std::string, void> {
- explicit as_if(const Node& node_) : node(node_) {}
- const Node& node;
-
- std::string operator()() const {
- if (node.Type() != NodeType::Scalar)
- throw TypedBadConversion<std::string>(node.Mark());
- return node.Scalar();
- }
-};
-
-// access functions
-template <typename T>
-inline T Node::as() const {
- if (!m_isValid)
- throw InvalidNode();
- return as_if<T, void>(*this)();
-}
-
-template <typename T, typename S>
-inline T Node::as(const S& fallback) const {
- if (!m_isValid)
- return fallback;
- return as_if<T, S>(*this)(fallback);
-}
-
-inline const std::string& Node::Scalar() const {
- if (!m_isValid)
- throw InvalidNode();
- return m_pNode ? m_pNode->scalar() : detail::node_data::empty_scalar;
-}
-
-inline const std::string& Node::Tag() const {
- if (!m_isValid)
- throw InvalidNode();
- return m_pNode ? m_pNode->tag() : detail::node_data::empty_scalar;
-}
-
-inline void Node::SetTag(const std::string& tag) {
- if (!m_isValid)
- throw InvalidNode();
- EnsureNodeExists();
- m_pNode->set_tag(tag);
-}
-
-inline EmitterStyle::value Node::Style() const {
- if (!m_isValid)
- throw InvalidNode();
- return m_pNode ? m_pNode->style() : EmitterStyle::Default;
-}
-
-inline void Node::SetStyle(EmitterStyle::value style) {
- if (!m_isValid)
- throw InvalidNode();
- EnsureNodeExists();
- m_pNode->set_style(style);
-}
-
-// assignment
-inline bool Node::is(const Node& rhs) const {
- if (!m_isValid || !rhs.m_isValid)
- throw InvalidNode();
- if (!m_pNode || !rhs.m_pNode)
- return false;
- return m_pNode->is(*rhs.m_pNode);
-}
-
-template <typename T>
-inline Node& Node::operator=(const T& rhs) {
- if (!m_isValid)
- throw InvalidNode();
- Assign(rhs);
- return *this;
-}
-
-inline void Node::reset(const YAML::Node& rhs) {
- if (!m_isValid || !rhs.m_isValid)
- throw InvalidNode();
- m_pMemory = rhs.m_pMemory;
- m_pNode = rhs.m_pNode;
-}
-
-template <typename T>
-inline void Node::Assign(const T& rhs) {
- if (!m_isValid)
- throw InvalidNode();
- AssignData(convert<T>::encode(rhs));
-}
-
-template <>
-inline void Node::Assign(const std::string& rhs) {
- if (!m_isValid)
- throw InvalidNode();
- EnsureNodeExists();
- m_pNode->set_scalar(rhs);
-}
-
-inline void Node::Assign(const char* rhs) {
- if (!m_isValid)
- throw InvalidNode();
- EnsureNodeExists();
- m_pNode->set_scalar(rhs);
-}
-
-inline void Node::Assign(char* rhs) {
- if (!m_isValid)
- throw InvalidNode();
- EnsureNodeExists();
- m_pNode->set_scalar(rhs);
-}
-
-inline Node& Node::operator=(const Node& rhs) {
- if (!m_isValid || !rhs.m_isValid)
- throw InvalidNode();
- if (is(rhs))
- return *this;
- AssignNode(rhs);
- return *this;
-}
-
-inline void Node::AssignData(const Node& rhs) {
- if (!m_isValid || !rhs.m_isValid)
- throw InvalidNode();
- EnsureNodeExists();
- rhs.EnsureNodeExists();
-
- m_pNode->set_data(*rhs.m_pNode);
- m_pMemory->merge(*rhs.m_pMemory);
-}
-
-inline void Node::AssignNode(const Node& rhs) {
- if (!m_isValid || !rhs.m_isValid)
- throw InvalidNode();
- rhs.EnsureNodeExists();
-
- if (!m_pNode) {
- m_pNode = rhs.m_pNode;
- m_pMemory = rhs.m_pMemory;
- return;
- }
-
- m_pNode->set_ref(*rhs.m_pNode);
- m_pMemory->merge(*rhs.m_pMemory);
- m_pNode = rhs.m_pNode;
-}
-
-// size/iterator
-inline std::size_t Node::size() const {
- if (!m_isValid)
- throw InvalidNode();
- return m_pNode ? m_pNode->size() : 0;
-}
-
-inline const_iterator Node::begin() const {
- if (!m_isValid)
- return const_iterator();
- return m_pNode ? const_iterator(m_pNode->begin(), m_pMemory)
- : const_iterator();
-}
-
-inline iterator Node::begin() {
- if (!m_isValid)
- return iterator();
- return m_pNode ? iterator(m_pNode->begin(), m_pMemory) : iterator();
-}
-
-inline const_iterator Node::end() const {
- if (!m_isValid)
- return const_iterator();
- return m_pNode ? const_iterator(m_pNode->end(), m_pMemory) : const_iterator();
-}
-
-inline iterator Node::end() {
- if (!m_isValid)
- return iterator();
- return m_pNode ? iterator(m_pNode->end(), m_pMemory) : iterator();
-}
-
-// sequence
-template <typename T>
-inline void Node::push_back(const T& rhs) {
- if (!m_isValid)
- throw InvalidNode();
- push_back(Node(rhs));
-}
-
-inline void Node::push_back(const Node& rhs) {
- if (!m_isValid || !rhs.m_isValid)
- throw InvalidNode();
- EnsureNodeExists();
- rhs.EnsureNodeExists();
-
- m_pNode->push_back(*rhs.m_pNode, m_pMemory);
- m_pMemory->merge(*rhs.m_pMemory);
-}
-
-// helpers for indexing
-namespace detail {
-template <typename T>
-struct to_value_t {
- explicit to_value_t(const T& t_) : t(t_) {}
- const T& t;
- typedef const T& return_type;
-
- const T& operator()() const { return t; }
-};
-
-template <>
-struct to_value_t<const char*> {
- explicit to_value_t(const char* t_) : t(t_) {}
- const char* t;
- typedef std::string return_type;
-
- const std::string operator()() const { return t; }
-};
-
-template <>
-struct to_value_t<char*> {
- explicit to_value_t(char* t_) : t(t_) {}
- const char* t;
- typedef std::string return_type;
-
- const std::string operator()() const { return t; }
-};
-
-template <std::size_t N>
-struct to_value_t<char[N]> {
- explicit to_value_t(const char* t_) : t(t_) {}
- const char* t;
- typedef std::string return_type;
-
- const std::string operator()() const { return t; }
-};
-
-// converts C-strings to std::strings so they can be copied
-template <typename T>
-inline typename to_value_t<T>::return_type to_value(const T& t) {
- return to_value_t<T>(t)();
-}
-}
-
-// indexing
-template <typename Key>
-inline const Node Node::operator[](const Key& key) const {
- if (!m_isValid)
- throw InvalidNode();
- EnsureNodeExists();
- detail::node* value = static_cast<const detail::node&>(*m_pNode)
- .get(detail::to_value(key), m_pMemory);
- if (!value) {
- return Node(ZombieNode);
- }
- return Node(*value, m_pMemory);
-}
-
-template <typename Key>
-inline Node Node::operator[](const Key& key) {
- if (!m_isValid)
- throw InvalidNode();
- EnsureNodeExists();
- detail::node& value = m_pNode->get(detail::to_value(key), m_pMemory);
- return Node(value, m_pMemory);
-}
-
-template <typename Key>
-inline bool Node::remove(const Key& key) {
- if (!m_isValid)
- throw InvalidNode();
- EnsureNodeExists();
- return m_pNode->remove(detail::to_value(key), m_pMemory);
-}
-
-inline const Node Node::operator[](const Node& key) const {
- if (!m_isValid || !key.m_isValid)
- throw InvalidNode();
- EnsureNodeExists();
- key.EnsureNodeExists();
- m_pMemory->merge(*key.m_pMemory);
- detail::node* value =
- static_cast<const detail::node&>(*m_pNode).get(*key.m_pNode, m_pMemory);
- if (!value) {
- return Node(ZombieNode);
- }
- return Node(*value, m_pMemory);
-}
-
-inline Node Node::operator[](const Node& key) {
- if (!m_isValid || !key.m_isValid)
- throw InvalidNode();
- EnsureNodeExists();
- key.EnsureNodeExists();
- m_pMemory->merge(*key.m_pMemory);
- detail::node& value = m_pNode->get(*key.m_pNode, m_pMemory);
- return Node(value, m_pMemory);
-}
-
-inline bool Node::remove(const Node& key) {
- if (!m_isValid || !key.m_isValid)
- throw InvalidNode();
- EnsureNodeExists();
- key.EnsureNodeExists();
- return m_pNode->remove(*key.m_pNode, m_pMemory);
-}
-
-// map
-template <typename Key, typename Value>
-inline void Node::force_insert(const Key& key, const Value& value) {
- if (!m_isValid)
- throw InvalidNode();
- EnsureNodeExists();
- m_pNode->force_insert(detail::to_value(key), detail::to_value(value),
- m_pMemory);
-}
-
-// free functions
-inline bool operator==(const Node& lhs, const Node& rhs) { return lhs.is(rhs); }
-}
-
-#endif // NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/node/iterator.h b/funasr/runtime/onnxruntime/include/yaml-cpp/node/iterator.h
deleted file mode 100644
index 366a9c8..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/node/iterator.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include "yaml-cpp/dll.h"
-#include "yaml-cpp/node/node.h"
-#include "yaml-cpp/node/detail/iterator_fwd.h"
-#include "yaml-cpp/node/detail/iterator.h"
-#include <list>
-#include <utility>
-#include <vector>
-
-namespace YAML {
-namespace detail {
-struct iterator_value : public Node, std::pair<Node, Node> {
- iterator_value() {}
- explicit iterator_value(const Node& rhs)
- : Node(rhs),
- std::pair<Node, Node>(Node(Node::ZombieNode), Node(Node::ZombieNode)) {}
- explicit iterator_value(const Node& key, const Node& value)
- : Node(Node::ZombieNode), std::pair<Node, Node>(key, value) {}
-};
-}
-}
-
-#endif // VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/node/node.h b/funasr/runtime/onnxruntime/include/yaml-cpp/node/node.h
deleted file mode 100644
index 1ded7d2..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/node/node.h
+++ /dev/null
@@ -1,145 +0,0 @@
-#ifndef NODE_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define NODE_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include <stdexcept>
-
-#include "yaml-cpp/dll.h"
-#include "yaml-cpp/emitterstyle.h"
-#include "yaml-cpp/mark.h"
-#include "yaml-cpp/node/detail/bool_type.h"
-#include "yaml-cpp/node/detail/iterator_fwd.h"
-#include "yaml-cpp/node/ptr.h"
-#include "yaml-cpp/node/type.h"
-
-namespace YAML {
-namespace detail {
-class node;
-class node_data;
-struct iterator_value;
-} // namespace detail
-} // namespace YAML
-
-namespace YAML {
-class YAML_CPP_API Node {
- public:
- friend class NodeBuilder;
- friend class NodeEvents;
- friend struct detail::iterator_value;
- friend class detail::node;
- friend class detail::node_data;
- template <typename>
- friend class detail::iterator_base;
- template <typename T, typename S>
- friend struct as_if;
-
- typedef YAML::iterator iterator;
- typedef YAML::const_iterator const_iterator;
-
- Node();
- explicit Node(NodeType::value type);
- template <typename T>
- explicit Node(const T& rhs);
- explicit Node(const detail::iterator_value& rhs);
- Node(const Node& rhs);
- ~Node();
-
- YAML::Mark Mark() const;
- NodeType::value Type() const;
- bool IsDefined() const;
- bool IsNull() const { return Type() == NodeType::Null; }
- bool IsScalar() const { return Type() == NodeType::Scalar; }
- bool IsSequence() const { return Type() == NodeType::Sequence; }
- bool IsMap() const { return Type() == NodeType::Map; }
-
- // bool conversions
- YAML_CPP_OPERATOR_BOOL()
- bool operator!() const { return !IsDefined(); }
-
- // access
- template <typename T>
- T as() const;
- template <typename T, typename S>
- T as(const S& fallback) const;
- const std::string& Scalar() const;
-
- const std::string& Tag() const;
- void SetTag(const std::string& tag);
-
- // style
- // WARNING: This API might change in future releases.
- EmitterStyle::value Style() const;
- void SetStyle(EmitterStyle::value style);
-
- // assignment
- bool is(const Node& rhs) const;
- template <typename T>
- Node& operator=(const T& rhs);
- Node& operator=(const Node& rhs);
- void reset(const Node& rhs = Node());
-
- // size/iterator
- std::size_t size() const;
-
- const_iterator begin() const;
- iterator begin();
-
- const_iterator end() const;
- iterator end();
-
- // sequence
- template <typename T>
- void push_back(const T& rhs);
- void push_back(const Node& rhs);
-
- // indexing
- template <typename Key>
- const Node operator[](const Key& key) const;
- template <typename Key>
- Node operator[](const Key& key);
- template <typename Key>
- bool remove(const Key& key);
-
- const Node operator[](const Node& key) const;
- Node operator[](const Node& key);
- bool remove(const Node& key);
-
- // map
- template <typename Key, typename Value>
- void force_insert(const Key& key, const Value& value);
-
- private:
- enum Zombie { ZombieNode };
- explicit Node(Zombie);
- explicit Node(detail::node& node, detail::shared_memory_holder pMemory);
-
- void EnsureNodeExists() const;
-
- template <typename T>
- void Assign(const T& rhs);
- void Assign(const char* rhs);
- void Assign(char* rhs);
-
- void AssignData(const Node& rhs);
- void AssignNode(const Node& rhs);
-
- private:
- bool m_isValid;
- mutable detail::shared_memory_holder m_pMemory;
- mutable detail::node* m_pNode;
-};
-
-YAML_CPP_API bool operator==(const Node& lhs, const Node& rhs);
-
-YAML_CPP_API Node Clone(const Node& node);
-
-template <typename T>
-struct convert;
-}
-
-#endif // NODE_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/node/parse.h b/funasr/runtime/onnxruntime/include/yaml-cpp/node/parse.h
deleted file mode 100644
index 7745fd7..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/node/parse.h
+++ /dev/null
@@ -1,78 +0,0 @@
-#ifndef VALUE_PARSE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define VALUE_PARSE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include <iosfwd>
-#include <string>
-#include <vector>
-
-#include "yaml-cpp/dll.h"
-
-namespace YAML {
-class Node;
-
-/**
- * Loads the input string as a single YAML document.
- *
- * @throws {@link ParserException} if it is malformed.
- */
-YAML_CPP_API Node Load(const std::string& input);
-
-/**
- * Loads the input string as a single YAML document.
- *
- * @throws {@link ParserException} if it is malformed.
- */
-YAML_CPP_API Node Load(const char* input);
-
-/**
- * Loads the input stream as a single YAML document.
- *
- * @throws {@link ParserException} if it is malformed.
- */
-YAML_CPP_API Node Load(std::istream& input);
-
-/**
- * Loads the input file as a single YAML document.
- *
- * @throws {@link ParserException} if it is malformed.
- * @throws {@link BadFile} if the file cannot be loaded.
- */
-YAML_CPP_API Node LoadFile(const std::string& filename);
-
-/**
- * Loads the input string as a list of YAML documents.
- *
- * @throws {@link ParserException} if it is malformed.
- */
-YAML_CPP_API std::vector<Node> LoadAll(const std::string& input);
-
-/**
- * Loads the input string as a list of YAML documents.
- *
- * @throws {@link ParserException} if it is malformed.
- */
-YAML_CPP_API std::vector<Node> LoadAll(const char* input);
-
-/**
- * Loads the input stream as a list of YAML documents.
- *
- * @throws {@link ParserException} if it is malformed.
- */
-YAML_CPP_API std::vector<Node> LoadAll(std::istream& input);
-
-/**
- * Loads the input file as a list of YAML documents.
- *
- * @throws {@link ParserException} if it is malformed.
- * @throws {@link BadFile} if the file cannot be loaded.
- */
-YAML_CPP_API std::vector<Node> LoadAllFromFile(const std::string& filename);
-} // namespace YAML
-
-#endif // VALUE_PARSE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/node/ptr.h b/funasr/runtime/onnxruntime/include/yaml-cpp/node/ptr.h
deleted file mode 100644
index ce085dd..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/node/ptr.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef VALUE_PTR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define VALUE_PTR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include "yaml-cpp/dll.h"
-#include <memory>
-
-namespace YAML {
-namespace detail {
-class node;
-class node_ref;
-class node_data;
-class memory;
-class memory_holder;
-
-typedef std::shared_ptr<node> shared_node;
-typedef std::shared_ptr<node_ref> shared_node_ref;
-typedef std::shared_ptr<node_data> shared_node_data;
-typedef std::shared_ptr<memory_holder> shared_memory_holder;
-typedef std::shared_ptr<memory> shared_memory;
-}
-}
-
-#endif // VALUE_PTR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/node/type.h b/funasr/runtime/onnxruntime/include/yaml-cpp/node/type.h
deleted file mode 100644
index 9d55ca9..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/node/type.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef VALUE_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define VALUE_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-namespace YAML {
-struct NodeType {
- enum value { Undefined, Null, Scalar, Sequence, Map };
-};
-}
-
-#endif // VALUE_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/noncopyable.h b/funasr/runtime/onnxruntime/include/yaml-cpp/noncopyable.h
deleted file mode 100644
index a261040..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/noncopyable.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include "yaml-cpp/dll.h"
-
-namespace YAML {
-// this is basically boost::noncopyable
-class YAML_CPP_API noncopyable {
- protected:
- noncopyable() {}
- ~noncopyable() {}
-
- private:
- noncopyable(const noncopyable&);
- const noncopyable& operator=(const noncopyable&);
-};
-}
-
-#endif // NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/null.h b/funasr/runtime/onnxruntime/include/yaml-cpp/null.h
deleted file mode 100644
index b9521d4..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/null.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include "yaml-cpp/dll.h"
-#include <string>
-
-namespace YAML {
-class Node;
-
-struct YAML_CPP_API _Null {};
-inline bool operator==(const _Null&, const _Null&) { return true; }
-inline bool operator!=(const _Null&, const _Null&) { return false; }
-
-YAML_CPP_API bool IsNull(const Node& node); // old API only
-YAML_CPP_API bool IsNullString(const std::string& str);
-
-extern YAML_CPP_API _Null Null;
-}
-
-#endif // NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/ostream_wrapper.h b/funasr/runtime/onnxruntime/include/yaml-cpp/ostream_wrapper.h
deleted file mode 100644
index 09d45f3..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/ostream_wrapper.h
+++ /dev/null
@@ -1,72 +0,0 @@
-#ifndef OSTREAM_WRAPPER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define OSTREAM_WRAPPER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include <string>
-#include <vector>
-
-#include "yaml-cpp/dll.h"
-
-namespace YAML {
-class YAML_CPP_API ostream_wrapper {
- public:
- ostream_wrapper();
- explicit ostream_wrapper(std::ostream& stream);
- ~ostream_wrapper();
-
- void write(const std::string& str);
- void write(const char* str, std::size_t size);
-
- void set_comment() { m_comment = true; }
-
- const char* str() const {
- if (m_pStream) {
- return 0;
- } else {
- m_buffer[m_pos] = '\0';
- return &m_buffer[0];
- }
- }
-
- std::size_t row() const { return m_row; }
- std::size_t col() const { return m_col; }
- std::size_t pos() const { return m_pos; }
- bool comment() const { return m_comment; }
-
- private:
- void update_pos(char ch);
-
- private:
- mutable std::vector<char> m_buffer;
- std::ostream* const m_pStream;
-
- std::size_t m_pos;
- std::size_t m_row, m_col;
- bool m_comment;
-};
-
-template <std::size_t N>
-inline ostream_wrapper& operator<<(ostream_wrapper& stream,
- const char(&str)[N]) {
- stream.write(str, N - 1);
- return stream;
-}
-
-inline ostream_wrapper& operator<<(ostream_wrapper& stream,
- const std::string& str) {
- stream.write(str);
- return stream;
-}
-
-inline ostream_wrapper& operator<<(ostream_wrapper& stream, char ch) {
- stream.write(&ch, 1);
- return stream;
-}
-}
-
-#endif // OSTREAM_WRAPPER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/parser.h b/funasr/runtime/onnxruntime/include/yaml-cpp/parser.h
deleted file mode 100644
index ceac22d..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/parser.h
+++ /dev/null
@@ -1,86 +0,0 @@
-#ifndef PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include <ios>
-#include <memory>
-
-#include "yaml-cpp/dll.h"
-#include "yaml-cpp/noncopyable.h"
-
-namespace YAML {
-class EventHandler;
-class Node;
-class Scanner;
-struct Directives;
-struct Token;
-
-/**
- * A parser turns a stream of bytes into one stream of "events" per YAML
- * document in the input stream.
- */
-class YAML_CPP_API Parser : private noncopyable {
- public:
- /** Constructs an empty parser (with no input. */
- Parser();
-
- /**
- * Constructs a parser from the given input stream. The input stream must
- * live as long as the parser.
- */
- explicit Parser(std::istream& in);
-
- ~Parser();
-
- /** Evaluates to true if the parser has some valid input to be read. */
- explicit operator bool() const;
-
- /**
- * Resets the parser with the given input stream. Any existing state is
- * erased.
- */
- void Load(std::istream& in);
-
- /**
- * Handles the next document by calling events on the {@code eventHandler}.
- *
- * @throw a ParserException on error.
- * @return false if there are no more documents
- */
- bool HandleNextDocument(EventHandler& eventHandler);
-
- void PrintTokens(std::ostream& out);
-
- private:
- /**
- * Reads any directives that are next in the queue, setting the internal
- * {@code m_pDirectives} state.
- */
- void ParseDirectives();
-
- void HandleDirective(const Token& token);
-
- /**
- * Handles a "YAML" directive, which should be of the form 'major.minor' (like
- * a version number).
- */
- void HandleYamlDirective(const Token& token);
-
- /**
- * Handles a "TAG" directive, which should be of the form 'handle prefix',
- * where 'handle' is converted to 'prefix' in the file.
- */
- void HandleTagDirective(const Token& token);
-
- private:
- std::unique_ptr<Scanner> m_pScanner;
- std::unique_ptr<Directives> m_pDirectives;
-};
-}
-
-#endif // PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/stlemitter.h b/funasr/runtime/onnxruntime/include/yaml-cpp/stlemitter.h
deleted file mode 100644
index 06780c8..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/stlemitter.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include <vector>
-#include <list>
-#include <set>
-#include <map>
-
-namespace YAML {
-template <typename Seq>
-inline Emitter& EmitSeq(Emitter& emitter, const Seq& seq) {
- emitter << BeginSeq;
- for (typename Seq::const_iterator it = seq.begin(); it != seq.end(); ++it)
- emitter << *it;
- emitter << EndSeq;
- return emitter;
-}
-
-template <typename T>
-inline Emitter& operator<<(Emitter& emitter, const std::vector<T>& v) {
- return EmitSeq(emitter, v);
-}
-
-template <typename T>
-inline Emitter& operator<<(Emitter& emitter, const std::list<T>& v) {
- return EmitSeq(emitter, v);
-}
-
-template <typename T>
-inline Emitter& operator<<(Emitter& emitter, const std::set<T>& v) {
- return EmitSeq(emitter, v);
-}
-
-template <typename K, typename V>
-inline Emitter& operator<<(Emitter& emitter, const std::map<K, V>& m) {
- typedef typename std::map<K, V> map;
- emitter << BeginMap;
- for (typename map::const_iterator it = m.begin(); it != m.end(); ++it)
- emitter << Key << it->first << Value << it->second;
- emitter << EndMap;
- return emitter;
-}
-}
-
-#endif // STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/traits.h b/funasr/runtime/onnxruntime/include/yaml-cpp/traits.h
deleted file mode 100644
index f33d0e1..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/traits.h
+++ /dev/null
@@ -1,103 +0,0 @@
-#ifndef TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-namespace YAML {
-template <typename>
-struct is_numeric {
- enum { value = false };
-};
-
-template <>
-struct is_numeric<char> {
- enum { value = true };
-};
-template <>
-struct is_numeric<unsigned char> {
- enum { value = true };
-};
-template <>
-struct is_numeric<int> {
- enum { value = true };
-};
-template <>
-struct is_numeric<unsigned int> {
- enum { value = true };
-};
-template <>
-struct is_numeric<long int> {
- enum { value = true };
-};
-template <>
-struct is_numeric<unsigned long int> {
- enum { value = true };
-};
-template <>
-struct is_numeric<short int> {
- enum { value = true };
-};
-template <>
-struct is_numeric<unsigned short int> {
- enum { value = true };
-};
-#if defined(_MSC_VER) && (_MSC_VER < 1310)
-template <>
-struct is_numeric<__int64> {
- enum { value = true };
-};
-template <>
-struct is_numeric<unsigned __int64> {
- enum { value = true };
-};
-#else
-template <>
-struct is_numeric<long long> {
- enum { value = true };
-};
-template <>
-struct is_numeric<unsigned long long> {
- enum { value = true };
-};
-#endif
-template <>
-struct is_numeric<float> {
- enum { value = true };
-};
-template <>
-struct is_numeric<double> {
- enum { value = true };
-};
-template <>
-struct is_numeric<long double> {
- enum { value = true };
-};
-
-template <bool, class T = void>
-struct enable_if_c {
- typedef T type;
-};
-
-template <class T>
-struct enable_if_c<false, T> {};
-
-template <class Cond, class T = void>
-struct enable_if : public enable_if_c<Cond::value, T> {};
-
-template <bool, class T = void>
-struct disable_if_c {
- typedef T type;
-};
-
-template <class T>
-struct disable_if_c<true, T> {};
-
-template <class Cond, class T = void>
-struct disable_if : public disable_if_c<Cond::value, T> {};
-}
-
-#endif // TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/include/yaml-cpp/yaml.h b/funasr/runtime/onnxruntime/include/yaml-cpp/yaml.h
deleted file mode 100644
index 7f515ef..0000000
--- a/funasr/runtime/onnxruntime/include/yaml-cpp/yaml.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
-#endif
-
-#include "yaml-cpp/parser.h"
-#include "yaml-cpp/emitter.h"
-#include "yaml-cpp/emitterstyle.h"
-#include "yaml-cpp/stlemitter.h"
-#include "yaml-cpp/exceptions.h"
-
-#include "yaml-cpp/node/node.h"
-#include "yaml-cpp/node/impl.h"
-#include "yaml-cpp/node/convert.h"
-#include "yaml-cpp/node/iterator.h"
-#include "yaml-cpp/node/detail/impl.h"
-#include "yaml-cpp/node/parse.h"
-#include "yaml-cpp/node/emit.h"
-
-#endif // YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/funasr/runtime/onnxruntime/src/CMakeLists.txt b/funasr/runtime/onnxruntime/src/CMakeLists.txt
index e00edc1..28a67b4 100644
--- a/funasr/runtime/onnxruntime/src/CMakeLists.txt
+++ b/funasr/runtime/onnxruntime/src/CMakeLists.txt
@@ -8,7 +8,7 @@
add_library(funasr ${files})
if(WIN32)
- set(EXTRA_LIBS pthread yaml-cpp csrc)
+ set(EXTRA_LIBS pthread yaml-cpp csrc glog)
if(CMAKE_CL_64)
target_link_directories(funasr PUBLIC ${CMAKE_SOURCE_DIR}/win/lib/x64)
else()
@@ -18,7 +18,7 @@
target_compile_definitions(funasr PUBLIC -D_FUNASR_API_EXPORT)
else()
- set(EXTRA_LIBS pthread yaml-cpp csrc)
+ set(EXTRA_LIBS pthread yaml-cpp csrc glog )
include_directories(${ONNXRUNTIME_DIR}/include)
endif()
diff --git a/funasr/runtime/onnxruntime/src/fsmn-vad.cpp b/funasr/runtime/onnxruntime/src/fsmn-vad.cpp
index 0f87cb2..2988350 100644
--- a/funasr/runtime/onnxruntime/src/fsmn-vad.cpp
+++ b/funasr/runtime/onnxruntime/src/fsmn-vad.cpp
@@ -1,8 +1,6 @@
#include <fstream>
#include "precomp.h"
-//#include "glog/logging.h"
-
void FsmnVad::InitVad(const std::string &vad_model, const std::string &vad_cmvn, int vad_sample_rate, int vad_silence_duration, int vad_max_len,
float vad_speech_noise_thres) {
@@ -34,10 +32,10 @@
vad_session_ = std::make_shared<Ort::Session>(
env_, vad_model.c_str(), session_options_);
} catch (std::exception const &e) {
- //LOG(ERROR) << "Error when load onnx model: " << e.what();
+ LOG(ERROR) << "Error when load onnx model: " << e.what();
exit(0);
}
- //LOG(INFO) << "vad onnx:";
+ LOG(INFO) << "vad onnx:";
GetInputOutputInfo(vad_session_, &vad_in_names_, &vad_out_names_);
}
@@ -59,8 +57,8 @@
shape << j;
shape << " ";
}
- // LOG(INFO) << "\tInput " << i << " : name=" << name.get() << " type=" << type
- // << " dims=" << shape.str();
+ LOG(INFO) << "\tInput " << i << " : name=" << name.get() << " type=" << type
+ << " dims=" << shape.str();
(*in_names)[i] = name.get();
name.release();
}
@@ -78,8 +76,8 @@
shape << j;
shape << " ";
}
- // LOG(INFO) << "\tOutput " << i << " : name=" << name.get() << " type=" << type
- // << " dims=" << shape.str();
+ LOG(INFO) << "\tOutput " << i << " : name=" << name.get() << " type=" << type
+ << " dims=" << shape.str();
(*out_names)[i] = name.get();
name.release();
}
@@ -119,12 +117,12 @@
// 4. Onnx infer
std::vector<Ort::Value> vad_ort_outputs;
try {
- // VLOG(3) << "Start infer";
+ VLOG(3) << "Start infer";
vad_ort_outputs = vad_session_->Run(
Ort::RunOptions{nullptr}, vad_in_names_.data(), vad_inputs.data(),
vad_inputs.size(), vad_out_names_.data(), vad_out_names_.size());
} catch (std::exception const &e) {
- // LOG(ERROR) << e.what();
+ LOG(ERROR) << e.what();
return;
}
diff --git a/funasr/runtime/onnxruntime/src/funasr-onnx-offline.cpp b/funasr/runtime/onnxruntime/src/funasr-onnx-offline.cpp
index b0d2e4d..80c50ab 100644
--- a/funasr/runtime/onnxruntime/src/funasr-onnx-offline.cpp
+++ b/funasr/runtime/onnxruntime/src/funasr-onnx-offline.cpp
@@ -5,12 +5,28 @@
#include <win_func.h>
#endif
-#include "libfunasrapi.h"
#include <sstream>
+#include <glog/logging.h>
+#include "libfunasrapi.h"
+#include "tclap/CmdLine.h"
+
using namespace std;
int main(int argc, char *argv[])
{
+ google::InitGoogleLogging(argv[0]);
+
+ TCLAP::CmdLine cmd("Command description message", ' ', "1.0");
+ TCLAP::ValueArg<std::string> nameArg("n", "name", "Name of user", true, "", "string");
+ TCLAP::SwitchArg reverseSwitch("r","reverse","Print name backwards", cmd, false);
+ cmd.add(nameArg);
+
+ cmd.parse(argc, argv);
+ string name = nameArg.getValue();
+
+ printf(name.c_str());
+
+
if (argc < 6)
{
printf("Usage: %s /path/to/model_dir /path/to/wav/file quantize(true or false) use_vad(true or false) use_punc(true or false)\n", argv[0]);
diff --git a/funasr/runtime/onnxruntime/src/precomp.h b/funasr/runtime/onnxruntime/src/precomp.h
index d567f15..cf69ad9 100644
--- a/funasr/runtime/onnxruntime/src/precomp.h
+++ b/funasr/runtime/onnxruntime/src/precomp.h
@@ -21,10 +21,11 @@
// third part
#include "onnxruntime_run_options_config_keys.h"
#include "onnxruntime_cxx_api.h"
-#include "kaldi-native-fbank/csrc/feature-fbank.h"
-#include "kaldi-native-fbank/csrc/online-feature.h"
+#include <kaldi-native-fbank/csrc/feature-fbank.h>
+#include <kaldi-native-fbank/csrc/online-feature.h>
// mine
+#include <glog/logging.h>
#include "common-struct.h"
#include "com-define.h"
#include "commonfunc.h"
diff --git a/funasr/runtime/onnxruntime/src/tokenizer.h b/funasr/runtime/onnxruntime/src/tokenizer.h
index 319975a..7326db8 100644
--- a/funasr/runtime/onnxruntime/src/tokenizer.h
+++ b/funasr/runtime/onnxruntime/src/tokenizer.h
@@ -1,5 +1,5 @@
#pragma once
-#include "yaml-cpp/yaml.h"
+#include <yaml-cpp/yaml.h>
class CTokenizer {
private:
diff --git a/funasr/runtime/onnxruntime/third_party/glog/.bazelci/presubmit.yml b/funasr/runtime/onnxruntime/third_party/glog/.bazelci/presubmit.yml
new file mode 100644
index 0000000..04a5385
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/.bazelci/presubmit.yml
@@ -0,0 +1,62 @@
+---
+tasks:
+ ubuntu1804:
+ name: "Ubuntu 18.04"
+ platform: ubuntu1804
+ build_flags:
+ - "--features=layering_check"
+ - "--copt=-Werror"
+ build_targets:
+ - "//..."
+ test_flags:
+ - "--features=layering_check"
+ - "--copt=-Werror"
+ test_targets:
+ - "//..."
+ macos:
+ name: "macOS: latest Xcode"
+ platform: macos
+ build_flags:
+ - "--features=layering_check"
+ - "--copt=-Werror"
+ build_targets:
+ - "//..."
+ test_flags:
+ - "--features=layering_check"
+ - "--copt=-Werror"
+ test_targets:
+ - "//..."
+ windows-msvc:
+ name: "Windows: MSVC 2017"
+ platform: windows
+ environment:
+ BAZEL_VC: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC"
+ build_flags:
+ - "--features=layering_check"
+ - "--copt=/WX"
+ build_targets:
+ - "//..."
+ test_flags:
+ - "--features=layering_check"
+ - "--copt=/WX"
+ test_targets:
+ - "//..."
+ windows-clang-cl:
+ name: "Windows: Clang"
+ platform: windows
+ environment:
+ BAZEL_VC: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC"
+ build_flags:
+ - "--extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl"
+ - "--extra_execution_platforms=//:x64_windows-clang-cl"
+ - "--compiler=clang-cl"
+ - "--features=layering_check"
+ build_targets:
+ - "//..."
+ test_flags:
+ - "--extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl"
+ - "--extra_execution_platforms=//:x64_windows-clang-cl"
+ - "--compiler=clang-cl"
+ - "--features=layering_check"
+ test_targets:
+ - "//..."
diff --git a/funasr/runtime/onnxruntime/third_party/glog/.clang-format b/funasr/runtime/onnxruntime/third_party/glog/.clang-format
new file mode 100644
index 0000000..039559d
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/.clang-format
@@ -0,0 +1,168 @@
+---
+Language: Cpp
+# BasedOnStyle: Google
+AccessModifierOffset: -1
+AlignAfterOpenBracket: Align
+AlignConsecutiveMacros: false
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignEscapedNewlines: Left
+AlignOperands: true
+AlignTrailingComments: true
+AllowAllArgumentsOnNextLine: true
+AllowAllConstructorInitializersOnNextLine: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: Never
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: All
+AllowShortLambdasOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: WithoutElse
+AllowShortLoopsOnASingleLine: true
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakAfterReturnType: None
+AlwaysBreakBeforeMultilineStrings: true
+AlwaysBreakTemplateDeclarations: Yes
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+ AfterCaseLabel: false
+ AfterClass: false
+ AfterControlStatement: false
+ AfterEnum: false
+ AfterFunction: false
+ AfterNamespace: false
+ AfterObjCDeclaration: false
+ AfterStruct: false
+ AfterUnion: false
+ AfterExternBlock: false
+ BeforeCatch: false
+ BeforeElse: false
+ IndentBraces: false
+ SplitEmptyFunction: true
+ SplitEmptyRecord: true
+ SplitEmptyNamespace: true
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Attach
+BreakBeforeInheritanceComma: false
+BreakInheritanceList: BeforeColon
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+BreakConstructorInitializers: BeforeColon
+BreakAfterJavaFieldAnnotations: false
+BreakStringLiterals: true
+ColumnLimit: 80
+CommentPragmas: '^ IWYU pragma:'
+CompactNamespaces: false
+ConstructorInitializerAllOnOneLineOrOnePerLine: true
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: true
+DeriveLineEnding: true
+DerivePointerAlignment: true
+DisableFormat: false
+ExperimentalAutoDetectBinPacking: false
+FixNamespaceComments: true
+ForEachMacros:
+ - foreach
+ - Q_FOREACH
+ - BOOST_FOREACH
+IncludeBlocks: Regroup
+IncludeCategories:
+ - Regex: '^<ext/.*\.h>'
+ Priority: 2
+ SortPriority: 0
+ - Regex: '^<.*\.h>'
+ Priority: 1
+ SortPriority: 0
+ - Regex: '^<.*'
+ Priority: 2
+ SortPriority: 0
+ - Regex: '.*'
+ Priority: 3
+ SortPriority: 0
+IncludeIsMainRegex: '([-_](test|unittest))?$'
+IncludeIsMainSourceRegex: ''
+IndentCaseLabels: true
+IndentGotoLabels: true
+IndentPPDirectives: None
+IndentWidth: 2
+IndentWrappedFunctionNames: false
+JavaScriptQuotes: Leave
+JavaScriptWrapImports: true
+KeepEmptyLinesAtTheStartOfBlocks: false
+MacroBlockBegin: ''
+MacroBlockEnd: ''
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBinPackProtocolList: Never
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakAssignment: 2
+PenaltyBreakBeforeFirstCallParameter: 1
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyBreakTemplateDeclaration: 10
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 200
+PointerAlignment: Left
+RawStringFormats:
+ - Language: Cpp
+ Delimiters:
+ - cc
+ - CC
+ - cpp
+ - Cpp
+ - CPP
+ - 'c++'
+ - 'C++'
+ CanonicalDelimiter: ''
+ BasedOnStyle: google
+ - Language: TextProto
+ Delimiters:
+ - pb
+ - PB
+ - proto
+ - PROTO
+ EnclosingFunctions:
+ - EqualsProto
+ - EquivToProto
+ - PARSE_PARTIAL_TEXT_PROTO
+ - PARSE_TEST_PROTO
+ - PARSE_TEXT_PROTO
+ - ParseTextOrDie
+ - ParseTextProtoOrDie
+ CanonicalDelimiter: ''
+ BasedOnStyle: google
+ReflowComments: true
+SortIncludes: true
+SortUsingDeclarations: true
+SpaceAfterCStyleCast: false
+SpaceAfterLogicalNot: false
+SpaceAfterTemplateKeyword: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
+SpaceBeforeParens: ControlStatements
+SpaceBeforeRangeBasedForLoopColon: true
+SpaceInEmptyBlock: false
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 2
+SpacesInAngles: false
+SpacesInConditionalStatement: false
+SpacesInContainerLiterals: true
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+SpaceBeforeSquareBrackets: false
+Standard: c++14
+StatementMacros:
+ - Q_UNUSED
+ - QT_REQUIRE_VERSION
+TabWidth: 8
+UseCRLF: false
+UseTab: Never
+...
+
diff --git a/funasr/runtime/onnxruntime/third_party/glog/.clang-tidy b/funasr/runtime/onnxruntime/third_party/glog/.clang-tidy
new file mode 100644
index 0000000..1f4ea16
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/.clang-tidy
@@ -0,0 +1,59 @@
+---
+Checks: 'clang-diagnostic-*,clang-analyzer-*,google-*,modernize-*,-modernize-use-trailing-return-type,readability-*,portability-*,performance-*,bugprone-*,android-*,darwin-*,clang-analyzer-*'
+WarningsAsErrors: ''
+HeaderFilterRegex: ''
+AnalyzeTemporaryDtors: false
+FormatStyle: file
+CheckOptions:
+ - key: cert-dcl16-c.NewSuffixes
+ value: 'L;LL;LU;LLU'
+ - key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
+ value: '0'
+ - key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors
+ value: '1'
+ - key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
+ value: '1'
+ - key: google-build-namespaces.HeaderFileExtensions
+ value: ',h,hh,hpp,hxx'
+ - key: google-global-names-in-headers.HeaderFileExtensions
+ value: ',h,hh,hpp,hxx'
+ - key: google-readability-braces-around-statements.ShortStatementLines
+ value: '1'
+ - key: google-readability-function-size.BranchThreshold
+ value: '4294967295'
+ - key: google-readability-function-size.LineThreshold
+ value: '4294967295'
+ - key: google-readability-function-size.NestingThreshold
+ value: '4294967295'
+ - key: google-readability-function-size.ParameterThreshold
+ value: '4294967295'
+ - key: google-readability-function-size.StatementThreshold
+ value: '800'
+ - key: google-readability-function-size.VariableThreshold
+ value: '4294967295'
+ - key: google-readability-namespace-comments.ShortNamespaceLines
+ value: '10'
+ - key: google-readability-namespace-comments.SpacesBeforeComments
+ value: '2'
+ - key: google-runtime-int.SignedTypePrefix
+ value: int
+ - key: google-runtime-int.TypeSuffix
+ value: ''
+ - key: google-runtime-int.UnsignedTypePrefix
+ value: uint
+ - key: google-runtime-references.WhiteListTypes
+ value: ''
+ - key: modernize-loop-convert.MaxCopySize
+ value: '16'
+ - key: modernize-loop-convert.MinConfidence
+ value: reasonable
+ - key: modernize-loop-convert.NamingStyle
+ value: CamelCase
+ - key: modernize-pass-by-value.IncludeStyle
+ value: llvm
+ - key: modernize-replace-auto-ptr.IncludeStyle
+ value: llvm
+ - key: modernize-use-nullptr.NullMacros
+ value: 'NULL'
+...
+
diff --git a/funasr/runtime/onnxruntime/third_party/glog/.gitattributes b/funasr/runtime/onnxruntime/third_party/glog/.gitattributes
new file mode 100644
index 0000000..2f6d494
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/.gitattributes
@@ -0,0 +1 @@
+*.h linguist-language=C++
diff --git a/funasr/runtime/onnxruntime/third_party/glog/.github/workflows/android.yml b/funasr/runtime/onnxruntime/third_party/glog/.github/workflows/android.yml
new file mode 100644
index 0000000..e860d0a
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/.github/workflows/android.yml
@@ -0,0 +1,55 @@
+name: Android
+
+on: [push, pull_request]
+
+jobs:
+ build-android:
+ name: NDK-C++${{matrix.std}}-${{matrix.abi}}-${{matrix.build_type}}
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ shell: bash
+ env:
+ NDK_VERSION: 25.0.8775105
+ strategy:
+ fail-fast: true
+ matrix:
+ std: [14, 17, 20]
+ abi: [arm64-v8a, armeabi-v7a, x86_64, x86]
+ build_type: [Debug, Release]
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Setup Ninja
+ uses: ashutoshvarma/setup-ninja@master
+ with:
+ version: 1.10.0
+
+ - name: Setup NDK
+ env:
+ ANDROID_SDK_ROOT: /usr/local/lib/android/sdk
+ run: |
+ echo 'y' | ${{env.ANDROID_SDK_ROOT}}/cmdline-tools/latest/bin/sdkmanager --install 'ndk;${{env.NDK_VERSION}}'
+
+ - name: Configure
+ env:
+ CXXFLAGS: -Wall -Wextra -Wpedantic -Wsign-conversion -Wtautological-compare -Wformat-nonliteral -Wundef -Werror ${{env.CXXFLAGS}}
+ run: |
+ cmake -S . -B build_${{matrix.abi}} \
+ -DCMAKE_ANDROID_API=28 \
+ -DCMAKE_ANDROID_ARCH_ABI=${{matrix.abi}} \
+ -DCMAKE_ANDROID_NDK=/usr/local/lib/android/sdk/ndk/${{env.NDK_VERSION}} \
+ -DCMAKE_ANDROID_STL_TYPE=c++_shared \
+ -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
+ -DCMAKE_CXX_EXTENSIONS=OFF \
+ -DCMAKE_CXX_STANDARD=${{matrix.std}} \
+ -DCMAKE_CXX_STANDARD_REQUIRED=ON \
+ -DCMAKE_SYSTEM_NAME=Android \
+ -G Ninja \
+ -Werror
+
+ - name: Build
+ run: |
+ cmake --build build_${{matrix.abi}} \
+ --config ${{matrix.build_type}}
diff --git a/funasr/runtime/onnxruntime/third_party/glog/.github/workflows/cifuzz.yml b/funasr/runtime/onnxruntime/third_party/glog/.github/workflows/cifuzz.yml
new file mode 100644
index 0000000..091024b
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/.github/workflows/cifuzz.yml
@@ -0,0 +1,26 @@
+name: CIFuzz
+on: [pull_request]
+jobs:
+ Fuzzing:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Build Fuzzers
+ id: build
+ uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
+ with:
+ oss-fuzz-project-name: 'glog'
+ dry-run: false
+ language: c++
+ - name: Run Fuzzers
+ uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
+ with:
+ oss-fuzz-project-name: 'glog'
+ fuzz-seconds: 60
+ dry-run: false
+ language: c++
+ - name: Upload Crash
+ uses: actions/upload-artifact@v3
+ if: failure() && steps.build.outcome == 'success'
+ with:
+ name: artifacts
+ path: ./out/artifacts
diff --git a/funasr/runtime/onnxruntime/third_party/glog/.github/workflows/emscripten.yml b/funasr/runtime/onnxruntime/third_party/glog/.github/workflows/emscripten.yml
new file mode 100644
index 0000000..4bbb6dc
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/.github/workflows/emscripten.yml
@@ -0,0 +1,52 @@
+name: Emscripten
+
+on: [push, pull_request]
+
+jobs:
+ build-linux:
+ defaults:
+ run:
+ shell: bash
+ name: Emscripten-C++${{matrix.std}}-${{matrix.build_type}}-${{matrix.lib}}
+ runs-on: ubuntu-latest
+ container: emscripten/emsdk
+ strategy:
+ fail-fast: true
+ matrix:
+ build_type: [Release, Debug]
+ lib: [static]
+ std: [14, 17, 20]
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Setup Dependencies
+ run: |
+ apt-get update
+ DEBIAN_FRONTEND=noninteractive sudo apt-get install -y \
+ cmake \
+ ninja-build
+
+ - name: Configure
+ env:
+ CXXFLAGS: -Wall -Wextra -Wsign-conversion -Wtautological-compare -Wformat-nonliteral -Wundef -Werror -Wno-error=wasm-exception-spec ${{env.CXXFLAGS}}
+ run: |
+ cmake -S . -B build_${{matrix.build_type}} \
+ -DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} \
+ -DCMAKE_AR=$(which emar) \
+ -DCMAKE_CXX_COMPILER=$(which em++) \
+ -DCMAKE_CXX_STANDARD=${{matrix.std}} \
+ -DCMAKE_CXX_STANDARD_REQUIRED=ON \
+ -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
+ -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
+ -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY \
+ -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
+ -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install \
+ -DCMAKE_RANLIB=$(which emranlib) \
+ -G Ninja \
+ -Werror
+
+ - name: Build
+ run: |
+ cmake --build build_${{matrix.build_type}} \
+ --config ${{matrix.build_type}}
diff --git a/funasr/runtime/onnxruntime/third_party/glog/.github/workflows/linux.yml b/funasr/runtime/onnxruntime/third_party/glog/.github/workflows/linux.yml
new file mode 100644
index 0000000..9d29f59
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/.github/workflows/linux.yml
@@ -0,0 +1,143 @@
+name: Linux
+
+on: [push, pull_request]
+
+jobs:
+ build-linux:
+ defaults:
+ run:
+ shell: bash
+ name: GCC-C++${{matrix.std}}-${{matrix.build_type}}-${{matrix.lib}}
+ runs-on: ubuntu-22.04
+ strategy:
+ fail-fast: true
+ matrix:
+ build_type: [Release, Debug]
+ lib: [shared, static]
+ std: [14, 17, 20]
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Setup Dependencies
+ run: |
+ sudo apt-get update
+ DEBIAN_FRONTEND=noninteractive sudo apt-get install -y \
+ build-essential \
+ cmake \
+ lcov \
+ libgflags-dev \
+ libunwind-dev \
+ ninja-build
+
+ - name: Cache GTest
+ id: cache-gtest
+ uses: actions/cache@v3
+ with:
+ path: gtest/
+ key: ${{runner.os}}-gtest-1.11
+
+ - name: Download GTest
+ if: steps.cache-gtest.outputs.cache-hit != 'true'
+ run: |
+ wget https://github.com/google/googletest/archive/refs/tags/release-1.11.0.tar.gz
+ tar xvf release-1.11.0.tar.gz
+
+ - name: Build GTest
+ if: steps.cache-gtest.outputs.cache-hit != 'true'
+ run: |
+ cmake -S googletest-release-1.11.0 -B build-googletest \
+ -DBUILD_SHARED_LIBS=${{matrix.shared}} \
+ -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
+ -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/gtest \
+ -G Ninja
+ cmake --build build-googletest --target install
+
+ - name: Setup Environment
+ if: matrix.build_type == 'Debug'
+ run: |
+ echo 'CXXFLAGS=--coverage' >> $GITHUB_ENV
+ echo 'GTest_ROOT=${{github.workspace}}/gtest' >> $GITHUB_ENV
+
+ - name: Configure
+ env:
+ CXXFLAGS: -Wall -Wextra -Wsign-conversion -Wtautological-compare -Wformat-nonliteral -Wundef -Werror ${{env.CXXFLAGS}}
+ run: |
+ cmake -S . -B build_${{matrix.build_type}} \
+ -DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} \
+ -DCMAKE_CXX_STANDARD=${{matrix.std}} \
+ -DCMAKE_CXX_STANDARD_REQUIRED=ON \
+ -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install \
+ -G Ninja \
+ -Werror
+
+ - name: Build
+ run: |
+ cmake --build build_${{matrix.build_type}} \
+ --config ${{matrix.build_type}}
+
+ - name: Install
+ run: |
+ cmake --build build_${{matrix.build_type}} \
+ --config ${{matrix.build_type}} \
+ --target install
+
+ cmake build_${{matrix.build_type}} \
+ -DCMAKE_INSTALL_INCLUDEDIR=${{runner.workspace}}/foo/include \
+ -DCMAKE_INSTALL_LIBDIR=${{runner.workspace}}/foo/lib \
+ -DCMAKE_INSTALL_DATAROOTDIR=${{runner.workspace}}/foo/share
+ cmake --build build_${{matrix.build_type}} \
+ --config ${{matrix.build_type}} \
+ --target install
+
+ - name: Test CMake Package (relative GNUInstallDirs)
+ run: |
+ cmake -S src/package_config_unittest/working_config \
+ -B build_${{matrix.build_type}}_package \
+ -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
+ -DCMAKE_PREFIX_PATH=${{github.workspace}}/install \
+ -G Ninja
+ cmake --build build_${{matrix.build_type}}_package \
+ --config ${{matrix.build_type}}
+
+ - name: Test CMake Package (absolute GNUInstallDirs)
+ run: |
+ cmake -S src/package_config_unittest/working_config \
+ -B build_${{matrix.build_type}}_package_foo \
+ -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
+ -DCMAKE_PREFIX_PATH=${{runner.workspace}}/foo \
+ -G Ninja
+ cmake --build build_${{matrix.build_type}}_package_foo \
+ --config ${{matrix.build_type}}
+
+ - name: Test
+ run: |
+ ctest --test-dir build_${{matrix.build_type}} -j$(nproc) --output-on-failure
+
+ - name: Generate Coverage
+ if: matrix.build_type == 'Debug'
+ run: |
+ lcov --directory . --capture --output-file coverage.info
+ lcov --remove coverage.info \
+ '${{github.workspace}}/gtest/*' \
+ '*/src/*_unittest.cc' \
+ '*/src/googletest.h' \
+ '*/src/mock-log.h' \
+ '/usr/*' \
+ --output-file coverage.info
+
+ for file in src/glog/*.h.in; do
+ name=$(basename ${file})
+ name_we=${name%.h.in}
+ sed -i "s|build_${{matrix.build_type}}/glog/${name_we}.h\$|${file}|g" coverage.info
+ done
+
+ lcov --list coverage.info
+
+ - name: Upload Coverage to Codecov
+ if: matrix.build_type == 'Debug'
+ uses: codecov/codecov-action@v3
+ with:
+ token: ${{ secrets.CODECOV_TOKEN }}
+ fail_ci_if_error: true
+ verbose: true
diff --git a/funasr/runtime/onnxruntime/third_party/glog/.github/workflows/macos.yml b/funasr/runtime/onnxruntime/third_party/glog/.github/workflows/macos.yml
new file mode 100644
index 0000000..51cf7ff
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/.github/workflows/macos.yml
@@ -0,0 +1,83 @@
+name: macOS
+
+on: [push, pull_request]
+
+jobs:
+ build-macos:
+ name: AppleClang-C++${{matrix.std}}-${{matrix.build_type}}
+ runs-on: macos-12
+ strategy:
+ fail-fast: true
+ matrix:
+ std: [14, 17, 20]
+ include:
+ - generator: Ninja
+ - build_type: Debug
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Setup Ninja
+ uses: ashutoshvarma/setup-ninja@master
+ with:
+ version: 1.10.0
+
+ - name: Setup Dependencies
+ run: |
+ brew install lcov
+
+ - name: Setup Environment
+ if: matrix.build_type == 'Debug'
+ run: |
+ echo 'CXXFLAGS=--coverage' >> $GITHUB_ENV
+
+ - name: Configure
+ shell: bash
+ env:
+ CXXFLAGS: -Wall -Wextra -Wsign-conversion -Wtautological-compare -Wformat-nonliteral -Wundef -Werror ${{env.CXXFLAGS}}
+ run: |
+ cmake -S . -B build_${{matrix.build_type}} \
+ -DCMAKE_CXX_EXTENSIONS=OFF \
+ -DCMAKE_CXX_FLAGS_DEBUG=-pedantic-errors \
+ -DCMAKE_CXX_FLAGS_RELEASE=-pedantic-errors \
+ -DCMAKE_CXX_STANDARD=${{matrix.std}} \
+ -DCMAKE_CXX_STANDARD_REQUIRED=ON \
+ -G "${{matrix.generator}}" \
+ -Werror
+
+ - name: Build
+ run: |
+ cmake --build build_${{matrix.build_type}} \
+ --config ${{matrix.build_type}}
+
+ - name: Test
+ run: |
+ ctest --test-dir build_${{matrix.build_type}} \
+ --output-on-failure
+
+ - name: Generate Coverage
+ if: matrix.build_type == 'Debug'
+ run: |
+ lcov --directory . --capture --output-file coverage.info
+ lcov --remove coverage.info \
+ '*/src/*_unittest.cc' \
+ '*/src/googletest.h' \
+ '*/src/mock-log.h' \
+ '*/usr/*' \
+ --output-file coverage.info
+
+ for file in src/glog/*.h.in; do
+ name=$(basename ${file})
+ name_we=${name%.h.in}
+ sed -i "" "s|${{github.workspace}}/glog/${name_we}.h\$|${file}|g" coverage.info
+ done
+
+ lcov --list coverage.info
+
+ - name: Upload Coverage to Codecov
+ if: matrix.build_type == 'Debug'
+ uses: codecov/codecov-action@v3
+ with:
+ token: ${{ secrets.CODECOV_TOKEN }}
+ fail_ci_if_error: true
+ verbose: true
diff --git a/funasr/runtime/onnxruntime/third_party/glog/.github/workflows/windows.yml b/funasr/runtime/onnxruntime/third_party/glog/.github/workflows/windows.yml
new file mode 100644
index 0000000..158e8d1
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/.github/workflows/windows.yml
@@ -0,0 +1,224 @@
+name: Windows
+
+on: [push, pull_request]
+
+jobs:
+ build-msvc:
+ name: ${{matrix.msvc}}-${{matrix.arch}}-C++${{matrix.std}}-${{matrix.build_type}}-${{matrix.lib}}
+ runs-on: ${{matrix.os}}
+ defaults:
+ run:
+ shell: powershell
+ env:
+ CL: /MP
+ CXXFLAGS: /WX /permissive-
+ strategy:
+ fail-fast: true
+ matrix:
+ arch: [Win32, x64]
+ build_type: [Debug, Release]
+ lib: [shared, static]
+ msvc: [VS-16-2019, VS-17-2022]
+ std: [14, 17, 20]
+ include:
+ - msvc: VS-16-2019
+ os: windows-2019
+ generator: 'Visual Studio 16 2019'
+ - msvc: VS-17-2022
+ os: windows-2022
+ generator: 'Visual Studio 17 2022'
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Cache GTest
+ id: cache-gtest
+ uses: actions/cache@v3
+ with:
+ path: gtest/
+ key: ${{runner.os}}-gtest-1.11-${{matrix.lib}}-${{matrix.arch}}-${{matrix.build_type}}
+
+ - name: Download GTest
+ if: steps.cache-gtest.outputs.cache-hit != 'true'
+ run: |
+ (New-Object System.Net.WebClient).DownloadFile("https://github.com/google/googletest/archive/refs/tags/release-1.11.0.zip", "release-1.11.0.zip")
+ Expand-Archive release-1.11.0.zip .
+
+ - name: Build GTest
+ if: steps.cache-gtest.outputs.cache-hit != 'true'
+ run: |
+ cmake -S googletest-release-1.11.0 -B build-googletest `
+ -A ${{matrix.arch}} `
+ -DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} `
+ -Dgtest_force_shared_crt=ON `
+ -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/gtest
+ cmake --build build-googletest `
+ --config ${{matrix.build_type}} `
+ --target install
+
+ - name: Cache gflags
+ id: cache-gflags
+ uses: actions/cache@v3
+ with:
+ path: gflags/
+ key: ${{runner.os}}-gflags-2.2.2-${{matrix.lib}}-${{matrix.arch}}-${{matrix.build_type}}
+
+ - name: Download gflags
+ if: steps.cache-gflags.outputs.cache-hit != 'true'
+ run: |
+ (New-Object System.Net.WebClient).DownloadFile("https://github.com/gflags/gflags/archive/refs/tags/v2.2.2.zip", "v2.2.2.zip")
+ Expand-Archive v2.2.2.zip .
+
+ - name: Build gflags
+ if: steps.cache-gflags.outputs.cache-hit != 'true'
+ run: |
+ cmake -S gflags-2.2.2 -B build-gflags `
+ -A ${{matrix.arch}} `
+ -DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} `
+ -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/gflags
+ cmake --build build-gflags `
+ --config ${{matrix.build_type}} `
+ --target install
+
+ - name: Setup Environment
+ run: |
+ echo "GTest_ROOT=$((Get-Item .).FullName)/gtest" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
+ echo "gflags_ROOT=$((Get-Item .).FullName)/gflags" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
+ echo "${{github.workspace}}/gtest/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
+ echo "${{github.workspace}}/gflags/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
+
+ - name: Setup Release Environment
+ if: matrix.build_type != 'Debug'
+ run: |
+ echo "CXXFLAGS=/Zi ${{env.CXXFLAGS}}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
+
+ - name: Configure
+ run: |
+ cmake -S . -B build_${{matrix.build_type}} `
+ -A ${{matrix.arch}} `
+ -DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} `
+ -DCMAKE_CXX_EXTENSIONS=OFF `
+ -DCMAKE_CXX_STANDARD=${{matrix.std}} `
+ -DCMAKE_CXX_STANDARD_REQUIRED=ON `
+ -DCMAKE_EXE_LINKER_FLAGS='/NOIMPLIB' `
+ -DCMAKE_EXE_LINKER_FLAGS_RELEASE='/INCREMENTAL:NO /DEBUG' `
+ -DCMAKE_INSTALL_PREFIX:PATH=./install `
+ -DCMAKE_MSVC_RUNTIME_LIBRARY='MultiThreaded$<$<CONFIG:Debug>:Debug>DLL' `
+ -G "${{matrix.generator}}" `
+ -Werror
+
+ - name: Build
+ run: cmake --build build_${{matrix.build_type}} `
+ --config ${{matrix.build_type}}
+
+ - name: Test
+ env:
+ CTEST_OUTPUT_ON_FAILURE: 1
+ run: |
+ cmake --build build_${{matrix.build_type}}/ `
+ --config ${{matrix.build_type}} `
+ --target RUN_TESTS
+
+ - name: Install
+ run: |
+ cmake --build build_${{matrix.build_type}}/ `
+ --config ${{matrix.build_type}} `
+ --target install
+
+ build-mingw:
+ name: ${{matrix.sys}}-${{matrix.env}}-C++${{matrix.std}}-${{matrix.build_type}}-${{matrix.lib}}
+ runs-on: windows-2022
+ env:
+ BUILDDIR: 'build_${{matrix.sys}}-${{matrix.env}}-C++${{matrix.std}}-${{matrix.build_type}}-${{matrix.lib}}'
+ defaults:
+ run:
+ shell: msys2 {0}
+ strategy:
+ fail-fast: true
+ matrix:
+ build_type: [Debug]
+ lib: [shared, static]
+ std: [14, 17, 20]
+ sys: [mingw32, mingw64]
+ include:
+ - sys: mingw32
+ env: i686
+ - sys: mingw64
+ env: x86_64
+
+ steps:
+ - uses: actions/checkout@v3
+ - uses: msys2/setup-msys2@v2
+ with:
+ msystem: ${{matrix.sys}}
+ install: >-
+ lcov
+ mingw-w64-${{matrix.env}}-cmake
+ mingw-w64-${{matrix.env}}-gcc
+ mingw-w64-${{matrix.env}}-gflags
+ mingw-w64-${{matrix.env}}-ninja
+
+ - name: Setup Environment
+ if: matrix.build_type == 'Debug'
+ run: |
+ echo 'CXXFLAGS=--coverage ${{env.CXXFLAGS}}' >> $GITHUB_ENV
+
+ - name: Configure
+ env:
+ CXXFLAGS: -Wall -Wextra -Wpedantic -Wsign-conversion -Wtautological-compare -Wformat-nonliteral -Wundef -Werror ${{env.CXXFLAGS}}
+ run: |
+ cmake -S . -B build_${{matrix.build_type}}/ \
+ -DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} \
+ -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
+ -DCMAKE_CXX_EXTENSIONS=OFF \
+ -DCMAKE_CXX_STANDARD=${{matrix.std}} \
+ -DCMAKE_CXX_STANDARD_REQUIRED=ON \
+ -DCMAKE_INSTALL_PREFIX:PATH=./install \
+ -G Ninja \
+ -Werror
+
+ - name: Build
+ run: |
+ cmake --build build_${{matrix.build_type}}/ --config ${{matrix.build_type}}
+
+ - name: Test
+ env:
+ CTEST_OUTPUT_ON_FAILURE: 1
+ run: |
+ cmake --build build_${{matrix.build_type}}/ --config ${{matrix.build_type}} \
+ --target test
+
+ - name: Install
+ run: |
+ cmake --build build_${{matrix.build_type}}/ \
+ --config ${{matrix.build_type}} \
+ --target install
+
+ - name: Generate Coverage
+ if: matrix.build_type == 'Debug'
+ run: |
+ lcov --directory . --capture --output-file coverage.info
+ lcov --remove coverage.info \
+ '*/install/include/*' \
+ '*/msys64/mingw32/*' \
+ '*/msys64/mingw64/*' \
+ '*/src/*_unittest.cc' \
+ '*/src/googletest.h' \
+ '*/src/mock-log.h' \
+ --output-file coverage.info
+
+ for file in src/glog/*.h.in; do
+ name=$(basename ${file})
+ name_we=${name%.h.in}
+ sed -i "s|build_${{matrix.build_type}}/glog/${name_we}.h\$|${file}|g" coverage.info
+ done
+
+ lcov --list coverage.info
+
+ - name: Upload Coverage to Codecov
+ if: matrix.build_type == 'Debug'
+ uses: codecov/codecov-action@v3
+ with:
+ token: ${{ secrets.CODECOV_TOKEN }}
+ fail_ci_if_error: true
+ verbose: true
diff --git a/funasr/runtime/onnxruntime/third_party/glog/AUTHORS b/funasr/runtime/onnxruntime/third_party/glog/AUTHORS
new file mode 100644
index 0000000..9d711ec
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/AUTHORS
@@ -0,0 +1,29 @@
+# This is the official list of glog authors for copyright purposes.
+# This file is distinct from the CONTRIBUTORS files.
+# See the latter for an explanation.
+#
+# Names should be added to this file as:
+# Name or Organization <email address>
+# The email address is not required for organizations.
+#
+# Please keep the list sorted.
+
+Abhishek Dasgupta <abhi2743@gmail.com>
+Abhishek Parmar <abhishek@orng.net>
+Andrew Schwartzmeyer <andrew@schwartzmeyer.com>
+Andy Ying <andy@trailofbits.com>
+Brian Silverman <bsilver16384@gmail.com>
+Dmitriy Arbitman <d.arbitman@gmail.com>
+Google Inc.
+Guillaume Dumont <dumont.guillaume@gmail.com>
+Marco Wang <m.aesophor@gmail.com>
+Michael Tanner <michael@tannertaxpro.com>
+MiniLight <MiniLightAR@Gmail.com>
+romange <romange@users.noreply.github.com>
+Roman Perepelitsa <roman.perepelitsa@gmail.com>
+Sergiu Deitsch <sergiu.deitsch@gmail.com>
+tbennun <tbennun@gmail.com>
+Teddy Reed <teddy@prosauce.org>
+Vijaymahantesh Sattigeri <vijaymahantesh016@gmail.com>
+Zhongming Qu <qzmfranklin@gmail.com>
+Zhuoran Shen <cmsflash99@gmail.com>
diff --git a/funasr/runtime/onnxruntime/third_party/glog/BUILD.bazel b/funasr/runtime/onnxruntime/third_party/glog/BUILD.bazel
new file mode 100644
index 0000000..0acdc72
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/BUILD.bazel
@@ -0,0 +1,22 @@
+licenses(["notice"])
+
+exports_files(["COPYING"])
+
+load(":bazel/glog.bzl", "glog_library")
+
+glog_library()
+
+# platform() to build with clang-cl on Bazel CI. This is enabled with
+# the flags in .bazelci/presubmit.yml:
+#
+# --incompatible_enable_cc_toolchain_resolution
+# --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl
+# --extra_execution_platforms=//:x64_windows-clang-cl
+platform(
+ name = "x64_windows-clang-cl",
+ constraint_values = [
+ "@platforms//cpu:x86_64",
+ "@platforms//os:windows",
+ "@bazel_tools//tools/cpp:clang-cl",
+ ],
+)
diff --git a/funasr/runtime/onnxruntime/third_party/glog/CMakeLists.txt b/funasr/runtime/onnxruntime/third_party/glog/CMakeLists.txt
new file mode 100644
index 0000000..f5c1e55
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/CMakeLists.txt
@@ -0,0 +1,941 @@
+cmake_minimum_required (VERSION 3.16)
+project (glog
+ VERSION 0.7.0
+ DESCRIPTION "C++ implementation of the Google logging module"
+ HOMEPAGE_URL https://github.com/google/glog
+ LANGUAGES CXX
+)
+
+set (CPACK_PACKAGE_NAME glog)
+set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Google logging library")
+set (CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
+set (CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
+set (CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
+set (CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
+
+list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
+
+include (CheckCXXCompilerFlag)
+include (CheckCXXSourceCompiles)
+include (CheckCXXSourceRuns)
+include (CheckCXXSymbolExists)
+include (CheckFunctionExists)
+include (CheckIncludeFileCXX)
+include (CheckLibraryExists)
+include (CheckStructHasMember)
+include (CheckTypeSize)
+include (CMakeDependentOption)
+include (CMakePackageConfigHelpers)
+include (CMakePushCheckState)
+include (CPack)
+include (CTest)
+include (DetermineGflagsNamespace)
+include (GenerateExportHeader)
+include (GetCacheVariables)
+include (GNUInstallDirs)
+
+option (BUILD_SHARED_LIBS "Build shared libraries" ON)
+option (PRINT_UNSYMBOLIZED_STACK_TRACES
+ "Print file offsets in traces instead of symbolizing" OFF)
+option (WITH_GFLAGS "Use gflags" ON)
+option (WITH_GTEST "Use Google Test" ON)
+option (WITH_PKGCONFIG "Enable pkg-config support" ON)
+option (WITH_SYMBOLIZE "Enable symbolize module" ON)
+option (WITH_THREADS "Enable multithreading support" ON)
+option (WITH_TLS "Enable Thread Local Storage (TLS) support" ON)
+option (WITH_UNWIND "Enable libunwind support" ON)
+
+cmake_dependent_option (WITH_GMOCK "Use Google Mock" ON WITH_GTEST OFF)
+
+set (WITH_FUZZING none CACHE STRING "Fuzzing engine")
+set_property (CACHE WITH_FUZZING PROPERTY STRINGS none libfuzzer ossfuzz)
+
+if (NOT WITH_UNWIND)
+ set (CMAKE_DISABLE_FIND_PACKAGE_Unwind ON)
+endif (NOT WITH_UNWIND)
+
+if (NOT WITH_GTEST)
+ set (CMAKE_DISABLE_FIND_PACKAGE_GTest ON)
+endif (NOT WITH_GTEST)
+
+if (NOT WITH_THREADS)
+ set (CMAKE_DISABLE_FIND_PACKAGE_Threads ON)
+endif (NOT WITH_THREADS)
+
+set (CMAKE_C_VISIBILITY_PRESET hidden)
+set (CMAKE_CXX_VISIBILITY_PRESET hidden)
+set (CMAKE_POSITION_INDEPENDENT_CODE ON)
+set (CMAKE_VISIBILITY_INLINES_HIDDEN ON)
+
+set (CMAKE_DEBUG_POSTFIX d)
+set (CMAKE_THREAD_PREFER_PTHREAD 1)
+
+find_package (GTest NO_MODULE)
+
+if (GTest_FOUND)
+ set (HAVE_LIB_GTEST 1)
+endif (GTest_FOUND)
+
+if (WITH_GMOCK AND TARGET GTest::gmock)
+ set (HAVE_LIB_GMOCK 1)
+endif (WITH_GMOCK AND TARGET GTest::gmock)
+
+if (WITH_GFLAGS)
+ find_package (gflags 2.2.2)
+
+ if (gflags_FOUND)
+ set (HAVE_LIB_GFLAGS 1)
+ determine_gflags_namespace (gflags_NAMESPACE)
+ endif (gflags_FOUND)
+endif (WITH_GFLAGS)
+
+find_package (Threads)
+find_package (Unwind)
+
+if (Unwind_FOUND)
+ set (HAVE_LIB_UNWIND 1)
+else (Unwind_FOUND)
+ # Check whether linking actually succeeds. ARM toolchains of LLVM unwind
+ # implementation do not necessarily provide the _Unwind_Backtrace function
+ # which causes the previous check to succeed but the linking to fail.
+ check_cxx_symbol_exists (_Unwind_Backtrace unwind.h HAVE__UNWIND_BACKTRACE)
+ check_cxx_symbol_exists (_Unwind_GetIP unwind.h HAVE__UNWIND_GETIP)
+endif (Unwind_FOUND)
+
+check_include_file_cxx (dlfcn.h HAVE_DLFCN_H)
+check_include_file_cxx (glob.h HAVE_GLOB_H)
+check_include_file_cxx (memory.h HAVE_MEMORY_H)
+check_include_file_cxx (pwd.h HAVE_PWD_H)
+check_include_file_cxx (strings.h HAVE_STRINGS_H)
+check_include_file_cxx (sys/stat.h HAVE_SYS_STAT_H)
+check_include_file_cxx (sys/syscall.h HAVE_SYS_SYSCALL_H)
+check_include_file_cxx (sys/time.h HAVE_SYS_TIME_H)
+check_include_file_cxx (sys/types.h HAVE_SYS_TYPES_H)
+check_include_file_cxx (sys/utsname.h HAVE_SYS_UTSNAME_H)
+check_include_file_cxx (sys/wait.h HAVE_SYS_WAIT_H)
+check_include_file_cxx (syscall.h HAVE_SYSCALL_H)
+check_include_file_cxx (syslog.h HAVE_SYSLOG_H)
+check_include_file_cxx (ucontext.h HAVE_UCONTEXT_H)
+check_include_file_cxx (unistd.h HAVE_UNISTD_H)
+
+check_type_size (mode_t HAVE_MODE_T LANGUAGE CXX)
+check_type_size (ssize_t HAVE_SSIZE_T LANGUAGE CXX)
+
+check_function_exists (dladdr HAVE_DLADDR)
+check_function_exists (fcntl HAVE_FCNTL)
+check_function_exists (pread HAVE_PREAD)
+check_function_exists (pwrite HAVE_PWRITE)
+check_function_exists (sigaction HAVE_SIGACTION)
+check_function_exists (sigaltstack HAVE_SIGALTSTACK)
+
+check_cxx_symbol_exists (backtrace execinfo.h HAVE_EXECINFO_BACKTRACE)
+check_cxx_symbol_exists (backtrace_symbols execinfo.h
+ HAVE_EXECINFO_BACKTRACE_SYMBOLS)
+
+# NOTE gcc does not fail if you pass a non-existent -Wno-* option as an
+# argument. However, it will happily fail if you pass the corresponding -W*
+# option. So, we check whether options that disable warnings exist by testing
+# the availability of the corresponding option that enables the warning. This
+# eliminates the need to check for compiler for several (mainly Clang) options.
+
+check_cxx_compiler_flag (-Wdeprecated HAVE_NO_DEPRECATED)
+check_cxx_compiler_flag (-Wunnamed-type-template-args
+ HAVE_NO_UNNAMED_TYPE_TEMPLATE_ARGS)
+
+cmake_push_check_state (RESET)
+
+if (Threads_FOUND)
+ set (CMAKE_REQUIRED_LIBRARIES Threads::Threads)
+endif (Threads_FOUND)
+
+check_cxx_symbol_exists (pthread_threadid_np "pthread.h" HAVE_PTHREAD_THREADID_NP)
+cmake_pop_check_state ()
+
+# NOTE: Cannot use check_function_exists here since >=vc-14.0 can define
+# snprintf as an inline function
+check_cxx_symbol_exists (snprintf cstdio HAVE_SNPRINTF)
+
+check_library_exists (dbghelp UnDecorateSymbolName "" HAVE_DBGHELP)
+
+check_cxx_source_compiles ("
+#include <cstdlib>
+static void foo(void) __attribute__ ((unused));
+int main(void) { return 0; }
+" HAVE___ATTRIBUTE__)
+
+check_cxx_source_compiles ("
+#include <cstdlib>
+static void foo(void) __attribute__ ((visibility(\"default\")));
+int main(void) { return 0; }
+" HAVE___ATTRIBUTE__VISIBILITY_DEFAULT)
+
+check_cxx_source_compiles ("
+#include <cstdlib>
+static void foo(void) __attribute__ ((visibility(\"hidden\")));
+int main(void) { return 0; }
+" HAVE___ATTRIBUTE__VISIBILITY_HIDDEN)
+
+check_cxx_source_compiles ("
+int main(void) { if (__builtin_expect(0, 0)) return 1; return 0; }
+" HAVE___BUILTIN_EXPECT)
+
+check_cxx_source_compiles ("
+int main(void)
+{
+ int a; if (__sync_val_compare_and_swap(&a, 0, 1)) return 1; return 0;
+}
+" HAVE___SYNC_VAL_COMPARE_AND_SWAP)
+
+if (Threads_FOUND)
+ cmake_push_check_state (RESET)
+ set (CMAKE_REQUIRED_LIBRARIES Threads::Threads)
+ check_cxx_source_compiles ("
+#define _XOPEN_SOURCE 500
+#include <pthread.h>
+int main(void)
+{
+ pthread_rwlock_t l;
+ pthread_rwlock_init(&l, NULL);
+ pthread_rwlock_rdlock(&l);
+ return 0;
+}
+ " HAVE_RWLOCK)
+ cmake_pop_check_state ()
+endif (Threads_FOUND)
+
+check_cxx_source_compiles ("
+__declspec(selectany) int a;
+int main(void) { return 0; }
+" HAVE___DECLSPEC)
+
+if (WITH_TLS)
+ set (GLOG_THREAD_LOCAL_STORAGE 1)
+endif (WITH_TLS)
+
+set (_PC_FIELDS
+ "gregs[REG_PC]"
+ "gregs[REG_EIP]"
+ "gregs[REG_RIP]"
+ "sc_ip"
+ "uc_regs->gregs[PT_NIP]"
+ "gregs[R15]"
+ "arm_pc"
+ "mc_eip"
+ "mc_rip"
+ "__gregs[REG_EIP]"
+ "__gregs[REG_RIP]"
+ "ss.eip"
+ "__ss.__eip"
+ "ss.rip"
+ "__ss.__rip"
+ "ss.srr0"
+ "__ss.__srr0"
+)
+
+set (_PC_HEADERS ucontext.h signal.h)
+
+if (HAVE_UCONTEXT_H AND NOT PC_FROM_UCONTEXT)
+ foreach (_PC_FIELD ${_PC_FIELDS})
+ foreach (_PC_HEADER ${_PC_HEADERS})
+ set (_TMP
+ ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/uctfield.cpp)
+ file (WRITE ${_TMP} "
+#define _GNU_SOURCE 1
+#include <${_PC_HEADER}>
+int main(void)
+{
+ ucontext_t u;
+ return u.${_PC_FIELD} == 0;
+}
+")
+ try_compile (HAVE_PC_FROM_UCONTEXT ${CMAKE_CURRENT_BINARY_DIR} ${_TMP}
+ COMPILE_DEFINITIONS _GNU_SOURCE=1)
+
+ if (HAVE_PC_FROM_UCONTEXT)
+ set (PC_FROM_UCONTEXT ${_PC_FIELD} CACHE)
+ endif (HAVE_PC_FROM_UCONTEXT)
+ endforeach (_PC_HEADER)
+ endforeach (_PC_FIELD)
+endif (HAVE_UCONTEXT_H AND NOT PC_FROM_UCONTEXT)
+
+set (GOOGLE_NAMESPACE google)
+set (_START_GOOGLE_NAMESPACE_ "namespace ${GOOGLE_NAMESPACE} {")
+set (_END_GOOGLE_NAMESPACE_ "}")
+set (ac_cv_have_glog_export 1)
+
+if (HAVE_LIB_GFLAGS)
+ set (ac_cv_have_libgflags 1)
+else (HAVE_LIB_GFLAGS)
+ set (ac_cv_have_libgflags 0)
+endif (HAVE_LIB_GFLAGS)
+
+if (HAVE_SYS_TYPES_H)
+ set (ac_cv_have_systypes_h 1)
+else (HAVE_SYS_TYPES_H)
+ set (ac_cv_have_systypes_h 0)
+endif (HAVE_SYS_TYPES_H)
+
+if (HAVE_SSIZE_T)
+ set (ac_cv_have_ssize_t 1)
+else (HAVE_SSIZE_T)
+ set (ac_cv_have_ssize_t 0)
+endif (HAVE_SSIZE_T)
+
+if (HAVE_MODE_T)
+ set (ac_cv_have_mode_t 1)
+else (HAVE_MODE_T)
+ set (ac_cv_have_mode_t 0)
+endif (HAVE_MODE_T)
+
+if (HAVE_UNISTD_H)
+ set (ac_cv_have_unistd_h 1)
+else (HAVE_UNISTD_H)
+ set (ac_cv_have_unistd_h 0)
+endif (HAVE_UNISTD_H)
+
+set (ac_google_namespace ${GOOGLE_NAMESPACE})
+set (ac_google_end_namespace ${_END_GOOGLE_NAMESPACE_})
+set (ac_google_start_namespace ${_START_GOOGLE_NAMESPACE_})
+
+if (HAVE___ATTRIBUTE__)
+ set (ac_cv___attribute___noinline "__attribute__((noinline))")
+ set (ac_cv___attribute___printf_4_5 "__attribute__((__format__(__printf__, 4, 5)))")
+elseif (HAVE___DECLSPEC)
+ #set (ac_cv___attribute___noinline "__declspec(noinline)")
+endif (HAVE___ATTRIBUTE__)
+
+if (HAVE___BUILTIN_EXPECT)
+ set (ac_cv_have___builtin_expect 1)
+else (HAVE___BUILTIN_EXPECT)
+ set (ac_cv_have___builtin_expect 0)
+endif (HAVE___BUILTIN_EXPECT)
+
+if (HAVE_EXECINFO_BACKTRACE AND HAVE_EXECINFO_BACKTRACE_SYMBOLS)
+ set (HAVE_STACKTRACE 1)
+endif (HAVE_EXECINFO_BACKTRACE AND HAVE_EXECINFO_BACKTRACE_SYMBOLS)
+
+if (WITH_SYMBOLIZE)
+ if (WIN32 OR CYGWIN)
+ cmake_push_check_state (RESET)
+ set (CMAKE_REQUIRED_LIBRARIES DbgHelp)
+
+ check_cxx_source_runs ([=[
+ #include <windows.h>
+ #include <dbghelp.h>
+ #include <cstdlib>
+
+ void foobar() { }
+
+ int main()
+ {
+ HANDLE process = GetCurrentProcess();
+
+ if (!SymInitialize(process, NULL, TRUE))
+ return EXIT_FAILURE;
+
+ char buf[sizeof(SYMBOL_INFO) + MAX_SYM_NAME];
+ SYMBOL_INFO *symbol = reinterpret_cast<SYMBOL_INFO *>(buf);
+ symbol->SizeOfStruct = sizeof(SYMBOL_INFO);
+ symbol->MaxNameLen = MAX_SYM_NAME;
+
+ void* const pc = reinterpret_cast<void*>(&foobar);
+ BOOL ret = SymFromAddr(process, reinterpret_cast<DWORD64>(pc), 0, symbol);
+
+ return ret ? EXIT_SUCCESS : EXIT_FAILURE;
+ }
+ ]=] HAVE_SYMBOLIZE)
+
+ cmake_pop_check_state ()
+
+ if (HAVE_SYMBOLIZE)
+ set (HAVE_STACKTRACE 1)
+ endif (HAVE_SYMBOLIZE)
+ elseif (UNIX)
+ cmake_push_check_state (RESET)
+ check_cxx_source_compiles ([=[
+ int main()
+ {
+ #ifndef __ELF__
+ #error __ELF__ not defined
+ #endif
+ }
+ ]=] HAVE_SYMBOLIZE)
+ cmake_pop_check_state ()
+ elseif (APPLE AND HAVE_DLADDR)
+ set (HAVE_SYMBOLIZE 1)
+ endif (WIN32 OR CYGWIN)
+endif (WITH_SYMBOLIZE)
+
+# CMake manages symbolize availability. The definition is necessary only when
+# building the library.
+add_compile_definitions (GLOG_NO_SYMBOLIZE_DETECTION)
+
+check_cxx_source_compiles ("
+#include <cstdlib>
+#include <ctime>
+int main()
+{
+ time_t timep;
+ struct tm result;
+ localtime_r(&timep, &result);
+ return EXIT_SUCCESS;
+}
+" HAVE_LOCALTIME_R)
+
+set (SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
+
+if (WITH_THREADS AND Threads_FOUND)
+ if (CMAKE_USE_PTHREADS_INIT)
+ set (HAVE_PTHREAD 1)
+ endif (CMAKE_USE_PTHREADS_INIT)
+else (WITH_THREADS AND Threads_FOUND)
+ set (NO_THREADS 1)
+endif (WITH_THREADS AND Threads_FOUND)
+
+# fopen/open on Cygwin can not handle unix-type paths like /home/....
+# therefore we translate TEST_SRC_DIR to windows-path.
+if (CYGWIN)
+ execute_process (COMMAND cygpath.exe -m ${CMAKE_CURRENT_SOURCE_DIR}
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ OUTPUT_VARIABLE TEST_SRC_DIR)
+ set (TEST_SRC_DIR \"${TEST_SRC_DIR}\")
+else (CYGWIN)
+ set (TEST_SRC_DIR \"${CMAKE_CURRENT_SOURCE_DIR}\")
+endif (CYGWIN)
+
+configure_file (src/config.h.cmake.in config.h)
+configure_file (src/glog/logging.h.in glog/logging.h @ONLY)
+configure_file (src/glog/raw_logging.h.in glog/raw_logging.h @ONLY)
+configure_file (src/glog/stl_logging.h.in glog/stl_logging.h @ONLY)
+configure_file (src/glog/vlog_is_on.h.in glog/vlog_is_on.h @ONLY)
+
+add_compile_options ($<$<AND:$<BOOL:${HAVE_NO_UNNAMED_TYPE_TEMPLATE_ARGS}>,$<NOT:$<CXX_COMPILER_ID:GNU>>>:-Wno-unnamed-type-template-args>)
+
+set (_glog_CMake_BINDIR ${CMAKE_INSTALL_BINDIR})
+set (_glog_CMake_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR})
+set (_glog_CMake_LIBDIR ${CMAKE_INSTALL_LIBDIR})
+set (_glog_CMake_INSTALLDIR ${_glog_CMake_LIBDIR}/cmake/glog)
+
+set (_glog_CMake_DIR glog/cmake)
+set (_glog_CMake_DATADIR ${CMAKE_INSTALL_DATAROOTDIR}/${_glog_CMake_DIR})
+set (_glog_BINARY_CMake_DATADIR
+ ${CMAKE_CURRENT_BINARY_DIR}/${_glog_CMake_DATADIR})
+
+# Add additional CMake find modules here.
+set (_glog_CMake_MODULES)
+
+if (Unwind_FOUND)
+ # Copy the module only if libunwind is actually used.
+ list (APPEND _glog_CMake_MODULES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindUnwind.cmake)
+endif (Unwind_FOUND)
+
+# Generate file name for each module in the binary directory
+foreach (_file ${_glog_CMake_MODULES})
+ get_filename_component (_module "${_file}" NAME)
+
+ list (APPEND _glog_BINARY_CMake_MODULES
+ ${_glog_BINARY_CMake_DATADIR}/${_module})
+endforeach (_file)
+
+if (_glog_CMake_MODULES)
+ # Copy modules to binary directory during the build
+ add_custom_command (OUTPUT ${_glog_BINARY_CMake_MODULES}
+ COMMAND ${CMAKE_COMMAND} -E make_directory
+ ${_glog_BINARY_CMake_DATADIR}
+ COMMAND ${CMAKE_COMMAND} -E copy ${_glog_CMake_MODULES}
+ ${_glog_BINARY_CMake_DATADIR}
+ DEPENDS ${_glog_CMake_MODULES}
+ COMMENT "Copying find modules..."
+ )
+endif (_glog_CMake_MODULES)
+
+set (GLOG_PUBLIC_H
+ ${CMAKE_CURRENT_BINARY_DIR}/glog/export.h
+ ${CMAKE_CURRENT_BINARY_DIR}/glog/logging.h
+ ${CMAKE_CURRENT_BINARY_DIR}/glog/raw_logging.h
+ ${CMAKE_CURRENT_BINARY_DIR}/glog/stl_logging.h
+ ${CMAKE_CURRENT_BINARY_DIR}/glog/vlog_is_on.h
+ src/glog/log_severity.h
+ src/glog/platform.h
+)
+
+set (GLOG_SRCS
+ ${GLOG_PUBLIC_H}
+ src/base/commandlineflags.h
+ src/base/googleinit.h
+ src/base/mutex.h
+ src/demangle.cc
+ src/demangle.h
+ src/logging.cc
+ src/raw_logging.cc
+ src/symbolize.cc
+ src/symbolize.h
+ src/utilities.cc
+ src/utilities.h
+ src/vlog_is_on.cc
+)
+
+if (HAVE_PTHREAD OR WIN32 OR CYGWIN)
+ list (APPEND GLOG_SRCS src/signalhandler.cc)
+endif (HAVE_PTHREAD OR WIN32 OR CYGWIN)
+
+if (CYGWIN OR WIN32)
+ list (APPEND GLOG_SRCS
+ src/windows/port.cc
+ src/windows/port.h
+ )
+endif (CYGWIN OR WIN32)
+
+add_library (glog_internal OBJECT
+ ${_glog_BINARY_CMake_MODULES}
+ ${GLOG_SRCS}
+)
+target_compile_features (glog_internal PUBLIC $<TARGET_PROPERTY:glog,COMPILE_FEATURES>)
+
+add_library (glog
+ $<TARGET_OBJECTS:glog_internal>
+)
+target_compile_features (glog PUBLIC cxx_std_14)
+
+add_library (glog::glog ALIAS glog)
+
+set (glog_libraries_options_for_static_linking)
+
+if (Unwind_FOUND)
+ target_link_libraries (glog PRIVATE unwind::unwind)
+ set (glog_libraries_options_for_static_linking "${glog_libraries_options_for_static_linking} -lunwind")
+ set (Unwind_DEPENDENCY "find_dependency (Unwind ${Unwind_VERSION})")
+endif (Unwind_FOUND)
+
+if (HAVE_DBGHELP)
+ target_link_libraries (glog PRIVATE dbghelp)
+ set (glog_libraries_options_for_static_linking "${glog_libraries_options_for_static_linking} -ldbghelp")
+endif (HAVE_DBGHELP)
+
+if (HAVE_PTHREAD)
+ target_link_libraries (glog PRIVATE ${CMAKE_THREAD_LIBS_INIT})
+
+ if (CMAKE_THREAD_LIBS_INIT)
+ set (glog_libraries_options_for_static_linking "${glog_libraries_options_for_static_linking} ${CMAKE_THREAD_LIBS_INIT}")
+ endif (CMAKE_THREAD_LIBS_INIT)
+endif (HAVE_PTHREAD)
+
+if (gflags_FOUND)
+ # Prefer the gflags target that uses double colon convention
+ if (TARGET gflags::gflags)
+ target_link_libraries (glog PUBLIC gflags::gflags)
+ else (TARGET gflags::gflags)
+ target_link_libraries (glog PUBLIC gflags)
+ endif (TARGET gflags::gflags)
+
+ set (glog_libraries_options_for_static_linking "${glog_libraries_options_for_static_linking} -lgflags")
+endif (gflags_FOUND)
+
+if (ANDROID)
+ target_link_libraries (glog PRIVATE log)
+ set (glog_libraries_options_for_static_linking "${glog_libraries_options_for_static_linking} -llog")
+endif (ANDROID)
+
+set_target_properties (glog PROPERTIES VERSION ${PROJECT_VERSION})
+set_target_properties (glog PROPERTIES SOVERSION 1)
+
+if (CYGWIN OR WIN32)
+ target_compile_definitions (glog PUBLIC GLOG_NO_ABBREVIATED_SEVERITIES)
+endif (CYGWIN OR WIN32)
+
+set_target_properties (glog PROPERTIES PUBLIC_HEADER "${GLOG_PUBLIC_H}")
+
+target_include_directories (glog BEFORE PUBLIC
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>"
+ "$<INSTALL_INTERFACE:${_glog_CMake_INCLUDE_DIR}>"
+ PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
+
+if (CYGWIN OR WIN32)
+ target_include_directories (glog_internal PUBLIC
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/windows>"
+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/windows)
+
+ target_include_directories (glog PUBLIC
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/windows>"
+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/windows)
+endif (CYGWIN OR WIN32)
+
+set_target_properties (glog PROPERTIES DEFINE_SYMBOL GOOGLE_GLOG_IS_A_DLL)
+
+target_include_directories (glog_internal PUBLIC
+ $<TARGET_PROPERTY:glog,INCLUDE_DIRECTORIES>)
+target_compile_definitions (glog_internal PUBLIC
+ $<TARGET_PROPERTY:glog,COMPILE_DEFINITIONS>
+ PRIVATE GOOGLE_GLOG_IS_A_DLL)
+
+generate_export_header (glog
+ EXPORT_MACRO_NAME GLOG_EXPORT
+ EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/glog/export.h)
+
+string (STRIP "${glog_libraries_options_for_static_linking}" glog_libraries_options_for_static_linking)
+
+if (WITH_PKGCONFIG)
+ set (VERSION ${PROJECT_VERSION})
+ set (prefix ${CMAKE_INSTALL_PREFIX})
+ set (exec_prefix ${CMAKE_INSTALL_FULL_BINDIR})
+ set (libdir ${CMAKE_INSTALL_FULL_LIBDIR})
+ set (includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR})
+
+ configure_file (
+ "${PROJECT_SOURCE_DIR}/libglog.pc.in"
+ "${PROJECT_BINARY_DIR}/libglog.pc"
+ @ONLY
+ )
+
+ unset (VERSION)
+ unset (prefix)
+ unset (exec_prefix)
+ unset (libdir)
+ unset (includedir)
+endif (WITH_PKGCONFIG)
+
+# Unit testing
+
+if (NOT WITH_FUZZING STREQUAL "none")
+ add_executable (fuzz_demangle
+ src/fuzz_demangle.cc
+ )
+
+ if (WITH_FUZZING STREQUAL "ossfuzz")
+ set (LIB_FUZZING_ENGINE $ENV{LIB_FUZZING_ENGINE})
+ target_link_libraries (fuzz_demangle PRIVATE glog ${LIB_FUZZING_ENGINE})
+ elseif (WITH_FUZZING STREQUAL "libfuzzer")
+ target_compile_options (fuzz_demangle PRIVATE -fsanitize=fuzzer)
+ target_link_libraries (fuzz_demangle PRIVATE glog)
+ else (WITH_FUZZING STREQUAL "libfuzzer")
+ message (FATAL_ERROR "Unsupported fuzzing engine ${WITH_FUZZING}")
+ endif (WITH_FUZZING STREQUAL "ossfuzz")
+endif (NOT WITH_FUZZING STREQUAL "none")
+
+if (BUILD_TESTING)
+ add_library (glogtest STATIC
+ $<TARGET_OBJECTS:glog_internal>
+ )
+
+ target_include_directories (glogtest PUBLIC
+ $<TARGET_PROPERTY:glog,INCLUDE_DIRECTORIES>)
+ target_compile_definitions (glogtest PUBLIC
+ $<TARGET_PROPERTY:glog,COMPILE_DEFINITIONS> GLOG_STATIC_DEFINE)
+ target_link_libraries (glogtest PUBLIC
+ $<TARGET_PROPERTY:glog,LINK_LIBRARIES>)
+
+ set (_GLOG_TEST_LIBS glogtest)
+
+ if (HAVE_LIB_GTEST)
+ list (APPEND _GLOG_TEST_LIBS GTest::gtest)
+ endif (HAVE_LIB_GTEST)
+
+ if (HAVE_LIB_GMOCK)
+ list (APPEND _GLOG_TEST_LIBS GTest::gmock)
+ endif (HAVE_LIB_GMOCK)
+
+ add_executable (logging_unittest
+ src/logging_unittest.cc
+ )
+
+ target_link_libraries (logging_unittest PRIVATE ${_GLOG_TEST_LIBS})
+
+ add_executable (stl_logging_unittest
+ src/stl_logging_unittest.cc
+ )
+
+ target_link_libraries (stl_logging_unittest PRIVATE ${_GLOG_TEST_LIBS})
+
+ if (HAVE_NO_DEPRECATED)
+ set_property (TARGET stl_logging_unittest APPEND PROPERTY COMPILE_OPTIONS
+ -Wno-deprecated)
+ endif (HAVE_NO_DEPRECATED)
+
+ if (HAVE_EXT_SLIST)
+ target_compile_definitions (stl_logging_unittest PRIVATE
+ GLOG_STL_LOGGING_FOR_EXT_SLIST)
+ endif (HAVE_EXT_SLIST)
+
+ if (HAVE_SYMBOLIZE)
+ add_executable (symbolize_unittest
+ src/symbolize_unittest.cc
+ )
+
+ target_link_libraries (symbolize_unittest PRIVATE ${_GLOG_TEST_LIBS})
+ endif (HAVE_SYMBOLIZE)
+
+ add_executable (demangle_unittest
+ src/demangle_unittest.cc
+ )
+
+ target_link_libraries (demangle_unittest PRIVATE ${_GLOG_TEST_LIBS})
+
+ if (HAVE_STACKTRACE)
+ add_executable (stacktrace_unittest
+ src/stacktrace_unittest.cc
+ )
+
+ target_link_libraries (stacktrace_unittest PRIVATE ${_GLOG_TEST_LIBS})
+ endif (HAVE_STACKTRACE)
+
+ add_executable (utilities_unittest
+ src/utilities_unittest.cc
+ )
+
+ target_link_libraries (utilities_unittest PRIVATE ${_GLOG_TEST_LIBS})
+
+ if (HAVE_STACKTRACE AND HAVE_SYMBOLIZE)
+ add_executable (signalhandler_unittest
+ src/signalhandler_unittest.cc
+ )
+
+ target_link_libraries (signalhandler_unittest PRIVATE ${_GLOG_TEST_LIBS})
+ endif (HAVE_STACKTRACE AND HAVE_SYMBOLIZE)
+
+ add_test (NAME demangle COMMAND demangle_unittest)
+ add_test (NAME logging COMMAND logging_unittest)
+
+ set_tests_properties (logging PROPERTIES TIMEOUT 30)
+ # MacOS diff is not deterministic: use the output to determine whether the
+ # test passed.
+ set_tests_properties (logging PROPERTIES PASS_REGULAR_EXPRESSION ".*\nPASS\n.*")
+
+ # FIXME: Skip flaky test
+ set_tests_properties (logging PROPERTIES SKIP_REGULAR_EXPRESSION
+ "Check failed: time_ns within LogTimes::LOG_PERIOD_TOL_NS of LogTimes::LOG_PERIOD_NS")
+
+ if (APPLE)
+ # FIXME: Skip flaky test
+ set_property (TEST logging APPEND PROPERTY SKIP_REGULAR_EXPRESSION
+ "unexpected new.*PASS\nTest with golden file failed. We'll try to show the diff:")
+ endif (APPLE)
+
+ if (TARGET signalhandler_unittest)
+ add_test (NAME signalhandler COMMAND signalhandler_unittest)
+ endif (TARGET signalhandler_unittest)
+
+ if (TARGET stacktrace_unittest)
+ add_test (NAME stacktrace COMMAND stacktrace_unittest)
+ set_tests_properties (stacktrace PROPERTIES TIMEOUT 30)
+ endif (TARGET stacktrace_unittest)
+
+ add_test (NAME stl_logging COMMAND stl_logging_unittest)
+
+ if (TARGET symbolize_unittest)
+ add_test (NAME symbolize COMMAND symbolize_unittest)
+
+ # FIXME: Skip flaky test when compiled in C++20 mode
+ set_tests_properties (symbolize PROPERTIES SKIP_REGULAR_EXPRESSION
+ [=[Check failed: streq\("nonstatic_func"\, TrySymbolize\(\(void \*\)\(&nonstatic_func\)\)\)]=])
+ endif (TARGET symbolize_unittest)
+
+ if (HAVE_LIB_GMOCK)
+ add_executable (mock-log_unittest
+ src/mock-log_unittest.cc
+ src/mock-log.h
+ )
+
+ target_link_libraries (mock-log_unittest PRIVATE ${_GLOG_TEST_LIBS})
+
+ add_test (NAME mock-log COMMAND mock-log_unittest)
+ endif (HAVE_LIB_GMOCK)
+
+ # Generate an initial cache
+
+ get_cache_variables (_CACHEVARS)
+
+ set (_INITIAL_CACHE
+ ${CMAKE_CURRENT_BINARY_DIR}/test_package_config/glog_package_config_initial_cache.cmake)
+
+ # Package config test
+
+ add_test (NAME cmake_package_config_init COMMAND ${CMAKE_COMMAND}
+ -DTEST_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/test_package_config
+ -DINITIAL_CACHE=${_INITIAL_CACHE}
+ -DCACHEVARS=${_CACHEVARS}
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/TestInitPackageConfig.cmake
+ )
+
+ add_test (NAME cmake_package_config_generate COMMAND ${CMAKE_COMMAND}
+ -DGENERATOR=${CMAKE_GENERATOR}
+ -DGENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
+ -DGENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET}
+ -DINITIAL_CACHE=${_INITIAL_CACHE}
+ -DPACKAGE_DIR=${CMAKE_CURRENT_BINARY_DIR}
+ -DPATH=$ENV{PATH}
+ -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/src/package_config_unittest/working_config
+ -DTEST_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/test_package_config/working_config
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/TestPackageConfig.cmake
+ )
+
+ add_test (NAME cmake_package_config_build COMMAND
+ ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/test_package_config/working_config
+ --config $<CONFIG>
+ )
+
+ add_test (NAME cmake_package_config_cleanup COMMAND ${CMAKE_COMMAND} -E
+ remove_directory
+ ${CMAKE_CURRENT_BINARY_DIR}/test_package_config
+ )
+
+ # Fixtures setup
+ set_tests_properties (cmake_package_config_init PROPERTIES FIXTURES_SETUP
+ cmake_package_config)
+ set_tests_properties (cmake_package_config_generate PROPERTIES FIXTURES_SETUP
+ cmake_package_config_working)
+
+ # Fixtures cleanup
+ set_tests_properties (cmake_package_config_cleanup PROPERTIES FIXTURES_CLEANUP
+ cmake_package_config)
+
+ # Fixture requirements
+ set_tests_properties (cmake_package_config_generate PROPERTIES
+ FIXTURES_REQUIRED cmake_package_config)
+ set_tests_properties (cmake_package_config_build PROPERTIES
+ FIXTURES_REQUIRED "cmake_package_config;cmake_package_config_working")
+
+ add_executable (cleanup_immediately_unittest
+ src/cleanup_immediately_unittest.cc)
+
+ target_link_libraries (cleanup_immediately_unittest PRIVATE ${_GLOG_TEST_LIBS})
+
+ add_executable (cleanup_with_absolute_prefix_unittest
+ src/cleanup_with_absolute_prefix_unittest.cc)
+
+ target_link_libraries (cleanup_with_absolute_prefix_unittest PRIVATE ${_GLOG_TEST_LIBS})
+
+ add_executable (cleanup_with_relative_prefix_unittest
+ src/cleanup_with_relative_prefix_unittest.cc)
+
+ target_link_libraries (cleanup_with_relative_prefix_unittest PRIVATE ${_GLOG_TEST_LIBS})
+
+ set (CLEANUP_LOG_DIR ${CMAKE_CURRENT_BINARY_DIR}/cleanup_tests)
+
+ add_test (NAME cleanup_init COMMAND
+ ${CMAKE_COMMAND} -E make_directory ${CLEANUP_LOG_DIR})
+ add_test (NAME cleanup_logdir COMMAND
+ ${CMAKE_COMMAND} -E remove_directory ${CLEANUP_LOG_DIR})
+ add_test (NAME cleanup_immediately COMMAND
+ ${CMAKE_COMMAND}
+ -DLOGCLEANUP=$<TARGET_FILE:cleanup_immediately_unittest>
+ # NOTE The trailing slash is important
+ -DTEST_DIR=${CLEANUP_LOG_DIR}/
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/RunCleanerTest1.cmake
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+ add_test (NAME cleanup_with_absolute_prefix COMMAND
+ ${CMAKE_COMMAND}
+ -DLOGCLEANUP=$<TARGET_FILE:cleanup_with_absolute_prefix_unittest>
+ -DTEST_DIR=${CMAKE_CURRENT_BINARY_DIR}/
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/RunCleanerTest2.cmake
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+ add_test (NAME cleanup_with_relative_prefix COMMAND
+ ${CMAKE_COMMAND}
+ -DLOGCLEANUP=$<TARGET_FILE:cleanup_with_relative_prefix_unittest>
+ -DTEST_DIR=${CMAKE_CURRENT_BINARY_DIR}/
+ -DTEST_SUBDIR=test_subdir/
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/RunCleanerTest3.cmake
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+
+ # Fixtures setup
+ set_tests_properties (cleanup_init PROPERTIES FIXTURES_SETUP logcleanuptest)
+ ## Fixtures cleanup
+ set_tests_properties (cleanup_logdir PROPERTIES FIXTURES_CLEANUP logcleanuptest)
+ # Fixture requirements
+ set_tests_properties (cleanup_immediately PROPERTIES FIXTURES_REQUIRED logcleanuptest)
+ set_tests_properties (cleanup_with_absolute_prefix PROPERTIES FIXTURES_REQUIRED logcleanuptest)
+ set_tests_properties (cleanup_with_relative_prefix PROPERTIES FIXTURES_REQUIRED logcleanuptest)
+endif (BUILD_TESTING)
+
+install (TARGETS glog
+ EXPORT glog-targets
+ RUNTIME DESTINATION ${_glog_CMake_BINDIR}
+ PUBLIC_HEADER DESTINATION ${_glog_CMake_INCLUDE_DIR}/glog
+ LIBRARY DESTINATION ${_glog_CMake_LIBDIR}
+ ARCHIVE DESTINATION ${_glog_CMake_LIBDIR})
+
+if (WITH_PKGCONFIG)
+ install (
+ FILES "${PROJECT_BINARY_DIR}/libglog.pc"
+ DESTINATION "${_glog_CMake_LIBDIR}/pkgconfig"
+ )
+endif (WITH_PKGCONFIG)
+
+set (glog_CMake_VERSION 3.0)
+
+if (gflags_FOUND)
+ # Ensure clients locate only the package config and not third party find
+ # modules having the same name. This avoid cmake_policy PUSH/POP errors.
+ if (CMAKE_VERSION VERSION_LESS 3.9)
+ set (gflags_DEPENDENCY "find_dependency (gflags ${gflags_VERSION})")
+ else (CMAKE_VERSION VERSION_LESS 3.9)
+ # Passing additional find_package arguments to find_dependency is possible
+ # starting with CMake 3.9.
+ set (glog_CMake_VERSION 3.9)
+ set (gflags_DEPENDENCY "find_dependency (gflags ${gflags_VERSION} NO_MODULE)")
+ endif (CMAKE_VERSION VERSION_LESS 3.9)
+endif (gflags_FOUND)
+
+configure_package_config_file (glog-config.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/glog-config.cmake
+ INSTALL_DESTINATION ${_glog_CMake_INSTALLDIR}
+ NO_CHECK_REQUIRED_COMPONENTS_MACRO)
+
+write_basic_package_version_file (
+ ${CMAKE_CURRENT_BINARY_DIR}/glog-config-version.cmake
+ COMPATIBILITY SameMajorVersion)
+
+export (TARGETS glog NAMESPACE glog:: FILE glog-targets.cmake)
+export (PACKAGE glog)
+
+get_filename_component (_PREFIX "${CMAKE_INSTALL_PREFIX}" ABSOLUTE)
+
+# Directory containing the find modules relative to the config install
+# directory.
+file (RELATIVE_PATH glog_REL_CMake_MODULES
+ ${_PREFIX}/${_glog_CMake_INSTALLDIR}
+ ${_PREFIX}/${_glog_CMake_DATADIR}/glog-modules.cmake)
+
+get_filename_component (glog_REL_CMake_DATADIR ${glog_REL_CMake_MODULES}
+ DIRECTORY)
+
+set (glog_FULL_CMake_DATADIR
+ ${CMAKE_CURRENT_BINARY_DIR}/${_glog_CMake_DATADIR})
+
+configure_file (glog-modules.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/glog-modules.cmake @ONLY)
+
+install (CODE
+"
+set (glog_FULL_CMake_DATADIR \"\\\${CMAKE_CURRENT_LIST_DIR}/${glog_REL_CMake_DATADIR}\")
+set (glog_DATADIR_DESTINATION ${_glog_CMake_INSTALLDIR})
+
+if (NOT IS_ABSOLUTE ${_glog_CMake_INSTALLDIR})
+ set (glog_DATADIR_DESTINATION \"\${CMAKE_INSTALL_PREFIX}/\${glog_DATADIR_DESTINATION}\")
+endif (NOT IS_ABSOLUTE ${_glog_CMake_INSTALLDIR})
+
+configure_file (\"${CMAKE_CURRENT_SOURCE_DIR}/glog-modules.cmake.in\"
+ \"${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/glog-modules.cmake\" @ONLY)
+file (INSTALL
+ \"${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/glog-modules.cmake\"
+ DESTINATION
+ \"\${glog_DATADIR_DESTINATION}\")
+"
+ COMPONENT Development
+)
+
+install (FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/glog-config.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/glog-config-version.cmake
+ DESTINATION ${_glog_CMake_INSTALLDIR})
+
+# Find modules in share/glog/cmake
+install (DIRECTORY ${_glog_BINARY_CMake_DATADIR}
+ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/glog
+ COMPONENT Development
+ FILES_MATCHING PATTERN "*.cmake"
+)
+
+install (EXPORT glog-targets NAMESPACE glog:: DESTINATION
+ ${_glog_CMake_INSTALLDIR})
diff --git a/funasr/runtime/onnxruntime/third_party/glog/CONTRIBUTORS b/funasr/runtime/onnxruntime/third_party/glog/CONTRIBUTORS
new file mode 100644
index 0000000..05cb688
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/CONTRIBUTORS
@@ -0,0 +1,52 @@
+# People who have agreed to one of the CLAs and can contribute patches.
+# The AUTHORS file lists the copyright holders; this file
+# lists people. For example, Google employees are listed here
+# but not in AUTHORS, because Google holds the copyright.
+#
+# Names should be added to this file only after verifying that
+# the individual or the individual's organization has agreed to
+# the appropriate Contributor License Agreement, found here:
+#
+# https://developers.google.com/open-source/cla/individual
+# https://developers.google.com/open-source/cla/corporate
+#
+# The agreement for individuals can be filled out on the web.
+#
+# When adding J Random Contributor's name to this file,
+# either J's name or J's organization's name should be
+# added to the AUTHORS file, depending on whether the
+# individual or corporate CLA was used.
+#
+# Names should be added to this file as:
+# Name <email address>
+#
+# Please keep the list sorted.
+
+Abhishek Dasgupta <abhi2743@gmail.com>
+Abhishek Parmar <abhishek@orng.net>
+Andrew Schwartzmeyer <andrew@schwartzmeyer.com>
+Andy Ying <andy@trailofbits.com>
+Bret McKee <bretmckee@google.com>
+Brian Silverman <bsilver16384@gmail.com>
+Dmitriy Arbitman <d.arbitman@gmail.com>
+Fumitoshi Ukai <ukai@google.com>
+Guillaume Dumont <dumont.guillaume@gmail.com>
+H氓kan L. S. Younes <hyounes@google.com>
+Ivan Penkov <ivanpe@google.com>
+Jacob Trimble <modmaker@google.com>
+Jim Ray <jimray@google.com>
+Marco Wang <m.aesophor@gmail.com>
+Michael Darr <mdarr@matician.com>
+Michael Tanner <michael@tannertaxpro.com>
+MiniLight <MiniLightAR@Gmail.com>
+Peter Collingbourne <pcc@google.com>
+Rodrigo Queiro <rodrigoq@google.com>
+romange <romange@users.noreply.github.com>
+Roman Perepelitsa <roman.perepelitsa@gmail.com>
+Sergiu Deitsch <sergiu.deitsch@gmail.com>
+Shinichiro Hamaji <hamaji@google.com>
+tbennun <tbennun@gmail.com>
+Teddy Reed <teddy@prosauce.org>
+Vijaymahantesh Sattigeri <vijaymahantesh016@gmail.com>
+Zhongming Qu <qzmfranklin@gmail.com>
+Zhuoran Shen <cmsflash99@gmail.com>
diff --git a/funasr/runtime/onnxruntime/third_party/glog/COPYING b/funasr/runtime/onnxruntime/third_party/glog/COPYING
new file mode 100644
index 0000000..38396b5
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/COPYING
@@ -0,0 +1,65 @@
+Copyright (c) 2008, Google Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+A function gettimeofday in utilities.cc is based on
+
+http://www.google.com/codesearch/p?hl=en#dR3YEbitojA/COPYING&q=GetSystemTimeAsFileTime%20license:bsd
+
+The license of this code is:
+
+Copyright (c) 2003-2008, Jouni Malinen <j@w1.fi> and contributors
+All Rights Reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+3. Neither the name(s) of the above-listed copyright holder(s) nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/funasr/runtime/onnxruntime/third_party/glog/ChangeLog b/funasr/runtime/onnxruntime/third_party/glog/ChangeLog
new file mode 100644
index 0000000..a107e93
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/ChangeLog
@@ -0,0 +1,109 @@
+2022-04-05 Google Inc. <opensource@google.com>
+
+ * google-glog: version 0.6.0.
+ * See git log for the details.
+
+2021-05-08 Google Inc. <opensource@google.com>
+
+ * google-glog: version 0.5.0.
+ * See git log for the details.
+
+2019-01-22 Google Inc. <opensource@google.com>
+
+ * google-glog: version 0.4.0.
+ * See git log for the details.
+
+2017-05-09 Google Inc. <opensource@google.com>
+
+ * google-glog: version 0.3.5
+ * See git log for the details.
+
+2015-03-09 Google Inc. <opensource@google.com>
+
+ * google-glog: version 0.3.4
+ * See git log for the details.
+
+2013-02-01 Google Inc. <opensource@google.com>
+
+ * google-glog: version 0.3.3
+ * Add --disable-rtti option for configure.
+ * Visual Studio build and test fix.
+ * QNX build fix (thanks vanuan).
+ * Reduce warnings.
+ * Fixed LOG_SYSRESULT (thanks ukai).
+ * FreeBSD build fix (thanks yyanagisawa).
+ * Clang build fix.
+ * Now users can re-initialize glog after ShutdownGoogleLogging.
+ * Color output support by GLOG_colorlogtostderr (thanks alexs).
+ * Now glog's ABI around flags are compatible with gflags.
+ * Document mentions how to modify flags from user programs.
+
+2012-01-12 Google Inc. <opensource@google.com>
+
+ * google-glog: version 0.3.2
+ * Clang support.
+ * Demangler and stacktrace improvement for newer GCCs.
+ * Now fork(2) doesn't mess up log files.
+ * Make valgrind happier.
+ * Reduce warnings for more -W options.
+ * Provide a workaround for ERROR defined by windows.h.
+
+2010-06-15 Google Inc. <opensource@google.com>
+
+ * google-glog: version 0.3.1
+ * GLOG_* environment variables now work even when gflags is installed.
+ * Snow leopard support.
+ * Now we can build and test from out side tree.
+ * Add DCHECK_NOTNULL.
+ * Add ShutdownGoogleLogging to close syslog (thanks DGunchev)
+ * Fix --enable-frame-pointers option (thanks kazuki.ohta)
+ * Fix libunwind detection (thanks giantchen)
+
+2009-07-30 Google Inc. <opensource@google.com>
+
+ * google-glog: version 0.3.0
+ * Fix a deadlock happened when user uses glog with recent gflags.
+ * Suppress several unnecessary warnings (thanks keir).
+ * NetBSD and OpenBSD support.
+ * Use Win32API GetComputeNameA properly (thanks magila).
+ * Fix user name detection for Windows (thanks ademin).
+ * Fix several minor bugs.
+
+2009-04-10 Google Inc. <opensource@google.com>
+ * google-glog: version 0.2.1
+ * Fix timestamps of VC++ version.
+ * Add pkg-config support (thanks Tomasz)
+ * Fix build problem when building with gtest (thanks Michael)
+ * Add --with-gflags option for configure (thanks Michael)
+ * Fixes for GCC 4.4 (thanks John)
+
+2009-01-23 Google Inc. <opensource@google.com>
+ * google-glog: version 0.2
+ * Add initial Windows VC++ support.
+ * Google testing/mocking frameworks integration.
+ * Link pthread library automatically.
+ * Flush logs in signal handlers.
+ * Add macros LOG_TO_STRING, LOG_AT_LEVEL, DVLOG, and LOG_TO_SINK_ONLY.
+ * Log microseconds.
+ * Add --log_backtrace_at option.
+ * Fix some minor bugs.
+
+2008-11-18 Google Inc. <opensource@google.com>
+ * google-glog: version 0.1.2
+ * Add InstallFailureSignalHandler(). (satorux)
+ * Re-organize the way to produce stacktraces.
+ * Don't define unnecessary macro DISALLOW_EVIL_CONSTRUCTORS.
+
+2008-10-15 Google Inc. <opensource@google.com>
+ * google-glog: version 0.1.1
+ * Support symbolize for MacOSX 10.5.
+ * BUG FIX: --vmodule didn't work with gflags.
+ * BUG FIX: symbolize_unittest failed with GCC 4.3.
+ * Several fixes on the document.
+
+2008-10-07 Google Inc. <opensource@google.com>
+
+ * google-glog: initial release:
+ The glog package contains a library that implements application-level
+ logging. This library provides logging APIs based on C++-style
+ streams and various helper macros.
diff --git a/funasr/runtime/onnxruntime/third_party/glog/README.rst b/funasr/runtime/onnxruntime/third_party/glog/README.rst
new file mode 100644
index 0000000..29a38d5
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/README.rst
@@ -0,0 +1,890 @@
+Google Logging Library
+======================
+
+|Linux Github actions| |Windows Github actions| |macOS Github actions| |Codecov|
+
+Google Logging (glog) is a C++14 library that implements application-level
+logging. The library provides logging APIs based on C++-style streams and
+various helper macros.
+
+.. role:: cmake(code)
+ :language: cmake
+
+.. role:: cmd(code)
+ :language: bash
+
+.. role:: cpp(code)
+ :language: cpp
+
+.. role:: bazel(code)
+ :language: starlark
+
+
+Getting Started
+---------------
+
+You can log a message by simply streaming things to ``LOG``\ (<a
+particular `severity level <#severity-levels>`__>), e.g.,
+
+.. code:: cpp
+
+ #include <glog/logging.h>
+
+ int main(int argc, char* argv[]) {
+ // Initialize Google鈥檚 logging library.
+ google::InitGoogleLogging(argv[0]);
+
+ // ...
+ LOG(INFO) << "Found " << num_cookies << " cookies";
+ }
+
+
+For a detailed overview of glog features and their usage, please refer
+to the `user guide <#user-guide>`__.
+
+.. contents:: Table of Contents
+
+
+Building from Source
+--------------------
+
+glog supports multiple build systems for compiling the project from
+source: `Bazel <#bazel>`__, `CMake <#cmake>`__, `vcpkg <#vcpkg>`__, and `conan <#conan>`__.
+
+Bazel
+~~~~~
+
+To use glog within a project which uses the
+`Bazel <https://bazel.build/>`__ build tool, add the following lines to
+your ``WORKSPACE`` file:
+
+.. code:: bazel
+
+ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+ http_archive(
+ name = "com_github_gflags_gflags",
+ sha256 = "34af2f15cf7367513b352bdcd2493ab14ce43692d2dcd9dfc499492966c64dcf",
+ strip_prefix = "gflags-2.2.2",
+ urls = ["https://github.com/gflags/gflags/archive/v2.2.2.tar.gz"],
+ )
+
+ http_archive(
+ name = "com_github_google_glog",
+ sha256 = "122fb6b712808ef43fbf80f75c52a21c9760683dae470154f02bddfc61135022",
+ strip_prefix = "glog-0.6.0",
+ urls = ["https://github.com/google/glog/archive/v0.6.0.zip"],
+ )
+
+You can then add :bazel:`@com_github_google_glog//:glog` to the deps section
+of a :bazel:`cc_binary` or :bazel:`cc_library` rule, and :code:`#include
+<glog/logging.h>` to include it in your source code. Here鈥檚 a simple example:
+
+.. code:: bazel
+
+ cc_binary(
+ name = "main",
+ srcs = ["main.cc"],
+ deps = ["@com_github_google_glog//:glog"],
+ )
+
+CMake
+~~~~~
+
+glog also supports CMake that can be used to build the project on a wide
+range of platforms. If you don鈥檛 have CMake installed already, you can
+download it for from CMake鈥檚 `official
+website <http://www.cmake.org>`__.
+
+CMake works by generating native makefiles or build projects that can be
+used in the compiler environment of your choice. You can either build
+glog with CMake as a standalone project or it can be incorporated into
+an existing CMake build for another project.
+
+Building glog with CMake
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+When building glog as a standalone project, on Unix-like systems with
+GNU Make as build tool, the typical workflow is:
+
+1. Get the source code and change to it. e.g., cloning with git:
+
+ .. code:: bash
+
+ git clone https://github.com/google/glog.git
+ cd glog
+
+2. Run CMake to configure the build tree.
+
+ .. code:: bash
+
+ cmake -S . -B build -G "Unix Makefiles"
+
+ CMake provides different generators, and by default will pick the most
+ relevant one to your environment. If you need a specific version of Visual
+ Studio, use :cmd:`cmake . -G <generator-name>`, and see :cmd:`cmake --help`
+ for the available generators. Also see :cmd:`-T <toolset-name>`, which can
+ be used to request the native x64 toolchain with :cmd:`-T host=x64`.
+
+3. Afterwards, generated files can be used to compile the project.
+
+ .. code:: bash
+
+ cmake --build build
+
+4. Test the build software (optional).
+
+ .. code:: bash
+
+ cmake --build build --target test
+
+5. Install the built files (optional).
+
+ .. code:: bash
+
+ cmake --build build --target install
+
+Consuming glog in a CMake Project
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+If you have glog installed in your system, you can use the CMake command
+:cmake:`find_package` to build against glog in your CMake Project as follows:
+
+.. code:: cmake
+
+ cmake_minimum_required (VERSION 3.16)
+ project (myproj VERSION 1.0)
+
+ find_package (glog 0.6.0 REQUIRED)
+
+ add_executable (myapp main.cpp)
+ target_link_libraries (myapp glog::glog)
+
+Compile definitions and options will be added automatically to your
+target as needed.
+
+Incorporating glog into a CMake Project
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+You can also use the CMake command :cmake:`add_subdirectory` to include glog
+directly from a subdirectory of your project by replacing the
+:cmake:`find_package` call from the previous example by
+:cmake:`add_subdirectory`. The :cmake:`glog::glog` target is in this case an
+:cmake:`ALIAS` library target for the ``glog`` library target.
+
+Again, compile definitions and options will be added automatically to
+your target as needed.
+
+vcpkg
+~~~~~
+
+You can download and install glog using the `vcpkg
+<https://github.com/Microsoft/vcpkg>`__ dependency manager:
+
+.. code:: bash
+
+ git clone https://github.com/Microsoft/vcpkg.git
+ cd vcpkg
+ ./bootstrap-vcpkg.sh
+ ./vcpkg integrate install
+ ./vcpkg install glog
+
+The glog port in vcpkg is kept up to date by Microsoft team members and
+community contributors. If the version is out of date, please create an
+issue or pull request on the vcpkg repository.
+
+conan
+~~~~~
+
+You can download and install glog using the `conan
+<https://conan.io>`__ package manager:
+
+.. code:: bash
+
+ pip install conan
+ conan install -r conancenter glob/<glob-version>@
+
+The glog recipe in conan center is kept up to date by conan center index community
+contributors. If the version is out of date, please create an
+issue or pull request on the `conan-center-index
+<https://github.com/conan-io/conan-center-index>`__ repository.
+
+User Guide
+----------
+
+glog defines a series of macros that simplify many common logging tasks.
+You can log messages by severity level, control logging behavior from
+the command line, log based on conditionals, abort the program when
+expected conditions are not met, introduce your own verbose logging
+levels, customize the prefix attached to log messages, and more.
+
+Following sections describe the functionality supported by glog. Please note
+this description may not be complete but limited to the most useful ones. If you
+want to find less common features, please check header files under `src/glog
+<src/glog>`__ directory.
+
+Severity Levels
+~~~~~~~~~~~~~~~
+
+You can specify one of the following severity levels (in increasing
+order of severity): ``INFO``, ``WARNING``, ``ERROR``, and ``FATAL``.
+Logging a ``FATAL`` message terminates the program (after the message is
+logged). Note that messages of a given severity are logged not only in
+the logfile for that severity, but also in all logfiles of lower
+severity. E.g., a message of severity ``FATAL`` will be logged to the
+logfiles of severity ``FATAL``, ``ERROR``, ``WARNING``, and ``INFO``.
+
+The ``DFATAL`` severity logs a ``FATAL`` error in debug mode (i.e.,
+there is no ``NDEBUG`` macro defined), but avoids halting the program in
+production by automatically reducing the severity to ``ERROR``.
+
+Unless otherwise specified, glog writes to the filename
+``/tmp/\<program name\>.\<hostname\>.\<user name\>.log.\<severity level\>.\<date\>-\<time\>.\<pid\>``
+(e.g.,
+``/tmp/hello_world.example.com.hamaji.log.INFO.20080709-222411.10474``).
+By default, glog copies the log messages of severity level ``ERROR`` or
+``FATAL`` to standard error (``stderr``) in addition to log files.
+
+Setting Flags
+~~~~~~~~~~~~~
+
+Several flags influence glog鈥檚 output behavior. If the `Google gflags library
+<https://github.com/gflags/gflags>`__ is installed on your machine, the build
+system will automatically detect and use it, allowing you to pass flags on the
+command line. For example, if you want to turn the flag :cmd:`--logtostderr` on,
+you can start your application with the following command line:
+
+.. code:: bash
+
+ ./your_application --logtostderr=1
+
+If the Google gflags library isn鈥檛 installed, you set flags via
+environment variables, prefixing the flag name with ``GLOG_``, e.g.,
+
+.. code:: bash
+
+ GLOG_logtostderr=1 ./your_application
+
+The following flags are most commonly used:
+
+``logtostderr`` (``bool``, default=\ ``false``)
+ Log messages to ``stderr`` instead of logfiles. Note: you can set
+ binary flags to ``true`` by specifying ``1``, ``true``, or ``yes``
+ (case insensitive). Also, you can set binary flags to ``false`` by
+ specifying ``0``, ``false``, or ``no`` (again, case insensitive).
+
+``stderrthreshold`` (``int``, default=2, which is ``ERROR``)
+ Copy log messages at or above this level to stderr in addition to
+ logfiles. The numbers of severity levels ``INFO``, ``WARNING``,
+ ``ERROR``, and ``FATAL`` are 0, 1, 2, and 3, respectively.
+
+``minloglevel`` (``int``, default=0, which is ``INFO``)
+ Log messages at or above this level. Again, the numbers of severity
+ levels ``INFO``, ``WARNING``, ``ERROR``, and ``FATAL`` are 0, 1, 2,
+ and 3, respectively.
+
+``log_dir`` (``string``, default="")
+ If specified, logfiles are written into this directory instead of the
+ default logging directory.
+
+``v`` (``int``, default=0)
+ Show all ``VLOG(m)`` messages for ``m`` less or equal the value of
+ this flag. Overridable by :cmd:`--vmodule`. See `the section about
+ verbose logging <#verbose-logging>`__ for more detail.
+
+``vmodule`` (``string``, default="")
+ Per-module verbose level. The argument has to contain a
+ comma-separated list of <module name>=<log level>. <module name> is a
+ glob pattern (e.g., ``gfs*`` for all modules whose name starts with
+ "gfs"), matched against the filename base (that is, name ignoring
+ .cc/.h./-inl.h). <log level> overrides any value given by :cmd:`--v`.
+ See also `the section about verbose logging <#verbose-logging>`__.
+
+There are some other flags defined in logging.cc. Please grep the source
+code for ``DEFINE_`` to see a complete list of all flags.
+
+You can also modify flag values in your program by modifying global
+variables ``FLAGS_*`` . Most settings start working immediately after
+you update ``FLAGS_*`` . The exceptions are the flags related to
+destination files. For example, you might want to set ``FLAGS_log_dir``
+before calling :cpp:`google::InitGoogleLogging` . Here is an example:
+
+.. code:: cpp
+
+ LOG(INFO) << "file";
+ // Most flags work immediately after updating values.
+ FLAGS_logtostderr = 1;
+ LOG(INFO) << "stderr";
+ FLAGS_logtostderr = 0;
+ // This won鈥檛 change the log destination. If you want to set this
+ // value, you should do this before google::InitGoogleLogging .
+ FLAGS_log_dir = "/some/log/directory";
+ LOG(INFO) << "the same file";
+
+Conditional / Occasional Logging
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Sometimes, you may only want to log a message under certain conditions.
+You can use the following macros to perform conditional logging:
+
+.. code:: cpp
+
+ LOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
+
+The "Got lots of cookies" message is logged only when the variable
+``num_cookies`` exceeds 10. If a line of code is executed many times, it
+may be useful to only log a message at certain intervals. This kind of
+logging is most useful for informational messages.
+
+.. code:: cpp
+
+ LOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie";
+
+The above line outputs a log messages on the 1st, 11th, 21st, ... times
+it is executed. Note that the special ``google::COUNTER`` value is used
+to identify which repetition is happening.
+
+You can combine conditional and occasional logging with the following
+macro.
+
+.. code:: cpp
+
+ LOG_IF_EVERY_N(INFO, (size > 1024), 10) << "Got the " << google::COUNTER
+ << "th big cookie";
+
+Instead of outputting a message every nth time, you can also limit the
+output to the first n occurrences:
+
+.. code:: cpp
+
+ LOG_FIRST_N(INFO, 20) << "Got the " << google::COUNTER << "th cookie";
+
+Outputs log messages for the first 20 times it is executed. Again, the
+``google::COUNTER`` identifier indicates which repetition is happening.
+
+Other times, it is desired to only log a message periodically based on a time.
+So for example, to log a message every 10ms:
+
+.. code:: cpp
+
+ LOG_EVERY_T(INFO, 0.01) << "Got a cookie";
+
+Or every 2.35s:
+
+.. code:: cpp
+
+ LOG_EVERY_T(INFO, 2.35) << "Got a cookie";
+
+Debug Mode Support
+~~~~~~~~~~~~~~~~~~
+
+Special "debug mode" logging macros only have an effect in debug mode
+and are compiled away to nothing for non-debug mode compiles. Use these
+macros to avoid slowing down your production application due to
+excessive logging.
+
+.. code:: cpp
+
+ DLOG(INFO) << "Found cookies";
+ DLOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
+ DLOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie";
+
+
+``CHECK`` Macros
+~~~~~~~~~~~~~~~~
+
+It is a good practice to check expected conditions in your program
+frequently to detect errors as early as possible. The ``CHECK`` macro
+provides the ability to abort the application when a condition is not
+met, similar to the ``assert`` macro defined in the standard C library.
+
+``CHECK`` aborts the application if a condition is not true. Unlike
+``assert``, it is \*not\* controlled by ``NDEBUG``, so the check will be
+executed regardless of compilation mode. Therefore, ``fp->Write(x)`` in
+the following example is always executed:
+
+.. code:: cpp
+
+ CHECK(fp->Write(x) == 4) << "Write failed!";
+
+There are various helper macros for equality/inequality checks -
+``CHECK_EQ``, ``CHECK_NE``, ``CHECK_LE``, ``CHECK_LT``, ``CHECK_GE``,
+and ``CHECK_GT``. They compare two values, and log a ``FATAL`` message
+including the two values when the result is not as expected. The values
+must have :cpp:`operator<<(ostream, ...)` defined.
+
+You may append to the error message like so:
+
+.. code:: cpp
+
+ CHECK_NE(1, 2) << ": The world must be ending!";
+
+We are very careful to ensure that each argument is evaluated exactly
+once, and that anything which is legal to pass as a function argument is
+legal here. In particular, the arguments may be temporary expressions
+which will end up being destroyed at the end of the apparent statement,
+for example:
+
+.. code:: cpp
+
+ CHECK_EQ(string("abc")[1], 鈥檅鈥�);
+
+The compiler reports an error if one of the arguments is a pointer and the other
+is :cpp:`nullptr`. To work around this, simply :cpp:`static_cast` :cpp:`nullptr` to
+the type of the desired pointer.
+
+.. code:: cpp
+
+ CHECK_EQ(some_ptr, static_cast<SomeType*>(nullptr));
+
+Better yet, use the ``CHECK_NOTNULL`` macro:
+
+.. code:: cpp
+
+ CHECK_NOTNULL(some_ptr);
+ some_ptr->DoSomething();
+
+Since this macro returns the given pointer, this is very useful in
+constructor initializer lists.
+
+.. code:: cpp
+
+ struct S {
+ S(Something* ptr) : ptr_(CHECK_NOTNULL(ptr)) {}
+ Something* ptr_;
+ };
+
+Note that you cannot use this macro as a C++ stream due to this feature.
+Please use ``CHECK_EQ`` described above to log a custom message before
+aborting the application.
+
+If you are comparing C strings (:cpp:`char *`), a handy set of macros performs
+case sensitive as well as case insensitive comparisons - ``CHECK_STREQ``,
+``CHECK_STRNE``, ``CHECK_STRCASEEQ``, and ``CHECK_STRCASENE``. The CASE versions
+are case-insensitive. You can safely pass :cpp:`nullptr` pointers for this macro. They
+treat :cpp:`nullptr` and any non-:cpp:`nullptr` string as not equal. Two :cpp:`nullptr`\
+s are equal.
+
+Note that both arguments may be temporary strings which are destructed
+at the end of the current "full expression" (e.g.,
+:cpp:`CHECK_STREQ(Foo().c_str(), Bar().c_str())` where ``Foo`` and ``Bar``
+return C++鈥檚 :cpp:`std::string`).
+
+The ``CHECK_DOUBLE_EQ`` macro checks the equality of two floating point
+values, accepting a small error margin. ``CHECK_NEAR`` accepts a third
+floating point argument, which specifies the acceptable error margin.
+
+Verbose Logging
+~~~~~~~~~~~~~~~
+
+When you are chasing difficult bugs, thorough log messages are very useful.
+However, you may want to ignore too verbose messages in usual development. For
+such verbose logging, glog provides the ``VLOG`` macro, which allows you to
+define your own numeric logging levels. The :cmd:`--v` command line option
+controls which verbose messages are logged:
+
+.. code:: cpp
+
+ VLOG(1) << "I鈥檓 printed when you run the program with --v=1 or higher";
+ VLOG(2) << "I鈥檓 printed when you run the program with --v=2 or higher";
+
+With ``VLOG``, the lower the verbose level, the more likely messages are to be
+logged. For example, if :cmd:`--v==1`, ``VLOG(1)`` will log, but ``VLOG(2)``
+will not log. This is opposite of the severity level, where ``INFO`` is 0, and
+``ERROR`` is 2. :cmd:`--minloglevel` of 1 will log ``WARNING`` and above. Though
+you can specify any integers for both ``VLOG`` macro and :cmd:`--v` flag, the
+common values for them are small positive integers. For example, if you write
+``VLOG(0)``, you should specify :cmd:`--v=-1` or lower to silence it. This is
+less useful since we may not want verbose logs by default in most cases. The
+``VLOG`` macros always log at the ``INFO`` log level (when they log at all).
+
+Verbose logging can be controlled from the command line on a per-module
+basis:
+
+.. code:: bash
+
+ --vmodule=mapreduce=2,file=1,gfs*=3 --v=0
+
+will:
+
+(a) Print ``VLOG(2)`` and lower messages from mapreduce.{h,cc}
+(b) Print ``VLOG(1)`` and lower messages from file.{h,cc}
+(c) Print ``VLOG(3)`` and lower messages from files prefixed with "gfs"
+(d) Print ``VLOG(0)`` and lower messages from elsewhere
+
+The wildcarding functionality shown by (c) supports both 鈥�*鈥� (matches 0
+or more characters) and 鈥�?鈥� (matches any single character) wildcards.
+Please also check the section about `command line flags <#setting-flags>`__.
+
+There鈥檚 also ``VLOG_IS_ON(n)`` "verbose level" condition macro. This
+macro returns true when the :cmd:`--v` is equal or greater than ``n``. To
+be used as
+
+.. code:: cpp
+
+ if (VLOG_IS_ON(2)) {
+ // do some logging preparation and logging
+ // that can鈥檛 be accomplished with just VLOG(2) << ...;
+ }
+
+Verbose level condition macros ``VLOG_IF``, ``VLOG_EVERY_N`` and
+``VLOG_IF_EVERY_N`` behave analogous to ``LOG_IF``, ``LOG_EVERY_N``,
+``LOF_IF_EVERY``, but accept a numeric verbosity level as opposed to a
+severity level.
+
+.. code:: cpp
+
+ VLOG_IF(1, (size > 1024))
+ << "I鈥檓 printed when size is more than 1024 and when you run the "
+ "program with --v=1 or more";
+ VLOG_EVERY_N(1, 10)
+ << "I鈥檓 printed every 10th occurrence, and when you run the program "
+ "with --v=1 or more. Present occurence is " << google::COUNTER;
+ VLOG_IF_EVERY_N(1, (size > 1024), 10)
+ << "I鈥檓 printed on every 10th occurence of case when size is more "
+ " than 1024, when you run the program with --v=1 or more. ";
+ "Present occurence is " << google::COUNTER;
+
+
+Custom Log Prefix Format
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+glog supports changing the format of the prefix attached to log messages by
+receiving a user-provided callback to be used to generate such strings.
+
+For each log entry, the callback will be invoked with a ``LogMessageInfo``
+struct containing the severity, filename, line number, thread ID, and time of
+the event. It will also be given a reference to the output stream, whose
+contents will be prepended to the actual message in the final log line.
+
+For example:
+
+.. code:: cpp
+
+ /* This function writes a prefix that matches glog's default format.
+ * (The third parameter can be used to receive user-supplied data, and is
+ * nullptr by default.)
+ */
+ void CustomPrefix(std::ostream &s, const LogMessageInfo &l, void*) {
+ s << l.severity[0]
+ << setw(4) << 1900 + l.time.year()
+ << setw(2) << 1 + l.time.month()
+ << setw(2) << l.time.day()
+ << ' '
+ << setw(2) << l.time.hour() << ':'
+ << setw(2) << l.time.min() << ':'
+ << setw(2) << l.time.sec() << "."
+ << setw(6) << l.time.usec()
+ << ' '
+ << setfill(' ') << setw(5)
+ << l.thread_id << setfill('0')
+ << ' '
+ << l.filename << ':' << l.line_number << "]";
+ }
+
+
+To enable the use of ``CustomPrefix()``, simply give glog a pointer to it
+during initialization: ``InitGoogleLogging(argv[0], &CustomPrefix);``.
+
+Optionally, ``InitGoogleLogging()`` takes a third argument of type ``void*``
+to pass on to the callback function.
+
+Failure Signal Handler
+~~~~~~~~~~~~~~~~~~~~~~
+
+The library provides a convenient signal handler that will dump useful
+information when the program crashes on certain signals such as ``SIGSEGV``. The
+signal handler can be installed by :cpp:`google::InstallFailureSignalHandler()`.
+The following is an example of output from the signal handler.
+
+::
+
+ *** Aborted at 1225095260 (unix time) try "date -d @1225095260" if you are using GNU date ***
+ *** SIGSEGV (@0x0) received by PID 17711 (TID 0x7f893090a6f0) from PID 0; stack trace: ***
+ PC: @ 0x412eb1 TestWaitingLogSink::send()
+ @ 0x7f892fb417d0 (unknown)
+ @ 0x412eb1 TestWaitingLogSink::send()
+ @ 0x7f89304f7f06 google::LogMessage::SendToLog()
+ @ 0x7f89304f35af google::LogMessage::Flush()
+ @ 0x7f89304f3739 google::LogMessage::~LogMessage()
+ @ 0x408cf4 TestLogSinkWaitTillSent()
+ @ 0x4115de main
+ @ 0x7f892f7ef1c4 (unknown)
+ @ 0x4046f9 (unknown)
+
+By default, the signal handler writes the failure dump to the standard
+error. You can customize the destination by :cpp:`InstallFailureWriter()`.
+
+Performance of Messages
+~~~~~~~~~~~~~~~~~~~~~~~
+
+The conditional logging macros provided by glog (e.g., ``CHECK``,
+``LOG_IF``, ``VLOG``, etc.) are carefully implemented and don鈥檛 execute
+the right hand side expressions when the conditions are false. So, the
+following check may not sacrifice the performance of your application.
+
+.. code:: cpp
+
+ CHECK(obj.ok) << obj.CreatePrettyFormattedStringButVerySlow();
+
+User-defined Failure Function
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+``FATAL`` severity level messages or unsatisfied ``CHECK`` condition
+terminate your program. You can change the behavior of the termination
+by :cpp:`InstallFailureFunction`.
+
+.. code:: cpp
+
+ void YourFailureFunction() {
+ // Reports something...
+ exit(EXIT_FAILURE);
+ }
+
+ int main(int argc, char* argv[]) {
+ google::InstallFailureFunction(&YourFailureFunction);
+ }
+
+By default, glog tries to dump stacktrace and makes the program exit
+with status 1. The stacktrace is produced only when you run the program
+on an architecture for which glog supports stack tracing (as of
+September 2008, glog supports stack tracing for x86 and x86_64).
+
+Raw Logging
+~~~~~~~~~~~
+
+The header file ``<glog/raw_logging.h>`` can be used for thread-safe logging,
+which does not allocate any memory or acquire any locks. Therefore, the macros
+defined in this header file can be used by low-level memory allocation and
+synchronization code. Please check `src/glog/raw_logging.h.in
+<src/glog/raw_logging.h.in>`__ for detail.
+
+Google Style ``perror()``
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+``PLOG()`` and ``PLOG_IF()`` and ``PCHECK()`` behave exactly like their
+``LOG*`` and ``CHECK`` equivalents with the addition that they append a
+description of the current state of errno to their output lines. E.g.
+
+.. code:: cpp
+
+ PCHECK(write(1, nullptr, 2) >= 0) << "Write nullptr failed";
+
+This check fails with the following error message.
+
+::
+
+ F0825 185142 test.cc:22] Check failed: write(1, nullptr, 2) >= 0 Write nullptr failed: Bad address [14]
+
+Syslog
+~~~~~~
+
+``SYSLOG``, ``SYSLOG_IF``, and ``SYSLOG_EVERY_N`` macros are available.
+These log to syslog in addition to the normal logs. Be aware that
+logging to syslog can drastically impact performance, especially if
+syslog is configured for remote logging! Make sure you understand the
+implications of outputting to syslog before you use these macros. In
+general, it鈥檚 wise to use these macros sparingly.
+
+Strip Logging Messages
+~~~~~~~~~~~~~~~~~~~~~~
+
+Strings used in log messages can increase the size of your binary and
+present a privacy concern. You can therefore instruct glog to remove all
+strings which fall below a certain severity level by using the
+``GOOGLE_STRIP_LOG`` macro:
+
+If your application has code like this:
+
+.. code:: cpp
+
+ #define GOOGLE_STRIP_LOG 1 // this must go before the #include!
+ #include <glog/logging.h>
+
+The compiler will remove the log messages whose severities are less than
+the specified integer value. Since ``VLOG`` logs at the severity level
+``INFO`` (numeric value ``0``), setting ``GOOGLE_STRIP_LOG`` to 1 or
+greater removes all log messages associated with ``VLOG``\ s as well as
+``INFO`` log statements.
+
+Automatically Remove Old Logs
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+To enable the log cleaner:
+
+.. code:: cpp
+
+ google::EnableLogCleaner(3); // keep your logs for 3 days
+
+And then glog will check if there are overdue logs whenever a flush is
+performed. In this example, any log file from your project whose last
+modified time is greater than 3 days will be unlink()ed.
+
+This feature can be disabled at any time (if it has been enabled)
+
+.. code:: cpp
+
+ google::DisableLogCleaner();
+
+Notes for Windows Users
+~~~~~~~~~~~~~~~~~~~~~~~
+
+glog defines a severity level ``ERROR``, which is also defined in
+``windows.h`` . You can make glog not define ``INFO``, ``WARNING``,
+``ERROR``, and ``FATAL`` by defining ``GLOG_NO_ABBREVIATED_SEVERITIES``
+before including ``glog/logging.h`` . Even with this macro, you can
+still use the iostream like logging facilities:
+
+.. code:: cpp
+
+ #define GLOG_NO_ABBREVIATED_SEVERITIES
+ #include <windows.h>
+ #include <glog/logging.h>
+
+ // ...
+
+ LOG(ERROR) << "This should work";
+ LOG_IF(ERROR, x > y) << "This should be also OK";
+
+However, you cannot use ``INFO``, ``WARNING``, ``ERROR``, and ``FATAL``
+anymore for functions defined in ``glog/logging.h`` .
+
+.. code:: cpp
+
+ #define GLOG_NO_ABBREVIATED_SEVERITIES
+ #include <windows.h>
+ #include <glog/logging.h>
+
+ // ...
+
+ // This won鈥檛 work.
+ // google::FlushLogFiles(google::ERROR);
+
+ // Use this instead.
+ google::FlushLogFiles(google::GLOG_ERROR);
+
+If you don鈥檛 need ``ERROR`` defined by ``windows.h``, there are a couple
+of more workarounds which sometimes don鈥檛 work:
+
+- ``#define WIN32_LEAN_AND_MEAN`` or ``NOGDI`` **before** you
+ ``#include windows.h``.
+- ``#undef ERROR`` **after** you ``#include windows.h`` .
+
+See `this
+issue <http://code.google.com/p/google-glog/issues/detail?id=33>`__ for
+more detail.
+
+
+Installation Notes for 64-bit Linux Systems
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The glibc built-in stack-unwinder on 64-bit systems has some problems with glog.
+(In particular, if you are using :cpp:`InstallFailureSignalHandler()`, the
+signal may be raised in the middle of malloc, holding some malloc-related locks
+when they invoke the stack unwinder. The built-in stack unwinder may call malloc
+recursively, which may require the thread to acquire a lock it already holds:
+deadlock.)
+
+For that reason, if you use a 64-bit system and you need
+:cpp:`InstallFailureSignalHandler()`, we strongly recommend you install
+``libunwind`` before trying to configure or install google glog.
+libunwind can be found
+`here <http://download.savannah.nongnu.org/releases/libunwind/libunwind-snap-070410.tar.gz>`__.
+
+Even if you already have ``libunwind`` installed, you will probably
+still need to install from the snapshot to get the latest version.
+
+Caution: if you install libunwind from the URL above, be aware that you
+may have trouble if you try to statically link your binary with glog:
+that is, if you link with ``gcc -static -lgcc_eh ...``. This is because
+both ``libunwind`` and ``libgcc`` implement the same C++ exception
+handling APIs, but they implement them differently on some platforms.
+This is not likely to be a problem on ia64, but may be on x86-64.
+
+Also, if you link binaries statically, make sure that you add
+:cmd:`-Wl,--eh-frame-hdr` to your linker options. This is required so that
+``libunwind`` can find the information generated by the compiler required for
+stack unwinding.
+
+Using :cmd:`-static` is rare, though, so unless you know this will affect you it
+probably won鈥檛.
+
+If you cannot or do not wish to install libunwind, you can still try to
+use two kinds of stack-unwinder: 1. glibc built-in stack-unwinder and 2.
+frame pointer based stack-unwinder.
+
+1. As we already mentioned, glibc鈥檚 unwinder has a deadlock issue.
+ However, if you don鈥檛 use :cpp:`InstallFailureSignalHandler()` or you
+ don鈥檛 worry about the rare possibilities of deadlocks, you can use
+ this stack-unwinder. If you specify no options and ``libunwind``
+ isn鈥檛 detected on your system, the configure script chooses this
+ unwinder by default.
+
+2. The frame pointer based stack unwinder requires that your
+ application, the glog library, and system libraries like libc, all be
+ compiled with a frame pointer. This is *not* the default for x86-64.
+
+
+How to Contribute
+-----------------
+
+We鈥檇 love to accept your patches and contributions to this project.
+There are a just a few small guidelines you need to follow.
+
+Contributor License Agreement (CLA)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Contributions to any Google project must be accompanied by a Contributor
+License Agreement. This is not a copyright **assignment**, it simply
+gives Google permission to use and redistribute your contributions as
+part of the project.
+
+* If you are an individual writing original source code and you鈥檙e sure
+ you own the intellectual property, then you鈥檒l need to sign an
+ `individual
+ CLA <https://developers.google.com/open-source/cla/individual>`__.
+* If you work for a company that wants to allow you to contribute your
+ work, then you鈥檒l need to sign a `corporate
+ CLA <https://developers.google.com/open-source/cla/corporate>`__.
+
+You generally only need to submit a CLA once, so if you鈥檝e already
+submitted one (even if it was for a different project), you probably
+don鈥檛 need to do it again.
+
+Once your CLA is submitted (or if you already submitted one for another
+Google project), make a commit adding yourself to the
+`AUTHORS <./AUTHORS>`__ and `CONTRIBUTORS <./CONTRIBUTORS>`__ files. This
+commit can be part of your first `pull
+request <https://help.github.com/articles/creating-a-pull-request>`__.
+
+Submitting a Patch
+~~~~~~~~~~~~~~~~~~
+
+1. It鈥檚 generally best to start by opening a new issue describing the
+ bug or feature you鈥檙e intending to fix. Even if you think it鈥檚
+ relatively minor, it鈥檚 helpful to know what people are working on.
+ Mention in the initial issue that you are planning to work on that
+ bug or feature so that it can be assigned to you.
+2. Follow the normal process of
+ `forking <https://help.github.com/articles/fork-a-repo>`__ the
+ project, and setup a new branch to work in. It鈥檚 important that each
+ group of changes be done in separate branches in order to ensure that
+ a pull request only includes the commits related to that bug or
+ feature.
+3. Do your best to have `well-formed commit
+ messages <http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html>`__
+ for each change. This provides consistency throughout the project,
+ and ensures that commit messages are able to be formatted properly by
+ various git tools.
+4. Finally, push the commits to your fork and submit a `pull
+ request <https://help.github.com/articles/creating-a-pull-request>`__.
+
+
+.. |Linux Github actions| image:: https://github.com/google/glog/actions/workflows/linux.yml/badge.svg
+ :target: https://github.com/google/glog/actions
+.. |Windows Github actions| image:: https://github.com/google/glog/actions/workflows/windows.yml/badge.svg
+ :target: https://github.com/google/glog/actions
+.. |macOS Github actions| image:: https://github.com/google/glog/actions/workflows/macos.yml/badge.svg
+ :target: https://github.com/google/glog/actions
+.. |Codecov| image:: https://codecov.io/gh/google/glog/branch/master/graph/badge.svg?token=8an420vNju
+ :target: https://codecov.io/gh/google/glog
diff --git a/funasr/runtime/onnxruntime/third_party/glog/WORKSPACE b/funasr/runtime/onnxruntime/third_party/glog/WORKSPACE
new file mode 100644
index 0000000..6f8714b
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/WORKSPACE
@@ -0,0 +1,18 @@
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+http_archive(
+ name = "com_github_gflags_gflags",
+ sha256 = "34af2f15cf7367513b352bdcd2493ab14ce43692d2dcd9dfc499492966c64dcf",
+ strip_prefix = "gflags-2.2.2",
+ urls = [
+ "https://mirror.bazel.build/github.com/gflags/gflags/archive/v2.2.2.tar.gz",
+ "https://github.com/gflags/gflags/archive/v2.2.2.tar.gz",
+ ],
+)
+
+http_archive(
+ name = "com_github_google_googletest",
+ sha256 = "258f33ab1a8ee17adf48ec65e821d0ea9eafcbedeff6110f9eaed78472e73dde",
+ strip_prefix = "googletest-15460959cbbfa20e66ef0b5ab497367e47fc0a04",
+ urls = ["https://github.com/google/googletest/archive/15460959cbbfa20e66ef0b5ab497367e47fc0a04.tar.gz"],
+)
diff --git a/funasr/runtime/onnxruntime/third_party/glog/bazel/example/BUILD.bazel b/funasr/runtime/onnxruntime/third_party/glog/bazel/example/BUILD.bazel
new file mode 100644
index 0000000..05ab0f3
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/bazel/example/BUILD.bazel
@@ -0,0 +1,9 @@
+cc_test(
+ name = "main",
+ size = "small",
+ srcs = ["main.cc"],
+ deps = [
+ "//:glog",
+ "@com_github_gflags_gflags//:gflags",
+ ],
+)
diff --git a/funasr/runtime/onnxruntime/third_party/glog/bazel/example/main.cc b/funasr/runtime/onnxruntime/third_party/glog/bazel/example/main.cc
new file mode 100644
index 0000000..fef01dc
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/bazel/example/main.cc
@@ -0,0 +1,22 @@
+#include <gflags/gflags.h>
+#include <glog/logging.h>
+#include <glog/stl_logging.h>
+
+int main(int argc, char* argv[]) {
+ // Initialize Google's logging library.
+ google::InitGoogleLogging(argv[0]);
+
+ // Optional: parse command line flags
+ gflags::ParseCommandLineFlags(&argc, &argv, true);
+
+ LOG(INFO) << "Hello, world!";
+
+ // glog/stl_logging.h allows logging STL containers.
+ std::vector<int> x;
+ x.push_back(1);
+ x.push_back(2);
+ x.push_back(3);
+ LOG(INFO) << "ABC, it's easy as " << x;
+
+ return 0;
+}
diff --git a/funasr/runtime/onnxruntime/third_party/glog/bazel/glog.bzl b/funasr/runtime/onnxruntime/third_party/glog/bazel/glog.bzl
new file mode 100644
index 0000000..c25a786
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/bazel/glog.bzl
@@ -0,0 +1,307 @@
+# Implement a macro glog_library() that the BUILD.bazel file can load.
+
+# By default, glog is built with gflags support. You can change this behavior
+# by using glog_library(with_gflags=0)
+#
+# This file is inspired by the following sample BUILD files:
+# https://github.com/google/glog/issues/61
+# https://github.com/google/glog/files/393474/BUILD.txt
+#
+# Known issue: the namespace parameter is not supported on Win32.
+
+def expand_template_impl(ctx):
+ ctx.actions.expand_template(
+ template = ctx.file.template,
+ output = ctx.outputs.out,
+ substitutions = ctx.attr.substitutions,
+ )
+
+expand_template = rule(
+ implementation = expand_template_impl,
+ attrs = {
+ "template": attr.label(mandatory = True, allow_single_file = True),
+ "substitutions": attr.string_dict(mandatory = True),
+ "out": attr.output(mandatory = True),
+ },
+)
+
+def dict_union(x, y):
+ z = {}
+ z.update(x)
+ z.update(y)
+ return z
+
+def glog_library(namespace = "google", with_gflags = 1, **kwargs):
+ if native.repository_name() != "@":
+ repo_name = native.repository_name()[1:] # Strip the first leading @
+ gendir = "$(GENDIR)/external/" + repo_name
+ src_windows = "external/%s/src/windows" % repo_name
+ else:
+ gendir = "$(GENDIR)"
+ src_windows = "src/windows"
+
+ # Config setting for WebAssembly target.
+ native.config_setting(
+ name = "wasm",
+ values = {"cpu": "wasm"},
+ )
+
+ # Detect when building with clang-cl on Windows.
+ native.config_setting(
+ name = "clang-cl",
+ values = {"compiler": "clang-cl"},
+ )
+
+ common_copts = [
+ "-std=c++14",
+ "-DGLOG_BAZEL_BUILD",
+ # Inject a C++ namespace.
+ "-DGOOGLE_NAMESPACE='%s'" % namespace,
+ "-DHAVE_STRING_H",
+ "-I%s/glog_internal" % gendir,
+ ] + (["-DHAVE_LIB_GFLAGS"] if with_gflags else [])
+
+ wasm_copts = [
+ # Disable warnings that exists in glog.
+ "-Wno-sign-compare",
+ "-Wno-unused-function",
+ "-Wno-unused-local-typedefs",
+ "-Wno-unused-variable",
+ # Allows src/base/mutex.h to include pthread.h.
+ "-DHAVE_PTHREAD",
+ # Allows src/logging.cc to determine the host name.
+ "-DHAVE_SYS_UTSNAME_H",
+ # For src/utilities.cc.
+ "-DHAVE_SYS_TIME_H",
+ "-DHAVE__UNWIND_BACKTRACE",
+ "-DHAVE__UNWIND_GETIP",
+ # Enable dumping stacktrace upon sigaction.
+ "-DHAVE_SIGACTION",
+ # For logging.cc.
+ "-DHAVE_PREAD",
+ "-DHAVE___ATTRIBUTE__",
+ ]
+
+ linux_or_darwin_copts = wasm_copts + [
+ "-DGLOG_EXPORT=__attribute__((visibility(\\\"default\\\")))",
+ # For src/utilities.cc.
+ "-DHAVE_SYS_SYSCALL_H",
+ # For src/logging.cc to create symlinks.
+ "-DHAVE_UNISTD_H",
+ "-fvisibility-inlines-hidden",
+ "-fvisibility=hidden",
+ ]
+
+ freebsd_only_copts = [
+ # Enable declaration of _Unwind_Backtrace
+ "-D_GNU_SOURCE",
+ ]
+
+ linux_only_copts = [
+ # For utilities.h.
+ "-DHAVE_EXECINFO_H",
+ ]
+
+ darwin_only_copts = [
+ # For stacktrace.
+ "-DHAVE_DLADDR",
+ # Avoid deprecated syscall().
+ "-DHAVE_PTHREAD_THREADID_NP",
+ ]
+
+ windows_only_copts = [
+ # Override -DGLOG_EXPORT= from the cc_library's defines.
+ "-DGLOG_EXPORT=__declspec(dllexport)",
+ "-DGLOG_NO_ABBREVIATED_SEVERITIES",
+ "-DHAVE_SNPRINTF",
+ "-I" + src_windows,
+ ]
+
+ clang_cl_only_copts = [
+ # Allow the override of -DGLOG_EXPORT.
+ "-Wno-macro-redefined",
+ ]
+
+ windows_only_srcs = [
+ "src/glog/log_severity.h",
+ "src/windows/dirent.h",
+ "src/windows/port.cc",
+ "src/windows/port.h",
+ ]
+
+ gflags_deps = ["@com_github_gflags_gflags//:gflags"] if with_gflags else []
+
+ final_lib_defines = select({
+ # GLOG_EXPORT is normally set by export.h, but that's not
+ # generated for Bazel.
+ "@bazel_tools//src/conditions:windows": [
+ "GLOG_EXPORT=",
+ "GLOG_DEPRECATED=__declspec(deprecated)",
+ "GLOG_NO_ABBREVIATED_SEVERITIES",
+ ],
+ "//conditions:default": [
+ "GLOG_DEPRECATED=__attribute__((deprecated))",
+ "GLOG_EXPORT=__attribute__((visibility(\\\"default\\\")))",
+ ],
+ })
+
+ final_lib_copts = select({
+ "@bazel_tools//src/conditions:windows": common_copts + windows_only_copts,
+ "@bazel_tools//src/conditions:darwin": common_copts + linux_or_darwin_copts + darwin_only_copts,
+ "@bazel_tools//src/conditions:freebsd": common_copts + linux_or_darwin_copts + freebsd_only_copts,
+ ":wasm": common_copts + wasm_copts,
+ "//conditions:default": common_copts + linux_or_darwin_copts + linux_only_copts,
+ }) + select({
+ ":clang-cl": clang_cl_only_copts,
+ "//conditions:default": [],
+ })
+
+ native.cc_library(
+ name = "glog",
+ visibility = ["//visibility:public"],
+ srcs = [
+ ":config_h",
+ "src/base/commandlineflags.h",
+ "src/base/googleinit.h",
+ "src/base/mutex.h",
+ "src/demangle.cc",
+ "src/demangle.h",
+ "src/logging.cc",
+ "src/raw_logging.cc",
+ "src/signalhandler.cc",
+ "src/stacktrace.h",
+ "src/stacktrace_generic-inl.h",
+ "src/stacktrace_libunwind-inl.h",
+ "src/stacktrace_powerpc-inl.h",
+ "src/stacktrace_unwind-inl.h",
+ "src/stacktrace_windows-inl.h",
+ "src/stacktrace_x86-inl.h",
+ "src/symbolize.cc",
+ "src/symbolize.h",
+ "src/utilities.cc",
+ "src/utilities.h",
+ "src/vlog_is_on.cc",
+ ] + select({
+ "@bazel_tools//src/conditions:windows": windows_only_srcs,
+ "//conditions:default": [],
+ }),
+ hdrs = [
+ "src/glog/log_severity.h",
+ "src/glog/platform.h",
+ ":logging_h",
+ ":raw_logging_h",
+ ":stl_logging_h",
+ ":vlog_is_on_h",
+ ],
+ strip_include_prefix = "src",
+ defines = final_lib_defines,
+ copts = final_lib_copts,
+ deps = gflags_deps + select({
+ "@bazel_tools//src/conditions:windows": [":strip_include_prefix_hack"],
+ "//conditions:default": [],
+ }),
+ **kwargs
+ )
+
+ test_list = [
+ "cleanup_immediately",
+ "cleanup_with_absolute_prefix",
+ "cleanup_with_relative_prefix",
+ # "demangle", # Broken
+ # "logging", # Broken
+ # "mock-log", # Broken
+ # "signalhandler", # Pointless
+ "stacktrace",
+ "stl_logging",
+ # "symbolize", # Broken
+ "utilities",
+ ]
+
+ test_only_copts = [
+ "-DTEST_SRC_DIR=\\\"%s/tests\\\"" % gendir,
+ ]
+
+ for test_name in test_list:
+ native.cc_test(
+ name = test_name + "_test",
+ visibility = ["//visibility:public"],
+ srcs = [
+ "src/googletest.h",
+ "src/" + test_name + "_unittest.cc",
+ ],
+ defines = final_lib_defines,
+ copts = final_lib_copts + test_only_copts,
+ deps = [
+ ":glog",
+ "@com_github_google_googletest//:gtest",
+ ],
+ **kwargs
+ )
+
+ # Workaround https://github.com/bazelbuild/bazel/issues/6337 by declaring
+ # the dependencies without strip_include_prefix.
+ native.cc_library(
+ name = "strip_include_prefix_hack",
+ hdrs = [
+ "src/glog/log_severity.h",
+ ":logging_h",
+ ":raw_logging_h",
+ ":stl_logging_h",
+ ":vlog_is_on_h",
+ ],
+ )
+
+ expand_template(
+ name = "config_h",
+ template = "src/config.h.cmake.in",
+ out = "glog_internal/config.h",
+ substitutions = {"#cmakedefine": "//cmakedefine"},
+ )
+
+ common_config = {
+ "@ac_cv_have_u_int16_t@": "0",
+ "@ac_cv_have_glog_export@": "0",
+ "@ac_google_start_namespace@": "namespace google {",
+ "@ac_google_end_namespace@": "}",
+ "@ac_google_namespace@": "google",
+ }
+
+ posix_config = dict_union(common_config, {
+ "@ac_cv___attribute___noinline@": "__attribute__((noinline))",
+ "@ac_cv___attribute___printf_4_5@": "__attribute__((__format__(__printf__, 4, 5)))",
+ "@ac_cv_have___builtin_expect@": "1",
+ "@ac_cv_have_libgflags@": "1" if with_gflags else "0",
+ "@ac_cv_have_mode_t@": "1",
+ "@ac_cv_have_ssize_t@": "1",
+ "@ac_cv_have_systypes_h@": "1",
+ "@ac_cv_have_unistd_h@": "1",
+ })
+
+ windows_config = dict_union(common_config, {
+ "@ac_cv___attribute___noinline@": "",
+ "@ac_cv___attribute___printf_4_5@": "",
+ "@ac_cv_have___builtin_expect@": "0",
+ "@ac_cv_have_libgflags@": "0",
+ "@ac_cv_have_mode_t@": "0",
+ "@ac_cv_have_ssize_t@": "0",
+ "@ac_cv_have_systypes_h@": "0",
+ "@ac_cv_have_unistd_h@": "0",
+ })
+
+ [
+ expand_template(
+ name = "%s_h" % f,
+ template = "src/glog/%s.h.in" % f,
+ out = "src/glog/%s.h" % f,
+ substitutions = select({
+ "@bazel_tools//src/conditions:windows": windows_config,
+ "//conditions:default": posix_config,
+ }),
+ )
+ for f in [
+ "vlog_is_on",
+ "stl_logging",
+ "raw_logging",
+ "logging",
+ ]
+ ]
diff --git a/funasr/runtime/onnxruntime/third_party/glog/cmake/DetermineGflagsNamespace.cmake b/funasr/runtime/onnxruntime/third_party/glog/cmake/DetermineGflagsNamespace.cmake
new file mode 100644
index 0000000..3dde42b
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/cmake/DetermineGflagsNamespace.cmake
@@ -0,0 +1,69 @@
+macro(determine_gflags_namespace VARIABLE)
+ if (NOT DEFINED "${VARIABLE}")
+ if (CMAKE_REQUIRED_INCLUDES)
+ set (CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}")
+ else ()
+ set (CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS)
+ endif ()
+
+ set(MACRO_CHECK_INCLUDE_FILE_FLAGS ${CMAKE_REQUIRED_FLAGS})
+
+ set(_NAMESPACES gflags google)
+ set(_check_code
+"
+#include <gflags/gflags.h>
+
+int main(int argc, char**argv)
+{
+ GLOG_GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
+}
+")
+ if (NOT CMAKE_REQUIRED_QUIET)
+ message (STATUS "Looking for gflags namespace")
+ endif ()
+ if (${ARGC} EQUAL 3)
+ set (CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS})
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARGV2}")
+ endif ()
+
+ set (_check_file
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/DetermineGflagsNamespace.cxx)
+
+ foreach (_namespace ${_NAMESPACES})
+ file (WRITE "${_check_file}" "${_check_code}")
+ try_compile (${VARIABLE}
+ "${CMAKE_BINARY_DIR}" "${_check_file}"
+ COMPILE_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}" -DGLOG_GFLAGS_NAMESPACE=${_namespace}
+ LINK_LIBRARIES gflags
+ CMAKE_FLAGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+ OUTPUT_VARIABLE OUTPUT)
+
+ if (${VARIABLE})
+ set (${VARIABLE} ${_namespace} CACHE INTERNAL "gflags namespace" FORCE)
+ break ()
+ else ()
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining the gflags namespace ${_namespace} failed with the following output:\n"
+ "${OUTPUT}\n\n")
+ endif ()
+ endforeach (_namespace)
+
+ if (${ARGC} EQUAL 3)
+ set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_SAVE})
+ endif ()
+
+ if (${VARIABLE})
+ if (NOT CMAKE_REQUIRED_QUIET)
+ message (STATUS "Looking for gflags namespace - ${${VARIABLE}}")
+ endif ()
+ file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining the gflags namespace passed with the following output:\n"
+ "${OUTPUT}\n\n")
+ else ()
+ if (NOT CMAKE_REQUIRED_QUIET)
+ message (STATUS "Looking for gflags namespace - failed")
+ endif ()
+ set (${VARIABLE} ${_namespace} CACHE INTERNAL "gflags namespace")
+ endif ()
+ endif ()
+endmacro ()
diff --git a/funasr/runtime/onnxruntime/third_party/glog/cmake/FindUnwind.cmake b/funasr/runtime/onnxruntime/third_party/glog/cmake/FindUnwind.cmake
new file mode 100644
index 0000000..a7a976b
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/cmake/FindUnwind.cmake
@@ -0,0 +1,61 @@
+# - Try to find libunwind
+# Once done this will define
+#
+# Unwind_FOUND - system has libunwind
+# unwind::unwind - cmake target for libunwind
+
+include (FindPackageHandleStandardArgs)
+
+find_path (Unwind_INCLUDE_DIR NAMES unwind.h libunwind.h DOC "unwind include directory")
+find_library (Unwind_LIBRARY NAMES unwind DOC "unwind library")
+
+mark_as_advanced (Unwind_INCLUDE_DIR Unwind_LIBRARY)
+
+# Extract version information
+if (Unwind_LIBRARY)
+ set (_Unwind_VERSION_HEADER ${Unwind_INCLUDE_DIR}/libunwind-common.h)
+
+ if (EXISTS ${_Unwind_VERSION_HEADER})
+ file (READ ${_Unwind_VERSION_HEADER} _Unwind_VERSION_CONTENTS)
+
+ string (REGEX REPLACE ".*#define UNW_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1"
+ Unwind_VERSION_MAJOR "${_Unwind_VERSION_CONTENTS}")
+ string (REGEX REPLACE ".*#define UNW_VERSION_MINOR[ \t]+([0-9]+).*" "\\1"
+ Unwind_VERSION_MINOR "${_Unwind_VERSION_CONTENTS}")
+ string (REGEX REPLACE ".*#define UNW_VERSION_EXTRA[ \t]+([0-9]+).*" "\\1"
+ Unwind_VERSION_PATCH "${_Unwind_VERSION_CONTENTS}")
+
+ set (Unwind_VERSION ${Unwind_VERSION_MAJOR}.${Unwind_VERSION_MINOR})
+
+ if (CMAKE_MATCH_0)
+ # Third version component may be empty
+ set (Unwind_VERSION ${Unwind_VERSION}.${Unwind_VERSION_PATCH})
+ set (Unwind_VERSION_COMPONENTS 3)
+ else (CMAKE_MATCH_0)
+ set (Unwind_VERSION_COMPONENTS 2)
+ endif (CMAKE_MATCH_0)
+ endif (EXISTS ${_Unwind_VERSION_HEADER})
+endif (Unwind_LIBRARY)
+
+# handle the QUIETLY and REQUIRED arguments and set Unwind_FOUND to TRUE
+# if all listed variables are TRUE
+find_package_handle_standard_args (Unwind
+ REQUIRED_VARS Unwind_INCLUDE_DIR Unwind_LIBRARY
+ VERSION_VAR Unwind_VERSION
+)
+
+if (Unwind_FOUND)
+ if (NOT TARGET unwind::unwind)
+ add_library (unwind::unwind INTERFACE IMPORTED)
+
+ set_property (TARGET unwind::unwind PROPERTY
+ INTERFACE_INCLUDE_DIRECTORIES ${Unwind_INCLUDE_DIR}
+ )
+ set_property (TARGET unwind::unwind PROPERTY
+ INTERFACE_LINK_LIBRARIES ${Unwind_LIBRARY}
+ )
+ set_property (TARGET unwind::unwind PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE
+ )
+ endif (NOT TARGET unwind::unwind)
+endif (Unwind_FOUND)
diff --git a/funasr/runtime/onnxruntime/third_party/glog/cmake/GetCacheVariables.cmake b/funasr/runtime/onnxruntime/third_party/glog/cmake/GetCacheVariables.cmake
new file mode 100644
index 0000000..ead3589
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/cmake/GetCacheVariables.cmake
@@ -0,0 +1,70 @@
+cmake_policy (PUSH)
+cmake_policy (VERSION 3.3)
+
+include (CMakeParseArguments)
+
+function (get_cache_variables _CACHEVARS)
+ set (_SINGLE)
+ set (_MULTI EXCLUDE)
+ set (_OPTIONS)
+
+ cmake_parse_arguments (_ARGS "${_OPTIONS}" "${_SINGLE}" "${_MULTI}" ${ARGS} ${ARGN})
+
+ get_cmake_property (_VARIABLES VARIABLES)
+
+ set (CACHEVARS)
+
+ foreach (_VAR ${_VARIABLES})
+ if (DEFINED _ARGS_EXCLUDE)
+ if ("${_VAR}" IN_LIST _ARGS_EXCLUDE)
+ continue ()
+ endif ("${_VAR}" IN_LIST _ARGS_EXCLUDE)
+ endif (DEFINED _ARGS_EXCLUDE)
+
+ get_property (_CACHEVARTYPE CACHE ${_VAR} PROPERTY TYPE)
+
+ if ("${_CACHEVARTYPE}" STREQUAL INTERNAL OR
+ "${_CACHEVARTYPE}" STREQUAL STATIC OR
+ "${_CACHEVARTYPE}" STREQUAL UNINITIALIZED)
+ continue ()
+ endif ("${_CACHEVARTYPE}" STREQUAL INTERNAL OR
+ "${_CACHEVARTYPE}" STREQUAL STATIC OR
+ "${_CACHEVARTYPE}" STREQUAL UNINITIALIZED)
+
+ get_property (_CACHEVARVAL CACHE ${_VAR} PROPERTY VALUE)
+
+ if ("${_CACHEVARVAL}" STREQUAL "")
+ continue ()
+ endif ("${_CACHEVARVAL}" STREQUAL "")
+
+ get_property (_CACHEVARDOC CACHE ${_VAR} PROPERTY HELPSTRING)
+
+ # Escape " in values
+ string (REPLACE "\"" "\\\"" _CACHEVARVAL "${_CACHEVARVAL}")
+ # Escape " in help strings
+ string (REPLACE "\"" "\\\"" _CACHEVARDOC "${_CACHEVARDOC}")
+ # Escape ; in values
+ string (REPLACE ";" "\\\;" _CACHEVARVAL "${_CACHEVARVAL}")
+ # Escape ; in help strings
+ string (REPLACE ";" "\\\;" _CACHEVARDOC "${_CACHEVARDOC}")
+ # Escape backslashes in values except those that are followed by a
+ # quote.
+ string (REGEX REPLACE "\\\\([^\"])" "\\\\\\1" _CACHEVARVAL "${_CACHEVARVAL}")
+ # Escape backslashes in values that are followed by a letter to avoid
+ # invalid escape sequence errors.
+ string (REGEX REPLACE "\\\\([a-zA-Z])" "\\\\\\\\1" _CACHEVARVAL "${_CACHEVARVAL}")
+ string (REPLACE "\\\\" "\\\\\\\\" _CACHEVARDOC "${_CACHEVARDOC}")
+
+ if (NOT "${_CACHEVARTYPE}" STREQUAL BOOL)
+ set (_CACHEVARVAL "\"${_CACHEVARVAL}\"")
+ endif (NOT "${_CACHEVARTYPE}" STREQUAL BOOL)
+
+ if (NOT "${_CACHEVARTYPE}" STREQUAL "" AND NOT "${_CACHEVARVAL}" STREQUAL "")
+ set (CACHEVARS "${CACHEVARS}set (${_VAR} ${_CACHEVARVAL} CACHE ${_CACHEVARTYPE} \"${_CACHEVARDOC}\")\n")
+ endif (NOT "${_CACHEVARTYPE}" STREQUAL "" AND NOT "${_CACHEVARVAL}" STREQUAL "")
+ endforeach (_VAR)
+
+ set (${_CACHEVARS} ${CACHEVARS} PARENT_SCOPE)
+endfunction (get_cache_variables)
+
+cmake_policy (POP)
diff --git a/funasr/runtime/onnxruntime/third_party/glog/cmake/RunCleanerTest1.cmake b/funasr/runtime/onnxruntime/third_party/glog/cmake/RunCleanerTest1.cmake
new file mode 100644
index 0000000..7fbf463
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/cmake/RunCleanerTest1.cmake
@@ -0,0 +1,22 @@
+set (RUNS 3)
+
+foreach (iter RANGE 1 ${RUNS})
+ set (ENV{GOOGLE_LOG_DIR} ${TEST_DIR})
+ execute_process (COMMAND ${LOGCLEANUP} RESULT_VARIABLE _RESULT)
+
+ if (NOT _RESULT EQUAL 0)
+ message (FATAL_ERROR "Failed to run logcleanup_unittest (error: ${_RESULT})")
+ endif (NOT _RESULT EQUAL 0)
+
+ # Ensure the log files to have different modification timestamps such that
+ # exactly one log file remains at the end. Otherwise all log files will be
+ # retained.
+ execute_process (COMMAND ${CMAKE_COMMAND} -E sleep 1)
+endforeach (iter)
+
+file (GLOB LOG_FILES ${TEST_DIR}/*.foobar)
+list (LENGTH LOG_FILES NUM_FILES)
+
+if (NOT NUM_FILES EQUAL 1)
+ message (SEND_ERROR "Expected 1 log file in log directory but found ${NUM_FILES}")
+endif (NOT NUM_FILES EQUAL 1)
diff --git a/funasr/runtime/onnxruntime/third_party/glog/cmake/RunCleanerTest2.cmake b/funasr/runtime/onnxruntime/third_party/glog/cmake/RunCleanerTest2.cmake
new file mode 100644
index 0000000..d3b51e3
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/cmake/RunCleanerTest2.cmake
@@ -0,0 +1,22 @@
+set (RUNS 3)
+
+foreach (iter RANGE 1 ${RUNS})
+ execute_process (COMMAND ${LOGCLEANUP} -log_dir=${TEST_DIR}
+ RESULT_VARIABLE _RESULT)
+
+ if (NOT _RESULT EQUAL 0)
+ message (FATAL_ERROR "Failed to run logcleanup_unittest (error: ${_RESULT})")
+ endif (NOT _RESULT EQUAL 0)
+
+ # Ensure the log files to have different modification timestamps such that
+ # exactly one log file remains at the end. Otherwise all log files will be
+ # retained.
+ execute_process (COMMAND ${CMAKE_COMMAND} -E sleep 1)
+endforeach (iter)
+
+file (GLOB LOG_FILES ${TEST_DIR}/test_cleanup_*.barfoo)
+list (LENGTH LOG_FILES NUM_FILES)
+
+if (NOT NUM_FILES EQUAL 1)
+ message (SEND_ERROR "Expected 1 log file in build directory ${TEST_DIR} but found ${NUM_FILES}")
+endif (NOT NUM_FILES EQUAL 1)
diff --git a/funasr/runtime/onnxruntime/third_party/glog/cmake/RunCleanerTest3.cmake b/funasr/runtime/onnxruntime/third_party/glog/cmake/RunCleanerTest3.cmake
new file mode 100644
index 0000000..e8105d1
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/cmake/RunCleanerTest3.cmake
@@ -0,0 +1,28 @@
+set (RUNS 3)
+
+# Create the subdirectory required by this unit test.
+file (MAKE_DIRECTORY ${TEST_DIR}/${TEST_SUBDIR})
+
+foreach (iter RANGE 1 ${RUNS})
+ execute_process (COMMAND ${LOGCLEANUP} -log_dir=${TEST_DIR}
+ RESULT_VARIABLE _RESULT)
+
+ if (NOT _RESULT EQUAL 0)
+ message (FATAL_ERROR "Failed to run logcleanup_unittest (error: ${_RESULT})")
+ endif (NOT _RESULT EQUAL 0)
+
+ # Ensure the log files to have different modification timestamps such that
+ # exactly one log file remains at the end. Otherwise all log files will be
+ # retained.
+ execute_process (COMMAND ${CMAKE_COMMAND} -E sleep 2)
+endforeach (iter)
+
+file (GLOB LOG_FILES ${TEST_DIR}/${TEST_SUBDIR}/test_cleanup_*.relativefoo)
+list (LENGTH LOG_FILES NUM_FILES)
+
+if (NOT NUM_FILES EQUAL 1)
+ message (SEND_ERROR "Expected 1 log file in build directory ${TEST_DIR}${TEST_SUBDIR} but found ${NUM_FILES}")
+endif (NOT NUM_FILES EQUAL 1)
+
+# Remove the subdirectory required by this unit test.
+file (REMOVE_RECURSE ${TEST_DIR}/${TEST_SUBDIR})
diff --git a/funasr/runtime/onnxruntime/third_party/glog/cmake/TestInitPackageConfig.cmake b/funasr/runtime/onnxruntime/third_party/glog/cmake/TestInitPackageConfig.cmake
new file mode 100644
index 0000000..01d3a40
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/cmake/TestInitPackageConfig.cmake
@@ -0,0 +1,11 @@
+# Create the build directory
+execute_process (
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${TEST_BINARY_DIR}
+ RESULT_VARIABLE _DIRECTORY_CREATED_SUCCEEDED
+)
+
+if (NOT _DIRECTORY_CREATED_SUCCEEDED EQUAL 0)
+ message (FATAL_ERROR "Failed to create build directory")
+endif (NOT _DIRECTORY_CREATED_SUCCEEDED EQUAL 0)
+
+file (WRITE ${INITIAL_CACHE} "${CACHEVARS}")
diff --git a/funasr/runtime/onnxruntime/third_party/glog/cmake/TestPackageConfig.cmake b/funasr/runtime/onnxruntime/third_party/glog/cmake/TestPackageConfig.cmake
new file mode 100644
index 0000000..97244ab
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/cmake/TestPackageConfig.cmake
@@ -0,0 +1,40 @@
+# Create the build directory
+execute_process (
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${TEST_BINARY_DIR}
+ RESULT_VARIABLE _DIRECTORY_CREATED_SUCCEEDED
+)
+
+if (NOT _DIRECTORY_CREATED_SUCCEEDED EQUAL 0)
+ message (FATAL_ERROR "Failed to create build directory")
+endif (NOT _DIRECTORY_CREATED_SUCCEEDED EQUAL 0)
+
+if (GENERATOR_TOOLSET)
+ list (APPEND _ADDITIONAL_ARGS -T ${GENERATOR_TOOLSET})
+endif (GENERATOR_TOOLSET)
+
+if (GENERATOR_PLATFORM)
+ list (APPEND _ADDITIONAL_ARGS -A ${GENERATOR_PLATFORM})
+endif (GENERATOR_PLATFORM)
+
+# Run CMake
+execute_process (
+ # Capture the PATH environment variable content set during project generation
+ # stage. This is required because later during the build stage the PATH is
+ # modified again (e.g., for MinGW AppVeyor CI builds) by adding back the
+ # directory containing git.exe. Incidently, the Git installation directory
+ # also contains sh.exe which causes MinGW Makefile generation to fail.
+ COMMAND ${CMAKE_COMMAND} -E env PATH=${PATH}
+ ${CMAKE_COMMAND} -C ${INITIAL_CACHE}
+ -G ${GENERATOR}
+ ${_ADDITIONAL_ARGS}
+ -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON
+ -DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON
+ -DCMAKE_PREFIX_PATH=${PACKAGE_DIR}
+ ${SOURCE_DIR}
+ WORKING_DIRECTORY ${TEST_BINARY_DIR}
+ RESULT_VARIABLE _GENERATE_SUCCEEDED
+)
+
+if (NOT _GENERATE_SUCCEEDED EQUAL 0)
+ message (FATAL_ERROR "Failed to generate project files using CMake")
+endif (NOT _GENERATE_SUCCEEDED EQUAL 0)
diff --git a/funasr/runtime/onnxruntime/third_party/glog/glog-config.cmake.in b/funasr/runtime/onnxruntime/third_party/glog/glog-config.cmake.in
new file mode 100644
index 0000000..5c5c9c0
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/glog-config.cmake.in
@@ -0,0 +1,13 @@
+if (CMAKE_VERSION VERSION_LESS @glog_CMake_VERSION@)
+ message (FATAL_ERROR "CMake >= @glog_CMake_VERSION@ required")
+endif (CMAKE_VERSION VERSION_LESS @glog_CMake_VERSION@)
+
+@PACKAGE_INIT@
+
+include (CMakeFindDependencyMacro)
+include (${CMAKE_CURRENT_LIST_DIR}/glog-modules.cmake)
+
+@gflags_DEPENDENCY@
+@Unwind_DEPENDENCY@
+
+include (${CMAKE_CURRENT_LIST_DIR}/glog-targets.cmake)
diff --git a/funasr/runtime/onnxruntime/third_party/glog/glog-modules.cmake.in b/funasr/runtime/onnxruntime/third_party/glog/glog-modules.cmake.in
new file mode 100644
index 0000000..71c5160
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/glog-modules.cmake.in
@@ -0,0 +1,18 @@
+cmake_policy (PUSH)
+cmake_policy (SET CMP0057 NEW)
+
+if (CMAKE_VERSION VERSION_LESS 3.3)
+ message (FATAL_ERROR "glog-modules.cmake requires the consumer "
+ "to use CMake 3.3 (or newer)")
+endif (CMAKE_VERSION VERSION_LESS 3.3)
+
+set (glog_MODULE_PATH "@glog_FULL_CMake_DATADIR@")
+list (APPEND CMAKE_MODULE_PATH ${glog_MODULE_PATH})
+
+if (NOT glog_MODULE_PATH IN_LIST CMAKE_MODULE_PATH)
+ message (FATAL_ERROR "Cannot add '${glog_MODULE_PATH}' to "
+ "CMAKE_MODULE_PATH. This will cause glog-config.cmake to fail at "
+ "locating required find modules. Make sure CMAKE_MODULE_PATH is not a cache variable.")
+endif (NOT glog_MODULE_PATH IN_LIST CMAKE_MODULE_PATH)
+
+cmake_policy (POP)
diff --git a/funasr/runtime/onnxruntime/third_party/glog/libglog.pc.in b/funasr/runtime/onnxruntime/third_party/glog/libglog.pc.in
new file mode 100644
index 0000000..2303e2e
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/libglog.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libglog
+Description: Google Log (glog) C++ logging framework
+Version: @VERSION@
+Libs: -L${libdir} -lglog
+Libs.private: @glog_libraries_options_for_static_linking@
+Cflags: -I${includedir}
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/base/commandlineflags.h b/funasr/runtime/onnxruntime/third_party/glog/src/base/commandlineflags.h
new file mode 100644
index 0000000..c011df4
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/base/commandlineflags.h
@@ -0,0 +1,148 @@
+// Copyright (c) 2008, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// ---
+// This file is a compatibility layer that defines Google's version of
+// command line flags that are used for configuration.
+//
+// We put flags into their own namespace. It is purposefully
+// named in an opaque way that people should have trouble typing
+// directly. The idea is that DEFINE puts the flag in the weird
+// namespace, and DECLARE imports the flag from there into the
+// current namespace. The net result is to force people to use
+// DECLARE to get access to a flag, rather than saying
+// extern bool FLAGS_logtostderr;
+// or some such instead. We want this so we can put extra
+// functionality (like sanity-checking) in DECLARE if we want,
+// and make sure it is picked up everywhere.
+//
+// We also put the type of the variable in the namespace, so that
+// people can't DECLARE_int32 something that they DEFINE_bool'd
+// elsewhere.
+#ifndef BASE_COMMANDLINEFLAGS_H__
+#define BASE_COMMANDLINEFLAGS_H__
+
+#include "config.h"
+#include <cstdlib> // for getenv
+#include <cstring> // for memchr
+#include <string>
+
+#ifdef HAVE_LIB_GFLAGS
+
+#include <gflags/gflags.h>
+
+#else
+
+#include <glog/logging.h>
+
+#define DECLARE_VARIABLE(type, shorttype, name, tn) \
+ namespace fL##shorttype { \
+ extern GLOG_EXPORT type FLAGS_##name; \
+ } \
+ using fL##shorttype::FLAGS_##name
+#define DEFINE_VARIABLE(type, shorttype, name, value, meaning, tn) \
+ namespace fL##shorttype { \
+ GLOG_EXPORT type FLAGS_##name(value); \
+ char FLAGS_no##name; \
+ } \
+ using fL##shorttype::FLAGS_##name
+
+// bool specialization
+#define DECLARE_bool(name) \
+ DECLARE_VARIABLE(bool, B, name, bool)
+#define DEFINE_bool(name, value, meaning) \
+ DEFINE_VARIABLE(bool, B, name, value, meaning, bool)
+
+// int32 specialization
+#define DECLARE_int32(name) \
+ DECLARE_VARIABLE(GOOGLE_NAMESPACE::int32, I, name, int32)
+#define DEFINE_int32(name, value, meaning) \
+ DEFINE_VARIABLE(GOOGLE_NAMESPACE::int32, I, name, value, meaning, int32)
+
+// uint32 specialization
+#ifndef DECLARE_uint32
+#define DECLARE_uint32(name) \
+ DECLARE_VARIABLE(GOOGLE_NAMESPACE::uint32, U, name, uint32)
+#endif // DECLARE_uint64
+#define DEFINE_uint32(name, value, meaning) \
+ DEFINE_VARIABLE(GOOGLE_NAMESPACE::uint32, U, name, value, meaning, uint32)
+
+// Special case for string, because we have to specify the namespace
+// std::string, which doesn't play nicely with our FLAG__namespace hackery.
+#define DECLARE_string(name) \
+ namespace fLS { \
+ extern GLOG_EXPORT std::string& FLAGS_##name; \
+ } \
+ using fLS::FLAGS_##name
+#define DEFINE_string(name, value, meaning) \
+ namespace fLS { \
+ std::string FLAGS_##name##_buf(value); \
+ GLOG_EXPORT std::string& FLAGS_##name = FLAGS_##name##_buf; \
+ char FLAGS_no##name; \
+ } \
+ using fLS::FLAGS_##name
+
+#endif // HAVE_LIB_GFLAGS
+
+// Define GLOG_DEFINE_* using DEFINE_* . By using these macros, we
+// have GLOG_* environ variables even if we have gflags installed.
+//
+// If both an environment variable and a flag are specified, the value
+// specified by a flag wins. E.g., if GLOG_v=0 and --v=1, the
+// verbosity will be 1, not 0.
+
+#define GLOG_DEFINE_bool(name, value, meaning) \
+ DEFINE_bool(name, EnvToBool("GLOG_" #name, value), meaning)
+
+#define GLOG_DEFINE_int32(name, value, meaning) \
+ DEFINE_int32(name, EnvToInt("GLOG_" #name, value), meaning)
+
+#define GLOG_DEFINE_uint32(name, value, meaning) \
+ DEFINE_uint32(name, EnvToUInt("GLOG_" #name, value), meaning)
+
+#define GLOG_DEFINE_string(name, value, meaning) \
+ DEFINE_string(name, EnvToString("GLOG_" #name, value), meaning)
+
+// These macros (could be functions, but I don't want to bother with a .cc
+// file), make it easier to initialize flags from the environment.
+
+#define EnvToString(envname, dflt) \
+ (!getenv(envname) ? (dflt) : getenv(envname))
+
+#define EnvToBool(envname, dflt) \
+ (!getenv(envname) ? (dflt) \
+ : memchr("tTyY1\0", getenv(envname)[0], 6) != nullptr)
+
+#define EnvToInt(envname, dflt) \
+ (!getenv(envname) ? (dflt) : strtol(getenv(envname), nullptr, 10))
+
+#define EnvToUInt(envname, dflt) \
+ (!getenv(envname) ? (dflt) : strtoul(getenv(envname), nullptr, 10))
+
+#endif // BASE_COMMANDLINEFLAGS_H__
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/base/googleinit.h b/funasr/runtime/onnxruntime/third_party/glog/src/base/googleinit.h
new file mode 100644
index 0000000..b5f4436
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/base/googleinit.h
@@ -0,0 +1,51 @@
+// Copyright (c) 2008, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// ---
+// Author: Jacob Hoffman-Andrews
+
+#ifndef _GOOGLEINIT_H
+#define _GOOGLEINIT_H
+
+class GoogleInitializer {
+ public:
+ using void_function = void (*)();
+ GoogleInitializer(const char*, void_function f) {
+ f();
+ }
+};
+
+#define REGISTER_MODULE_INITIALIZER(name, body) \
+ namespace { \
+ static void google_init_module_##name () { body; } \
+ GoogleInitializer google_initializer_module_##name(#name, \
+ google_init_module_##name); \
+ }
+
+#endif /* _GOOGLEINIT_H */
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/base/mutex.h b/funasr/runtime/onnxruntime/third_party/glog/src/base/mutex.h
new file mode 100644
index 0000000..6d10df1
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/base/mutex.h
@@ -0,0 +1,333 @@
+// Copyright (c) 2007, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// ---
+// Author: Craig Silverstein.
+//
+// A simple mutex wrapper, supporting locks and read-write locks.
+// You should assume the locks are *not* re-entrant.
+//
+// To use: you should define the following macros in your configure.ac:
+// ACX_PTHREAD
+// AC_RWLOCK
+// The latter is defined in ../autoconf.
+//
+// This class is meant to be internal-only and should be wrapped by an
+// internal namespace. Before you use this module, please give the
+// name of your internal namespace for this module. Or, if you want
+// to expose it, you'll want to move it to the Google namespace. We
+// cannot put this class in global namespace because there can be some
+// problems when we have multiple versions of Mutex in each shared object.
+//
+// NOTE: by default, we have #ifdef'ed out the TryLock() method.
+// This is for two reasons:
+// 1) TryLock() under Windows is a bit annoying (it requires a
+// #define to be defined very early).
+// 2) TryLock() is broken for NO_THREADS mode, at least in NDEBUG
+// mode.
+// If you need TryLock(), and either these two caveats are not a
+// problem for you, or you're willing to work around them, then
+// feel free to #define GMUTEX_TRYLOCK, or to remove the #ifdefs
+// in the code below.
+//
+// CYGWIN NOTE: Cygwin support for rwlock seems to be buggy:
+// http://www.cygwin.com/ml/cygwin/2008-12/msg00017.html
+// Because of that, we might as well use windows locks for
+// cygwin. They seem to be more reliable than the cygwin pthreads layer.
+//
+// TRICKY IMPLEMENTATION NOTE:
+// This class is designed to be safe to use during
+// dynamic-initialization -- that is, by global constructors that are
+// run before main() starts. The issue in this case is that
+// dynamic-initialization happens in an unpredictable order, and it
+// could be that someone else's dynamic initializer could call a
+// function that tries to acquire this mutex -- but that all happens
+// before this mutex's constructor has run. (This can happen even if
+// the mutex and the function that uses the mutex are in the same .cc
+// file.) Basically, because Mutex does non-trivial work in its
+// constructor, it's not, in the naive implementation, safe to use
+// before dynamic initialization has run on it.
+//
+// The solution used here is to pair the actual mutex primitive with a
+// bool that is set to true when the mutex is dynamically initialized.
+// (Before that it's false.) Then we modify all mutex routines to
+// look at the bool, and not try to lock/unlock until the bool makes
+// it to true (which happens after the Mutex constructor has run.)
+//
+// This works because before main() starts -- particularly, during
+// dynamic initialization -- there are no threads, so a) it's ok that
+// the mutex operations are a no-op, since we don't need locking then
+// anyway; and b) we can be quite confident our bool won't change
+// state between a call to Lock() and a call to Unlock() (that would
+// require a global constructor in one translation unit to call Lock()
+// and another global constructor in another translation unit to call
+// Unlock() later, which is pretty perverse).
+//
+// That said, it's tricky, and can conceivably fail; it's safest to
+// avoid trying to acquire a mutex in a global constructor, if you
+// can. One way it can fail is that a really smart compiler might
+// initialize the bool to true at static-initialization time (too
+// early) rather than at dynamic-initialization time. To discourage
+// that, we set is_safe_ to true in code (not the constructor
+// colon-initializer) and set it to true via a function that always
+// evaluates to true, but that the compiler can't know always
+// evaluates to true. This should be good enough.
+
+#ifndef GOOGLE_MUTEX_H_
+#define GOOGLE_MUTEX_H_
+
+#include "config.h" // to figure out pthreads support
+
+#if defined(NO_THREADS)
+ typedef int MutexType; // to keep a lock-count
+#elif defined(_WIN32) || defined(__CYGWIN__)
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN // We only need minimal includes
+# endif
+# ifdef GMUTEX_TRYLOCK
+ // We need Windows NT or later for TryEnterCriticalSection(). If you
+ // don't need that functionality, you can remove these _WIN32_WINNT
+ // lines, and change TryLock() to assert(0) or something.
+# ifndef _WIN32_WINNT
+# define _WIN32_WINNT 0x0400
+# endif
+# endif
+// To avoid macro definition of ERROR.
+# ifndef NOGDI
+# define NOGDI
+# endif
+// To avoid macro definition of min/max.
+# ifndef NOMINMAX
+# define NOMINMAX
+# endif
+# include <windows.h>
+ typedef CRITICAL_SECTION MutexType;
+#elif defined(HAVE_PTHREAD) && defined(HAVE_RWLOCK)
+ // Needed for pthread_rwlock_*. If it causes problems, you could take it
+ // out, but then you'd have to unset HAVE_RWLOCK (at least on linux -- it
+ // *does* cause problems for FreeBSD, or MacOSX, but isn't needed
+ // for locking there.)
+# ifdef __linux__
+# ifndef _XOPEN_SOURCE // Some other header might have already set it for us.
+# define _XOPEN_SOURCE 500 // may be needed to get the rwlock calls
+# endif
+# endif
+# include <pthread.h>
+using MutexType = pthread_rwlock_t;
+#elif defined(HAVE_PTHREAD)
+# include <pthread.h>
+ typedef pthread_mutex_t MutexType;
+#else
+# error Need to implement mutex.h for your architecture, or #define NO_THREADS
+#endif
+
+// We need to include these header files after defining _XOPEN_SOURCE
+// as they may define the _XOPEN_SOURCE macro.
+#include <cassert>
+#include <cstdlib> // for abort()
+
+#define MUTEX_NAMESPACE glog_internal_namespace_
+
+namespace MUTEX_NAMESPACE {
+
+class Mutex {
+ public:
+ // Create a Mutex that is not held by anybody. This constructor is
+ // typically used for Mutexes allocated on the heap or the stack.
+ // See below for a recommendation for constructing global Mutex
+ // objects.
+ inline Mutex();
+
+ // Destructor
+ inline ~Mutex();
+
+ inline void Lock(); // Block if needed until free then acquire exclusively
+ inline void Unlock(); // Release a lock acquired via Lock()
+#ifdef GMUTEX_TRYLOCK
+ inline bool TryLock(); // If free, Lock() and return true, else return false
+#endif
+ // Note that on systems that don't support read-write locks, these may
+ // be implemented as synonyms to Lock() and Unlock(). So you can use
+ // these for efficiency, but don't use them anyplace where being able
+ // to do shared reads is necessary to avoid deadlock.
+ inline void ReaderLock(); // Block until free or shared then acquire a share
+ inline void ReaderUnlock(); // Release a read share of this Mutex
+ inline void WriterLock() { Lock(); } // Acquire an exclusive lock
+ inline void WriterUnlock() { Unlock(); } // Release a lock from WriterLock()
+
+ // TODO(hamaji): Do nothing, implement correctly.
+ inline void AssertHeld() {}
+
+ private:
+ MutexType mutex_;
+ // We want to make sure that the compiler sets is_safe_ to true only
+ // when we tell it to, and never makes assumptions is_safe_ is
+ // always true. volatile is the most reliable way to do that.
+ volatile bool is_safe_;
+
+ inline void SetIsSafe() { is_safe_ = true; }
+
+ // Catch the error of writing Mutex when intending MutexLock.
+ explicit Mutex(Mutex * /*ignored*/) {}
+ // Disallow "evil" constructors
+ Mutex(const Mutex &) = delete;
+ void operator=(const Mutex &) = delete;
+};
+
+// Now the implementation of Mutex for various systems
+#if defined(NO_THREADS)
+
+// When we don't have threads, we can be either reading or writing,
+// but not both. We can have lots of readers at once (in no-threads
+// mode, that's most likely to happen in recursive function calls),
+// but only one writer. We represent this by having mutex_ be -1 when
+// writing and a number > 0 when reading (and 0 when no lock is held).
+//
+// In debug mode, we assert these invariants, while in non-debug mode
+// we do nothing, for efficiency. That's why everything is in an
+// assert.
+
+Mutex::Mutex() : mutex_(0) { }
+Mutex::~Mutex() { assert(mutex_ == 0); }
+void Mutex::Lock() { assert(--mutex_ == -1); }
+void Mutex::Unlock() { assert(mutex_++ == -1); }
+#ifdef GMUTEX_TRYLOCK
+bool Mutex::TryLock() { if (mutex_) return false; Lock(); return true; }
+#endif
+void Mutex::ReaderLock() { assert(++mutex_ > 0); }
+void Mutex::ReaderUnlock() { assert(mutex_-- > 0); }
+
+#elif defined(_WIN32) || defined(__CYGWIN__)
+
+Mutex::Mutex() { InitializeCriticalSection(&mutex_); SetIsSafe(); }
+Mutex::~Mutex() { DeleteCriticalSection(&mutex_); }
+void Mutex::Lock() { if (is_safe_) EnterCriticalSection(&mutex_); }
+void Mutex::Unlock() { if (is_safe_) LeaveCriticalSection(&mutex_); }
+#ifdef GMUTEX_TRYLOCK
+bool Mutex::TryLock() { return is_safe_ ?
+ TryEnterCriticalSection(&mutex_) != 0 : true; }
+#endif
+void Mutex::ReaderLock() { Lock(); } // we don't have read-write locks
+void Mutex::ReaderUnlock() { Unlock(); }
+
+#elif defined(HAVE_PTHREAD) && defined(HAVE_RWLOCK)
+
+#define SAFE_PTHREAD(fncall) do { /* run fncall if is_safe_ is true */ \
+ if (is_safe_ && fncall(&mutex_) != 0) abort(); \
+} while (0)
+
+Mutex::Mutex() {
+ SetIsSafe();
+ if (is_safe_ && pthread_rwlock_init(&mutex_, nullptr) != 0) abort();
+}
+Mutex::~Mutex() { SAFE_PTHREAD(pthread_rwlock_destroy); }
+void Mutex::Lock() { SAFE_PTHREAD(pthread_rwlock_wrlock); }
+void Mutex::Unlock() { SAFE_PTHREAD(pthread_rwlock_unlock); }
+#ifdef GMUTEX_TRYLOCK
+bool Mutex::TryLock() { return is_safe_ ?
+ pthread_rwlock_trywrlock(&mutex_) == 0 :
+ true; }
+#endif
+void Mutex::ReaderLock() { SAFE_PTHREAD(pthread_rwlock_rdlock); }
+void Mutex::ReaderUnlock() { SAFE_PTHREAD(pthread_rwlock_unlock); }
+#undef SAFE_PTHREAD
+
+#elif defined(HAVE_PTHREAD)
+
+#define SAFE_PTHREAD(fncall) do { /* run fncall if is_safe_ is true */ \
+ if (is_safe_ && fncall(&mutex_) != 0) abort(); \
+} while (0)
+
+Mutex::Mutex() {
+ SetIsSafe();
+ if (is_safe_ && pthread_mutex_init(&mutex_, nullptr) != 0) abort();
+}
+Mutex::~Mutex() { SAFE_PTHREAD(pthread_mutex_destroy); }
+void Mutex::Lock() { SAFE_PTHREAD(pthread_mutex_lock); }
+void Mutex::Unlock() { SAFE_PTHREAD(pthread_mutex_unlock); }
+#ifdef GMUTEX_TRYLOCK
+bool Mutex::TryLock() { return is_safe_ ?
+ pthread_mutex_trylock(&mutex_) == 0 : true; }
+#endif
+void Mutex::ReaderLock() { Lock(); }
+void Mutex::ReaderUnlock() { Unlock(); }
+#undef SAFE_PTHREAD
+
+#endif
+
+// --------------------------------------------------------------------------
+// Some helper classes
+
+// MutexLock(mu) acquires mu when constructed and releases it when destroyed.
+class MutexLock {
+ public:
+ explicit MutexLock(Mutex *mu) : mu_(mu) { mu_->Lock(); }
+ ~MutexLock() { mu_->Unlock(); }
+ private:
+ Mutex * const mu_;
+ // Disallow "evil" constructors
+ MutexLock(const MutexLock &) = delete;
+ void operator=(const MutexLock &) = delete;
+};
+
+// ReaderMutexLock and WriterMutexLock do the same, for rwlocks
+class ReaderMutexLock {
+ public:
+ explicit ReaderMutexLock(Mutex *mu) : mu_(mu) { mu_->ReaderLock(); }
+ ~ReaderMutexLock() { mu_->ReaderUnlock(); }
+ private:
+ Mutex * const mu_;
+ // Disallow "evil" constructors
+ ReaderMutexLock(const ReaderMutexLock &) = delete;
+ void operator=(const ReaderMutexLock &) = delete;
+};
+
+class WriterMutexLock {
+ public:
+ explicit WriterMutexLock(Mutex *mu) : mu_(mu) { mu_->WriterLock(); }
+ ~WriterMutexLock() { mu_->WriterUnlock(); }
+ private:
+ Mutex * const mu_;
+ // Disallow "evil" constructors
+ WriterMutexLock(const WriterMutexLock &) = delete;
+ void operator=(const WriterMutexLock &) = delete;
+};
+
+// Catch bug where variable name is omitted, e.g. MutexLock (&mu);
+#define MutexLock(x) COMPILE_ASSERT(0, mutex_lock_decl_missing_var_name)
+#define ReaderMutexLock(x) COMPILE_ASSERT(0, rmutex_lock_decl_missing_var_name)
+#define WriterMutexLock(x) COMPILE_ASSERT(0, wmutex_lock_decl_missing_var_name)
+
+} // namespace MUTEX_NAMESPACE
+
+using namespace MUTEX_NAMESPACE;
+
+#undef MUTEX_NAMESPACE
+
+#endif /* #define GOOGLE_MUTEX_H__ */
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/cleanup_immediately_unittest.cc b/funasr/runtime/onnxruntime/third_party/glog/src/cleanup_immediately_unittest.cc
new file mode 100644
index 0000000..686d193
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/cleanup_immediately_unittest.cc
@@ -0,0 +1,96 @@
+// Copyright (c) 2021, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include <glog/logging.h>
+#include <glog/raw_logging.h>
+
+#include "base/commandlineflags.h"
+#include "googletest.h"
+
+#ifdef HAVE_LIB_GFLAGS
+#include <gflags/gflags.h>
+using namespace GFLAGS_NAMESPACE;
+#endif
+
+#ifdef HAVE_LIB_GMOCK
+#include <gmock/gmock.h>
+
+#include "mock-log.h"
+// Introduce several symbols from gmock.
+using GOOGLE_NAMESPACE::glog_testing::ScopedMockLog;
+using testing::_;
+using testing::AllOf;
+using testing::AnyNumber;
+using testing::HasSubstr;
+using testing::InitGoogleMock;
+using testing::StrictMock;
+using testing::StrNe;
+#endif
+
+using namespace GOOGLE_NAMESPACE;
+
+TEST(CleanImmediately, logging) {
+ google::SetLogFilenameExtension(".foobar");
+ google::EnableLogCleaner(0);
+
+ for (unsigned i = 0; i < 1000; ++i) {
+ LOG(INFO) << "cleanup test";
+ }
+
+ google::DisableLogCleaner();
+}
+
+int main(int argc, char **argv) {
+ FLAGS_colorlogtostderr = false;
+ FLAGS_timestamp_in_logfile_name = true;
+#ifdef HAVE_LIB_GFLAGS
+ ParseCommandLineFlags(&argc, &argv, true);
+#endif
+ // Make sure stderr is not buffered as stderr seems to be buffered
+ // on recent windows.
+ setbuf(stderr, nullptr);
+
+ // Test some basics before InitGoogleLogging:
+ CaptureTestStderr();
+ const string early_stderr = GetCapturedTestStderr();
+
+ EXPECT_FALSE(IsGoogleLoggingInitialized());
+
+ InitGoogleLogging(argv[0]);
+
+ EXPECT_TRUE(IsGoogleLoggingInitialized());
+
+ InitGoogleTest(&argc, argv);
+#ifdef HAVE_LIB_GMOCK
+ InitGoogleMock(&argc, argv);
+#endif
+
+ // so that death tests run before we use threads
+ CHECK_EQ(RUN_ALL_TESTS(), 0);
+}
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/cleanup_with_absolute_prefix_unittest.cc b/funasr/runtime/onnxruntime/third_party/glog/src/cleanup_with_absolute_prefix_unittest.cc
new file mode 100644
index 0000000..95c4baf
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/cleanup_with_absolute_prefix_unittest.cc
@@ -0,0 +1,101 @@
+// Copyright (c) 2021, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include <glog/logging.h>
+#include <glog/raw_logging.h>
+
+#include "base/commandlineflags.h"
+#include "googletest.h"
+
+#ifdef HAVE_LIB_GFLAGS
+#include <gflags/gflags.h>
+using namespace GFLAGS_NAMESPACE;
+#endif
+
+#ifdef HAVE_LIB_GMOCK
+#include <gmock/gmock.h>
+
+#include "mock-log.h"
+// Introduce several symbols from gmock.
+using GOOGLE_NAMESPACE::glog_testing::ScopedMockLog;
+using testing::_;
+using testing::AllOf;
+using testing::AnyNumber;
+using testing::HasSubstr;
+using testing::InitGoogleMock;
+using testing::StrictMock;
+using testing::StrNe;
+#endif
+
+using namespace GOOGLE_NAMESPACE;
+
+TEST(CleanImmediatelyWithAbsolutePrefix, logging) {
+ google::EnableLogCleaner(0);
+ google::SetLogFilenameExtension(".barfoo");
+ google::SetLogDestination(GLOG_INFO, "test_cleanup_");
+
+ for (unsigned i = 0; i < 1000; ++i) {
+ LOG(INFO) << "cleanup test";
+ }
+
+ for (unsigned i = 0; i < 10; ++i) {
+ LOG(ERROR) << "cleanup test";
+ }
+
+ google::DisableLogCleaner();
+}
+
+int main(int argc, char **argv) {
+ FLAGS_colorlogtostderr = false;
+ FLAGS_timestamp_in_logfile_name = true;
+#ifdef HAVE_LIB_GFLAGS
+ ParseCommandLineFlags(&argc, &argv, true);
+#endif
+ // Make sure stderr is not buffered as stderr seems to be buffered
+ // on recent windows.
+ setbuf(stderr, nullptr);
+
+ // Test some basics before InitGoogleLogging:
+ CaptureTestStderr();
+ const string early_stderr = GetCapturedTestStderr();
+
+ EXPECT_FALSE(IsGoogleLoggingInitialized());
+
+ InitGoogleLogging(argv[0]);
+
+ EXPECT_TRUE(IsGoogleLoggingInitialized());
+
+ InitGoogleTest(&argc, argv);
+#ifdef HAVE_LIB_GMOCK
+ InitGoogleMock(&argc, argv);
+#endif
+
+ // so that death tests run before we use threads
+ CHECK_EQ(RUN_ALL_TESTS(), 0);
+}
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/cleanup_with_relative_prefix_unittest.cc b/funasr/runtime/onnxruntime/third_party/glog/src/cleanup_with_relative_prefix_unittest.cc
new file mode 100644
index 0000000..0cee085
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/cleanup_with_relative_prefix_unittest.cc
@@ -0,0 +1,97 @@
+// Copyright (c) 2021, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include <glog/logging.h>
+#include <glog/raw_logging.h>
+
+#include "base/commandlineflags.h"
+#include "googletest.h"
+
+#ifdef HAVE_LIB_GFLAGS
+#include <gflags/gflags.h>
+using namespace GFLAGS_NAMESPACE;
+#endif
+
+#ifdef HAVE_LIB_GMOCK
+#include <gmock/gmock.h>
+
+#include "mock-log.h"
+// Introduce several symbols from gmock.
+using GOOGLE_NAMESPACE::glog_testing::ScopedMockLog;
+using testing::_;
+using testing::AllOf;
+using testing::AnyNumber;
+using testing::HasSubstr;
+using testing::InitGoogleMock;
+using testing::StrictMock;
+using testing::StrNe;
+#endif
+
+using namespace GOOGLE_NAMESPACE;
+
+TEST(CleanImmediatelyWithRelativePrefix, logging) {
+ google::EnableLogCleaner(0);
+ google::SetLogFilenameExtension(".relativefoo");
+ google::SetLogDestination(GLOG_INFO, "test_subdir/test_cleanup_");
+
+ for (unsigned i = 0; i < 1000; ++i) {
+ LOG(INFO) << "cleanup test";
+ }
+
+ google::DisableLogCleaner();
+}
+
+int main(int argc, char **argv) {
+ FLAGS_colorlogtostderr = false;
+ FLAGS_timestamp_in_logfile_name = true;
+#ifdef HAVE_LIB_GFLAGS
+ ParseCommandLineFlags(&argc, &argv, true);
+#endif
+ // Make sure stderr is not buffered as stderr seems to be buffered
+ // on recent windows.
+ setbuf(stderr, nullptr);
+
+ // Test some basics before InitGoogleLogging:
+ CaptureTestStderr();
+ const string early_stderr = GetCapturedTestStderr();
+
+ EXPECT_FALSE(IsGoogleLoggingInitialized());
+
+ InitGoogleLogging(argv[0]);
+
+ EXPECT_TRUE(IsGoogleLoggingInitialized());
+
+ InitGoogleTest(&argc, argv);
+#ifdef HAVE_LIB_GMOCK
+ InitGoogleMock(&argc, argv);
+#endif
+
+ // so that death tests run before we use threads
+ CHECK_EQ(RUN_ALL_TESTS(), 0);
+}
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/config.h.cmake.in b/funasr/runtime/onnxruntime/third_party/glog/src/config.h.cmake.in
new file mode 100644
index 0000000..9d61010
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/config.h.cmake.in
@@ -0,0 +1,177 @@
+#ifndef GLOG_CONFIG_H
+#define GLOG_CONFIG_H
+
+/* Namespace for Google classes */
+#cmakedefine GOOGLE_NAMESPACE ${GOOGLE_NAMESPACE}
+
+/* Define if you have the `dladdr' function */
+#cmakedefine HAVE_DLADDR
+
+/* Define if you have the `snprintf' function */
+#cmakedefine HAVE_SNPRINTF
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#cmakedefine HAVE_DLFCN_H
+
+/* Define if you have the `backtrace' function in <execinfo.h> */
+#cmakedefine HAVE_EXECINFO_BACKTRACE
+
+/* Define if you have the `backtrace_symbols' function in <execinfo.h> */
+#cmakedefine HAVE_EXECINFO_BACKTRACE_SYMBOLS
+
+/* Define if you have the `fcntl' function */
+#cmakedefine HAVE_FCNTL
+
+/* Define to 1 if you have the <glob.h> header file. */
+#cmakedefine HAVE_GLOB_H
+
+/* Define to 1 if you have the `pthread' library (-lpthread). */
+#cmakedefine HAVE_LIBPTHREAD
+
+/* define if you have google gflags library */
+#cmakedefine HAVE_LIB_GFLAGS
+
+/* define if you have google gmock library */
+#cmakedefine HAVE_LIB_GMOCK
+
+/* define if you have google gtest library */
+#cmakedefine HAVE_LIB_GTEST
+
+/* define if you have dbghelp library */
+#cmakedefine HAVE_DBGHELP
+
+/* define if you have libunwind */
+#cmakedefine HAVE_LIB_UNWIND
+
+/* Define to 1 if you have the <memory.h> header file. */
+#cmakedefine HAVE_MEMORY_H
+
+/* define to disable multithreading support. */
+#cmakedefine NO_THREADS
+
+/* Define if you have the 'pread' function */
+#cmakedefine HAVE_PREAD
+
+/* Define if you have POSIX threads libraries and header files. */
+#cmakedefine HAVE_PTHREAD
+
+/* Define to 1 if you have the <pwd.h> header file. */
+#cmakedefine HAVE_PWD_H
+
+/* Define if you have the 'pwrite' function */
+#cmakedefine HAVE_PWRITE
+
+/* define if the compiler implements pthread_rwlock_* */
+#cmakedefine HAVE_RWLOCK
+
+/* Define if you have the 'sigaction' function */
+#cmakedefine HAVE_SIGACTION
+
+/* Define if you have the `sigaltstack' function */
+#cmakedefine HAVE_SIGALTSTACK
+
+/* Define to 1 if you have the <strings.h> header file. */
+#cmakedefine HAVE_STRINGS_H
+
+/* Define to 1 if you have the <syscall.h> header file. */
+#cmakedefine HAVE_SYSCALL_H
+
+/* Define to 1 if you have the <syslog.h> header file. */
+#cmakedefine HAVE_SYSLOG_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#cmakedefine HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/syscall.h> header file. */
+#cmakedefine HAVE_SYS_SYSCALL_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#cmakedefine HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#cmakedefine HAVE_SYS_TYPES_H ${HAVE_SYS_TYPES_H}
+
+/* Define to 1 if you have the <sys/ucontext.h> header file. */
+#cmakedefine HAVE_SYS_UCONTEXT_H
+
+/* Define to 1 if you have the <sys/utsname.h> header file. */
+#cmakedefine HAVE_SYS_UTSNAME_H
+
+/* Define to 1 if you have the <sys/wait.h> header file. */
+#cmakedefine HAVE_SYS_WAIT_H
+
+/* Define to 1 if you have the <ucontext.h> header file. */
+#cmakedefine HAVE_UCONTEXT_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#cmakedefine HAVE_UNISTD_H ${HAVE_UNISTD_H}
+
+/* Define if you linking to _Unwind_Backtrace is possible. */
+#cmakedefine HAVE__UNWIND_BACKTRACE
+
+/* Define if you linking to _Unwind_GetIP is possible. */
+#cmakedefine HAVE__UNWIND_GETIP
+
+/* define if your compiler has __attribute__ */
+#cmakedefine HAVE___ATTRIBUTE__
+
+/* define if your compiler has __builtin_expect */
+#cmakedefine HAVE___BUILTIN_EXPECT ${HAVE___BUILTIN_EXPECT}
+
+/* define if your compiler has __sync_val_compare_and_swap */
+#cmakedefine HAVE___SYNC_VAL_COMPARE_AND_SWAP
+
+/* define if symbolize support is available */
+#cmakedefine HAVE_SYMBOLIZE
+
+/* define if localtime_r is available in time.h */
+#cmakedefine HAVE_LOCALTIME_R
+
+/* define if gmtime_r is available in time.h */
+#cmakedefine HAVE_GMTIME_R
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#cmakedefine LT_OBJDIR
+
+/* How to access the PC from a struct ucontext */
+#cmakedefine PC_FROM_UCONTEXT
+
+/* define if we should print file offsets in traces instead of symbolizing. */
+#cmakedefine PRINT_UNSYMBOLIZED_STACK_TRACES
+
+/* Define to necessary symbol if this constant uses a non-standard name on
+ your system. */
+#cmakedefine PTHREAD_CREATE_JOINABLE
+
+/* The size of `void *', as computed by sizeof. */
+#cmakedefine SIZEOF_VOID_P ${SIZEOF_VOID_P}
+
+/* location of source code */
+#cmakedefine TEST_SRC_DIR ${TEST_SRC_DIR}
+
+/* Define if thread-local storage is enabled. */
+#cmakedefine GLOG_THREAD_LOCAL_STORAGE
+
+#ifdef GLOG_BAZEL_BUILD
+
+/* TODO(rodrigoq): remove this workaround once bazel#3979 is resolved:
+ * https://github.com/bazelbuild/bazel/issues/3979 */
+#define _START_GOOGLE_NAMESPACE_ namespace GOOGLE_NAMESPACE {
+
+#define _END_GOOGLE_NAMESPACE_ }
+
+#else
+
+/* Stops putting the code inside the Google namespace */
+#cmakedefine _END_GOOGLE_NAMESPACE_ ${_END_GOOGLE_NAMESPACE_}
+
+/* Puts following code inside the Google namespace */
+#cmakedefine _START_GOOGLE_NAMESPACE_ ${_START_GOOGLE_NAMESPACE_}
+
+#endif
+
+/* Replacement for deprecated syscall(SYS_gettid) on macOS. */
+#cmakedefine HAVE_PTHREAD_THREADID_NP ${HAVE_PTHREAD_THREADID_NP}
+
+#endif // GLOG_CONFIG_H
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/demangle.cc b/funasr/runtime/onnxruntime/third_party/glog/src/demangle.cc
new file mode 100644
index 0000000..b19d446
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/demangle.cc
@@ -0,0 +1,1310 @@
+// Copyright (c) 2006, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Satoru Takabayashi
+//
+// For reference check out:
+// http://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling
+//
+// Note that we only have partial C++0x support yet.
+
+#include "demangle.h"
+
+#include <cstdio> // for nullptr
+
+#include "utilities.h"
+
+#if defined(GLOG_OS_WINDOWS)
+#include <dbghelp.h>
+#endif
+
+_START_GOOGLE_NAMESPACE_
+
+#if !defined(GLOG_OS_WINDOWS)
+struct AbbrevPair {
+ const char *abbrev;
+ const char *real_name;
+};
+
+// List of operators from Itanium C++ ABI.
+static const AbbrevPair kOperatorList[] = {
+ {"nw", "new"}, {"na", "new[]"}, {"dl", "delete"}, {"da", "delete[]"},
+ {"ps", "+"}, {"ng", "-"}, {"ad", "&"}, {"de", "*"},
+ {"co", "~"}, {"pl", "+"}, {"mi", "-"}, {"ml", "*"},
+ {"dv", "/"}, {"rm", "%"}, {"an", "&"}, {"or", "|"},
+ {"eo", "^"}, {"aS", "="}, {"pL", "+="}, {"mI", "-="},
+ {"mL", "*="}, {"dV", "/="}, {"rM", "%="}, {"aN", "&="},
+ {"oR", "|="}, {"eO", "^="}, {"ls", "<<"}, {"rs", ">>"},
+ {"lS", "<<="}, {"rS", ">>="}, {"eq", "=="}, {"ne", "!="},
+ {"lt", "<"}, {"gt", ">"}, {"le", "<="}, {"ge", ">="},
+ {"nt", "!"}, {"aa", "&&"}, {"oo", "||"}, {"pp", "++"},
+ {"mm", "--"}, {"cm", ","}, {"pm", "->*"}, {"pt", "->"},
+ {"cl", "()"}, {"ix", "[]"}, {"qu", "?"}, {"st", "sizeof"},
+ {"sz", "sizeof"}, {nullptr, nullptr},
+};
+
+// List of builtin types from Itanium C++ ABI.
+static const AbbrevPair kBuiltinTypeList[] = {
+ {"v", "void"}, {"w", "wchar_t"},
+ {"b", "bool"}, {"c", "char"},
+ {"a", "signed char"}, {"h", "unsigned char"},
+ {"s", "short"}, {"t", "unsigned short"},
+ {"i", "int"}, {"j", "unsigned int"},
+ {"l", "long"}, {"m", "unsigned long"},
+ {"x", "long long"}, {"y", "unsigned long long"},
+ {"n", "__int128"}, {"o", "unsigned __int128"},
+ {"f", "float"}, {"d", "double"},
+ {"e", "long double"}, {"g", "__float128"},
+ {"z", "ellipsis"}, {nullptr, nullptr}};
+
+// List of substitutions Itanium C++ ABI.
+static const AbbrevPair kSubstitutionList[] = {
+ {"St", ""},
+ {"Sa", "allocator"},
+ {"Sb", "basic_string"},
+ // std::basic_string<char, std::char_traits<char>,std::allocator<char> >
+ {"Ss", "string"},
+ // std::basic_istream<char, std::char_traits<char> >
+ {"Si", "istream"},
+ // std::basic_ostream<char, std::char_traits<char> >
+ {"So", "ostream"},
+ // std::basic_iostream<char, std::char_traits<char> >
+ {"Sd", "iostream"},
+ {nullptr, nullptr}};
+
+// State needed for demangling.
+struct State {
+ const char *mangled_cur; // Cursor of mangled name.
+ char *out_cur; // Cursor of output string.
+ const char *out_begin; // Beginning of output string.
+ const char *out_end; // End of output string.
+ const char *prev_name; // For constructors/destructors.
+ ssize_t prev_name_length; // For constructors/destructors.
+ short nest_level; // For nested names.
+ bool append; // Append flag.
+ bool overflowed; // True if output gets overflowed.
+};
+
+// We don't use strlen() in libc since it's not guaranteed to be async
+// signal safe.
+static size_t StrLen(const char *str) {
+ size_t len = 0;
+ while (*str != '\0') {
+ ++str;
+ ++len;
+ }
+ return len;
+}
+
+// Returns true if "str" has at least "n" characters remaining.
+static bool AtLeastNumCharsRemaining(const char *str, ssize_t n) {
+ for (ssize_t i = 0; i < n; ++i) {
+ if (str[i] == '\0') {
+ return false;
+ }
+ }
+ return true;
+}
+
+// Returns true if "str" has "prefix" as a prefix.
+static bool StrPrefix(const char *str, const char *prefix) {
+ size_t i = 0;
+ while (str[i] != '\0' && prefix[i] != '\0' &&
+ str[i] == prefix[i]) {
+ ++i;
+ }
+ return prefix[i] == '\0'; // Consumed everything in "prefix".
+}
+
+static void InitState(State *state, const char *mangled,
+ char *out, size_t out_size) {
+ state->mangled_cur = mangled;
+ state->out_cur = out;
+ state->out_begin = out;
+ state->out_end = out + out_size;
+ state->prev_name = nullptr;
+ state->prev_name_length = -1;
+ state->nest_level = -1;
+ state->append = true;
+ state->overflowed = false;
+}
+
+// Returns true and advances "mangled_cur" if we find "one_char_token"
+// at "mangled_cur" position. It is assumed that "one_char_token" does
+// not contain '\0'.
+static bool ParseOneCharToken(State *state, const char one_char_token) {
+ if (state->mangled_cur[0] == one_char_token) {
+ ++state->mangled_cur;
+ return true;
+ }
+ return false;
+}
+
+// Returns true and advances "mangled_cur" if we find "two_char_token"
+// at "mangled_cur" position. It is assumed that "two_char_token" does
+// not contain '\0'.
+static bool ParseTwoCharToken(State *state, const char *two_char_token) {
+ if (state->mangled_cur[0] == two_char_token[0] &&
+ state->mangled_cur[1] == two_char_token[1]) {
+ state->mangled_cur += 2;
+ return true;
+ }
+ return false;
+}
+
+// Returns true and advances "mangled_cur" if we find any character in
+// "char_class" at "mangled_cur" position.
+static bool ParseCharClass(State *state, const char *char_class) {
+ const char *p = char_class;
+ for (; *p != '\0'; ++p) {
+ if (state->mangled_cur[0] == *p) {
+ ++state->mangled_cur;
+ return true;
+ }
+ }
+ return false;
+}
+
+// This function is used for handling an optional non-terminal.
+static bool Optional(bool) {
+ return true;
+}
+
+// This function is used for handling <non-terminal>+ syntax.
+using ParseFunc = bool (*)(State *);
+static bool OneOrMore(ParseFunc parse_func, State *state) {
+ if (parse_func(state)) {
+ while (parse_func(state)) {
+ }
+ return true;
+ }
+ return false;
+}
+
+// This function is used for handling <non-terminal>* syntax. The function
+// always returns true and must be followed by a termination token or a
+// terminating sequence not handled by parse_func (e.g.
+// ParseOneCharToken(state, 'E')).
+static bool ZeroOrMore(ParseFunc parse_func, State *state) {
+ while (parse_func(state)) {
+ }
+ return true;
+}
+
+// Append "str" at "out_cur". If there is an overflow, "overflowed"
+// is set to true for later use. The output string is ensured to
+// always terminate with '\0' as long as there is no overflow.
+static void Append(State *state, const char * const str, ssize_t length) {
+ for (ssize_t i = 0; i < length; ++i) {
+ if (state->out_cur + 1 < state->out_end) { // +1 for '\0'
+ *state->out_cur = str[i];
+ ++state->out_cur;
+ } else {
+ state->overflowed = true;
+ break;
+ }
+ }
+ if (!state->overflowed) {
+ *state->out_cur = '\0'; // Terminate it with '\0'
+ }
+}
+
+// We don't use equivalents in libc to avoid locale issues.
+static bool IsLower(char c) {
+ return c >= 'a' && c <= 'z';
+}
+
+static bool IsAlpha(char c) {
+ return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
+}
+
+static bool IsDigit(char c) {
+ return c >= '0' && c <= '9';
+}
+
+// Returns true if "str" is a function clone suffix. These suffixes are used
+// by GCC 4.5.x and later versions to indicate functions which have been
+// cloned during optimization. We treat any sequence (.<alpha>+.<digit>+)+ as
+// a function clone suffix.
+static bool IsFunctionCloneSuffix(const char *str) {
+ size_t i = 0;
+ while (str[i] != '\0') {
+ // Consume a single .<alpha>+.<digit>+ sequence.
+ if (str[i] != '.' || !IsAlpha(str[i + 1])) {
+ return false;
+ }
+ i += 2;
+ while (IsAlpha(str[i])) {
+ ++i;
+ }
+ if (str[i] != '.' || !IsDigit(str[i + 1])) {
+ return false;
+ }
+ i += 2;
+ while (IsDigit(str[i])) {
+ ++i;
+ }
+ }
+ return true; // Consumed everything in "str".
+}
+
+// Append "str" with some tweaks, iff "append" state is true.
+// Returns true so that it can be placed in "if" conditions.
+static void MaybeAppendWithLength(State *state, const char * const str,
+ ssize_t length) {
+ if (state->append && length > 0) {
+ // Append a space if the output buffer ends with '<' and "str"
+ // starts with '<' to avoid <<<.
+ if (str[0] == '<' && state->out_begin < state->out_cur &&
+ state->out_cur[-1] == '<') {
+ Append(state, " ", 1);
+ }
+ // Remember the last identifier name for ctors/dtors.
+ if (IsAlpha(str[0]) || str[0] == '_') {
+ state->prev_name = state->out_cur;
+ state->prev_name_length = length;
+ }
+ Append(state, str, length);
+ }
+}
+
+// A convenient wrapper arount MaybeAppendWithLength().
+static bool MaybeAppend(State *state, const char * const str) {
+ if (state->append) {
+ size_t length = StrLen(str);
+ MaybeAppendWithLength(state, str, static_cast<ssize_t>(length));
+ }
+ return true;
+}
+
+// This function is used for handling nested names.
+static bool EnterNestedName(State *state) {
+ state->nest_level = 0;
+ return true;
+}
+
+// This function is used for handling nested names.
+static bool LeaveNestedName(State *state, short prev_value) {
+ state->nest_level = prev_value;
+ return true;
+}
+
+// Disable the append mode not to print function parameters, etc.
+static bool DisableAppend(State *state) {
+ state->append = false;
+ return true;
+}
+
+// Restore the append mode to the previous state.
+static bool RestoreAppend(State *state, bool prev_value) {
+ state->append = prev_value;
+ return true;
+}
+
+// Increase the nest level for nested names.
+static void MaybeIncreaseNestLevel(State *state) {
+ if (state->nest_level > -1) {
+ ++state->nest_level;
+ }
+}
+
+// Appends :: for nested names if necessary.
+static void MaybeAppendSeparator(State *state) {
+ if (state->nest_level >= 1) {
+ MaybeAppend(state, "::");
+ }
+}
+
+// Cancel the last separator if necessary.
+static void MaybeCancelLastSeparator(State *state) {
+ if (state->nest_level >= 1 && state->append &&
+ state->out_begin <= state->out_cur - 2) {
+ state->out_cur -= 2;
+ *state->out_cur = '\0';
+ }
+}
+
+// Returns true if the identifier of the given length pointed to by
+// "mangled_cur" is anonymous namespace.
+static bool IdentifierIsAnonymousNamespace(State *state, ssize_t length) {
+ static const char anon_prefix[] = "_GLOBAL__N_";
+ return (length > static_cast<ssize_t>(sizeof(anon_prefix)) -
+ 1 && // Should be longer.
+ StrPrefix(state->mangled_cur, anon_prefix));
+}
+
+// Forward declarations of our parsing functions.
+static bool ParseMangledName(State *state);
+static bool ParseEncoding(State *state);
+static bool ParseName(State *state);
+static bool ParseUnscopedName(State *state);
+static bool ParseUnscopedTemplateName(State *state);
+static bool ParseNestedName(State *state);
+static bool ParsePrefix(State *state);
+static bool ParseUnqualifiedName(State *state);
+static bool ParseSourceName(State *state);
+static bool ParseLocalSourceName(State *state);
+static bool ParseNumber(State *state, int *number_out);
+static bool ParseFloatNumber(State *state);
+static bool ParseSeqId(State *state);
+static bool ParseIdentifier(State *state, ssize_t length);
+static bool ParseAbiTags(State *state);
+static bool ParseAbiTag(State *state);
+static bool ParseOperatorName(State *state);
+static bool ParseSpecialName(State *state);
+static bool ParseCallOffset(State *state);
+static bool ParseNVOffset(State *state);
+static bool ParseVOffset(State *state);
+static bool ParseCtorDtorName(State *state);
+static bool ParseType(State *state);
+static bool ParseCVQualifiers(State *state);
+static bool ParseBuiltinType(State *state);
+static bool ParseFunctionType(State *state);
+static bool ParseBareFunctionType(State *state);
+static bool ParseClassEnumType(State *state);
+static bool ParseArrayType(State *state);
+static bool ParsePointerToMemberType(State *state);
+static bool ParseTemplateParam(State *state);
+static bool ParseTemplateTemplateParam(State *state);
+static bool ParseTemplateArgs(State *state);
+static bool ParseTemplateArg(State *state);
+static bool ParseExpression(State *state);
+static bool ParseExprPrimary(State *state);
+static bool ParseLocalName(State *state);
+static bool ParseDiscriminator(State *state);
+static bool ParseSubstitution(State *state);
+
+// Implementation note: the following code is a straightforward
+// translation of the Itanium C++ ABI defined in BNF with a couple of
+// exceptions.
+//
+// - Support GNU extensions not defined in the Itanium C++ ABI
+// - <prefix> and <template-prefix> are combined to avoid infinite loop
+// - Reorder patterns to shorten the code
+// - Reorder patterns to give greedier functions precedence
+// We'll mark "Less greedy than" for these cases in the code
+//
+// Each parsing function changes the state and returns true on
+// success. Otherwise, don't change the state and returns false. To
+// ensure that the state isn't changed in the latter case, we save the
+// original state before we call more than one parsing functions
+// consecutively with &&, and restore the state if unsuccessful. See
+// ParseEncoding() as an example of this convention. We follow the
+// convention throughout the code.
+//
+// Originally we tried to do demangling without following the full ABI
+// syntax but it turned out we needed to follow the full syntax to
+// parse complicated cases like nested template arguments. Note that
+// implementing a full-fledged demangler isn't trivial (libiberty's
+// cp-demangle.c has +4300 lines).
+//
+// Note that (foo) in <(foo) ...> is a modifier to be ignored.
+//
+// Reference:
+// - Itanium C++ ABI
+// <http://www.codesourcery.com/cxx-abi/abi.html#mangling>
+
+// <mangled-name> ::= _Z <encoding>
+static bool ParseMangledName(State *state) {
+ return ParseTwoCharToken(state, "_Z") && ParseEncoding(state);
+}
+
+// <encoding> ::= <(function) name> <bare-function-type>
+// ::= <(data) name>
+// ::= <special-name>
+static bool ParseEncoding(State *state) {
+ State copy = *state;
+ if (ParseName(state) && ParseBareFunctionType(state)) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseName(state) || ParseSpecialName(state)) {
+ return true;
+ }
+ return false;
+}
+
+// <name> ::= <nested-name>
+// ::= <unscoped-template-name> <template-args>
+// ::= <unscoped-name>
+// ::= <local-name>
+static bool ParseName(State *state) {
+ if (ParseNestedName(state) || ParseLocalName(state)) {
+ return true;
+ }
+
+ State copy = *state;
+ if (ParseUnscopedTemplateName(state) &&
+ ParseTemplateArgs(state)) {
+ return true;
+ }
+ *state = copy;
+
+ // Less greedy than <unscoped-template-name> <template-args>.
+ if (ParseUnscopedName(state)) {
+ return true;
+ }
+ return false;
+}
+
+// <unscoped-name> ::= <unqualified-name>
+// ::= St <unqualified-name>
+static bool ParseUnscopedName(State *state) {
+ if (ParseUnqualifiedName(state)) {
+ return true;
+ }
+
+ State copy = *state;
+ if (ParseTwoCharToken(state, "St") &&
+ MaybeAppend(state, "std::") &&
+ ParseUnqualifiedName(state)) {
+ return true;
+ }
+ *state = copy;
+ return false;
+}
+
+// <unscoped-template-name> ::= <unscoped-name>
+// ::= <substitution>
+static bool ParseUnscopedTemplateName(State *state) {
+ return ParseUnscopedName(state) || ParseSubstitution(state);
+}
+
+// <nested-name> ::= N [<CV-qualifiers>] <prefix> <unqualified-name> E
+// ::= N [<CV-qualifiers>] <template-prefix> <template-args> E
+static bool ParseNestedName(State *state) {
+ State copy = *state;
+ if (ParseOneCharToken(state, 'N') &&
+ EnterNestedName(state) &&
+ Optional(ParseCVQualifiers(state)) &&
+ ParsePrefix(state) &&
+ LeaveNestedName(state, copy.nest_level) &&
+ ParseOneCharToken(state, 'E')) {
+ return true;
+ }
+ *state = copy;
+ return false;
+}
+
+// This part is tricky. If we literally translate them to code, we'll
+// end up infinite loop. Hence we merge them to avoid the case.
+//
+// <prefix> ::= <prefix> <unqualified-name>
+// ::= <template-prefix> <template-args>
+// ::= <template-param>
+// ::= <substitution>
+// ::= # empty
+// <template-prefix> ::= <prefix> <(template) unqualified-name>
+// ::= <template-param>
+// ::= <substitution>
+static bool ParsePrefix(State *state) {
+ bool has_something = false;
+ while (true) {
+ MaybeAppendSeparator(state);
+ if (ParseTemplateParam(state) ||
+ ParseSubstitution(state) ||
+ ParseUnscopedName(state)) {
+ has_something = true;
+ MaybeIncreaseNestLevel(state);
+ continue;
+ }
+ MaybeCancelLastSeparator(state);
+ if (has_something && ParseTemplateArgs(state)) {
+ return ParsePrefix(state);
+ } else {
+ break;
+ }
+ }
+ return true;
+}
+
+// <unqualified-name> ::= <operator-name>
+// ::= <ctor-dtor-name>
+// ::= <source-name> [<abi-tags>]
+// ::= <local-source-name> [<abi-tags>]
+static bool ParseUnqualifiedName(State *state) {
+ return (ParseOperatorName(state) ||
+ ParseCtorDtorName(state) ||
+ (ParseSourceName(state) && Optional(ParseAbiTags(state))) ||
+ (ParseLocalSourceName(state) && Optional(ParseAbiTags(state))));
+}
+
+// <source-name> ::= <positive length number> <identifier>
+static bool ParseSourceName(State *state) {
+ State copy = *state;
+ int length = -1;
+ if (ParseNumber(state, &length) && ParseIdentifier(state, length)) {
+ return true;
+ }
+ *state = copy;
+ return false;
+}
+
+// <local-source-name> ::= L <source-name> [<discriminator>]
+//
+// References:
+// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31775
+// http://gcc.gnu.org/viewcvs?view=rev&revision=124467
+static bool ParseLocalSourceName(State *state) {
+ State copy = *state;
+ if (ParseOneCharToken(state, 'L') && ParseSourceName(state) &&
+ Optional(ParseDiscriminator(state))) {
+ return true;
+ }
+ *state = copy;
+ return false;
+}
+
+// <number> ::= [n] <non-negative decimal integer>
+// If "number_out" is non-null, then *number_out is set to the value of the
+// parsed number on success.
+static bool ParseNumber(State *state, int *number_out) {
+ int sign = 1;
+ if (ParseOneCharToken(state, 'n')) {
+ sign = -1;
+ }
+ const char *p = state->mangled_cur;
+ int number = 0;
+ for (;*p != '\0'; ++p) {
+ if (IsDigit(*p)) {
+ number = number * 10 + (*p - '0');
+ } else {
+ break;
+ }
+ }
+ if (p != state->mangled_cur) { // Conversion succeeded.
+ state->mangled_cur = p;
+ if (number_out != nullptr) {
+ *number_out = number * sign;
+ }
+ return true;
+ }
+ return false;
+}
+
+// Floating-point literals are encoded using a fixed-length lowercase
+// hexadecimal string.
+static bool ParseFloatNumber(State *state) {
+ const char *p = state->mangled_cur;
+ for (;*p != '\0'; ++p) {
+ if (!IsDigit(*p) && !(*p >= 'a' && *p <= 'f')) {
+ break;
+ }
+ }
+ if (p != state->mangled_cur) { // Conversion succeeded.
+ state->mangled_cur = p;
+ return true;
+ }
+ return false;
+}
+
+// The <seq-id> is a sequence number in base 36,
+// using digits and upper case letters
+static bool ParseSeqId(State *state) {
+ const char *p = state->mangled_cur;
+ for (;*p != '\0'; ++p) {
+ if (!IsDigit(*p) && !(*p >= 'A' && *p <= 'Z')) {
+ break;
+ }
+ }
+ if (p != state->mangled_cur) { // Conversion succeeded.
+ state->mangled_cur = p;
+ return true;
+ }
+ return false;
+}
+
+// <identifier> ::= <unqualified source code identifier> (of given length)
+static bool ParseIdentifier(State *state, ssize_t length) {
+ if (length == -1 ||
+ !AtLeastNumCharsRemaining(state->mangled_cur, length)) {
+ return false;
+ }
+ if (IdentifierIsAnonymousNamespace(state, length)) {
+ MaybeAppend(state, "(anonymous namespace)");
+ } else {
+ MaybeAppendWithLength(state, state->mangled_cur, length);
+ }
+ state->mangled_cur += length;
+ return true;
+}
+
+// <abi-tags> ::= <abi-tag> [<abi-tags>]
+static bool ParseAbiTags(State *state) {
+ State copy = *state;
+ DisableAppend(state);
+ if (OneOrMore(ParseAbiTag, state)) {
+ RestoreAppend(state, copy.append);
+ return true;
+ }
+ *state = copy;
+ return false;
+}
+
+// <abi-tag> ::= B <source-name>
+static bool ParseAbiTag(State *state) {
+ return ParseOneCharToken(state, 'B') && ParseSourceName(state);
+}
+
+// <operator-name> ::= nw, and other two letters cases
+// ::= cv <type> # (cast)
+// ::= v <digit> <source-name> # vendor extended operator
+static bool ParseOperatorName(State *state) {
+ if (!AtLeastNumCharsRemaining(state->mangled_cur, 2)) {
+ return false;
+ }
+ // First check with "cv" (cast) case.
+ State copy = *state;
+ if (ParseTwoCharToken(state, "cv") &&
+ MaybeAppend(state, "operator ") &&
+ EnterNestedName(state) &&
+ ParseType(state) &&
+ LeaveNestedName(state, copy.nest_level)) {
+ return true;
+ }
+ *state = copy;
+
+ // Then vendor extended operators.
+ if (ParseOneCharToken(state, 'v') && ParseCharClass(state, "0123456789") &&
+ ParseSourceName(state)) {
+ return true;
+ }
+ *state = copy;
+
+ // Other operator names should start with a lower alphabet followed
+ // by a lower/upper alphabet.
+ if (!(IsLower(state->mangled_cur[0]) &&
+ IsAlpha(state->mangled_cur[1]))) {
+ return false;
+ }
+ // We may want to perform a binary search if we really need speed.
+ const AbbrevPair *p;
+ for (p = kOperatorList; p->abbrev != nullptr; ++p) {
+ if (state->mangled_cur[0] == p->abbrev[0] &&
+ state->mangled_cur[1] == p->abbrev[1]) {
+ MaybeAppend(state, "operator");
+ if (IsLower(*p->real_name)) { // new, delete, etc.
+ MaybeAppend(state, " ");
+ }
+ MaybeAppend(state, p->real_name);
+ state->mangled_cur += 2;
+ return true;
+ }
+ }
+ return false;
+}
+
+// <special-name> ::= TV <type>
+// ::= TT <type>
+// ::= TI <type>
+// ::= TS <type>
+// ::= Tc <call-offset> <call-offset> <(base) encoding>
+// ::= GV <(object) name>
+// ::= T <call-offset> <(base) encoding>
+// G++ extensions:
+// ::= TC <type> <(offset) number> _ <(base) type>
+// ::= TF <type>
+// ::= TJ <type>
+// ::= GR <name>
+// ::= GA <encoding>
+// ::= Th <call-offset> <(base) encoding>
+// ::= Tv <call-offset> <(base) encoding>
+//
+// Note: we don't care much about them since they don't appear in
+// stack traces. The are special data.
+static bool ParseSpecialName(State *state) {
+ State copy = *state;
+ if (ParseOneCharToken(state, 'T') &&
+ ParseCharClass(state, "VTIS") &&
+ ParseType(state)) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseTwoCharToken(state, "Tc") && ParseCallOffset(state) &&
+ ParseCallOffset(state) && ParseEncoding(state)) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseTwoCharToken(state, "GV") &&
+ ParseName(state)) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseOneCharToken(state, 'T') && ParseCallOffset(state) &&
+ ParseEncoding(state)) {
+ return true;
+ }
+ *state = copy;
+
+ // G++ extensions
+ if (ParseTwoCharToken(state, "TC") && ParseType(state) &&
+ ParseNumber(state, nullptr) && ParseOneCharToken(state, '_') &&
+ DisableAppend(state) && ParseType(state)) {
+ RestoreAppend(state, copy.append);
+ return true;
+ }
+ *state = copy;
+
+ if (ParseOneCharToken(state, 'T') && ParseCharClass(state, "FJ") &&
+ ParseType(state)) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseTwoCharToken(state, "GR") && ParseName(state)) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseTwoCharToken(state, "GA") && ParseEncoding(state)) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseOneCharToken(state, 'T') && ParseCharClass(state, "hv") &&
+ ParseCallOffset(state) && ParseEncoding(state)) {
+ return true;
+ }
+ *state = copy;
+ return false;
+}
+
+// <call-offset> ::= h <nv-offset> _
+// ::= v <v-offset> _
+static bool ParseCallOffset(State *state) {
+ State copy = *state;
+ if (ParseOneCharToken(state, 'h') &&
+ ParseNVOffset(state) && ParseOneCharToken(state, '_')) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseOneCharToken(state, 'v') &&
+ ParseVOffset(state) && ParseOneCharToken(state, '_')) {
+ return true;
+ }
+ *state = copy;
+
+ return false;
+}
+
+// <nv-offset> ::= <(offset) number>
+static bool ParseNVOffset(State *state) { return ParseNumber(state, nullptr); }
+
+// <v-offset> ::= <(offset) number> _ <(virtual offset) number>
+static bool ParseVOffset(State *state) {
+ State copy = *state;
+ if (ParseNumber(state, nullptr) && ParseOneCharToken(state, '_') &&
+ ParseNumber(state, nullptr)) {
+ return true;
+ }
+ *state = copy;
+ return false;
+}
+
+// <ctor-dtor-name> ::= C1 | C2 | C3
+// ::= D0 | D1 | D2
+static bool ParseCtorDtorName(State *state) {
+ State copy = *state;
+ if (ParseOneCharToken(state, 'C') &&
+ ParseCharClass(state, "123")) {
+ const char * const prev_name = state->prev_name;
+ const ssize_t prev_name_length = state->prev_name_length;
+ MaybeAppendWithLength(state, prev_name, prev_name_length);
+ return true;
+ }
+ *state = copy;
+
+ if (ParseOneCharToken(state, 'D') &&
+ ParseCharClass(state, "012")) {
+ const char * const prev_name = state->prev_name;
+ const ssize_t prev_name_length = state->prev_name_length;
+ MaybeAppend(state, "~");
+ MaybeAppendWithLength(state, prev_name, prev_name_length);
+ return true;
+ }
+ *state = copy;
+ return false;
+}
+
+// <type> ::= <CV-qualifiers> <type>
+// ::= P <type> # pointer-to
+// ::= R <type> # reference-to
+// ::= O <type> # rvalue reference-to (C++0x)
+// ::= C <type> # complex pair (C 2000)
+// ::= G <type> # imaginary (C 2000)
+// ::= U <source-name> <type> # vendor extended type qualifier
+// ::= <builtin-type>
+// ::= <function-type>
+// ::= <class-enum-type>
+// ::= <array-type>
+// ::= <pointer-to-member-type>
+// ::= <template-template-param> <template-args>
+// ::= <template-param>
+// ::= <substitution>
+// ::= Dp <type> # pack expansion of (C++0x)
+// ::= Dt <expression> E # decltype of an id-expression or class
+// # member access (C++0x)
+// ::= DT <expression> E # decltype of an expression (C++0x)
+//
+static bool ParseType(State *state) {
+ // We should check CV-qualifers, and PRGC things first.
+ State copy = *state;
+ if (ParseCVQualifiers(state) && ParseType(state)) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseCharClass(state, "OPRCG") && ParseType(state)) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseTwoCharToken(state, "Dp") && ParseType(state)) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseOneCharToken(state, 'D') && ParseCharClass(state, "tT") &&
+ ParseExpression(state) && ParseOneCharToken(state, 'E')) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseOneCharToken(state, 'U') && ParseSourceName(state) &&
+ ParseType(state)) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseBuiltinType(state) ||
+ ParseFunctionType(state) ||
+ ParseClassEnumType(state) ||
+ ParseArrayType(state) ||
+ ParsePointerToMemberType(state) ||
+ ParseSubstitution(state)) {
+ return true;
+ }
+
+ if (ParseTemplateTemplateParam(state) &&
+ ParseTemplateArgs(state)) {
+ return true;
+ }
+ *state = copy;
+
+ // Less greedy than <template-template-param> <template-args>.
+ if (ParseTemplateParam(state)) {
+ return true;
+ }
+
+ return false;
+}
+
+// <CV-qualifiers> ::= [r] [V] [K]
+// We don't allow empty <CV-qualifiers> to avoid infinite loop in
+// ParseType().
+static bool ParseCVQualifiers(State *state) {
+ int num_cv_qualifiers = 0;
+ num_cv_qualifiers += ParseOneCharToken(state, 'r');
+ num_cv_qualifiers += ParseOneCharToken(state, 'V');
+ num_cv_qualifiers += ParseOneCharToken(state, 'K');
+ return num_cv_qualifiers > 0;
+}
+
+// <builtin-type> ::= v, etc.
+// ::= u <source-name>
+static bool ParseBuiltinType(State *state) {
+ const AbbrevPair *p;
+ for (p = kBuiltinTypeList; p->abbrev != nullptr; ++p) {
+ if (state->mangled_cur[0] == p->abbrev[0]) {
+ MaybeAppend(state, p->real_name);
+ ++state->mangled_cur;
+ return true;
+ }
+ }
+
+ State copy = *state;
+ if (ParseOneCharToken(state, 'u') && ParseSourceName(state)) {
+ return true;
+ }
+ *state = copy;
+ return false;
+}
+
+// <function-type> ::= F [Y] <bare-function-type> E
+static bool ParseFunctionType(State *state) {
+ State copy = *state;
+ if (ParseOneCharToken(state, 'F') &&
+ Optional(ParseOneCharToken(state, 'Y')) &&
+ ParseBareFunctionType(state) && ParseOneCharToken(state, 'E')) {
+ return true;
+ }
+ *state = copy;
+ return false;
+}
+
+// <bare-function-type> ::= <(signature) type>+
+static bool ParseBareFunctionType(State *state) {
+ State copy = *state;
+ DisableAppend(state);
+ if (OneOrMore(ParseType, state)) {
+ RestoreAppend(state, copy.append);
+ MaybeAppend(state, "()");
+ return true;
+ }
+ *state = copy;
+ return false;
+}
+
+// <class-enum-type> ::= <name>
+static bool ParseClassEnumType(State *state) {
+ return ParseName(state);
+}
+
+// <array-type> ::= A <(positive dimension) number> _ <(element) type>
+// ::= A [<(dimension) expression>] _ <(element) type>
+static bool ParseArrayType(State *state) {
+ State copy = *state;
+ if (ParseOneCharToken(state, 'A') && ParseNumber(state, nullptr) &&
+ ParseOneCharToken(state, '_') && ParseType(state)) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseOneCharToken(state, 'A') && Optional(ParseExpression(state)) &&
+ ParseOneCharToken(state, '_') && ParseType(state)) {
+ return true;
+ }
+ *state = copy;
+ return false;
+}
+
+// <pointer-to-member-type> ::= M <(class) type> <(member) type>
+static bool ParsePointerToMemberType(State *state) {
+ State copy = *state;
+ if (ParseOneCharToken(state, 'M') && ParseType(state) &&
+ ParseType(state)) {
+ return true;
+ }
+ *state = copy;
+ return false;
+}
+
+// <template-param> ::= T_
+// ::= T <parameter-2 non-negative number> _
+static bool ParseTemplateParam(State *state) {
+ if (ParseTwoCharToken(state, "T_")) {
+ MaybeAppend(state, "?"); // We don't support template substitutions.
+ return true;
+ }
+
+ State copy = *state;
+ if (ParseOneCharToken(state, 'T') && ParseNumber(state, nullptr) &&
+ ParseOneCharToken(state, '_')) {
+ MaybeAppend(state, "?"); // We don't support template substitutions.
+ return true;
+ }
+ *state = copy;
+ return false;
+}
+
+
+// <template-template-param> ::= <template-param>
+// ::= <substitution>
+static bool ParseTemplateTemplateParam(State *state) {
+ return (ParseTemplateParam(state) ||
+ ParseSubstitution(state));
+}
+
+// <template-args> ::= I <template-arg>+ E
+static bool ParseTemplateArgs(State *state) {
+ State copy = *state;
+ DisableAppend(state);
+ if (ParseOneCharToken(state, 'I') &&
+ OneOrMore(ParseTemplateArg, state) &&
+ ParseOneCharToken(state, 'E')) {
+ RestoreAppend(state, copy.append);
+ MaybeAppend(state, "<>");
+ return true;
+ }
+ *state = copy;
+ return false;
+}
+
+// <template-arg> ::= <type>
+// ::= <expr-primary>
+// ::= I <template-arg>* E # argument pack
+// ::= J <template-arg>* E # argument pack
+// ::= X <expression> E
+static bool ParseTemplateArg(State *state) {
+ State copy = *state;
+ if ((ParseOneCharToken(state, 'I') || ParseOneCharToken(state, 'J')) &&
+ ZeroOrMore(ParseTemplateArg, state) &&
+ ParseOneCharToken(state, 'E')) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseType(state) ||
+ ParseExprPrimary(state)) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseOneCharToken(state, 'X') && ParseExpression(state) &&
+ ParseOneCharToken(state, 'E')) {
+ return true;
+ }
+ *state = copy;
+ return false;
+}
+
+// <expression> ::= <template-param>
+// ::= <expr-primary>
+// ::= <unary operator-name> <expression>
+// ::= <binary operator-name> <expression> <expression>
+// ::= <trinary operator-name> <expression> <expression>
+// <expression>
+// ::= st <type>
+// ::= sr <type> <unqualified-name> <template-args>
+// ::= sr <type> <unqualified-name>
+static bool ParseExpression(State *state) {
+ if (ParseTemplateParam(state) || ParseExprPrimary(state)) {
+ return true;
+ }
+
+ State copy = *state;
+ if (ParseOperatorName(state) &&
+ ParseExpression(state) &&
+ ParseExpression(state) &&
+ ParseExpression(state)) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseOperatorName(state) &&
+ ParseExpression(state) &&
+ ParseExpression(state)) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseOperatorName(state) &&
+ ParseExpression(state)) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseTwoCharToken(state, "st") && ParseType(state)) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseTwoCharToken(state, "sr") && ParseType(state) &&
+ ParseUnqualifiedName(state) &&
+ ParseTemplateArgs(state)) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseTwoCharToken(state, "sr") && ParseType(state) &&
+ ParseUnqualifiedName(state)) {
+ return true;
+ }
+ *state = copy;
+ return false;
+}
+
+// <expr-primary> ::= L <type> <(value) number> E
+// ::= L <type> <(value) float> E
+// ::= L <mangled-name> E
+// // A bug in g++'s C++ ABI version 2 (-fabi-version=2).
+// ::= LZ <encoding> E
+static bool ParseExprPrimary(State *state) {
+ State copy = *state;
+ if (ParseOneCharToken(state, 'L') && ParseType(state) &&
+ ParseNumber(state, nullptr) && ParseOneCharToken(state, 'E')) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseOneCharToken(state, 'L') && ParseType(state) &&
+ ParseFloatNumber(state) &&
+ ParseOneCharToken(state, 'E')) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseOneCharToken(state, 'L') && ParseMangledName(state) &&
+ ParseOneCharToken(state, 'E')) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseTwoCharToken(state, "LZ") && ParseEncoding(state) &&
+ ParseOneCharToken(state, 'E')) {
+ return true;
+ }
+ *state = copy;
+
+ return false;
+}
+
+// <local-name> := Z <(function) encoding> E <(entity) name>
+// [<discriminator>]
+// := Z <(function) encoding> E s [<discriminator>]
+static bool ParseLocalName(State *state) {
+ State copy = *state;
+ if (ParseOneCharToken(state, 'Z') && ParseEncoding(state) &&
+ ParseOneCharToken(state, 'E') && MaybeAppend(state, "::") &&
+ ParseName(state) && Optional(ParseDiscriminator(state))) {
+ return true;
+ }
+ *state = copy;
+
+ if (ParseOneCharToken(state, 'Z') && ParseEncoding(state) &&
+ ParseTwoCharToken(state, "Es") && Optional(ParseDiscriminator(state))) {
+ return true;
+ }
+ *state = copy;
+ return false;
+}
+
+// <discriminator> := _ <(non-negative) number>
+static bool ParseDiscriminator(State *state) {
+ State copy = *state;
+ if (ParseOneCharToken(state, '_') && ParseNumber(state, nullptr)) {
+ return true;
+ }
+ *state = copy;
+ return false;
+}
+
+// <substitution> ::= S_
+// ::= S <seq-id> _
+// ::= St, etc.
+static bool ParseSubstitution(State *state) {
+ if (ParseTwoCharToken(state, "S_")) {
+ MaybeAppend(state, "?"); // We don't support substitutions.
+ return true;
+ }
+
+ State copy = *state;
+ if (ParseOneCharToken(state, 'S') && ParseSeqId(state) &&
+ ParseOneCharToken(state, '_')) {
+ MaybeAppend(state, "?"); // We don't support substitutions.
+ return true;
+ }
+ *state = copy;
+
+ // Expand abbreviations like "St" => "std".
+ if (ParseOneCharToken(state, 'S')) {
+ const AbbrevPair *p;
+ for (p = kSubstitutionList; p->abbrev != nullptr; ++p) {
+ if (state->mangled_cur[0] == p->abbrev[1]) {
+ MaybeAppend(state, "std");
+ if (p->real_name[0] != '\0') {
+ MaybeAppend(state, "::");
+ MaybeAppend(state, p->real_name);
+ }
+ ++state->mangled_cur;
+ return true;
+ }
+ }
+ }
+ *state = copy;
+ return false;
+}
+
+// Parse <mangled-name>, optionally followed by either a function-clone suffix
+// or version suffix. Returns true only if all of "mangled_cur" was consumed.
+static bool ParseTopLevelMangledName(State *state) {
+ if (ParseMangledName(state)) {
+ if (state->mangled_cur[0] != '\0') {
+ // Drop trailing function clone suffix, if any.
+ if (IsFunctionCloneSuffix(state->mangled_cur)) {
+ return true;
+ }
+ // Append trailing version suffix if any.
+ // ex. _Z3foo@@GLIBCXX_3.4
+ if (state->mangled_cur[0] == '@') {
+ MaybeAppend(state, state->mangled_cur);
+ return true;
+ }
+ return false; // Unconsumed suffix.
+ }
+ return true;
+ }
+ return false;
+}
+#endif
+
+// The demangler entry point.
+bool Demangle(const char *mangled, char *out, size_t out_size) {
+#if defined(GLOG_OS_WINDOWS)
+#if defined(HAVE_DBGHELP)
+ // When built with incremental linking, the Windows debugger
+ // library provides a more complicated `Symbol->Name` with the
+ // Incremental Linking Table offset, which looks like
+ // `@ILT+1105(?func@Foo@@SAXH@Z)`. However, the demangler expects
+ // only the mangled symbol, `?func@Foo@@SAXH@Z`. Fortunately, the
+ // mangled symbol is guaranteed not to have parentheses,
+ // so we search for `(` and extract up to `)`.
+ //
+ // Since we may be in a signal handler here, we cannot use `std::string`.
+ char buffer[1024]; // Big enough for a sane symbol.
+ const char *lparen = strchr(mangled, '(');
+ if (lparen) {
+ // Extract the string `(?...)`
+ const char *rparen = strchr(lparen, ')');
+ size_t length = static_cast<size_t>(rparen - lparen) - 1;
+ strncpy(buffer, lparen + 1, length);
+ buffer[length] = '\0';
+ mangled = buffer;
+ } // Else the symbol wasn't inside a set of parentheses
+ // We use the ANSI version to ensure the string type is always `char *`.
+ return UnDecorateSymbolName(mangled, out, out_size, UNDNAME_COMPLETE);
+#else
+ (void)mangled;
+ (void)out;
+ (void)out_size;
+ return false;
+#endif
+#else
+ State state;
+ InitState(&state, mangled, out, out_size);
+ return ParseTopLevelMangledName(&state) && !state.overflowed;
+#endif
+}
+
+_END_GOOGLE_NAMESPACE_
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/demangle.h b/funasr/runtime/onnxruntime/third_party/glog/src/demangle.h
new file mode 100644
index 0000000..f347b98
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/demangle.h
@@ -0,0 +1,85 @@
+// Copyright (c) 2006, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Satoru Takabayashi
+//
+// An async-signal-safe and thread-safe demangler for Itanium C++ ABI
+// (aka G++ V3 ABI).
+
+// The demangler is implemented to be used in async signal handlers to
+// symbolize stack traces. We cannot use libstdc++'s
+// abi::__cxa_demangle() in such signal handlers since it's not async
+// signal safe (it uses malloc() internally).
+//
+// Note that this demangler doesn't support full demangling. More
+// specifically, it doesn't print types of function parameters and
+// types of template arguments. It just skips them. However, it's
+// still very useful to extract basic information such as class,
+// function, constructor, destructor, and operator names.
+//
+// See the implementation note in demangle.cc if you are interested.
+//
+// Example:
+//
+// | Mangled Name | The Demangler | abi::__cxa_demangle()
+// |---------------|---------------|-----------------------
+// | _Z1fv | f() | f()
+// | _Z1fi | f() | f(int)
+// | _Z3foo3bar | foo() | foo(bar)
+// | _Z1fIiEvi | f<>() | void f<int>(int)
+// | _ZN1N1fE | N::f | N::f
+// | _ZN3Foo3BarEv | Foo::Bar() | Foo::Bar()
+// | _Zrm1XS_" | operator%() | operator%(X, X)
+// | _ZN3FooC1Ev | Foo::Foo() | Foo::Foo()
+// | _Z1fSs | f() | f(std::basic_string<char,
+// | | | std::char_traits<char>,
+// | | | std::allocator<char> >)
+//
+// See the unit test for more examples.
+//
+// Note: we might want to write demanglers for ABIs other than Itanium
+// C++ ABI in the future.
+//
+
+#ifndef BASE_DEMANGLE_H_
+#define BASE_DEMANGLE_H_
+
+#include "config.h"
+#include <glog/logging.h>
+
+_START_GOOGLE_NAMESPACE_
+
+// Demangle "mangled". On success, return true and write the
+// demangled symbol name to "out". Otherwise, return false.
+// "out" is modified even if demangling is unsuccessful.
+bool GLOG_EXPORT Demangle(const char *mangled, char *out, size_t out_size);
+
+_END_GOOGLE_NAMESPACE_
+
+#endif // BASE_DEMANGLE_H_
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/demangle_unittest.cc b/funasr/runtime/onnxruntime/third_party/glog/src/demangle_unittest.cc
new file mode 100644
index 0000000..144781c
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/demangle_unittest.cc
@@ -0,0 +1,170 @@
+// Copyright (c) 2006, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Satoru Takabayashi
+//
+// Unit tests for functions in demangle.c.
+
+#include "utilities.h"
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <glog/logging.h>
+#include "demangle.h"
+#include "googletest.h"
+#include "config.h"
+
+#ifdef HAVE_LIB_GFLAGS
+#include <gflags/gflags.h>
+using namespace GFLAGS_NAMESPACE;
+#endif
+
+GLOG_DEFINE_bool(demangle_filter, false,
+ "Run demangle_unittest in filter mode");
+
+using namespace std;
+using namespace GOOGLE_NAMESPACE;
+
+// A wrapper function for Demangle() to make the unit test simple.
+static const char *DemangleIt(const char * const mangled) {
+ static char demangled[4096];
+ if (Demangle(mangled, demangled, sizeof(demangled))) {
+ return demangled;
+ } else {
+ return mangled;
+ }
+}
+
+#if defined(GLOG_OS_WINDOWS)
+
+#if defined(HAVE_DBGHELP) && !defined(NDEBUG)
+TEST(Demangle, Windows) {
+ EXPECT_STREQ(
+ "public: static void __cdecl Foo::func(int)",
+ DemangleIt("?func@Foo@@SAXH@Z"));
+ EXPECT_STREQ(
+ "public: static void __cdecl Foo::func(int)",
+ DemangleIt("@ILT+1105(?func@Foo@@SAXH@Z)"));
+ EXPECT_STREQ(
+ "int __cdecl foobarArray(int * const)",
+ DemangleIt("?foobarArray@@YAHQAH@Z"));
+}
+#endif
+
+#else
+
+// Test corner cases of bounary conditions.
+TEST(Demangle, CornerCases) {
+ const size_t size = 10;
+ char tmp[size] = { 0 };
+ const char *demangled = "foobar()";
+ const char *mangled = "_Z6foobarv";
+ EXPECT_TRUE(Demangle(mangled, tmp, sizeof(tmp)));
+ // sizeof("foobar()") == size - 1
+ EXPECT_STREQ(demangled, tmp);
+ EXPECT_TRUE(Demangle(mangled, tmp, size - 1));
+ EXPECT_STREQ(demangled, tmp);
+ EXPECT_FALSE(Demangle(mangled, tmp, size - 2)); // Not enough.
+ EXPECT_FALSE(Demangle(mangled, tmp, 1));
+ EXPECT_FALSE(Demangle(mangled, tmp, 0));
+ EXPECT_FALSE(Demangle(mangled, nullptr, 0)); // Should not cause SEGV.
+}
+
+// Test handling of functions suffixed with .clone.N, which is used by GCC
+// 4.5.x, and .constprop.N and .isra.N, which are used by GCC 4.6.x. These
+// suffixes are used to indicate functions which have been cloned during
+// optimization. We ignore these suffixes.
+TEST(Demangle, Clones) {
+ char tmp[20];
+ EXPECT_TRUE(Demangle("_ZL3Foov", tmp, sizeof(tmp)));
+ EXPECT_STREQ("Foo()", tmp);
+ EXPECT_TRUE(Demangle("_ZL3Foov.clone.3", tmp, sizeof(tmp)));
+ EXPECT_STREQ("Foo()", tmp);
+ EXPECT_TRUE(Demangle("_ZL3Foov.constprop.80", tmp, sizeof(tmp)));
+ EXPECT_STREQ("Foo()", tmp);
+ EXPECT_TRUE(Demangle("_ZL3Foov.isra.18", tmp, sizeof(tmp)));
+ EXPECT_STREQ("Foo()", tmp);
+ EXPECT_TRUE(Demangle("_ZL3Foov.isra.2.constprop.18", tmp, sizeof(tmp)));
+ EXPECT_STREQ("Foo()", tmp);
+ // Invalid (truncated), should not demangle.
+ EXPECT_FALSE(Demangle("_ZL3Foov.clo", tmp, sizeof(tmp)));
+ // Invalid (.clone. not followed by number), should not demangle.
+ EXPECT_FALSE(Demangle("_ZL3Foov.clone.", tmp, sizeof(tmp)));
+ // Invalid (.clone. followed by non-number), should not demangle.
+ EXPECT_FALSE(Demangle("_ZL3Foov.clone.foo", tmp, sizeof(tmp)));
+ // Invalid (.constprop. not followed by number), should not demangle.
+ EXPECT_FALSE(Demangle("_ZL3Foov.isra.2.constprop.", tmp, sizeof(tmp)));
+}
+
+TEST(Demangle, FromFile) {
+ string test_file = FLAGS_test_srcdir + "/src/demangle_unittest.txt";
+ ifstream f(test_file.c_str()); // The file should exist.
+ EXPECT_FALSE(f.fail());
+
+ string line;
+ while (getline(f, line)) {
+ // Lines start with '#' are considered as comments.
+ if (line.empty() || line[0] == '#') {
+ continue;
+ }
+ // Each line should contain a mangled name and a demangled name
+ // separated by '\t'. Example: "_Z3foo\tfoo"
+ string::size_type tab_pos = line.find('\t');
+ EXPECT_NE(string::npos, tab_pos);
+ string mangled = line.substr(0, tab_pos);
+ string demangled = line.substr(tab_pos + 1);
+ EXPECT_EQ(demangled, DemangleIt(mangled.c_str()));
+ }
+}
+
+#endif
+
+int main(int argc, char **argv) {
+#ifdef HAVE_LIB_GFLAGS
+ ParseCommandLineFlags(&argc, &argv, true);
+#endif
+ InitGoogleTest(&argc, argv);
+
+ FLAGS_logtostderr = true;
+ InitGoogleLogging(argv[0]);
+ if (FLAGS_demangle_filter) {
+ // Read from cin and write to cout.
+ string line;
+ while (getline(cin, line, '\n')) {
+ cout << DemangleIt(line.c_str()) << endl;
+ }
+ return 0;
+ } else if (argc > 1) {
+ cout << DemangleIt(argv[1]) << endl;
+ return 0;
+ } else {
+ return RUN_ALL_TESTS();
+ }
+}
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/demangle_unittest.sh b/funasr/runtime/onnxruntime/third_party/glog/src/demangle_unittest.sh
new file mode 100755
index 0000000..91deee2
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/demangle_unittest.sh
@@ -0,0 +1,95 @@
+#! /bin/sh
+#
+# Copyright (c) 2006, Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Author: Satoru Takabayashi
+#
+# Unit tests for demangle.c with a real binary.
+
+set -e
+
+die () {
+ echo $1
+ exit 1
+}
+
+BINDIR=".libs"
+LIBGLOG="$BINDIR/libglog.so"
+
+DEMANGLER="$BINDIR/demangle_unittest"
+
+if test -e "$DEMANGLER"; then
+ # We need shared object.
+ export LD_LIBRARY_PATH=$BINDIR
+ export DYLD_LIBRARY_PATH=$BINDIR
+else
+ # For windows
+ DEMANGLER="./demangle_unittest.exe"
+ if ! test -e "$DEMANGLER"; then
+ echo "We coundn't find demangle_unittest binary."
+ exit 1
+ fi
+fi
+
+# Extract C++ mangled symbols from libbase.so.
+NM_OUTPUT="demangle.nm"
+nm "$LIBGLOG" | perl -nle 'print $1 if /\s(_Z\S+$)/' > "$NM_OUTPUT"
+
+# Check if mangled symbols exist. If there are none, we quit.
+# The binary is more likely compiled with GCC 2.95 or something old.
+if ! grep --quiet '^_Z' "$NM_OUTPUT"; then
+ echo "PASS"
+ exit 0
+fi
+
+# Demangle the symbols using our demangler.
+DM_OUTPUT="demangle.dm"
+GLOG_demangle_filter=1 "$DEMANGLER" --demangle_filter < "$NM_OUTPUT" > "$DM_OUTPUT"
+
+# Calculate the numbers of lines.
+NM_LINES=`wc -l "$NM_OUTPUT" | awk '{ print $1 }'`
+DM_LINES=`wc -l "$DM_OUTPUT" | awk '{ print $1 }'`
+
+# Compare the numbers of lines. They must be the same.
+if test "$NM_LINES" != "$DM_LINES"; then
+ die "$NM_OUTPUT and $DM_OUTPUT don't have the same numbers of lines"
+fi
+
+# Check if mangled symbols exist. They must not exist.
+if grep --quiet '^_Z' "$DM_OUTPUT"; then
+ MANGLED=`grep '^_Z' "$DM_OUTPUT" | wc -l | awk '{ print \$1 }'`
+ echo "Mangled symbols ($MANGLED out of $NM_LINES) found in $DM_OUTPUT:"
+ grep '^_Z' "$DM_OUTPUT"
+ die "Mangled symbols ($MANGLED out of $NM_LINES) found in $DM_OUTPUT"
+fi
+
+# All C++ symbols are demangled successfully.
+echo "PASS"
+exit 0
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/demangle_unittest.txt b/funasr/runtime/onnxruntime/third_party/glog/src/demangle_unittest.txt
new file mode 100644
index 0000000..07e28bc
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/demangle_unittest.txt
@@ -0,0 +1,145 @@
+# Test caces for demangle_unittest. Each line consists of a
+# tab-separated pair of mangled and demangled symbol names.
+
+# Constructors and destructors.
+_ZN3FooC1Ev Foo::Foo()
+_ZN3FooD1Ev Foo::~Foo()
+_ZNSoD0Ev std::ostream::~ostream()
+
+# G++ extensions.
+_ZTCN10LogMessage9LogStreamE0_So LogMessage::LogStream
+_ZTv0_n12_N10LogMessage9LogStreamD0Ev LogMessage::LogStream::~LogStream()
+_ZThn4_N7icu_3_410UnicodeSetD0Ev icu_3_4::UnicodeSet::~UnicodeSet()
+
+# A bug in g++'s C++ ABI version 2 (-fabi-version=2).
+_ZN7NSSInfoI5groupjjXadL_Z10getgrgid_rEELZ19nss_getgrgid_r_nameEEC1Ei NSSInfo<>::NSSInfo()
+
+# C linkage symbol names. Should keep them untouched.
+main main
+Demangle Demangle
+_ZERO _ZERO
+
+# Cast operator.
+_Zcviv operator int()
+_ZN3foocviEv foo::operator int()
+
+# Versioned symbols.
+_Z3Foo@GLIBCXX_3.4 Foo@GLIBCXX_3.4
+_Z3Foo@@GLIBCXX_3.4 Foo@@GLIBCXX_3.4
+
+# Abbreviations.
+_ZNSaE std::allocator
+_ZNSbE std::basic_string
+_ZNSdE std::iostream
+_ZNSiE std::istream
+_ZNSoE std::ostream
+_ZNSsE std::string
+
+# Substitutions. We just replace them with ?.
+_ZN3fooS_E foo::?
+_ZN3foo3barS0_E foo::bar::?
+_ZNcvT_IiEEv operator ?<>()
+
+# "<< <" case.
+_ZlsI3fooE operator<< <>
+
+# ABI tags.
+_Z1AB3barB3foo A
+_ZN3fooL3barB5cxx11E foo::bar
+
+# Random things we found interesting.
+_ZN3FooISt6vectorISsSaISsEEEclEv Foo<>::operator()()
+_ZTI9Callback1IiE Callback1<>
+_ZN7icu_3_47UMemorynwEj icu_3_4::UMemory::operator new()
+_ZNSt6vectorIbE9push_backE std::vector<>::push_back
+_ZNSt6vectorIbSaIbEE9push_backEb std::vector<>::push_back()
+_ZlsRSoRK15PRIVATE_Counter operator<<()
+_ZSt6fill_nIPPN9__gnu_cxx15_Hashtable_nodeISt4pairIKPKcjEEEjS8_ET_SA_T0_RKT1_ std::fill_n<>()
+_ZZ3FoovE3Bar Foo()::Bar
+_ZGVZ7UpTimervE8up_timer UpTimer()::up_timer
+
+# Test cases from gcc-4.1.0/libstdc++-v3/testsuite/demangle.
+# Collected by:
+# % grep verify_demangle **/*.cc | perl -nle 'print $1 if /"(_Z.*?)"/' |
+# sort | uniq
+#
+# Note that the following symbols are invalid.
+# That's why they are not demangled.
+# - _ZNZN1N1fEiE1X1gE
+# - _ZNZN1N1fEiE1X1gEv
+# - _Z1xINiEE
+_Z1fA37_iPS_ f()
+_Z1fAszL_ZZNK1N1A1fEvE3foo_0E_i f()
+_Z1fI1APS0_PKS0_EvT_T0_T1_PA4_S3_M1CS8_ f<>()
+_Z1fI1XENT_1tES2_ f<>()
+_Z1fI1XEvPVN1AIT_E1TE f<>()
+_Z1fILi1ELc120EEv1AIXplT_cviLd4028ae147ae147aeEEE f<>()
+_Z1fILi1ELc120EEv1AIXplT_cviLf3f800000EEE f<>()
+_Z1fILi5E1AEvN1CIXqugtT_Li0ELi1ELi2EEE1qE f<>()
+_Z1fILi5E1AEvN1CIXstN1T1tEEXszsrS2_1tEE1qE f<>()
+_Z1fILi5EEvN1AIXcvimlT_Li22EEE1qE f<>()
+_Z1fIiEvi f<>()
+_Z1fKPFiiE f()
+_Z1fM1AFivEPS0_ f()
+_Z1fM1AKFivE f()
+_Z1fM1AKFvvE f()
+_Z1fPFPA1_ivE f()
+_Z1fPFYPFiiEiE f()
+_Z1fPFvvEM1SFvvE f()
+_Z1fPKM1AFivE f()
+_Z1fi f()
+_Z1fv f()
+_Z1jM1AFivEPS1_ j()
+_Z1rM1GFivEMS_KFivES_M1HFivES1_4whatIKS_E5what2IS8_ES3_ r()
+_Z1sPA37_iPS0_ s()
+_Z1xINiEE _Z1xINiEE
+_Z3absILi11EEvv abs<>()
+_Z3foo3bar foo()
+_Z3foo5Hello5WorldS0_S_ foo()
+_Z3fooA30_A_i foo()
+_Z3fooIA6_KiEvA9_KT_rVPrS4_ foo<>()
+_Z3fooILi2EEvRAplT_Li1E_i foo<>()
+_Z3fooIiFvdEiEvv foo<>()
+_Z3fooPM2ABi foo()
+_Z3fooc foo()
+_Z3fooiPiPS_PS0_PS1_PS2_PS3_PS4_PS5_PS6_PS7_PS8_PS9_PSA_PSB_PSC_ foo()
+_Z3kooPA28_A30_i koo()
+_Z4makeI7FactoryiET_IT0_Ev make<>()
+_Z5firstI3DuoEvS0_ first<>()
+_Z5firstI3DuoEvT_ first<>()
+_Z9hairyfuncM1YKFPVPFrPA2_PM1XKFKPA3_ilEPcEiE hairyfunc()
+_ZGVN5libcw24_GLOBAL__N_cbll.cc0ZhUKa23compiler_bug_workaroundISt6vectorINS_13omanip_id_tctINS_5debug32memblk_types_manipulator_data_ctEEESaIS6_EEE3idsE libcw::(anonymous namespace)::compiler_bug_workaround<>::ids
+_ZN12libcw_app_ct10add_optionIS_EEvMT_FvPKcES3_cS3_S3_ libcw_app_ct::add_option<>()
+_ZN1AIfEcvT_IiEEv A<>::operator ?<>()
+_ZN1N1TIiiE2mfES0_IddE N::T<>::mf()
+_ZN1N1fE N::f
+_ZN1f1fE f::f
+_ZN3FooIA4_iE3barE Foo<>::bar
+_ZN5Arena5levelE Arena::level
+_ZN5StackIiiE5levelE Stack<>::level
+_ZN5libcw5debug13cwprint_usingINS_9_private_12GlobalObjectEEENS0_17cwprint_using_tctIT_EERKS5_MS5_KFvRSt7ostreamE libcw::debug::cwprint_using<>()
+_ZN6System5Sound4beepEv System::Sound::beep()
+_ZNKSt14priority_queueIP27timer_event_request_base_ctSt5dequeIS1_SaIS1_EE13timer_greaterE3topEv std::priority_queue<>::top()
+_ZNKSt15_Deque_iteratorIP15memory_block_stRKS1_PS2_EeqERKS5_ std::_Deque_iterator<>::operator==()
+_ZNKSt17__normal_iteratorIPK6optionSt6vectorIS0_SaIS0_EEEmiERKS6_ std::__normal_iterator<>::operator-()
+_ZNSbIcSt11char_traitsIcEN5libcw5debug27no_alloc_checking_allocatorEE12_S_constructIPcEES6_T_S7_RKS3_ std::basic_string<>::_S_construct<>()
+_ZNSt13_Alloc_traitsISbIcSt18string_char_traitsIcEN5libcw5debug9_private_17allocator_adaptorIcSt24__default_alloc_templateILb0ELi327664EELb1EEEENS5_IS9_S7_Lb1EEEE15_S_instancelessE std::_Alloc_traits<>::_S_instanceless
+_ZNSt3_In4wardE std::_In::ward
+_ZNZN1N1fEiE1X1gE _ZNZN1N1fEiE1X1gE
+_ZNZN1N1fEiE1X1gEv _ZNZN1N1fEiE1X1gEv
+_ZSt1BISt1DIP1ARKS2_PS3_ES0_IS2_RS2_PS2_ES2_ET0_T_SB_SA_PT1_ std::B<>()
+_ZSt5state std::state
+_ZTI7a_class a_class
+_ZZN1N1fEiE1p N::f()::p
+_ZZN1N1fEiEs N::f()
+_ZlsRK1XS1_ operator<<()
+_ZlsRKU3fooU4bart1XS0_ operator<<()
+_ZlsRKU3fooU4bart1XS2_ operator<<()
+_ZlsRSoRKSs operator<<()
+_ZngILi42EEvN1AIXplT_Li2EEE1TE operator-<>()
+_ZplR1XS0_ operator+()
+_Zrm1XS_ operator%()
+
+# Template argument packs can start with I or J.
+_Z3addIIiEEvDpT_ add<>()
+_Z3addIJiEEvDpT_ add<>()
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/fuzz_demangle.cc b/funasr/runtime/onnxruntime/third_party/glog/src/fuzz_demangle.cc
new file mode 100644
index 0000000..c6ee4b5
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/fuzz_demangle.cc
@@ -0,0 +1,32 @@
+// Copyright 2023 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+#include <cstring>
+
+#include "demangle.h"
+
+extern "C" int LLVMFuzzerTestOneInput(const unsigned char *Data,
+ unsigned Size) {
+ if (Size >= 4095) {
+ return 0;
+ }
+ char Buffer[Size + 1];
+ std::memcpy(Buffer, Data, Size);
+ Buffer[Size] = 0;
+ char demangled[4096];
+ google::Demangle(Buffer, demangled, Size);
+ return 0;
+}
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/glog/log_severity.h b/funasr/runtime/onnxruntime/third_party/glog/src/glog/log_severity.h
new file mode 100644
index 0000000..d52989d
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/glog/log_severity.h
@@ -0,0 +1,98 @@
+// Copyright (c) 2023, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef BASE_LOG_SEVERITY_H__
+#define BASE_LOG_SEVERITY_H__
+
+// The recommended semantics of the log levels are as follows:
+//
+// INFO:
+// Use for state changes or other major events, or to aid debugging.
+// WARNING:
+// Use for undesired but relatively expected events, which may indicate a
+// problem
+// ERROR:
+// Use for undesired and unexpected events that the program can recover from.
+// All ERRORs should be actionable - it should be appropriate to file a bug
+// whenever an ERROR occurs in production.
+// FATAL:
+// Use for undesired and unexpected events that the program cannot recover
+// from.
+
+// Variables of type LogSeverity are widely taken to lie in the range
+// [0, NUM_SEVERITIES-1]. Be careful to preserve this assumption if
+// you ever need to change their values or add a new severity.
+using LogSeverity = int;
+
+const int GLOG_INFO = 0, GLOG_WARNING = 1, GLOG_ERROR = 2, GLOG_FATAL = 3,
+ NUM_SEVERITIES = 4;
+#ifndef GLOG_NO_ABBREVIATED_SEVERITIES
+# ifdef ERROR
+# error ERROR macro is defined. Define GLOG_NO_ABBREVIATED_SEVERITIES before including logging.h. See the document for detail.
+# endif
+const int INFO = GLOG_INFO, WARNING = GLOG_WARNING,
+ ERROR = GLOG_ERROR, FATAL = GLOG_FATAL;
+#endif
+
+// DFATAL is FATAL in debug mode, ERROR in normal mode
+#ifdef NDEBUG
+#define DFATAL_LEVEL ERROR
+#else
+#define DFATAL_LEVEL FATAL
+#endif
+
+extern GLOG_EXPORT const char* const LogSeverityNames[NUM_SEVERITIES];
+
+// NDEBUG usage helpers related to (RAW_)DCHECK:
+//
+// DEBUG_MODE is for small !NDEBUG uses like
+// if (DEBUG_MODE) foo.CheckThatFoo();
+// instead of substantially more verbose
+// #ifndef NDEBUG
+// foo.CheckThatFoo();
+// #endif
+//
+// IF_DEBUG_MODE is for small !NDEBUG uses like
+// IF_DEBUG_MODE( string error; )
+// DCHECK(Foo(&error)) << error;
+// instead of substantially more verbose
+// #ifndef NDEBUG
+// string error;
+// DCHECK(Foo(&error)) << error;
+// #endif
+//
+#ifdef NDEBUG
+enum { DEBUG_MODE = 0 };
+#define IF_DEBUG_MODE(x)
+#else
+enum { DEBUG_MODE = 1 };
+#define IF_DEBUG_MODE(x) x
+#endif
+
+#endif // BASE_LOG_SEVERITY_H__
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/glog/logging.h.in b/funasr/runtime/onnxruntime/third_party/glog/src/glog/logging.h.in
new file mode 100644
index 0000000..e8e6c41
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/glog/logging.h.in
@@ -0,0 +1,1842 @@
+// Copyright (c) 2023, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Ray Sidney
+//
+// This file contains #include information about logging-related stuff.
+// Pretty much everybody needs to #include this file so that they can
+// log various happenings.
+//
+#ifndef GLOG_LOGGING_H
+#define GLOG_LOGGING_H
+
+#include <cerrno>
+#include <chrono>
+#include <cstddef>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
+#include <iosfwd>
+#include <ostream>
+#include <sstream>
+#include <string>
+#if @ac_cv_have_unistd_h@
+# include <unistd.h>
+#endif
+#include <vector>
+
+#if defined(_MSC_VER)
+#define GLOG_MSVC_PUSH_DISABLE_WARNING(n) __pragma(warning(push)) \
+ __pragma(warning(disable:n))
+#define GLOG_MSVC_POP_WARNING() __pragma(warning(pop))
+#else
+#define GLOG_MSVC_PUSH_DISABLE_WARNING(n)
+#define GLOG_MSVC_POP_WARNING()
+#endif
+
+#include <glog/platform.h>
+
+#if @ac_cv_have_glog_export@
+#include <glog/export.h>
+#endif
+
+// We care a lot about number of bits things take up. Unfortunately,
+// systems define their bit-specific ints in a lot of different ways.
+// We use our own way, and have a typedef to get there.
+// Note: these commands below may look like "#if 1" or "#if 0", but
+// that's because they were constructed that way at ./configure time.
+// Look at logging.h.in to see how they're calculated (based on your config).
+#include <cstdint> // the normal place uint16_t is defined
+#if @ac_cv_have_systypes_h@
+#include <sys/types.h> // the normal place u_int16_t is defined
+#endif
+
+#if @ac_cv_have_libgflags@
+#include <gflags/gflags.h>
+#endif
+
+#include <atomic>
+
+@ac_google_start_namespace@
+
+ typedef std::int32_t int32;
+typedef std::uint32_t uint32;
+typedef std::int64_t int64;
+typedef std::uint64_t uint64;
+
+#if !(@ac_cv_have_ssize_t@)
+typedef ptrdiff_t ssize_t;
+#endif
+
+#if !(@ac_cv_have_mode_t@)
+typedef int mode_t;
+#endif
+
+typedef double WallTime;
+
+struct GLOG_EXPORT LogMessageTime {
+ LogMessageTime();
+ LogMessageTime(std::tm t);
+ LogMessageTime(std::time_t timestamp, WallTime now);
+
+ const time_t& timestamp() const { return timestamp_; }
+ const int& sec() const { return time_struct_.tm_sec; }
+ const int32_t& usec() const { return usecs_; }
+ const int&(min)() const { return time_struct_.tm_min; }
+ const int& hour() const { return time_struct_.tm_hour; }
+ const int& day() const { return time_struct_.tm_mday; }
+ const int& month() const { return time_struct_.tm_mon; }
+ const int& year() const { return time_struct_.tm_year; }
+ const int& dayOfWeek() const { return time_struct_.tm_wday; }
+ const int& dayInYear() const { return time_struct_.tm_yday; }
+ const int& dst() const { return time_struct_.tm_isdst; }
+ const long int& gmtoff() const { return gmtoffset_; }
+ const std::tm& tm() const { return time_struct_; }
+
+ private:
+ void init(const std::tm& t, std::time_t timestamp, WallTime now);
+ std::tm time_struct_; // Time of creation of LogMessage
+ time_t timestamp_; // Time of creation of LogMessage in seconds
+ int32_t usecs_; // Time of creation of LogMessage - microseconds part
+ long int gmtoffset_;
+
+ void CalcGmtOffset();
+};
+
+struct LogMessageInfo {
+ explicit LogMessageInfo(const char* const severity_,
+ const char* const filename_,
+ const int& line_number_,
+ const int& thread_id_,
+ const LogMessageTime& time_):
+ severity(severity_), filename(filename_), line_number(line_number_),
+ thread_id(thread_id_), time(time_)
+ {}
+
+ const char* const severity;
+ const char* const filename;
+ const int &line_number;
+ const int &thread_id;
+ const LogMessageTime& time;
+};
+
+typedef void(*CustomPrefixCallback)(std::ostream& s, const LogMessageInfo& l, void* data);
+
+@ac_google_end_namespace@
+
+
+// The global value of GOOGLE_STRIP_LOG. All the messages logged to
+// LOG(XXX) with severity less than GOOGLE_STRIP_LOG will not be displayed.
+// If it can be determined at compile time that the message will not be
+// printed, the statement will be compiled out.
+//
+// Example: to strip out all INFO and WARNING messages, use the value
+// of 2 below. To make an exception for WARNING messages from a single
+// file, add "#define GOOGLE_STRIP_LOG 1" to that file _before_ including
+// base/logging.h
+#ifndef GOOGLE_STRIP_LOG
+#define GOOGLE_STRIP_LOG 0
+#endif
+
+// GCC can be told that a certain branch is not likely to be taken (for
+// instance, a CHECK failure), and use that information in static analysis.
+// Giving it this information can help it optimize for the common case in
+// the absence of better information (ie. -fprofile-arcs).
+//
+#ifndef GOOGLE_PREDICT_BRANCH_NOT_TAKEN
+#if @ac_cv_have___builtin_expect@
+#define GOOGLE_PREDICT_BRANCH_NOT_TAKEN(x) (__builtin_expect(x, 0))
+#else
+#define GOOGLE_PREDICT_BRANCH_NOT_TAKEN(x) x
+#endif
+#endif
+
+#ifndef GOOGLE_PREDICT_FALSE
+#if @ac_cv_have___builtin_expect@
+#define GOOGLE_PREDICT_FALSE(x) (__builtin_expect(x, 0))
+#else
+#define GOOGLE_PREDICT_FALSE(x) x
+#endif
+#endif
+
+#ifndef GOOGLE_PREDICT_TRUE
+#if @ac_cv_have___builtin_expect@
+#define GOOGLE_PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
+#else
+#define GOOGLE_PREDICT_TRUE(x) x
+#endif
+#endif
+
+
+// Make a bunch of macros for logging. The way to log things is to stream
+// things to LOG(<a particular severity level>). E.g.,
+//
+// LOG(INFO) << "Found " << num_cookies << " cookies";
+//
+// You can capture log messages in a string, rather than reporting them
+// immediately:
+//
+// vector<string> errors;
+// LOG_STRING(ERROR, &errors) << "Couldn't parse cookie #" << cookie_num;
+//
+// This pushes back the new error onto 'errors'; if given a NULL pointer,
+// it reports the error via LOG(ERROR).
+//
+// You can also do conditional logging:
+//
+// LOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
+//
+// You can also do occasional logging (log every n'th occurrence of an
+// event):
+//
+// LOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie";
+//
+// The above will cause log messages to be output on the 1st, 11th, 21st, ...
+// times it is executed. Note that the special google::COUNTER value is used
+// to identify which repetition is happening.
+//
+// You can also do occasional conditional logging (log every n'th
+// occurrence of an event, when condition is satisfied):
+//
+// LOG_IF_EVERY_N(INFO, (size > 1024), 10) << "Got the " << google::COUNTER
+// << "th big cookie";
+//
+// You can log messages the first N times your code executes a line. E.g.
+//
+// LOG_FIRST_N(INFO, 20) << "Got the " << google::COUNTER << "th cookie";
+//
+// Outputs log messages for the first 20 times it is executed.
+//
+// Analogous SYSLOG, SYSLOG_IF, and SYSLOG_EVERY_N macros are available.
+// These log to syslog as well as to the normal logs. If you use these at
+// all, you need to be aware that syslog can drastically reduce performance,
+// especially if it is configured for remote logging! Don't use these
+// unless you fully understand this and have a concrete need to use them.
+// Even then, try to minimize your use of them.
+//
+// There are also "debug mode" logging macros like the ones above:
+//
+// DLOG(INFO) << "Found cookies";
+//
+// DLOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
+//
+// DLOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie";
+//
+// All "debug mode" logging is compiled away to nothing for non-debug mode
+// compiles.
+//
+// We also have
+//
+// LOG_ASSERT(assertion);
+// DLOG_ASSERT(assertion);
+//
+// which is syntactic sugar for {,D}LOG_IF(FATAL, assert fails) << assertion;
+//
+// There are "verbose level" logging macros. They look like
+//
+// VLOG(1) << "I'm printed when you run the program with --v=1 or more";
+// VLOG(2) << "I'm printed when you run the program with --v=2 or more";
+//
+// These always log at the INFO log level (when they log at all).
+// The verbose logging can also be turned on module-by-module. For instance,
+// --vmodule=mapreduce=2,file=1,gfs*=3 --v=0
+// will cause:
+// a. VLOG(2) and lower messages to be printed from mapreduce.{h,cc}
+// b. VLOG(1) and lower messages to be printed from file.{h,cc}
+// c. VLOG(3) and lower messages to be printed from files prefixed with "gfs"
+// d. VLOG(0) and lower messages to be printed from elsewhere
+//
+// The wildcarding functionality shown by (c) supports both '*' (match
+// 0 or more characters) and '?' (match any single character) wildcards.
+//
+// There's also VLOG_IS_ON(n) "verbose level" condition macro. To be used as
+//
+// if (VLOG_IS_ON(2)) {
+// // do some logging preparation and logging
+// // that can't be accomplished with just VLOG(2) << ...;
+// }
+//
+// There are also VLOG_IF, VLOG_EVERY_N and VLOG_IF_EVERY_N "verbose level"
+// condition macros for sample cases, when some extra computation and
+// preparation for logs is not needed.
+// VLOG_IF(1, (size > 1024))
+// << "I'm printed when size is more than 1024 and when you run the "
+// "program with --v=1 or more";
+// VLOG_EVERY_N(1, 10)
+// << "I'm printed every 10th occurrence, and when you run the program "
+// "with --v=1 or more. Present occurence is " << google::COUNTER;
+// VLOG_IF_EVERY_N(1, (size > 1024), 10)
+// << "I'm printed on every 10th occurence of case when size is more "
+// " than 1024, when you run the program with --v=1 or more. ";
+// "Present occurence is " << google::COUNTER;
+//
+// The supported severity levels for macros that allow you to specify one
+// are (in increasing order of severity) INFO, WARNING, ERROR, and FATAL.
+// Note that messages of a given severity are logged not only in the
+// logfile for that severity, but also in all logfiles of lower severity.
+// E.g., a message of severity FATAL will be logged to the logfiles of
+// severity FATAL, ERROR, WARNING, and INFO.
+//
+// There is also the special severity of DFATAL, which logs FATAL in
+// debug mode, ERROR in normal mode.
+//
+// Very important: logging a message at the FATAL severity level causes
+// the program to terminate (after the message is logged).
+//
+// Unless otherwise specified, logs will be written to the filename
+// "<program name>.<hostname>.<user name>.log.<severity level>.", followed
+// by the date, time, and pid (you can't prevent the date, time, and pid
+// from being in the filename).
+//
+// The logging code takes two flags:
+// --v=# set the verbose level
+// --logtostderr log all the messages to stderr instead of to logfiles
+
+// LOG LINE PREFIX FORMAT
+//
+// Log lines have this form:
+//
+// Lyyyymmdd hh:mm:ss.uuuuuu threadid file:line] msg...
+//
+// where the fields are defined as follows:
+//
+// L A single character, representing the log level
+// (eg 'I' for INFO)
+// yyyy The year
+// mm The month (zero padded; ie May is '05')
+// dd The day (zero padded)
+// hh:mm:ss.uuuuuu Time in hours, minutes and fractional seconds
+// threadid The space-padded thread ID as returned by GetTID()
+// (this matches the PID on Linux)
+// file The file name
+// line The line number
+// msg The user-supplied message
+//
+// Example:
+//
+// I1103 11:57:31.739339 24395 google.cc:2341] Command line: ./some_prog
+// I1103 11:57:31.739403 24395 google.cc:2342] Process id 24395
+//
+// NOTE: although the microseconds are useful for comparing events on
+// a single machine, clocks on different machines may not be well
+// synchronized. Hence, use caution when comparing the low bits of
+// timestamps from different machines.
+
+#pragma push_macro("DECLARE_VARIABLE")
+#pragma push_macro("DECLARE_bool")
+#pragma push_macro("DECLARE_string")
+#pragma push_macro("DECLARE_int32")
+#pragma push_macro("DECLARE_uint32")
+
+#ifdef DECLARE_VARIABLE
+#undef DECLARE_VARIABLE
+#endif
+
+#ifdef DECLARE_bool
+#undef DECLARE_bool
+#endif
+
+#ifdef DECLARE_string
+#undef DECLARE_string
+#endif
+
+#ifdef DECLARE_int32
+#undef DECLARE_int32
+#endif
+
+#ifdef DECLARE_uint32
+#undef DECLARE_uint32
+#endif
+
+#ifndef DECLARE_VARIABLE
+#define DECLARE_VARIABLE(type, shorttype, name, tn) \
+ namespace fL##shorttype { \
+ extern GLOG_EXPORT type FLAGS_##name; \
+ } \
+ using fL##shorttype::FLAGS_##name
+
+// bool specialization
+#define DECLARE_bool(name) \
+ DECLARE_VARIABLE(bool, B, name, bool)
+
+// int32 specialization
+#define DECLARE_int32(name) \
+ DECLARE_VARIABLE(@ac_google_namespace@::int32, I, name, int32)
+
+#if !defined(DECLARE_uint32)
+// uint32 specialization
+#define DECLARE_uint32(name) \
+ DECLARE_VARIABLE(@ac_google_namespace@::uint32, U, name, uint32)
+#endif // !defined(DECLARE_uint32) && !(@ac_cv_have_libgflags@)
+
+// Special case for string, because we have to specify the namespace
+// std::string, which doesn't play nicely with our FLAG__namespace hackery.
+#define DECLARE_string(name) \
+ namespace fLS { \
+ extern GLOG_EXPORT std::string& FLAGS_##name; \
+ } \
+ using fLS::FLAGS_##name
+#endif
+
+// Set whether appending a timestamp to the log file name
+DECLARE_bool(timestamp_in_logfile_name);
+
+// Set whether log messages go to stdout instead of logfiles
+DECLARE_bool(logtostdout);
+
+// Set color messages logged to stdout (if supported by terminal).
+DECLARE_bool(colorlogtostdout);
+
+// Set whether log messages go to stderr instead of logfiles
+DECLARE_bool(logtostderr);
+
+// Set whether log messages go to stderr in addition to logfiles.
+DECLARE_bool(alsologtostderr);
+
+// Set color messages logged to stderr (if supported by terminal).
+DECLARE_bool(colorlogtostderr);
+
+// Log messages at a level >= this flag are automatically sent to
+// stderr in addition to log files.
+DECLARE_int32(stderrthreshold);
+
+// Set whether the log file header should be written upon creating a file.
+DECLARE_bool(log_file_header);
+
+// Set whether the log prefix should be prepended to each line of output.
+DECLARE_bool(log_prefix);
+
+// Set whether the year should be included in the log prefix.
+DECLARE_bool(log_year_in_prefix);
+
+// Log messages at a level <= this flag are buffered.
+// Log messages at a higher level are flushed immediately.
+DECLARE_int32(logbuflevel);
+
+// Sets the maximum number of seconds which logs may be buffered for.
+DECLARE_int32(logbufsecs);
+
+// Log suppression level: messages logged at a lower level than this
+// are suppressed.
+DECLARE_int32(minloglevel);
+
+// If specified, logfiles are written into this directory instead of the
+// default logging directory.
+DECLARE_string(log_dir);
+
+// Set the log file mode.
+DECLARE_int32(logfile_mode);
+
+// Sets the path of the directory into which to put additional links
+// to the log files.
+DECLARE_string(log_link);
+
+DECLARE_int32(v); // in vlog_is_on.cc
+
+DECLARE_string(vmodule); // also in vlog_is_on.cc
+
+// Sets the maximum log file size (in MB).
+DECLARE_uint32(max_log_size);
+
+// Sets whether to avoid logging to the disk if the disk is full.
+DECLARE_bool(stop_logging_if_full_disk);
+
+// Use UTC time for logging
+DECLARE_bool(log_utc_time);
+
+// Log messages below the GOOGLE_STRIP_LOG level will be compiled away for
+// security reasons. See LOG(severtiy) below.
+
+// A few definitions of macros that don't generate much code. Since
+// LOG(INFO) and its ilk are used all over our code, it's
+// better to have compact code for these operations.
+
+#if GOOGLE_STRIP_LOG == 0
+#define COMPACT_GOOGLE_LOG_INFO @ac_google_namespace@::LogMessage( \
+ __FILE__, __LINE__)
+#define LOG_TO_STRING_INFO(message) @ac_google_namespace@::LogMessage( \
+ __FILE__, __LINE__, @ac_google_namespace@::GLOG_INFO, message)
+#else
+#define COMPACT_GOOGLE_LOG_INFO @ac_google_namespace@::NullStream()
+#define LOG_TO_STRING_INFO(message) @ac_google_namespace@::NullStream()
+#endif
+
+#if GOOGLE_STRIP_LOG <= 1
+#define COMPACT_GOOGLE_LOG_WARNING @ac_google_namespace@::LogMessage( \
+ __FILE__, __LINE__, @ac_google_namespace@::GLOG_WARNING)
+#define LOG_TO_STRING_WARNING(message) @ac_google_namespace@::LogMessage( \
+ __FILE__, __LINE__, @ac_google_namespace@::GLOG_WARNING, message)
+#else
+#define COMPACT_GOOGLE_LOG_WARNING @ac_google_namespace@::NullStream()
+#define LOG_TO_STRING_WARNING(message) @ac_google_namespace@::NullStream()
+#endif
+
+#if GOOGLE_STRIP_LOG <= 2
+#define COMPACT_GOOGLE_LOG_ERROR @ac_google_namespace@::LogMessage( \
+ __FILE__, __LINE__, @ac_google_namespace@::GLOG_ERROR)
+#define LOG_TO_STRING_ERROR(message) @ac_google_namespace@::LogMessage( \
+ __FILE__, __LINE__, @ac_google_namespace@::GLOG_ERROR, message)
+#else
+#define COMPACT_GOOGLE_LOG_ERROR @ac_google_namespace@::NullStream()
+#define LOG_TO_STRING_ERROR(message) @ac_google_namespace@::NullStream()
+#endif
+
+#if GOOGLE_STRIP_LOG <= 3
+#define COMPACT_GOOGLE_LOG_FATAL @ac_google_namespace@::LogMessageFatal( \
+ __FILE__, __LINE__)
+#define LOG_TO_STRING_FATAL(message) @ac_google_namespace@::LogMessage( \
+ __FILE__, __LINE__, @ac_google_namespace@::GLOG_FATAL, message)
+#else
+#define COMPACT_GOOGLE_LOG_FATAL @ac_google_namespace@::NullStreamFatal()
+#define LOG_TO_STRING_FATAL(message) @ac_google_namespace@::NullStreamFatal()
+#endif
+
+#if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
+#define DCHECK_IS_ON() 0
+#else
+#define DCHECK_IS_ON() 1
+#endif
+
+// For DFATAL, we want to use LogMessage (as opposed to
+// LogMessageFatal), to be consistent with the original behavior.
+#if !DCHECK_IS_ON()
+#define COMPACT_GOOGLE_LOG_DFATAL COMPACT_GOOGLE_LOG_ERROR
+#elif GOOGLE_STRIP_LOG <= 3
+#define COMPACT_GOOGLE_LOG_DFATAL @ac_google_namespace@::LogMessage( \
+ __FILE__, __LINE__, @ac_google_namespace@::GLOG_FATAL)
+#else
+#define COMPACT_GOOGLE_LOG_DFATAL @ac_google_namespace@::NullStreamFatal()
+#endif
+
+#define GOOGLE_LOG_INFO(counter) @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_INFO, counter, &@ac_google_namespace@::LogMessage::SendToLog)
+#define SYSLOG_INFO(counter) \
+ @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_INFO, counter, \
+ &@ac_google_namespace@::LogMessage::SendToSyslogAndLog)
+#define GOOGLE_LOG_WARNING(counter) \
+ @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_WARNING, counter, \
+ &@ac_google_namespace@::LogMessage::SendToLog)
+#define SYSLOG_WARNING(counter) \
+ @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_WARNING, counter, \
+ &@ac_google_namespace@::LogMessage::SendToSyslogAndLog)
+#define GOOGLE_LOG_ERROR(counter) \
+ @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_ERROR, counter, \
+ &@ac_google_namespace@::LogMessage::SendToLog)
+#define SYSLOG_ERROR(counter) \
+ @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_ERROR, counter, \
+ &@ac_google_namespace@::LogMessage::SendToSyslogAndLog)
+#define GOOGLE_LOG_FATAL(counter) \
+ @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_FATAL, counter, \
+ &@ac_google_namespace@::LogMessage::SendToLog)
+#define SYSLOG_FATAL(counter) \
+ @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_FATAL, counter, \
+ &@ac_google_namespace@::LogMessage::SendToSyslogAndLog)
+#define GOOGLE_LOG_DFATAL(counter) \
+ @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::DFATAL_LEVEL, counter, \
+ &@ac_google_namespace@::LogMessage::SendToLog)
+#define SYSLOG_DFATAL(counter) \
+ @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::DFATAL_LEVEL, counter, \
+ &@ac_google_namespace@::LogMessage::SendToSyslogAndLog)
+
+#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) || defined(__CYGWIN32__)
+// A very useful logging macro to log windows errors:
+#define LOG_SYSRESULT(result) \
+ if (FAILED(HRESULT_FROM_WIN32(result))) { \
+ LPSTR message = NULL; \
+ LPSTR msg = reinterpret_cast<LPSTR>(&message); \
+ DWORD message_length = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | \
+ FORMAT_MESSAGE_FROM_SYSTEM | \
+ FORMAT_MESSAGE_IGNORE_INSERTS, \
+ 0, result, 0, msg, 100, NULL); \
+ if (message_length > 0) { \
+ @ac_google_namespace@::LogMessage(__FILE__, __LINE__, @ac_google_namespace@::GLOG_ERROR, 0, \
+ &@ac_google_namespace@::LogMessage::SendToLog).stream() \
+ << reinterpret_cast<const char*>(message); \
+ LocalFree(message); \
+ } \
+ }
+#endif
+
+// We use the preprocessor's merging operator, "##", so that, e.g.,
+// LOG(INFO) becomes the token GOOGLE_LOG_INFO. There's some funny
+// subtle difference between ostream member streaming functions (e.g.,
+// ostream::operator<<(int) and ostream non-member streaming functions
+// (e.g., ::operator<<(ostream&, string&): it turns out that it's
+// impossible to stream something like a string directly to an unnamed
+// ostream. We employ a neat hack by calling the stream() member
+// function of LogMessage which seems to avoid the problem.
+#define LOG(severity) COMPACT_GOOGLE_LOG_ ## severity.stream()
+#define SYSLOG(severity) SYSLOG_ ## severity(0).stream()
+
+@ac_google_start_namespace@
+
+// They need the definitions of integer types.
+#include <glog/log_severity.h>
+#include <glog/vlog_is_on.h>
+
+// Initialize google's logging library. You will see the program name
+// specified by argv0 in log outputs.
+GLOG_EXPORT void InitGoogleLogging(const char* argv0);
+
+GLOG_EXPORT void InitGoogleLogging(const char* argv0,
+ CustomPrefixCallback prefix_callback,
+ void* prefix_callback_data = NULL);
+
+// Check if google's logging library has been initialized.
+GLOG_EXPORT bool IsGoogleLoggingInitialized();
+
+// Shutdown google's logging library.
+GLOG_EXPORT void ShutdownGoogleLogging();
+
+#if defined(__GNUC__)
+typedef void (*logging_fail_func_t)() __attribute__((noreturn));
+#else
+typedef void (*logging_fail_func_t)();
+#endif
+
+// Install a function which will be called after LOG(FATAL).
+GLOG_EXPORT void InstallFailureFunction(logging_fail_func_t fail_func);
+
+// Enable/Disable old log cleaner.
+GLOG_EXPORT void EnableLogCleaner(unsigned int overdue_days);
+GLOG_EXPORT void DisableLogCleaner();
+GLOG_EXPORT void SetApplicationFingerprint(const std::string& fingerprint);
+
+class LogSink; // defined below
+
+// If a non-NULL sink pointer is given, we push this message to that sink.
+// For LOG_TO_SINK we then do normal LOG(severity) logging as well.
+// This is useful for capturing messages and passing/storing them
+// somewhere more specific than the global log of the process.
+// Argument types:
+// LogSink* sink;
+// LogSeverity severity;
+// The cast is to disambiguate NULL arguments.
+#define LOG_TO_SINK(sink, severity) \
+ @ac_google_namespace@::LogMessage( \
+ __FILE__, __LINE__, \
+ @ac_google_namespace@::GLOG_ ## severity, \
+ static_cast<@ac_google_namespace@::LogSink*>(sink), true).stream()
+#define LOG_TO_SINK_BUT_NOT_TO_LOGFILE(sink, severity) \
+ @ac_google_namespace@::LogMessage( \
+ __FILE__, __LINE__, \
+ @ac_google_namespace@::GLOG_ ## severity, \
+ static_cast<@ac_google_namespace@::LogSink*>(sink), false).stream()
+
+// If a non-NULL string pointer is given, we write this message to that string.
+// We then do normal LOG(severity) logging as well.
+// This is useful for capturing messages and storing them somewhere more
+// specific than the global log of the process.
+// Argument types:
+// string* message;
+// LogSeverity severity;
+// The cast is to disambiguate NULL arguments.
+// NOTE: LOG(severity) expands to LogMessage().stream() for the specified
+// severity.
+#define LOG_TO_STRING(severity, message) \
+ LOG_TO_STRING_##severity(static_cast<std::string*>(message)).stream()
+
+// If a non-NULL pointer is given, we push the message onto the end
+// of a vector of strings; otherwise, we report it with LOG(severity).
+// This is handy for capturing messages and perhaps passing them back
+// to the caller, rather than reporting them immediately.
+// Argument types:
+// LogSeverity severity;
+// vector<string> *outvec;
+// The cast is to disambiguate NULL arguments.
+#define LOG_STRING(severity, outvec) \
+ LOG_TO_STRING_##severity(static_cast<std::vector<std::string>*>(outvec)).stream()
+
+#define LOG_IF(severity, condition) \
+ static_cast<void>(0), \
+ !(condition) ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity)
+#define SYSLOG_IF(severity, condition) \
+ static_cast<void>(0), \
+ !(condition) ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & SYSLOG(severity)
+
+#define LOG_ASSERT(condition) \
+ LOG_IF(FATAL, !(condition)) << "Assert failed: " #condition
+#define SYSLOG_ASSERT(condition) \
+ SYSLOG_IF(FATAL, !(condition)) << "Assert failed: " #condition
+
+// CHECK dies with a fatal error if condition is not true. It is *not*
+// controlled by DCHECK_IS_ON(), so the check will be executed regardless of
+// compilation mode. Therefore, it is safe to do things like:
+// CHECK(fp->Write(x) == 4)
+#define CHECK(condition) \
+ LOG_IF(FATAL, GOOGLE_PREDICT_BRANCH_NOT_TAKEN(!(condition))) \
+ << "Check failed: " #condition " "
+
+// A container for a string pointer which can be evaluated to a bool -
+// true iff the pointer is NULL.
+struct CheckOpString {
+ CheckOpString(std::string* str) : str_(str) { }
+ // No destructor: if str_ is non-NULL, we're about to LOG(FATAL),
+ // so there's no point in cleaning up str_.
+ operator bool() const {
+ return GOOGLE_PREDICT_BRANCH_NOT_TAKEN(str_ != NULL);
+ }
+ std::string* str_;
+};
+
+// Function is overloaded for integral types to allow static const
+// integrals declared in classes and not defined to be used as arguments to
+// CHECK* macros. It's not encouraged though.
+template <class T>
+inline const T& GetReferenceableValue(const T& t) { return t; }
+inline char GetReferenceableValue(char t) { return t; }
+inline unsigned char GetReferenceableValue(unsigned char t) { return t; }
+inline signed char GetReferenceableValue(signed char t) { return t; }
+inline short GetReferenceableValue(short t) { return t; }
+inline unsigned short GetReferenceableValue(unsigned short t) { return t; }
+inline int GetReferenceableValue(int t) { return t; }
+inline unsigned int GetReferenceableValue(unsigned int t) { return t; }
+inline long GetReferenceableValue(long t) { return t; }
+inline unsigned long GetReferenceableValue(unsigned long t) { return t; }
+inline long long GetReferenceableValue(long long t) { return t; }
+inline unsigned long long GetReferenceableValue(unsigned long long t) {
+ return t;
+}
+
+// This is a dummy class to define the following operator.
+struct DummyClassToDefineOperator {};
+
+@ac_google_end_namespace@
+
+// Define global operator<< to declare using ::operator<<.
+// This declaration will allow use to use CHECK macros for user
+// defined classes which have operator<< (e.g., stl_logging.h).
+inline std::ostream& operator<<(
+ std::ostream& out, const google::DummyClassToDefineOperator&) {
+ return out;
+}
+
+@ac_google_start_namespace@
+
+// This formats a value for a failing CHECK_XX statement. Ordinarily,
+// it uses the definition for operator<<, with a few special cases below.
+template <typename T>
+inline void MakeCheckOpValueString(std::ostream* os, const T& v) {
+ (*os) << v;
+}
+
+// Overrides for char types provide readable values for unprintable
+// characters.
+template <> GLOG_EXPORT
+void MakeCheckOpValueString(std::ostream* os, const char& v);
+template <> GLOG_EXPORT
+void MakeCheckOpValueString(std::ostream* os, const signed char& v);
+template <> GLOG_EXPORT
+void MakeCheckOpValueString(std::ostream* os, const unsigned char& v);
+
+// Provide printable value for nullptr_t
+template <>
+GLOG_EXPORT void MakeCheckOpValueString(std::ostream* os,
+ const std::nullptr_t& v);
+
+// Build the error message string. Specify no inlining for code size.
+template <typename T1, typename T2>
+std::string* MakeCheckOpString(const T1& v1, const T2& v2, const char* exprtext)
+ @ac_cv___attribute___noinline@;
+
+namespace base {
+namespace internal {
+
+// If "s" is less than base_logging::INFO, returns base_logging::INFO.
+// If "s" is greater than base_logging::FATAL, returns
+// base_logging::ERROR. Otherwise, returns "s".
+LogSeverity NormalizeSeverity(LogSeverity s);
+
+} // namespace internal
+
+// A helper class for formatting "expr (V1 vs. V2)" in a CHECK_XX
+// statement. See MakeCheckOpString for sample usage. Other
+// approaches were considered: use of a template method (e.g.,
+// base::BuildCheckOpString(exprtext, base::Print<T1>, &v1,
+// base::Print<T2>, &v2), however this approach has complications
+// related to volatile arguments and function-pointer arguments).
+class GLOG_EXPORT CheckOpMessageBuilder {
+ public:
+ // Inserts "exprtext" and " (" to the stream.
+ explicit CheckOpMessageBuilder(const char *exprtext);
+ // Deletes "stream_".
+ ~CheckOpMessageBuilder();
+ // For inserting the first variable.
+ std::ostream* ForVar1() { return stream_; }
+ // For inserting the second variable (adds an intermediate " vs. ").
+ std::ostream* ForVar2();
+ // Get the result (inserts the closing ")").
+ std::string* NewString();
+
+ private:
+ std::ostringstream *stream_;
+};
+
+} // namespace base
+
+template <typename T1, typename T2>
+std::string* MakeCheckOpString(const T1& v1, const T2& v2, const char* exprtext) {
+ base::CheckOpMessageBuilder comb(exprtext);
+ MakeCheckOpValueString(comb.ForVar1(), v1);
+ MakeCheckOpValueString(comb.ForVar2(), v2);
+ return comb.NewString();
+}
+
+// Helper functions for CHECK_OP macro.
+// The (int, int) specialization works around the issue that the compiler
+// will not instantiate the template version of the function on values of
+// unnamed enum type - see comment below.
+#define DEFINE_CHECK_OP_IMPL(name, op) \
+ template <typename T1, typename T2> \
+ inline std::string* name##Impl(const T1& v1, const T2& v2, \
+ const char* exprtext) { \
+ if (GOOGLE_PREDICT_TRUE(v1 op v2)) return NULL; \
+ else return MakeCheckOpString(v1, v2, exprtext); \
+ } \
+ inline std::string* name##Impl(int v1, int v2, const char* exprtext) { \
+ return name##Impl<int, int>(v1, v2, exprtext); \
+ }
+
+// We use the full name Check_EQ, Check_NE, etc. in case the file including
+// base/logging.h provides its own #defines for the simpler names EQ, NE, etc.
+// This happens if, for example, those are used as token names in a
+// yacc grammar.
+DEFINE_CHECK_OP_IMPL(Check_EQ, ==) // Compilation error with CHECK_EQ(NULL, x)?
+DEFINE_CHECK_OP_IMPL(Check_NE, !=) // Use CHECK(x == NULL) instead.
+DEFINE_CHECK_OP_IMPL(Check_LE, <=)
+DEFINE_CHECK_OP_IMPL(Check_LT, < )
+DEFINE_CHECK_OP_IMPL(Check_GE, >=)
+DEFINE_CHECK_OP_IMPL(Check_GT, > )
+#undef DEFINE_CHECK_OP_IMPL
+
+// Helper macro for binary operators.
+// Don't use this macro directly in your code, use CHECK_EQ et al below.
+
+#if defined(STATIC_ANALYSIS)
+// Only for static analysis tool to know that it is equivalent to assert
+#define CHECK_OP_LOG(name, op, val1, val2, log) CHECK((val1) op (val2))
+#elif DCHECK_IS_ON()
+// In debug mode, avoid constructing CheckOpStrings if possible,
+// to reduce the overhead of CHECK statments by 2x.
+// Real DCHECK-heavy tests have seen 1.5x speedups.
+
+// The meaning of "string" might be different between now and
+// when this macro gets invoked (e.g., if someone is experimenting
+// with other string implementations that get defined after this
+// file is included). Save the current meaning now and use it
+// in the macro.
+typedef std::string _Check_string;
+#define CHECK_OP_LOG(name, op, val1, val2, log) \
+ while (@ac_google_namespace@::_Check_string* _result = \
+ @ac_google_namespace@::Check##name##Impl( \
+ @ac_google_namespace@::GetReferenceableValue(val1), \
+ @ac_google_namespace@::GetReferenceableValue(val2), \
+ #val1 " " #op " " #val2)) \
+ log(__FILE__, __LINE__, \
+ @ac_google_namespace@::CheckOpString(_result)).stream()
+#else
+// In optimized mode, use CheckOpString to hint to compiler that
+// the while condition is unlikely.
+#define CHECK_OP_LOG(name, op, val1, val2, log) \
+ while (@ac_google_namespace@::CheckOpString _result = \
+ @ac_google_namespace@::Check##name##Impl( \
+ @ac_google_namespace@::GetReferenceableValue(val1), \
+ @ac_google_namespace@::GetReferenceableValue(val2), \
+ #val1 " " #op " " #val2)) \
+ log(__FILE__, __LINE__, _result).stream()
+#endif // STATIC_ANALYSIS, DCHECK_IS_ON()
+
+#if GOOGLE_STRIP_LOG <= 3
+#define CHECK_OP(name, op, val1, val2) \
+ CHECK_OP_LOG(name, op, val1, val2, @ac_google_namespace@::LogMessageFatal)
+#else
+#define CHECK_OP(name, op, val1, val2) \
+ CHECK_OP_LOG(name, op, val1, val2, @ac_google_namespace@::NullStreamFatal)
+#endif // STRIP_LOG <= 3
+
+// Equality/Inequality checks - compare two values, and log a FATAL message
+// including the two values when the result is not as expected. The values
+// must have operator<<(ostream, ...) defined.
+//
+// You may append to the error message like so:
+// CHECK_NE(1, 2) << ": The world must be ending!";
+//
+// We are very careful to ensure that each argument is evaluated exactly
+// once, and that anything which is legal to pass as a function argument is
+// legal here. In particular, the arguments may be temporary expressions
+// which will end up being destroyed at the end of the apparent statement,
+// for example:
+// CHECK_EQ(string("abc")[1], 'b');
+//
+// WARNING: These don't compile correctly if one of the arguments is a pointer
+// and the other is NULL. To work around this, simply static_cast NULL to the
+// type of the desired pointer.
+
+#define CHECK_EQ(val1, val2) CHECK_OP(_EQ, ==, val1, val2)
+#define CHECK_NE(val1, val2) CHECK_OP(_NE, !=, val1, val2)
+#define CHECK_LE(val1, val2) CHECK_OP(_LE, <=, val1, val2)
+#define CHECK_LT(val1, val2) CHECK_OP(_LT, < , val1, val2)
+#define CHECK_GE(val1, val2) CHECK_OP(_GE, >=, val1, val2)
+#define CHECK_GT(val1, val2) CHECK_OP(_GT, > , val1, val2)
+
+// Check that the input is non NULL. This very useful in constructor
+// initializer lists.
+
+#define CHECK_NOTNULL(val) \
+ @ac_google_namespace@::CheckNotNull(__FILE__, __LINE__, "'" #val "' Must be non NULL", (val))
+
+// Helper functions for string comparisons.
+// To avoid bloat, the definitions are in logging.cc.
+#define DECLARE_CHECK_STROP_IMPL(func, expected) \
+ GLOG_EXPORT std::string* Check##func##expected##Impl( \
+ const char* s1, const char* s2, const char* names);
+DECLARE_CHECK_STROP_IMPL(strcmp, true)
+DECLARE_CHECK_STROP_IMPL(strcmp, false)
+DECLARE_CHECK_STROP_IMPL(strcasecmp, true)
+DECLARE_CHECK_STROP_IMPL(strcasecmp, false)
+#undef DECLARE_CHECK_STROP_IMPL
+
+// Helper macro for string comparisons.
+// Don't use this macro directly in your code, use CHECK_STREQ et al below.
+#define CHECK_STROP(func, op, expected, s1, s2) \
+ while (@ac_google_namespace@::CheckOpString _result = \
+ @ac_google_namespace@::Check##func##expected##Impl((s1), (s2), \
+ #s1 " " #op " " #s2)) \
+ LOG(FATAL) << *_result.str_
+
+
+// String (char*) equality/inequality checks.
+// CASE versions are case-insensitive.
+//
+// Note that "s1" and "s2" may be temporary strings which are destroyed
+// by the compiler at the end of the current "full expression"
+// (e.g. CHECK_STREQ(Foo().c_str(), Bar().c_str())).
+
+#define CHECK_STREQ(s1, s2) CHECK_STROP(strcmp, ==, true, s1, s2)
+#define CHECK_STRNE(s1, s2) CHECK_STROP(strcmp, !=, false, s1, s2)
+#define CHECK_STRCASEEQ(s1, s2) CHECK_STROP(strcasecmp, ==, true, s1, s2)
+#define CHECK_STRCASENE(s1, s2) CHECK_STROP(strcasecmp, !=, false, s1, s2)
+
+#define CHECK_INDEX(I,A) CHECK(I < (sizeof(A)/sizeof(A[0])))
+#define CHECK_BOUND(B,A) CHECK(B <= (sizeof(A)/sizeof(A[0])))
+
+#define CHECK_DOUBLE_EQ(val1, val2) \
+ do { \
+ CHECK_LE((val1), (val2)+0.000000000000001L); \
+ CHECK_GE((val1), (val2)-0.000000000000001L); \
+ } while (0)
+
+#define CHECK_NEAR(val1, val2, margin) \
+ do { \
+ CHECK_LE((val1), (val2)+(margin)); \
+ CHECK_GE((val1), (val2)-(margin)); \
+ } while (0)
+
+// perror()..googly style!
+//
+// PLOG() and PLOG_IF() and PCHECK() behave exactly like their LOG* and
+// CHECK equivalents with the addition that they postpend a description
+// of the current state of errno to their output lines.
+
+#define PLOG(severity) GOOGLE_PLOG(severity, 0).stream()
+
+#define GOOGLE_PLOG(severity, counter) \
+ @ac_google_namespace@::ErrnoLogMessage( \
+ __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity, counter, \
+ &@ac_google_namespace@::LogMessage::SendToLog)
+
+#define PLOG_IF(severity, condition) \
+ static_cast<void>(0), \
+ !(condition) ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & PLOG(severity)
+
+// A CHECK() macro that postpends errno if the condition is false. E.g.
+//
+// if (poll(fds, nfds, timeout) == -1) { PCHECK(errno == EINTR); ... }
+#define PCHECK(condition) \
+ PLOG_IF(FATAL, GOOGLE_PREDICT_BRANCH_NOT_TAKEN(!(condition))) \
+ << "Check failed: " #condition " "
+
+// A CHECK() macro that lets you assert the success of a function that
+// returns -1 and sets errno in case of an error. E.g.
+//
+// CHECK_ERR(mkdir(path, 0700));
+//
+// or
+//
+// int fd = open(filename, flags); CHECK_ERR(fd) << ": open " << filename;
+#define CHECK_ERR(invocation) \
+PLOG_IF(FATAL, GOOGLE_PREDICT_BRANCH_NOT_TAKEN((invocation) == -1)) \
+ << #invocation
+
+// Use macro expansion to create, for each use of LOG_EVERY_N(), static
+// variables with the __LINE__ expansion as part of the variable name.
+#define LOG_EVERY_N_VARNAME(base, line) LOG_EVERY_N_VARNAME_CONCAT(base, line)
+#define LOG_EVERY_N_VARNAME_CONCAT(base, line) base ## line
+
+#define LOG_OCCURRENCES LOG_EVERY_N_VARNAME(occurrences_, __LINE__)
+#define LOG_OCCURRENCES_MOD_N LOG_EVERY_N_VARNAME(occurrences_mod_n_, __LINE__)
+
+#define LOG_TIME_PERIOD LOG_EVERY_N_VARNAME(timePeriod_, __LINE__)
+#define LOG_PREVIOUS_TIME_RAW LOG_EVERY_N_VARNAME(previousTimeRaw_, __LINE__)
+#define LOG_TIME_DELTA LOG_EVERY_N_VARNAME(deltaTime_, __LINE__)
+#define LOG_CURRENT_TIME LOG_EVERY_N_VARNAME(currentTime_, __LINE__)
+#define LOG_PREVIOUS_TIME LOG_EVERY_N_VARNAME(previousTime_, __LINE__)
+
+#if defined(__has_feature)
+# if __has_feature(thread_sanitizer)
+# define GLOG_SANITIZE_THREAD 1
+# endif
+#endif
+
+#if !defined(GLOG_SANITIZE_THREAD) && defined(__SANITIZE_THREAD__) && __SANITIZE_THREAD__
+# define GLOG_SANITIZE_THREAD 1
+#endif
+
+#if defined(GLOG_SANITIZE_THREAD)
+#define GLOG_IFDEF_THREAD_SANITIZER(X) X
+#else
+#define GLOG_IFDEF_THREAD_SANITIZER(X)
+#endif
+
+#if defined(GLOG_SANITIZE_THREAD)
+} // namespace google
+
+// We need to identify the static variables as "benign" races
+// to avoid noisy reports from TSAN.
+extern "C" void AnnotateBenignRaceSized(
+ const char *file,
+ int line,
+ const volatile void *mem,
+ size_t size,
+ const char *description);
+
+namespace google {
+#endif
+
+#define SOME_KIND_OF_LOG_EVERY_T(severity, seconds) \
+ constexpr std::chrono::nanoseconds LOG_TIME_PERIOD = \
+ std::chrono::duration_cast<std::chrono::nanoseconds>( \
+ std::chrono::duration<double>(seconds)); \
+ static std::atomic<@ac_google_namespace@ ::int64> LOG_PREVIOUS_TIME_RAW; \
+ GLOG_IFDEF_THREAD_SANITIZER( \
+ AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_TIME_PERIOD, \
+ sizeof(@ac_google_namespace @ ::int64), "")); \
+ GLOG_IFDEF_THREAD_SANITIZER( \
+ AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_PREVIOUS_TIME_RAW, \
+ sizeof(@ac_google_namespace @ ::int64), "")); \
+ const auto LOG_CURRENT_TIME = \
+ std::chrono::duration_cast<std::chrono::nanoseconds>( \
+ std::chrono::steady_clock::now().time_since_epoch()); \
+ const auto LOG_PREVIOUS_TIME = \
+ LOG_PREVIOUS_TIME_RAW.load(std::memory_order_relaxed); \
+ const auto LOG_TIME_DELTA = \
+ LOG_CURRENT_TIME - std::chrono::nanoseconds(LOG_PREVIOUS_TIME); \
+ if (LOG_TIME_DELTA > LOG_TIME_PERIOD) \
+ LOG_PREVIOUS_TIME_RAW.store( \
+ std::chrono::duration_cast<std::chrono::nanoseconds>(LOG_CURRENT_TIME) \
+ .count(), \
+ std::memory_order_relaxed); \
+ if (LOG_TIME_DELTA > LOG_TIME_PERIOD) \
+ @ac_google_namespace@ ::LogMessage( \
+ __FILE__, __LINE__, @ac_google_namespace@ ::GLOG_##severity) \
+ .stream()
+
+#define SOME_KIND_OF_LOG_EVERY_N(severity, n, what_to_do) \
+ static std::atomic<int> LOG_OCCURRENCES(0), LOG_OCCURRENCES_MOD_N(0); \
+ GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES, sizeof(int), "")); \
+ GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES_MOD_N, sizeof(int), "")); \
+ ++LOG_OCCURRENCES; \
+ if (++LOG_OCCURRENCES_MOD_N > n) LOG_OCCURRENCES_MOD_N -= n; \
+ if (LOG_OCCURRENCES_MOD_N == 1) \
+ @ac_google_namespace@::LogMessage( \
+ __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity, LOG_OCCURRENCES, \
+ &what_to_do).stream()
+
+#define SOME_KIND_OF_LOG_IF_EVERY_N(severity, condition, n, what_to_do) \
+ static std::atomic<int> LOG_OCCURRENCES(0), LOG_OCCURRENCES_MOD_N(0); \
+ GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES, sizeof(int), "")); \
+ GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES_MOD_N, sizeof(int), "")); \
+ ++LOG_OCCURRENCES; \
+ if ((condition) && \
+ ((LOG_OCCURRENCES_MOD_N=(LOG_OCCURRENCES_MOD_N + 1) % n) == (1 % n))) \
+ @ac_google_namespace@::LogMessage( \
+ __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity, LOG_OCCURRENCES, \
+ &what_to_do).stream()
+
+#define SOME_KIND_OF_PLOG_EVERY_N(severity, n, what_to_do) \
+ static std::atomic<int> LOG_OCCURRENCES(0), LOG_OCCURRENCES_MOD_N(0); \
+ GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES, sizeof(int), "")); \
+ GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES_MOD_N, sizeof(int), "")); \
+ ++LOG_OCCURRENCES; \
+ if (++LOG_OCCURRENCES_MOD_N > n) LOG_OCCURRENCES_MOD_N -= n; \
+ if (LOG_OCCURRENCES_MOD_N == 1) \
+ @ac_google_namespace@::ErrnoLogMessage( \
+ __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity, LOG_OCCURRENCES, \
+ &what_to_do).stream()
+
+#define SOME_KIND_OF_LOG_FIRST_N(severity, n, what_to_do) \
+ static std::atomic<int> LOG_OCCURRENCES(0); \
+ GLOG_IFDEF_THREAD_SANITIZER(AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_OCCURRENCES, sizeof(int), "")); \
+ if (LOG_OCCURRENCES <= n) \
+ ++LOG_OCCURRENCES; \
+ if (LOG_OCCURRENCES <= n) \
+ @ac_google_namespace@::LogMessage( \
+ __FILE__, __LINE__, @ac_google_namespace@::GLOG_ ## severity, LOG_OCCURRENCES, \
+ &what_to_do).stream()
+
+namespace glog_internal_namespace_ {
+template <bool>
+struct CompileAssert {
+};
+struct CrashReason;
+
+// Returns true if FailureSignalHandler is installed.
+// Needs to be exported since it's used by the signalhandler_unittest.
+GLOG_EXPORT bool IsFailureSignalHandlerInstalled();
+} // namespace glog_internal_namespace_
+
+#define LOG_EVERY_N(severity, n) \
+ SOME_KIND_OF_LOG_EVERY_N(severity, (n), @ac_google_namespace@::LogMessage::SendToLog)
+
+#define LOG_EVERY_T(severity, T) SOME_KIND_OF_LOG_EVERY_T(severity, (T))
+
+#define SYSLOG_EVERY_N(severity, n) \
+ SOME_KIND_OF_LOG_EVERY_N(severity, (n), @ac_google_namespace@::LogMessage::SendToSyslogAndLog)
+
+#define PLOG_EVERY_N(severity, n) \
+ SOME_KIND_OF_PLOG_EVERY_N(severity, (n), @ac_google_namespace@::LogMessage::SendToLog)
+
+#define LOG_FIRST_N(severity, n) \
+ SOME_KIND_OF_LOG_FIRST_N(severity, (n), @ac_google_namespace@::LogMessage::SendToLog)
+
+#define LOG_IF_EVERY_N(severity, condition, n) \
+ SOME_KIND_OF_LOG_IF_EVERY_N(severity, (condition), (n), @ac_google_namespace@::LogMessage::SendToLog)
+
+// We want the special COUNTER value available for LOG_EVERY_X()'ed messages
+enum PRIVATE_Counter {COUNTER};
+
+#ifdef GLOG_NO_ABBREVIATED_SEVERITIES
+// wingdi.h defines ERROR to be 0. When we call LOG(ERROR), it gets
+// substituted with 0, and it expands to COMPACT_GOOGLE_LOG_0. To allow us
+// to keep using this syntax, we define this macro to do the same thing
+// as COMPACT_GOOGLE_LOG_ERROR.
+#define COMPACT_GOOGLE_LOG_0 COMPACT_GOOGLE_LOG_ERROR
+#define SYSLOG_0 SYSLOG_ERROR
+#define LOG_TO_STRING_0 LOG_TO_STRING_ERROR
+// Needed for LOG_IS_ON(ERROR).
+const LogSeverity GLOG_0 = GLOG_ERROR;
+#else
+// Users may include windows.h after logging.h without
+// GLOG_NO_ABBREVIATED_SEVERITIES nor WIN32_LEAN_AND_MEAN.
+// For this case, we cannot detect if ERROR is defined before users
+// actually use ERROR. Let's make an undefined symbol to warn users.
+# define GLOG_ERROR_MSG ERROR_macro_is_defined_Define_GLOG_NO_ABBREVIATED_SEVERITIES_before_including_logging_h_See_the_document_for_detail
+# define COMPACT_GOOGLE_LOG_0 GLOG_ERROR_MSG
+# define SYSLOG_0 GLOG_ERROR_MSG
+# define LOG_TO_STRING_0 GLOG_ERROR_MSG
+# define GLOG_0 GLOG_ERROR_MSG
+#endif
+
+// Plus some debug-logging macros that get compiled to nothing for production
+
+#if DCHECK_IS_ON()
+
+#define DLOG(severity) LOG(severity)
+#define DVLOG(verboselevel) VLOG(verboselevel)
+#define DLOG_IF(severity, condition) LOG_IF(severity, condition)
+#define DLOG_EVERY_N(severity, n) LOG_EVERY_N(severity, n)
+#define DLOG_IF_EVERY_N(severity, condition, n) \
+ LOG_IF_EVERY_N(severity, condition, n)
+#define DLOG_ASSERT(condition) LOG_ASSERT(condition)
+
+// debug-only checking. executed if DCHECK_IS_ON().
+#define DCHECK(condition) CHECK(condition)
+#define DCHECK_EQ(val1, val2) CHECK_EQ(val1, val2)
+#define DCHECK_NE(val1, val2) CHECK_NE(val1, val2)
+#define DCHECK_LE(val1, val2) CHECK_LE(val1, val2)
+#define DCHECK_LT(val1, val2) CHECK_LT(val1, val2)
+#define DCHECK_GE(val1, val2) CHECK_GE(val1, val2)
+#define DCHECK_GT(val1, val2) CHECK_GT(val1, val2)
+#define DCHECK_NOTNULL(val) CHECK_NOTNULL(val)
+#define DCHECK_STREQ(str1, str2) CHECK_STREQ(str1, str2)
+#define DCHECK_STRCASEEQ(str1, str2) CHECK_STRCASEEQ(str1, str2)
+#define DCHECK_STRNE(str1, str2) CHECK_STRNE(str1, str2)
+#define DCHECK_STRCASENE(str1, str2) CHECK_STRCASENE(str1, str2)
+
+#else // !DCHECK_IS_ON()
+
+#define DLOG(severity) \
+ static_cast<void>(0), \
+ true ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity)
+
+#define DVLOG(verboselevel) \
+ static_cast<void>(0), \
+ (true || !VLOG_IS_ON(verboselevel)) ? \
+ (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(INFO)
+
+#define DLOG_IF(severity, condition) \
+ static_cast<void>(0), \
+ (true || !(condition)) ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity)
+
+#define DLOG_EVERY_N(severity, n) \
+ static_cast<void>(0), \
+ true ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity)
+
+#define DLOG_IF_EVERY_N(severity, condition, n) \
+ static_cast<void>(0), \
+ (true || !(condition))? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity)
+
+#define DLOG_ASSERT(condition) \
+ static_cast<void>(0), \
+ true ? (void) 0 : LOG_ASSERT(condition)
+
+// MSVC warning C4127: conditional expression is constant
+#define DCHECK(condition) \
+ GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \
+ while (false) \
+ GLOG_MSVC_POP_WARNING() CHECK(condition)
+
+#define DCHECK_EQ(val1, val2) \
+ GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \
+ while (false) \
+ GLOG_MSVC_POP_WARNING() CHECK_EQ(val1, val2)
+
+#define DCHECK_NE(val1, val2) \
+ GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \
+ while (false) \
+ GLOG_MSVC_POP_WARNING() CHECK_NE(val1, val2)
+
+#define DCHECK_LE(val1, val2) \
+ GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \
+ while (false) \
+ GLOG_MSVC_POP_WARNING() CHECK_LE(val1, val2)
+
+#define DCHECK_LT(val1, val2) \
+ GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \
+ while (false) \
+ GLOG_MSVC_POP_WARNING() CHECK_LT(val1, val2)
+
+#define DCHECK_GE(val1, val2) \
+ GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \
+ while (false) \
+ GLOG_MSVC_POP_WARNING() CHECK_GE(val1, val2)
+
+#define DCHECK_GT(val1, val2) \
+ GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \
+ while (false) \
+ GLOG_MSVC_POP_WARNING() CHECK_GT(val1, val2)
+
+// You may see warnings in release mode if you don't use the return
+// value of DCHECK_NOTNULL. Please just use DCHECK for such cases.
+#define DCHECK_NOTNULL(val) (val)
+
+#define DCHECK_STREQ(str1, str2) \
+ GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \
+ while (false) \
+ GLOG_MSVC_POP_WARNING() CHECK_STREQ(str1, str2)
+
+#define DCHECK_STRCASEEQ(str1, str2) \
+ GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \
+ while (false) \
+ GLOG_MSVC_POP_WARNING() CHECK_STRCASEEQ(str1, str2)
+
+#define DCHECK_STRNE(str1, str2) \
+ GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \
+ while (false) \
+ GLOG_MSVC_POP_WARNING() CHECK_STRNE(str1, str2)
+
+#define DCHECK_STRCASENE(str1, str2) \
+ GLOG_MSVC_PUSH_DISABLE_WARNING(4127) \
+ while (false) \
+ GLOG_MSVC_POP_WARNING() CHECK_STRCASENE(str1, str2)
+
+#endif // DCHECK_IS_ON()
+
+// Log only in verbose mode.
+
+#define VLOG(verboselevel) LOG_IF(INFO, VLOG_IS_ON(verboselevel))
+
+#define VLOG_IF(verboselevel, condition) \
+ LOG_IF(INFO, (condition) && VLOG_IS_ON(verboselevel))
+
+#define VLOG_EVERY_N(verboselevel, n) \
+ LOG_IF_EVERY_N(INFO, VLOG_IS_ON(verboselevel), n)
+
+#define VLOG_IF_EVERY_N(verboselevel, condition, n) \
+ LOG_IF_EVERY_N(INFO, (condition) && VLOG_IS_ON(verboselevel), n)
+
+namespace base_logging {
+
+// LogMessage::LogStream is a std::ostream backed by this streambuf.
+// This class ignores overflow and leaves two bytes at the end of the
+// buffer to allow for a '\n' and '\0'.
+class GLOG_EXPORT LogStreamBuf : public std::streambuf {
+ public:
+ // REQUIREMENTS: "len" must be >= 2 to account for the '\n' and '\0'.
+ LogStreamBuf(char *buf, int len) {
+ setp(buf, buf + len - 2);
+ }
+
+ // This effectively ignores overflow.
+ int_type overflow(int_type ch) {
+ return ch;
+ }
+
+ // Legacy public ostrstream method.
+ size_t pcount() const { return static_cast<size_t>(pptr() - pbase()); }
+ char* pbase() const { return std::streambuf::pbase(); }
+};
+
+} // namespace base_logging
+
+//
+// This class more or less represents a particular log message. You
+// create an instance of LogMessage and then stream stuff to it.
+// When you finish streaming to it, ~LogMessage is called and the
+// full message gets streamed to the appropriate destination.
+//
+// You shouldn't actually use LogMessage's constructor to log things,
+// though. You should use the LOG() macro (and variants thereof)
+// above.
+class GLOG_EXPORT LogMessage {
+public:
+ enum {
+ // Passing kNoLogPrefix for the line number disables the
+ // log-message prefix. Useful for using the LogMessage
+ // infrastructure as a printing utility. See also the --log_prefix
+ // flag for controlling the log-message prefix on an
+ // application-wide basis.
+ kNoLogPrefix = -1
+ };
+
+ // LogStream inherit from non-DLL-exported class (std::ostrstream)
+ // and VC++ produces a warning for this situation.
+ // However, MSDN says "C4275 can be ignored in Microsoft Visual C++
+ // 2005 if you are deriving from a type in the Standard C++ Library"
+ // http://msdn.microsoft.com/en-us/library/3tdb471s(VS.80).aspx
+ // Let's just ignore the warning.
+GLOG_MSVC_PUSH_DISABLE_WARNING(4275)
+ class GLOG_EXPORT LogStream : public std::ostream {
+GLOG_MSVC_POP_WARNING()
+ public:
+ LogStream(char *buf, int len, int64 ctr)
+ : std::ostream(NULL),
+ streambuf_(buf, len),
+ ctr_(ctr),
+ self_(this) {
+ rdbuf(&streambuf_);
+ }
+
+ int64 ctr() const { return ctr_; }
+ void set_ctr(int64 ctr) { ctr_ = ctr; }
+ LogStream* self() const { return self_; }
+
+ // Legacy std::streambuf methods.
+ size_t pcount() const { return streambuf_.pcount(); }
+ char* pbase() const { return streambuf_.pbase(); }
+ char* str() const { return pbase(); }
+
+ private:
+ LogStream(const LogStream&);
+ LogStream& operator=(const LogStream&);
+ base_logging::LogStreamBuf streambuf_;
+ int64 ctr_; // Counter hack (for the LOG_EVERY_X() macro)
+ LogStream *self_; // Consistency check hack
+ };
+
+public:
+ // icc 8 requires this typedef to avoid an internal compiler error.
+ typedef void (LogMessage::*SendMethod)();
+
+ LogMessage(const char* file, int line, LogSeverity severity, int64 ctr,
+ SendMethod send_method);
+
+ // Two special constructors that generate reduced amounts of code at
+ // LOG call sites for common cases.
+
+ // Used for LOG(INFO): Implied are:
+ // severity = INFO, ctr = 0, send_method = &LogMessage::SendToLog.
+ //
+ // Using this constructor instead of the more complex constructor above
+ // saves 19 bytes per call site.
+ LogMessage(const char* file, int line);
+
+ // Used for LOG(severity) where severity != INFO. Implied
+ // are: ctr = 0, send_method = &LogMessage::SendToLog
+ //
+ // Using this constructor instead of the more complex constructor above
+ // saves 17 bytes per call site.
+ LogMessage(const char* file, int line, LogSeverity severity);
+
+ // Constructor to log this message to a specified sink (if not NULL).
+ // Implied are: ctr = 0, send_method = &LogMessage::SendToSinkAndLog if
+ // also_send_to_log is true, send_method = &LogMessage::SendToSink otherwise.
+ LogMessage(const char* file, int line, LogSeverity severity, LogSink* sink,
+ bool also_send_to_log);
+
+ // Constructor where we also give a vector<string> pointer
+ // for storing the messages (if the pointer is not NULL).
+ // Implied are: ctr = 0, send_method = &LogMessage::SaveOrSendToLog.
+ LogMessage(const char* file, int line, LogSeverity severity,
+ std::vector<std::string>* outvec);
+
+ // Constructor where we also give a string pointer for storing the
+ // message (if the pointer is not NULL). Implied are: ctr = 0,
+ // send_method = &LogMessage::WriteToStringAndLog.
+ LogMessage(const char* file, int line, LogSeverity severity,
+ std::string* message);
+
+ // A special constructor used for check failures
+ LogMessage(const char* file, int line, const CheckOpString& result);
+
+ ~LogMessage();
+
+ // Flush a buffered message to the sink set in the constructor. Always
+ // called by the destructor, it may also be called from elsewhere if
+ // needed. Only the first call is actioned; any later ones are ignored.
+ void Flush();
+
+ // An arbitrary limit on the length of a single log message. This
+ // is so that streaming can be done more efficiently.
+ static const size_t kMaxLogMessageLen;
+
+ // Theses should not be called directly outside of logging.*,
+ // only passed as SendMethod arguments to other LogMessage methods:
+ void SendToLog(); // Actually dispatch to the logs
+ void SendToSyslogAndLog(); // Actually dispatch to syslog and the logs
+
+ // Call abort() or similar to perform LOG(FATAL) crash.
+ [[noreturn]] static void Fail();
+
+ std::ostream& stream();
+
+ int preserved_errno() const;
+
+ // Must be called without the log_mutex held. (L < log_mutex)
+ static int64 num_messages(int severity);
+
+ const LogMessageTime& getLogMessageTime() const;
+
+ struct LogMessageData;
+
+private:
+ // Fully internal SendMethod cases:
+ void SendToSinkAndLog(); // Send to sink if provided and dispatch to the logs
+ void SendToSink(); // Send to sink if provided, do nothing otherwise.
+
+ // Write to string if provided and dispatch to the logs.
+ void WriteToStringAndLog();
+
+ void SaveOrSendToLog(); // Save to stringvec if provided, else to logs
+
+ void Init(const char* file, int line, LogSeverity severity,
+ void (LogMessage::*send_method)());
+
+ // Used to fill in crash information during LOG(FATAL) failures.
+ void RecordCrashReason(glog_internal_namespace_::CrashReason* reason);
+
+ // Counts of messages sent at each priority:
+ static int64 num_messages_[NUM_SEVERITIES]; // under log_mutex
+
+ // We keep the data in a separate struct so that each instance of
+ // LogMessage uses less stack space.
+ LogMessageData* allocated_;
+ LogMessageData* data_;
+ LogMessageTime logmsgtime_;
+
+ friend class LogDestination;
+
+ LogMessage(const LogMessage&);
+ void operator=(const LogMessage&);
+};
+
+// This class happens to be thread-hostile because all instances share
+// a single data buffer, but since it can only be created just before
+// the process dies, we don't worry so much.
+class GLOG_EXPORT LogMessageFatal : public LogMessage {
+ public:
+ LogMessageFatal(const char* file, int line);
+ LogMessageFatal(const char* file, int line, const CheckOpString& result);
+ [[noreturn]] ~LogMessageFatal();
+};
+
+// A non-macro interface to the log facility; (useful
+// when the logging level is not a compile-time constant).
+inline void LogAtLevel(int const severity, std::string const &msg) {
+ LogMessage(__FILE__, __LINE__, severity).stream() << msg;
+}
+
+// A macro alternative of LogAtLevel. New code may want to use this
+// version since there are two advantages: 1. this version outputs the
+// file name and the line number where this macro is put like other
+// LOG macros, 2. this macro can be used as C++ stream.
+#define LOG_AT_LEVEL(severity) @ac_google_namespace@::LogMessage(__FILE__, __LINE__, severity).stream()
+
+// Helper for CHECK_NOTNULL().
+//
+// In C++11, all cases can be handled by a single function. Since the value
+// category of the argument is preserved (also for rvalue references),
+// member initializer lists like the one below will compile correctly:
+//
+// Foo()
+// : x_(CHECK_NOTNULL(MethodReturningUniquePtr())) {}
+template <typename T>
+T CheckNotNull(const char* file, int line, const char* names, T&& t) {
+ if (t == nullptr) {
+ LogMessageFatal(file, line, new std::string(names));
+ }
+ return std::forward<T>(t);
+}
+
+// Allow folks to put a counter in the LOG_EVERY_X()'ed messages. This
+// only works if ostream is a LogStream. If the ostream is not a
+// LogStream you'll get an assert saying as much at runtime.
+GLOG_EXPORT std::ostream& operator<<(std::ostream &os,
+ const PRIVATE_Counter&);
+
+
+// Derived class for PLOG*() above.
+class GLOG_EXPORT ErrnoLogMessage : public LogMessage {
+ public:
+ ErrnoLogMessage(const char* file, int line, LogSeverity severity, int64 ctr,
+ void (LogMessage::*send_method)());
+
+ // Postpends ": strerror(errno) [errno]".
+ ~ErrnoLogMessage();
+
+ private:
+ ErrnoLogMessage(const ErrnoLogMessage&);
+ void operator=(const ErrnoLogMessage&);
+};
+
+
+// This class is used to explicitly ignore values in the conditional
+// logging macros. This avoids compiler warnings like "value computed
+// is not used" and "statement has no effect".
+
+class GLOG_EXPORT LogMessageVoidify {
+ public:
+ LogMessageVoidify() { }
+ // This has to be an operator with a precedence lower than << but
+ // higher than ?:
+ void operator&(std::ostream&) { }
+};
+
+
+// Flushes all log files that contains messages that are at least of
+// the specified severity level. Thread-safe.
+GLOG_EXPORT void FlushLogFiles(LogSeverity min_severity);
+
+// Flushes all log files that contains messages that are at least of
+// the specified severity level. Thread-hostile because it ignores
+// locking -- used for catastrophic failures.
+GLOG_EXPORT void FlushLogFilesUnsafe(LogSeverity min_severity);
+
+//
+// Set the destination to which a particular severity level of log
+// messages is sent. If base_filename is "", it means "don't log this
+// severity". Thread-safe.
+//
+GLOG_EXPORT void SetLogDestination(LogSeverity severity,
+ const char* base_filename);
+
+//
+// Set the basename of the symlink to the latest log file at a given
+// severity. If symlink_basename is empty, do not make a symlink. If
+// you don't call this function, the symlink basename is the
+// invocation name of the program. Thread-safe.
+//
+GLOG_EXPORT void SetLogSymlink(LogSeverity severity,
+ const char* symlink_basename);
+
+//
+// Used to send logs to some other kind of destination
+// Users should subclass LogSink and override send to do whatever they want.
+// Implementations must be thread-safe because a shared instance will
+// be called from whichever thread ran the LOG(XXX) line.
+class GLOG_EXPORT LogSink {
+ public:
+ virtual ~LogSink();
+
+ // Sink's logging logic (message_len is such as to exclude '\n' at the end).
+ // This method can't use LOG() or CHECK() as logging system mutex(s) are held
+ // during this call.
+ virtual void send(LogSeverity severity, const char* full_filename,
+ const char* base_filename, int line,
+ const LogMessageTime& logmsgtime, const char* message,
+ size_t message_len);
+ // Provide an overload for compatibility purposes
+ GLOG_DEPRECATED
+ virtual void send(LogSeverity severity, const char* full_filename,
+ const char* base_filename, int line, const std::tm* t,
+ const char* message, size_t message_len);
+
+ // Redefine this to implement waiting for
+ // the sink's logging logic to complete.
+ // It will be called after each send() returns,
+ // but before that LogMessage exits or crashes.
+ // By default this function does nothing.
+ // Using this function one can implement complex logic for send()
+ // that itself involves logging; and do all this w/o causing deadlocks and
+ // inconsistent rearrangement of log messages.
+ // E.g. if a LogSink has thread-specific actions, the send() method
+ // can simply add the message to a queue and wake up another thread that
+ // handles real logging while itself making some LOG() calls;
+ // WaitTillSent() can be implemented to wait for that logic to complete.
+ // See our unittest for an example.
+ virtual void WaitTillSent();
+
+ // Returns the normal text output of the log message.
+ // Can be useful to implement send().
+ static std::string ToString(LogSeverity severity, const char* file, int line,
+ const LogMessageTime &logmsgtime,
+ const char* message, size_t message_len);
+};
+
+// Add or remove a LogSink as a consumer of logging data. Thread-safe.
+GLOG_EXPORT void AddLogSink(LogSink *destination);
+GLOG_EXPORT void RemoveLogSink(LogSink *destination);
+
+//
+// Specify an "extension" added to the filename specified via
+// SetLogDestination. This applies to all severity levels. It's
+// often used to append the port we're listening on to the logfile
+// name. Thread-safe.
+//
+GLOG_EXPORT void SetLogFilenameExtension(
+ const char* filename_extension);
+
+//
+// Make it so that all log messages of at least a particular severity
+// are logged to stderr (in addition to logging to the usual log
+// file(s)). Thread-safe.
+//
+GLOG_EXPORT void SetStderrLogging(LogSeverity min_severity);
+
+//
+// Make it so that all log messages go only to stderr. Thread-safe.
+//
+GLOG_EXPORT void LogToStderr();
+
+//
+// Make it so that all log messages of at least a particular severity are
+// logged via email to a list of addresses (in addition to logging to the
+// usual log file(s)). The list of addresses is just a string containing
+// the email addresses to send to (separated by spaces, say). Thread-safe.
+//
+GLOG_EXPORT void SetEmailLogging(LogSeverity min_severity,
+ const char* addresses);
+
+// A simple function that sends email. dest is a commma-separated
+// list of addressess. Thread-safe.
+GLOG_EXPORT bool SendEmail(const char* dest, const char* subject,
+ const char* body);
+
+GLOG_EXPORT const std::vector<std::string>& GetLoggingDirectories();
+
+// For tests only: Clear the internal [cached] list of logging directories to
+// force a refresh the next time GetLoggingDirectories is called.
+// Thread-hostile.
+void TestOnly_ClearLoggingDirectoriesList();
+
+// Returns a set of existing temporary directories, which will be a
+// subset of the directories returned by GetLoggingDirectories().
+// Thread-safe.
+GLOG_EXPORT void GetExistingTempDirectories(
+ std::vector<std::string>* list);
+
+// Print any fatal message again -- useful to call from signal handler
+// so that the last thing in the output is the fatal message.
+// Thread-hostile, but a race is unlikely.
+GLOG_EXPORT void ReprintFatalMessage();
+
+// Truncate a log file that may be the append-only output of multiple
+// processes and hence can't simply be renamed/reopened (typically a
+// stdout/stderr). If the file "path" is > "limit" bytes, copy the
+// last "keep" bytes to offset 0 and truncate the rest. Since we could
+// be racing with other writers, this approach has the potential to
+// lose very small amounts of data. For security, only follow symlinks
+// if the path is /proc/self/fd/*
+GLOG_EXPORT void TruncateLogFile(const char* path, uint64 limit, uint64 keep);
+
+// Truncate stdout and stderr if they are over the value specified by
+// --max_log_size; keep the final 1MB. This function has the same
+// race condition as TruncateLogFile.
+GLOG_EXPORT void TruncateStdoutStderr();
+
+// Return the string representation of the provided LogSeverity level.
+// Thread-safe.
+GLOG_EXPORT const char* GetLogSeverityName(LogSeverity severity);
+
+// ---------------------------------------------------------------------
+// Implementation details that are not useful to most clients
+// ---------------------------------------------------------------------
+
+// A Logger is the interface used by logging modules to emit entries
+// to a log. A typical implementation will dump formatted data to a
+// sequence of files. We also provide interfaces that will forward
+// the data to another thread so that the invoker never blocks.
+// Implementations should be thread-safe since the logging system
+// will write to them from multiple threads.
+
+namespace base {
+
+class GLOG_EXPORT Logger {
+ public:
+ virtual ~Logger();
+
+ // Writes "message[0,message_len-1]" corresponding to an event that
+ // occurred at "timestamp". If "force_flush" is true, the log file
+ // is flushed immediately.
+ //
+ // The input message has already been formatted as deemed
+ // appropriate by the higher level logging facility. For example,
+ // textual log messages already contain timestamps, and the
+ // file:linenumber header.
+ virtual void Write(bool force_flush,
+ time_t timestamp,
+ const char* message,
+ size_t message_len) = 0;
+
+ // Flush any buffered messages
+ virtual void Flush() = 0;
+
+ // Get the current LOG file size.
+ // The returned value is approximate since some
+ // logged data may not have been flushed to disk yet.
+ virtual uint32 LogSize() = 0;
+};
+
+// Get the logger for the specified severity level. The logger
+// remains the property of the logging module and should not be
+// deleted by the caller. Thread-safe.
+extern GLOG_EXPORT Logger* GetLogger(LogSeverity level);
+
+// Set the logger for the specified severity level. The logger
+// becomes the property of the logging module and should not
+// be deleted by the caller. Thread-safe.
+extern GLOG_EXPORT void SetLogger(LogSeverity level, Logger* logger);
+
+}
+
+// glibc has traditionally implemented two incompatible versions of
+// strerror_r(). There is a poorly defined convention for picking the
+// version that we want, but it is not clear whether it even works with
+// all versions of glibc.
+// So, instead, we provide this wrapper that automatically detects the
+// version that is in use, and then implements POSIX semantics.
+// N.B. In addition to what POSIX says, we also guarantee that "buf" will
+// be set to an empty string, if this function failed. This means, in most
+// cases, you do not need to check the error code and you can directly
+// use the value of "buf". It will never have an undefined value.
+// DEPRECATED: Use StrError(int) instead.
+GLOG_EXPORT int posix_strerror_r(int err, char *buf, size_t len);
+
+// A thread-safe replacement for strerror(). Returns a string describing the
+// given POSIX error code.
+GLOG_EXPORT std::string StrError(int err);
+
+// A class for which we define operator<<, which does nothing.
+class GLOG_EXPORT NullStream : public LogMessage::LogStream {
+ public:
+ // Initialize the LogStream so the messages can be written somewhere
+ // (they'll never be actually displayed). This will be needed if a
+ // NullStream& is implicitly converted to LogStream&, in which case
+ // the overloaded NullStream::operator<< will not be invoked.
+ NullStream() : LogMessage::LogStream(message_buffer_, 1, 0) { }
+ NullStream(const char* /*file*/, int /*line*/,
+ const CheckOpString& /*result*/) :
+ LogMessage::LogStream(message_buffer_, 1, 0) { }
+ NullStream &stream() { return *this; }
+ private:
+ // A very short buffer for messages (which we discard anyway). This
+ // will be needed if NullStream& converted to LogStream& (e.g. as a
+ // result of a conditional expression).
+ char message_buffer_[2];
+};
+
+// Do nothing. This operator is inline, allowing the message to be
+// compiled away. The message will not be compiled away if we do
+// something like (flag ? LOG(INFO) : LOG(ERROR)) << message; when
+// SKIP_LOG=WARNING. In those cases, NullStream will be implicitly
+// converted to LogStream and the message will be computed and then
+// quietly discarded.
+template<class T>
+inline NullStream& operator<<(NullStream &str, const T &) { return str; }
+
+// Similar to NullStream, but aborts the program (without stack
+// trace), like LogMessageFatal.
+class GLOG_EXPORT NullStreamFatal : public NullStream {
+ public:
+ NullStreamFatal() { }
+ NullStreamFatal(const char* file, int line, const CheckOpString& result) :
+ NullStream(file, line, result) { }
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable : 4722)
+#endif // _MSC_VER
+ [[noreturn]] ~NullStreamFatal() throw() { _exit(EXIT_FAILURE); }
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif // _MSC_VER
+};
+
+// Install a signal handler that will dump signal information and a stack
+// trace when the program crashes on certain signals. We'll install the
+// signal handler for the following signals.
+//
+// SIGSEGV, SIGILL, SIGFPE, SIGABRT, SIGBUS, and SIGTERM.
+//
+// By default, the signal handler will write the failure dump to the
+// standard error. You can customize the destination by installing your
+// own writer function by InstallFailureWriter() below.
+//
+// Note on threading:
+//
+// The function should be called before threads are created, if you want
+// to use the failure signal handler for all threads. The stack trace
+// will be shown only for the thread that receives the signal. In other
+// words, stack traces of other threads won't be shown.
+GLOG_EXPORT void InstallFailureSignalHandler();
+
+// Installs a function that is used for writing the failure dump. "data"
+// is the pointer to the beginning of a message to be written, and "size"
+// is the size of the message. You should not expect the data is
+// terminated with '\0'.
+GLOG_EXPORT void InstallFailureWriter(
+ void (*writer)(const char* data, size_t size));
+
+@ac_google_end_namespace@
+
+#pragma pop_macro("DECLARE_VARIABLE")
+#pragma pop_macro("DECLARE_bool")
+#pragma pop_macro("DECLARE_string")
+#pragma pop_macro("DECLARE_int32")
+#pragma pop_macro("DECLARE_uint32")
+
+#endif // GLOG_LOGGING_H
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/glog/platform.h b/funasr/runtime/onnxruntime/third_party/glog/src/glog/platform.h
new file mode 100644
index 0000000..7893c45
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/glog/platform.h
@@ -0,0 +1,60 @@
+// Copyright (c) 2008, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Shinichiro Hamaji
+//
+// Detect supported platforms.
+
+#ifndef GLOG_PLATFORM_H
+#define GLOG_PLATFORM_H
+
+#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
+#define GLOG_OS_WINDOWS
+#elif defined(__CYGWIN__) || defined(__CYGWIN32__)
+#define GLOG_OS_CYGWIN
+#elif defined(linux) || defined(__linux) || defined(__linux__)
+#ifndef GLOG_OS_LINUX
+#define GLOG_OS_LINUX
+#endif
+#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
+#define GLOG_OS_MACOSX
+#elif defined(__FreeBSD__)
+#define GLOG_OS_FREEBSD
+#elif defined(__NetBSD__)
+#define GLOG_OS_NETBSD
+#elif defined(__OpenBSD__)
+#define GLOG_OS_OPENBSD
+#elif defined(__EMSCRIPTEN__)
+#define GLOG_OS_EMSCRIPTEN
+#else
+// TODO(hamaji): Add other platforms.
+#error Platform not supported by glog. Please consider to contribute platform information by submitting a pull request on Github.
+#endif
+
+#endif // GLOG_PLATFORM_H
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/glog/raw_logging.h.in b/funasr/runtime/onnxruntime/third_party/glog/src/glog/raw_logging.h.in
new file mode 100644
index 0000000..66fec91
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/glog/raw_logging.h.in
@@ -0,0 +1,179 @@
+// Copyright (c) 2006, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Maxim Lifantsev
+//
+// Thread-safe logging routines that do not allocate any memory or
+// acquire any locks, and can therefore be used by low-level memory
+// allocation and synchronization code.
+
+#ifndef GLOG_RAW_LOGGING_H
+#define GLOG_RAW_LOGGING_H
+
+#include <ctime>
+
+@ac_google_start_namespace@
+
+#include <glog/log_severity.h>
+#include <glog/logging.h>
+#include <glog/vlog_is_on.h>
+
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvariadic-macros"
+#endif
+
+// This is similar to LOG(severity) << format... and VLOG(level) << format..,
+// but
+// * it is to be used ONLY by low-level modules that can't use normal LOG()
+// * it is desiged to be a low-level logger that does not allocate any
+// memory and does not need any locks, hence:
+// * it logs straight and ONLY to STDERR w/o buffering
+// * it uses an explicit format and arguments list
+// * it will silently chop off really long message strings
+// Usage example:
+// RAW_LOG(ERROR, "Failed foo with %i: %s", status, error);
+// RAW_VLOG(3, "status is %i", status);
+// These will print an almost standard log lines like this to stderr only:
+// E20200821 211317 file.cc:123] RAW: Failed foo with 22: bad_file
+// I20200821 211317 file.cc:142] RAW: status is 20
+#define RAW_LOG(severity, ...) \
+ do { \
+ switch (@ac_google_namespace@::GLOG_ ## severity) { \
+ case 0: \
+ RAW_LOG_INFO(__VA_ARGS__); \
+ break; \
+ case 1: \
+ RAW_LOG_WARNING(__VA_ARGS__); \
+ break; \
+ case 2: \
+ RAW_LOG_ERROR(__VA_ARGS__); \
+ break; \
+ case 3: \
+ RAW_LOG_FATAL(__VA_ARGS__); \
+ break; \
+ default: \
+ break; \
+ } \
+ } while (0)
+
+// The following STRIP_LOG testing is performed in the header file so that it's
+// possible to completely compile out the logging code and the log messages.
+#if !defined(STRIP_LOG) || STRIP_LOG == 0
+#define RAW_VLOG(verboselevel, ...) \
+ do { \
+ if (VLOG_IS_ON(verboselevel)) { \
+ RAW_LOG_INFO(__VA_ARGS__); \
+ } \
+ } while (0)
+#else
+#define RAW_VLOG(verboselevel, ...) RawLogStub__(0, __VA_ARGS__)
+#endif // STRIP_LOG == 0
+
+#if !defined(STRIP_LOG) || STRIP_LOG == 0
+#define RAW_LOG_INFO(...) @ac_google_namespace@::RawLog__(@ac_google_namespace@::GLOG_INFO, \
+ __FILE__, __LINE__, __VA_ARGS__)
+#else
+#define RAW_LOG_INFO(...) @ac_google_namespace@::RawLogStub__(0, __VA_ARGS__)
+#endif // STRIP_LOG == 0
+
+#if !defined(STRIP_LOG) || STRIP_LOG <= 1
+#define RAW_LOG_WARNING(...) @ac_google_namespace@::RawLog__(@ac_google_namespace@::GLOG_WARNING, \
+ __FILE__, __LINE__, __VA_ARGS__)
+#else
+#define RAW_LOG_WARNING(...) @ac_google_namespace@::RawLogStub__(0, __VA_ARGS__)
+#endif // STRIP_LOG <= 1
+
+#if !defined(STRIP_LOG) || STRIP_LOG <= 2
+#define RAW_LOG_ERROR(...) @ac_google_namespace@::RawLog__(@ac_google_namespace@::GLOG_ERROR, \
+ __FILE__, __LINE__, __VA_ARGS__)
+#else
+#define RAW_LOG_ERROR(...) @ac_google_namespace@::RawLogStub__(0, __VA_ARGS__)
+#endif // STRIP_LOG <= 2
+
+#if !defined(STRIP_LOG) || STRIP_LOG <= 3
+#define RAW_LOG_FATAL(...) @ac_google_namespace@::RawLog__(@ac_google_namespace@::GLOG_FATAL, \
+ __FILE__, __LINE__, __VA_ARGS__)
+#else
+#define RAW_LOG_FATAL(...) \
+ do { \
+ @ac_google_namespace@::RawLogStub__(0, __VA_ARGS__); \
+ exit(EXIT_FAILURE); \
+ } while (0)
+#endif // STRIP_LOG <= 3
+
+// Similar to CHECK(condition) << message,
+// but for low-level modules: we use only RAW_LOG that does not allocate memory.
+// We do not want to provide args list here to encourage this usage:
+// if (!cond) RAW_LOG(FATAL, "foo ...", hard_to_compute_args);
+// so that the args are not computed when not needed.
+#define RAW_CHECK(condition, message) \
+ do { \
+ if (!(condition)) { \
+ RAW_LOG(FATAL, "Check %s failed: %s", #condition, message); \
+ } \
+ } while (0)
+
+// Debug versions of RAW_LOG and RAW_CHECK
+#ifndef NDEBUG
+
+#define RAW_DLOG(severity, ...) RAW_LOG(severity, __VA_ARGS__)
+#define RAW_DCHECK(condition, message) RAW_CHECK(condition, message)
+
+#else // NDEBUG
+
+#define RAW_DLOG(severity, ...) \
+ while (false) \
+ RAW_LOG(severity, __VA_ARGS__)
+#define RAW_DCHECK(condition, message) \
+ while (false) \
+ RAW_CHECK(condition, message)
+
+#endif // NDEBUG
+
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
+
+// Stub log function used to work around for unused variable warnings when
+// building with STRIP_LOG > 0.
+static inline void RawLogStub__(int /* ignored */, ...) {
+}
+
+// Helper function to implement RAW_LOG and RAW_VLOG
+// Logs format... at "severity" level, reporting it
+// as called from file:line.
+// This does not allocate memory or acquire locks.
+GLOG_EXPORT void RawLog__(LogSeverity severity, const char* file, int line,
+ const char* format, ...)
+ @ac_cv___attribute___printf_4_5@;
+
+@ac_google_end_namespace@
+
+#endif // GLOG_RAW_LOGGING_H
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/glog/stl_logging.h.in b/funasr/runtime/onnxruntime/third_party/glog/src/glog/stl_logging.h.in
new file mode 100644
index 0000000..49eec03
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/glog/stl_logging.h.in
@@ -0,0 +1,177 @@
+// Copyright (c) 2003, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Stream output operators for STL containers; to be used for logging *only*.
+// Inclusion of this file lets you do:
+//
+// list<string> x;
+// LOG(INFO) << "data: " << x;
+// vector<int> v1, v2;
+// CHECK_EQ(v1, v2);
+//
+// If you want to use this header file with hash maps or slist, you
+// need to define macros before including this file:
+//
+// - GLOG_STL_LOGGING_FOR_UNORDERED - <unordered_map> and <unordered_set>
+// - GLOG_STL_LOGGING_FOR_TR1_UNORDERED - <tr1/unordered_(map|set)>
+// - GLOG_STL_LOGGING_FOR_EXT_HASH - <ext/hash_(map|set)>
+// - GLOG_STL_LOGGING_FOR_EXT_SLIST - <ext/slist>
+//
+
+#ifndef UTIL_GTL_STL_LOGGING_INL_H_
+#define UTIL_GTL_STL_LOGGING_INL_H_
+
+#include <deque>
+#include <list>
+#include <map>
+#include <ostream>
+#include <set>
+#include <unordered_map>
+#include <unordered_set>
+#include <utility>
+#include <vector>
+
+// Forward declare these two, and define them after all the container streams
+// operators so that we can recurse from pair -> container -> container -> pair
+// properly.
+template<class First, class Second>
+std::ostream& operator<<(std::ostream& out, const std::pair<First, Second>& p);
+
+@ac_google_start_namespace@
+
+template<class Iter>
+void PrintSequence(std::ostream& out, Iter begin, Iter end);
+
+@ac_google_end_namespace@
+#define OUTPUT_TWO_ARG_CONTAINER(Sequence) \
+template<class T1, class T2> \
+inline std::ostream& operator<<(std::ostream& out, \
+ const Sequence<T1, T2>& seq) { \
+ @ac_google_namespace@::PrintSequence(out, seq.begin(), seq.end()); \
+ return out; \
+}
+
+ OUTPUT_TWO_ARG_CONTAINER(std::vector) OUTPUT_TWO_ARG_CONTAINER(std::deque)
+ OUTPUT_TWO_ARG_CONTAINER(std::list)
+
+#undef OUTPUT_TWO_ARG_CONTAINER
+
+#define OUTPUT_THREE_ARG_CONTAINER(Sequence) \
+template<class T1, class T2, class T3> \
+inline std::ostream& operator<<(std::ostream& out, \
+ const Sequence<T1, T2, T3>& seq) { \
+ @ac_google_namespace@::PrintSequence(out, seq.begin(), seq.end()); \
+ return out; \
+}
+
+ OUTPUT_THREE_ARG_CONTAINER(std::set) OUTPUT_THREE_ARG_CONTAINER(
+ std::multiset)
+
+#undef OUTPUT_THREE_ARG_CONTAINER
+
+#define OUTPUT_FOUR_ARG_CONTAINER(Sequence) \
+template<class T1, class T2, class T3, class T4> \
+inline std::ostream& operator<<(std::ostream& out, \
+ const Sequence<T1, T2, T3, T4>& seq) { \
+ @ac_google_namespace@::PrintSequence(out, seq.begin(), seq.end()); \
+ return out; \
+}
+
+ OUTPUT_FOUR_ARG_CONTAINER(std::map) OUTPUT_FOUR_ARG_CONTAINER(
+ std::multimap) OUTPUT_FOUR_ARG_CONTAINER(std::unordered_set)
+ OUTPUT_FOUR_ARG_CONTAINER(std::unordered_multiset)
+
+#undef OUTPUT_FOUR_ARG_CONTAINER
+
+#define OUTPUT_FIVE_ARG_CONTAINER(Sequence) \
+template<class T1, class T2, class T3, class T4, class T5> \
+inline std::ostream& operator<<(std::ostream& out, \
+ const Sequence<T1, T2, T3, T4, T5>& seq) { \
+ @ac_google_namespace@::PrintSequence(out, seq.begin(), seq.end()); \
+ return out; \
+}
+
+#if defined(GLOG_STL_LOGGING_FOR_UNORDERED) && __cplusplus >= 201103L
+ OUTPUT_FIVE_ARG_CONTAINER(std::unordered_map)
+ OUTPUT_FIVE_ARG_CONTAINER(std::unordered_multimap)
+#endif
+
+#undef OUTPUT_FIVE_ARG_CONTAINER
+
+ template <class First, class Second>
+ inline std::ostream& operator<<(
+ std::ostream& out,
+ const std::pair<First, Second>& p) {
+ out << '(' << p.first << ", " << p.second << ')';
+ return out;
+}
+
+@ac_google_start_namespace@
+
+template<class Iter>
+inline void PrintSequence(std::ostream& out, Iter begin, Iter end) {
+ // Output at most 100 elements -- appropriate if used for logging.
+ for (int i = 0; begin != end && i < 100; ++i, ++begin) {
+ if (i > 0) out << ' ';
+ out << *begin;
+ }
+ if (begin != end) {
+ out << " ...";
+ }
+}
+
+@ac_google_end_namespace@
+
+// Note that this is technically undefined behavior! We are adding things into
+// the std namespace for a reason though -- we are providing new operations on
+// types which are themselves defined with this namespace. Without this, these
+// operator overloads cannot be found via ADL. If these definitions are not
+// found via ADL, they must be #included before they're used, which requires
+// this header to be included before apparently independent other headers.
+//
+// For example, base/logging.h defines various template functions to implement
+// CHECK_EQ(x, y) and stream x and y into the log in the event the check fails.
+// It does so via the function template MakeCheckOpValueString:
+// template<class T>
+// void MakeCheckOpValueString(strstream* ss, const T& v) {
+// (*ss) << v;
+// }
+// Because 'glog/logging.h' is included before 'glog/stl_logging.h',
+// subsequent CHECK_EQ(v1, v2) for vector<...> typed variable v1 and v2 can only
+// find these operator definitions via ADL.
+//
+// Even this solution has problems -- it may pull unintended operators into the
+// namespace as well, allowing them to also be found via ADL, and creating code
+// that only works with a particular order of includes. Long term, we need to
+// move all of the *definitions* into namespace std, bet we need to ensure no
+// one references them first. This lets us take that step. We cannot define them
+// in both because that would create ambiguous overloads when both are found.
+namespace std { using ::operator<<; }
+
+#endif // UTIL_GTL_STL_LOGGING_INL_H_
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/glog/vlog_is_on.h.in b/funasr/runtime/onnxruntime/third_party/glog/src/glog/vlog_is_on.h.in
new file mode 100644
index 0000000..ed37e0d
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/glog/vlog_is_on.h.in
@@ -0,0 +1,120 @@
+// Copyright (c) 2023, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Ray Sidney and many others
+//
+// Defines the VLOG_IS_ON macro that controls the variable-verbosity
+// conditional logging.
+//
+// It's used by VLOG and VLOG_IF in logging.h
+// and by RAW_VLOG in raw_logging.h to trigger the logging.
+//
+// It can also be used directly e.g. like this:
+// if (VLOG_IS_ON(2)) {
+// // do some logging preparation and logging
+// // that can't be accomplished e.g. via just VLOG(2) << ...;
+// }
+//
+// The truth value that VLOG_IS_ON(level) returns is determined by
+// the three verbosity level flags:
+// --v=<n> Gives the default maximal active V-logging level;
+// 0 is the default.
+// Normally positive values are used for V-logging levels.
+// --vmodule=<str> Gives the per-module maximal V-logging levels to override
+// the value given by --v.
+// E.g. "my_module=2,foo*=3" would change the logging level
+// for all code in source files "my_module.*" and "foo*.*"
+// ("-inl" suffixes are also disregarded for this matching).
+//
+// SetVLOGLevel helper function is provided to do limited dynamic control over
+// V-logging by overriding the per-module settings given via --vmodule flag.
+//
+// CAVEAT: --vmodule functionality is not available in non gcc compilers.
+//
+
+#ifndef BASE_VLOG_IS_ON_H_
+#define BASE_VLOG_IS_ON_H_
+
+#include <glog/log_severity.h>
+
+#include <cstddef>
+
+#if defined(__GNUC__)
+// We emit an anonymous static int* variable at every VLOG_IS_ON(n) site.
+// (Normally) the first time every VLOG_IS_ON(n) site is hit,
+// we determine what variable will dynamically control logging at this site:
+// it's either FLAGS_v or an appropriate internal variable
+// matching the current source file that represents results of
+// parsing of --vmodule flag and/or SetVLOGLevel calls.
+#define VLOG_IS_ON(verboselevel) \
+ __extension__ \
+ ({ static @ac_google_namespace@::SiteFlag vlocal__ = {NULL, NULL, 0, NULL}; \
+ @ac_google_namespace@::int32 verbose_level__ = (verboselevel); \
+ (vlocal__.level == NULL ? @ac_google_namespace@::InitVLOG3__(&vlocal__, &FLAGS_v, \
+ __FILE__, verbose_level__) : *vlocal__.level >= verbose_level__); \
+ })
+#else
+// GNU extensions not available, so we do not support --vmodule.
+// Dynamic value of FLAGS_v always controls the logging level.
+#define VLOG_IS_ON(verboselevel) (FLAGS_v >= (verboselevel))
+#endif
+
+// Set VLOG(_IS_ON) level for module_pattern to log_level.
+// This lets us dynamically control what is normally set by the --vmodule flag.
+// Returns the level that previously applied to module_pattern.
+// NOTE: To change the log level for VLOG(_IS_ON) sites
+// that have already executed after/during InitGoogleLogging,
+// one needs to supply the exact --vmodule pattern that applied to them.
+// (If no --vmodule pattern applied to them
+// the value of FLAGS_v will continue to control them.)
+extern GLOG_EXPORT int SetVLOGLevel(const char* module_pattern, int log_level);
+
+// Various declarations needed for VLOG_IS_ON above: =========================
+
+struct SiteFlag {
+ @ac_google_namespace@::int32* level;
+ const char* base_name;
+ std::size_t base_len;
+ SiteFlag* next;
+};
+
+// Helper routine which determines the logging info for a particalur VLOG site.
+// site_flag is the address of the site-local pointer to the controlling
+// verbosity level
+// site_default is the default to use for *site_flag
+// fname is the current source file name
+// verbose_level is the argument to VLOG_IS_ON
+// We will return the return value for VLOG_IS_ON
+// and if possible set *site_flag appropriately.
+extern GLOG_EXPORT bool InitVLOG3__(
+ @ac_google_namespace@::SiteFlag* site_flag,
+ @ac_google_namespace@::int32* site_default, const char* fname,
+ @ac_google_namespace@::int32 verbose_level);
+
+#endif // BASE_VLOG_IS_ON_H_
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/googletest.h b/funasr/runtime/onnxruntime/third_party/glog/src/googletest.h
new file mode 100644
index 0000000..a12c387
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/googletest.h
@@ -0,0 +1,654 @@
+// Copyright (c) 2009, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Shinichiro Hamaji
+// (based on googletest: http://code.google.com/p/googletest/)
+
+#ifdef GOOGLETEST_H__
+#error You must not include this file twice.
+#endif
+#define GOOGLETEST_H__
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include <cctype>
+#include <csetjmp>
+#include <cstdio>
+#include <cstdlib>
+#include <ctime>
+#include <map>
+#include <sstream>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "utilities.h"
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include "base/commandlineflags.h"
+
+#if __cplusplus < 201103L && !defined(_MSC_VER)
+#define GOOGLE_GLOG_THROW_BAD_ALLOC throw (std::bad_alloc)
+#else
+#define GOOGLE_GLOG_THROW_BAD_ALLOC
+#endif
+
+using std::map;
+using std::string;
+using std::vector;
+
+_START_GOOGLE_NAMESPACE_
+
+extern GLOG_EXPORT void (*g_logging_fail_func)();
+
+_END_GOOGLE_NAMESPACE_
+
+#undef GLOG_EXPORT
+#define GLOG_EXPORT
+
+static inline string GetTempDir() {
+ vector<string> temp_directories_list;
+ google::GetExistingTempDirectories(&temp_directories_list);
+
+ if (temp_directories_list.empty()) {
+ fprintf(stderr, "No temporary directory found\n");
+ exit(EXIT_FAILURE);
+ }
+
+ // Use first directory from list of existing temporary directories.
+ return temp_directories_list.front();
+}
+
+#if defined(GLOG_OS_WINDOWS) && defined(_MSC_VER) && !defined(TEST_SRC_DIR)
+// The test will run in glog/vsproject/<project name>
+// (e.g., glog/vsproject/logging_unittest).
+static const char TEST_SRC_DIR[] = "../..";
+#elif !defined(TEST_SRC_DIR)
+# warning TEST_SRC_DIR should be defined in config.h
+static const char TEST_SRC_DIR[] = ".";
+#endif
+
+static const uint32_t PTR_TEST_VALUE = 0x12345678;
+
+DEFINE_string(test_tmpdir, GetTempDir(), "Dir we use for temp files");
+DEFINE_string(test_srcdir, TEST_SRC_DIR,
+ "Source-dir root, needed to find glog_unittest_flagfile");
+DEFINE_bool(run_benchmark, false, "If true, run benchmarks");
+#ifdef NDEBUG
+DEFINE_int32(benchmark_iters, 100000000, "Number of iterations per benchmark");
+#else
+DEFINE_int32(benchmark_iters, 100000, "Number of iterations per benchmark");
+#endif
+
+#ifdef HAVE_LIB_GTEST
+# include <gtest/gtest.h>
+// Use our ASSERT_DEATH implementation.
+# undef ASSERT_DEATH
+# undef ASSERT_DEBUG_DEATH
+using testing::InitGoogleTest;
+#else
+
+_START_GOOGLE_NAMESPACE_
+
+void InitGoogleTest(int*, char**);
+
+void InitGoogleTest(int*, char**) {}
+
+// The following is some bare-bones testing infrastructure
+
+#define EXPECT_NEAR(val1, val2, abs_error) \
+ do { \
+ if (abs(val1 - val2) > abs_error) { \
+ fprintf(stderr, "Check failed: %s within %s of %s\n", #val1, #abs_error, \
+ #val2); \
+ exit(EXIT_FAILURE); \
+ } \
+ } while (0)
+
+#define EXPECT_TRUE(cond) \
+ do { \
+ if (!(cond)) { \
+ fprintf(stderr, "Check failed: %s\n", #cond); \
+ exit(EXIT_FAILURE); \
+ } \
+ } while (0)
+
+#define EXPECT_FALSE(cond) EXPECT_TRUE(!(cond))
+
+#define EXPECT_OP(op, val1, val2) \
+ do { \
+ if (!((val1) op (val2))) { \
+ fprintf(stderr, "Check failed: %s %s %s\n", #val1, #op, #val2); \
+ exit(EXIT_FAILURE); \
+ } \
+ } while (0)
+
+#define EXPECT_EQ(val1, val2) EXPECT_OP(==, val1, val2)
+#define EXPECT_NE(val1, val2) EXPECT_OP(!=, val1, val2)
+#define EXPECT_GT(val1, val2) EXPECT_OP(>, val1, val2)
+#define EXPECT_LT(val1, val2) EXPECT_OP(<, val1, val2)
+
+#define EXPECT_NAN(arg) \
+ do { \
+ if (!isnan(arg)) { \
+ fprintf(stderr, "Check failed: isnan(%s)\n", #arg); \
+ exit(EXIT_FAILURE); \
+ } \
+ } while (0)
+
+#define EXPECT_INF(arg) \
+ do { \
+ if (!isinf(arg)) { \
+ fprintf(stderr, "Check failed: isinf(%s)\n", #arg); \
+ exit(EXIT_FAILURE); \
+ } \
+ } while (0)
+
+#define EXPECT_DOUBLE_EQ(val1, val2) \
+ do { \
+ if (((val1) < (val2) - 0.001 || (val1) > (val2) + 0.001)) { \
+ fprintf(stderr, "Check failed: %s == %s\n", #val1, #val2); \
+ exit(EXIT_FAILURE); \
+ } \
+ } while (0)
+
+#define EXPECT_STREQ(val1, val2) \
+ do { \
+ if (strcmp((val1), (val2)) != 0) { \
+ fprintf(stderr, "Check failed: streq(%s, %s)\n", #val1, #val2); \
+ exit(EXIT_FAILURE); \
+ } \
+ } while (0)
+
+vector<void (*)()> g_testlist; // the tests to run
+
+#define TEST(a, b) \
+ struct Test_##a##_##b { \
+ Test_##a##_##b() { g_testlist.push_back(&Run); } \
+ static void Run() { FlagSaver fs; RunTest(); } \
+ static void RunTest(); \
+ }; \
+ static Test_##a##_##b g_test_##a##_##b; \
+ void Test_##a##_##b::RunTest()
+
+
+static inline int RUN_ALL_TESTS() {
+ vector<void (*)()>::const_iterator it;
+ for (it = g_testlist.begin(); it != g_testlist.end(); ++it) {
+ (*it)();
+ }
+ fprintf(stderr, "Passed %d tests\n\nPASS\n",
+ static_cast<int>(g_testlist.size()));
+ return 0;
+}
+
+_END_GOOGLE_NAMESPACE_
+
+#endif // ! HAVE_LIB_GTEST
+
+_START_GOOGLE_NAMESPACE_
+
+static bool g_called_abort;
+static jmp_buf g_jmp_buf;
+static inline void CalledAbort() {
+ g_called_abort = true;
+ longjmp(g_jmp_buf, 1);
+}
+
+#ifdef GLOG_OS_WINDOWS
+// TODO(hamaji): Death test somehow doesn't work in Windows.
+#define ASSERT_DEATH(fn, msg)
+#else
+#define ASSERT_DEATH(fn, msg) \
+ do { \
+ g_called_abort = false; \
+ /* in logging.cc */ \
+ void (*original_logging_fail_func)() = g_logging_fail_func; \
+ g_logging_fail_func = &CalledAbort; \
+ if (!setjmp(g_jmp_buf)) fn; \
+ /* set back to their default */ \
+ g_logging_fail_func = original_logging_fail_func; \
+ if (!g_called_abort) { \
+ fprintf(stderr, "Function didn't die (%s): %s\n", msg, #fn); \
+ exit(EXIT_FAILURE); \
+ } \
+ } while (0)
+#endif
+
+#ifdef NDEBUG
+#define ASSERT_DEBUG_DEATH(fn, msg)
+#else
+#define ASSERT_DEBUG_DEATH(fn, msg) ASSERT_DEATH(fn, msg)
+#endif // NDEBUG
+
+// Benchmark tools.
+
+#define BENCHMARK(n) static BenchmarkRegisterer __benchmark_ ## n (#n, &n);
+
+map<string, void (*)(int)> g_benchlist; // the benchmarks to run
+
+class BenchmarkRegisterer {
+ public:
+ BenchmarkRegisterer(const char* name, void (*function)(int iters)) {
+ EXPECT_TRUE(g_benchlist.insert(std::make_pair(name, function)).second);
+ }
+};
+
+static inline void RunSpecifiedBenchmarks() {
+ if (!FLAGS_run_benchmark) {
+ return;
+ }
+
+ int iter_cnt = FLAGS_benchmark_iters;
+ puts("Benchmark\tTime(ns)\tIterations");
+ for (auto& iter : g_benchlist) {
+ clock_t start = clock();
+ iter.second(iter_cnt);
+ double elapsed_ns = (static_cast<double>(clock()) - start) /
+ CLOCKS_PER_SEC * 1000 * 1000 * 1000;
+#if defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat="
+#endif
+ printf("%s\t%8.2lf\t%10d\n", iter.first.c_str(), elapsed_ns / iter_cnt,
+ iter_cnt);
+#if defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
+ }
+ puts("");
+}
+
+// ----------------------------------------------------------------------
+// Golden file functions
+// ----------------------------------------------------------------------
+
+class CapturedStream {
+ public:
+ CapturedStream(int fd, string filename)
+ : fd_(fd),
+
+ filename_(std::move(filename)) {
+ Capture();
+ }
+
+ ~CapturedStream() {
+ if (uncaptured_fd_ != -1) {
+ CHECK(close(uncaptured_fd_) != -1);
+ }
+ }
+
+ // Start redirecting output to a file
+ void Capture() {
+ // Keep original stream for later
+ CHECK(uncaptured_fd_ == -1) << ", Stream " << fd_ << " already captured!";
+ uncaptured_fd_ = dup(fd_);
+ CHECK(uncaptured_fd_ != -1);
+
+ // Open file to save stream to
+ int cap_fd = open(filename_.c_str(),
+ O_CREAT | O_TRUNC | O_WRONLY,
+ S_IRUSR | S_IWUSR);
+ CHECK(cap_fd != -1);
+
+ // Send stdout/stderr to this file
+ fflush(nullptr);
+ CHECK(dup2(cap_fd, fd_) != -1);
+ CHECK(close(cap_fd) != -1);
+ }
+
+ // Remove output redirection
+ void StopCapture() {
+ // Restore original stream
+ if (uncaptured_fd_ != -1) {
+ fflush(nullptr);
+ CHECK(dup2(uncaptured_fd_, fd_) != -1);
+ }
+ }
+
+ const string & filename() const { return filename_; }
+
+ private:
+ int fd_; // file descriptor being captured
+ int uncaptured_fd_{-1}; // where the stream was originally being sent to
+ string filename_; // file where stream is being saved
+};
+static CapturedStream * s_captured_streams[STDERR_FILENO+1];
+// Redirect a file descriptor to a file.
+// fd - Should be STDOUT_FILENO or STDERR_FILENO
+// filename - File where output should be stored
+static inline void CaptureTestOutput(int fd, const string & filename) {
+ CHECK((fd == STDOUT_FILENO) || (fd == STDERR_FILENO));
+ CHECK(s_captured_streams[fd] == nullptr);
+ s_captured_streams[fd] = new CapturedStream(fd, filename);
+}
+static inline void CaptureTestStdout() {
+ CaptureTestOutput(STDOUT_FILENO, FLAGS_test_tmpdir + "/captured.out");
+}
+static inline void CaptureTestStderr() {
+ CaptureTestOutput(STDERR_FILENO, FLAGS_test_tmpdir + "/captured.err");
+}
+// Return the size (in bytes) of a file
+static inline size_t GetFileSize(FILE * file) {
+ fseek(file, 0, SEEK_END);
+ return static_cast<size_t>(ftell(file));
+}
+// Read the entire content of a file as a string
+static inline string ReadEntireFile(FILE * file) {
+ const size_t file_size = GetFileSize(file);
+ char * const buffer = new char[file_size];
+
+ size_t bytes_last_read = 0; // # of bytes read in the last fread()
+ size_t bytes_read = 0; // # of bytes read so far
+
+ fseek(file, 0, SEEK_SET);
+
+ // Keep reading the file until we cannot read further or the
+ // pre-determined file size is reached.
+ do {
+ bytes_last_read = fread(buffer+bytes_read, 1, file_size-bytes_read, file);
+ bytes_read += bytes_last_read;
+ } while (bytes_last_read > 0 && bytes_read < file_size);
+
+ const string content = string(buffer, buffer+bytes_read);
+ delete[] buffer;
+
+ return content;
+}
+// Get the captured stdout (when fd is STDOUT_FILENO) or stderr (when
+// fd is STDERR_FILENO) as a string
+static inline string GetCapturedTestOutput(int fd) {
+ CHECK(fd == STDOUT_FILENO || fd == STDERR_FILENO);
+ CapturedStream * const cap = s_captured_streams[fd];
+ CHECK(cap)
+ << ": did you forget CaptureTestStdout() or CaptureTestStderr()?";
+
+ // Make sure everything is flushed.
+ cap->StopCapture();
+
+ // Read the captured file.
+ FILE * const file = fopen(cap->filename().c_str(), "r");
+ const string content = ReadEntireFile(file);
+ fclose(file);
+
+ delete cap;
+ s_captured_streams[fd] = nullptr;
+
+ return content;
+}
+// Get the captured stderr of a test as a string.
+static inline string GetCapturedTestStderr() {
+ return GetCapturedTestOutput(STDERR_FILENO);
+}
+
+static const std::size_t kLoggingPrefixLength = 9;
+
+// Check if the string is [IWEF](\d{8}|YEARDATE)
+static inline bool IsLoggingPrefix(const string& s) {
+ if (s.size() != kLoggingPrefixLength) {
+ return false;
+ }
+ if (!strchr("IWEF", s[0])) return false;
+ for (size_t i = 1; i <= 8; ++i) {
+ if (!isdigit(s[i]) && s[i] != "YEARDATE"[i-1]) return false;
+ }
+ return true;
+}
+
+// Convert log output into normalized form.
+//
+// Example:
+// I20200102 030405 logging_unittest.cc:345] RAW: vlog -1
+// => IYEARDATE TIME__ logging_unittest.cc:LINE] RAW: vlog -1
+static inline string MungeLine(const string& line) {
+ string before, logcode_date, time, thread_lineinfo;
+ std::size_t begin_of_logging_prefix = 0;
+ for (; begin_of_logging_prefix + kLoggingPrefixLength < line.size();
+ ++begin_of_logging_prefix) {
+ if (IsLoggingPrefix(
+ line.substr(begin_of_logging_prefix, kLoggingPrefixLength))) {
+ break;
+ }
+ }
+ if (begin_of_logging_prefix + kLoggingPrefixLength >= line.size()) {
+ return line;
+ } else if (begin_of_logging_prefix > 0) {
+ before = line.substr(0, begin_of_logging_prefix - 1);
+ }
+ std::istringstream iss(line.substr(begin_of_logging_prefix));
+ iss >> logcode_date;
+ iss >> time;
+ iss >> thread_lineinfo;
+ CHECK(!thread_lineinfo.empty());
+ if (thread_lineinfo[thread_lineinfo.size() - 1] != ']') {
+ // We found thread ID.
+ string tmp;
+ iss >> tmp;
+ CHECK(!tmp.empty());
+ CHECK_EQ(']', tmp[tmp.size() - 1]);
+ thread_lineinfo = "THREADID " + tmp;
+ }
+ size_t index = thread_lineinfo.find(':');
+ CHECK_NE(string::npos, index);
+ thread_lineinfo = thread_lineinfo.substr(0, index+1) + "LINE]";
+ string rest;
+ std::getline(iss, rest);
+ return (before + logcode_date[0] + "YEARDATE TIME__ " + thread_lineinfo +
+ MungeLine(rest));
+}
+
+static inline void StringReplace(string* str,
+ const string& oldsub,
+ const string& newsub) {
+ size_t pos = str->find(oldsub);
+ if (pos != string::npos) {
+ str->replace(pos, oldsub.size(), newsub);
+ }
+}
+
+static inline string Munge(const string& filename) {
+ FILE* fp = fopen(filename.c_str(), "rb");
+ CHECK(fp != nullptr) << filename << ": couldn't open";
+ char buf[4096];
+ string result;
+ while (fgets(buf, 4095, fp)) {
+ string line = MungeLine(buf);
+ const size_t str_size = 256;
+ char null_str[str_size];
+ char ptr_str[str_size];
+ snprintf(null_str, str_size, "%p", static_cast<void*>(nullptr));
+ snprintf(ptr_str, str_size, "%p", reinterpret_cast<void*>(PTR_TEST_VALUE));
+
+ StringReplace(&line, "__NULLP__", null_str);
+ StringReplace(&line, "__PTRTEST__", ptr_str);
+
+ StringReplace(&line, "__SUCCESS__", StrError(0));
+ StringReplace(&line, "__ENOENT__", StrError(ENOENT));
+ StringReplace(&line, "__EINTR__", StrError(EINTR));
+ StringReplace(&line, "__ENXIO__", StrError(ENXIO));
+ StringReplace(&line, "__ENOEXEC__", StrError(ENOEXEC));
+ result += line + "\n";
+ }
+ fclose(fp);
+ return result;
+}
+
+static inline void WriteToFile(const string& body, const string& file) {
+ FILE* fp = fopen(file.c_str(), "wb");
+ fwrite(body.data(), 1, body.size(), fp);
+ fclose(fp);
+}
+
+static inline bool MungeAndDiffTest(const string& golden_filename,
+ CapturedStream* cap) {
+ if (cap == s_captured_streams[STDOUT_FILENO]) {
+ CHECK(cap) << ": did you forget CaptureTestStdout()?";
+ } else {
+ CHECK(cap) << ": did you forget CaptureTestStderr()?";
+ }
+
+ cap->StopCapture();
+
+ // Run munge
+ const string captured = Munge(cap->filename());
+ const string golden = Munge(golden_filename);
+ if (captured != golden) {
+ fprintf(stderr,
+ "Test with golden file failed. We'll try to show the diff:\n");
+ string munged_golden = golden_filename + ".munged";
+ WriteToFile(golden, munged_golden);
+ string munged_captured = cap->filename() + ".munged";
+ WriteToFile(captured, munged_captured);
+#ifdef GLOG_OS_WINDOWS
+ string diffcmd("fc " + munged_golden + " " + munged_captured);
+#else
+ string diffcmd("diff -u " + munged_golden + " " + munged_captured);
+#endif
+ if (system(diffcmd.c_str()) != 0) {
+ fprintf(stderr, "diff command was failed.\n");
+ }
+ unlink(munged_golden.c_str());
+ unlink(munged_captured.c_str());
+ return false;
+ }
+ LOG(INFO) << "Diff was successful";
+ return true;
+}
+
+static inline bool MungeAndDiffTestStderr(const string& golden_filename) {
+ return MungeAndDiffTest(golden_filename, s_captured_streams[STDERR_FILENO]);
+}
+
+static inline bool MungeAndDiffTestStdout(const string& golden_filename) {
+ return MungeAndDiffTest(golden_filename, s_captured_streams[STDOUT_FILENO]);
+}
+
+// Save flags used from logging_unittest.cc.
+#ifndef HAVE_LIB_GFLAGS
+struct FlagSaver {
+ FlagSaver()
+ : v_(FLAGS_v),
+ stderrthreshold_(FLAGS_stderrthreshold),
+ logtostderr_(FLAGS_logtostderr),
+ alsologtostderr_(FLAGS_alsologtostderr) {}
+ ~FlagSaver() {
+ FLAGS_v = v_;
+ FLAGS_stderrthreshold = stderrthreshold_;
+ FLAGS_logtostderr = logtostderr_;
+ FLAGS_alsologtostderr = alsologtostderr_;
+ }
+ int v_;
+ int stderrthreshold_;
+ bool logtostderr_;
+ bool alsologtostderr_;
+};
+#endif
+
+class Thread {
+ public:
+ virtual ~Thread() = default;
+
+ void SetJoinable(bool) {}
+#if defined(GLOG_OS_WINDOWS) && !defined(GLOG_OS_CYGWIN)
+ void Start() {
+ handle_ = CreateThread(nullptr, 0, &Thread::InvokeThreadW, this, 0, &th_);
+ CHECK(handle_) << "CreateThread";
+ }
+ void Join() {
+ WaitForSingleObject(handle_, INFINITE);
+ }
+#elif defined(HAVE_PTHREAD)
+ void Start() { pthread_create(&th_, nullptr, &Thread::InvokeThread, this); }
+ void Join() { pthread_join(th_, nullptr); }
+#else
+# error No thread implementation.
+#endif
+
+ protected:
+ virtual void Run() = 0;
+
+ private:
+ static void* InvokeThread(void* self) {
+ (static_cast<Thread*>(self))->Run();
+ return nullptr;
+ }
+
+#if defined(GLOG_OS_WINDOWS) && !defined(GLOG_OS_CYGWIN)
+ static DWORD __stdcall InvokeThreadW(LPVOID self) {
+ InvokeThread(self);
+ return 0;
+ }
+ HANDLE handle_;
+ DWORD th_;
+#else
+ pthread_t th_;
+#endif
+};
+
+static inline void SleepForMilliseconds(unsigned t) {
+#ifndef GLOG_OS_WINDOWS
+# if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309L
+ const struct timespec req = {0, t * 1000 * 1000};
+ nanosleep(&req, nullptr);
+# else
+ usleep(t * 1000);
+# endif
+#else
+ Sleep(t);
+#endif
+}
+
+// Add hook for operator new to ensure there are no memory allocation.
+
+void (*g_new_hook)() = nullptr;
+
+_END_GOOGLE_NAMESPACE_
+
+void* operator new(size_t size) GOOGLE_GLOG_THROW_BAD_ALLOC {
+ if (GOOGLE_NAMESPACE::g_new_hook) {
+ GOOGLE_NAMESPACE::g_new_hook();
+ }
+ return malloc(size);
+}
+
+void* operator new[](size_t size) GOOGLE_GLOG_THROW_BAD_ALLOC {
+ return ::operator new(size);
+}
+
+void operator delete(void* p) noexcept { free(p); }
+
+void operator delete(void* p, size_t) noexcept { ::operator delete(p); }
+
+void operator delete[](void* p) noexcept { ::operator delete(p); }
+
+void operator delete[](void* p, size_t) noexcept { ::operator delete(p); }
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/logging.cc b/funasr/runtime/onnxruntime/third_party/glog/src/logging.cc
new file mode 100644
index 0000000..53b485c
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/logging.cc
@@ -0,0 +1,2678 @@
+// Copyright (c) 1999, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#define _GNU_SOURCE 1 // needed for O_NOFOLLOW and pread()/pwrite()
+
+#include "utilities.h"
+
+#include <algorithm>
+#include <cassert>
+#include <iomanip>
+#include <string>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h> // For _exit.
+#endif
+#include <climits>
+#include <sys/types.h>
+#include <sys/stat.h>
+#ifdef HAVE_SYS_UTSNAME_H
+# include <sys/utsname.h> // For uname.
+#endif
+#include <ctime>
+#include <fcntl.h>
+#include <cstdio>
+#include <iostream>
+#include <cstdarg>
+#include <cstdlib>
+#ifdef HAVE_PWD_H
+# include <pwd.h>
+#endif
+#ifdef HAVE_SYSLOG_H
+# include <syslog.h>
+#endif
+#include <vector>
+#include <cerrno> // for errno
+#include <sstream>
+#ifdef GLOG_OS_WINDOWS
+#include "windows/dirent.h"
+#else
+#include <dirent.h> // for automatic removal of old logs
+#endif
+#include "base/commandlineflags.h" // to get the program name
+#include <glog/logging.h>
+#include <glog/raw_logging.h>
+#include "base/googleinit.h"
+
+#ifdef HAVE_STACKTRACE
+# include "stacktrace.h"
+#endif
+
+#ifdef __ANDROID__
+#include <android/log.h>
+#endif
+
+using std::string;
+using std::vector;
+using std::setw;
+using std::setfill;
+using std::hex;
+using std::dec;
+using std::min;
+using std::ostream;
+using std::ostringstream;
+
+using std::FILE;
+using std::fwrite;
+using std::fclose;
+using std::fflush;
+using std::fprintf;
+using std::perror;
+
+#ifdef __QNX__
+using std::fdopen;
+#endif
+
+#ifdef _WIN32
+#define fdopen _fdopen
+#endif
+
+// There is no thread annotation support.
+#define EXCLUSIVE_LOCKS_REQUIRED(mu)
+
+static bool BoolFromEnv(const char *varname, bool defval) {
+ const char* const valstr = getenv(varname);
+ if (!valstr) {
+ return defval;
+ }
+ return memchr("tTyY1\0", valstr[0], 6) != nullptr;
+}
+
+GLOG_DEFINE_bool(timestamp_in_logfile_name,
+ BoolFromEnv("GOOGLE_TIMESTAMP_IN_LOGFILE_NAME", true),
+ "put a timestamp at the end of the log file name");
+GLOG_DEFINE_bool(logtostderr, BoolFromEnv("GOOGLE_LOGTOSTDERR", false),
+ "log messages go to stderr instead of logfiles");
+GLOG_DEFINE_bool(alsologtostderr, BoolFromEnv("GOOGLE_ALSOLOGTOSTDERR", false),
+ "log messages go to stderr in addition to logfiles");
+GLOG_DEFINE_bool(colorlogtostderr, false,
+ "color messages logged to stderr (if supported by terminal)");
+GLOG_DEFINE_bool(colorlogtostdout, false,
+ "color messages logged to stdout (if supported by terminal)");
+GLOG_DEFINE_bool(logtostdout, BoolFromEnv("GOOGLE_LOGTOSTDOUT", false),
+ "log messages go to stdout instead of logfiles");
+#ifdef GLOG_OS_LINUX
+GLOG_DEFINE_bool(drop_log_memory, true, "Drop in-memory buffers of log contents. "
+ "Logs can grow very quickly and they are rarely read before they "
+ "need to be evicted from memory. Instead, drop them from memory "
+ "as soon as they are flushed to disk.");
+#endif
+
+// By default, errors (including fatal errors) get logged to stderr as
+// well as the file.
+//
+// The default is ERROR instead of FATAL so that users can see problems
+// when they run a program without having to look in another file.
+DEFINE_int32(stderrthreshold,
+ GOOGLE_NAMESPACE::GLOG_ERROR,
+ "log messages at or above this level are copied to stderr in "
+ "addition to logfiles. This flag obsoletes --alsologtostderr.");
+
+GLOG_DEFINE_string(alsologtoemail, "",
+ "log messages go to these email addresses "
+ "in addition to logfiles");
+GLOG_DEFINE_bool(log_file_header, true,
+ "Write the file header at the start of each log file");
+GLOG_DEFINE_bool(log_prefix, true,
+ "Prepend the log prefix to the start of each log line");
+GLOG_DEFINE_bool(log_year_in_prefix, true,
+ "Include the year in the log prefix");
+GLOG_DEFINE_int32(minloglevel, 0, "Messages logged at a lower level than this don't "
+ "actually get logged anywhere");
+GLOG_DEFINE_int32(logbuflevel, 0,
+ "Buffer log messages logged at this level or lower"
+ " (-1 means don't buffer; 0 means buffer INFO only;"
+ " ...)");
+GLOG_DEFINE_int32(logbufsecs, 30,
+ "Buffer log messages for at most this many seconds");
+
+GLOG_DEFINE_int32(logcleansecs, 60 * 5, // every 5 minutes
+ "Clean overdue logs every this many seconds");
+
+GLOG_DEFINE_int32(logemaillevel, 999,
+ "Email log messages logged at this level or higher"
+ " (0 means email all; 3 means email FATAL only;"
+ " ...)");
+GLOG_DEFINE_string(logmailer, "",
+ "Mailer used to send logging email");
+
+// Compute the default value for --log_dir
+static const char* DefaultLogDir() {
+ const char* env;
+ env = getenv("GOOGLE_LOG_DIR");
+ if (env != nullptr && env[0] != '\0') {
+ return env;
+ }
+ env = getenv("TEST_TMPDIR");
+ if (env != nullptr && env[0] != '\0') {
+ return env;
+ }
+ return "";
+}
+
+GLOG_DEFINE_int32(logfile_mode, 0664, "Log file mode/permissions.");
+
+GLOG_DEFINE_string(log_dir, DefaultLogDir(),
+ "If specified, logfiles are written into this directory instead "
+ "of the default logging directory.");
+GLOG_DEFINE_string(log_link, "", "Put additional links to the log "
+ "files in this directory");
+
+GLOG_DEFINE_uint32(max_log_size, 1800,
+ "approx. maximum log file size (in MB). A value of 0 will "
+ "be silently overridden to 1.");
+
+GLOG_DEFINE_bool(stop_logging_if_full_disk, false,
+ "Stop attempting to log to disk if the disk is full.");
+
+GLOG_DEFINE_string(log_backtrace_at, "",
+ "Emit a backtrace when logging at file:linenum.");
+
+GLOG_DEFINE_bool(log_utc_time, false,
+ "Use UTC time for logging.");
+
+// TODO(hamaji): consider windows
+enum { PATH_SEPARATOR = '/' };
+
+#ifndef HAVE_PREAD
+#if defined(GLOG_OS_WINDOWS)
+#include <basetsd.h>
+#define ssize_t SSIZE_T
+#endif
+static ssize_t pread(int fd, void* buf, size_t count, off_t offset) {
+ off_t orig_offset = lseek(fd, 0, SEEK_CUR);
+ if (orig_offset == (off_t)-1)
+ return -1;
+ if (lseek(fd, offset, SEEK_CUR) == (off_t)-1)
+ return -1;
+ ssize_t len = read(fd, buf, count);
+ if (len < 0)
+ return len;
+ if (lseek(fd, orig_offset, SEEK_SET) == (off_t)-1)
+ return -1;
+ return len;
+}
+#endif // !HAVE_PREAD
+
+#ifndef HAVE_PWRITE
+static ssize_t pwrite(int fd, void* buf, size_t count, off_t offset) {
+ off_t orig_offset = lseek(fd, 0, SEEK_CUR);
+ if (orig_offset == (off_t)-1)
+ return -1;
+ if (lseek(fd, offset, SEEK_CUR) == (off_t)-1)
+ return -1;
+ ssize_t len = write(fd, buf, count);
+ if (len < 0)
+ return len;
+ if (lseek(fd, orig_offset, SEEK_SET) == (off_t)-1)
+ return -1;
+ return len;
+}
+#endif // !HAVE_PWRITE
+
+static void GetHostName(string* hostname) {
+#if defined(HAVE_SYS_UTSNAME_H)
+ struct utsname buf;
+ if (uname(&buf) < 0) {
+ // ensure null termination on failure
+ *buf.nodename = '\0';
+ }
+ *hostname = buf.nodename;
+#elif defined(GLOG_OS_WINDOWS)
+ char buf[MAX_COMPUTERNAME_LENGTH + 1];
+ DWORD len = MAX_COMPUTERNAME_LENGTH + 1;
+ if (GetComputerNameA(buf, &len)) {
+ *hostname = buf;
+ } else {
+ hostname->clear();
+ }
+#else
+# warning There is no way to retrieve the host name.
+ *hostname = "(unknown)";
+#endif
+}
+
+// Returns true iff terminal supports using colors in output.
+static bool TerminalSupportsColor() {
+ bool term_supports_color = false;
+#ifdef GLOG_OS_WINDOWS
+ // on Windows TERM variable is usually not set, but the console does
+ // support colors.
+ term_supports_color = true;
+#else
+ // On non-Windows platforms, we rely on the TERM variable.
+ const char* const term = getenv("TERM");
+ if (term != nullptr && term[0] != '\0') {
+ term_supports_color =
+ !strcmp(term, "xterm") ||
+ !strcmp(term, "xterm-color") ||
+ !strcmp(term, "xterm-256color") ||
+ !strcmp(term, "screen-256color") ||
+ !strcmp(term, "konsole") ||
+ !strcmp(term, "konsole-16color") ||
+ !strcmp(term, "konsole-256color") ||
+ !strcmp(term, "screen") ||
+ !strcmp(term, "linux") ||
+ !strcmp(term, "cygwin");
+ }
+#endif
+ return term_supports_color;
+}
+
+_START_GOOGLE_NAMESPACE_
+
+enum GLogColor {
+ COLOR_DEFAULT,
+ COLOR_RED,
+ COLOR_GREEN,
+ COLOR_YELLOW
+};
+
+static GLogColor SeverityToColor(LogSeverity severity) {
+ assert(severity >= 0 && severity < NUM_SEVERITIES);
+ GLogColor color = COLOR_DEFAULT;
+ switch (severity) {
+ case GLOG_INFO:
+ color = COLOR_DEFAULT;
+ break;
+ case GLOG_WARNING:
+ color = COLOR_YELLOW;
+ break;
+ case GLOG_ERROR:
+ case GLOG_FATAL:
+ color = COLOR_RED;
+ break;
+ default:
+ // should never get here.
+ assert(false);
+ }
+ return color;
+}
+
+#ifdef GLOG_OS_WINDOWS
+
+// Returns the character attribute for the given color.
+static WORD GetColorAttribute(GLogColor color) {
+ switch (color) {
+ case COLOR_RED: return FOREGROUND_RED;
+ case COLOR_GREEN: return FOREGROUND_GREEN;
+ case COLOR_YELLOW: return FOREGROUND_RED | FOREGROUND_GREEN;
+ default: return 0;
+ }
+}
+
+#else
+
+// Returns the ANSI color code for the given color.
+static const char* GetAnsiColorCode(GLogColor color) {
+ switch (color) {
+ case COLOR_RED: return "1";
+ case COLOR_GREEN: return "2";
+ case COLOR_YELLOW: return "3";
+ case COLOR_DEFAULT: return "";
+ };
+ return nullptr; // stop warning about return type.
+}
+
+#endif // GLOG_OS_WINDOWS
+
+// Safely get max_log_size, overriding to 1 if it somehow gets defined as 0
+static uint32 MaxLogSize() {
+ return (FLAGS_max_log_size > 0 && FLAGS_max_log_size < 4096
+ ? FLAGS_max_log_size
+ : 1);
+}
+
+// An arbitrary limit on the length of a single log message. This
+// is so that streaming can be done more efficiently.
+const size_t LogMessage::kMaxLogMessageLen = 30000;
+
+struct LogMessage::LogMessageData {
+ LogMessageData();
+
+ int preserved_errno_; // preserved errno
+ // Buffer space; contains complete message text.
+ char message_text_[LogMessage::kMaxLogMessageLen+1];
+ LogStream stream_;
+ char severity_; // What level is this LogMessage logged at?
+ int line_; // line number where logging call is.
+ void (LogMessage::*send_method_)(); // Call this in destructor to send
+ union { // At most one of these is used: union to keep the size low.
+ LogSink* sink_; // nullptr or sink to send message to
+ std::vector<std::string>*
+ outvec_; // nullptr or vector to push message onto
+ std::string* message_; // nullptr or string to write message into
+ };
+ size_t num_prefix_chars_; // # of chars of prefix in this message
+ size_t num_chars_to_log_; // # of chars of msg to send to log
+ size_t num_chars_to_syslog_; // # of chars of msg to send to syslog
+ const char* basename_; // basename of file that called LOG
+ const char* fullname_; // fullname of file that called LOG
+ bool has_been_flushed_; // false => data has not been flushed
+ bool first_fatal_; // true => this was first fatal msg
+
+ private:
+ LogMessageData(const LogMessageData&) = delete;
+ void operator=(const LogMessageData&) = delete;
+};
+
+// A mutex that allows only one thread to log at a time, to keep things from
+// getting jumbled. Some other very uncommon logging operations (like
+// changing the destination file for log messages of a given severity) also
+// lock this mutex. Please be sure that anybody who might possibly need to
+// lock it does so.
+static Mutex log_mutex;
+
+// Number of messages sent at each severity. Under log_mutex.
+int64 LogMessage::num_messages_[NUM_SEVERITIES] = {0, 0, 0, 0};
+
+// Globally disable log writing (if disk is full)
+static bool stop_writing = false;
+
+const char*const LogSeverityNames[NUM_SEVERITIES] = {
+ "INFO", "WARNING", "ERROR", "FATAL"
+};
+
+// Has the user called SetExitOnDFatal(true)?
+static bool exit_on_dfatal = true;
+
+const char* GetLogSeverityName(LogSeverity severity) {
+ return LogSeverityNames[severity];
+}
+
+static bool SendEmailInternal(const char*dest, const char *subject,
+ const char*body, bool use_logging);
+
+base::Logger::~Logger() = default;
+
+namespace {
+ // Optional user-configured callback to print custom prefixes.
+CustomPrefixCallback custom_prefix_callback = nullptr;
+// User-provided data to pass to the callback:
+void* custom_prefix_callback_data = nullptr;
+}
+
+namespace {
+
+// Encapsulates all file-system related state
+class LogFileObject : public base::Logger {
+ public:
+ LogFileObject(LogSeverity severity, const char* base_filename);
+ ~LogFileObject() override;
+
+ void Write(bool force_flush, // Should we force a flush here?
+ time_t timestamp, // Timestamp for this entry
+ const char* message, size_t message_len) override;
+
+ // Configuration options
+ void SetBasename(const char* basename);
+ void SetExtension(const char* ext);
+ void SetSymlinkBasename(const char* symlink_basename);
+
+ // Normal flushing routine
+ void Flush() override;
+
+ // It is the actual file length for the system loggers,
+ // i.e., INFO, ERROR, etc.
+ uint32 LogSize() override {
+ MutexLock l(&lock_);
+ return file_length_;
+ }
+
+ // Internal flush routine. Exposed so that FlushLogFilesUnsafe()
+ // can avoid grabbing a lock. Usually Flush() calls it after
+ // acquiring lock_.
+ void FlushUnlocked();
+
+ private:
+ static const uint32 kRolloverAttemptFrequency = 0x20;
+
+ Mutex lock_;
+ bool base_filename_selected_;
+ string base_filename_;
+ string symlink_basename_;
+ string filename_extension_; // option users can specify (eg to add port#)
+ FILE* file_{nullptr};
+ LogSeverity severity_;
+ uint32 bytes_since_flush_{0};
+ uint32 dropped_mem_length_{0};
+ uint32 file_length_{0};
+ unsigned int rollover_attempt_;
+ int64 next_flush_time_{0}; // cycle count at which to flush log
+ WallTime start_time_;
+
+ // Actually create a logfile using the value of base_filename_ and the
+ // optional argument time_pid_string
+ // REQUIRES: lock_ is held
+ bool CreateLogfile(const string& time_pid_string);
+};
+
+// Encapsulate all log cleaner related states
+class LogCleaner {
+ public:
+ LogCleaner();
+
+ // Setting overdue_days to 0 days will delete all logs.
+ void Enable(unsigned int overdue_days);
+ void Disable();
+
+ // update next_cleanup_time_
+ void UpdateCleanUpTime();
+
+ void Run(bool base_filename_selected,
+ const string& base_filename,
+ const string& filename_extension);
+
+ bool enabled() const { return enabled_; }
+
+ private:
+ vector<string> GetOverdueLogNames(string log_directory, unsigned int days,
+ const string& base_filename,
+ const string& filename_extension) const;
+
+ bool IsLogFromCurrentProject(const string& filepath,
+ const string& base_filename,
+ const string& filename_extension) const;
+
+ bool IsLogLastModifiedOver(const string& filepath, unsigned int days) const;
+
+ bool enabled_{false};
+ unsigned int overdue_days_{7};
+ int64 next_cleanup_time_{0}; // cycle count at which to clean overdue log
+};
+
+LogCleaner log_cleaner;
+
+} // namespace
+
+class LogDestination {
+ public:
+ friend class LogMessage;
+ friend void ReprintFatalMessage();
+ friend base::Logger* base::GetLogger(LogSeverity);
+ friend void base::SetLogger(LogSeverity, base::Logger*);
+
+ // These methods are just forwarded to by their global versions.
+ static void SetLogDestination(LogSeverity severity,
+ const char* base_filename);
+ static void SetLogSymlink(LogSeverity severity,
+ const char* symlink_basename);
+ static void AddLogSink(LogSink *destination);
+ static void RemoveLogSink(LogSink *destination);
+ static void SetLogFilenameExtension(const char* filename_extension);
+ static void SetStderrLogging(LogSeverity min_severity);
+ static void SetEmailLogging(LogSeverity min_severity, const char* addresses);
+ static void LogToStderr();
+ // Flush all log files that are at least at the given severity level
+ static void FlushLogFiles(int min_severity);
+ static void FlushLogFilesUnsafe(int min_severity);
+
+ // we set the maximum size of our packet to be 1400, the logic being
+ // to prevent fragmentation.
+ // Really this number is arbitrary.
+ static const int kNetworkBytes = 1400;
+
+ static const string& hostname();
+ static const bool& terminal_supports_color() {
+ return terminal_supports_color_;
+ }
+
+ static void DeleteLogDestinations();
+
+ private:
+ LogDestination(LogSeverity severity, const char* base_filename);
+ ~LogDestination();
+
+ // Take a log message of a particular severity and log it to stderr
+ // iff it's of a high enough severity to deserve it.
+ static void MaybeLogToStderr(LogSeverity severity, const char* message,
+ size_t message_len, size_t prefix_len);
+
+ // Take a log message of a particular severity and log it to email
+ // iff it's of a high enough severity to deserve it.
+ static void MaybeLogToEmail(LogSeverity severity, const char* message,
+ size_t len);
+ // Take a log message of a particular severity and log it to a file
+ // iff the base filename is not "" (which means "don't log to me")
+ static void MaybeLogToLogfile(LogSeverity severity,
+ time_t timestamp,
+ const char* message, size_t len);
+ // Take a log message of a particular severity and log it to the file
+ // for that severity and also for all files with severity less than
+ // this severity.
+ static void LogToAllLogfiles(LogSeverity severity,
+ time_t timestamp,
+ const char* message, size_t len);
+
+ // Send logging info to all registered sinks.
+ static void LogToSinks(LogSeverity severity, const char* full_filename,
+ const char* base_filename, int line,
+ const LogMessageTime& logmsgtime, const char* message,
+ size_t message_len);
+
+ // Wait for all registered sinks via WaitTillSent
+ // including the optional one in "data".
+ static void WaitForSinks(LogMessage::LogMessageData* data);
+
+ static LogDestination* log_destination(LogSeverity severity);
+
+ base::Logger* GetLoggerImpl() const { return logger_; }
+ void SetLoggerImpl(base::Logger* logger);
+ void ResetLoggerImpl() { SetLoggerImpl(&fileobject_); }
+
+ LogFileObject fileobject_;
+ base::Logger* logger_; // Either &fileobject_, or wrapper around it
+
+ static LogDestination* log_destinations_[NUM_SEVERITIES];
+ static LogSeverity email_logging_severity_;
+ static string addresses_;
+ static string hostname_;
+ static bool terminal_supports_color_;
+
+ // arbitrary global logging destinations.
+ static vector<LogSink*>* sinks_;
+
+ // Protects the vector sinks_,
+ // but not the LogSink objects its elements reference.
+ static Mutex sink_mutex_;
+
+ // Disallow
+ LogDestination(const LogDestination&) = delete;
+ LogDestination& operator=(const LogDestination&) = delete;
+};
+
+// Errors do not get logged to email by default.
+LogSeverity LogDestination::email_logging_severity_ = 99999;
+
+string LogDestination::addresses_;
+string LogDestination::hostname_;
+
+vector<LogSink*>* LogDestination::sinks_ = nullptr;
+Mutex LogDestination::sink_mutex_;
+bool LogDestination::terminal_supports_color_ = TerminalSupportsColor();
+
+/* static */
+const string& LogDestination::hostname() {
+ if (hostname_.empty()) {
+ GetHostName(&hostname_);
+ if (hostname_.empty()) {
+ hostname_ = "(unknown)";
+ }
+ }
+ return hostname_;
+}
+
+LogDestination::LogDestination(LogSeverity severity,
+ const char* base_filename)
+ : fileobject_(severity, base_filename),
+ logger_(&fileobject_) {
+}
+
+LogDestination::~LogDestination() {
+ ResetLoggerImpl();
+}
+
+void LogDestination::SetLoggerImpl(base::Logger* logger) {
+ if (logger_ == logger) {
+ // Prevent releasing currently held sink on reset
+ return;
+ }
+
+ if (logger_ && logger_ != &fileobject_) {
+ // Delete user-specified logger set via SetLogger().
+ delete logger_;
+ }
+ logger_ = logger;
+}
+
+inline void LogDestination::FlushLogFilesUnsafe(int min_severity) {
+ // assume we have the log_mutex or we simply don't care
+ // about it
+ for (int i = min_severity; i < NUM_SEVERITIES; i++) {
+ LogDestination* log = log_destinations_[i];
+ if (log != nullptr) {
+ // Flush the base fileobject_ logger directly instead of going
+ // through any wrappers to reduce chance of deadlock.
+ log->fileobject_.FlushUnlocked();
+ }
+ }
+}
+
+inline void LogDestination::FlushLogFiles(int min_severity) {
+ // Prevent any subtle race conditions by wrapping a mutex lock around
+ // all this stuff.
+ MutexLock l(&log_mutex);
+ for (int i = min_severity; i < NUM_SEVERITIES; i++) {
+ LogDestination* log = log_destination(i);
+ if (log != nullptr) {
+ log->logger_->Flush();
+ }
+ }
+}
+
+inline void LogDestination::SetLogDestination(LogSeverity severity,
+ const char* base_filename) {
+ assert(severity >= 0 && severity < NUM_SEVERITIES);
+ // Prevent any subtle race conditions by wrapping a mutex lock around
+ // all this stuff.
+ MutexLock l(&log_mutex);
+ log_destination(severity)->fileobject_.SetBasename(base_filename);
+}
+
+inline void LogDestination::SetLogSymlink(LogSeverity severity,
+ const char* symlink_basename) {
+ CHECK_GE(severity, 0);
+ CHECK_LT(severity, NUM_SEVERITIES);
+ MutexLock l(&log_mutex);
+ log_destination(severity)->fileobject_.SetSymlinkBasename(symlink_basename);
+}
+
+inline void LogDestination::AddLogSink(LogSink *destination) {
+ // Prevent any subtle race conditions by wrapping a mutex lock around
+ // all this stuff.
+ MutexLock l(&sink_mutex_);
+ if (!sinks_) sinks_ = new vector<LogSink*>;
+ sinks_->push_back(destination);
+}
+
+inline void LogDestination::RemoveLogSink(LogSink *destination) {
+ // Prevent any subtle race conditions by wrapping a mutex lock around
+ // all this stuff.
+ MutexLock l(&sink_mutex_);
+ // This doesn't keep the sinks in order, but who cares?
+ if (sinks_) {
+ sinks_->erase(std::remove(sinks_->begin(), sinks_->end(), destination), sinks_->end());
+ }
+}
+
+inline void LogDestination::SetLogFilenameExtension(const char* ext) {
+ // Prevent any subtle race conditions by wrapping a mutex lock around
+ // all this stuff.
+ MutexLock l(&log_mutex);
+ for ( int severity = 0; severity < NUM_SEVERITIES; ++severity ) {
+ log_destination(severity)->fileobject_.SetExtension(ext);
+ }
+}
+
+inline void LogDestination::SetStderrLogging(LogSeverity min_severity) {
+ assert(min_severity >= 0 && min_severity < NUM_SEVERITIES);
+ // Prevent any subtle race conditions by wrapping a mutex lock around
+ // all this stuff.
+ MutexLock l(&log_mutex);
+ FLAGS_stderrthreshold = min_severity;
+}
+
+inline void LogDestination::LogToStderr() {
+ // *Don't* put this stuff in a mutex lock, since SetStderrLogging &
+ // SetLogDestination already do the locking!
+ SetStderrLogging(0); // thus everything is "also" logged to stderr
+ for ( int i = 0; i < NUM_SEVERITIES; ++i ) {
+ SetLogDestination(i, ""); // "" turns off logging to a logfile
+ }
+}
+
+inline void LogDestination::SetEmailLogging(LogSeverity min_severity,
+ const char* addresses) {
+ assert(min_severity >= 0 && min_severity < NUM_SEVERITIES);
+ // Prevent any subtle race conditions by wrapping a mutex lock around
+ // all this stuff.
+ MutexLock l(&log_mutex);
+ LogDestination::email_logging_severity_ = min_severity;
+ LogDestination::addresses_ = addresses;
+}
+
+static void ColoredWriteToStderrOrStdout(FILE* output, LogSeverity severity,
+ const char* message, size_t len) {
+ bool is_stdout = (output == stdout);
+ const GLogColor color = (LogDestination::terminal_supports_color() &&
+ ((!is_stdout && FLAGS_colorlogtostderr) ||
+ (is_stdout && FLAGS_colorlogtostdout)))
+ ? SeverityToColor(severity)
+ : COLOR_DEFAULT;
+
+ // Avoid using cerr from this module since we may get called during
+ // exit code, and cerr may be partially or fully destroyed by then.
+ if (COLOR_DEFAULT == color) {
+ fwrite(message, len, 1, output);
+ return;
+ }
+#ifdef GLOG_OS_WINDOWS
+ const HANDLE output_handle =
+ GetStdHandle(is_stdout ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE);
+
+ // Gets the current text color.
+ CONSOLE_SCREEN_BUFFER_INFO buffer_info;
+ GetConsoleScreenBufferInfo(output_handle, &buffer_info);
+ const WORD old_color_attrs = buffer_info.wAttributes;
+
+ // We need to flush the stream buffers into the console before each
+ // SetConsoleTextAttribute call lest it affect the text that is already
+ // printed but has not yet reached the console.
+ fflush(output);
+ SetConsoleTextAttribute(output_handle,
+ GetColorAttribute(color) | FOREGROUND_INTENSITY);
+ fwrite(message, len, 1, output);
+ fflush(output);
+ // Restores the text color.
+ SetConsoleTextAttribute(output_handle, old_color_attrs);
+#else
+ fprintf(output, "\033[0;3%sm", GetAnsiColorCode(color));
+ fwrite(message, len, 1, output);
+ fprintf(output, "\033[m"); // Resets the terminal to default.
+#endif // GLOG_OS_WINDOWS
+}
+
+static void ColoredWriteToStdout(LogSeverity severity, const char* message,
+ size_t len) {
+ FILE* output = stdout;
+ // We also need to send logs to the stderr when the severity is
+ // higher or equal to the stderr threshold.
+ if (severity >= FLAGS_stderrthreshold) {
+ output = stderr;
+ }
+ ColoredWriteToStderrOrStdout(output, severity, message, len);
+}
+
+static void ColoredWriteToStderr(LogSeverity severity, const char* message,
+ size_t len) {
+ ColoredWriteToStderrOrStdout(stderr, severity, message, len);
+}
+
+static void WriteToStderr(const char* message, size_t len) {
+ // Avoid using cerr from this module since we may get called during
+ // exit code, and cerr may be partially or fully destroyed by then.
+ fwrite(message, len, 1, stderr);
+}
+
+inline void LogDestination::MaybeLogToStderr(LogSeverity severity,
+ const char* message, size_t message_len, size_t prefix_len) {
+ if ((severity >= FLAGS_stderrthreshold) || FLAGS_alsologtostderr) {
+ ColoredWriteToStderr(severity, message, message_len);
+#ifdef GLOG_OS_WINDOWS
+ (void) prefix_len;
+ // On Windows, also output to the debugger
+ ::OutputDebugStringA(message);
+#elif defined(__ANDROID__)
+ // On Android, also output to logcat
+ const int android_log_levels[NUM_SEVERITIES] = {
+ ANDROID_LOG_INFO,
+ ANDROID_LOG_WARN,
+ ANDROID_LOG_ERROR,
+ ANDROID_LOG_FATAL,
+ };
+ __android_log_write(android_log_levels[severity],
+ glog_internal_namespace_::ProgramInvocationShortName(),
+ message + prefix_len);
+#else
+ (void) prefix_len;
+#endif
+ }
+}
+
+
+inline void LogDestination::MaybeLogToEmail(LogSeverity severity,
+ const char* message, size_t len) {
+ if (severity >= email_logging_severity_ ||
+ severity >= FLAGS_logemaillevel) {
+ string to(FLAGS_alsologtoemail);
+ if (!addresses_.empty()) {
+ if (!to.empty()) {
+ to += ",";
+ }
+ to += addresses_;
+ }
+ const string subject(string("[LOG] ") + LogSeverityNames[severity] + ": " +
+ glog_internal_namespace_::ProgramInvocationShortName());
+ string body(hostname());
+ body += "\n\n";
+ body.append(message, len);
+
+ // should NOT use SendEmail(). The caller of this function holds the
+ // log_mutex and SendEmail() calls LOG/VLOG which will block trying to
+ // acquire the log_mutex object. Use SendEmailInternal() and set
+ // use_logging to false.
+ SendEmailInternal(to.c_str(), subject.c_str(), body.c_str(), false);
+ }
+}
+
+
+inline void LogDestination::MaybeLogToLogfile(LogSeverity severity,
+ time_t timestamp,
+ const char* message,
+ size_t len) {
+ const bool should_flush = severity > FLAGS_logbuflevel;
+ LogDestination* destination = log_destination(severity);
+ destination->logger_->Write(should_flush, timestamp, message, len);
+}
+
+inline void LogDestination::LogToAllLogfiles(LogSeverity severity,
+ time_t timestamp,
+ const char* message,
+ size_t len) {
+ if (FLAGS_logtostdout) { // global flag: never log to file
+ ColoredWriteToStdout(severity, message, len);
+ } else if (FLAGS_logtostderr) { // global flag: never log to file
+ ColoredWriteToStderr(severity, message, len);
+ } else {
+ for (int i = severity; i >= 0; --i) {
+ LogDestination::MaybeLogToLogfile(i, timestamp, message, len);
+ }
+ }
+}
+
+inline void LogDestination::LogToSinks(LogSeverity severity,
+ const char* full_filename,
+ const char* base_filename, int line,
+ const LogMessageTime& logmsgtime,
+ const char* message,
+ size_t message_len) {
+ ReaderMutexLock l(&sink_mutex_);
+ if (sinks_) {
+ for (size_t i = sinks_->size(); i-- > 0; ) {
+ (*sinks_)[i]->send(severity, full_filename, base_filename,
+ line, logmsgtime, message, message_len);
+ }
+ }
+}
+
+inline void LogDestination::WaitForSinks(LogMessage::LogMessageData* data) {
+ ReaderMutexLock l(&sink_mutex_);
+ if (sinks_) {
+ for (size_t i = sinks_->size(); i-- > 0; ) {
+ (*sinks_)[i]->WaitTillSent();
+ }
+ }
+ const bool send_to_sink =
+ (data->send_method_ == &LogMessage::SendToSink) ||
+ (data->send_method_ == &LogMessage::SendToSinkAndLog);
+ if (send_to_sink && data->sink_ != nullptr) {
+ data->sink_->WaitTillSent();
+ }
+}
+
+LogDestination* LogDestination::log_destinations_[NUM_SEVERITIES];
+
+inline LogDestination* LogDestination::log_destination(LogSeverity severity) {
+ assert(severity >=0 && severity < NUM_SEVERITIES);
+ if (!log_destinations_[severity]) {
+ log_destinations_[severity] = new LogDestination(severity, nullptr);
+ }
+ return log_destinations_[severity];
+}
+
+void LogDestination::DeleteLogDestinations() {
+ for (auto& log_destination : log_destinations_) {
+ delete log_destination;
+ log_destination = nullptr;
+ }
+ MutexLock l(&sink_mutex_);
+ delete sinks_;
+ sinks_ = nullptr;
+}
+
+namespace {
+
+std::string g_application_fingerprint;
+
+} // namespace
+
+void SetApplicationFingerprint(const std::string& fingerprint) {
+ g_application_fingerprint = fingerprint;
+}
+
+namespace {
+
+// Directory delimiter; Windows supports both forward slashes and backslashes
+#ifdef GLOG_OS_WINDOWS
+const char possible_dir_delim[] = {'\\', '/'};
+#else
+const char possible_dir_delim[] = {'/'};
+#endif
+
+string PrettyDuration(int secs) {
+ std::stringstream result;
+ int mins = secs / 60;
+ int hours = mins / 60;
+ mins = mins % 60;
+ secs = secs % 60;
+ result.fill('0');
+ result << hours << ':' << setw(2) << mins << ':' << setw(2) << secs;
+ return result.str();
+}
+
+LogFileObject::LogFileObject(LogSeverity severity, const char* base_filename)
+ : base_filename_selected_(base_filename != nullptr),
+ base_filename_((base_filename != nullptr) ? base_filename : ""),
+ symlink_basename_(glog_internal_namespace_::ProgramInvocationShortName()),
+ filename_extension_(),
+
+ severity_(severity),
+
+ rollover_attempt_(kRolloverAttemptFrequency - 1),
+
+ start_time_(WallTime_Now()) {
+ assert(severity >= 0);
+ assert(severity < NUM_SEVERITIES);
+}
+
+LogFileObject::~LogFileObject() {
+ MutexLock l(&lock_);
+ if (file_ != nullptr) {
+ fclose(file_);
+ file_ = nullptr;
+ }
+}
+
+void LogFileObject::SetBasename(const char* basename) {
+ MutexLock l(&lock_);
+ base_filename_selected_ = true;
+ if (base_filename_ != basename) {
+ // Get rid of old log file since we are changing names
+ if (file_ != nullptr) {
+ fclose(file_);
+ file_ = nullptr;
+ rollover_attempt_ = kRolloverAttemptFrequency-1;
+ }
+ base_filename_ = basename;
+ }
+}
+
+void LogFileObject::SetExtension(const char* ext) {
+ MutexLock l(&lock_);
+ if (filename_extension_ != ext) {
+ // Get rid of old log file since we are changing names
+ if (file_ != nullptr) {
+ fclose(file_);
+ file_ = nullptr;
+ rollover_attempt_ = kRolloverAttemptFrequency-1;
+ }
+ filename_extension_ = ext;
+ }
+}
+
+void LogFileObject::SetSymlinkBasename(const char* symlink_basename) {
+ MutexLock l(&lock_);
+ symlink_basename_ = symlink_basename;
+}
+
+void LogFileObject::Flush() {
+ MutexLock l(&lock_);
+ FlushUnlocked();
+}
+
+void LogFileObject::FlushUnlocked(){
+ if (file_ != nullptr) {
+ fflush(file_);
+ bytes_since_flush_ = 0;
+ }
+ // Figure out when we are due for another flush.
+ const int64 next = (FLAGS_logbufsecs
+ * static_cast<int64>(1000000)); // in usec
+ next_flush_time_ = CycleClock_Now() + UsecToCycles(next);
+}
+
+bool LogFileObject::CreateLogfile(const string& time_pid_string) {
+ string string_filename = base_filename_;
+ if (FLAGS_timestamp_in_logfile_name) {
+ string_filename += time_pid_string;
+ }
+ string_filename += filename_extension_;
+ const char* filename = string_filename.c_str();
+ //only write to files, create if non-existant.
+ int flags = O_WRONLY | O_CREAT;
+ if (FLAGS_timestamp_in_logfile_name) {
+ //demand that the file is unique for our timestamp (fail if it exists).
+ flags = flags | O_EXCL;
+ }
+ int fd = open(filename, flags, static_cast<mode_t>(FLAGS_logfile_mode));
+ if (fd == -1) return false;
+#ifdef HAVE_FCNTL
+ // Mark the file close-on-exec. We don't really care if this fails
+ fcntl(fd, F_SETFD, FD_CLOEXEC);
+
+ // Mark the file as exclusive write access to avoid two clients logging to the
+ // same file. This applies particularly when !FLAGS_timestamp_in_logfile_name
+ // (otherwise open would fail because the O_EXCL flag on similar filename).
+ // locks are released on unlock or close() automatically, only after log is
+ // released.
+ // This will work after a fork as it is not inherited (not stored in the fd).
+ // Lock will not be lost because the file is opened with exclusive lock
+ // (write) and we will never read from it inside the process.
+ // TODO: windows implementation of this (as flock is not available on
+ // mingw).
+ static struct flock w_lock;
+
+ w_lock.l_type = F_WRLCK;
+ w_lock.l_start = 0;
+ w_lock.l_whence = SEEK_SET;
+ w_lock.l_len = 0;
+
+ int wlock_ret = fcntl(fd, F_SETLK, &w_lock);
+ if (wlock_ret == -1) {
+ close(fd); //as we are failing already, do not check errors here
+ return false;
+ }
+#endif
+
+ //fdopen in append mode so if the file exists it will fseek to the end
+ file_ = fdopen(fd, "a"); // Make a FILE*.
+ if (file_ == nullptr) { // Man, we're screwed!
+ close(fd);
+ if (FLAGS_timestamp_in_logfile_name) {
+ unlink(filename); // Erase the half-baked evidence: an unusable log file, only if we just created it.
+ }
+ return false;
+ }
+#ifdef GLOG_OS_WINDOWS
+ // https://github.com/golang/go/issues/27638 - make sure we seek to the end to append
+ // empirically replicated with wine over mingw build
+ if (!FLAGS_timestamp_in_logfile_name) {
+ if (fseek(file_, 0, SEEK_END) != 0) {
+ return false;
+ }
+ }
+#endif
+ // We try to create a symlink called <program_name>.<severity>,
+ // which is easier to use. (Every time we create a new logfile,
+ // we destroy the old symlink and create a new one, so it always
+ // points to the latest logfile.) If it fails, we're sad but it's
+ // no error.
+ if (!symlink_basename_.empty()) {
+ // take directory from filename
+ const char* slash = strrchr(filename, PATH_SEPARATOR);
+ const string linkname =
+ symlink_basename_ + '.' + LogSeverityNames[severity_];
+ string linkpath;
+ if ( slash ) linkpath = string(filename, static_cast<size_t>(slash-filename+1)); // get dirname
+ linkpath += linkname;
+ unlink(linkpath.c_str()); // delete old one if it exists
+
+#if defined(GLOG_OS_WINDOWS)
+ // TODO(hamaji): Create lnk file on Windows?
+#elif defined(HAVE_UNISTD_H)
+ // We must have unistd.h.
+ // Make the symlink be relative (in the same dir) so that if the
+ // entire log directory gets relocated the link is still valid.
+ const char *linkdest = slash ? (slash + 1) : filename;
+ if (symlink(linkdest, linkpath.c_str()) != 0) {
+ // silently ignore failures
+ }
+
+ // Make an additional link to the log file in a place specified by
+ // FLAGS_log_link, if indicated
+ if (!FLAGS_log_link.empty()) {
+ linkpath = FLAGS_log_link + "/" + linkname;
+ unlink(linkpath.c_str()); // delete old one if it exists
+ if (symlink(filename, linkpath.c_str()) != 0) {
+ // silently ignore failures
+ }
+ }
+#endif
+ }
+
+ return true; // Everything worked
+}
+
+void LogFileObject::Write(bool force_flush,
+ time_t timestamp,
+ const char* message,
+ size_t message_len) {
+ MutexLock l(&lock_);
+
+ // We don't log if the base_name_ is "" (which means "don't write")
+ if (base_filename_selected_ && base_filename_.empty()) {
+ return;
+ }
+
+ if (file_length_ >> 20U >= MaxLogSize() || PidHasChanged()) {
+ if (file_ != nullptr) fclose(file_);
+ file_ = nullptr;
+ file_length_ = bytes_since_flush_ = dropped_mem_length_ = 0;
+ rollover_attempt_ = kRolloverAttemptFrequency - 1;
+ }
+
+ // If there's no destination file, make one before outputting
+ if (file_ == nullptr) {
+ // Try to rollover the log file every 32 log messages. The only time
+ // this could matter would be when we have trouble creating the log
+ // file. If that happens, we'll lose lots of log messages, of course!
+ if (++rollover_attempt_ != kRolloverAttemptFrequency) return;
+ rollover_attempt_ = 0;
+
+ struct ::tm tm_time;
+ if (FLAGS_log_utc_time) {
+ gmtime_r(×tamp, &tm_time);
+ } else {
+ localtime_r(×tamp, &tm_time);
+ }
+
+ // The logfile's filename will have the date/time & pid in it
+ ostringstream time_pid_stream;
+ time_pid_stream.fill('0');
+ time_pid_stream << 1900+tm_time.tm_year
+ << setw(2) << 1+tm_time.tm_mon
+ << setw(2) << tm_time.tm_mday
+ << '-'
+ << setw(2) << tm_time.tm_hour
+ << setw(2) << tm_time.tm_min
+ << setw(2) << tm_time.tm_sec
+ << '.'
+ << GetMainThreadPid();
+ const string& time_pid_string = time_pid_stream.str();
+
+ if (base_filename_selected_) {
+ if (!CreateLogfile(time_pid_string)) {
+ perror("Could not create log file");
+ fprintf(stderr, "COULD NOT CREATE LOGFILE '%s'!\n",
+ time_pid_string.c_str());
+ return;
+ }
+ } else {
+ // If no base filename for logs of this severity has been set, use a
+ // default base filename of
+ // "<program name>.<hostname>.<user name>.log.<severity level>.". So
+ // logfiles will have names like
+ // webserver.examplehost.root.log.INFO.19990817-150000.4354, where
+ // 19990817 is a date (1999 August 17), 150000 is a time (15:00:00),
+ // and 4354 is the pid of the logging process. The date & time reflect
+ // when the file was created for output.
+ //
+ // Where does the file get put? Successively try the directories
+ // "/tmp", and "."
+ string stripped_filename(
+ glog_internal_namespace_::ProgramInvocationShortName());
+ string hostname;
+ GetHostName(&hostname);
+
+ string uidname = MyUserName();
+ // We should not call CHECK() here because this function can be
+ // called after holding on to log_mutex. We don't want to
+ // attempt to hold on to the same mutex, and get into a
+ // deadlock. Simply use a name like invalid-user.
+ if (uidname.empty()) uidname = "invalid-user";
+
+ stripped_filename = stripped_filename+'.'+hostname+'.'
+ +uidname+".log."
+ +LogSeverityNames[severity_]+'.';
+ // We're going to (potentially) try to put logs in several different dirs
+ const vector<string> & log_dirs = GetLoggingDirectories();
+
+ // Go through the list of dirs, and try to create the log file in each
+ // until we succeed or run out of options
+ bool success = false;
+ for (const auto& log_dir : log_dirs) {
+ base_filename_ = log_dir + "/" + stripped_filename;
+ if ( CreateLogfile(time_pid_string) ) {
+ success = true;
+ break;
+ }
+ }
+ // If we never succeeded, we have to give up
+ if ( success == false ) {
+ perror("Could not create logging file");
+ fprintf(stderr, "COULD NOT CREATE A LOGGINGFILE %s!",
+ time_pid_string.c_str());
+ return;
+ }
+ }
+
+ // Write a header message into the log file
+ if (FLAGS_log_file_header) {
+ ostringstream file_header_stream;
+ file_header_stream.fill('0');
+ file_header_stream << "Log file created at: "
+ << 1900+tm_time.tm_year << '/'
+ << setw(2) << 1+tm_time.tm_mon << '/'
+ << setw(2) << tm_time.tm_mday
+ << ' '
+ << setw(2) << tm_time.tm_hour << ':'
+ << setw(2) << tm_time.tm_min << ':'
+ << setw(2) << tm_time.tm_sec << (FLAGS_log_utc_time ? " UTC\n" : "\n")
+ << "Running on machine: "
+ << LogDestination::hostname() << '\n';
+
+ if(!g_application_fingerprint.empty()) {
+ file_header_stream << "Application fingerprint: " << g_application_fingerprint << '\n';
+ }
+ const char* const date_time_format = FLAGS_log_year_in_prefix
+ ? "yyyymmdd hh:mm:ss.uuuuuu"
+ : "mmdd hh:mm:ss.uuuuuu";
+ file_header_stream << "Running duration (h:mm:ss): "
+ << PrettyDuration(static_cast<int>(WallTime_Now() - start_time_)) << '\n'
+ << "Log line format: [IWEF]" << date_time_format << " "
+ << "threadid file:line] msg" << '\n';
+ const string& file_header_string = file_header_stream.str();
+
+ const size_t header_len = file_header_string.size();
+ fwrite(file_header_string.data(), 1, header_len, file_);
+ file_length_ += header_len;
+ bytes_since_flush_ += header_len;
+ }
+ }
+
+ // Write to LOG file
+ if ( !stop_writing ) {
+ // fwrite() doesn't return an error when the disk is full, for
+ // messages that are less than 4096 bytes. When the disk is full,
+ // it returns the message length for messages that are less than
+ // 4096 bytes. fwrite() returns 4096 for message lengths that are
+ // greater than 4096, thereby indicating an error.
+ errno = 0;
+ fwrite(message, 1, message_len, file_);
+ if ( FLAGS_stop_logging_if_full_disk &&
+ errno == ENOSPC ) { // disk full, stop writing to disk
+ stop_writing = true; // until the disk is
+ return;
+ } else {
+ file_length_ += message_len;
+ bytes_since_flush_ += message_len;
+ }
+ } else {
+ if (CycleClock_Now() >= next_flush_time_) {
+ stop_writing = false; // check to see if disk has free space.
+ }
+ return; // no need to flush
+ }
+
+ // See important msgs *now*. Also, flush logs at least every 10^6 chars,
+ // or every "FLAGS_logbufsecs" seconds.
+ if ( force_flush ||
+ (bytes_since_flush_ >= 1000000) ||
+ (CycleClock_Now() >= next_flush_time_) ) {
+ FlushUnlocked();
+#ifdef GLOG_OS_LINUX
+ // Only consider files >= 3MiB
+ if (FLAGS_drop_log_memory && file_length_ >= (3U << 20U)) {
+ // Don't evict the most recent 1-2MiB so as not to impact a tailer
+ // of the log file and to avoid page rounding issue on linux < 4.7
+ uint32 total_drop_length =
+ (file_length_ & ~((1U << 20U) - 1U)) - (1U << 20U);
+ uint32 this_drop_length = total_drop_length - dropped_mem_length_;
+ if (this_drop_length >= (2U << 20U)) {
+ // Only advise when >= 2MiB to drop
+# if defined(__ANDROID__) && defined(__ANDROID_API__) && (__ANDROID_API__ < 21)
+ // 'posix_fadvise' introduced in API 21:
+ // * https://android.googlesource.com/platform/bionic/+/6880f936173081297be0dc12f687d341b86a4cfa/libc/libc.map.txt#732
+# else
+ posix_fadvise(fileno(file_), static_cast<off_t>(dropped_mem_length_),
+ static_cast<off_t>(this_drop_length),
+ POSIX_FADV_DONTNEED);
+# endif
+ dropped_mem_length_ = total_drop_length;
+ }
+ }
+#endif
+
+ // Remove old logs
+ if (log_cleaner.enabled()) {
+ log_cleaner.Run(base_filename_selected_,
+ base_filename_,
+ filename_extension_);
+ }
+ }
+}
+
+LogCleaner::LogCleaner() = default;
+
+void LogCleaner::Enable(unsigned int overdue_days) {
+ enabled_ = true;
+ overdue_days_ = overdue_days;
+}
+
+void LogCleaner::Disable() {
+ enabled_ = false;
+}
+
+void LogCleaner::UpdateCleanUpTime() {
+ const int64 next = (FLAGS_logcleansecs
+ * 1000000); // in usec
+ next_cleanup_time_ = CycleClock_Now() + UsecToCycles(next);
+}
+
+void LogCleaner::Run(bool base_filename_selected,
+ const string& base_filename,
+ const string& filename_extension) {
+ assert(enabled_);
+ assert(!base_filename_selected || !base_filename.empty());
+
+ // avoid scanning logs too frequently
+ if (CycleClock_Now() < next_cleanup_time_) {
+ return;
+ }
+ UpdateCleanUpTime();
+
+ vector<string> dirs;
+
+ if (!base_filename_selected) {
+ dirs = GetLoggingDirectories();
+ } else {
+ size_t pos = base_filename.find_last_of(possible_dir_delim, string::npos,
+ sizeof(possible_dir_delim));
+ if (pos != string::npos) {
+ string dir = base_filename.substr(0, pos + 1);
+ dirs.push_back(dir);
+ } else {
+ dirs.emplace_back(".");
+ }
+ }
+
+ for (auto& dir : dirs) {
+ vector<string> logs = GetOverdueLogNames(dir, overdue_days_, base_filename,
+ filename_extension);
+ for (auto& log : logs) {
+ static_cast<void>(unlink(log.c_str()));
+ }
+ }
+}
+
+vector<string> LogCleaner::GetOverdueLogNames(
+ string log_directory, unsigned int days, const string& base_filename,
+ const string& filename_extension) const {
+ // The names of overdue logs.
+ vector<string> overdue_log_names;
+
+ // Try to get all files within log_directory.
+ DIR *dir;
+ struct dirent *ent;
+
+ if ((dir = opendir(log_directory.c_str()))) {
+ while ((ent = readdir(dir))) {
+ if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) {
+ continue;
+ }
+
+ string filepath = ent->d_name;
+ const char* const dir_delim_end =
+ possible_dir_delim + sizeof(possible_dir_delim);
+
+ if (!log_directory.empty() &&
+ std::find(possible_dir_delim, dir_delim_end,
+ log_directory[log_directory.size() - 1]) != dir_delim_end) {
+ filepath = log_directory + filepath;
+ }
+
+ if (IsLogFromCurrentProject(filepath, base_filename, filename_extension) &&
+ IsLogLastModifiedOver(filepath, days)) {
+ overdue_log_names.push_back(filepath);
+ }
+ }
+ closedir(dir);
+ }
+
+ return overdue_log_names;
+}
+
+bool LogCleaner::IsLogFromCurrentProject(const string& filepath,
+ const string& base_filename,
+ const string& filename_extension) const {
+ // We should remove duplicated delimiters from `base_filename`, e.g.,
+ // before: "/tmp//<base_filename>.<create_time>.<pid>"
+ // after: "/tmp/<base_filename>.<create_time>.<pid>"
+ string cleaned_base_filename;
+
+ const char* const dir_delim_end =
+ possible_dir_delim + sizeof(possible_dir_delim);
+
+ size_t real_filepath_size = filepath.size();
+ for (char c : base_filename) {
+ if (cleaned_base_filename.empty()) {
+ cleaned_base_filename += c;
+ } else if (std::find(possible_dir_delim, dir_delim_end, c) ==
+ dir_delim_end ||
+ (!cleaned_base_filename.empty() &&
+ c != cleaned_base_filename[cleaned_base_filename.size() - 1])) {
+ cleaned_base_filename += c;
+ }
+ }
+
+ // Return early if the filename doesn't start with `cleaned_base_filename`.
+ if (filepath.find(cleaned_base_filename) != 0) {
+ return false;
+ }
+
+ // Check if in the string `filename_extension` is right next to
+ // `cleaned_base_filename` in `filepath` if the user
+ // has set a custom filename extension.
+ if (!filename_extension.empty()) {
+ if (cleaned_base_filename.size() >= real_filepath_size) {
+ return false;
+ }
+ // for origin version, `filename_extension` is middle of the `filepath`.
+ string ext = filepath.substr(cleaned_base_filename.size(), filename_extension.size());
+ if (ext == filename_extension) {
+ cleaned_base_filename += filename_extension;
+ }
+ else {
+ // for new version, `filename_extension` is right of the `filepath`.
+ if (filename_extension.size() >= real_filepath_size) {
+ return false;
+ }
+ real_filepath_size = filepath.size() - filename_extension.size();
+ if (filepath.substr(real_filepath_size) != filename_extension) {
+ return false;
+ }
+ }
+ }
+
+ // The characters after `cleaned_base_filename` should match the format:
+ // YYYYMMDD-HHMMSS.pid
+ for (size_t i = cleaned_base_filename.size(); i < real_filepath_size; i++) {
+ const char& c = filepath[i];
+
+ if (i <= cleaned_base_filename.size() + 7) { // 0 ~ 7 : YYYYMMDD
+ if (c < '0' || c > '9') { return false; }
+
+ } else if (i == cleaned_base_filename.size() + 8) { // 8: -
+ if (c != '-') { return false; }
+
+ } else if (i <= cleaned_base_filename.size() + 14) { // 9 ~ 14: HHMMSS
+ if (c < '0' || c > '9') { return false; }
+
+ } else if (i == cleaned_base_filename.size() + 15) { // 15: .
+ if (c != '.') { return false; }
+
+ } else if (i >= cleaned_base_filename.size() + 16) { // 16+: pid
+ if (c < '0' || c > '9') { return false; }
+ }
+ }
+
+ return true;
+}
+
+bool LogCleaner::IsLogLastModifiedOver(const string& filepath,
+ unsigned int days) const {
+ // Try to get the last modified time of this file.
+ struct stat file_stat;
+
+ if (stat(filepath.c_str(), &file_stat) == 0) {
+ const time_t seconds_in_a_day = 60 * 60 * 24;
+ time_t last_modified_time = file_stat.st_mtime;
+ time_t current_time = time(nullptr);
+ return difftime(current_time, last_modified_time) > days * seconds_in_a_day;
+ }
+
+ // If failed to get file stat, don't return true!
+ return false;
+}
+
+} // namespace
+
+// Static log data space to avoid alloc failures in a LOG(FATAL)
+//
+// Since multiple threads may call LOG(FATAL), and we want to preserve
+// the data from the first call, we allocate two sets of space. One
+// for exclusive use by the first thread, and one for shared use by
+// all other threads.
+static Mutex fatal_msg_lock;
+static CrashReason crash_reason;
+static bool fatal_msg_exclusive = true;
+static LogMessage::LogMessageData fatal_msg_data_exclusive;
+static LogMessage::LogMessageData fatal_msg_data_shared;
+
+#ifdef GLOG_THREAD_LOCAL_STORAGE
+// Static thread-local log data space to use, because typically at most one
+// LogMessageData object exists (in this case glog makes zero heap memory
+// allocations).
+static thread_local bool thread_data_available = true;
+
+static thread_local std::aligned_storage<
+ sizeof(LogMessage::LogMessageData),
+ alignof(LogMessage::LogMessageData)>::type thread_msg_data;
+#endif // defined(GLOG_THREAD_LOCAL_STORAGE)
+
+LogMessage::LogMessageData::LogMessageData()
+ : stream_(message_text_, LogMessage::kMaxLogMessageLen, 0) {
+}
+
+LogMessage::LogMessage(const char* file, int line, LogSeverity severity,
+ int64 ctr, void (LogMessage::*send_method)())
+ : allocated_(nullptr) {
+ Init(file, line, severity, send_method);
+ data_->stream_.set_ctr(ctr);
+}
+
+LogMessage::LogMessage(const char* file, int line, const CheckOpString& result)
+ : allocated_(nullptr) {
+ Init(file, line, GLOG_FATAL, &LogMessage::SendToLog);
+ stream() << "Check failed: " << (*result.str_) << " ";
+}
+
+LogMessage::LogMessage(const char* file, int line) : allocated_(nullptr) {
+ Init(file, line, GLOG_INFO, &LogMessage::SendToLog);
+}
+
+LogMessage::LogMessage(const char* file, int line, LogSeverity severity)
+ : allocated_(nullptr) {
+ Init(file, line, severity, &LogMessage::SendToLog);
+}
+
+LogMessage::LogMessage(const char* file, int line, LogSeverity severity,
+ LogSink* sink, bool also_send_to_log)
+ : allocated_(nullptr) {
+ Init(file, line, severity, also_send_to_log ? &LogMessage::SendToSinkAndLog :
+ &LogMessage::SendToSink);
+ data_->sink_ = sink; // override Init()'s setting to nullptr
+}
+
+LogMessage::LogMessage(const char* file, int line, LogSeverity severity,
+ vector<string>* outvec)
+ : allocated_(nullptr) {
+ Init(file, line, severity, &LogMessage::SaveOrSendToLog);
+ data_->outvec_ = outvec; // override Init()'s setting to nullptr
+}
+
+LogMessage::LogMessage(const char* file, int line, LogSeverity severity,
+ string* message)
+ : allocated_(nullptr) {
+ Init(file, line, severity, &LogMessage::WriteToStringAndLog);
+ data_->message_ = message; // override Init()'s setting to nullptr
+}
+
+void LogMessage::Init(const char* file,
+ int line,
+ LogSeverity severity,
+ void (LogMessage::*send_method)()) {
+ allocated_ = nullptr;
+ if (severity != GLOG_FATAL || !exit_on_dfatal) {
+#ifdef GLOG_THREAD_LOCAL_STORAGE
+ // No need for locking, because this is thread local.
+ if (thread_data_available) {
+ thread_data_available = false;
+ data_ = new (&thread_msg_data) LogMessageData;
+ } else {
+ allocated_ = new LogMessageData();
+ data_ = allocated_;
+ }
+#else // !defined(GLOG_THREAD_LOCAL_STORAGE)
+ allocated_ = new LogMessageData();
+ data_ = allocated_;
+#endif // defined(GLOG_THREAD_LOCAL_STORAGE)
+ data_->first_fatal_ = false;
+ } else {
+ MutexLock l(&fatal_msg_lock);
+ if (fatal_msg_exclusive) {
+ fatal_msg_exclusive = false;
+ data_ = &fatal_msg_data_exclusive;
+ data_->first_fatal_ = true;
+ } else {
+ data_ = &fatal_msg_data_shared;
+ data_->first_fatal_ = false;
+ }
+ }
+
+ data_->preserved_errno_ = errno;
+ data_->severity_ = severity;
+ data_->line_ = line;
+ data_->send_method_ = send_method;
+ data_->sink_ = nullptr;
+ data_->outvec_ = nullptr;
+ WallTime now = WallTime_Now();
+ auto timestamp_now = static_cast<time_t>(now);
+ logmsgtime_ = LogMessageTime(timestamp_now, now);
+
+ data_->num_chars_to_log_ = 0;
+ data_->num_chars_to_syslog_ = 0;
+ data_->basename_ = const_basename(file);
+ data_->fullname_ = file;
+ data_->has_been_flushed_ = false;
+
+ // If specified, prepend a prefix to each line. For example:
+ // I20201018 160715 f5d4fbb0 logging.cc:1153]
+ // (log level, GMT year, month, date, time, thread_id, file basename, line)
+ // We exclude the thread_id for the default thread.
+ if (FLAGS_log_prefix && (line != kNoLogPrefix)) {
+ std::ios saved_fmt(nullptr);
+ saved_fmt.copyfmt(stream());
+ stream().fill('0');
+ if (custom_prefix_callback == nullptr) {
+ stream() << LogSeverityNames[severity][0];
+ if (FLAGS_log_year_in_prefix) {
+ stream() << setw(4) << 1900 + logmsgtime_.year();
+ }
+ stream() << setw(2) << 1 + logmsgtime_.month() << setw(2)
+ << logmsgtime_.day() << ' ' << setw(2) << logmsgtime_.hour()
+ << ':' << setw(2) << logmsgtime_.min() << ':' << setw(2)
+ << logmsgtime_.sec() << "." << setw(6) << logmsgtime_.usec()
+ << ' ' << setfill(' ') << setw(5)
+ << static_cast<unsigned int>(GetTID()) << setfill('0') << ' '
+ << data_->basename_ << ':' << data_->line_ << "] ";
+ } else {
+ custom_prefix_callback(
+ stream(),
+ LogMessageInfo(LogSeverityNames[severity], data_->basename_,
+ data_->line_, GetTID(), logmsgtime_),
+ custom_prefix_callback_data);
+ stream() << " ";
+ }
+ stream().copyfmt(saved_fmt);
+ }
+ data_->num_prefix_chars_ = data_->stream_.pcount();
+
+ if (!FLAGS_log_backtrace_at.empty()) {
+ char fileline[128];
+ snprintf(fileline, sizeof(fileline), "%s:%d", data_->basename_, line);
+#ifdef HAVE_STACKTRACE
+ if (FLAGS_log_backtrace_at == fileline) {
+ string stacktrace;
+ DumpStackTraceToString(&stacktrace);
+ stream() << " (stacktrace:\n" << stacktrace << ") ";
+ }
+#endif
+ }
+}
+
+const LogMessageTime& LogMessage::getLogMessageTime() const {
+ return logmsgtime_;
+}
+
+LogMessage::~LogMessage() {
+ Flush();
+#ifdef GLOG_THREAD_LOCAL_STORAGE
+ if (data_ == static_cast<void*>(&thread_msg_data)) {
+ data_->~LogMessageData();
+ thread_data_available = true;
+ }
+ else {
+ delete allocated_;
+ }
+#else // !defined(GLOG_THREAD_LOCAL_STORAGE)
+ delete allocated_;
+#endif // defined(GLOG_THREAD_LOCAL_STORAGE)
+}
+
+int LogMessage::preserved_errno() const {
+ return data_->preserved_errno_;
+}
+
+ostream& LogMessage::stream() {
+ return data_->stream_;
+}
+
+// Flush buffered message, called by the destructor, or any other function
+// that needs to synchronize the log.
+void LogMessage::Flush() {
+ if (data_->has_been_flushed_ || data_->severity_ < FLAGS_minloglevel) {
+ return;
+ }
+
+ data_->num_chars_to_log_ = data_->stream_.pcount();
+ data_->num_chars_to_syslog_ =
+ data_->num_chars_to_log_ - data_->num_prefix_chars_;
+
+ // Do we need to add a \n to the end of this message?
+ bool append_newline =
+ (data_->message_text_[data_->num_chars_to_log_-1] != '\n');
+ char original_final_char = '\0';
+
+ // If we do need to add a \n, we'll do it by violating the memory of the
+ // ostrstream buffer. This is quick, and we'll make sure to undo our
+ // modification before anything else is done with the ostrstream. It
+ // would be preferable not to do things this way, but it seems to be
+ // the best way to deal with this.
+ if (append_newline) {
+ original_final_char = data_->message_text_[data_->num_chars_to_log_];
+ data_->message_text_[data_->num_chars_to_log_++] = '\n';
+ }
+ data_->message_text_[data_->num_chars_to_log_] = '\0';
+
+ // Prevent any subtle race conditions by wrapping a mutex lock around
+ // the actual logging action per se.
+ {
+ MutexLock l(&log_mutex);
+ (this->*(data_->send_method_))();
+ ++num_messages_[static_cast<int>(data_->severity_)];
+ }
+ LogDestination::WaitForSinks(data_);
+
+ if (append_newline) {
+ // Fix the ostrstream back how it was before we screwed with it.
+ // It's 99.44% certain that we don't need to worry about doing this.
+ data_->message_text_[data_->num_chars_to_log_-1] = original_final_char;
+ }
+
+ // If errno was already set before we enter the logging call, we'll
+ // set it back to that value when we return from the logging call.
+ // It happens often that we log an error message after a syscall
+ // failure, which can potentially set the errno to some other
+ // values. We would like to preserve the original errno.
+ if (data_->preserved_errno_ != 0) {
+ errno = data_->preserved_errno_;
+ }
+
+ // Note that this message is now safely logged. If we're asked to flush
+ // again, as a result of destruction, say, we'll do nothing on future calls.
+ data_->has_been_flushed_ = true;
+}
+
+// Copy of first FATAL log message so that we can print it out again
+// after all the stack traces. To preserve legacy behavior, we don't
+// use fatal_msg_data_exclusive.
+static time_t fatal_time;
+static char fatal_message[256];
+
+void ReprintFatalMessage() {
+ if (fatal_message[0]) {
+ const size_t n = strlen(fatal_message);
+ if (!FLAGS_logtostderr) {
+ // Also write to stderr (don't color to avoid terminal checks)
+ WriteToStderr(fatal_message, n);
+ }
+ LogDestination::LogToAllLogfiles(GLOG_ERROR, fatal_time, fatal_message, n);
+ }
+}
+
+// L >= log_mutex (callers must hold the log_mutex).
+void LogMessage::SendToLog() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) {
+ static bool already_warned_before_initgoogle = false;
+
+ log_mutex.AssertHeld();
+
+ RAW_DCHECK(data_->num_chars_to_log_ > 0 &&
+ data_->message_text_[data_->num_chars_to_log_-1] == '\n', "");
+
+ // Messages of a given severity get logged to lower severity logs, too
+
+ if (!already_warned_before_initgoogle && !IsGoogleLoggingInitialized()) {
+ const char w[] = "WARNING: Logging before InitGoogleLogging() is "
+ "written to STDERR\n";
+ WriteToStderr(w, strlen(w));
+ already_warned_before_initgoogle = true;
+ }
+
+ // global flag: never log to file if set. Also -- don't log to a
+ // file if we haven't parsed the command line flags to get the
+ // program name.
+ if (FLAGS_logtostderr || FLAGS_logtostdout || !IsGoogleLoggingInitialized()) {
+ if (FLAGS_logtostdout) {
+ ColoredWriteToStdout(data_->severity_, data_->message_text_,
+ data_->num_chars_to_log_);
+ } else {
+ ColoredWriteToStderr(data_->severity_, data_->message_text_,
+ data_->num_chars_to_log_);
+ }
+
+ // this could be protected by a flag if necessary.
+ LogDestination::LogToSinks(data_->severity_,
+ data_->fullname_, data_->basename_,
+ data_->line_, logmsgtime_,
+ data_->message_text_ + data_->num_prefix_chars_,
+ (data_->num_chars_to_log_ -
+ data_->num_prefix_chars_ - 1) );
+ } else {
+ // log this message to all log files of severity <= severity_
+ LogDestination::LogToAllLogfiles(data_->severity_, logmsgtime_.timestamp(),
+ data_->message_text_,
+ data_->num_chars_to_log_);
+
+ LogDestination::MaybeLogToStderr(data_->severity_, data_->message_text_,
+ data_->num_chars_to_log_,
+ data_->num_prefix_chars_);
+ LogDestination::MaybeLogToEmail(data_->severity_, data_->message_text_,
+ data_->num_chars_to_log_);
+ LogDestination::LogToSinks(data_->severity_,
+ data_->fullname_, data_->basename_,
+ data_->line_, logmsgtime_,
+ data_->message_text_ + data_->num_prefix_chars_,
+ (data_->num_chars_to_log_
+ - data_->num_prefix_chars_ - 1) );
+ // NOTE: -1 removes trailing \n
+ }
+
+ // If we log a FATAL message, flush all the log destinations, then toss
+ // a signal for others to catch. We leave the logs in a state that
+ // someone else can use them (as long as they flush afterwards)
+ if (data_->severity_ == GLOG_FATAL && exit_on_dfatal) {
+ if (data_->first_fatal_) {
+ // Store crash information so that it is accessible from within signal
+ // handlers that may be invoked later.
+ RecordCrashReason(&crash_reason);
+ SetCrashReason(&crash_reason);
+
+ // Store shortened fatal message for other logs and GWQ status
+ const size_t copy = min(data_->num_chars_to_log_,
+ sizeof(fatal_message)-1);
+ memcpy(fatal_message, data_->message_text_, copy);
+ fatal_message[copy] = '\0';
+ fatal_time = logmsgtime_.timestamp();
+ }
+
+ if (!FLAGS_logtostderr && !FLAGS_logtostdout) {
+ for (auto& log_destination : LogDestination::log_destinations_) {
+ if (log_destination) {
+ log_destination->logger_->Write(true, 0, "", 0);
+ }
+ }
+ }
+
+ // release the lock that our caller (directly or indirectly)
+ // LogMessage::~LogMessage() grabbed so that signal handlers
+ // can use the logging facility. Alternately, we could add
+ // an entire unsafe logging interface to bypass locking
+ // for signal handlers but this seems simpler.
+ log_mutex.Unlock();
+ LogDestination::WaitForSinks(data_);
+
+ const char* message = "*** Check failure stack trace: ***\n";
+ if (write(STDERR_FILENO, message, strlen(message)) < 0) {
+ // Ignore errors.
+ }
+#if defined(__ANDROID__)
+ // ANDROID_LOG_FATAL as this message is of FATAL severity.
+ __android_log_write(ANDROID_LOG_FATAL,
+ glog_internal_namespace_::ProgramInvocationShortName(),
+ message);
+#endif
+ Fail();
+ }
+}
+
+void LogMessage::RecordCrashReason(
+ glog_internal_namespace_::CrashReason* reason) {
+ reason->filename = fatal_msg_data_exclusive.fullname_;
+ reason->line_number = fatal_msg_data_exclusive.line_;
+ reason->message = fatal_msg_data_exclusive.message_text_ +
+ fatal_msg_data_exclusive.num_prefix_chars_;
+#ifdef HAVE_STACKTRACE
+ // Retrieve the stack trace, omitting the logging frames that got us here.
+ reason->depth = GetStackTrace(reason->stack, ARRAYSIZE(reason->stack), 4);
+#else
+ reason->depth = 0;
+#endif
+}
+
+GLOG_EXPORT logging_fail_func_t g_logging_fail_func =
+ reinterpret_cast<logging_fail_func_t>(&abort);
+
+void InstallFailureFunction(logging_fail_func_t fail_func) {
+ g_logging_fail_func = fail_func;
+}
+
+void LogMessage::Fail() {
+ g_logging_fail_func();
+}
+
+// L >= log_mutex (callers must hold the log_mutex).
+void LogMessage::SendToSink() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) {
+ if (data_->sink_ != nullptr) {
+ RAW_DCHECK(data_->num_chars_to_log_ > 0 &&
+ data_->message_text_[data_->num_chars_to_log_-1] == '\n', "");
+ data_->sink_->send(data_->severity_, data_->fullname_, data_->basename_,
+ data_->line_, logmsgtime_,
+ data_->message_text_ + data_->num_prefix_chars_,
+ (data_->num_chars_to_log_ -
+ data_->num_prefix_chars_ - 1) );
+ }
+}
+
+// L >= log_mutex (callers must hold the log_mutex).
+void LogMessage::SendToSinkAndLog() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) {
+ SendToSink();
+ SendToLog();
+}
+
+// L >= log_mutex (callers must hold the log_mutex).
+void LogMessage::SaveOrSendToLog() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) {
+ if (data_->outvec_ != nullptr) {
+ RAW_DCHECK(data_->num_chars_to_log_ > 0 &&
+ data_->message_text_[data_->num_chars_to_log_-1] == '\n', "");
+ // Omit prefix of message and trailing newline when recording in outvec_.
+ const char *start = data_->message_text_ + data_->num_prefix_chars_;
+ size_t len = data_->num_chars_to_log_ - data_->num_prefix_chars_ - 1;
+ data_->outvec_->push_back(string(start, len));
+ } else {
+ SendToLog();
+ }
+}
+
+void LogMessage::WriteToStringAndLog() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) {
+ if (data_->message_ != nullptr) {
+ RAW_DCHECK(data_->num_chars_to_log_ > 0 &&
+ data_->message_text_[data_->num_chars_to_log_-1] == '\n', "");
+ // Omit prefix of message and trailing newline when writing to message_.
+ const char *start = data_->message_text_ + data_->num_prefix_chars_;
+ size_t len = data_->num_chars_to_log_ - data_->num_prefix_chars_ - 1;
+ data_->message_->assign(start, len);
+ }
+ SendToLog();
+}
+
+// L >= log_mutex (callers must hold the log_mutex).
+void LogMessage::SendToSyslogAndLog() {
+#ifdef HAVE_SYSLOG_H
+ // Before any calls to syslog(), make a single call to openlog()
+ static bool openlog_already_called = false;
+ if (!openlog_already_called) {
+ openlog(glog_internal_namespace_::ProgramInvocationShortName(),
+ LOG_CONS | LOG_NDELAY | LOG_PID,
+ LOG_USER);
+ openlog_already_called = true;
+ }
+
+ // This array maps Google severity levels to syslog levels
+ const int SEVERITY_TO_LEVEL[] = { LOG_INFO, LOG_WARNING, LOG_ERR, LOG_EMERG };
+ syslog(LOG_USER | SEVERITY_TO_LEVEL[static_cast<int>(data_->severity_)],
+ "%.*s", static_cast<int>(data_->num_chars_to_syslog_),
+ data_->message_text_ + data_->num_prefix_chars_);
+ SendToLog();
+#else
+ LOG(ERROR) << "No syslog support: message=" << data_->message_text_;
+#endif
+}
+
+base::Logger* base::GetLogger(LogSeverity severity) {
+ MutexLock l(&log_mutex);
+ return LogDestination::log_destination(severity)->GetLoggerImpl();
+}
+
+void base::SetLogger(LogSeverity severity, base::Logger* logger) {
+ MutexLock l(&log_mutex);
+ LogDestination::log_destination(severity)->SetLoggerImpl(logger);
+}
+
+// L < log_mutex. Acquires and releases mutex_.
+int64 LogMessage::num_messages(int severity) {
+ MutexLock l(&log_mutex);
+ return num_messages_[severity];
+}
+
+// Output the COUNTER value. This is only valid if ostream is a
+// LogStream.
+ostream& operator<<(ostream &os, const PRIVATE_Counter&) {
+#ifdef DISABLE_RTTI
+ LogMessage::LogStream *log = static_cast<LogMessage::LogStream*>(&os);
+#else
+ auto* log = dynamic_cast<LogMessage::LogStream*>(&os);
+#endif
+ CHECK(log && log == log->self())
+ << "You must not use COUNTER with non-glog ostream";
+ os << log->ctr();
+ return os;
+}
+
+ErrnoLogMessage::ErrnoLogMessage(const char* file, int line,
+ LogSeverity severity, int64 ctr,
+ void (LogMessage::*send_method)())
+ : LogMessage(file, line, severity, ctr, send_method) {}
+
+ErrnoLogMessage::~ErrnoLogMessage() {
+ // Don't access errno directly because it may have been altered
+ // while streaming the message.
+ stream() << ": " << StrError(preserved_errno()) << " ["
+ << preserved_errno() << "]";
+}
+
+void FlushLogFiles(LogSeverity min_severity) {
+ LogDestination::FlushLogFiles(min_severity);
+}
+
+void FlushLogFilesUnsafe(LogSeverity min_severity) {
+ LogDestination::FlushLogFilesUnsafe(min_severity);
+}
+
+void SetLogDestination(LogSeverity severity, const char* base_filename) {
+ LogDestination::SetLogDestination(severity, base_filename);
+}
+
+void SetLogSymlink(LogSeverity severity, const char* symlink_basename) {
+ LogDestination::SetLogSymlink(severity, symlink_basename);
+}
+
+LogSink::~LogSink() = default;
+
+void LogSink::send(LogSeverity severity, const char* full_filename,
+ const char* base_filename, int line,
+ const LogMessageTime& time, const char* message,
+ size_t message_len) {
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#elif defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable : 4996)
+#endif // __GNUC__
+ send(severity, full_filename, base_filename, line, &time.tm(), message,
+ message_len);
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#elif defined(_MSC_VER)
+#pragma warning(pop)
+#endif // __GNUC__
+}
+
+void LogSink::send(LogSeverity severity, const char* full_filename,
+ const char* base_filename, int line, const std::tm* t,
+ const char* message, size_t message_len) {
+ (void)severity;
+ (void)full_filename;
+ (void)base_filename;
+ (void)line;
+ (void)t;
+ (void)message;
+ (void)message_len;
+}
+
+void LogSink::WaitTillSent() {
+ // noop default
+}
+
+string LogSink::ToString(LogSeverity severity, const char* file, int line,
+ const LogMessageTime& logmsgtime, const char* message,
+ size_t message_len) {
+ ostringstream stream;
+ stream.fill('0');
+
+ stream << LogSeverityNames[severity][0];
+ if (FLAGS_log_year_in_prefix) {
+ stream << setw(4) << 1900 + logmsgtime.year();
+ }
+ stream << setw(2) << 1 + logmsgtime.month()
+ << setw(2) << logmsgtime.day()
+ << ' '
+ << setw(2) << logmsgtime.hour() << ':'
+ << setw(2) << logmsgtime.min() << ':'
+ << setw(2) << logmsgtime.sec() << '.'
+ << setw(6) << logmsgtime.usec()
+ << ' '
+ << setfill(' ') << setw(5) << GetTID() << setfill('0')
+ << ' '
+ << file << ':' << line << "] ";
+
+ // A call to `write' is enclosed in parenthneses to prevent possible macro
+ // expansion. On Windows, `write' could be a macro defined for portability.
+ (stream.write)(message, static_cast<std::streamsize>(message_len));
+ return stream.str();
+}
+
+void AddLogSink(LogSink *destination) {
+ LogDestination::AddLogSink(destination);
+}
+
+void RemoveLogSink(LogSink *destination) {
+ LogDestination::RemoveLogSink(destination);
+}
+
+void SetLogFilenameExtension(const char* ext) {
+ LogDestination::SetLogFilenameExtension(ext);
+}
+
+void SetStderrLogging(LogSeverity min_severity) {
+ LogDestination::SetStderrLogging(min_severity);
+}
+
+void SetEmailLogging(LogSeverity min_severity, const char* addresses) {
+ LogDestination::SetEmailLogging(min_severity, addresses);
+}
+
+void LogToStderr() {
+ LogDestination::LogToStderr();
+}
+
+namespace base {
+namespace internal {
+
+bool GetExitOnDFatal();
+bool GetExitOnDFatal() {
+ MutexLock l(&log_mutex);
+ return exit_on_dfatal;
+}
+
+// Determines whether we exit the program for a LOG(DFATAL) message in
+// debug mode. It does this by skipping the call to Fail/FailQuietly.
+// This is intended for testing only.
+//
+// This can have some effects on LOG(FATAL) as well. Failure messages
+// are always allocated (rather than sharing a buffer), the crash
+// reason is not recorded, the "gwq" status message is not updated,
+// and the stack trace is not recorded. The LOG(FATAL) *will* still
+// exit the program. Since this function is used only in testing,
+// these differences are acceptable.
+void SetExitOnDFatal(bool value);
+void SetExitOnDFatal(bool value) {
+ MutexLock l(&log_mutex);
+ exit_on_dfatal = value;
+}
+
+} // namespace internal
+} // namespace base
+
+#ifndef GLOG_OS_EMSCRIPTEN
+// Shell-escaping as we need to shell out ot /bin/mail.
+static const char kDontNeedShellEscapeChars[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz"
+ "0123456789+-_.=/:,@";
+
+static string ShellEscape(const string& src) {
+ string result;
+ if (!src.empty() && // empty string needs quotes
+ src.find_first_not_of(kDontNeedShellEscapeChars) == string::npos) {
+ // only contains chars that don't need quotes; it's fine
+ result.assign(src);
+ } else if (src.find_first_of('\'') == string::npos) {
+ // no single quotes; just wrap it in single quotes
+ result.assign("'");
+ result.append(src);
+ result.append("'");
+ } else {
+ // needs double quote escaping
+ result.assign("\"");
+ for (size_t i = 0; i < src.size(); ++i) {
+ switch (src[i]) {
+ case '\\':
+ case '$':
+ case '"':
+ case '`':
+ result.append("\\");
+ }
+ result.append(src, i, 1);
+ }
+ result.append("\"");
+ }
+ return result;
+}
+#endif
+
+// use_logging controls whether the logging functions LOG/VLOG are used
+// to log errors. It should be set to false when the caller holds the
+// log_mutex.
+static bool SendEmailInternal(const char*dest, const char *subject,
+ const char*body, bool use_logging) {
+#ifndef GLOG_OS_EMSCRIPTEN
+ if (dest && *dest) {
+ if ( use_logging ) {
+ VLOG(1) << "Trying to send TITLE:" << subject
+ << " BODY:" << body << " to " << dest;
+ } else {
+ fprintf(stderr, "Trying to send TITLE: %s BODY: %s to %s\n",
+ subject, body, dest);
+ }
+
+ string logmailer = FLAGS_logmailer;
+ if (logmailer.empty()) {
+ logmailer = "/bin/mail";
+ }
+ string cmd =
+ logmailer + " -s" +
+ ShellEscape(subject) + " " + ShellEscape(dest);
+ if (use_logging) {
+ VLOG(4) << "Mailing command: " << cmd;
+ }
+
+ FILE* pipe = popen(cmd.c_str(), "w");
+ if (pipe != nullptr) {
+ // Add the body if we have one
+ if (body) {
+ fwrite(body, sizeof(char), strlen(body), pipe);
+ }
+ bool ok = pclose(pipe) != -1;
+ if ( !ok ) {
+ if ( use_logging ) {
+ LOG(ERROR) << "Problems sending mail to " << dest << ": "
+ << StrError(errno);
+ } else {
+ fprintf(stderr, "Problems sending mail to %s: %s\n",
+ dest, StrError(errno).c_str());
+ }
+ }
+ return ok;
+ } else {
+ if ( use_logging ) {
+ LOG(ERROR) << "Unable to send mail to " << dest;
+ } else {
+ fprintf(stderr, "Unable to send mail to %s\n", dest);
+ }
+ }
+ }
+#else
+ (void)dest;
+ (void)subject;
+ (void)body;
+ (void)use_logging;
+ LOG(WARNING) << "Email support not available; not sending message";
+#endif
+ return false;
+}
+
+bool SendEmail(const char*dest, const char *subject, const char*body){
+ return SendEmailInternal(dest, subject, body, true);
+}
+
+static void GetTempDirectories(vector<string>* list) {
+ list->clear();
+#ifdef GLOG_OS_WINDOWS
+ // On windows we'll try to find a directory in this order:
+ // C:/Documents & Settings/whomever/TEMP (or whatever GetTempPath() is)
+ // C:/TMP/
+ // C:/TEMP/
+ // C:/WINDOWS/ or C:/WINNT/
+ // .
+ char tmp[MAX_PATH];
+ if (GetTempPathA(MAX_PATH, tmp))
+ list->push_back(tmp);
+ list->push_back("C:\\tmp\\");
+ list->push_back("C:\\temp\\");
+#else
+ // Directories, in order of preference. If we find a dir that
+ // exists, we stop adding other less-preferred dirs
+ const char * candidates[] = {
+ // Non-null only during unittest/regtest
+ getenv("TEST_TMPDIR"),
+
+ // Explicitly-supplied temp dirs
+ getenv("TMPDIR"), getenv("TMP"),
+
+ // If all else fails
+ "/tmp",
+ };
+
+ for (auto d : candidates) {
+ if (!d) continue; // Empty env var
+
+ // Make sure we don't surprise anyone who's expecting a '/'
+ string dstr = d;
+ if (dstr[dstr.size() - 1] != '/') {
+ dstr += "/";
+ }
+ list->push_back(dstr);
+
+ struct stat statbuf;
+ if (!stat(d, &statbuf) && S_ISDIR(statbuf.st_mode)) {
+ // We found a dir that exists - we're done.
+ return;
+ }
+ }
+
+#endif
+}
+
+static vector<string>* logging_directories_list;
+
+const vector<string>& GetLoggingDirectories() {
+ // Not strictly thread-safe but we're called early in InitGoogle().
+ if (logging_directories_list == nullptr) {
+ logging_directories_list = new vector<string>;
+
+ if ( !FLAGS_log_dir.empty() ) {
+ // A dir was specified, we should use it
+ logging_directories_list->push_back(FLAGS_log_dir);
+ } else {
+ GetTempDirectories(logging_directories_list);
+#ifdef GLOG_OS_WINDOWS
+ char tmp[MAX_PATH];
+ if (GetWindowsDirectoryA(tmp, MAX_PATH))
+ logging_directories_list->push_back(tmp);
+ logging_directories_list->push_back(".\\");
+#else
+ logging_directories_list->push_back("./");
+#endif
+ }
+ }
+ return *logging_directories_list;
+}
+
+void TestOnly_ClearLoggingDirectoriesList() {
+ fprintf(stderr, "TestOnly_ClearLoggingDirectoriesList should only be "
+ "called from test code.\n");
+ delete logging_directories_list;
+ logging_directories_list = nullptr;
+}
+
+void GetExistingTempDirectories(vector<string>* list) {
+ GetTempDirectories(list);
+ auto i_dir = list->begin();
+ while( i_dir != list->end() ) {
+ // zero arg to access means test for existence; no constant
+ // defined on windows
+ if ( access(i_dir->c_str(), 0) ) {
+ i_dir = list->erase(i_dir);
+ } else {
+ ++i_dir;
+ }
+ }
+}
+
+void TruncateLogFile(const char *path, uint64 limit, uint64 keep) {
+#ifdef HAVE_UNISTD_H
+ struct stat statbuf;
+ const int kCopyBlockSize = 8 << 10;
+ char copybuf[kCopyBlockSize];
+ off_t read_offset, write_offset;
+ // Don't follow symlinks unless they're our own fd symlinks in /proc
+ int flags = O_RDWR;
+ // TODO(hamaji): Support other environments.
+#ifdef GLOG_OS_LINUX
+ const char *procfd_prefix = "/proc/self/fd/";
+ if (strncmp(procfd_prefix, path, strlen(procfd_prefix))) flags |= O_NOFOLLOW;
+#endif
+
+ int fd = open(path, flags);
+ if (fd == -1) {
+ if (errno == EFBIG) {
+ // The log file in question has got too big for us to open. The
+ // real fix for this would be to compile logging.cc (or probably
+ // all of base/...) with -D_FILE_OFFSET_BITS=64 but that's
+ // rather scary.
+ // Instead just truncate the file to something we can manage
+ if (truncate(path, 0) == -1) {
+ PLOG(ERROR) << "Unable to truncate " << path;
+ } else {
+ LOG(ERROR) << "Truncated " << path << " due to EFBIG error";
+ }
+ } else {
+ PLOG(ERROR) << "Unable to open " << path;
+ }
+ return;
+ }
+
+ if (fstat(fd, &statbuf) == -1) {
+ PLOG(ERROR) << "Unable to fstat()";
+ goto out_close_fd;
+ }
+
+ // See if the path refers to a regular file bigger than the
+ // specified limit
+ if (!S_ISREG(statbuf.st_mode)) goto out_close_fd;
+ if (statbuf.st_size <= static_cast<off_t>(limit)) goto out_close_fd;
+ if (statbuf.st_size <= static_cast<off_t>(keep)) goto out_close_fd;
+
+ // This log file is too large - we need to truncate it
+ LOG(INFO) << "Truncating " << path << " to " << keep << " bytes";
+
+ // Copy the last "keep" bytes of the file to the beginning of the file
+ read_offset = statbuf.st_size - static_cast<off_t>(keep);
+ write_offset = 0;
+ ssize_t bytesin, bytesout;
+ while ((bytesin = pread(fd, copybuf, sizeof(copybuf), read_offset)) > 0) {
+ bytesout = pwrite(fd, copybuf, static_cast<size_t>(bytesin), write_offset);
+ if (bytesout == -1) {
+ PLOG(ERROR) << "Unable to write to " << path;
+ break;
+ } else if (bytesout != bytesin) {
+ LOG(ERROR) << "Expected to write " << bytesin << ", wrote " << bytesout;
+ }
+ read_offset += bytesin;
+ write_offset += bytesout;
+ }
+ if (bytesin == -1) PLOG(ERROR) << "Unable to read from " << path;
+
+ // Truncate the remainder of the file. If someone else writes to the
+ // end of the file after our last read() above, we lose their latest
+ // data. Too bad ...
+ if (ftruncate(fd, write_offset) == -1) {
+ PLOG(ERROR) << "Unable to truncate " << path;
+ }
+
+ out_close_fd:
+ close(fd);
+#else
+ LOG(ERROR) << "No log truncation support.";
+#endif
+ }
+
+void TruncateStdoutStderr() {
+#ifdef HAVE_UNISTD_H
+ uint64 limit = MaxLogSize() << 20U;
+ uint64 keep = 1U << 20U;
+ TruncateLogFile("/proc/self/fd/1", limit, keep);
+ TruncateLogFile("/proc/self/fd/2", limit, keep);
+#else
+ LOG(ERROR) << "No log truncation support.";
+#endif
+}
+
+
+// Helper functions for string comparisons.
+#define DEFINE_CHECK_STROP_IMPL(name, func, expected) \
+ string* Check##func##expected##Impl(const char* s1, const char* s2, \
+ const char* names) { \
+ bool equal = s1 == s2 || (s1 && s2 && !func(s1, s2)); \
+ if (equal == expected) \
+ return nullptr; \
+ else { \
+ ostringstream ss; \
+ if (!s1) s1 = ""; \
+ if (!s2) s2 = ""; \
+ ss << #name " failed: " << names << " (" << s1 << " vs. " << s2 << ")"; \
+ return new string(ss.str()); \
+ } \
+ }
+DEFINE_CHECK_STROP_IMPL(CHECK_STREQ, strcmp, true)
+DEFINE_CHECK_STROP_IMPL(CHECK_STRNE, strcmp, false)
+DEFINE_CHECK_STROP_IMPL(CHECK_STRCASEEQ, strcasecmp, true)
+DEFINE_CHECK_STROP_IMPL(CHECK_STRCASENE, strcasecmp, false)
+#undef DEFINE_CHECK_STROP_IMPL
+
+int posix_strerror_r(int err, char *buf, size_t len) {
+ // Sanity check input parameters
+ if (buf == nullptr || len <= 0) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ // Reset buf and errno, and try calling whatever version of strerror_r()
+ // is implemented by glibc
+ buf[0] = '\000';
+ int old_errno = errno;
+ errno = 0;
+ char *rc = reinterpret_cast<char *>(strerror_r(err, buf, len));
+
+ // Both versions set errno on failure
+ if (errno) {
+ // Should already be there, but better safe than sorry
+ buf[0] = '\000';
+ return -1;
+ }
+ errno = old_errno;
+
+ // POSIX is vague about whether the string will be terminated, although
+ // is indirectly implies that typically ERANGE will be returned, instead
+ // of truncating the string. This is different from the GNU implementation.
+ // We play it safe by always terminating the string explicitly.
+ buf[len-1] = '\000';
+
+ // If the function succeeded, we can use its exit code to determine the
+ // semantics implemented by glibc
+ if (!rc) {
+ return 0;
+ } else {
+ // GNU semantics detected
+ if (rc == buf) {
+ return 0;
+ } else {
+ buf[0] = '\000';
+#if defined(GLOG_OS_MACOSX) || defined(GLOG_OS_FREEBSD) || defined(GLOG_OS_OPENBSD)
+ if (reinterpret_cast<intptr_t>(rc) < sys_nerr) {
+ // This means an error on MacOSX or FreeBSD.
+ return -1;
+ }
+#endif
+ strncat(buf, rc, len-1);
+ return 0;
+ }
+ }
+}
+
+string StrError(int err) {
+ char buf[100];
+ int rc = posix_strerror_r(err, buf, sizeof(buf));
+ if ((rc < 0) || (buf[0] == '\000')) {
+ snprintf(buf, sizeof(buf), "Error number %d", err);
+ }
+ return buf;
+}
+
+LogMessageFatal::LogMessageFatal(const char* file, int line) :
+ LogMessage(file, line, GLOG_FATAL) {}
+
+LogMessageFatal::LogMessageFatal(const char* file, int line,
+ const CheckOpString& result) :
+ LogMessage(file, line, result) {}
+
+LogMessageFatal::~LogMessageFatal() {
+ Flush();
+ LogMessage::Fail();
+}
+
+namespace base {
+
+CheckOpMessageBuilder::CheckOpMessageBuilder(const char *exprtext)
+ : stream_(new ostringstream) {
+ *stream_ << exprtext << " (";
+}
+
+CheckOpMessageBuilder::~CheckOpMessageBuilder() {
+ delete stream_;
+}
+
+ostream* CheckOpMessageBuilder::ForVar2() {
+ *stream_ << " vs. ";
+ return stream_;
+}
+
+string* CheckOpMessageBuilder::NewString() {
+ *stream_ << ")";
+ return new string(stream_->str());
+}
+
+} // namespace base
+
+template <>
+void MakeCheckOpValueString(std::ostream* os, const char& v) {
+ if (v >= 32 && v <= 126) {
+ (*os) << "'" << v << "'";
+ } else {
+ (*os) << "char value " << static_cast<short>(v);
+ }
+}
+
+template <>
+void MakeCheckOpValueString(std::ostream* os, const signed char& v) {
+ if (v >= 32 && v <= 126) {
+ (*os) << "'" << v << "'";
+ } else {
+ (*os) << "signed char value " << static_cast<short>(v);
+ }
+}
+
+template <>
+void MakeCheckOpValueString(std::ostream* os, const unsigned char& v) {
+ if (v >= 32 && v <= 126) {
+ (*os) << "'" << v << "'";
+ } else {
+ (*os) << "unsigned char value " << static_cast<unsigned short>(v);
+ }
+}
+
+template <>
+void MakeCheckOpValueString(std::ostream* os, const std::nullptr_t& /*v*/) {
+ (*os) << "nullptr";
+}
+
+void InitGoogleLogging(const char* argv0) {
+ glog_internal_namespace_::InitGoogleLoggingUtilities(argv0);
+}
+
+void InitGoogleLogging(const char* argv0,
+ CustomPrefixCallback prefix_callback,
+ void* prefix_callback_data) {
+ custom_prefix_callback = prefix_callback;
+ custom_prefix_callback_data = prefix_callback_data;
+ InitGoogleLogging(argv0);
+}
+
+void ShutdownGoogleLogging() {
+ glog_internal_namespace_::ShutdownGoogleLoggingUtilities();
+ LogDestination::DeleteLogDestinations();
+ delete logging_directories_list;
+ logging_directories_list = nullptr;
+}
+
+void EnableLogCleaner(unsigned int overdue_days) {
+ log_cleaner.Enable(overdue_days);
+}
+
+void DisableLogCleaner() {
+ log_cleaner.Disable();
+}
+
+LogMessageTime::LogMessageTime()
+ : time_struct_(), timestamp_(0), usecs_(0), gmtoffset_(0) {}
+
+LogMessageTime::LogMessageTime(std::tm t) {
+ std::time_t timestamp = std::mktime(&t);
+ init(t, timestamp, 0);
+}
+
+LogMessageTime::LogMessageTime(std::time_t timestamp, WallTime now) {
+ std::tm t;
+ if (FLAGS_log_utc_time) {
+ gmtime_r(×tamp, &t);
+ } else {
+ localtime_r(×tamp, &t);
+ }
+ init(t, timestamp, now);
+}
+
+void LogMessageTime::init(const std::tm& t, std::time_t timestamp,
+ WallTime now) {
+ time_struct_ = t;
+ timestamp_ = timestamp;
+ usecs_ = static_cast<int32>((now - timestamp) * 1000000);
+
+ CalcGmtOffset();
+}
+
+void LogMessageTime::CalcGmtOffset() {
+ std::tm gmt_struct;
+ int isDst = 0;
+ if ( FLAGS_log_utc_time ) {
+ localtime_r(×tamp_, &gmt_struct);
+ isDst = gmt_struct.tm_isdst;
+ gmt_struct = time_struct_;
+ } else {
+ isDst = time_struct_.tm_isdst;
+ gmtime_r(×tamp_, &gmt_struct);
+ }
+
+ time_t gmt_sec = mktime(&gmt_struct);
+ const long hour_secs = 3600;
+ // If the Daylight Saving Time(isDst) is active subtract an hour from the current timestamp.
+ gmtoffset_ = static_cast<long int>(timestamp_ - gmt_sec + (isDst ? hour_secs : 0) ) ;
+}
+
+_END_GOOGLE_NAMESPACE_
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/logging_striplog_test.sh b/funasr/runtime/onnxruntime/third_party/glog/src/logging_striplog_test.sh
new file mode 100755
index 0000000..73492bd
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/logging_striplog_test.sh
@@ -0,0 +1,79 @@
+#! /bin/sh
+#
+# Copyright (c) 2007, Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Author: Sergey Ioffe
+
+get_strings () {
+ if test -e ".libs/$1"; then
+ binary=".libs/$1"
+ elif test -e "$1.exe"; then
+ binary="$1.exe"
+ else
+ echo "We coundn't find $1 binary."
+ exit 1
+ fi
+
+ strings -n 10 $binary | sort | awk '/TESTMESSAGE/ {printf "%s ", $2}'
+}
+
+# Die if "$1" != "$2", print $3 as death reason
+check_eq () {
+ if [ "$1" != "$2" ]; then
+ echo "Check failed: '$1' == '$2' ${3:+ ($3)}"
+ exit 1
+ fi
+}
+
+die () {
+ echo $1
+ exit 1
+}
+
+# Check that the string literals are appropriately stripped. This will
+# not be the case in debug mode.
+
+mode=`GLOG_check_mode=1 ./logging_striptest0 2> /dev/null`
+if [ "$mode" = "opt" ];
+then
+ echo "In OPT mode"
+ check_eq "`get_strings logging_striptest0`" "COND ERROR FATAL INFO USAGE WARNING "
+ check_eq "`get_strings logging_striptest2`" "COND ERROR FATAL USAGE "
+ check_eq "`get_strings logging_striptest10`" ""
+else
+ echo "In DBG mode; not checking strings"
+fi
+
+# Check that LOG(FATAL) aborts even for large STRIP_LOG
+
+./logging_striptest2 2>/dev/null && die "Did not abort for STRIP_LOG=2"
+./logging_striptest10 2>/dev/null && die "Did not abort for STRIP_LOG=10"
+
+echo "PASS"
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/logging_striptest10.cc b/funasr/runtime/onnxruntime/third_party/glog/src/logging_striptest10.cc
new file mode 100644
index 0000000..f6e1078
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/logging_striptest10.cc
@@ -0,0 +1,35 @@
+// Copyright (c) 2007, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Sergey Ioffe
+
+#define GOOGLE_STRIP_LOG 10
+
+// Include the actual test.
+#include "logging_striptest_main.cc"
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/logging_striptest2.cc b/funasr/runtime/onnxruntime/third_party/glog/src/logging_striptest2.cc
new file mode 100644
index 0000000..a64685c
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/logging_striptest2.cc
@@ -0,0 +1,35 @@
+// Copyright (c) 2007, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Sergey Ioffe
+
+#define GOOGLE_STRIP_LOG 2
+
+// Include the actual test.
+#include "logging_striptest_main.cc"
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/logging_striptest_main.cc b/funasr/runtime/onnxruntime/third_party/glog/src/logging_striptest_main.cc
new file mode 100644
index 0000000..27e1254
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/logging_striptest_main.cc
@@ -0,0 +1,73 @@
+// Copyright (c) 2007, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Sergey Ioffe
+
+// The common part of the striplog tests.
+
+#include <cstdio>
+#include <string>
+#include <iosfwd>
+#include <glog/logging.h>
+#include "base/commandlineflags.h"
+#include "config.h"
+
+DECLARE_bool(logtostderr);
+GLOG_DEFINE_bool(check_mode, false, "Prints 'opt' or 'dbg'");
+
+using std::string;
+using namespace GOOGLE_NAMESPACE;
+
+int CheckNoReturn(bool b) {
+ string s;
+ if (b) {
+ LOG(FATAL) << "Fatal";
+ } else {
+ return 0;
+ }
+}
+
+struct A { };
+std::ostream &operator<<(std::ostream &str, const A&) {return str;}
+
+int main(int, char* argv[]) {
+ FLAGS_logtostderr = true;
+ InitGoogleLogging(argv[0]);
+ if (FLAGS_check_mode) {
+ printf("%s\n", DEBUG_MODE ? "dbg" : "opt");
+ return 0;
+ }
+ LOG(INFO) << "TESTMESSAGE INFO";
+ LOG(WARNING) << 2 << "something" << "TESTMESSAGE WARNING"
+ << 1 << 'c' << A() << std::endl;
+ LOG(ERROR) << "TESTMESSAGE ERROR";
+ bool flag = true;
+ (flag ? LOG(INFO) : LOG(ERROR)) << "TESTMESSAGE COND";
+ LOG(FATAL) << "TESTMESSAGE FATAL";
+}
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/logging_unittest.cc b/funasr/runtime/onnxruntime/third_party/glog/src/logging_unittest.cc
new file mode 100644
index 0000000..61039a3
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/logging_unittest.cc
@@ -0,0 +1,1491 @@
+// Copyright (c) 2023, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Ray Sidney
+
+#include "config.h"
+#include "utilities.h"
+
+#include <fcntl.h>
+#ifdef HAVE_GLOB_H
+# include <glob.h>
+#endif
+#include <sys/stat.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+#ifdef HAVE_SYS_WAIT_H
+# include <sys/wait.h>
+#endif
+
+#include <cstdio>
+#include <cstdlib>
+#include <fstream>
+#include <iomanip>
+#include <iostream>
+#include <fstream>
+#include <memory>
+#include <queue>
+#include <sstream>
+#include <string>
+#include <vector>
+
+#include "base/commandlineflags.h"
+#include <glog/logging.h>
+#include <glog/raw_logging.h>
+#include "googletest.h"
+
+DECLARE_string(log_backtrace_at); // logging.cc
+
+#ifdef HAVE_LIB_GFLAGS
+#include <gflags/gflags.h>
+using namespace GFLAGS_NAMESPACE;
+#endif
+
+#ifdef HAVE_LIB_GMOCK
+#include <gmock/gmock.h>
+#include "mock-log.h"
+// Introduce several symbols from gmock.
+using testing::_;
+using testing::AnyNumber;
+using testing::HasSubstr;
+using testing::AllOf;
+using testing::StrNe;
+using testing::StrictMock;
+using testing::InitGoogleMock;
+using GOOGLE_NAMESPACE::glog_testing::ScopedMockLog;
+#endif
+
+using namespace std;
+using namespace GOOGLE_NAMESPACE;
+
+// Some non-advertised functions that we want to test or use.
+_START_GOOGLE_NAMESPACE_
+namespace base {
+namespace internal {
+bool GetExitOnDFatal();
+void SetExitOnDFatal(bool value);
+} // namespace internal
+} // namespace base
+_END_GOOGLE_NAMESPACE_
+
+static void TestLogging(bool check_counts);
+static void TestRawLogging();
+static void LogWithLevels(int v, int severity, bool err, bool alsoerr);
+static void TestLoggingLevels();
+static void TestVLogModule();
+static void TestLogString();
+static void TestLogSink();
+static void TestLogToString();
+static void TestLogSinkWaitTillSent();
+static void TestCHECK();
+static void TestDCHECK();
+static void TestSTREQ();
+static void TestBasename();
+static void TestBasenameAppendWhenNoTimestamp();
+static void TestTwoProcessesWrite();
+static void TestSymlink();
+static void TestExtension();
+static void TestWrapper();
+static void TestErrno();
+static void TestTruncate();
+static void TestCustomLoggerDeletionOnShutdown();
+static void TestLogPeriodically();
+
+static int x = -1;
+static void BM_Check1(int n) {
+ while (n-- > 0) {
+ CHECK_GE(n, x);
+ CHECK_GE(n, x);
+ CHECK_GE(n, x);
+ CHECK_GE(n, x);
+ CHECK_GE(n, x);
+ CHECK_GE(n, x);
+ CHECK_GE(n, x);
+ CHECK_GE(n, x);
+ }
+}
+BENCHMARK(BM_Check1)
+
+static void CheckFailure(int a, int b, const char* file, int line, const char* msg);
+static void BM_Check3(int n) {
+ while (n-- > 0) {
+ if (n < x) CheckFailure(n, x, __FILE__, __LINE__, "n < x");
+ if (n < x) CheckFailure(n, x, __FILE__, __LINE__, "n < x");
+ if (n < x) CheckFailure(n, x, __FILE__, __LINE__, "n < x");
+ if (n < x) CheckFailure(n, x, __FILE__, __LINE__, "n < x");
+ if (n < x) CheckFailure(n, x, __FILE__, __LINE__, "n < x");
+ if (n < x) CheckFailure(n, x, __FILE__, __LINE__, "n < x");
+ if (n < x) CheckFailure(n, x, __FILE__, __LINE__, "n < x");
+ if (n < x) CheckFailure(n, x, __FILE__, __LINE__, "n < x");
+ }
+}
+BENCHMARK(BM_Check3)
+
+static void BM_Check2(int n) {
+ if (n == 17) {
+ x = 5;
+ }
+ while (n-- > 0) {
+ CHECK(n >= x);
+ CHECK(n >= x);
+ CHECK(n >= x);
+ CHECK(n >= x);
+ CHECK(n >= x);
+ CHECK(n >= x);
+ CHECK(n >= x);
+ CHECK(n >= x);
+ }
+}
+BENCHMARK(BM_Check2)
+
+static void CheckFailure(int, int, const char* /* file */, int /* line */,
+ const char* /* msg */) {
+}
+
+static void BM_logspeed(int n) {
+ while (n-- > 0) {
+ LOG(INFO) << "test message";
+ }
+}
+BENCHMARK(BM_logspeed)
+
+static void BM_vlog(int n) {
+ while (n-- > 0) {
+ VLOG(1) << "test message";
+ }
+}
+BENCHMARK(BM_vlog)
+
+// Dynamically generate a prefix using the default format and write it to the stream.
+void PrefixAttacher(std::ostream &s, const LogMessageInfo &l, void* data) {
+ // Assert that `data` contains the expected contents before producing the
+ // prefix (otherwise causing the tests to fail):
+ if (data == nullptr || *static_cast<string*>(data) != "good data") {
+ return;
+ }
+
+ s << l.severity[0]
+ << setw(4) << 1900 + l.time.year()
+ << setw(2) << 1 + l.time.month()
+ << setw(2) << l.time.day()
+ << ' '
+ << setw(2) << l.time.hour() << ':'
+ << setw(2) << l.time.min() << ':'
+ << setw(2) << l.time.sec() << "."
+ << setw(6) << l.time.usec()
+ << ' '
+ << setfill(' ') << setw(5)
+ << l.thread_id << setfill('0')
+ << ' '
+ << l.filename << ':' << l.line_number << "]";
+}
+
+int main(int argc, char **argv) {
+ FLAGS_colorlogtostderr = false;
+ FLAGS_timestamp_in_logfile_name = true;
+
+ // Make sure stderr is not buffered as stderr seems to be buffered
+ // on recent windows.
+ setbuf(stderr, nullptr);
+
+ // Test some basics before InitGoogleLogging:
+ CaptureTestStderr();
+ LogWithLevels(FLAGS_v, FLAGS_stderrthreshold,
+ FLAGS_logtostderr, FLAGS_alsologtostderr);
+ LogWithLevels(0, 0, false, false); // simulate "before global c-tors"
+ const string early_stderr = GetCapturedTestStderr();
+
+ EXPECT_FALSE(IsGoogleLoggingInitialized());
+
+ // Setting a custom prefix generator (it will use the default format so that
+ // the golden outputs can be reused):
+ string prefix_attacher_data = "good data";
+ InitGoogleLogging(argv[0], &PrefixAttacher, static_cast<void*>(&prefix_attacher_data));
+
+ EXPECT_TRUE(IsGoogleLoggingInitialized());
+
+ RunSpecifiedBenchmarks();
+
+ FLAGS_logtostderr = true;
+
+ InitGoogleTest(&argc, argv);
+#ifdef HAVE_LIB_GMOCK
+ InitGoogleMock(&argc, argv);
+#endif
+
+#ifdef HAVE_LIB_GFLAGS
+ ParseCommandLineFlags(&argc, &argv, true);
+#endif
+
+ // so that death tests run before we use threads
+ CHECK_EQ(RUN_ALL_TESTS(), 0);
+
+ CaptureTestStderr();
+
+ // re-emit early_stderr
+ LogMessage("dummy", LogMessage::kNoLogPrefix, GLOG_INFO).stream() << early_stderr;
+
+ TestLogging(true);
+ TestRawLogging();
+ TestLoggingLevels();
+ TestVLogModule();
+ TestLogString();
+ TestLogSink();
+ TestLogToString();
+ TestLogSinkWaitTillSent();
+ TestCHECK();
+ TestDCHECK();
+ TestSTREQ();
+
+ // TODO: The golden test portion of this test is very flakey.
+ EXPECT_TRUE(
+ MungeAndDiffTestStderr(FLAGS_test_srcdir + "/src/logging_unittest.err"));
+
+ FLAGS_logtostderr = false;
+
+ FLAGS_logtostdout = true;
+ FLAGS_stderrthreshold = NUM_SEVERITIES;
+ CaptureTestStdout();
+ TestRawLogging();
+ TestLoggingLevels();
+ TestLogString();
+ TestLogSink();
+ TestLogToString();
+ TestLogSinkWaitTillSent();
+ TestCHECK();
+ TestDCHECK();
+ TestSTREQ();
+ EXPECT_TRUE(
+ MungeAndDiffTestStdout(FLAGS_test_srcdir + "/src/logging_unittest.out"));
+ FLAGS_logtostdout = false;
+
+ TestBasename();
+ TestBasenameAppendWhenNoTimestamp();
+ TestTwoProcessesWrite();
+ TestSymlink();
+ TestExtension();
+ TestWrapper();
+ TestErrno();
+ TestTruncate();
+ TestCustomLoggerDeletionOnShutdown();
+ TestLogPeriodically();
+
+ fprintf(stdout, "PASS\n");
+ return 0;
+}
+
+void TestLogging(bool check_counts) {
+ int64 base_num_infos = LogMessage::num_messages(GLOG_INFO);
+ int64 base_num_warning = LogMessage::num_messages(GLOG_WARNING);
+ int64 base_num_errors = LogMessage::num_messages(GLOG_ERROR);
+
+ LOG(INFO) << string("foo ") << "bar " << 10 << ' ' << 3.4;
+ for ( int i = 0; i < 10; ++i ) {
+ int old_errno = errno;
+ errno = i;
+ PLOG_EVERY_N(ERROR, 2) << "Plog every 2, iteration " << COUNTER;
+ errno = old_errno;
+
+ LOG_EVERY_N(ERROR, 3) << "Log every 3, iteration " << COUNTER << endl;
+ LOG_EVERY_N(ERROR, 4) << "Log every 4, iteration " << COUNTER << endl;
+
+ LOG_IF_EVERY_N(WARNING, true, 5) << "Log if every 5, iteration " << COUNTER;
+ LOG_IF_EVERY_N(WARNING, false, 3)
+ << "Log if every 3, iteration " << COUNTER;
+ LOG_IF_EVERY_N(INFO, true, 1) << "Log if every 1, iteration " << COUNTER;
+ LOG_IF_EVERY_N(ERROR, (i < 3), 2)
+ << "Log if less than 3 every 2, iteration " << COUNTER;
+ }
+ LOG_IF(WARNING, true) << "log_if this";
+ LOG_IF(WARNING, false) << "don't log_if this";
+
+ char s[] = "array";
+ LOG(INFO) << s;
+ const char const_s[] = "const array";
+ LOG(INFO) << const_s;
+ int j = 1000;
+ LOG(ERROR) << string("foo") << ' '<< j << ' ' << setw(10) << j << " "
+ << setw(1) << hex << j;
+ LOG(INFO) << "foo " << std::setw(10) << 1.0;
+
+ {
+ google::LogMessage outer(__FILE__, __LINE__, GLOG_ERROR);
+ outer.stream() << "outer";
+
+ LOG(ERROR) << "inner";
+ }
+
+ LogMessage("foo", LogMessage::kNoLogPrefix, GLOG_INFO).stream() << "no prefix";
+
+ if (check_counts) {
+ CHECK_EQ(base_num_infos + 15, LogMessage::num_messages(GLOG_INFO));
+ CHECK_EQ(base_num_warning + 3, LogMessage::num_messages(GLOG_WARNING));
+ CHECK_EQ(base_num_errors + 17, LogMessage::num_messages(GLOG_ERROR));
+ }
+}
+
+static void NoAllocNewHook() {
+ LOG(FATAL) << "unexpected new";
+}
+
+struct NewHook {
+ NewHook() {
+ g_new_hook = &NoAllocNewHook;
+ }
+ ~NewHook() { g_new_hook = nullptr; }
+};
+
+TEST(DeathNoAllocNewHook, logging) {
+ // tests that NewHook used below works
+ NewHook new_hook;
+ ASSERT_DEATH({
+ new int;
+ }, "unexpected new");
+}
+
+void TestRawLogging() {
+ auto* foo = new string("foo ");
+ string huge_str(50000, 'a');
+
+ FlagSaver saver;
+
+ // Check that RAW loggging does not use mallocs.
+ NewHook new_hook;
+
+ RAW_LOG(INFO, "%s%s%d%c%f", foo->c_str(), "bar ", 10, ' ', 3.4);
+ char s[] = "array";
+ RAW_LOG(WARNING, "%s", s);
+ const char const_s[] = "const array";
+ RAW_LOG(INFO, "%s", const_s);
+ void* p = reinterpret_cast<void*>(PTR_TEST_VALUE);
+ RAW_LOG(INFO, "ptr %p", p);
+ p = nullptr;
+ RAW_LOG(INFO, "ptr %p", p);
+ int j = 1000;
+ RAW_LOG(ERROR, "%s%d%c%010d%s%1x", foo->c_str(), j, ' ', j, " ", j);
+ RAW_VLOG(0, "foo %d", j);
+
+#if defined(NDEBUG)
+ RAW_LOG(INFO, "foo %d", j); // so that have same stderr to compare
+#else
+ RAW_DLOG(INFO, "foo %d", j); // test RAW_DLOG in debug mode
+#endif
+
+ // test how long messages are chopped:
+ RAW_LOG(WARNING, "Huge string: %s", huge_str.c_str());
+ RAW_VLOG(0, "Huge string: %s", huge_str.c_str());
+
+ FLAGS_v = 0;
+ RAW_LOG(INFO, "log");
+ RAW_VLOG(0, "vlog 0 on");
+ RAW_VLOG(1, "vlog 1 off");
+ RAW_VLOG(2, "vlog 2 off");
+ RAW_VLOG(3, "vlog 3 off");
+ FLAGS_v = 2;
+ RAW_LOG(INFO, "log");
+ RAW_VLOG(1, "vlog 1 on");
+ RAW_VLOG(2, "vlog 2 on");
+ RAW_VLOG(3, "vlog 3 off");
+
+#if defined(NDEBUG)
+ RAW_DCHECK(1 == 2, " RAW_DCHECK's shouldn't be compiled in normal mode");
+#endif
+
+ RAW_CHECK(1 == 1, "should be ok");
+ RAW_DCHECK(true, "should be ok");
+
+ delete foo;
+}
+
+void LogWithLevels(int v, int severity, bool err, bool alsoerr) {
+ RAW_LOG(INFO,
+ "Test: v=%d stderrthreshold=%d logtostderr=%d alsologtostderr=%d",
+ v, severity, err, alsoerr);
+
+ FlagSaver saver;
+
+ FLAGS_v = v;
+ FLAGS_stderrthreshold = severity;
+ FLAGS_logtostderr = err;
+ FLAGS_alsologtostderr = alsoerr;
+
+ RAW_VLOG(-1, "vlog -1");
+ RAW_VLOG(0, "vlog 0");
+ RAW_VLOG(1, "vlog 1");
+ RAW_LOG(INFO, "log info");
+ RAW_LOG(WARNING, "log warning");
+ RAW_LOG(ERROR, "log error");
+
+ VLOG(-1) << "vlog -1";
+ VLOG(0) << "vlog 0";
+ VLOG(1) << "vlog 1";
+ LOG(INFO) << "log info";
+ LOG(WARNING) << "log warning";
+ LOG(ERROR) << "log error";
+
+ VLOG_IF(-1, true) << "vlog_if -1";
+ VLOG_IF(-1, false) << "don't vlog_if -1";
+ VLOG_IF(0, true) << "vlog_if 0";
+ VLOG_IF(0, false) << "don't vlog_if 0";
+ VLOG_IF(1, true) << "vlog_if 1";
+ VLOG_IF(1, false) << "don't vlog_if 1";
+ LOG_IF(INFO, true) << "log_if info";
+ LOG_IF(INFO, false) << "don't log_if info";
+ LOG_IF(WARNING, true) << "log_if warning";
+ LOG_IF(WARNING, false) << "don't log_if warning";
+ LOG_IF(ERROR, true) << "log_if error";
+ LOG_IF(ERROR, false) << "don't log_if error";
+
+ int c;
+ c = 1; VLOG_IF(100, c -= 2) << "vlog_if 100 expr"; EXPECT_EQ(c, -1);
+ c = 1; VLOG_IF(0, c -= 2) << "vlog_if 0 expr"; EXPECT_EQ(c, -1);
+ c = 1; LOG_IF(INFO, c -= 2) << "log_if info expr"; EXPECT_EQ(c, -1);
+ c = 1; LOG_IF(ERROR, c -= 2) << "log_if error expr"; EXPECT_EQ(c, -1);
+ c = 2; VLOG_IF(0, c -= 2) << "don't vlog_if 0 expr"; EXPECT_EQ(c, 0);
+ c = 2; LOG_IF(ERROR, c -= 2) << "don't log_if error expr"; EXPECT_EQ(c, 0);
+
+ c = 3; LOG_IF_EVERY_N(INFO, c -= 4, 1) << "log_if info every 1 expr";
+ EXPECT_EQ(c, -1);
+ c = 3; LOG_IF_EVERY_N(ERROR, c -= 4, 1) << "log_if error every 1 expr";
+ EXPECT_EQ(c, -1);
+ c = 4; LOG_IF_EVERY_N(ERROR, c -= 4, 3) << "don't log_if info every 3 expr";
+ EXPECT_EQ(c, 0);
+ c = 4; LOG_IF_EVERY_N(ERROR, c -= 4, 3) << "don't log_if error every 3 expr";
+ EXPECT_EQ(c, 0);
+ c = 5; VLOG_IF_EVERY_N(0, c -= 4, 1) << "vlog_if 0 every 1 expr";
+ EXPECT_EQ(c, 1);
+ c = 5; VLOG_IF_EVERY_N(100, c -= 4, 3) << "vlog_if 100 every 3 expr";
+ EXPECT_EQ(c, 1);
+ c = 6; VLOG_IF_EVERY_N(0, c -= 6, 1) << "don't vlog_if 0 every 1 expr";
+ EXPECT_EQ(c, 0);
+ c = 6; VLOG_IF_EVERY_N(100, c -= 6, 3) << "don't vlog_if 100 every 1 expr";
+ EXPECT_EQ(c, 0);
+}
+
+void TestLoggingLevels() {
+ LogWithLevels(0, GLOG_INFO, false, false);
+ LogWithLevels(1, GLOG_INFO, false, false);
+ LogWithLevels(-1, GLOG_INFO, false, false);
+ LogWithLevels(0, GLOG_WARNING, false, false);
+ LogWithLevels(0, GLOG_ERROR, false, false);
+ LogWithLevels(0, GLOG_FATAL, false, false);
+ LogWithLevels(0, GLOG_FATAL, true, false);
+ LogWithLevels(0, GLOG_FATAL, false, true);
+ LogWithLevels(1, GLOG_WARNING, false, false);
+ LogWithLevels(1, GLOG_FATAL, false, true);
+}
+
+int TestVlogHelper() {
+ if (VLOG_IS_ON(1)) {
+ return 1;
+ }
+ return 0;
+}
+
+void TestVLogModule() {
+ int c = TestVlogHelper();
+ EXPECT_EQ(0, c);
+
+#if defined(__GNUC__)
+ EXPECT_EQ(0, SetVLOGLevel("logging_unittest", 1));
+ c = TestVlogHelper();
+ EXPECT_EQ(1, c);
+#endif
+}
+
+TEST(DeathRawCHECK, logging) {
+ ASSERT_DEATH(RAW_CHECK(false, "failure 1"),
+ "RAW: Check false failed: failure 1");
+ ASSERT_DEBUG_DEATH(RAW_DCHECK(1 == 2, "failure 2"),
+ "RAW: Check 1 == 2 failed: failure 2");
+}
+
+void TestLogString() {
+ vector<string> errors;
+ vector<string>* no_errors = nullptr;
+
+ LOG_STRING(INFO, &errors) << "LOG_STRING: " << "collected info";
+ LOG_STRING(WARNING, &errors) << "LOG_STRING: " << "collected warning";
+ LOG_STRING(ERROR, &errors) << "LOG_STRING: " << "collected error";
+
+ LOG_STRING(INFO, no_errors) << "LOG_STRING: " << "reported info";
+ LOG_STRING(WARNING, no_errors) << "LOG_STRING: " << "reported warning";
+ LOG_STRING(ERROR, nullptr) << "LOG_STRING: "
+ << "reported error";
+
+ for (auto& error : errors) {
+ LOG(INFO) << "Captured by LOG_STRING: " << error;
+ }
+}
+
+void TestLogToString() {
+ string error;
+ string* no_error = nullptr;
+
+ LOG_TO_STRING(INFO, &error) << "LOG_TO_STRING: " << "collected info";
+ LOG(INFO) << "Captured by LOG_TO_STRING: " << error;
+ LOG_TO_STRING(WARNING, &error) << "LOG_TO_STRING: " << "collected warning";
+ LOG(INFO) << "Captured by LOG_TO_STRING: " << error;
+ LOG_TO_STRING(ERROR, &error) << "LOG_TO_STRING: " << "collected error";
+ LOG(INFO) << "Captured by LOG_TO_STRING: " << error;
+
+ LOG_TO_STRING(INFO, no_error) << "LOG_TO_STRING: " << "reported info";
+ LOG_TO_STRING(WARNING, no_error) << "LOG_TO_STRING: " << "reported warning";
+ LOG_TO_STRING(ERROR, nullptr) << "LOG_TO_STRING: "
+ << "reported error";
+}
+
+class TestLogSinkImpl : public LogSink {
+ public:
+ vector<string> errors;
+ void send(LogSeverity severity, const char* /* full_filename */,
+ const char* base_filename, int line,
+ const LogMessageTime& logmsgtime, const char* message,
+ size_t message_len) override {
+ errors.push_back(
+ ToString(severity, base_filename, line, logmsgtime, message, message_len));
+ }
+};
+
+void TestLogSink() {
+ TestLogSinkImpl sink;
+ LogSink* no_sink = nullptr;
+
+ LOG_TO_SINK(&sink, INFO) << "LOG_TO_SINK: " << "collected info";
+ LOG_TO_SINK(&sink, WARNING) << "LOG_TO_SINK: " << "collected warning";
+ LOG_TO_SINK(&sink, ERROR) << "LOG_TO_SINK: " << "collected error";
+
+ LOG_TO_SINK(no_sink, INFO) << "LOG_TO_SINK: " << "reported info";
+ LOG_TO_SINK(no_sink, WARNING) << "LOG_TO_SINK: " << "reported warning";
+ LOG_TO_SINK(nullptr, ERROR) << "LOG_TO_SINK: "
+ << "reported error";
+
+ LOG_TO_SINK_BUT_NOT_TO_LOGFILE(&sink, INFO)
+ << "LOG_TO_SINK_BUT_NOT_TO_LOGFILE: " << "collected info";
+ LOG_TO_SINK_BUT_NOT_TO_LOGFILE(&sink, WARNING)
+ << "LOG_TO_SINK_BUT_NOT_TO_LOGFILE: " << "collected warning";
+ LOG_TO_SINK_BUT_NOT_TO_LOGFILE(&sink, ERROR)
+ << "LOG_TO_SINK_BUT_NOT_TO_LOGFILE: " << "collected error";
+
+ LOG_TO_SINK_BUT_NOT_TO_LOGFILE(no_sink, INFO)
+ << "LOG_TO_SINK_BUT_NOT_TO_LOGFILE: " << "thrashed info";
+ LOG_TO_SINK_BUT_NOT_TO_LOGFILE(no_sink, WARNING)
+ << "LOG_TO_SINK_BUT_NOT_TO_LOGFILE: " << "thrashed warning";
+ LOG_TO_SINK_BUT_NOT_TO_LOGFILE(nullptr, ERROR)
+ << "LOG_TO_SINK_BUT_NOT_TO_LOGFILE: "
+ << "thrashed error";
+
+ LOG(INFO) << "Captured by LOG_TO_SINK:";
+ for (auto& error : sink.errors) {
+ LogMessage("foo", LogMessage::kNoLogPrefix, GLOG_INFO).stream() << error;
+ }
+}
+
+// For testing using CHECK*() on anonymous enums.
+enum {
+ CASE_A,
+ CASE_B
+};
+
+void TestCHECK() {
+ // Tests using CHECK*() on int values.
+ CHECK(1 == 1);
+ CHECK_EQ(1, 1);
+ CHECK_NE(1, 2);
+ CHECK_GE(1, 1);
+ CHECK_GE(2, 1);
+ CHECK_LE(1, 1);
+ CHECK_LE(1, 2);
+ CHECK_GT(2, 1);
+ CHECK_LT(1, 2);
+
+ // Tests using CHECK*() on anonymous enums.
+ // Apple's GCC doesn't like this.
+#if !defined(GLOG_OS_MACOSX)
+ CHECK_EQ(CASE_A, CASE_A);
+ CHECK_NE(CASE_A, CASE_B);
+ CHECK_GE(CASE_A, CASE_A);
+ CHECK_GE(CASE_B, CASE_A);
+ CHECK_LE(CASE_A, CASE_A);
+ CHECK_LE(CASE_A, CASE_B);
+ CHECK_GT(CASE_B, CASE_A);
+ CHECK_LT(CASE_A, CASE_B);
+#endif
+}
+
+void TestDCHECK() {
+#if defined(NDEBUG)
+ DCHECK( 1 == 2 ) << " DCHECK's shouldn't be compiled in normal mode";
+#endif
+ DCHECK( 1 == 1 );
+ DCHECK_EQ(1, 1);
+ DCHECK_NE(1, 2);
+ DCHECK_GE(1, 1);
+ DCHECK_GE(2, 1);
+ DCHECK_LE(1, 1);
+ DCHECK_LE(1, 2);
+ DCHECK_GT(2, 1);
+ DCHECK_LT(1, 2);
+
+ auto* orig_ptr = new int64;
+ int64* ptr = DCHECK_NOTNULL(orig_ptr);
+ CHECK_EQ(ptr, orig_ptr);
+ delete orig_ptr;
+}
+
+void TestSTREQ() {
+ CHECK_STREQ("this", "this");
+ CHECK_STREQ(nullptr, nullptr);
+ CHECK_STRCASEEQ("this", "tHiS");
+ CHECK_STRCASEEQ(nullptr, nullptr);
+ CHECK_STRNE("this", "tHiS");
+ CHECK_STRNE("this", nullptr);
+ CHECK_STRCASENE("this", "that");
+ CHECK_STRCASENE(nullptr, "that");
+ CHECK_STREQ((string("a")+"b").c_str(), "ab");
+ CHECK_STREQ(string("test").c_str(),
+ (string("te") + string("st")).c_str());
+}
+
+TEST(DeathSTREQ, logging) {
+ ASSERT_DEATH(CHECK_STREQ(nullptr, "this"), "");
+ ASSERT_DEATH(CHECK_STREQ("this", "siht"), "");
+ ASSERT_DEATH(CHECK_STRCASEEQ(nullptr, "siht"), "");
+ ASSERT_DEATH(CHECK_STRCASEEQ("this", "siht"), "");
+ ASSERT_DEATH(CHECK_STRNE(nullptr, nullptr), "");
+ ASSERT_DEATH(CHECK_STRNE("this", "this"), "");
+ ASSERT_DEATH(CHECK_STREQ((string("a")+"b").c_str(), "abc"), "");
+}
+
+TEST(CheckNOTNULL, Simple) {
+ int64 t;
+ void *ptr = static_cast<void *>(&t);
+ void *ref = CHECK_NOTNULL(ptr);
+ EXPECT_EQ(ptr, ref);
+ CHECK_NOTNULL(reinterpret_cast<char *>(ptr));
+ CHECK_NOTNULL(reinterpret_cast<unsigned char *>(ptr));
+ CHECK_NOTNULL(reinterpret_cast<int *>(ptr));
+ CHECK_NOTNULL(reinterpret_cast<int64 *>(ptr));
+}
+
+TEST(DeathCheckNN, Simple) {
+ ASSERT_DEATH(CHECK_NOTNULL(static_cast<void*>(nullptr)), "");
+}
+
+// Get list of file names that match pattern
+static void GetFiles(const string& pattern, vector<string>* files) {
+ files->clear();
+#if defined(HAVE_GLOB_H)
+ glob_t g;
+ const int r = glob(pattern.c_str(), 0, nullptr, &g);
+ CHECK((r == 0) || (r == GLOB_NOMATCH)) << ": error matching " << pattern;
+ for (size_t i = 0; i < g.gl_pathc; i++) {
+ files->push_back(string(g.gl_pathv[i]));
+ }
+ globfree(&g);
+#elif defined(GLOG_OS_WINDOWS)
+ WIN32_FIND_DATAA data;
+ HANDLE handle = FindFirstFileA(pattern.c_str(), &data);
+ size_t index = pattern.rfind('\\');
+ if (index == string::npos) {
+ LOG(FATAL) << "No directory separator.";
+ }
+ const string dirname = pattern.substr(0, index + 1);
+ if (handle == INVALID_HANDLE_VALUE) {
+ // Finding no files is OK.
+ return;
+ }
+ do {
+ files->push_back(dirname + data.cFileName);
+ } while (FindNextFileA(handle, &data));
+ BOOL result = FindClose(handle);
+ LOG_SYSRESULT(result != 0);
+#else
+# error There is no way to do glob.
+#endif
+}
+
+// Delete files patching pattern
+static void DeleteFiles(const string& pattern) {
+ vector<string> files;
+ GetFiles(pattern, &files);
+ for (auto& file : files) {
+ CHECK(unlink(file.c_str()) == 0) << ": " << strerror(errno);
+ }
+}
+
+//check string is in file (or is *NOT*, depending on optional checkInFileOrNot)
+static void CheckFile(const string& name, const string& expected_string, const bool checkInFileOrNot = true) {
+ vector<string> files;
+ GetFiles(name + "*", &files);
+ CHECK_EQ(files.size(), 1UL);
+
+ FILE* file = fopen(files[0].c_str(), "r");
+ CHECK(file != nullptr) << ": could not open " << files[0];
+ char buf[1000];
+ while (fgets(buf, sizeof(buf), file) != nullptr) {
+ char* first = strstr(buf, expected_string.c_str());
+ // if first == nullptr, not found.
+ // Terser than if (checkInFileOrNot && first != nullptr || !check...
+ if (checkInFileOrNot != (first == nullptr)) {
+ fclose(file);
+ return;
+ }
+ }
+ fclose(file);
+ LOG(FATAL) << "Did " << (checkInFileOrNot? "not " : "") << "find " << expected_string << " in " << files[0];
+}
+
+static void TestBasename() {
+ fprintf(stderr, "==== Test setting log file basename\n");
+ const string dest = FLAGS_test_tmpdir + "/logging_test_basename";
+ DeleteFiles(dest + "*");
+
+ SetLogDestination(GLOG_INFO, dest.c_str());
+ LOG(INFO) << "message to new base";
+ FlushLogFiles(GLOG_INFO);
+
+ CheckFile(dest, "message to new base");
+
+ // Release file handle for the destination file to unlock the file in Windows.
+ LogToStderr();
+ DeleteFiles(dest + "*");
+}
+
+static void TestBasenameAppendWhenNoTimestamp() {
+ fprintf(stderr, "==== Test setting log file basename without timestamp and appending properly\n");
+ const string dest = FLAGS_test_tmpdir + "/logging_test_basename_append_when_no_timestamp";
+ DeleteFiles(dest + "*");
+
+ ofstream out(dest.c_str());
+ out << "test preexisting content" << endl;
+ out.close();
+
+ CheckFile(dest, "test preexisting content");
+
+ FLAGS_timestamp_in_logfile_name=false;
+ SetLogDestination(GLOG_INFO, dest.c_str());
+ LOG(INFO) << "message to new base, appending to preexisting file";
+ FlushLogFiles(GLOG_INFO);
+ FLAGS_timestamp_in_logfile_name=true;
+
+ //if the logging overwrites the file instead of appending it will fail.
+ CheckFile(dest, "test preexisting content");
+ CheckFile(dest, "message to new base, appending to preexisting file");
+
+ // Release file handle for the destination file to unlock the file in Windows.
+ LogToStderr();
+ DeleteFiles(dest + "*");
+}
+
+static void TestTwoProcessesWrite() {
+// test only implemented for platforms with fork & wait; the actual implementation relies on flock
+#if defined(HAVE_SYS_WAIT_H) && defined(HAVE_UNISTD_H) && defined(HAVE_FCNTL)
+ fprintf(stderr, "==== Test setting log file basename and two processes writing - second should fail\n");
+ const string dest = FLAGS_test_tmpdir + "/logging_test_basename_two_processes_writing";
+ DeleteFiles(dest + "*");
+
+ //make both processes write into the same file (easier test)
+ FLAGS_timestamp_in_logfile_name=false;
+ SetLogDestination(GLOG_INFO, dest.c_str());
+ LOG(INFO) << "message to new base, parent";
+ FlushLogFiles(GLOG_INFO);
+
+ pid_t pid = fork();
+ CHECK_ERR(pid);
+ if (pid == 0) {
+ LOG(INFO) << "message to new base, child - should only appear on STDERR not on the file";
+ ShutdownGoogleLogging(); //for children proc
+ exit(EXIT_SUCCESS);
+ } else if (pid > 0) {
+ wait(nullptr);
+ }
+ FLAGS_timestamp_in_logfile_name=true;
+
+ CheckFile(dest, "message to new base, parent");
+ CheckFile(dest, "message to new base, child - should only appear on STDERR not on the file", false);
+
+ // Release
+ LogToStderr();
+ DeleteFiles(dest + "*");
+#endif
+}
+
+static void TestSymlink() {
+#ifndef GLOG_OS_WINDOWS
+ fprintf(stderr, "==== Test setting log file symlink\n");
+ string dest = FLAGS_test_tmpdir + "/logging_test_symlink";
+ string sym = FLAGS_test_tmpdir + "/symlinkbase";
+ DeleteFiles(dest + "*");
+ DeleteFiles(sym + "*");
+
+ SetLogSymlink(GLOG_INFO, "symlinkbase");
+ SetLogDestination(GLOG_INFO, dest.c_str());
+ LOG(INFO) << "message to new symlink";
+ FlushLogFiles(GLOG_INFO);
+ CheckFile(sym, "message to new symlink");
+
+ DeleteFiles(dest + "*");
+ DeleteFiles(sym + "*");
+#endif
+}
+
+static void TestExtension() {
+ fprintf(stderr, "==== Test setting log file extension\n");
+ string dest = FLAGS_test_tmpdir + "/logging_test_extension";
+ DeleteFiles(dest + "*");
+
+ SetLogDestination(GLOG_INFO, dest.c_str());
+ SetLogFilenameExtension("specialextension");
+ LOG(INFO) << "message to new extension";
+ FlushLogFiles(GLOG_INFO);
+ CheckFile(dest, "message to new extension");
+
+ // Check that file name ends with extension
+ vector<string> filenames;
+ GetFiles(dest + "*", &filenames);
+ CHECK_EQ(filenames.size(), 1UL);
+ CHECK(strstr(filenames[0].c_str(), "specialextension") != nullptr);
+
+ // Release file handle for the destination file to unlock the file in Windows.
+ LogToStderr();
+ DeleteFiles(dest + "*");
+}
+
+struct MyLogger : public base::Logger {
+ string data;
+
+ explicit MyLogger(bool* set_on_destruction)
+ : set_on_destruction_(set_on_destruction) {}
+
+ ~MyLogger() override { *set_on_destruction_ = true; }
+
+ void Write(bool /* should_flush */, time_t /* timestamp */,
+ const char* message, size_t length) override {
+ data.append(message, length);
+ }
+
+ void Flush() override {}
+
+ uint32 LogSize() override { return data.length(); }
+
+ private:
+ bool* set_on_destruction_;
+};
+
+static void TestWrapper() {
+ fprintf(stderr, "==== Test log wrapper\n");
+
+ bool custom_logger_deleted = false;
+ auto* my_logger = new MyLogger(&custom_logger_deleted);
+ base::Logger* old_logger = base::GetLogger(GLOG_INFO);
+ base::SetLogger(GLOG_INFO, my_logger);
+ LOG(INFO) << "Send to wrapped logger";
+ CHECK(strstr(my_logger->data.c_str(), "Send to wrapped logger") != nullptr);
+ FlushLogFiles(GLOG_INFO);
+
+ EXPECT_FALSE(custom_logger_deleted);
+ base::SetLogger(GLOG_INFO, old_logger);
+ EXPECT_TRUE(custom_logger_deleted);
+}
+
+static void TestErrno() {
+ fprintf(stderr, "==== Test errno preservation\n");
+
+ errno = ENOENT;
+ TestLogging(false);
+ CHECK_EQ(errno, ENOENT);
+}
+
+static void TestOneTruncate(const char *path, uint64 limit, uint64 keep,
+ size_t dsize, size_t ksize, size_t expect) {
+ int fd;
+ CHECK_ERR(fd = open(path, O_RDWR | O_CREAT | O_TRUNC, 0600));
+
+ const char *discardstr = "DISCARDME!", *keepstr = "KEEPME!";
+ const size_t discard_size = strlen(discardstr), keep_size = strlen(keepstr);
+
+ // Fill the file with the requested data; first discard data, then kept data
+ size_t written = 0;
+ while (written < dsize) {
+ size_t bytes = min(dsize - written, discard_size);
+ CHECK_ERR(write(fd, discardstr, bytes));
+ written += bytes;
+ }
+ written = 0;
+ while (written < ksize) {
+ size_t bytes = min(ksize - written, keep_size);
+ CHECK_ERR(write(fd, keepstr, bytes));
+ written += bytes;
+ }
+
+ TruncateLogFile(path, limit, keep);
+
+ // File should now be shorter
+ struct stat statbuf;
+ CHECK_ERR(fstat(fd, &statbuf));
+ CHECK_EQ(static_cast<size_t>(statbuf.st_size), expect);
+ CHECK_ERR(lseek(fd, 0, SEEK_SET));
+
+ // File should contain the suffix of the original file
+ const size_t buf_size = static_cast<size_t>(statbuf.st_size) + 1;
+ char* buf = new char[buf_size];
+ memset(buf, 0, buf_size);
+ CHECK_ERR(read(fd, buf, buf_size));
+
+ const char* p = buf;
+ size_t checked = 0;
+ while (checked < expect) {
+ size_t bytes = min(expect - checked, keep_size);
+ CHECK(!memcmp(p, keepstr, bytes));
+ checked += bytes;
+ }
+ close(fd);
+ delete[] buf;
+}
+
+static void TestTruncate() {
+#ifdef HAVE_UNISTD_H
+ fprintf(stderr, "==== Test log truncation\n");
+ string path = FLAGS_test_tmpdir + "/truncatefile";
+
+ // Test on a small file
+ TestOneTruncate(path.c_str(), 10, 10, 10, 10, 10);
+
+ // And a big file (multiple blocks to copy)
+ TestOneTruncate(path.c_str(), 2U << 20U, 4U << 10U, 3U << 20U, 4U << 10U,
+ 4U << 10U);
+
+ // Check edge-case limits
+ TestOneTruncate(path.c_str(), 10, 20, 0, 20, 20);
+ TestOneTruncate(path.c_str(), 10, 0, 0, 0, 0);
+ TestOneTruncate(path.c_str(), 10, 50, 0, 10, 10);
+ TestOneTruncate(path.c_str(), 50, 100, 0, 30, 30);
+
+ // MacOSX 10.4 doesn't fail in this case.
+ // Windows doesn't have symlink.
+ // Let's just ignore this test for these cases.
+#if !defined(GLOG_OS_MACOSX) && !defined(GLOG_OS_WINDOWS)
+ // Through a symlink should fail to truncate
+ string linkname = path + ".link";
+ unlink(linkname.c_str());
+ CHECK_ERR(symlink(path.c_str(), linkname.c_str()));
+ TestOneTruncate(linkname.c_str(), 10, 10, 0, 30, 30);
+#endif
+
+ // The /proc/self path makes sense only for linux.
+#if defined(GLOG_OS_LINUX)
+ // Through an open fd symlink should work
+ int fd;
+ CHECK_ERR(fd = open(path.c_str(), O_APPEND | O_WRONLY));
+ char fdpath[64];
+ snprintf(fdpath, sizeof(fdpath), "/proc/self/fd/%d", fd);
+ TestOneTruncate(fdpath, 10, 10, 10, 10, 10);
+#endif
+
+#endif
+}
+
+struct RecordDeletionLogger : public base::Logger {
+ RecordDeletionLogger(bool* set_on_destruction,
+ base::Logger* wrapped_logger) :
+ set_on_destruction_(set_on_destruction),
+ wrapped_logger_(wrapped_logger)
+ {
+ *set_on_destruction_ = false;
+ }
+ ~RecordDeletionLogger() override { *set_on_destruction_ = true; }
+ void Write(bool force_flush, time_t timestamp, const char* message,
+ size_t length) override {
+ wrapped_logger_->Write(force_flush, timestamp, message, length);
+ }
+ void Flush() override { wrapped_logger_->Flush(); }
+ uint32 LogSize() override { return wrapped_logger_->LogSize(); }
+
+ private:
+ bool* set_on_destruction_;
+ base::Logger* wrapped_logger_;
+};
+
+static void TestCustomLoggerDeletionOnShutdown() {
+ bool custom_logger_deleted = false;
+ base::SetLogger(GLOG_INFO,
+ new RecordDeletionLogger(&custom_logger_deleted,
+ base::GetLogger(GLOG_INFO)));
+ EXPECT_TRUE(IsGoogleLoggingInitialized());
+ ShutdownGoogleLogging();
+ EXPECT_TRUE(custom_logger_deleted);
+ EXPECT_FALSE(IsGoogleLoggingInitialized());
+}
+
+namespace LogTimes {
+// Log a "message" every 10ms, 10 times. These numbers are nice compromise
+// between total running time of 100ms and the period of 10ms. The period is
+// large enough such that any CPU and OS scheduling variation shouldn't affect
+// the results from the ideal case by more than 5% (500us or 0.5ms)
+constexpr int64_t LOG_PERIOD_NS = 10000000; // 10ms
+constexpr int64_t LOG_PERIOD_TOL_NS = 500000; // 500us
+
+// Set an upper limit for the number of times the stream operator can be
+// called. Make sure not to exceed this number of times the stream operator is
+// called, since it is also the array size and will be indexed by the stream
+// operator.
+constexpr size_t MAX_CALLS = 10;
+} // namespace LogTimes
+
+struct LogTimeRecorder {
+ LogTimeRecorder() = default;
+ size_t m_streamTimes{0};
+ std::chrono::steady_clock::time_point m_callTimes[LogTimes::MAX_CALLS];
+};
+// The stream operator is called by LOG_EVERY_T every time a logging event
+// occurs. Make sure to save the times for each call as they will be used later
+// to verify the time delta between each call.
+std::ostream& operator<<(std::ostream& stream, LogTimeRecorder& t) {
+ t.m_callTimes[t.m_streamTimes++] = std::chrono::steady_clock::now();
+ return stream;
+}
+// get elapsed time in nanoseconds
+int64 elapsedTime_ns(const std::chrono::steady_clock::time_point& begin,
+ const std::chrono::steady_clock::time_point& end) {
+ return std::chrono::duration_cast<std::chrono::nanoseconds>((end - begin))
+ .count();
+}
+
+static void TestLogPeriodically() {
+ fprintf(stderr, "==== Test log periodically\n");
+
+ LogTimeRecorder timeLogger;
+
+ constexpr double LOG_PERIOD_SEC = LogTimes::LOG_PERIOD_NS * 1e-9;
+
+ while (timeLogger.m_streamTimes < LogTimes::MAX_CALLS) {
+ LOG_EVERY_T(INFO, LOG_PERIOD_SEC)
+ << timeLogger << "Timed Message #" << timeLogger.m_streamTimes;
+ }
+
+ // Calculate time between each call in nanoseconds for higher resolution to
+ // minimize error.
+ int64 nsBetweenCalls[LogTimes::MAX_CALLS - 1];
+ for (size_t i = 1; i < LogTimes::MAX_CALLS; ++i) {
+ nsBetweenCalls[i - 1] = elapsedTime_ns(
+ timeLogger.m_callTimes[i - 1], timeLogger.m_callTimes[i]);
+ }
+
+ for (long time_ns : nsBetweenCalls) {
+ EXPECT_NEAR(time_ns, LogTimes::LOG_PERIOD_NS, LogTimes::LOG_PERIOD_TOL_NS);
+ }
+}
+
+_START_GOOGLE_NAMESPACE_
+namespace glog_internal_namespace_ {
+extern // in logging.cc
+bool SafeFNMatch_(const char* pattern, size_t patt_len,
+ const char* str, size_t str_len);
+} // namespace glog_internal_namespace_
+using glog_internal_namespace_::SafeFNMatch_;
+_END_GOOGLE_NAMESPACE_
+
+static bool WrapSafeFNMatch(string pattern, string str) {
+ pattern += "abc";
+ str += "defgh";
+ return SafeFNMatch_(pattern.data(), pattern.size() - 3,
+ str.data(), str.size() - 5);
+}
+
+TEST(SafeFNMatch, logging) {
+ CHECK(WrapSafeFNMatch("foo", "foo"));
+ CHECK(!WrapSafeFNMatch("foo", "bar"));
+ CHECK(!WrapSafeFNMatch("foo", "fo"));
+ CHECK(!WrapSafeFNMatch("foo", "foo2"));
+ CHECK(WrapSafeFNMatch("bar/foo.ext", "bar/foo.ext"));
+ CHECK(WrapSafeFNMatch("*ba*r/fo*o.ext*", "bar/foo.ext"));
+ CHECK(!WrapSafeFNMatch("bar/foo.ext", "bar/baz.ext"));
+ CHECK(!WrapSafeFNMatch("bar/foo.ext", "bar/foo"));
+ CHECK(!WrapSafeFNMatch("bar/foo.ext", "bar/foo.ext.zip"));
+ CHECK(WrapSafeFNMatch("ba?/*.ext", "bar/foo.ext"));
+ CHECK(WrapSafeFNMatch("ba?/*.ext", "baZ/FOO.ext"));
+ CHECK(!WrapSafeFNMatch("ba?/*.ext", "barr/foo.ext"));
+ CHECK(!WrapSafeFNMatch("ba?/*.ext", "bar/foo.ext2"));
+ CHECK(WrapSafeFNMatch("ba?/*", "bar/foo.ext2"));
+ CHECK(WrapSafeFNMatch("ba?/*", "bar/"));
+ CHECK(!WrapSafeFNMatch("ba?/?", "bar/"));
+ CHECK(!WrapSafeFNMatch("ba?/*", "bar"));
+}
+
+// TestWaitingLogSink will save messages here
+// No lock: Accessed only by TestLogSinkWriter thread
+// and after its demise by its creator.
+static vector<string> global_messages;
+
+// helper for TestWaitingLogSink below.
+// Thread that does the logic of TestWaitingLogSink
+// It's free to use LOG() itself.
+class TestLogSinkWriter : public Thread {
+ public:
+ TestLogSinkWriter() {
+ SetJoinable(true);
+ Start();
+ }
+
+ // Just buffer it (can't use LOG() here).
+ void Buffer(const string& message) {
+ mutex_.Lock();
+ RAW_LOG(INFO, "Buffering");
+ messages_.push(message);
+ mutex_.Unlock();
+ RAW_LOG(INFO, "Buffered");
+ }
+
+ // Wait for the buffer to clear (can't use LOG() here).
+ void Wait() {
+ RAW_LOG(INFO, "Waiting");
+ mutex_.Lock();
+ while (!NoWork()) {
+ mutex_.Unlock();
+ SleepForMilliseconds(1);
+ mutex_.Lock();
+ }
+ RAW_LOG(INFO, "Waited");
+ mutex_.Unlock();
+ }
+
+ // Trigger thread exit.
+ void Stop() {
+ MutexLock l(&mutex_);
+ should_exit_ = true;
+ }
+
+ private:
+
+ // helpers ---------------
+
+ // For creating a "Condition".
+ bool NoWork() { return messages_.empty(); }
+ bool HaveWork() { return !messages_.empty() || should_exit_; }
+
+ // Thread body; CAN use LOG() here!
+ void Run() override {
+ while (true) {
+ mutex_.Lock();
+ while (!HaveWork()) {
+ mutex_.Unlock();
+ SleepForMilliseconds(1);
+ mutex_.Lock();
+ }
+ if (should_exit_ && messages_.empty()) {
+ mutex_.Unlock();
+ break;
+ }
+ // Give the main thread time to log its message,
+ // so that we get a reliable log capture to compare to golden file.
+ // Same for the other sleep below.
+ SleepForMilliseconds(20);
+ RAW_LOG(INFO, "Sink got a messages"); // only RAW_LOG under mutex_ here
+ string message = messages_.front();
+ messages_.pop();
+ // Normally this would be some more real/involved logging logic
+ // where LOG() usage can't be eliminated,
+ // e.g. pushing the message over with an RPC:
+ size_t messages_left = messages_.size();
+ mutex_.Unlock();
+ SleepForMilliseconds(20);
+ // May not use LOG while holding mutex_, because Buffer()
+ // acquires mutex_, and Buffer is called from LOG(),
+ // which has its own internal mutex:
+ // LOG()->LogToSinks()->TestWaitingLogSink::send()->Buffer()
+ LOG(INFO) << "Sink is sending out a message: " << message;
+ LOG(INFO) << "Have " << messages_left << " left";
+ global_messages.push_back(message);
+ }
+ }
+
+ // data ---------------
+
+ Mutex mutex_;
+ bool should_exit_{false};
+ queue<string> messages_; // messages to be logged
+};
+
+// A log sink that exercises WaitTillSent:
+// it pushes data to a buffer and wakes up another thread to do the logging
+// (that other thread can than use LOG() itself),
+class TestWaitingLogSink : public LogSink {
+ public:
+
+ TestWaitingLogSink() {
+ tid_ = pthread_self(); // for thread-specific behavior
+ AddLogSink(this);
+ }
+ ~TestWaitingLogSink() override {
+ RemoveLogSink(this);
+ writer_.Stop();
+ writer_.Join();
+ }
+
+ // (re)define LogSink interface
+
+ void send(LogSeverity severity, const char* /* full_filename */,
+ const char* base_filename, int line,
+ const LogMessageTime& logmsgtime, const char* message,
+ size_t message_len) override {
+ // Push it to Writer thread if we are the original logging thread.
+ // Note: Something like ThreadLocalLogSink is a better choice
+ // to do thread-specific LogSink logic for real.
+ if (pthread_equal(tid_, pthread_self())) {
+ writer_.Buffer(ToString(severity, base_filename, line,
+ logmsgtime, message, message_len));
+ }
+ }
+
+ void WaitTillSent() override {
+ // Wait for Writer thread if we are the original logging thread.
+ if (pthread_equal(tid_, pthread_self())) writer_.Wait();
+ }
+
+ private:
+
+ pthread_t tid_;
+ TestLogSinkWriter writer_;
+};
+
+// Check that LogSink::WaitTillSent can be used in the advertised way.
+// We also do golden-stderr comparison.
+static void TestLogSinkWaitTillSent() {
+ // Clear global_messages here to make sure that this test case can be
+ // reentered
+ global_messages.clear();
+ { TestWaitingLogSink sink;
+ // Sleeps give the sink threads time to do all their work,
+ // so that we get a reliable log capture to compare to the golden file.
+ LOG(INFO) << "Message 1";
+ SleepForMilliseconds(60);
+ LOG(ERROR) << "Message 2";
+ SleepForMilliseconds(60);
+ LOG(WARNING) << "Message 3";
+ SleepForMilliseconds(60);
+ }
+ for (auto& global_message : global_messages) {
+ LOG(INFO) << "Sink capture: " << global_message;
+ }
+ CHECK_EQ(global_messages.size(), 3UL);
+}
+
+TEST(Strerror, logging) {
+ int errcode = EINTR;
+ char *msg = strdup(strerror(errcode));
+ const size_t buf_size = strlen(msg) + 1;
+ char *buf = new char[buf_size];
+ CHECK_EQ(posix_strerror_r(errcode, nullptr, 0), -1);
+ buf[0] = 'A';
+ CHECK_EQ(posix_strerror_r(errcode, buf, 0), -1);
+ CHECK_EQ(buf[0], 'A');
+ CHECK_EQ(posix_strerror_r(errcode, nullptr, buf_size), -1);
+#if defined(GLOG_OS_MACOSX) || defined(GLOG_OS_FREEBSD) || defined(GLOG_OS_OPENBSD)
+ // MacOSX or FreeBSD considers this case is an error since there is
+ // no enough space.
+ CHECK_EQ(posix_strerror_r(errcode, buf, 1), -1);
+#else
+ CHECK_EQ(posix_strerror_r(errcode, buf, 1), 0);
+#endif
+ CHECK_STREQ(buf, "");
+ CHECK_EQ(posix_strerror_r(errcode, buf, buf_size), 0);
+ CHECK_STREQ(buf, msg);
+ delete[] buf;
+ CHECK_EQ(msg, StrError(errcode));
+ free(msg);
+}
+
+// Simple routines to look at the sizes of generated code for LOG(FATAL) and
+// CHECK(..) via objdump
+/*
+static void MyFatal() {
+ LOG(FATAL) << "Failed";
+}
+static void MyCheck(bool a, bool b) {
+ CHECK_EQ(a, b);
+}
+*/
+#ifdef HAVE_LIB_GMOCK
+
+TEST(DVLog, Basic) {
+ ScopedMockLog log;
+
+#if defined(NDEBUG)
+ // We are expecting that nothing is logged.
+ EXPECT_CALL(log, Log(_, _, _)).Times(0);
+#else
+ EXPECT_CALL(log, Log(GLOG_INFO, __FILE__, "debug log"));
+#endif
+
+ FLAGS_v = 1;
+ DVLOG(1) << "debug log";
+}
+
+TEST(DVLog, V0) {
+ ScopedMockLog log;
+
+ // We are expecting that nothing is logged.
+ EXPECT_CALL(log, Log(_, _, _)).Times(0);
+
+ FLAGS_v = 0;
+ DVLOG(1) << "debug log";
+}
+
+TEST(LogAtLevel, Basic) {
+ ScopedMockLog log;
+
+ // The function version outputs "logging.h" as a file name.
+ EXPECT_CALL(log, Log(GLOG_WARNING, StrNe(__FILE__), "function version"));
+ EXPECT_CALL(log, Log(GLOG_INFO, __FILE__, "macro version"));
+
+ int severity = GLOG_WARNING;
+ LogAtLevel(severity, "function version");
+
+ severity = GLOG_INFO;
+ // We can use the macro version as a C++ stream.
+ LOG_AT_LEVEL(severity) << "macro" << ' ' << "version";
+}
+
+TEST(TestExitOnDFatal, ToBeOrNotToBe) {
+ // Check the default setting...
+ EXPECT_TRUE(base::internal::GetExitOnDFatal());
+
+ // Turn off...
+ base::internal::SetExitOnDFatal(false);
+ EXPECT_FALSE(base::internal::GetExitOnDFatal());
+
+ // We don't die.
+ {
+ ScopedMockLog log;
+ //EXPECT_CALL(log, Log(_, _, _)).Times(AnyNumber());
+ // LOG(DFATAL) has severity FATAL if debugging, but is
+ // downgraded to ERROR if not debugging.
+ const LogSeverity severity =
+#if defined(NDEBUG)
+ GLOG_ERROR;
+#else
+ GLOG_FATAL;
+#endif
+ EXPECT_CALL(log, Log(severity, __FILE__, "This should not be fatal"));
+ LOG(DFATAL) << "This should not be fatal";
+ }
+
+ // Turn back on...
+ base::internal::SetExitOnDFatal(true);
+ EXPECT_TRUE(base::internal::GetExitOnDFatal());
+
+#ifdef GTEST_HAS_DEATH_TEST
+ // Death comes on little cats' feet.
+ EXPECT_DEBUG_DEATH({
+ LOG(DFATAL) << "This should be fatal in debug mode";
+ }, "This should be fatal in debug mode");
+#endif
+}
+
+#ifdef HAVE_STACKTRACE
+
+static void BacktraceAtHelper() {
+ LOG(INFO) << "Not me";
+
+// The vertical spacing of the next 3 lines is significant.
+ LOG(INFO) << "Backtrace me";
+}
+static int kBacktraceAtLine = __LINE__ - 2; // The line of the LOG(INFO) above
+
+TEST(LogBacktraceAt, DoesNotBacktraceWhenDisabled) {
+ StrictMock<ScopedMockLog> log;
+
+ FLAGS_log_backtrace_at = "";
+
+ EXPECT_CALL(log, Log(_, _, "Backtrace me"));
+ EXPECT_CALL(log, Log(_, _, "Not me"));
+
+ BacktraceAtHelper();
+}
+
+TEST(LogBacktraceAt, DoesBacktraceAtRightLineWhenEnabled) {
+ StrictMock<ScopedMockLog> log;
+
+ char where[100];
+ snprintf(where, 100, "%s:%d", const_basename(__FILE__), kBacktraceAtLine);
+ FLAGS_log_backtrace_at = where;
+
+ // The LOG at the specified line should include a stacktrace which includes
+ // the name of the containing function, followed by the log message.
+ // We use HasSubstr()s instead of ContainsRegex() for environments
+ // which don't have regexp.
+ EXPECT_CALL(log, Log(_, _, AllOf(HasSubstr("stacktrace:"),
+ HasSubstr("BacktraceAtHelper"),
+ HasSubstr("main"),
+ HasSubstr("Backtrace me"))));
+ // Other LOGs should not include a backtrace.
+ EXPECT_CALL(log, Log(_, _, "Not me"));
+
+ BacktraceAtHelper();
+}
+
+#endif // HAVE_STACKTRACE
+
+#endif // HAVE_LIB_GMOCK
+
+struct UserDefinedClass {
+ bool operator==(const UserDefinedClass&) const { return true; }
+};
+
+inline ostream& operator<<(ostream& out, const UserDefinedClass&) {
+ out << "OK";
+ return out;
+}
+
+TEST(UserDefinedClass, logging) {
+ UserDefinedClass u;
+ vector<string> buf;
+ LOG_STRING(INFO, &buf) << u;
+ CHECK_EQ(1UL, buf.size());
+ CHECK(buf[0].find("OK") != string::npos);
+
+ // We must be able to compile this.
+ CHECK_EQ(u, u);
+}
+
+TEST(LogMsgTime, gmtoff) {
+ /*
+ * Unit test for GMT offset API
+ * TODO: To properly test this API, we need a platform independent way to set time-zone.
+ * */
+ google::LogMessage log_obj(__FILE__, __LINE__);
+
+ long int nGmtOff = log_obj.getLogMessageTime().gmtoff();
+ // GMT offset ranges from UTC-12:00 to UTC+14:00
+ const long utc_min_offset = -43200;
+ const long utc_max_offset = 50400;
+ EXPECT_TRUE( (nGmtOff >= utc_min_offset) && (nGmtOff <= utc_max_offset) );
+}
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/logging_unittest.err b/funasr/runtime/onnxruntime/third_party/glog/src/logging_unittest.err
new file mode 100644
index 0000000..21517cb
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/logging_unittest.err
@@ -0,0 +1,308 @@
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=0 stderrthreshold=2 logtostderr=0 alsologtostderr=0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error
+WARNING: Logging before InitGoogleLogging() is written to STDERR
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=0 stderrthreshold=0 logtostderr=0 alsologtostderr=0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] foo bar 10 3.4
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Plog every 2, iteration 1: __SUCCESS__ [0]
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log every 3, iteration 1
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log every 4, iteration 1
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 5, iteration 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 1
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if less than 3 every 2, iteration 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 2
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Plog every 2, iteration 3: __ENOENT__ [2]
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 3
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if less than 3 every 2, iteration 3
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log every 3, iteration 4
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 4
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Plog every 2, iteration 5: __EINTR__ [4]
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log every 4, iteration 5
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 5
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 5, iteration 6
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 6
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Plog every 2, iteration 7: __ENXIO__ [6]
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log every 3, iteration 7
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 7
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 8
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Plog every 2, iteration 9: __ENOEXEC__ [8]
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log every 4, iteration 9
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 9
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log every 3, iteration 10
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Log if every 1, iteration 10
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if this
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] array
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] const array
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] foo 1000 1000 3e8
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] foo 1
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] inner
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] outer
+no prefix
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: foo bar 10 3.400000
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: array
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: const array
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: ptr __PTRTEST__
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: ptr __NULLP__
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: foo 1000 0000001000 3e8
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: foo 1000
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: foo 1000
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: RAW_LOG ERROR: The Message was too long!
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: RAW_LOG ERROR: The Message was too long!
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 0 on
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 1 on
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 2 on
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=0 stderrthreshold=0 logtostderr=0 alsologtostderr=0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=1 stderrthreshold=0 logtostderr=0 alsologtostderr=0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=-1 stderrthreshold=0 logtostderr=0 alsologtostderr=0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=0 stderrthreshold=1 logtostderr=0 alsologtostderr=0
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=0 stderrthreshold=2 logtostderr=0 alsologtostderr=0
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=0 stderrthreshold=3 logtostderr=0 alsologtostderr=0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=0 stderrthreshold=3 logtostderr=1 alsologtostderr=0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=0 stderrthreshold=3 logtostderr=0 alsologtostderr=1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=1 stderrthreshold=1 logtostderr=0 alsologtostderr=0
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Test: v=1 stderrthreshold=3 logtostderr=0 alsologtostderr=1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: vlog 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: log error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_STRING: reported info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_STRING: reported warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_STRING: reported error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_STRING: LOG_STRING: collected info
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_STRING: LOG_STRING: collected warning
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_STRING: LOG_STRING: collected error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: reported info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: reported warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: reported error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_TO_SINK:
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK_BUT_NOT_TO_LOGFILE: collected info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK_BUT_NOT_TO_LOGFILE: collected warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK_BUT_NOT_TO_LOGFILE: collected error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: collected info
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_TO_STRING: LOG_TO_STRING: collected info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: collected warning
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_TO_STRING: LOG_TO_STRING: collected warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: collected error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_TO_STRING: LOG_TO_STRING: collected error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: reported info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: reported warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: reported error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Buffering
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Buffered
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Waiting
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Sink got a messages
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Waited
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Sink is sending out a message: IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Have 0 left
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 2
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Buffering
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Buffered
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Waiting
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Sink got a messages
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Waited
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Sink is sending out a message: EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 2
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Have 0 left
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 3
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Buffering
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Buffered
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Waiting
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Sink got a messages
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] RAW: Waited
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Sink is sending out a message: WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 3
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Have 0 left
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Sink capture: IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Sink capture: EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 2
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Sink capture: WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 3
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/logging_unittest.out b/funasr/runtime/onnxruntime/third_party/glog/src/logging_unittest.out
new file mode 100644
index 0000000..18795e1
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/logging_unittest.out
@@ -0,0 +1,150 @@
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if -1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if info every 1 expr
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] log_if error every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] vlog_if 0 every 1 expr
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_STRING: reported info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_STRING: reported warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_STRING: reported error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_STRING: LOG_STRING: collected info
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_STRING: LOG_STRING: collected warning
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_STRING: LOG_STRING: collected error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: reported info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: reported warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: reported error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_TO_SINK:
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK: collected error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK_BUT_NOT_TO_LOGFILE: collected info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK_BUT_NOT_TO_LOGFILE: collected warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_SINK_BUT_NOT_TO_LOGFILE: collected error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: collected info
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_TO_STRING: LOG_TO_STRING: collected info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: collected warning
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_TO_STRING: LOG_TO_STRING: collected warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: collected error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Captured by LOG_TO_STRING: LOG_TO_STRING: collected error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: reported info
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: reported warning
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] LOG_TO_STRING: reported error
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Sink is sending out a message: IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Have 0 left
+EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 2
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Sink is sending out a message: EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 2
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Have 0 left
+WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 3
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Sink is sending out a message: WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 3
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Have 0 left
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Sink capture: IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 1
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Sink capture: EYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 2
+IYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Sink capture: WYEARDATE TIME__ THREADID logging_unittest.cc:LINE] Message 3
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/mock-log.h b/funasr/runtime/onnxruntime/third_party/glog/src/mock-log.h
new file mode 100644
index 0000000..62999b2
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/mock-log.h
@@ -0,0 +1,155 @@
+// Copyright (c) 2007, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Zhanyong Wan
+//
+// Defines the ScopedMockLog class (using Google C++ Mocking
+// Framework), which is convenient for testing code that uses LOG().
+
+#ifndef GLOG_SRC_MOCK_LOG_H_
+#define GLOG_SRC_MOCK_LOG_H_
+
+// For GOOGLE_NAMESPACE. This must go first so we get _XOPEN_SOURCE.
+#include "utilities.h"
+
+#include <string>
+
+#include <gmock/gmock.h>
+
+#include <glog/logging.h>
+
+_START_GOOGLE_NAMESPACE_
+namespace glog_testing {
+
+// A ScopedMockLog object intercepts LOG() messages issued during its
+// lifespan. Using this together with Google C++ Mocking Framework,
+// it's very easy to test how a piece of code calls LOG(). The
+// typical usage:
+//
+// TEST(FooTest, LogsCorrectly) {
+// ScopedMockLog log;
+//
+// // We expect the WARNING "Something bad!" exactly twice.
+// EXPECT_CALL(log, Log(WARNING, _, "Something bad!"))
+// .Times(2);
+//
+// // We allow foo.cc to call LOG(INFO) any number of times.
+// EXPECT_CALL(log, Log(INFO, HasSubstr("/foo.cc"), _))
+// .Times(AnyNumber());
+//
+// Foo(); // Exercises the code under test.
+// }
+class ScopedMockLog : public GOOGLE_NAMESPACE::LogSink {
+ public:
+ // When a ScopedMockLog object is constructed, it starts to
+ // intercept logs.
+ ScopedMockLog() { AddLogSink(this); }
+
+ // When the object is destructed, it stops intercepting logs.
+ ~ScopedMockLog() override { RemoveLogSink(this); }
+
+ // Implements the mock method:
+ //
+ // void Log(LogSeverity severity, const string& file_path,
+ // const string& message);
+ //
+ // The second argument to Send() is the full path of the source file
+ // in which the LOG() was issued.
+ //
+ // Note, that in a multi-threaded environment, all LOG() messages from a
+ // single thread will be handled in sequence, but that cannot be guaranteed
+ // for messages from different threads. In fact, if the same or multiple
+ // expectations are matched on two threads concurrently, their actions will
+ // be executed concurrently as well and may interleave.
+ MOCK_METHOD3(Log, void(GOOGLE_NAMESPACE::LogSeverity severity,
+ const std::string& file_path,
+ const std::string& message));
+
+ private:
+ // Implements the send() virtual function in class LogSink.
+ // Whenever a LOG() statement is executed, this function will be
+ // invoked with information presented in the LOG().
+ //
+ // The method argument list is long and carries much information a
+ // test usually doesn't care about, so we trim the list before
+ // forwarding the call to Log(), which is much easier to use in
+ // tests.
+ //
+ // We still cannot call Log() directly, as it may invoke other LOG()
+ // messages, either due to Invoke, or due to an error logged in
+ // Google C++ Mocking Framework code, which would trigger a deadlock
+ // since a lock is held during send().
+ //
+ // Hence, we save the message for WaitTillSent() which will be called after
+ // the lock on send() is released, and we'll call Log() inside
+ // WaitTillSent(). Since while a single send() call may be running at a
+ // time, multiple WaitTillSent() calls (along with the one send() call) may
+ // be running simultaneously, we ensure thread-safety of the exchange between
+ // send() and WaitTillSent(), and that for each message, LOG(), send(),
+ // WaitTillSent() and Log() are executed in the same thread.
+ void send(GOOGLE_NAMESPACE::LogSeverity severity, const char* full_filename,
+ const char* /*base_filename*/, int /*line*/,
+ const LogMessageTime& /*logmsgtime*/, const char* message,
+ size_t message_len) override {
+ // We are only interested in the log severity, full file name, and
+ // log message.
+ message_info_.severity = severity;
+ message_info_.file_path = full_filename;
+ message_info_.message = std::string(message, message_len);
+ }
+
+ // Implements the WaitTillSent() virtual function in class LogSink.
+ // It will be executed after send() and after the global logging lock is
+ // released, so calls within it (or rather within the Log() method called
+ // within) may also issue LOG() statements.
+ //
+ // LOG(), send(), WaitTillSent() and Log() will occur in the same thread for
+ // a given log message.
+ void WaitTillSent() override {
+ // First, and very importantly, we save a copy of the message being
+ // processed before calling Log(), since Log() may indirectly call send()
+ // and WaitTillSent() in the same thread again.
+ MessageInfo message_info = message_info_;
+ Log(message_info.severity, message_info.file_path, message_info.message);
+ }
+
+ // All relevant information about a logged message that needs to be passed
+ // from send() to WaitTillSent().
+ struct MessageInfo {
+ GOOGLE_NAMESPACE::LogSeverity severity;
+ std::string file_path;
+ std::string message;
+ };
+ MessageInfo message_info_;
+};
+
+} // namespace glog_testing
+_END_GOOGLE_NAMESPACE_
+
+#endif // GLOG_SRC_MOCK_LOG_H_
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/mock-log_unittest.cc b/funasr/runtime/onnxruntime/third_party/glog/src/mock-log_unittest.cc
new file mode 100644
index 0000000..b9bef4e
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/mock-log_unittest.cc
@@ -0,0 +1,108 @@
+// Copyright (c) 2022, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Zhanyong Wan
+
+// Tests the ScopedMockLog class.
+
+#include "mock-log.h"
+
+#include <string>
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+namespace {
+
+using GOOGLE_NAMESPACE::GLOG_ERROR;
+using GOOGLE_NAMESPACE::GLOG_INFO;
+using GOOGLE_NAMESPACE::GLOG_WARNING;
+using GOOGLE_NAMESPACE::glog_testing::ScopedMockLog;
+using std::string;
+using testing::_;
+using testing::EndsWith;
+using testing::InSequence;
+using testing::InvokeWithoutArgs;
+
+// Tests that ScopedMockLog intercepts LOG()s when it's alive.
+TEST(ScopedMockLogTest, InterceptsLog) {
+ ScopedMockLog log;
+
+ InSequence s;
+ EXPECT_CALL(log,
+ Log(GLOG_WARNING, EndsWith("mock-log_unittest.cc"), "Fishy."));
+ EXPECT_CALL(log, Log(GLOG_INFO, _, "Working..."))
+ .Times(2);
+ EXPECT_CALL(log, Log(GLOG_ERROR, _, "Bad!!"));
+
+ LOG(WARNING) << "Fishy.";
+ LOG(INFO) << "Working...";
+ LOG(INFO) << "Working...";
+ LOG(ERROR) << "Bad!!";
+}
+
+void LogBranch() {
+ LOG(INFO) << "Logging a branch...";
+}
+
+void LogTree() {
+ LOG(INFO) << "Logging the whole tree...";
+}
+
+void LogForest() {
+ LOG(INFO) << "Logging the entire forest.";
+ LOG(INFO) << "Logging the entire forest..";
+ LOG(INFO) << "Logging the entire forest...";
+}
+
+// The purpose of the following test is to verify that intercepting logging
+// continues to work properly if a LOG statement is executed within the scope
+// of a mocked call.
+TEST(ScopedMockLogTest, LogDuringIntercept) {
+ ScopedMockLog log;
+ InSequence s;
+ EXPECT_CALL(log, Log(GLOG_INFO, __FILE__, "Logging a branch..."))
+ .WillOnce(InvokeWithoutArgs(LogTree));
+ EXPECT_CALL(log, Log(GLOG_INFO, __FILE__, "Logging the whole tree..."))
+ .WillOnce(InvokeWithoutArgs(LogForest));
+ EXPECT_CALL(log, Log(GLOG_INFO, __FILE__, "Logging the entire forest."));
+ EXPECT_CALL(log, Log(GLOG_INFO, __FILE__, "Logging the entire forest.."));
+ EXPECT_CALL(log, Log(GLOG_INFO, __FILE__, "Logging the entire forest..."));
+ LogBranch();
+}
+
+} // namespace
+
+int main(int argc, char **argv) {
+ GOOGLE_NAMESPACE::InitGoogleLogging(argv[0]);
+ testing::InitGoogleTest(&argc, argv);
+ testing::InitGoogleMock(&argc, argv);
+
+ return RUN_ALL_TESTS();
+}
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/package_config_unittest/working_config/CMakeLists.txt b/funasr/runtime/onnxruntime/third_party/glog/src/package_config_unittest/working_config/CMakeLists.txt
new file mode 100644
index 0000000..5fcfe7f
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/package_config_unittest/working_config/CMakeLists.txt
@@ -0,0 +1,8 @@
+cmake_minimum_required (VERSION 3.16)
+project (glog_package_config LANGUAGES CXX)
+
+find_package (glog REQUIRED NO_MODULE)
+
+add_executable (glog_package_config glog_package_config.cc)
+
+target_link_libraries (glog_package_config PRIVATE glog::glog)
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/package_config_unittest/working_config/glog_package_config.cc b/funasr/runtime/onnxruntime/third_party/glog/src/package_config_unittest/working_config/glog_package_config.cc
new file mode 100644
index 0000000..b7b5cf6
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/package_config_unittest/working_config/glog_package_config.cc
@@ -0,0 +1,6 @@
+#include <glog/logging.h>
+
+int main(int /*argc*/, char** argv)
+{
+ google::InitGoogleLogging(argv[0]);
+}
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/raw_logging.cc b/funasr/runtime/onnxruntime/third_party/glog/src/raw_logging.cc
new file mode 100644
index 0000000..9e6cf17
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/raw_logging.cc
@@ -0,0 +1,179 @@
+// Copyright (c) 2006, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Maxim Lifantsev
+//
+// logging_unittest.cc covers the functionality herein
+
+#include <cerrno>
+#include <cstdarg>
+#include <cstdio>
+
+#include "utilities.h"
+#ifdef HAVE_UNISTD_H
+# include <unistd.h> // for close() and write()
+#endif
+#include <fcntl.h> // for open()
+#include <ctime>
+#include "config.h"
+#include <glog/logging.h> // To pick up flag settings etc.
+#include <glog/raw_logging.h>
+#include "base/commandlineflags.h"
+
+#ifdef HAVE_STACKTRACE
+# include "stacktrace.h"
+#endif
+
+#if defined(HAVE_SYSCALL_H)
+#include <syscall.h> // for syscall()
+#elif defined(HAVE_SYS_SYSCALL_H)
+#include <sys/syscall.h> // for syscall()
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if (defined(HAVE_SYSCALL_H) || defined(HAVE_SYS_SYSCALL_H)) && \
+ (!(defined(GLOG_OS_MACOSX))) && !defined(GLOG_OS_EMSCRIPTEN)
+#define safe_write(fd, s, len) syscall(SYS_write, fd, s, len)
+#else
+// Not so safe, but what can you do?
+#define safe_write(fd, s, len) write(fd, s, len)
+#endif
+
+_START_GOOGLE_NAMESPACE_
+
+#if defined(__GNUC__)
+#define GLOG_ATTRIBUTE_FORMAT(archetype, stringIndex, firstToCheck) \
+ __attribute__((format(archetype, stringIndex, firstToCheck)))
+#define GLOG_ATTRIBUTE_FORMAT_ARG(stringIndex) \
+ __attribute__((format_arg(stringIndex)))
+#else
+#define GLOG_ATTRIBUTE_FORMAT(archetype, stringIndex, firstToCheck)
+#define GLOG_ATTRIBUTE_FORMAT_ARG(stringIndex)
+#endif
+
+// CAVEAT: vsnprintf called from *DoRawLog below has some (exotic) code paths
+// that invoke malloc() and getenv() that might acquire some locks.
+// If this becomes a problem we should reimplement a subset of vsnprintf
+// that does not need locks and malloc.
+
+// Helper for RawLog__ below.
+// *DoRawLog writes to *buf of *size and move them past the written portion.
+// It returns true iff there was no overflow or error.
+GLOG_ATTRIBUTE_FORMAT(printf, 3, 4)
+static bool DoRawLog(char** buf, size_t* size, const char* format, ...) {
+ va_list ap;
+ va_start(ap, format);
+ int n = vsnprintf(*buf, *size, format, ap);
+ va_end(ap);
+ if (n < 0 || static_cast<size_t>(n) > *size) return false;
+ *size -= static_cast<size_t>(n);
+ *buf += n;
+ return true;
+}
+
+// Helper for RawLog__ below.
+inline static bool VADoRawLog(char** buf, size_t* size,
+ const char* format, va_list ap) {
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
+ int n = vsnprintf(*buf, *size, format, ap);
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
+ if (n < 0 || static_cast<size_t>(n) > *size) return false;
+ *size -= static_cast<size_t>(n);
+ *buf += n;
+ return true;
+}
+
+static const int kLogBufSize = 3000;
+static bool crashed = false;
+static CrashReason crash_reason;
+static char crash_buf[kLogBufSize + 1] = { 0 }; // Will end in '\0'
+
+GLOG_ATTRIBUTE_FORMAT(printf, 4, 5)
+void RawLog__(LogSeverity severity, const char* file, int line,
+ const char* format, ...) {
+ if (!(FLAGS_logtostdout || FLAGS_logtostderr ||
+ severity >= FLAGS_stderrthreshold || FLAGS_alsologtostderr ||
+ !IsGoogleLoggingInitialized())) {
+ return; // this stderr log message is suppressed
+ }
+ // can't call localtime_r here: it can allocate
+ char buffer[kLogBufSize];
+ char* buf = buffer;
+ size_t size = sizeof(buffer);
+
+ // NOTE: this format should match the specification in base/logging.h
+ DoRawLog(&buf, &size, "%c00000000 00:00:00.000000 %5u %s:%d] RAW: ",
+ LogSeverityNames[severity][0],
+ static_cast<unsigned int>(GetTID()),
+ const_basename(const_cast<char *>(file)), line);
+
+ // Record the position and size of the buffer after the prefix
+ const char* msg_start = buf;
+ const size_t msg_size = size;
+
+ va_list ap;
+ va_start(ap, format);
+ bool no_chop = VADoRawLog(&buf, &size, format, ap);
+ va_end(ap);
+ if (no_chop) {
+ DoRawLog(&buf, &size, "\n");
+ } else {
+ DoRawLog(&buf, &size, "RAW_LOG ERROR: The Message was too long!\n");
+ }
+ // We make a raw syscall to write directly to the stderr file descriptor,
+ // avoiding FILE buffering (to avoid invoking malloc()), and bypassing
+ // libc (to side-step any libc interception).
+ // We write just once to avoid races with other invocations of RawLog__.
+ safe_write(STDERR_FILENO, buffer, strlen(buffer));
+ if (severity == GLOG_FATAL) {
+ if (!sync_val_compare_and_swap(&crashed, false, true)) {
+ crash_reason.filename = file;
+ crash_reason.line_number = line;
+ memcpy(crash_buf, msg_start, msg_size); // Don't include prefix
+ crash_reason.message = crash_buf;
+#ifdef HAVE_STACKTRACE
+ crash_reason.depth =
+ GetStackTrace(crash_reason.stack, ARRAYSIZE(crash_reason.stack), 1);
+#else
+ crash_reason.depth = 0;
+#endif
+ SetCrashReason(&crash_reason);
+ }
+ LogMessage::Fail(); // abort()
+ }
+}
+
+_END_GOOGLE_NAMESPACE_
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/signalhandler.cc b/funasr/runtime/onnxruntime/third_party/glog/src/signalhandler.cc
new file mode 100644
index 0000000..657e15c
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/signalhandler.cc
@@ -0,0 +1,412 @@
+// Copyright (c) 2008, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Satoru Takabayashi
+//
+// Implementation of InstallFailureSignalHandler().
+
+#include "utilities.h"
+#include "stacktrace.h"
+#include "symbolize.h"
+#include <glog/logging.h>
+
+#include <csignal>
+#include <ctime>
+#ifdef HAVE_UCONTEXT_H
+# include <ucontext.h>
+#endif
+#ifdef HAVE_SYS_UCONTEXT_H
+# include <sys/ucontext.h>
+#endif
+#include <algorithm>
+
+_START_GOOGLE_NAMESPACE_
+
+namespace {
+
+// We'll install the failure signal handler for these signals. We could
+// use strsignal() to get signal names, but we don't use it to avoid
+// introducing yet another #ifdef complication.
+//
+// The list should be synced with the comment in signalhandler.h.
+const struct {
+ int number;
+ const char *name;
+} kFailureSignals[] = {
+ { SIGSEGV, "SIGSEGV" },
+ { SIGILL, "SIGILL" },
+ { SIGFPE, "SIGFPE" },
+ { SIGABRT, "SIGABRT" },
+#if !defined(GLOG_OS_WINDOWS)
+ { SIGBUS, "SIGBUS" },
+#endif
+ { SIGTERM, "SIGTERM" },
+};
+
+static bool kFailureSignalHandlerInstalled = false;
+
+#if !defined(GLOG_OS_WINDOWS)
+// Returns the program counter from signal context, nullptr if unknown.
+void* GetPC(void* ucontext_in_void) {
+#if (defined(HAVE_UCONTEXT_H) || defined(HAVE_SYS_UCONTEXT_H)) && defined(PC_FROM_UCONTEXT)
+ if (ucontext_in_void != nullptr) {
+ ucontext_t *context = reinterpret_cast<ucontext_t *>(ucontext_in_void);
+ return (void*)context->PC_FROM_UCONTEXT;
+ }
+#else
+ (void)ucontext_in_void;
+#endif
+ return nullptr;
+}
+#endif
+
+// The class is used for formatting error messages. We don't use printf()
+// as it's not async signal safe.
+class MinimalFormatter {
+ public:
+ MinimalFormatter(char *buffer, size_t size)
+ : buffer_(buffer),
+ cursor_(buffer),
+ end_(buffer + size) {
+ }
+
+ // Returns the number of bytes written in the buffer.
+ std::size_t num_bytes_written() const { return static_cast<std::size_t>(cursor_ - buffer_); }
+
+ // Appends string from "str" and updates the internal cursor.
+ void AppendString(const char* str) {
+ ptrdiff_t i = 0;
+ while (str[i] != '\0' && cursor_ + i < end_) {
+ cursor_[i] = str[i];
+ ++i;
+ }
+ cursor_ += i;
+ }
+
+ // Formats "number" in "radix" and updates the internal cursor.
+ // Lowercase letters are used for 'a' - 'z'.
+ void AppendUint64(uint64 number, unsigned radix) {
+ unsigned i = 0;
+ while (cursor_ + i < end_) {
+ const uint64 tmp = number % radix;
+ number /= radix;
+ cursor_[i] = static_cast<char>(tmp < 10 ? '0' + tmp : 'a' + tmp - 10);
+ ++i;
+ if (number == 0) {
+ break;
+ }
+ }
+ // Reverse the bytes written.
+ std::reverse(cursor_, cursor_ + i);
+ cursor_ += i;
+ }
+
+ // Formats "number" as hexadecimal number, and updates the internal
+ // cursor. Padding will be added in front if needed.
+ void AppendHexWithPadding(uint64 number, int width) {
+ char* start = cursor_;
+ AppendString("0x");
+ AppendUint64(number, 16);
+ // Move to right and add padding in front if needed.
+ if (cursor_ < start + width) {
+ const int64 delta = start + width - cursor_;
+ std::copy(start, cursor_, start + delta);
+ std::fill(start, start + delta, ' ');
+ cursor_ = start + width;
+ }
+ }
+
+ private:
+ char *buffer_;
+ char *cursor_;
+ const char * const end_;
+};
+
+// Writes the given data with the size to the standard error.
+void WriteToStderr(const char* data, size_t size) {
+ if (write(STDERR_FILENO, data, size) < 0) {
+ // Ignore errors.
+ }
+}
+
+// The writer function can be changed by InstallFailureWriter().
+void (*g_failure_writer)(const char* data, size_t size) = WriteToStderr;
+
+// Dumps time information. We don't dump human-readable time information
+// as localtime() is not guaranteed to be async signal safe.
+void DumpTimeInfo() {
+ time_t time_in_sec = time(nullptr);
+ char buf[256]; // Big enough for time info.
+ MinimalFormatter formatter(buf, sizeof(buf));
+ formatter.AppendString("*** Aborted at ");
+ formatter.AppendUint64(static_cast<uint64>(time_in_sec), 10);
+ formatter.AppendString(" (unix time)");
+ formatter.AppendString(" try \"date -d @");
+ formatter.AppendUint64(static_cast<uint64>(time_in_sec), 10);
+ formatter.AppendString("\" if you are using GNU date ***\n");
+ g_failure_writer(buf, formatter.num_bytes_written());
+}
+
+// TODO(hamaji): Use signal instead of sigaction?
+#if defined(HAVE_STACKTRACE) && defined(HAVE_SIGACTION)
+
+// Dumps information about the signal to STDERR.
+void DumpSignalInfo(int signal_number, siginfo_t *siginfo) {
+ // Get the signal name.
+ const char* signal_name = nullptr;
+ for (auto kFailureSignal : kFailureSignals) {
+ if (signal_number == kFailureSignal.number) {
+ signal_name = kFailureSignal.name;
+ }
+ }
+
+ char buf[256]; // Big enough for signal info.
+ MinimalFormatter formatter(buf, sizeof(buf));
+
+ formatter.AppendString("*** ");
+ if (signal_name) {
+ formatter.AppendString(signal_name);
+ } else {
+ // Use the signal number if the name is unknown. The signal name
+ // should be known, but just in case.
+ formatter.AppendString("Signal ");
+ formatter.AppendUint64(static_cast<uint64>(signal_number), 10);
+ }
+ formatter.AppendString(" (@0x");
+ formatter.AppendUint64(reinterpret_cast<uintptr_t>(siginfo->si_addr), 16);
+ formatter.AppendString(")");
+ formatter.AppendString(" received by PID ");
+ formatter.AppendUint64(static_cast<uint64>(getpid()), 10);
+ formatter.AppendString(" (TID 0x");
+ // We assume pthread_t is an integral number or a pointer, rather
+ // than a complex struct. In some environments, pthread_self()
+ // returns an uint64 but in some other environments pthread_self()
+ // returns a pointer.
+ pthread_t id = pthread_self();
+ formatter.AppendUint64(
+ reinterpret_cast<uint64>(reinterpret_cast<const char*>(id)), 16);
+ formatter.AppendString(") ");
+ // Only linux has the PID of the signal sender in si_pid.
+#ifdef GLOG_OS_LINUX
+ formatter.AppendString("from PID ");
+ formatter.AppendUint64(static_cast<uint64>(siginfo->si_pid), 10);
+ formatter.AppendString("; ");
+#endif
+ formatter.AppendString("stack trace: ***\n");
+ g_failure_writer(buf, formatter.num_bytes_written());
+}
+
+#endif // HAVE_SIGACTION
+
+// Dumps information about the stack frame to STDERR.
+void DumpStackFrameInfo(const char* prefix, void* pc) {
+ // Get the symbol name.
+ const char *symbol = "(unknown)";
+ char symbolized[1024]; // Big enough for a sane symbol.
+ // Symbolizes the previous address of pc because pc may be in the
+ // next function.
+ if (Symbolize(reinterpret_cast<char *>(pc) - 1,
+ symbolized, sizeof(symbolized))) {
+ symbol = symbolized;
+ }
+
+ char buf[1024]; // Big enough for stack frame info.
+ MinimalFormatter formatter(buf, sizeof(buf));
+
+ formatter.AppendString(prefix);
+ formatter.AppendString("@ ");
+ const int width = 2 * sizeof(void*) + 2; // + 2 for "0x".
+ formatter.AppendHexWithPadding(reinterpret_cast<uintptr_t>(pc), width);
+ formatter.AppendString(" ");
+ formatter.AppendString(symbol);
+ formatter.AppendString("\n");
+ g_failure_writer(buf, formatter.num_bytes_written());
+}
+
+// Invoke the default signal handler.
+void InvokeDefaultSignalHandler(int signal_number) {
+#ifdef HAVE_SIGACTION
+ struct sigaction sig_action;
+ memset(&sig_action, 0, sizeof(sig_action));
+ sigemptyset(&sig_action.sa_mask);
+ sig_action.sa_handler = SIG_DFL;
+ sigaction(signal_number, &sig_action, nullptr);
+ kill(getpid(), signal_number);
+#elif defined(GLOG_OS_WINDOWS)
+ signal(signal_number, SIG_DFL);
+ raise(signal_number);
+#endif
+}
+
+// This variable is used for protecting FailureSignalHandler() from
+// dumping stuff while another thread is doing it. Our policy is to let
+// the first thread dump stuff and let other threads wait.
+// See also comments in FailureSignalHandler().
+static pthread_t* g_entered_thread_id_pointer = nullptr;
+
+// Dumps signal and stack frame information, and invokes the default
+// signal handler once our job is done.
+#if defined(GLOG_OS_WINDOWS)
+void FailureSignalHandler(int signal_number)
+#else
+void FailureSignalHandler(int signal_number,
+ siginfo_t *signal_info,
+ void *ucontext)
+#endif
+{
+ // First check if we've already entered the function. We use an atomic
+ // compare and swap operation for platforms that support it. For other
+ // platforms, we use a naive method that could lead to a subtle race.
+
+ // We assume pthread_self() is async signal safe, though it's not
+ // officially guaranteed.
+ pthread_t my_thread_id = pthread_self();
+ // NOTE: We could simply use pthread_t rather than pthread_t* for this,
+ // if pthread_self() is guaranteed to return non-zero value for thread
+ // ids, but there is no such guarantee. We need to distinguish if the
+ // old value (value returned from __sync_val_compare_and_swap) is
+ // different from the original value (in this case nullptr).
+ pthread_t* old_thread_id_pointer =
+ glog_internal_namespace_::sync_val_compare_and_swap(
+ &g_entered_thread_id_pointer, static_cast<pthread_t*>(nullptr),
+ &my_thread_id);
+ if (old_thread_id_pointer != nullptr) {
+ // We've already entered the signal handler. What should we do?
+ if (pthread_equal(my_thread_id, *g_entered_thread_id_pointer)) {
+ // It looks the current thread is reentering the signal handler.
+ // Something must be going wrong (maybe we are reentering by another
+ // type of signal?). Kill ourself by the default signal handler.
+ InvokeDefaultSignalHandler(signal_number);
+ }
+ // Another thread is dumping stuff. Let's wait until that thread
+ // finishes the job and kills the process.
+ while (true) {
+ sleep(1);
+ }
+ }
+ // This is the first time we enter the signal handler. We are going to
+ // do some interesting stuff from here.
+ // TODO(satorux): We might want to set timeout here using alarm(), but
+ // mixing alarm() and sleep() can be a bad idea.
+
+ // First dump time info.
+ DumpTimeInfo();
+
+#if !defined(GLOG_OS_WINDOWS)
+ // Get the program counter from ucontext.
+ void *pc = GetPC(ucontext);
+ DumpStackFrameInfo("PC: ", pc);
+#endif
+
+#ifdef HAVE_STACKTRACE
+ // Get the stack traces.
+ void *stack[32];
+ // +1 to exclude this function.
+ const int depth = GetStackTrace(stack, ARRAYSIZE(stack), 1);
+# ifdef HAVE_SIGACTION
+ DumpSignalInfo(signal_number, signal_info);
+#elif !defined(GLOG_OS_WINDOWS)
+ (void)signal_info;
+# endif
+ // Dump the stack traces.
+ for (int i = 0; i < depth; ++i) {
+ DumpStackFrameInfo(" ", stack[i]);
+ }
+#elif !defined(GLOG_OS_WINDOWS)
+ (void)signal_info;
+#endif
+
+ // *** TRANSITION ***
+ //
+ // BEFORE this point, all code must be async-termination-safe!
+ // (See WARNING above.)
+ //
+ // AFTER this point, we do unsafe things, like using LOG()!
+ // The process could be terminated or hung at any time. We try to
+ // do more useful things first and riskier things later.
+
+ // Flush the logs before we do anything in case 'anything'
+ // causes problems.
+ FlushLogFilesUnsafe(0);
+
+ // Kill ourself by the default signal handler.
+ InvokeDefaultSignalHandler(signal_number);
+}
+
+} // namespace
+
+namespace glog_internal_namespace_ {
+
+bool IsFailureSignalHandlerInstalled() {
+#ifdef HAVE_SIGACTION
+ // TODO(andschwa): Return kFailureSignalHandlerInstalled?
+ struct sigaction sig_action;
+ memset(&sig_action, 0, sizeof(sig_action));
+ sigemptyset(&sig_action.sa_mask);
+ sigaction(SIGABRT, nullptr, &sig_action);
+ if (sig_action.sa_sigaction == &FailureSignalHandler) {
+ return true;
+ }
+#elif defined(GLOG_OS_WINDOWS)
+ return kFailureSignalHandlerInstalled;
+#endif // HAVE_SIGACTION
+ return false;
+}
+
+} // namespace glog_internal_namespace_
+
+void InstallFailureSignalHandler() {
+#ifdef HAVE_SIGACTION
+ // Build the sigaction struct.
+ struct sigaction sig_action;
+ memset(&sig_action, 0, sizeof(sig_action));
+ sigemptyset(&sig_action.sa_mask);
+ sig_action.sa_flags |= SA_SIGINFO;
+ sig_action.sa_sigaction = &FailureSignalHandler;
+
+ for (auto kFailureSignal : kFailureSignals) {
+ CHECK_ERR(sigaction(kFailureSignal.number, &sig_action, nullptr));
+ }
+ kFailureSignalHandlerInstalled = true;
+#elif defined(GLOG_OS_WINDOWS)
+ for (size_t i = 0; i < ARRAYSIZE(kFailureSignals); ++i) {
+ CHECK_NE(signal(kFailureSignals[i].number, &FailureSignalHandler),
+ SIG_ERR);
+ }
+ kFailureSignalHandlerInstalled = true;
+#endif // HAVE_SIGACTION
+}
+
+void InstallFailureWriter(void (*writer)(const char* data, size_t size)) {
+#if defined(HAVE_SIGACTION) || defined(GLOG_OS_WINDOWS)
+ g_failure_writer = writer;
+#endif // HAVE_SIGACTION
+}
+
+_END_GOOGLE_NAMESPACE_
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/signalhandler_unittest.cc b/funasr/runtime/onnxruntime/third_party/glog/src/signalhandler_unittest.cc
new file mode 100644
index 0000000..c88598b
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/signalhandler_unittest.cc
@@ -0,0 +1,113 @@
+// Copyright (c) 2008, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Satoru Takabayashi
+//
+// This is a helper binary for testing signalhandler.cc. The actual test
+// is done in signalhandler_unittest.sh.
+
+#include "utilities.h"
+
+#if defined(HAVE_PTHREAD)
+# include <pthread.h>
+#endif
+#include <csignal>
+#include <cstdio>
+#include <cstdlib>
+#include <string>
+#include <glog/logging.h>
+
+#ifdef HAVE_LIB_GFLAGS
+#include <gflags/gflags.h>
+using namespace GFLAGS_NAMESPACE;
+#endif
+
+using namespace GOOGLE_NAMESPACE;
+
+static void* DieInThread(void*) {
+ // We assume pthread_t is an integral number or a pointer, rather
+ // than a complex struct. In some environments, pthread_self()
+ // returns an uint64 but in some other environments pthread_self()
+ // returns a pointer.
+ fprintf(
+ stderr, "0x%px is dying\n",
+ static_cast<const void*>(reinterpret_cast<const char*>(pthread_self())));
+ // Use volatile to prevent from these to be optimized away.
+ volatile int a = 0;
+ volatile int b = 1 / a;
+ fprintf(stderr, "We should have died: b=%d\n", b);
+ return nullptr;
+}
+
+static void WriteToStdout(const char* data, size_t size) {
+ if (write(STDOUT_FILENO, data, size) < 0) {
+ // Ignore errors.
+ }
+}
+
+int main(int argc, char **argv) {
+#if defined(HAVE_STACKTRACE) && defined(HAVE_SYMBOLIZE)
+ InitGoogleLogging(argv[0]);
+#ifdef HAVE_LIB_GFLAGS
+ ParseCommandLineFlags(&argc, &argv, true);
+#endif
+ InstallFailureSignalHandler();
+ const std::string command = argc > 1 ? argv[1] : "none";
+ if (command == "segv") {
+ // We'll check if this is outputted.
+ LOG(INFO) << "create the log file";
+ LOG(INFO) << "a message before segv";
+ // We assume 0xDEAD is not writable.
+ int *a = (int*)0xDEAD;
+ *a = 0;
+ } else if (command == "loop") {
+ fprintf(stderr, "looping\n");
+ while (true);
+ } else if (command == "die_in_thread") {
+#if defined(HAVE_PTHREAD)
+ pthread_t thread;
+ pthread_create(&thread, nullptr, &DieInThread, nullptr);
+ pthread_join(thread, nullptr);
+#else
+ fprintf(stderr, "no pthread\n");
+ return 1;
+#endif
+ } else if (command == "dump_to_stdout") {
+ InstallFailureWriter(WriteToStdout);
+ abort();
+ } else if (command == "installed") {
+ fprintf(stderr, "signal handler installed: %s\n",
+ IsFailureSignalHandlerInstalled() ? "true" : "false");
+ } else {
+ // Tell the shell script
+ puts("OK");
+ }
+#endif
+ return 0;
+}
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/signalhandler_unittest.sh b/funasr/runtime/onnxruntime/third_party/glog/src/signalhandler_unittest.sh
new file mode 100755
index 0000000..265cd45
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/signalhandler_unittest.sh
@@ -0,0 +1,131 @@
+#! /bin/sh
+#
+# Copyright (c) 2008, Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Author: Satoru Takabayashi
+#
+# Unit tests for signalhandler.cc.
+
+die () {
+ echo $1
+ exit 1
+}
+
+BINDIR=".libs"
+LIBGLOG="$BINDIR/libglog.so"
+
+BINARY="$BINDIR/signalhandler_unittest"
+LOG_INFO="./signalhandler_unittest.INFO"
+
+# Remove temporary files.
+rm -f signalhandler.out*
+
+if test -e "$BINARY"; then
+ # We need shared object.
+ export LD_LIBRARY_PATH=$BINDIR
+ export DYLD_LIBRARY_PATH=$BINDIR
+else
+ # For windows
+ BINARY="./signalhandler_unittest.exe"
+ if ! test -e "$BINARY"; then
+ echo "We coundn't find demangle_unittest binary."
+ exit 1
+ fi
+fi
+
+if [ x`$BINARY` != 'xOK' ]; then
+ echo "PASS (No stacktrace support. We don't run this test.)"
+ exit 0
+fi
+
+# The PC cannot be obtained in signal handlers on PowerPC correctly.
+# We just skip the test for PowerPC.
+if [ x`uname -p` = x"powerpc" ]; then
+ echo "PASS (We don't test the signal handler on PowerPC.)"
+ exit 0
+fi
+
+# Test for a case the program kills itself by SIGSEGV.
+GOOGLE_LOG_DIR=. $BINARY segv 2> signalhandler.out1
+for pattern in SIGSEGV 0xdead main "Aborted at [0-9]"; do
+ if ! grep --quiet "$pattern" signalhandler.out1; then
+ die "'$pattern' should appear in the output"
+ fi
+done
+if ! grep --quiet "a message before segv" $LOG_INFO; then
+ die "'a message before segv' should appear in the INFO log"
+fi
+rm -f $LOG_INFO
+
+# Test for a case the program is killed by this shell script.
+# $! = the process id of the last command run in the background.
+# $$ = the process id of this shell.
+$BINARY loop 2> signalhandler.out2 &
+# Wait until "looping" is written in the file. This indicates the program
+# is ready to accept signals.
+while true; do
+ if grep --quiet looping signalhandler.out2; then
+ break
+ fi
+done
+kill -TERM $!
+wait $!
+
+from_pid=''
+# Only linux has the process ID of the signal sender.
+if [ x`uname` = "xLinux" ]; then
+ from_pid="from PID $$"
+fi
+for pattern in SIGTERM "by PID $!" "$from_pid" main "Aborted at [0-9]"; do
+ if ! grep --quiet "$pattern" signalhandler.out2; then
+ die "'$pattern' should appear in the output"
+ fi
+done
+
+# Test for a case the program dies in a non-main thread.
+$BINARY die_in_thread 2> signalhandler.out3
+EXPECTED_TID="`sed 's/ .*//; q' signalhandler.out3`"
+
+for pattern in SIGFPE DieInThread "TID $EXPECTED_TID" "Aborted at [0-9]"; do
+ if ! grep --quiet "$pattern" signalhandler.out3; then
+ die "'$pattern' should appear in the output"
+ fi
+done
+
+# Test for a case the program installs a custom failure writer that writes
+# stuff to stdout instead of stderr.
+$BINARY dump_to_stdout 1> signalhandler.out4
+for pattern in SIGABRT main "Aborted at [0-9]"; do
+ if ! grep --quiet "$pattern" signalhandler.out4; then
+ die "'$pattern' should appear in the output"
+ fi
+done
+
+echo PASS
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/stacktrace.h b/funasr/runtime/onnxruntime/third_party/glog/src/stacktrace.h
new file mode 100644
index 0000000..bf23e19
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/stacktrace.h
@@ -0,0 +1,61 @@
+// Copyright (c) 2000 - 2007, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Routines to extract the current stack trace. These functions are
+// thread-safe.
+
+#ifndef BASE_STACKTRACE_H_
+#define BASE_STACKTRACE_H_
+
+#include "config.h"
+#include <glog/logging.h>
+
+_START_GOOGLE_NAMESPACE_
+
+// This is similar to the GetStackFrames routine, except that it returns
+// the stack trace only, and not the stack frame sizes as well.
+// Example:
+// main() { foo(); }
+// foo() { bar(); }
+// bar() {
+// void* result[10];
+// int depth = GetStackFrames(result, 10, 1);
+// }
+//
+// This produces:
+// result[0] foo
+// result[1] main
+// .... ...
+//
+// "result" must not be nullptr.
+GLOG_EXPORT int GetStackTrace(void** result, int max_depth, int skip_count);
+
+_END_GOOGLE_NAMESPACE_
+
+#endif // BASE_STACKTRACE_H_
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_generic-inl.h b/funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_generic-inl.h
new file mode 100644
index 0000000..0e473a9
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_generic-inl.h
@@ -0,0 +1,64 @@
+// Copyright (c) 2000 - 2007, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Portable implementation - just use glibc
+//
+// Note: The glibc implementation may cause a call to malloc.
+// This can cause a deadlock in HeapProfiler.
+#include <execinfo.h>
+
+#include <cstring>
+
+#include "stacktrace.h"
+
+_START_GOOGLE_NAMESPACE_
+
+// If you change this function, also change GetStackFrames below.
+int GetStackTrace(void** result, int max_depth, int skip_count) {
+ static const int kStackLength = 64;
+ void * stack[kStackLength];
+ int size;
+
+ size = backtrace(stack, kStackLength);
+ skip_count++; // we want to skip the current frame as well
+ int result_count = size - skip_count;
+ if (result_count < 0) {
+ result_count = 0;
+ }
+ if (result_count > max_depth) {
+ result_count = max_depth;
+ }
+ for (int i = 0; i < result_count; i++) {
+ result[i] = stack[i + skip_count];
+ }
+
+ return result_count;
+}
+
+_END_GOOGLE_NAMESPACE_
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_libunwind-inl.h b/funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_libunwind-inl.h
new file mode 100644
index 0000000..0b20d23
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_libunwind-inl.h
@@ -0,0 +1,93 @@
+// Copyright (c) 2005 - 2007, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Arun Sharma
+//
+// Produce stack trace using libunwind
+
+#include "utilities.h"
+
+extern "C" {
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+}
+#include <glog/raw_logging.h>
+#include "stacktrace.h"
+
+_START_GOOGLE_NAMESPACE_
+
+// Sometimes, we can try to get a stack trace from within a stack
+// trace, because libunwind can call mmap (maybe indirectly via an
+// internal mmap based memory allocator), and that mmap gets trapped
+// and causes a stack-trace request. If were to try to honor that
+// recursive request, we'd end up with infinite recursion or deadlock.
+// Luckily, it's safe to ignore those subsequent traces. In such
+// cases, we return 0 to indicate the situation.
+// We can use the GCC __thread syntax here since libunwind is not supported on
+// Windows.
+static __thread bool g_tl_entered; // Initialized to false.
+
+// If you change this function, also change GetStackFrames below.
+int GetStackTrace(void** result, int max_depth, int skip_count) {
+ void *ip;
+ int n = 0;
+ unw_cursor_t cursor;
+ unw_context_t uc;
+
+ if (g_tl_entered) {
+ return 0;
+ }
+ g_tl_entered = true;
+
+ unw_getcontext(&uc);
+ RAW_CHECK(unw_init_local(&cursor, &uc) >= 0, "unw_init_local failed");
+ skip_count++; // Do not include the "GetStackTrace" frame
+
+ while (n < max_depth) {
+ int ret =
+ unw_get_reg(&cursor, UNW_REG_IP, reinterpret_cast<unw_word_t *>(&ip));
+ if (ret < 0) {
+ break;
+ }
+ if (skip_count > 0) {
+ skip_count--;
+ } else {
+ result[n++] = ip;
+ }
+ ret = unw_step(&cursor);
+ if (ret <= 0) {
+ break;
+ }
+ }
+
+ g_tl_entered = false;
+ return n;
+}
+
+_END_GOOGLE_NAMESPACE_
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_powerpc-inl.h b/funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_powerpc-inl.h
new file mode 100644
index 0000000..30217db
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_powerpc-inl.h
@@ -0,0 +1,133 @@
+// Copyright (c) 2007, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Craig Silverstein
+//
+// Produce stack trace. I'm guessing (hoping!) the code is much like
+// for x86. For apple machines, at least, it seems to be; see
+// http://developer.apple.com/documentation/mac/runtimehtml/RTArch-59.html
+// http://www.linux-foundation.org/spec/ELF/ppc64/PPC-elf64abi-1.9.html#STACK
+// Linux has similar code: http://patchwork.ozlabs.org/linuxppc/patch?id=8882
+
+#include <cstdint> // for uintptr_t
+#include <cstdio>
+
+#include "stacktrace.h"
+
+_START_GOOGLE_NAMESPACE_
+
+// Given a pointer to a stack frame, locate and return the calling
+// stackframe, or return nullptr if no stackframe can be found. Perform sanity
+// checks (the strictness of which is controlled by the boolean parameter
+// "STRICT_UNWINDING") to reduce the chance that a bad pointer is returned.
+template<bool STRICT_UNWINDING>
+static void **NextStackFrame(void **old_sp) {
+ void **new_sp = static_cast<void **>(*old_sp);
+
+ // Check that the transition from frame pointer old_sp to frame
+ // pointer new_sp isn't clearly bogus
+ if (STRICT_UNWINDING) {
+ // With the stack growing downwards, older stack frame must be
+ // at a greater address that the current one.
+ if (new_sp <= old_sp) return nullptr;
+ // Assume stack frames larger than 100,000 bytes are bogus.
+ if ((uintptr_t)new_sp - (uintptr_t)old_sp > 100000) return nullptr;
+ } else {
+ // In the non-strict mode, allow discontiguous stack frames.
+ // (alternate-signal-stacks for example).
+ if (new_sp == old_sp) return nullptr;
+ // And allow frames upto about 1MB.
+ if ((new_sp > old_sp) &&
+ ((uintptr_t)new_sp - (uintptr_t)old_sp > 1000000)) {
+ return nullptr;
+ }
+ }
+ if ((uintptr_t)new_sp & (sizeof(void *) - 1)) return nullptr;
+ return new_sp;
+}
+
+// This ensures that GetStackTrace stes up the Link Register properly.
+void StacktracePowerPCDummyFunction() __attribute__((noinline));
+void StacktracePowerPCDummyFunction() { __asm__ volatile(""); }
+
+// If you change this function, also change GetStackFrames below.
+int GetStackTrace(void** result, int max_depth, int skip_count) {
+ void **sp;
+ // Apple OS X uses an old version of gnu as -- both Darwin 7.9.0 (Panther)
+ // and Darwin 8.8.1 (Tiger) use as 1.38. This means we have to use a
+ // different asm syntax. I don't know quite the best way to discriminate
+ // systems using the old as from the new one; I've gone with __APPLE__.
+#ifdef __APPLE__
+ __asm__ volatile ("mr %0,r1" : "=r" (sp));
+#else
+ __asm__ volatile ("mr %0,1" : "=r" (sp));
+#endif
+
+ // On PowerPC, the "Link Register" or "Link Record" (LR), is a stack
+ // entry that holds the return address of the subroutine call (what
+ // instruction we run after our function finishes). This is the
+ // same as the stack-pointer of our parent routine, which is what we
+ // want here. While the compiler will always(?) set up LR for
+ // subroutine calls, it may not for leaf functions (such as this one).
+ // This routine forces the compiler (at least gcc) to push it anyway.
+ StacktracePowerPCDummyFunction();
+
+ // The LR save area is used by the callee, so the top entry is bogus.
+ skip_count++;
+
+ int n = 0;
+ while (sp && n < max_depth) {
+ if (skip_count > 0) {
+ skip_count--;
+ } else {
+ // PowerPC has 3 main ABIs, which say where in the stack the
+ // Link Register is. For DARWIN and AIX (used by apple and
+ // linux ppc64), it's in sp[2]. For SYSV (used by linux ppc),
+ // it's in sp[1].
+#if defined(_CALL_AIX) || defined(_CALL_DARWIN)
+ result[n++] = *(sp+2);
+#elif defined(_CALL_SYSV)
+ result[n++] = *(sp+1);
+#elif defined(__APPLE__) || ((defined(__linux) || defined(__linux__)) && defined(__PPC64__))
+ // This check is in case the compiler doesn't define _CALL_AIX/etc.
+ result[n++] = *(sp+2);
+#elif defined(__linux) || defined(__OpenBSD__)
+ // This check is in case the compiler doesn't define _CALL_SYSV.
+ result[n++] = *(sp+1);
+#else
+#error Need to specify the PPC ABI for your archiecture.
+#endif
+ }
+ // Use strict unwinding rules.
+ sp = NextStackFrame<true>(sp);
+ }
+ return n;
+}
+
+_END_GOOGLE_NAMESPACE_
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_unittest.cc b/funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_unittest.cc
new file mode 100644
index 0000000..6d3c21a
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_unittest.cc
@@ -0,0 +1,245 @@
+// Copyright (c) 2004, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "utilities.h"
+
+#include <cstdio>
+#include <cstdlib>
+#include "config.h"
+#include "base/commandlineflags.h"
+#include <glog/logging.h>
+#include "stacktrace.h"
+
+#ifdef HAVE_EXECINFO_BACKTRACE_SYMBOLS
+# include <execinfo.h>
+#endif
+
+using namespace GOOGLE_NAMESPACE;
+
+#ifdef HAVE_STACKTRACE
+
+// Obtain a backtrace, verify that the expected callers are present in the
+// backtrace, and maybe print the backtrace to stdout.
+
+// The sequence of functions whose return addresses we expect to see in the
+// backtrace.
+const int BACKTRACE_STEPS = 6;
+
+struct AddressRange {
+ const void *start, *end;
+};
+
+// Expected function [start,end] range.
+AddressRange expected_range[BACKTRACE_STEPS];
+
+#if __GNUC__
+// Using GCC extension: address of a label can be taken with '&&label'.
+// Start should be a label somewhere before recursive call, end somewhere
+// after it.
+#define INIT_ADDRESS_RANGE(fn, start_label, end_label, prange) \
+ do { \
+ (prange)->start = &&start_label; \
+ (prange)->end = &&end_label; \
+ CHECK_LT((prange)->start, (prange)->end); \
+ } while (0)
+// This macro expands into "unmovable" code (opaque to GCC), and that
+// prevents GCC from moving a_label up or down in the code.
+// Without it, there is no code following the 'end' label, and GCC
+// (4.3.1, 4.4.0) thinks it safe to assign &&end an address that is before
+// the recursive call.
+#define DECLARE_ADDRESS_LABEL(a_label) \
+ a_label: do { __asm__ __volatile__(""); } while (0)
+// Gcc 4.4.0 may split function into multiple chunks, and the chunk
+// performing recursive call may end up later in the code then the return
+// instruction (this actually happens with FDO).
+// Adjust function range from __builtin_return_address.
+#define ADJUST_ADDRESS_RANGE_FROM_RA(prange) \
+ do { \
+ void *ra = __builtin_return_address(0); \
+ CHECK_LT((prange)->start, ra); \
+ if (ra > (prange)->end) { \
+ printf("Adjusting range from %p..%p to %p..%p\n", \
+ (prange)->start, (prange)->end, \
+ (prange)->start, ra); \
+ (prange)->end = ra; \
+ } \
+ } while (0)
+#else
+// Assume the Check* functions below are not longer than 256 bytes.
+#define INIT_ADDRESS_RANGE(fn, start_label, end_label, prange) \
+ do { \
+ (prange)->start = reinterpret_cast<const void *>(&fn); \
+ (prange)->end = reinterpret_cast<const char *>(&fn) + 256; \
+ } while (0)
+#define DECLARE_ADDRESS_LABEL(a_label) do { } while (0)
+#define ADJUST_ADDRESS_RANGE_FROM_RA(prange) do { } while (0)
+#endif // __GNUC__
+
+//-----------------------------------------------------------------------//
+
+static void CheckRetAddrIsInFunction(void *ret_addr, const AddressRange &range)
+{
+ CHECK_GE(ret_addr, range.start);
+ CHECK_LE(ret_addr, range.end);
+}
+
+//-----------------------------------------------------------------------//
+
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wgnu-label-as-value"
+#endif
+
+void ATTRIBUTE_NOINLINE CheckStackTrace(int);
+static void ATTRIBUTE_NOINLINE CheckStackTraceLeaf() {
+ const int STACK_LEN = 10;
+ void *stack[STACK_LEN];
+ int size;
+
+ ADJUST_ADDRESS_RANGE_FROM_RA(&expected_range[1]);
+ INIT_ADDRESS_RANGE(CheckStackTraceLeaf, start, end, &expected_range[0]);
+ DECLARE_ADDRESS_LABEL(start);
+ size = GetStackTrace(stack, STACK_LEN, 0);
+ printf("Obtained %d stack frames.\n", size);
+ CHECK_GE(size, 1);
+ CHECK_LE(size, STACK_LEN);
+
+ if (true) {
+#ifdef HAVE_EXECINFO_BACKTRACE_SYMBOLS
+ char **strings = backtrace_symbols(stack, size);
+ printf("Obtained %d stack frames.\n", size);
+ for (int i = 0; i < size; i++) {
+ printf("%s %p\n", strings[i], stack[i]);
+ }
+
+ union {
+ void (*p1)(int);
+ void* p2;
+ } p = {&CheckStackTrace};
+
+ printf("CheckStackTrace() addr: %p\n", p.p2);
+ free(strings);
+#endif
+ }
+ for (int i = 0; i < BACKTRACE_STEPS; i++) {
+ printf("Backtrace %d: expected: %p..%p actual: %p ... ",
+ i, expected_range[i].start, expected_range[i].end, stack[i]);
+ fflush(stdout);
+ CheckRetAddrIsInFunction(stack[i], expected_range[i]);
+ printf("OK\n");
+ }
+ DECLARE_ADDRESS_LABEL(end);
+}
+
+//-----------------------------------------------------------------------//
+
+/* Dummy functions to make the backtrace more interesting. */
+static void ATTRIBUTE_NOINLINE CheckStackTrace4(int i) {
+ ADJUST_ADDRESS_RANGE_FROM_RA(&expected_range[2]);
+ INIT_ADDRESS_RANGE(CheckStackTrace4, start, end, &expected_range[1]);
+ DECLARE_ADDRESS_LABEL(start);
+ for (int j = i; j >= 0; j--) {
+ CheckStackTraceLeaf();
+ }
+ DECLARE_ADDRESS_LABEL(end);
+}
+static void ATTRIBUTE_NOINLINE CheckStackTrace3(int i) {
+ ADJUST_ADDRESS_RANGE_FROM_RA(&expected_range[3]);
+ INIT_ADDRESS_RANGE(CheckStackTrace3, start, end, &expected_range[2]);
+ DECLARE_ADDRESS_LABEL(start);
+ for (int j = i; j >= 0; j--) {
+ CheckStackTrace4(j);
+ }
+ DECLARE_ADDRESS_LABEL(end);
+}
+static void ATTRIBUTE_NOINLINE CheckStackTrace2(int i) {
+ ADJUST_ADDRESS_RANGE_FROM_RA(&expected_range[4]);
+ INIT_ADDRESS_RANGE(CheckStackTrace2, start, end, &expected_range[3]);
+ DECLARE_ADDRESS_LABEL(start);
+ for (int j = i; j >= 0; j--) {
+ CheckStackTrace3(j);
+ }
+ DECLARE_ADDRESS_LABEL(end);
+}
+static void ATTRIBUTE_NOINLINE CheckStackTrace1(int i) {
+ ADJUST_ADDRESS_RANGE_FROM_RA(&expected_range[5]);
+ INIT_ADDRESS_RANGE(CheckStackTrace1, start, end, &expected_range[4]);
+ DECLARE_ADDRESS_LABEL(start);
+ for (int j = i; j >= 0; j--) {
+ CheckStackTrace2(j);
+ }
+ DECLARE_ADDRESS_LABEL(end);
+}
+
+#ifndef __GNUC__
+// On non-GNU environment, we use the address of `CheckStackTrace` to
+// guess the address range of this function. This guess is wrong for
+// non-static function on Windows. This is probably because
+// `&CheckStackTrace` returns the address of a trampoline like PLT,
+// not the actual address of `CheckStackTrace`.
+// See https://github.com/google/glog/issues/421 for the detail.
+static
+#endif
+void ATTRIBUTE_NOINLINE CheckStackTrace(int i) {
+ INIT_ADDRESS_RANGE(CheckStackTrace, start, end, &expected_range[5]);
+ DECLARE_ADDRESS_LABEL(start);
+ for (int j = i; j >= 0; j--) {
+ CheckStackTrace1(j);
+ }
+ DECLARE_ADDRESS_LABEL(end);
+}
+
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
+
+//-----------------------------------------------------------------------//
+
+int main(int, char ** argv) {
+ FLAGS_logtostderr = true;
+ InitGoogleLogging(argv[0]);
+
+ CheckStackTrace(0);
+
+ printf("PASS\n");
+ return 0;
+}
+
+#else
+int main() {
+
+#ifdef GLOG_BAZEL_BUILD
+ printf("HAVE_STACKTRACE is expected to be defined in Bazel tests\n");
+ exit(EXIT_FAILURE);
+#endif // GLOG_BAZEL_BUILD
+
+ printf("PASS (no stacktrace support)\n");
+ return 0;
+}
+#endif // HAVE_STACKTRACE
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_unwind-inl.h b/funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_unwind-inl.h
new file mode 100644
index 0000000..3a4b4c5
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_unwind-inl.h
@@ -0,0 +1,106 @@
+// Copyright (c) 2005 - 2007, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Arun Sharma
+//
+// Produce stack trace using libgcc
+
+#include <unwind.h> // ABI defined unwinder
+
+#include <cstdlib> // for nullptr
+
+#include "stacktrace.h"
+
+_START_GOOGLE_NAMESPACE_
+
+struct trace_arg_t {
+ void **result;
+ int max_depth;
+ int skip_count;
+ int count;
+};
+
+// Workaround for the malloc() in _Unwind_Backtrace() issue.
+static _Unwind_Reason_Code nop_backtrace(struct _Unwind_Context */*uc*/, void */*opq*/) {
+ return _URC_NO_REASON;
+}
+
+
+// This code is not considered ready to run until
+// static initializers run so that we are guaranteed
+// that any malloc-related initialization is done.
+static bool ready_to_run = false;
+class StackTraceInit {
+ public:
+ StackTraceInit() {
+ // Extra call to force initialization
+ _Unwind_Backtrace(nop_backtrace, nullptr);
+ ready_to_run = true;
+ }
+};
+
+static StackTraceInit module_initializer; // Force initialization
+
+static _Unwind_Reason_Code GetOneFrame(struct _Unwind_Context *uc, void *opq) {
+ auto *targ = static_cast<trace_arg_t *>(opq);
+
+ if (targ->skip_count > 0) {
+ targ->skip_count--;
+ } else {
+ targ->result[targ->count++] = reinterpret_cast<void *>(_Unwind_GetIP(uc));
+ }
+
+ if (targ->count == targ->max_depth) {
+ return _URC_END_OF_STACK;
+ }
+
+ return _URC_NO_REASON;
+}
+
+// If you change this function, also change GetStackFrames below.
+int GetStackTrace(void** result, int max_depth, int skip_count) {
+ if (!ready_to_run) {
+ return 0;
+ }
+
+ trace_arg_t targ;
+
+ skip_count += 1; // Do not include the "GetStackTrace" frame
+
+ targ.result = result;
+ targ.max_depth = max_depth;
+ targ.skip_count = skip_count;
+ targ.count = 0;
+
+ _Unwind_Backtrace(GetOneFrame, &targ);
+
+ return targ.count;
+}
+
+_END_GOOGLE_NAMESPACE_
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_windows-inl.h b/funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_windows-inl.h
new file mode 100644
index 0000000..9c27664
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_windows-inl.h
@@ -0,0 +1,51 @@
+// Copyright (c) 2000 - 2007, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Andrew Schwartzmeyer
+//
+// Windows implementation - just use CaptureStackBackTrace
+
+#include "config.h"
+#include "port.h"
+#include "stacktrace.h"
+#include <dbghelp.h>
+
+_START_GOOGLE_NAMESPACE_
+
+int GetStackTrace(void** result, int max_depth, int skip_count) {
+ if (max_depth > 64) {
+ max_depth = 64;
+ }
+ skip_count++; // we want to skip the current frame as well
+ // This API is thread-safe (moreover it walks only the current thread).
+ return CaptureStackBackTrace(static_cast<DWORD>(skip_count),
+ static_cast<DWORD>(max_depth), result, nullptr);
+}
+
+_END_GOOGLE_NAMESPACE_
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_x86-inl.h b/funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_x86-inl.h
new file mode 100644
index 0000000..f7afe87
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/stacktrace_x86-inl.h
@@ -0,0 +1,159 @@
+// Copyright (c) 2000 - 2007, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Produce stack trace
+
+#include <cstdint> // for uintptr_t
+
+#include "utilities.h" // for OS_* macros
+
+#if !defined(GLOG_OS_WINDOWS)
+#include <unistd.h>
+#include <sys/mman.h>
+#endif
+
+#include <cstdio> // for nullptr
+
+#include "stacktrace.h"
+
+_START_GOOGLE_NAMESPACE_
+
+// Given a pointer to a stack frame, locate and return the calling
+// stackframe, or return nullptr if no stackframe can be found. Perform sanity
+// checks (the strictness of which is controlled by the boolean parameter
+// "STRICT_UNWINDING") to reduce the chance that a bad pointer is returned.
+template<bool STRICT_UNWINDING>
+static void **NextStackFrame(void **old_sp) {
+ void **new_sp = static_cast<void **>(*old_sp);
+
+ // Check that the transition from frame pointer old_sp to frame
+ // pointer new_sp isn't clearly bogus
+ if (STRICT_UNWINDING) {
+ // With the stack growing downwards, older stack frame must be
+ // at a greater address that the current one.
+ if (new_sp <= old_sp) return nullptr;
+ // Assume stack frames larger than 100,000 bytes are bogus.
+ if (reinterpret_cast<uintptr_t>(new_sp) -
+ reinterpret_cast<uintptr_t>(old_sp) >
+ 100000) {
+ return nullptr;
+ }
+ } else {
+ // In the non-strict mode, allow discontiguous stack frames.
+ // (alternate-signal-stacks for example).
+ if (new_sp == old_sp) return nullptr;
+ // And allow frames upto about 1MB.
+ if ((new_sp > old_sp) && (reinterpret_cast<uintptr_t>(new_sp) -
+ reinterpret_cast<uintptr_t>(old_sp) >
+ 1000000)) {
+ return nullptr;
+ }
+ }
+ if (reinterpret_cast<uintptr_t>(new_sp) & (sizeof(void *) - 1)) {
+ return nullptr;
+ }
+#ifdef __i386__
+ // On 64-bit machines, the stack pointer can be very close to
+ // 0xffffffff, so we explicitly check for a pointer into the
+ // last two pages in the address space
+ if ((uintptr_t)new_sp >= 0xffffe000) return nullptr;
+#endif
+#if !defined(GLOG_OS_WINDOWS)
+ if (!STRICT_UNWINDING) {
+ // Lax sanity checks cause a crash in 32-bit tcmalloc/crash_reason_test
+ // on AMD-based machines with VDSO-enabled kernels.
+ // Make an extra sanity check to insure new_sp is readable.
+ // Note: NextStackFrame<false>() is only called while the program
+ // is already on its last leg, so it's ok to be slow here.
+ static int page_size = getpagesize();
+ void *new_sp_aligned =
+ reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(new_sp) &
+ static_cast<uintptr_t>(~(page_size - 1)));
+ if (msync(new_sp_aligned, static_cast<size_t>(page_size), MS_ASYNC) == -1) {
+ return nullptr;
+ }
+ }
+#endif
+ return new_sp;
+}
+
+// If you change this function, also change GetStackFrames below.
+int GetStackTrace(void** result, int max_depth, int skip_count) {
+ void **sp;
+
+#ifdef __GNUC__
+#if __GNUC__ * 100 + __GNUC_MINOR__ >= 402
+#define USE_BUILTIN_FRAME_ADDRESS
+#endif
+#endif
+
+#ifdef USE_BUILTIN_FRAME_ADDRESS
+ sp = reinterpret_cast<void**>(__builtin_frame_address(0));
+#elif defined(__i386__)
+ // Stack frame format:
+ // sp[0] pointer to previous frame
+ // sp[1] caller address
+ // sp[2] first argument
+ // ...
+ sp = (void **)&result - 2;
+#elif defined(__x86_64__)
+ // __builtin_frame_address(0) can return the wrong address on gcc-4.1.0-k8
+ unsigned long rbp;
+ // Move the value of the register %rbp into the local variable rbp.
+ // We need 'volatile' to prevent this instruction from getting moved
+ // around during optimization to before function prologue is done.
+ // An alternative way to achieve this
+ // would be (before this __asm__ instruction) to call Noop() defined as
+ // static void Noop() __attribute__ ((noinline)); // prevent inlining
+ // static void Noop() { asm(""); } // prevent optimizing-away
+ __asm__ volatile ("mov %%rbp, %0" : "=r" (rbp));
+ // Arguments are passed in registers on x86-64, so we can't just
+ // offset from &result
+ sp = (void **) rbp;
+#endif
+
+ int n = 0;
+ while (sp && n < max_depth) {
+ if (*(sp + 1) == nullptr) {
+ // In 64-bit code, we often see a frame that
+ // points to itself and has a return address of 0.
+ break;
+ }
+ if (skip_count > 0) {
+ skip_count--;
+ } else {
+ result[n++] = *(sp+1);
+ }
+ // Use strict unwinding rules.
+ sp = NextStackFrame<true>(sp);
+ }
+ return n;
+}
+
+_END_GOOGLE_NAMESPACE_
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/stl_logging_unittest.cc b/funasr/runtime/onnxruntime/third_party/glog/src/stl_logging_unittest.cc
new file mode 100644
index 0000000..34daf8d
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/stl_logging_unittest.cc
@@ -0,0 +1,114 @@
+// Copyright (c) 2003, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include <glog/logging.h>
+#include <glog/stl_logging.h>
+
+#include <functional>
+#include <iostream>
+#include <map>
+#include <ostream>
+#include <string>
+#include <vector>
+
+#include "config.h"
+#include "googletest.h"
+
+using namespace std;
+
+struct user_hash {
+ size_t operator()(int x) const { return static_cast<size_t>(x); }
+};
+
+static void TestSTLLogging() {
+ {
+ // Test a sequence.
+ vector<int> v;
+ v.push_back(10);
+ v.push_back(20);
+ v.push_back(30);
+ ostringstream ss;
+ ss << v;
+ EXPECT_EQ(ss.str(), "10 20 30");
+ vector<int> copied_v(v);
+ CHECK_EQ(v, copied_v); // This must compile.
+ }
+
+ {
+ // Test a sorted pair associative container.
+ map< int, string > m;
+ m[20] = "twenty";
+ m[10] = "ten";
+ m[30] = "thirty";
+ ostringstream ss;
+ ss << m;
+ EXPECT_EQ(ss.str(), "(10, ten) (20, twenty) (30, thirty)");
+ map< int, string > copied_m(m);
+ CHECK_EQ(m, copied_m); // This must compile.
+ }
+
+ {
+ // Test a long sequence.
+ vector<int> v;
+ string expected;
+ for (int i = 0; i < 100; i++) {
+ v.push_back(i);
+ if (i > 0) expected += ' ';
+ const size_t buf_size = 256;
+ char buf[buf_size];
+ snprintf(buf, buf_size, "%d", i);
+ expected += buf;
+ }
+ v.push_back(100);
+ expected += " ...";
+ ostringstream ss;
+ ss << v;
+ CHECK_EQ(ss.str(), expected.c_str());
+ }
+
+ {
+ // Test a sorted pair associative container.
+ // Use a non-default comparison functor.
+ map<int, string, greater<> > m;
+ m[20] = "twenty";
+ m[10] = "ten";
+ m[30] = "thirty";
+ ostringstream ss;
+ ss << m;
+ EXPECT_EQ(ss.str(), "(30, thirty) (20, twenty) (10, ten)");
+ map<int, string, greater<> > copied_m(m);
+ CHECK_EQ(m, copied_m); // This must compile.
+ }
+}
+
+int main(int, char**) {
+ TestSTLLogging();
+ std::cout << "PASS\n";
+ return 0;
+}
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/symbolize.cc b/funasr/runtime/onnxruntime/third_party/glog/src/symbolize.cc
new file mode 100644
index 0000000..f95fccc
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/symbolize.cc
@@ -0,0 +1,956 @@
+// Copyright (c) 2006, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Satoru Takabayashi
+// Stack-footprint reduction work done by Raksit Ashok
+//
+// Implementation note:
+//
+// We don't use heaps but only use stacks. We want to reduce the
+// stack consumption so that the symbolizer can run on small stacks.
+//
+// Here are some numbers collected with GCC 4.1.0 on x86:
+// - sizeof(Elf32_Sym) = 16
+// - sizeof(Elf32_Shdr) = 40
+// - sizeof(Elf64_Sym) = 24
+// - sizeof(Elf64_Shdr) = 64
+//
+// This implementation is intended to be async-signal-safe but uses
+// some functions which are not guaranteed to be so, such as memchr()
+// and memmove(). We assume they are async-signal-safe.
+//
+// Additional header can be specified by the GLOG_BUILD_CONFIG_INCLUDE
+// macro to add platform specific defines (e.g. GLOG_OS_OPENBSD).
+
+#ifdef GLOG_BUILD_CONFIG_INCLUDE
+#include GLOG_BUILD_CONFIG_INCLUDE
+#endif // GLOG_BUILD_CONFIG_INCLUDE
+
+#include "utilities.h"
+
+#if defined(HAVE_SYMBOLIZE)
+
+#include <cstring>
+
+#include <algorithm>
+#include <limits>
+
+#include "symbolize.h"
+#include "demangle.h"
+
+_START_GOOGLE_NAMESPACE_
+
+// We don't use assert() since it's not guaranteed to be
+// async-signal-safe. Instead we define a minimal assertion
+// macro. So far, we don't need pretty printing for __FILE__, etc.
+
+// A wrapper for abort() to make it callable in ? :.
+static int AssertFail() {
+ abort();
+ return 0; // Should not reach.
+}
+
+#define SAFE_ASSERT(expr) ((expr) ? 0 : AssertFail())
+
+static SymbolizeCallback g_symbolize_callback = nullptr;
+void InstallSymbolizeCallback(SymbolizeCallback callback) {
+ g_symbolize_callback = callback;
+}
+
+static SymbolizeOpenObjectFileCallback g_symbolize_open_object_file_callback =
+ nullptr;
+void InstallSymbolizeOpenObjectFileCallback(
+ SymbolizeOpenObjectFileCallback callback) {
+ g_symbolize_open_object_file_callback = callback;
+}
+
+// This function wraps the Demangle function to provide an interface
+// where the input symbol is demangled in-place.
+// To keep stack consumption low, we would like this function to not
+// get inlined.
+static ATTRIBUTE_NOINLINE void DemangleInplace(char *out, size_t out_size) {
+ char demangled[256]; // Big enough for sane demangled symbols.
+ if (Demangle(out, demangled, sizeof(demangled))) {
+ // Demangling succeeded. Copy to out if the space allows.
+ size_t len = strlen(demangled);
+ if (len + 1 <= out_size) { // +1 for '\0'.
+ SAFE_ASSERT(len < sizeof(demangled));
+ memmove(out, demangled, len + 1);
+ }
+ }
+}
+
+_END_GOOGLE_NAMESPACE_
+
+#if defined(__ELF__)
+
+#if defined(HAVE_DLFCN_H)
+#include <dlfcn.h>
+#endif
+#if defined(GLOG_OS_OPENBSD)
+#include <sys/exec_elf.h>
+#else
+#include <elf.h>
+#endif
+#include <fcntl.h>
+#include <glog/raw_logging.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <cerrno>
+#include <climits>
+#include <cstddef>
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+
+#include "config.h"
+#include "symbolize.h"
+
+// Re-runs fn until it doesn't cause EINTR.
+#define NO_INTR(fn) do {} while ((fn) < 0 && errno == EINTR)
+
+_START_GOOGLE_NAMESPACE_
+
+// Read up to "count" bytes from "offset" in the file pointed by file
+// descriptor "fd" into the buffer starting at "buf" while handling short reads
+// and EINTR. On success, return the number of bytes read. Otherwise, return
+// -1.
+static ssize_t ReadFromOffset(const int fd, void *buf, const size_t count,
+ const size_t offset) {
+ SAFE_ASSERT(fd >= 0);
+ SAFE_ASSERT(count <= static_cast<size_t>(std::numeric_limits<ssize_t>::max()));
+ char *buf0 = reinterpret_cast<char *>(buf);
+ size_t num_bytes = 0;
+ while (num_bytes < count) {
+ ssize_t len;
+ NO_INTR(len = pread(fd, buf0 + num_bytes, count - num_bytes,
+ static_cast<off_t>(offset + num_bytes)));
+ if (len < 0) { // There was an error other than EINTR.
+ return -1;
+ }
+ if (len == 0) { // Reached EOF.
+ break;
+ }
+ num_bytes += static_cast<size_t>(len);
+ }
+ SAFE_ASSERT(num_bytes <= count);
+ return static_cast<ssize_t>(num_bytes);
+}
+
+// Try reading exactly "count" bytes from "offset" bytes in a file
+// pointed by "fd" into the buffer starting at "buf" while handling
+// short reads and EINTR. On success, return true. Otherwise, return
+// false.
+static bool ReadFromOffsetExact(const int fd, void *buf,
+ const size_t count, const size_t offset) {
+ ssize_t len = ReadFromOffset(fd, buf, count, offset);
+ return static_cast<size_t>(len) == count;
+}
+
+// Returns elf_header.e_type if the file pointed by fd is an ELF binary.
+static int FileGetElfType(const int fd) {
+ ElfW(Ehdr) elf_header;
+ if (!ReadFromOffsetExact(fd, &elf_header, sizeof(elf_header), 0)) {
+ return -1;
+ }
+ if (memcmp(elf_header.e_ident, ELFMAG, SELFMAG) != 0) {
+ return -1;
+ }
+ return elf_header.e_type;
+}
+
+// Read the section headers in the given ELF binary, and if a section
+// of the specified type is found, set the output to this section header
+// and return true. Otherwise, return false.
+// To keep stack consumption low, we would like this function to not get
+// inlined.
+static ATTRIBUTE_NOINLINE bool
+GetSectionHeaderByType(const int fd, ElfW(Half) sh_num, const size_t sh_offset,
+ ElfW(Word) type, ElfW(Shdr) *out) {
+ // Read at most 16 section headers at a time to save read calls.
+ ElfW(Shdr) buf[16];
+ for (size_t i = 0; i < sh_num;) {
+ const size_t num_bytes_left = (sh_num - i) * sizeof(buf[0]);
+ const size_t num_bytes_to_read =
+ (sizeof(buf) > num_bytes_left) ? num_bytes_left : sizeof(buf);
+ const ssize_t len = ReadFromOffset(fd, buf, num_bytes_to_read,
+ sh_offset + i * sizeof(buf[0]));
+ if (len == -1) {
+ return false;
+ }
+ SAFE_ASSERT(static_cast<size_t>(len) % sizeof(buf[0]) == 0);
+ const size_t num_headers_in_buf = static_cast<size_t>(len) / sizeof(buf[0]);
+ SAFE_ASSERT(num_headers_in_buf <= sizeof(buf) / sizeof(buf[0]));
+ for (size_t j = 0; j < num_headers_in_buf; ++j) {
+ if (buf[j].sh_type == type) {
+ *out = buf[j];
+ return true;
+ }
+ }
+ i += num_headers_in_buf;
+ }
+ return false;
+}
+
+// There is no particular reason to limit section name to 63 characters,
+// but there has (as yet) been no need for anything longer either.
+const int kMaxSectionNameLen = 64;
+
+// name_len should include terminating '\0'.
+bool GetSectionHeaderByName(int fd, const char *name, size_t name_len,
+ ElfW(Shdr) *out) {
+ ElfW(Ehdr) elf_header;
+ if (!ReadFromOffsetExact(fd, &elf_header, sizeof(elf_header), 0)) {
+ return false;
+ }
+
+ ElfW(Shdr) shstrtab;
+ size_t shstrtab_offset =
+ (elf_header.e_shoff + static_cast<size_t>(elf_header.e_shentsize) *
+ static_cast<size_t>(elf_header.e_shstrndx));
+ if (!ReadFromOffsetExact(fd, &shstrtab, sizeof(shstrtab), shstrtab_offset)) {
+ return false;
+ }
+
+ for (size_t i = 0; i < elf_header.e_shnum; ++i) {
+ size_t section_header_offset = (elf_header.e_shoff +
+ elf_header.e_shentsize * i);
+ if (!ReadFromOffsetExact(fd, out, sizeof(*out), section_header_offset)) {
+ return false;
+ }
+ char header_name[kMaxSectionNameLen];
+ if (sizeof(header_name) < name_len) {
+ RAW_LOG(WARNING, "Section name '%s' is too long (%" PRIuS "); "
+ "section will not be found (even if present).", name, name_len);
+ // No point in even trying.
+ return false;
+ }
+ size_t name_offset = shstrtab.sh_offset + out->sh_name;
+ ssize_t n_read = ReadFromOffset(fd, &header_name, name_len, name_offset);
+ if (n_read == -1) {
+ return false;
+ } else if (static_cast<size_t>(n_read) != name_len) {
+ // Short read -- name could be at end of file.
+ continue;
+ }
+ if (memcmp(header_name, name, name_len) == 0) {
+ return true;
+ }
+ }
+ return false;
+}
+
+// Read a symbol table and look for the symbol containing the
+// pc. Iterate over symbols in a symbol table and look for the symbol
+// containing "pc". On success, return true and write the symbol name
+// to out. Otherwise, return false.
+// To keep stack consumption low, we would like this function to not get
+// inlined.
+static ATTRIBUTE_NOINLINE bool
+FindSymbol(uint64_t pc, const int fd, char *out, size_t out_size,
+ uint64_t symbol_offset, const ElfW(Shdr) *strtab,
+ const ElfW(Shdr) *symtab) {
+ if (symtab == nullptr) {
+ return false;
+ }
+ const size_t num_symbols = symtab->sh_size / symtab->sh_entsize;
+ for (unsigned i = 0; i < num_symbols;) {
+ size_t offset = symtab->sh_offset + i * symtab->sh_entsize;
+
+ // If we are reading Elf64_Sym's, we want to limit this array to
+ // 32 elements (to keep stack consumption low), otherwise we can
+ // have a 64 element Elf32_Sym array.
+#if defined(__WORDSIZE) && __WORDSIZE == 64
+ const size_t NUM_SYMBOLS = 32U;
+#else
+ const size_t NUM_SYMBOLS = 64U;
+#endif
+
+ // Read at most NUM_SYMBOLS symbols at once to save read() calls.
+ ElfW(Sym) buf[NUM_SYMBOLS];
+ size_t num_symbols_to_read = std::min(NUM_SYMBOLS, num_symbols - i);
+ const ssize_t len =
+ ReadFromOffset(fd, &buf, sizeof(buf[0]) * num_symbols_to_read, offset);
+ SAFE_ASSERT(static_cast<size_t>(len) % sizeof(buf[0]) == 0);
+ const size_t num_symbols_in_buf = static_cast<size_t>(len) / sizeof(buf[0]);
+ SAFE_ASSERT(num_symbols_in_buf <= num_symbols_to_read);
+ for (unsigned j = 0; j < num_symbols_in_buf; ++j) {
+ const ElfW(Sym)& symbol = buf[j];
+ uint64_t start_address = symbol.st_value;
+ start_address += symbol_offset;
+ uint64_t end_address = start_address + symbol.st_size;
+ if (symbol.st_value != 0 && // Skip null value symbols.
+ symbol.st_shndx != 0 && // Skip undefined symbols.
+ start_address <= pc && pc < end_address) {
+ ssize_t len1 = ReadFromOffset(fd, out, out_size,
+ strtab->sh_offset + symbol.st_name);
+ if (len1 <= 0 || memchr(out, '\0', out_size) == nullptr) {
+ memset(out, 0, out_size);
+ return false;
+ }
+ return true; // Obtained the symbol name.
+ }
+ }
+ i += num_symbols_in_buf;
+ }
+ return false;
+}
+
+// Get the symbol name of "pc" from the file pointed by "fd". Process
+// both regular and dynamic symbol tables if necessary. On success,
+// write the symbol name to "out" and return true. Otherwise, return
+// false.
+static bool GetSymbolFromObjectFile(const int fd,
+ uint64_t pc,
+ char* out,
+ size_t out_size,
+ uint64_t base_address) {
+ // Read the ELF header.
+ ElfW(Ehdr) elf_header;
+ if (!ReadFromOffsetExact(fd, &elf_header, sizeof(elf_header), 0)) {
+ return false;
+ }
+
+ ElfW(Shdr) symtab, strtab;
+
+ // Consult a regular symbol table first.
+ if (GetSectionHeaderByType(fd, elf_header.e_shnum, elf_header.e_shoff,
+ SHT_SYMTAB, &symtab)) {
+ if (!ReadFromOffsetExact(fd, &strtab, sizeof(strtab), elf_header.e_shoff +
+ symtab.sh_link * sizeof(symtab))) {
+ return false;
+ }
+ if (FindSymbol(pc, fd, out, out_size, base_address, &strtab, &symtab)) {
+ return true; // Found the symbol in a regular symbol table.
+ }
+ }
+
+ // If the symbol is not found, then consult a dynamic symbol table.
+ if (GetSectionHeaderByType(fd, elf_header.e_shnum, elf_header.e_shoff,
+ SHT_DYNSYM, &symtab)) {
+ if (!ReadFromOffsetExact(fd, &strtab, sizeof(strtab), elf_header.e_shoff +
+ symtab.sh_link * sizeof(symtab))) {
+ return false;
+ }
+ if (FindSymbol(pc, fd, out, out_size, base_address, &strtab, &symtab)) {
+ return true; // Found the symbol in a dynamic symbol table.
+ }
+ }
+
+ return false;
+}
+
+namespace {
+// Thin wrapper around a file descriptor so that the file descriptor
+// gets closed for sure.
+struct FileDescriptor {
+ const int fd_;
+ explicit FileDescriptor(int fd) : fd_(fd) {}
+ ~FileDescriptor() {
+ if (fd_ >= 0) {
+ close(fd_);
+ }
+ }
+ int get() { return fd_; }
+
+ private:
+ FileDescriptor(const FileDescriptor &) = delete;
+ void operator=(const FileDescriptor &) = delete;
+};
+
+// Helper class for reading lines from file.
+//
+// Note: we don't use ProcMapsIterator since the object is big (it has
+// a 5k array member) and uses async-unsafe functions such as sscanf()
+// and snprintf().
+class LineReader {
+ public:
+ explicit LineReader(int fd, char *buf, size_t buf_len, size_t offset)
+ : fd_(fd),
+ buf_(buf),
+ buf_len_(buf_len),
+ offset_(offset),
+ bol_(buf),
+ eol_(buf),
+ eod_(buf) {}
+
+ // Read '\n'-terminated line from file. On success, modify "bol"
+ // and "eol", then return true. Otherwise, return false.
+ //
+ // Note: if the last line doesn't end with '\n', the line will be
+ // dropped. It's an intentional behavior to make the code simple.
+ bool ReadLine(const char **bol, const char **eol) {
+ if (BufferIsEmpty()) { // First time.
+ const ssize_t num_bytes = ReadFromOffset(fd_, buf_, buf_len_, offset_);
+ if (num_bytes <= 0) { // EOF or error.
+ return false;
+ }
+ offset_ += static_cast<size_t>(num_bytes);
+ eod_ = buf_ + num_bytes;
+ bol_ = buf_;
+ } else {
+ bol_ = eol_ + 1; // Advance to the next line in the buffer.
+ SAFE_ASSERT(bol_ <= eod_); // "bol_" can point to "eod_".
+ if (!HasCompleteLine()) {
+ const auto incomplete_line_length = static_cast<size_t>(eod_ - bol_);
+ // Move the trailing incomplete line to the beginning.
+ memmove(buf_, bol_, incomplete_line_length);
+ // Read text from file and append it.
+ char * const append_pos = buf_ + incomplete_line_length;
+ const size_t capacity_left = buf_len_ - incomplete_line_length;
+ const ssize_t num_bytes =
+ ReadFromOffset(fd_, append_pos, capacity_left, offset_);
+ if (num_bytes <= 0) { // EOF or error.
+ return false;
+ }
+ offset_ += static_cast<size_t>(num_bytes);
+ eod_ = append_pos + num_bytes;
+ bol_ = buf_;
+ }
+ }
+ eol_ = FindLineFeed();
+ if (eol_ == nullptr) { // '\n' not found. Malformed line.
+ return false;
+ }
+ *eol_ = '\0'; // Replace '\n' with '\0'.
+
+ *bol = bol_;
+ *eol = eol_;
+ return true;
+ }
+
+ // Beginning of line.
+ const char *bol() {
+ return bol_;
+ }
+
+ // End of line.
+ const char *eol() {
+ return eol_;
+ }
+
+ private:
+ LineReader(const LineReader &) = delete;
+ void operator=(const LineReader &) = delete;
+
+ char *FindLineFeed() {
+ return reinterpret_cast<char *>(memchr(bol_, '\n', static_cast<size_t>(eod_ - bol_)));
+ }
+
+ bool BufferIsEmpty() {
+ return buf_ == eod_;
+ }
+
+ bool HasCompleteLine() {
+ return !BufferIsEmpty() && FindLineFeed() != nullptr;
+ }
+
+ const int fd_;
+ char * const buf_;
+ const size_t buf_len_;
+ size_t offset_;
+ char *bol_;
+ char *eol_;
+ const char *eod_; // End of data in "buf_".
+};
+} // namespace
+
+// Place the hex number read from "start" into "*hex". The pointer to
+// the first non-hex character or "end" is returned.
+static char *GetHex(const char *start, const char *end, uint64_t *hex) {
+ *hex = 0;
+ const char *p;
+ for (p = start; p < end; ++p) {
+ int ch = *p;
+ if ((ch >= '0' && ch <= '9') ||
+ (ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f')) {
+ *hex = (*hex << 4U) | (ch < 'A' ? static_cast<uint64_t>(ch - '0') : (ch & 0xF) + 9U);
+ } else { // Encountered the first non-hex character.
+ break;
+ }
+ }
+ SAFE_ASSERT(p <= end);
+ return const_cast<char *>(p);
+}
+
+// Searches for the object file (from /proc/self/maps) that contains
+// the specified pc. If found, sets |start_address| to the start address
+// of where this object file is mapped in memory, sets the module base
+// address into |base_address|, copies the object file name into
+// |out_file_name|, and attempts to open the object file. If the object
+// file is opened successfully, returns the file descriptor. Otherwise,
+// returns -1. |out_file_name_size| is the size of the file name buffer
+// (including the null-terminator).
+static ATTRIBUTE_NOINLINE int
+OpenObjectFileContainingPcAndGetStartAddress(uint64_t pc,
+ uint64_t &start_address,
+ uint64_t &base_address,
+ char *out_file_name,
+ size_t out_file_name_size) {
+ int object_fd;
+
+ int maps_fd;
+ NO_INTR(maps_fd = open("/proc/self/maps", O_RDONLY));
+ FileDescriptor wrapped_maps_fd(maps_fd);
+ if (wrapped_maps_fd.get() < 0) {
+ return -1;
+ }
+
+ int mem_fd;
+ NO_INTR(mem_fd = open("/proc/self/mem", O_RDONLY));
+ FileDescriptor wrapped_mem_fd(mem_fd);
+ if (wrapped_mem_fd.get() < 0) {
+ return -1;
+ }
+
+ // Iterate over maps and look for the map containing the pc. Then
+ // look into the symbol tables inside.
+ char buf[1024]; // Big enough for line of sane /proc/self/maps
+ unsigned num_maps = 0;
+ LineReader reader(wrapped_maps_fd.get(), buf, sizeof(buf), 0);
+ while (true) {
+ num_maps++;
+ const char *cursor;
+ const char *eol;
+ if (!reader.ReadLine(&cursor, &eol)) { // EOF or malformed line.
+ return -1;
+ }
+
+ // Start parsing line in /proc/self/maps. Here is an example:
+ //
+ // 08048000-0804c000 r-xp 00000000 08:01 2142121 /bin/cat
+ //
+ // We want start address (08048000), end address (0804c000), flags
+ // (r-xp) and file name (/bin/cat).
+
+ // Read start address.
+ cursor = GetHex(cursor, eol, &start_address);
+ if (cursor == eol || *cursor != '-') {
+ return -1; // Malformed line.
+ }
+ ++cursor; // Skip '-'.
+
+ // Read end address.
+ uint64_t end_address;
+ cursor = GetHex(cursor, eol, &end_address);
+ if (cursor == eol || *cursor != ' ') {
+ return -1; // Malformed line.
+ }
+ ++cursor; // Skip ' '.
+
+ // Read flags. Skip flags until we encounter a space or eol.
+ const char * const flags_start = cursor;
+ while (cursor < eol && *cursor != ' ') {
+ ++cursor;
+ }
+ // We expect at least four letters for flags (ex. "r-xp").
+ if (cursor == eol || cursor < flags_start + 4) {
+ return -1; // Malformed line.
+ }
+
+ // Determine the base address by reading ELF headers in process memory.
+ ElfW(Ehdr) ehdr;
+ // Skip non-readable maps.
+ if (flags_start[0] == 'r' &&
+ ReadFromOffsetExact(mem_fd, &ehdr, sizeof(ElfW(Ehdr)), start_address) &&
+ memcmp(ehdr.e_ident, ELFMAG, SELFMAG) == 0) {
+ switch (ehdr.e_type) {
+ case ET_EXEC:
+ base_address = 0;
+ break;
+ case ET_DYN:
+ // Find the segment containing file offset 0. This will correspond
+ // to the ELF header that we just read. Normally this will have
+ // virtual address 0, but this is not guaranteed. We must subtract
+ // the virtual address from the address where the ELF header was
+ // mapped to get the base address.
+ //
+ // If we fail to find a segment for file offset 0, use the address
+ // of the ELF header as the base address.
+ base_address = start_address;
+ for (unsigned i = 0; i != ehdr.e_phnum; ++i) {
+ ElfW(Phdr) phdr;
+ if (ReadFromOffsetExact(
+ mem_fd, &phdr, sizeof(phdr),
+ start_address + ehdr.e_phoff + i * sizeof(phdr)) &&
+ phdr.p_type == PT_LOAD && phdr.p_offset == 0) {
+ base_address = start_address - phdr.p_vaddr;
+ break;
+ }
+ }
+ break;
+ default:
+ // ET_REL or ET_CORE. These aren't directly executable, so they don't
+ // affect the base address.
+ break;
+ }
+ }
+
+ // Check start and end addresses.
+ if (!(start_address <= pc && pc < end_address)) {
+ continue; // We skip this map. PC isn't in this map.
+ }
+
+ // Check flags. We are only interested in "r*x" maps.
+ if (flags_start[0] != 'r' || flags_start[2] != 'x') {
+ continue; // We skip this map.
+ }
+ ++cursor; // Skip ' '.
+
+ // Read file offset.
+ uint64_t file_offset;
+ cursor = GetHex(cursor, eol, &file_offset);
+ if (cursor == eol || *cursor != ' ') {
+ return -1; // Malformed line.
+ }
+ ++cursor; // Skip ' '.
+
+ // Skip to file name. "cursor" now points to dev. We need to
+ // skip at least two spaces for dev and inode.
+ int num_spaces = 0;
+ while (cursor < eol) {
+ if (*cursor == ' ') {
+ ++num_spaces;
+ } else if (num_spaces >= 2) {
+ // The first non-space character after skipping two spaces
+ // is the beginning of the file name.
+ break;
+ }
+ ++cursor;
+ }
+ if (cursor == eol) {
+ return -1; // Malformed line.
+ }
+
+ // Finally, "cursor" now points to file name of our interest.
+ NO_INTR(object_fd = open(cursor, O_RDONLY));
+ if (object_fd < 0) {
+ // Failed to open object file. Copy the object file name to
+ // |out_file_name|.
+ strncpy(out_file_name, cursor, out_file_name_size);
+ // Making sure |out_file_name| is always null-terminated.
+ out_file_name[out_file_name_size - 1] = '\0';
+ return -1;
+ }
+ return object_fd;
+ }
+}
+
+// POSIX doesn't define any async-signal safe function for converting
+// an integer to ASCII. We'll have to define our own version.
+// itoa_r() converts an (unsigned) integer to ASCII. It returns "buf", if the
+// conversion was successful or nullptr otherwise. It never writes more than
+// "sz" bytes. Output will be truncated as needed, and a NUL character is always
+// appended.
+// NOTE: code from sandbox/linux/seccomp-bpf/demo.cc.
+static char *itoa_r(uintptr_t i, char *buf, size_t sz, unsigned base, size_t padding) {
+ // Make sure we can write at least one NUL byte.
+ size_t n = 1;
+ if (n > sz) {
+ return nullptr;
+ }
+
+ if (base < 2 || base > 16) {
+ buf[0] = '\000';
+ return nullptr;
+ }
+
+ char *start = buf;
+
+ // Loop until we have converted the entire number. Output at least one
+ // character (i.e. '0').
+ char *ptr = start;
+ do {
+ // Make sure there is still enough space left in our output buffer.
+ if (++n > sz) {
+ buf[0] = '\000';
+ return nullptr;
+ }
+
+ // Output the next digit.
+ *ptr++ = "0123456789abcdef"[i % base];
+ i /= base;
+
+ if (padding > 0) {
+ padding--;
+ }
+ } while (i > 0 || padding > 0);
+
+ // Terminate the output with a NUL character.
+ *ptr = '\000';
+
+ // Conversion to ASCII actually resulted in the digits being in reverse
+ // order. We can't easily generate them in forward order, as we can't tell
+ // the number of characters needed until we are done converting.
+ // So, now, we reverse the string (except for the possible "-" sign).
+ while (--ptr > start) {
+ char ch = *ptr;
+ *ptr = *start;
+ *start++ = ch;
+ }
+ return buf;
+}
+
+// Safely appends string |source| to string |dest|. Never writes past the
+// buffer size |dest_size| and guarantees that |dest| is null-terminated.
+static void SafeAppendString(const char* source, char* dest, size_t dest_size) {
+ size_t dest_string_length = strlen(dest);
+ SAFE_ASSERT(dest_string_length < dest_size);
+ dest += dest_string_length;
+ dest_size -= dest_string_length;
+ strncpy(dest, source, dest_size);
+ // Making sure |dest| is always null-terminated.
+ dest[dest_size - 1] = '\0';
+}
+
+// Converts a 64-bit value into a hex string, and safely appends it to |dest|.
+// Never writes past the buffer size |dest_size| and guarantees that |dest| is
+// null-terminated.
+static void SafeAppendHexNumber(uint64_t value, char* dest, size_t dest_size) {
+ // 64-bit numbers in hex can have up to 16 digits.
+ char buf[17] = {'\0'};
+ SafeAppendString(itoa_r(value, buf, sizeof(buf), 16, 0), dest, dest_size);
+}
+
+// The implementation of our symbolization routine. If it
+// successfully finds the symbol containing "pc" and obtains the
+// symbol name, returns true and write the symbol name to "out".
+// Otherwise, returns false. If Callback function is installed via
+// InstallSymbolizeCallback(), the function is also called in this function,
+// and "out" is used as its output.
+// To keep stack consumption low, we would like this function to not
+// get inlined.
+static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void *pc, char *out,
+ size_t out_size) {
+ auto pc0 = reinterpret_cast<uintptr_t>(pc);
+ uint64_t start_address = 0;
+ uint64_t base_address = 0;
+ int object_fd = -1;
+
+ if (out_size < 1) {
+ return false;
+ }
+ out[0] = '\0';
+ SafeAppendString("(", out, out_size);
+
+ if (g_symbolize_open_object_file_callback) {
+ object_fd = g_symbolize_open_object_file_callback(pc0, start_address,
+ base_address, out + 1,
+ out_size - 1);
+ } else {
+ object_fd = OpenObjectFileContainingPcAndGetStartAddress(pc0, start_address,
+ base_address,
+ out + 1,
+ out_size - 1);
+ }
+
+ FileDescriptor wrapped_object_fd(object_fd);
+
+#if defined(PRINT_UNSYMBOLIZED_STACK_TRACES)
+ {
+#else
+ // Check whether a file name was returned.
+ if (object_fd < 0) {
+#endif
+ if (out[1]) {
+ // The object file containing PC was determined successfully however the
+ // object file was not opened successfully. This is still considered
+ // success because the object file name and offset are known and tools
+ // like asan_symbolize.py can be used for the symbolization.
+ out[out_size - 1] = '\0'; // Making sure |out| is always null-terminated.
+ SafeAppendString("+0x", out, out_size);
+ SafeAppendHexNumber(pc0 - base_address, out, out_size);
+ SafeAppendString(")", out, out_size);
+ return true;
+ }
+ // Failed to determine the object file containing PC. Bail out.
+ return false;
+ }
+ int elf_type = FileGetElfType(wrapped_object_fd.get());
+ if (elf_type == -1) {
+ return false;
+ }
+ if (g_symbolize_callback) {
+ // Run the call back if it's installed.
+ // Note: relocation (and much of the rest of this code) will be
+ // wrong for prelinked shared libraries and PIE executables.
+ uint64_t relocation = (elf_type == ET_DYN) ? start_address : 0;
+ int num_bytes_written = g_symbolize_callback(wrapped_object_fd.get(),
+ pc, out, out_size,
+ relocation);
+ if (num_bytes_written > 0) {
+ out += static_cast<size_t>(num_bytes_written);
+ out_size -= static_cast<size_t>(num_bytes_written);
+ }
+ }
+ if (!GetSymbolFromObjectFile(wrapped_object_fd.get(), pc0,
+ out, out_size, base_address)) {
+ if (out[1] && !g_symbolize_callback) {
+ // The object file containing PC was opened successfully however the
+ // symbol was not found. The object may have been stripped. This is still
+ // considered success because the object file name and offset are known
+ // and tools like asan_symbolize.py can be used for the symbolization.
+ out[out_size - 1] = '\0'; // Making sure |out| is always null-terminated.
+ SafeAppendString("+0x", out, out_size);
+ SafeAppendHexNumber(pc0 - base_address, out, out_size);
+ SafeAppendString(")", out, out_size);
+ return true;
+ }
+ return false;
+ }
+
+ // Symbolization succeeded. Now we try to demangle the symbol.
+ DemangleInplace(out, out_size);
+ return true;
+}
+
+_END_GOOGLE_NAMESPACE_
+
+#elif defined(GLOG_OS_MACOSX) && defined(HAVE_DLADDR)
+
+#include <dlfcn.h>
+#include <cstring>
+
+_START_GOOGLE_NAMESPACE_
+
+static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void *pc, char *out,
+ size_t out_size) {
+ Dl_info info;
+ if (dladdr(pc, &info)) {
+ if (info.dli_sname) {
+ if (strlen(info.dli_sname) < out_size) {
+ strcpy(out, info.dli_sname);
+ // Symbolization succeeded. Now we try to demangle the symbol.
+ DemangleInplace(out, out_size);
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+_END_GOOGLE_NAMESPACE_
+
+#elif defined(GLOG_OS_WINDOWS) || defined(GLOG_OS_CYGWIN)
+
+#include <windows.h>
+#include <dbghelp.h>
+
+#ifdef _MSC_VER
+#pragma comment(lib, "dbghelp")
+#endif
+
+_START_GOOGLE_NAMESPACE_
+
+class SymInitializer {
+public:
+ HANDLE process;
+ bool ready;
+ SymInitializer() : process(nullptr), ready(false) {
+ // Initialize the symbol handler.
+ // https://msdn.microsoft.com/en-us/library/windows/desktop/ms680344(v=vs.85).aspx
+ process = GetCurrentProcess();
+ // Defer symbol loading.
+ // We do not request undecorated symbols with SYMOPT_UNDNAME
+ // because the mangling library calls UnDecorateSymbolName.
+ SymSetOptions(SYMOPT_DEFERRED_LOADS);
+ if (SymInitialize(process, nullptr, true)) {
+ ready = true;
+ }
+ }
+ ~SymInitializer() {
+ SymCleanup(process);
+ // We do not need to close `HANDLE process` because it's a "pseudo handle."
+ }
+private:
+ SymInitializer(const SymInitializer&);
+ SymInitializer& operator=(const SymInitializer&);
+};
+
+static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void *pc, char *out,
+ size_t out_size) {
+ const static SymInitializer symInitializer;
+ if (!symInitializer.ready) {
+ return false;
+ }
+ // Resolve symbol information from address.
+ // https://msdn.microsoft.com/en-us/library/windows/desktop/ms680578(v=vs.85).aspx
+ char buf[sizeof(SYMBOL_INFO) + MAX_SYM_NAME];
+ SYMBOL_INFO *symbol = reinterpret_cast<SYMBOL_INFO *>(buf);
+ symbol->SizeOfStruct = sizeof(SYMBOL_INFO);
+ symbol->MaxNameLen = MAX_SYM_NAME;
+ // We use the ANSI version to ensure the string type is always `char *`.
+ // This could break if a symbol has Unicode in it.
+ BOOL ret = SymFromAddr(symInitializer.process,
+ reinterpret_cast<DWORD64>(pc), 0, symbol);
+ if (ret == 1 && static_cast<ssize_t>(symbol->NameLen) < out_size) {
+ // `NameLen` does not include the null terminating character.
+ strncpy(out, symbol->Name, static_cast<size_t>(symbol->NameLen) + 1);
+ out[static_cast<size_t>(symbol->NameLen)] = '\0';
+ // Symbolization succeeded. Now we try to demangle the symbol.
+ DemangleInplace(out, out_size);
+ return true;
+ }
+ return false;
+}
+
+_END_GOOGLE_NAMESPACE_
+
+#else
+# error BUG: HAVE_SYMBOLIZE was wrongly set
+#endif
+
+_START_GOOGLE_NAMESPACE_
+
+bool Symbolize(void *pc, char *out, size_t out_size) {
+ return SymbolizeAndDemangle(pc, out, out_size);
+}
+
+_END_GOOGLE_NAMESPACE_
+
+#else /* HAVE_SYMBOLIZE */
+
+#include <cassert>
+
+#include "config.h"
+
+_START_GOOGLE_NAMESPACE_
+
+// TODO: Support other environments.
+bool Symbolize(void* /*pc*/, char* /*out*/, size_t /*out_size*/) {
+ assert(0);
+ return false;
+}
+
+_END_GOOGLE_NAMESPACE_
+
+#endif
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/symbolize.h b/funasr/runtime/onnxruntime/third_party/glog/src/symbolize.h
new file mode 100644
index 0000000..86c22e3
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/symbolize.h
@@ -0,0 +1,152 @@
+// Copyright (c) 2006, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Satoru Takabayashi
+//
+// This library provides Symbolize() function that symbolizes program
+// counters to their corresponding symbol names on linux platforms.
+// This library has a minimal implementation of an ELF symbol table
+// reader (i.e. it doesn't depend on libelf, etc.).
+//
+// The algorithm used in Symbolize() is as follows.
+//
+// 1. Go through a list of maps in /proc/self/maps and find the map
+// containing the program counter.
+//
+// 2. Open the mapped file and find a regular symbol table inside.
+// Iterate over symbols in the symbol table and look for the symbol
+// containing the program counter. If such a symbol is found,
+// obtain the symbol name, and demangle the symbol if possible.
+// If the symbol isn't found in the regular symbol table (binary is
+// stripped), try the same thing with a dynamic symbol table.
+//
+// Note that Symbolize() is originally implemented to be used in
+// FailureSignalHandler() in base/google.cc. Hence it doesn't use
+// malloc() and other unsafe operations. It should be both
+// thread-safe and async-signal-safe.
+
+#ifndef BASE_SYMBOLIZE_H_
+#define BASE_SYMBOLIZE_H_
+
+#include "utilities.h"
+#include "config.h"
+#include <glog/logging.h>
+
+#ifdef HAVE_SYMBOLIZE
+
+#if defined(__ELF__) // defined by gcc
+#if defined(__OpenBSD__)
+#include <sys/exec_elf.h>
+#else
+#include <elf.h>
+#endif
+
+#if !defined(ANDROID)
+#include <link.h> // For ElfW() macro.
+#endif
+
+// For systems where SIZEOF_VOID_P is not defined, determine it
+// based on __LP64__ (defined by gcc on 64-bit systems)
+#if !defined(SIZEOF_VOID_P)
+# if defined(__LP64__)
+# define SIZEOF_VOID_P 8
+# else
+# define SIZEOF_VOID_P 4
+# endif
+#endif
+
+// If there is no ElfW macro, let's define it by ourself.
+#ifndef ElfW
+# if SIZEOF_VOID_P == 4
+# define ElfW(type) Elf32_##type
+# elif SIZEOF_VOID_P == 8
+# define ElfW(type) Elf64_##type
+# else
+# error "Unknown sizeof(void *)"
+# endif
+#endif
+
+_START_GOOGLE_NAMESPACE_
+
+// Gets the section header for the given name, if it exists. Returns true on
+// success. Otherwise, returns false.
+bool GetSectionHeaderByName(int fd, const char *name, size_t name_len,
+ ElfW(Shdr) *out);
+
+_END_GOOGLE_NAMESPACE_
+
+#endif /* __ELF__ */
+
+_START_GOOGLE_NAMESPACE_
+
+// Restrictions on the callbacks that follow:
+// - The callbacks must not use heaps but only use stacks.
+// - The callbacks must be async-signal-safe.
+
+// Installs a callback function, which will be called right before a symbol name
+// is printed. The callback is intended to be used for showing a file name and a
+// line number preceding a symbol name.
+// "fd" is a file descriptor of the object file containing the program
+// counter "pc". The callback function should write output to "out"
+// and return the size of the output written. On error, the callback
+// function should return -1.
+using SymbolizeCallback = int (*)(int, void *, char *, size_t, uint64_t);
+GLOG_EXPORT
+void InstallSymbolizeCallback(SymbolizeCallback callback);
+
+// Installs a callback function, which will be called instead of
+// OpenObjectFileContainingPcAndGetStartAddress. The callback is expected
+// to searches for the object file (from /proc/self/maps) that contains
+// the specified pc. If found, sets |start_address| to the start address
+// of where this object file is mapped in memory, sets the module base
+// address into |base_address|, copies the object file name into
+// |out_file_name|, and attempts to open the object file. If the object
+// file is opened successfully, returns the file descriptor. Otherwise,
+// returns -1. |out_file_name_size| is the size of the file name buffer
+// (including the null-terminator).
+using SymbolizeOpenObjectFileCallback = int (*)(uint64_t, uint64_t &,
+ uint64_t &, char *, size_t);
+void InstallSymbolizeOpenObjectFileCallback(
+ SymbolizeOpenObjectFileCallback callback);
+
+_END_GOOGLE_NAMESPACE_
+
+#endif
+
+_START_GOOGLE_NAMESPACE_
+
+// Symbolizes a program counter. On success, returns true and write the
+// symbol name to "out". The symbol name is demangled if possible
+// (supports symbols generated by GCC 3.x or newer). Otherwise,
+// returns false.
+GLOG_EXPORT bool Symbolize(void* pc, char* out, size_t out_size);
+
+_END_GOOGLE_NAMESPACE_
+
+#endif // BASE_SYMBOLIZE_H_
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/symbolize_unittest.cc b/funasr/runtime/onnxruntime/third_party/glog/src/symbolize_unittest.cc
new file mode 100644
index 0000000..2b4d8c2
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/symbolize_unittest.cc
@@ -0,0 +1,468 @@
+// Copyright (c) 2006, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Satoru Takabayashi
+//
+// Unit tests for functions in symbolize.cc.
+
+#include "symbolize.h"
+
+#include <glog/logging.h>
+
+#include <csignal>
+#include <iostream>
+
+#include "config.h"
+#include "googletest.h"
+#include "utilities.h"
+
+#ifdef HAVE_LIB_GFLAGS
+#include <gflags/gflags.h>
+using namespace GFLAGS_NAMESPACE;
+#endif
+
+using namespace std;
+using namespace GOOGLE_NAMESPACE;
+
+// Avoid compile error due to "cast between pointer-to-function and
+// pointer-to-object is an extension" warnings.
+#if defined(__GNUG__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
+#endif
+
+#if defined(HAVE_STACKTRACE)
+
+#define always_inline
+
+#if defined(__ELF__) || defined(GLOG_OS_WINDOWS) || defined(GLOG_OS_CYGWIN)
+// A wrapper function for Symbolize() to make the unit test simple.
+static const char *TrySymbolize(void *pc) {
+ static char symbol[4096];
+ if (Symbolize(pc, symbol, sizeof(symbol))) {
+ return symbol;
+ } else {
+ return nullptr;
+ }
+}
+#endif
+
+# if defined(__ELF__)
+
+// This unit tests make sense only with GCC.
+// Uses lots of GCC specific features.
+#if defined(__GNUC__) && !defined(__OPENCC__)
+# if __GNUC__ >= 4
+# define TEST_WITH_MODERN_GCC
+# if defined(__i386__) && __i386__ // always_inline isn't supported for x86_64 with GCC 4.1.0.
+# undef always_inline
+# define always_inline __attribute__((always_inline))
+# define HAVE_ALWAYS_INLINE
+# endif // __i386__
+# else
+# endif // __GNUC__ >= 4
+# if defined(__i386__) || defined(__x86_64__)
+# define TEST_X86_32_AND_64 1
+# endif // defined(__i386__) || defined(__x86_64__)
+#endif
+
+// Make them C linkage to avoid mangled names.
+extern "C" {
+void nonstatic_func();
+void nonstatic_func() {
+ volatile int a = 0;
+ // NOTE: In C++20, increment of object of volatile-qualified type is
+ // deprecated.
+ a = a + 1;
+}
+
+static void static_func() {
+ volatile int a = 0;
+ // NOTE: In C++20, increment of object of volatile-qualified type is
+ // deprecated.
+ a = a + 1;
+}
+}
+
+TEST(Symbolize, Symbolize) {
+ // We do C-style cast since GCC 2.95.3 doesn't allow
+ // reinterpret_cast<void *>(&func).
+
+ // Compilers should give us pointers to them.
+ EXPECT_STREQ("nonstatic_func", TrySymbolize((void *)(&nonstatic_func)));
+
+ // The name of an internal linkage symbol is not specified; allow either a
+ // mangled or an unmangled name here.
+ const char *static_func_symbol =
+ TrySymbolize(reinterpret_cast<void *>(&static_func));
+
+#if !defined(_MSC_VER) || !defined(NDEBUG)
+ CHECK(nullptr != static_func_symbol);
+ EXPECT_TRUE(strcmp("static_func", static_func_symbol) == 0 ||
+ strcmp("static_func()", static_func_symbol) == 0);
+#endif
+
+ EXPECT_TRUE(nullptr == TrySymbolize(nullptr));
+}
+
+struct Foo {
+ static void func(int x);
+};
+
+void ATTRIBUTE_NOINLINE Foo::func(int x) {
+ volatile int a = x;
+ // NOTE: In C++20, increment of object of volatile-qualified type is
+ // deprecated.
+ a = a + 1;
+}
+
+// With a modern GCC, Symbolize() should return demangled symbol
+// names. Function parameters should be omitted.
+#ifdef TEST_WITH_MODERN_GCC
+TEST(Symbolize, SymbolizeWithDemangling) {
+ Foo::func(100);
+#if !defined(_MSC_VER) || !defined(NDEBUG)
+ EXPECT_STREQ("Foo::func()", TrySymbolize((void *)(&Foo::func)));
+#endif
+}
+#endif
+
+// Tests that verify that Symbolize footprint is within some limit.
+
+// To measure the stack footprint of the Symbolize function, we create
+// a signal handler (for SIGUSR1 say) that calls the Symbolize function
+// on an alternate stack. This alternate stack is initialized to some
+// known pattern (0x55, 0x55, 0x55, ...). We then self-send this signal,
+// and after the signal handler returns, look at the alternate stack
+// buffer to see what portion has been touched.
+//
+// This trick gives us the the stack footprint of the signal handler.
+// But the signal handler, even before the call to Symbolize, consumes
+// some stack already. We however only want the stack usage of the
+// Symbolize function. To measure this accurately, we install two signal
+// handlers: one that does nothing and just returns, and another that
+// calls Symbolize. The difference between the stack consumption of these
+// two signals handlers should give us the Symbolize stack foorprint.
+
+static void *g_pc_to_symbolize;
+static char g_symbolize_buffer[4096];
+static char *g_symbolize_result;
+
+static void EmptySignalHandler(int /*signo*/) {}
+
+static void SymbolizeSignalHandler(int /*signo*/) {
+ if (Symbolize(g_pc_to_symbolize, g_symbolize_buffer,
+ sizeof(g_symbolize_buffer))) {
+ g_symbolize_result = g_symbolize_buffer;
+ } else {
+ g_symbolize_result = nullptr;
+ }
+}
+
+const int kAlternateStackSize = 8096;
+const char kAlternateStackFillValue = 0x55;
+
+// These helper functions look at the alternate stack buffer, and figure
+// out what portion of this buffer has been touched - this is the stack
+// consumption of the signal handler running on this alternate stack.
+static ATTRIBUTE_NOINLINE bool StackGrowsDown(int *x) {
+ int y;
+ return &y < x;
+}
+static int GetStackConsumption(const char* alt_stack) {
+ int x;
+ if (StackGrowsDown(&x)) {
+ for (int i = 0; i < kAlternateStackSize; i++) {
+ if (alt_stack[i] != kAlternateStackFillValue) {
+ return (kAlternateStackSize - i);
+ }
+ }
+ } else {
+ for (int i = (kAlternateStackSize - 1); i >= 0; i--) {
+ if (alt_stack[i] != kAlternateStackFillValue) {
+ return i;
+ }
+ }
+ }
+ return -1;
+}
+
+#ifdef HAVE_SIGALTSTACK
+
+// Call Symbolize and figure out the stack footprint of this call.
+static const char *SymbolizeStackConsumption(void *pc, int *stack_consumed) {
+
+ g_pc_to_symbolize = pc;
+
+ // The alt-signal-stack cannot be heap allocated because there is a
+ // bug in glibc-2.2 where some signal handler setup code looks at the
+ // current stack pointer to figure out what thread is currently running.
+ // Therefore, the alternate stack must be allocated from the main stack
+ // itself.
+ char altstack[kAlternateStackSize];
+ memset(altstack, kAlternateStackFillValue, kAlternateStackSize);
+
+ // Set up the alt-signal-stack (and save the older one).
+ stack_t sigstk;
+ memset(&sigstk, 0, sizeof(stack_t));
+ stack_t old_sigstk;
+ sigstk.ss_sp = altstack;
+ sigstk.ss_size = kAlternateStackSize;
+ sigstk.ss_flags = 0;
+ CHECK_ERR(sigaltstack(&sigstk, &old_sigstk));
+
+ // Set up SIGUSR1 and SIGUSR2 signal handlers (and save the older ones).
+ struct sigaction sa;
+ memset(&sa, 0, sizeof(struct sigaction));
+ struct sigaction old_sa1, old_sa2;
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = SA_ONSTACK;
+
+ // SIGUSR1 maps to EmptySignalHandler.
+ sa.sa_handler = EmptySignalHandler;
+ CHECK_ERR(sigaction(SIGUSR1, &sa, &old_sa1));
+
+ // SIGUSR2 maps to SymbolizeSignalHanlder.
+ sa.sa_handler = SymbolizeSignalHandler;
+ CHECK_ERR(sigaction(SIGUSR2, &sa, &old_sa2));
+
+ // Send SIGUSR1 signal and measure the stack consumption of the empty
+ // signal handler.
+ CHECK_ERR(kill(getpid(), SIGUSR1));
+ int stack_consumption1 = GetStackConsumption(altstack);
+
+ // Send SIGUSR2 signal and measure the stack consumption of the symbolize
+ // signal handler.
+ CHECK_ERR(kill(getpid(), SIGUSR2));
+ int stack_consumption2 = GetStackConsumption(altstack);
+
+ // The difference between the two stack consumption values is the
+ // stack footprint of the Symbolize function.
+ if (stack_consumption1 != -1 && stack_consumption2 != -1) {
+ *stack_consumed = stack_consumption2 - stack_consumption1;
+ } else {
+ *stack_consumed = -1;
+ }
+
+ // Log the stack consumption values.
+ LOG(INFO) << "Stack consumption of empty signal handler: "
+ << stack_consumption1;
+ LOG(INFO) << "Stack consumption of symbolize signal handler: "
+ << stack_consumption2;
+ LOG(INFO) << "Stack consumption of Symbolize: " << *stack_consumed;
+
+ // Now restore the old alt-signal-stack and signal handlers.
+ CHECK_ERR(sigaltstack(&old_sigstk, nullptr));
+ CHECK_ERR(sigaction(SIGUSR1, &old_sa1, nullptr));
+ CHECK_ERR(sigaction(SIGUSR2, &old_sa2, nullptr));
+
+ return g_symbolize_result;
+}
+
+#ifdef __ppc64__
+// Symbolize stack consumption should be within 4kB.
+const int kStackConsumptionUpperLimit = 4096;
+#else
+// Symbolize stack consumption should be within 2kB.
+const int kStackConsumptionUpperLimit = 2048;
+#endif
+
+TEST(Symbolize, SymbolizeStackConsumption) {
+ int stack_consumed;
+ const char* symbol;
+
+ symbol = SymbolizeStackConsumption(reinterpret_cast<void *>(&nonstatic_func),
+ &stack_consumed);
+ EXPECT_STREQ("nonstatic_func", symbol);
+ EXPECT_GT(stack_consumed, 0);
+ EXPECT_LT(stack_consumed, kStackConsumptionUpperLimit);
+
+ // The name of an internal linkage symbol is not specified; allow either a
+ // mangled or an unmangled name here.
+ symbol = SymbolizeStackConsumption(reinterpret_cast<void *>(&static_func),
+ &stack_consumed);
+ CHECK(nullptr != symbol);
+ EXPECT_TRUE(strcmp("static_func", symbol) == 0 ||
+ strcmp("static_func()", symbol) == 0);
+ EXPECT_GT(stack_consumed, 0);
+ EXPECT_LT(stack_consumed, kStackConsumptionUpperLimit);
+}
+
+#ifdef TEST_WITH_MODERN_GCC
+TEST(Symbolize, SymbolizeWithDemanglingStackConsumption) {
+ Foo::func(100);
+ int stack_consumed;
+ const char* symbol;
+
+ symbol = SymbolizeStackConsumption(reinterpret_cast<void *>(&Foo::func),
+ &stack_consumed);
+
+ EXPECT_STREQ("Foo::func()", symbol);
+ EXPECT_GT(stack_consumed, 0);
+ EXPECT_LT(stack_consumed, kStackConsumptionUpperLimit);
+}
+#endif
+
+#endif // HAVE_SIGALTSTACK
+
+// x86 specific tests. Uses some inline assembler.
+extern "C" {
+inline void* always_inline inline_func() {
+ void *pc = nullptr;
+#ifdef TEST_X86_32_AND_64
+ __asm__ __volatile__("call 1f; 1: pop %0" : "=r"(pc));
+#endif
+ return pc;
+}
+
+void* ATTRIBUTE_NOINLINE non_inline_func();
+void* ATTRIBUTE_NOINLINE non_inline_func() {
+ void *pc = nullptr;
+#ifdef TEST_X86_32_AND_64
+ __asm__ __volatile__("call 1f; 1: pop %0" : "=r"(pc));
+#endif
+ return pc;
+}
+
+static void ATTRIBUTE_NOINLINE TestWithPCInsideNonInlineFunction() {
+#if defined(TEST_X86_32_AND_64) && defined(HAVE_ATTRIBUTE_NOINLINE)
+ void *pc = non_inline_func();
+ const char *symbol = TrySymbolize(pc);
+
+#if !defined(_MSC_VER) || !defined(NDEBUG)
+ CHECK(symbol != nullptr);
+ CHECK_STREQ(symbol, "non_inline_func");
+#endif
+ cout << "Test case TestWithPCInsideNonInlineFunction passed." << endl;
+#endif
+}
+
+static void ATTRIBUTE_NOINLINE TestWithPCInsideInlineFunction() {
+#if defined(TEST_X86_32_AND_64) && defined(HAVE_ALWAYS_INLINE)
+ void *pc = inline_func(); // Must be inlined.
+ const char *symbol = TrySymbolize(pc);
+
+#if !defined(_MSC_VER) || !defined(NDEBUG)
+ CHECK(symbol != nullptr);
+ CHECK_STREQ(symbol, __FUNCTION__);
+#endif
+ cout << "Test case TestWithPCInsideInlineFunction passed." << endl;
+#endif
+}
+}
+
+// Test with a return address.
+static void ATTRIBUTE_NOINLINE TestWithReturnAddress() {
+#if defined(HAVE_ATTRIBUTE_NOINLINE)
+ void *return_address = __builtin_return_address(0);
+ const char *symbol = TrySymbolize(return_address);
+
+#if !defined(_MSC_VER) || !defined(NDEBUG)
+ CHECK(symbol != nullptr);
+ CHECK_STREQ(symbol, "main");
+#endif
+ cout << "Test case TestWithReturnAddress passed." << endl;
+#endif
+}
+
+# elif defined(GLOG_OS_WINDOWS) || defined(GLOG_OS_CYGWIN)
+
+#ifdef _MSC_VER
+#include <intrin.h>
+#pragma intrinsic(_ReturnAddress)
+#endif
+
+struct Foo {
+ static void func(int x);
+};
+
+__declspec(noinline) void Foo::func(int x) {
+ volatile int a = x;
+ // NOTE: In C++20, increment of object of volatile-qualified type is
+ // deprecated.
+ a = a + 1;
+}
+
+TEST(Symbolize, SymbolizeWithDemangling) {
+ Foo::func(100);
+ const char* ret = TrySymbolize((void *)(&Foo::func));
+
+#if defined(HAVE_DBGHELP) && !defined(NDEBUG)
+ EXPECT_STREQ("public: static void __cdecl Foo::func(int)", ret);
+#endif
+}
+
+__declspec(noinline) void TestWithReturnAddress() {
+ void *return_address =
+#ifdef __GNUC__ // Cygwin and MinGW support
+ __builtin_return_address(0)
+#else
+ _ReturnAddress()
+#endif
+ ;
+ const char *symbol = TrySymbolize(return_address);
+#if !defined(_MSC_VER) || !defined(NDEBUG)
+ CHECK(symbol != nullptr);
+ CHECK_STREQ(symbol, "main");
+#endif
+ cout << "Test case TestWithReturnAddress passed." << endl;
+}
+# endif // __ELF__
+#endif // HAVE_STACKTRACE
+
+int main(int argc, char **argv) {
+ FLAGS_logtostderr = true;
+ InitGoogleLogging(argv[0]);
+ InitGoogleTest(&argc, argv);
+#if defined(HAVE_SYMBOLIZE) && defined(HAVE_STACKTRACE)
+# if defined(__ELF__)
+ // We don't want to get affected by the callback interface, that may be
+ // used to install some callback function at InitGoogle() time.
+ InstallSymbolizeCallback(nullptr);
+
+ TestWithPCInsideInlineFunction();
+ TestWithPCInsideNonInlineFunction();
+ TestWithReturnAddress();
+ return RUN_ALL_TESTS();
+# elif defined(GLOG_OS_WINDOWS) || defined(GLOG_OS_CYGWIN)
+ TestWithReturnAddress();
+ return RUN_ALL_TESTS();
+# else // GLOG_OS_WINDOWS
+ printf("PASS (no symbolize_unittest support)\n");
+ return 0;
+# endif // __ELF__
+#else
+ printf("PASS (no symbolize support)\n");
+ return 0;
+#endif // HAVE_SYMBOLIZE
+}
+
+#if defined(__GNUG__)
+#pragma GCC diagnostic pop
+#endif
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/utilities.cc b/funasr/runtime/onnxruntime/third_party/glog/src/utilities.cc
new file mode 100644
index 0000000..8b0a1ea
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/utilities.cc
@@ -0,0 +1,400 @@
+// Copyright (c) 2008, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Shinichiro Hamaji
+
+#include "config.h"
+#include "utilities.h"
+
+#include <cstdio>
+#include <cstdlib>
+
+#include <csignal>
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#include <ctime>
+#if defined(HAVE_SYSCALL_H)
+#include <syscall.h> // for syscall()
+#elif defined(HAVE_SYS_SYSCALL_H)
+#include <sys/syscall.h> // for syscall()
+#endif
+#ifdef HAVE_SYSLOG_H
+# include <syslog.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h> // For geteuid.
+#endif
+#ifdef HAVE_PWD_H
+# include <pwd.h>
+#endif
+#ifdef __ANDROID__
+#include <android/log.h>
+#endif
+
+#include "base/googleinit.h"
+
+using std::string;
+
+_START_GOOGLE_NAMESPACE_
+
+static const char* g_program_invocation_short_name = nullptr;
+
+bool IsGoogleLoggingInitialized() {
+ return g_program_invocation_short_name != nullptr;
+}
+
+_END_GOOGLE_NAMESPACE_
+
+// The following APIs are all internal.
+#ifdef HAVE_STACKTRACE
+
+#include "stacktrace.h"
+#include "symbolize.h"
+#include "base/commandlineflags.h"
+
+GLOG_DEFINE_bool(symbolize_stacktrace, true,
+ "Symbolize the stack trace in the tombstone");
+
+_START_GOOGLE_NAMESPACE_
+
+using DebugWriter = void(const char*, void*);
+
+// The %p field width for printf() functions is two characters per byte.
+// For some environments, add two extra bytes for the leading "0x".
+static const int kPrintfPointerFieldWidth = 2 + 2 * sizeof(void*);
+
+static void DebugWriteToStderr(const char* data, void *) {
+ // This one is signal-safe.
+ if (write(STDERR_FILENO, data, strlen(data)) < 0) {
+ // Ignore errors.
+ }
+#if defined(__ANDROID__)
+ // ANDROID_LOG_FATAL as fatal error occurred and now is dumping call stack.
+ __android_log_write(ANDROID_LOG_FATAL,
+ glog_internal_namespace_::ProgramInvocationShortName(),
+ data);
+#endif
+}
+
+static void DebugWriteToString(const char* data, void *arg) {
+ reinterpret_cast<string*>(arg)->append(data);
+}
+
+#ifdef HAVE_SYMBOLIZE
+// Print a program counter and its symbol name.
+static void DumpPCAndSymbol(DebugWriter *writerfn, void *arg, void *pc,
+ const char * const prefix) {
+ char tmp[1024];
+ const char *symbol = "(unknown)";
+ // Symbolizes the previous address of pc because pc may be in the
+ // next function. The overrun happens when the function ends with
+ // a call to a function annotated noreturn (e.g. CHECK).
+ if (Symbolize(reinterpret_cast<char *>(pc) - 1, tmp, sizeof(tmp))) {
+ symbol = tmp;
+ }
+ char buf[1024];
+ snprintf(buf, sizeof(buf), "%s@ %*p %s\n",
+ prefix, kPrintfPointerFieldWidth, pc, symbol);
+ writerfn(buf, arg);
+}
+#endif
+
+static void DumpPC(DebugWriter *writerfn, void *arg, void *pc,
+ const char * const prefix) {
+ char buf[100];
+ snprintf(buf, sizeof(buf), "%s@ %*p\n",
+ prefix, kPrintfPointerFieldWidth, pc);
+ writerfn(buf, arg);
+}
+
+// Dump current stack trace as directed by writerfn
+static void DumpStackTrace(int skip_count, DebugWriter *writerfn, void *arg) {
+ // Print stack trace
+ void* stack[32];
+ int depth = GetStackTrace(stack, ARRAYSIZE(stack), skip_count+1);
+ for (int i = 0; i < depth; i++) {
+#if defined(HAVE_SYMBOLIZE)
+ if (FLAGS_symbolize_stacktrace) {
+ DumpPCAndSymbol(writerfn, arg, stack[i], " ");
+ } else {
+ DumpPC(writerfn, arg, stack[i], " ");
+ }
+#else
+ DumpPC(writerfn, arg, stack[i], " ");
+#endif
+ }
+}
+
+#ifdef __GNUC__
+__attribute__((noreturn))
+#endif
+static void
+DumpStackTraceAndExit() {
+ DumpStackTrace(1, DebugWriteToStderr, nullptr);
+
+ // TODO(hamaji): Use signal instead of sigaction?
+ if (IsFailureSignalHandlerInstalled()) {
+ // Set the default signal handler for SIGABRT, to avoid invoking our
+ // own signal handler installed by InstallFailureSignalHandler().
+#ifdef HAVE_SIGACTION
+ struct sigaction sig_action;
+ memset(&sig_action, 0, sizeof(sig_action));
+ sigemptyset(&sig_action.sa_mask);
+ sig_action.sa_handler = SIG_DFL;
+ sigaction(SIGABRT, &sig_action, nullptr);
+#elif defined(GLOG_OS_WINDOWS)
+ signal(SIGABRT, SIG_DFL);
+#endif // HAVE_SIGACTION
+ }
+
+ abort();
+}
+
+_END_GOOGLE_NAMESPACE_
+
+#endif // HAVE_STACKTRACE
+
+_START_GOOGLE_NAMESPACE_
+
+namespace glog_internal_namespace_ {
+
+const char* ProgramInvocationShortName() {
+ if (g_program_invocation_short_name != nullptr) {
+ return g_program_invocation_short_name;
+ } else {
+ // TODO(hamaji): Use /proc/self/cmdline and so?
+ return "UNKNOWN";
+ }
+}
+
+#ifdef GLOG_OS_WINDOWS
+struct timeval {
+ long tv_sec, tv_usec;
+};
+
+// Based on: http://www.google.com/codesearch/p?hl=en#dR3YEbitojA/os_win32.c&q=GetSystemTimeAsFileTime%20license:bsd
+// See COPYING for copyright information.
+static int gettimeofday(struct timeval *tv, void* /*tz*/) {
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wlong-long"
+#endif
+#define EPOCHFILETIME (116444736000000000ULL)
+ FILETIME ft;
+ ULARGE_INTEGER li;
+ uint64 tt;
+
+ GetSystemTimeAsFileTime(&ft);
+ li.LowPart = ft.dwLowDateTime;
+ li.HighPart = ft.dwHighDateTime;
+ tt = (li.QuadPart - EPOCHFILETIME) / 10;
+ tv->tv_sec = tt / 1000000;
+ tv->tv_usec = tt % 1000000;
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
+
+ return 0;
+}
+#endif
+
+int64 CycleClock_Now() {
+ // TODO(hamaji): temporary impementation - it might be too slow.
+ struct timeval tv;
+ gettimeofday(&tv, nullptr);
+ return static_cast<int64>(tv.tv_sec) * 1000000 + tv.tv_usec;
+}
+
+int64 UsecToCycles(int64 usec) {
+ return usec;
+}
+
+WallTime WallTime_Now() {
+ // Now, cycle clock is retuning microseconds since the epoch.
+ return CycleClock_Now() * 0.000001;
+}
+
+static int32 g_main_thread_pid = getpid();
+int32 GetMainThreadPid() {
+ return g_main_thread_pid;
+}
+
+bool PidHasChanged() {
+ int32 pid = getpid();
+ if (g_main_thread_pid == pid) {
+ return false;
+ }
+ g_main_thread_pid = pid;
+ return true;
+}
+
+pid_t GetTID() {
+ // On Linux and MacOSX, we try to use gettid().
+#if defined GLOG_OS_LINUX || defined GLOG_OS_MACOSX
+#ifndef __NR_gettid
+#ifdef GLOG_OS_MACOSX
+#define __NR_gettid SYS_gettid
+#elif ! defined __i386__
+#error "Must define __NR_gettid for non-x86 platforms"
+#else
+#define __NR_gettid 224
+#endif
+#endif
+ static bool lacks_gettid = false;
+ if (!lacks_gettid) {
+#if (defined(GLOG_OS_MACOSX) && defined(HAVE_PTHREAD_THREADID_NP))
+ uint64_t tid64;
+ const int error = pthread_threadid_np(nullptr, &tid64);
+ pid_t tid = error ? -1 : static_cast<pid_t>(tid64);
+#else
+ auto tid = static_cast<pid_t>(syscall(__NR_gettid));
+#endif
+ if (tid != -1) {
+ return tid;
+ }
+ // Technically, this variable has to be volatile, but there is a small
+ // performance penalty in accessing volatile variables and there should
+ // not be any serious adverse effect if a thread does not immediately see
+ // the value change to "true".
+ lacks_gettid = true;
+ }
+#endif // GLOG_OS_LINUX || GLOG_OS_MACOSX
+
+ // If gettid() could not be used, we use one of the following.
+#if defined GLOG_OS_LINUX
+ return getpid(); // Linux: getpid returns thread ID when gettid is absent
+#elif defined GLOG_OS_WINDOWS && !defined GLOG_OS_CYGWIN
+ return static_cast<pid_t>(GetCurrentThreadId());
+#elif defined(HAVE_PTHREAD)
+ // If none of the techniques above worked, we use pthread_self().
+ return (pid_t)(uintptr_t)pthread_self();
+#else
+ return -1;
+#endif
+}
+
+const char* const_basename(const char* filepath) {
+ const char* base = strrchr(filepath, '/');
+#ifdef GLOG_OS_WINDOWS // Look for either path separator in Windows
+ if (!base)
+ base = strrchr(filepath, '\\');
+#endif
+ return base ? (base+1) : filepath;
+}
+
+static string g_my_user_name;
+const string& MyUserName() {
+ return g_my_user_name;
+}
+static void MyUserNameInitializer() {
+ // TODO(hamaji): Probably this is not portable.
+#if defined(GLOG_OS_WINDOWS)
+ const char* user = getenv("USERNAME");
+#else
+ const char* user = getenv("USER");
+#endif
+ if (user != nullptr) {
+ g_my_user_name = user;
+ } else {
+#if defined(HAVE_PWD_H) && defined(HAVE_UNISTD_H)
+ struct passwd pwd;
+ struct passwd* result = nullptr;
+ char buffer[1024] = {'\0'};
+ uid_t uid = geteuid();
+ int pwuid_res = getpwuid_r(uid, &pwd, buffer, sizeof(buffer), &result);
+ if (pwuid_res == 0 && result) {
+ g_my_user_name = pwd.pw_name;
+ } else {
+ snprintf(buffer, sizeof(buffer), "uid%d", uid);
+ g_my_user_name = buffer;
+ }
+#endif
+ if (g_my_user_name.empty()) {
+ g_my_user_name = "invalid-user";
+ }
+ }
+}
+REGISTER_MODULE_INITIALIZER(utilities, MyUserNameInitializer())
+
+#ifdef HAVE_STACKTRACE
+void DumpStackTraceToString(string* stacktrace) {
+ DumpStackTrace(1, DebugWriteToString, stacktrace);
+}
+#endif
+
+// We use an atomic operation to prevent problems with calling CrashReason
+// from inside the Mutex implementation (potentially through RAW_CHECK).
+static const CrashReason* g_reason = nullptr;
+
+void SetCrashReason(const CrashReason* r) {
+ sync_val_compare_and_swap(&g_reason,
+ reinterpret_cast<const CrashReason*>(0),
+ r);
+}
+
+void InitGoogleLoggingUtilities(const char* argv0) {
+ CHECK(!IsGoogleLoggingInitialized())
+ << "You called InitGoogleLogging() twice!";
+ const char* slash = strrchr(argv0, '/');
+#ifdef GLOG_OS_WINDOWS
+ if (!slash) slash = strrchr(argv0, '\\');
+#endif
+ g_program_invocation_short_name = slash ? slash + 1 : argv0;
+
+#ifdef HAVE_STACKTRACE
+ InstallFailureFunction(&DumpStackTraceAndExit);
+#endif
+}
+
+void ShutdownGoogleLoggingUtilities() {
+ CHECK(IsGoogleLoggingInitialized())
+ << "You called ShutdownGoogleLogging() without calling InitGoogleLogging() first!";
+ g_program_invocation_short_name = nullptr;
+#ifdef HAVE_SYSLOG_H
+ closelog();
+#endif
+}
+
+} // namespace glog_internal_namespace_
+
+_END_GOOGLE_NAMESPACE_
+
+// Make an implementation of stacktrace compiled.
+#ifdef STACKTRACE_H
+# include STACKTRACE_H
+# if 0
+// For include scanners which can't handle macro expansions.
+# include "stacktrace_libunwind-inl.h"
+# include "stacktrace_x86-inl.h"
+# include "stacktrace_x86_64-inl.h"
+# include "stacktrace_powerpc-inl.h"
+# include "stacktrace_generic-inl.h"
+# endif
+#endif
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/utilities.h b/funasr/runtime/onnxruntime/third_party/glog/src/utilities.h
new file mode 100644
index 0000000..45e555b
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/utilities.h
@@ -0,0 +1,217 @@
+// Copyright (c) 2008, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Shinichiro Hamaji
+//
+// Define utilties for glog internal usage.
+
+#ifndef UTILITIES_H__
+#define UTILITIES_H__
+
+// printf macros for size_t, in the style of inttypes.h
+#ifdef _LP64
+#define __PRIS_PREFIX "z"
+#else
+#define __PRIS_PREFIX
+#endif
+
+// Use these macros after a % in a printf format string
+// to get correct 32/64 bit behavior, like this:
+// size_t size = records.size();
+// printf("%"PRIuS"\n", size);
+
+#define PRIdS __PRIS_PREFIX "d"
+#define PRIxS __PRIS_PREFIX "x"
+#define PRIuS __PRIS_PREFIX "u"
+#define PRIXS __PRIS_PREFIX "X"
+#define PRIoS __PRIS_PREFIX "o"
+
+#include "base/mutex.h" // This must go first so we get _XOPEN_SOURCE
+
+#include <string>
+
+#include <glog/logging.h>
+
+#if defined(GLOG_OS_WINDOWS)
+# include "port.h"
+#endif
+
+#include "config.h"
+
+// There are three different ways we can try to get the stack trace:
+//
+// 1) The libunwind library. This is still in development, and as a
+// separate library adds a new dependency, but doesn't need a frame
+// pointer. It also doesn't call malloc.
+//
+// 2) Our hand-coded stack-unwinder. This depends on a certain stack
+// layout, which is used by gcc (and those systems using a
+// gcc-compatible ABI) on x86 systems, at least since gcc 2.95.
+// It uses the frame pointer to do its work.
+//
+// 3) The gdb unwinder -- also the one used by the c++ exception code.
+// It's obviously well-tested, but has a fatal flaw: it can call
+// malloc() from the unwinder. This is a problem because we're
+// trying to use the unwinder to instrument malloc().
+//
+// 4) The Windows API CaptureStackTrace.
+//
+// Note: if you add a new implementation here, make sure it works
+// correctly when GetStackTrace() is called with max_depth == 0.
+// Some code may do that.
+
+#if defined(HAVE_LIB_UNWIND)
+# define STACKTRACE_H "stacktrace_libunwind-inl.h"
+#elif defined(HAVE__UNWIND_BACKTRACE) && defined(HAVE__UNWIND_GETIP)
+# define STACKTRACE_H "stacktrace_unwind-inl.h"
+#elif !defined(NO_FRAME_POINTER)
+# if defined(__i386__) && __GNUC__ >= 2
+# define STACKTRACE_H "stacktrace_x86-inl.h"
+# elif (defined(__ppc__) || defined(__PPC__)) && __GNUC__ >= 2
+# define STACKTRACE_H "stacktrace_powerpc-inl.h"
+# elif defined(GLOG_OS_WINDOWS)
+# define STACKTRACE_H "stacktrace_windows-inl.h"
+# endif
+#endif
+
+#if !defined(STACKTRACE_H) && defined(HAVE_EXECINFO_BACKTRACE)
+# define STACKTRACE_H "stacktrace_generic-inl.h"
+#endif
+
+#if defined(STACKTRACE_H)
+# define HAVE_STACKTRACE
+#endif
+
+#ifndef GLOG_NO_SYMBOLIZE_DETECTION
+#ifndef HAVE_SYMBOLIZE
+// defined by gcc
+#if defined(__ELF__) && defined(GLOG_OS_LINUX)
+# define HAVE_SYMBOLIZE
+#elif defined(GLOG_OS_MACOSX) && defined(HAVE_DLADDR)
+// Use dladdr to symbolize.
+# define HAVE_SYMBOLIZE
+#elif defined(GLOG_OS_WINDOWS)
+// Use DbgHelp to symbolize
+# define HAVE_SYMBOLIZE
+#endif
+#endif // !defined(HAVE_SYMBOLIZE)
+#endif // !defined(GLOG_NO_SYMBOLIZE_DETECTION)
+
+#ifndef ARRAYSIZE
+// There is a better way, but this is good enough for our purpose.
+# define ARRAYSIZE(a) (sizeof(a) / sizeof(*(a)))
+#endif
+
+_START_GOOGLE_NAMESPACE_
+
+namespace glog_internal_namespace_ {
+
+#ifdef HAVE___ATTRIBUTE__
+# define ATTRIBUTE_NOINLINE __attribute__ ((noinline))
+# define HAVE_ATTRIBUTE_NOINLINE
+#elif defined(GLOG_OS_WINDOWS)
+# define ATTRIBUTE_NOINLINE __declspec(noinline)
+# define HAVE_ATTRIBUTE_NOINLINE
+#else
+# define ATTRIBUTE_NOINLINE
+#endif
+
+const char* ProgramInvocationShortName();
+
+int64 CycleClock_Now();
+
+int64 UsecToCycles(int64 usec);
+WallTime WallTime_Now();
+
+int32 GetMainThreadPid();
+bool PidHasChanged();
+
+pid_t GetTID();
+
+const std::string& MyUserName();
+
+// Get the part of filepath after the last path separator.
+// (Doesn't modify filepath, contrary to basename() in libgen.h.)
+const char* const_basename(const char* filepath);
+
+// Wrapper of __sync_val_compare_and_swap. If the GCC extension isn't
+// defined, we try the CPU specific logics (we only support x86 and
+// x86_64 for now) first, then use a naive implementation, which has a
+// race condition.
+template<typename T>
+inline T sync_val_compare_and_swap(T* ptr, T oldval, T newval) {
+#if defined(HAVE___SYNC_VAL_COMPARE_AND_SWAP)
+ return __sync_val_compare_and_swap(ptr, oldval, newval);
+#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
+ T ret;
+ __asm__ __volatile__("lock; cmpxchg %1, (%2);"
+ :"=a"(ret)
+ // GCC may produces %sil or %dil for
+ // constraint "r", but some of apple's gas
+ // dosn't know the 8 bit registers.
+ // We use "q" to avoid these registers.
+ :"q"(newval), "q"(ptr), "a"(oldval)
+ :"memory", "cc");
+ return ret;
+#else
+ T ret = *ptr;
+ if (ret == oldval) {
+ *ptr = newval;
+ }
+ return ret;
+#endif
+}
+
+void DumpStackTraceToString(std::string* stacktrace);
+
+struct CrashReason {
+ CrashReason() = default;
+
+ const char* filename{nullptr};
+ int line_number{0};
+ const char* message{nullptr};
+
+ // We'll also store a bit of stack trace context at the time of crash as
+ // it may not be available later on.
+ void* stack[32];
+ int depth{0};
+};
+
+void SetCrashReason(const CrashReason* r);
+
+void InitGoogleLoggingUtilities(const char* argv0);
+void ShutdownGoogleLoggingUtilities();
+
+} // namespace glog_internal_namespace_
+
+_END_GOOGLE_NAMESPACE_
+
+using namespace GOOGLE_NAMESPACE::glog_internal_namespace_;
+
+#endif // UTILITIES_H__
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/utilities_unittest.cc b/funasr/runtime/onnxruntime/third_party/glog/src/utilities_unittest.cc
new file mode 100644
index 0000000..93b1acd
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/utilities_unittest.cc
@@ -0,0 +1,58 @@
+// Copyright (c) 2008, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Shinichiro Hamaji
+#include "utilities.h"
+#include "googletest.h"
+#include <glog/logging.h>
+
+#ifdef HAVE_LIB_GFLAGS
+#include <gflags/gflags.h>
+using namespace GFLAGS_NAMESPACE;
+#endif
+
+using namespace GOOGLE_NAMESPACE;
+
+TEST(utilities, sync_val_compare_and_swap) {
+ bool now_entering = false;
+ EXPECT_FALSE(sync_val_compare_and_swap(&now_entering, false, true));
+ EXPECT_TRUE(sync_val_compare_and_swap(&now_entering, false, true));
+ EXPECT_TRUE(sync_val_compare_and_swap(&now_entering, false, true));
+}
+
+TEST(utilities, InitGoogleLoggingDeathTest) {
+ ASSERT_DEATH(InitGoogleLogging("foobar"), "");
+}
+
+int main(int argc, char **argv) {
+ InitGoogleLogging(argv[0]);
+ InitGoogleTest(&argc, argv);
+
+ CHECK_EQ(RUN_ALL_TESTS(), 0);
+}
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/vlog_is_on.cc b/funasr/runtime/onnxruntime/third_party/glog/src/vlog_is_on.cc
new file mode 100644
index 0000000..ac60d02
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/vlog_is_on.cc
@@ -0,0 +1,294 @@
+// Copyright (c) 1999, 2007, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Ray Sidney and many others
+//
+// Broken out from logging.cc by Soren Lassen
+// logging_unittest.cc covers the functionality herein
+
+#include "utilities.h"
+
+#include <cstring>
+#include <cstdlib>
+#include <cerrno>
+#include <cstdio>
+#include <string>
+#include "base/commandlineflags.h"
+#include <glog/logging.h>
+#include <glog/raw_logging.h>
+#include "base/googleinit.h"
+
+// glog doesn't have annotation
+#define ANNOTATE_BENIGN_RACE(address, description)
+
+using std::string;
+
+GLOG_DEFINE_int32(v, 0, "Show all VLOG(m) messages for m <= this."
+" Overridable by --vmodule.");
+
+GLOG_DEFINE_string(vmodule, "", "per-module verbose level."
+" Argument is a comma-separated list of <module name>=<log level>."
+" <module name> is a glob pattern, matched against the filename base"
+" (that is, name ignoring .cc/.h./-inl.h)."
+" <log level> overrides any value given by --v.");
+
+_START_GOOGLE_NAMESPACE_
+
+namespace glog_internal_namespace_ {
+
+// Used by logging_unittests.cc so can't make it static here.
+GLOG_EXPORT bool SafeFNMatch_(const char* pattern, size_t patt_len,
+ const char* str, size_t str_len);
+
+// Implementation of fnmatch that does not need 0-termination
+// of arguments and does not allocate any memory,
+// but we only support "*" and "?" wildcards, not the "[...]" patterns.
+// It's not a static function for the unittest.
+GLOG_EXPORT bool SafeFNMatch_(const char* pattern, size_t patt_len,
+ const char* str, size_t str_len) {
+ size_t p = 0;
+ size_t s = 0;
+ while (true) {
+ if (p == patt_len && s == str_len) return true;
+ if (p == patt_len) return false;
+ if (s == str_len) return p+1 == patt_len && pattern[p] == '*';
+ if (pattern[p] == str[s] || pattern[p] == '?') {
+ p += 1;
+ s += 1;
+ continue;
+ }
+ if (pattern[p] == '*') {
+ if (p+1 == patt_len) return true;
+ do {
+ if (SafeFNMatch_(pattern+(p+1), patt_len-(p+1), str+s, str_len-s)) {
+ return true;
+ }
+ s += 1;
+ } while (s != str_len);
+ return false;
+ }
+ return false;
+ }
+}
+
+} // namespace glog_internal_namespace_
+
+using glog_internal_namespace_::SafeFNMatch_;
+
+// List of per-module log levels from FLAGS_vmodule.
+// Once created each element is never deleted/modified
+// except for the vlog_level: other threads will read VModuleInfo blobs
+// w/o locks and we'll store pointers to vlog_level at VLOG locations
+// that will never go away.
+// We can't use an STL struct here as we wouldn't know
+// when it's safe to delete/update it: other threads need to use it w/o locks.
+struct VModuleInfo {
+ string module_pattern;
+ mutable int32 vlog_level; // Conceptually this is an AtomicWord, but it's
+ // too much work to use AtomicWord type here
+ // w/o much actual benefit.
+ const VModuleInfo* next;
+};
+
+// This protects the following global variables.
+static Mutex vmodule_lock;
+// Pointer to head of the VModuleInfo list.
+// It's a map from module pattern to logging level for those module(s).
+static VModuleInfo* vmodule_list = nullptr;
+static SiteFlag* cached_site_list = nullptr;
+
+// Boolean initialization flag.
+static bool inited_vmodule = false;
+
+// L >= vmodule_lock.
+static void VLOG2Initializer() {
+ vmodule_lock.AssertHeld();
+ // Can now parse --vmodule flag and initialize mapping of module-specific
+ // logging levels.
+ inited_vmodule = false;
+ const char* vmodule = FLAGS_vmodule.c_str();
+ const char* sep;
+ VModuleInfo* head = nullptr;
+ VModuleInfo* tail = nullptr;
+ while ((sep = strchr(vmodule, '=')) != nullptr) {
+ string pattern(vmodule, static_cast<size_t>(sep - vmodule));
+ int module_level;
+ if (sscanf(sep, "=%d", &module_level) == 1) {
+ auto* info = new VModuleInfo;
+ info->module_pattern = pattern;
+ info->vlog_level = module_level;
+ if (head) {
+ tail->next = info;
+ } else {
+ head = info;
+ }
+ tail = info;
+ }
+ // Skip past this entry
+ vmodule = strchr(sep, ',');
+ if (vmodule == nullptr) break;
+ vmodule++; // Skip past ","
+ }
+ if (head) { // Put them into the list at the head:
+ tail->next = vmodule_list;
+ vmodule_list = head;
+ }
+ inited_vmodule = true;
+}
+
+// This can be called very early, so we use SpinLock and RAW_VLOG here.
+int SetVLOGLevel(const char* module_pattern, int log_level) {
+ int result = FLAGS_v;
+ size_t const pattern_len = strlen(module_pattern);
+ bool found = false;
+ {
+ MutexLock l(&vmodule_lock); // protect whole read-modify-write
+ for (const VModuleInfo* info = vmodule_list; info != nullptr;
+ info = info->next) {
+ if (info->module_pattern == module_pattern) {
+ if (!found) {
+ result = info->vlog_level;
+ found = true;
+ }
+ info->vlog_level = log_level;
+ } else if (!found &&
+ SafeFNMatch_(info->module_pattern.c_str(),
+ info->module_pattern.size(),
+ module_pattern, pattern_len)) {
+ result = info->vlog_level;
+ found = true;
+ }
+ }
+ if (!found) {
+ auto* info = new VModuleInfo;
+ info->module_pattern = module_pattern;
+ info->vlog_level = log_level;
+ info->next = vmodule_list;
+ vmodule_list = info;
+
+ SiteFlag** item_ptr = &cached_site_list;
+ SiteFlag* item = cached_site_list;
+
+ // We traverse the list fully because the pattern can match several items
+ // from the list.
+ while (item) {
+ if (SafeFNMatch_(module_pattern, pattern_len, item->base_name,
+ item->base_len)) {
+ // Redirect the cached value to its module override.
+ item->level = &info->vlog_level;
+ *item_ptr = item->next; // Remove the item from the list.
+ } else {
+ item_ptr = &item->next;
+ }
+ item = *item_ptr;
+ }
+ }
+ }
+ RAW_VLOG(1, "Set VLOG level for \"%s\" to %d", module_pattern, log_level);
+ return result;
+}
+
+// NOTE: Individual VLOG statements cache the integer log level pointers.
+// NOTE: This function must not allocate memory or require any locks.
+bool InitVLOG3__(SiteFlag* site_flag, int32* level_default,
+ const char* fname, int32 verbose_level) {
+ MutexLock l(&vmodule_lock);
+ bool read_vmodule_flag = inited_vmodule;
+ if (!read_vmodule_flag) {
+ VLOG2Initializer();
+ }
+
+ // protect the errno global in case someone writes:
+ // VLOG(..) << "The last error was " << strerror(errno)
+ int old_errno = errno;
+
+ // site_default normally points to FLAGS_v
+ int32* site_flag_value = level_default;
+
+ // Get basename for file
+ const char* base = strrchr(fname, '/');
+
+#ifdef _WIN32
+ if (!base) {
+ base = strrchr(fname, '\\');
+ }
+#endif
+
+ base = base ? (base+1) : fname;
+ const char* base_end = strchr(base, '.');
+ size_t base_length =
+ base_end ? static_cast<size_t>(base_end - base) : strlen(base);
+
+ // Trim out trailing "-inl" if any
+ if (base_length >= 4 && (memcmp(base+base_length-4, "-inl", 4) == 0)) {
+ base_length -= 4;
+ }
+
+ // TODO: Trim out _unittest suffix? Perhaps it is better to have
+ // the extra control and just leave it there.
+
+ // find target in vector of modules, replace site_flag_value with
+ // a module-specific verbose level, if any.
+ for (const VModuleInfo* info = vmodule_list; info != nullptr;
+ info = info->next) {
+ if (SafeFNMatch_(info->module_pattern.c_str(), info->module_pattern.size(),
+ base, base_length)) {
+ site_flag_value = &info->vlog_level;
+ // value at info->vlog_level is now what controls
+ // the VLOG at the caller site forever
+ break;
+ }
+ }
+
+ // Cache the vlog value pointer if --vmodule flag has been parsed.
+ ANNOTATE_BENIGN_RACE(site_flag,
+ "*site_flag may be written by several threads,"
+ " but the value will be the same");
+ if (read_vmodule_flag) {
+ site_flag->level = site_flag_value;
+ // If VLOG flag has been cached to the default site pointer,
+ // we want to add to the cached list in order to invalidate in case
+ // SetVModule is called afterwards with new modules.
+ // The performance penalty here is neglible, because InitVLOG3__ is called
+ // once per site.
+ if (site_flag_value == level_default && !site_flag->base_name) {
+ site_flag->base_name = base;
+ site_flag->base_len = base_length;
+ site_flag->next = cached_site_list;
+ cached_site_list = site_flag;
+ }
+ }
+
+ // restore the errno in case something recoverable went wrong during
+ // the initialization of the VLOG mechanism (see above note "protect the..")
+ errno = old_errno;
+ return *site_flag_value >= verbose_level;
+}
+
+_END_GOOGLE_NAMESPACE_
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/windows/dirent.h b/funasr/runtime/onnxruntime/third_party/glog/src/windows/dirent.h
new file mode 100644
index 0000000..097ad20
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/windows/dirent.h
@@ -0,0 +1,1145 @@
+/*
+ * Dirent interface for Microsoft Visual Studio
+ *
+ * Copyright (C) 1998-2019 Toni Ronkko
+ * This file is part of dirent. Dirent may be freely distributed
+ * under the MIT license. For all details and documentation, see
+ * https://github.com/tronkko/dirent
+ */
+#ifndef DIRENT_H
+#define DIRENT_H
+
+/* Hide warnings about unreferenced local functions */
+#if defined(__clang__)
+# pragma clang diagnostic ignored "-Wunused-function"
+#elif defined(_MSC_VER)
+# pragma warning(disable:4505)
+#elif defined(__GNUC__)
+# pragma GCC diagnostic ignored "-Wunused-function"
+#endif
+
+/*
+ * Include windows.h without Windows Sockets 1.1 to prevent conflicts with
+ * Windows Sockets 2.0.
+ */
+#ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+
+#include <cerrno>
+#include <cstdarg>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <cwchar>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+/* Indicates that d_type field is available in dirent structure */
+#define _DIRENT_HAVE_D_TYPE
+
+/* Indicates that d_namlen field is available in dirent structure */
+#define _DIRENT_HAVE_D_NAMLEN
+
+/* Entries missing from MSVC 6.0 */
+#if !defined(FILE_ATTRIBUTE_DEVICE)
+# define FILE_ATTRIBUTE_DEVICE 0x40
+#endif
+
+/* File type and permission flags for stat(), general mask */
+#if !defined(S_IFMT)
+# define S_IFMT _S_IFMT
+#endif
+
+/* Directory bit */
+#if !defined(S_IFDIR)
+# define S_IFDIR _S_IFDIR
+#endif
+
+/* Character device bit */
+#if !defined(S_IFCHR)
+# define S_IFCHR _S_IFCHR
+#endif
+
+/* Pipe bit */
+#if !defined(S_IFFIFO)
+# define S_IFFIFO _S_IFFIFO
+#endif
+
+/* Regular file bit */
+#if !defined(S_IFREG)
+# define S_IFREG _S_IFREG
+#endif
+
+/* Read permission */
+#if !defined(S_IREAD)
+# define S_IREAD _S_IREAD
+#endif
+
+/* Write permission */
+#if !defined(S_IWRITE)
+# define S_IWRITE _S_IWRITE
+#endif
+
+/* Execute permission */
+#if !defined(S_IEXEC)
+# define S_IEXEC _S_IEXEC
+#endif
+
+/* Pipe */
+#if !defined(S_IFIFO)
+# define S_IFIFO _S_IFIFO
+#endif
+
+/* Block device */
+#if !defined(S_IFBLK)
+# define S_IFBLK 0
+#endif
+
+/* Link */
+#if !defined(S_IFLNK)
+# define S_IFLNK 0
+#endif
+
+/* Socket */
+#if !defined(S_IFSOCK)
+# define S_IFSOCK 0
+#endif
+
+/* Read user permission */
+#if !defined(S_IRUSR)
+# define S_IRUSR S_IREAD
+#endif
+
+/* Write user permission */
+#if !defined(S_IWUSR)
+# define S_IWUSR S_IWRITE
+#endif
+
+/* Execute user permission */
+#if !defined(S_IXUSR)
+# define S_IXUSR 0
+#endif
+
+/* Read group permission */
+#if !defined(S_IRGRP)
+# define S_IRGRP 0
+#endif
+
+/* Write group permission */
+#if !defined(S_IWGRP)
+# define S_IWGRP 0
+#endif
+
+/* Execute group permission */
+#if !defined(S_IXGRP)
+# define S_IXGRP 0
+#endif
+
+/* Read others permission */
+#if !defined(S_IROTH)
+# define S_IROTH 0
+#endif
+
+/* Write others permission */
+#if !defined(S_IWOTH)
+# define S_IWOTH 0
+#endif
+
+/* Execute others permission */
+#if !defined(S_IXOTH)
+# define S_IXOTH 0
+#endif
+
+/* Maximum length of file name */
+#if !defined(PATH_MAX)
+# define PATH_MAX MAX_PATH
+#endif
+#if !defined(FILENAME_MAX)
+# define FILENAME_MAX MAX_PATH
+#endif
+#if !defined(NAME_MAX)
+# define NAME_MAX FILENAME_MAX
+#endif
+
+/* File type flags for d_type */
+#define DT_UNKNOWN 0
+#define DT_REG S_IFREG
+#define DT_DIR S_IFDIR
+#define DT_FIFO S_IFIFO
+#define DT_SOCK S_IFSOCK
+#define DT_CHR S_IFCHR
+#define DT_BLK S_IFBLK
+#define DT_LNK S_IFLNK
+
+/* Macros for converting between st_mode and d_type */
+#define IFTODT(mode) ((mode) & S_IFMT)
+#define DTTOIF(type) (type)
+
+/*
+ * File type macros. Note that block devices, sockets and links cannot be
+ * distinguished on Windows and the macros S_ISBLK, S_ISSOCK and S_ISLNK are
+ * only defined for compatibility. These macros should always return false
+ * on Windows.
+ */
+#if !defined(S_ISFIFO)
+# define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
+#endif
+#if !defined(S_ISDIR)
+# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
+#endif
+#if !defined(S_ISREG)
+# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
+#endif
+#if !defined(S_ISLNK)
+# define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
+#endif
+#if !defined(S_ISSOCK)
+# define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
+#endif
+#if !defined(S_ISCHR)
+# define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
+#endif
+#if !defined(S_ISBLK)
+# define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
+#endif
+
+/* Return the exact length of the file name without zero terminator */
+#define _D_EXACT_NAMLEN(p) ((p)->d_namlen)
+
+/* Return the maximum size of a file name */
+#define _D_ALLOC_NAMLEN(p) ((PATH_MAX)+1)
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Wide-character version */
+struct _wdirent {
+ /* Always zero */
+ long d_ino;
+
+ /* File position within stream */
+ long d_off;
+
+ /* Structure size */
+ unsigned short d_reclen;
+
+ /* Length of name without \0 */
+ size_t d_namlen;
+
+ /* File type */
+ int d_type;
+
+ /* File name */
+ wchar_t d_name[PATH_MAX+1];
+};
+
+struct _WDIR {
+ /* Current directory entry */
+ _wdirent ent;
+
+ /* Private file data */
+ WIN32_FIND_DATAW data;
+
+ /* True if data is valid */
+ int cached;
+
+ /* Win32 search handle */
+ HANDLE handle;
+
+ /* Initial directory name */
+ wchar_t *patt;
+};
+
+/* Multi-byte character version */
+struct dirent {
+ /* Always zero */
+ long d_ino;
+
+ /* File position within stream */
+ long d_off;
+
+ /* Structure size */
+ unsigned short d_reclen;
+
+ /* Length of name without \0 */
+ size_t d_namlen;
+
+ /* File type */
+ int d_type;
+
+ /* File name */
+ char d_name[PATH_MAX+1];
+};
+
+struct DIR {
+ struct dirent ent;
+ struct _WDIR *wdirp;
+};
+
+/* Dirent functions */
+static DIR *opendir (const char *dirname);
+static _WDIR *_wopendir (const wchar_t *dirname);
+
+static struct dirent *readdir (DIR *dirp);
+static struct _wdirent *_wreaddir (_WDIR *dirp);
+
+static int readdir_r(
+ DIR *dirp, struct dirent *entry, struct dirent **result);
+static int _wreaddir_r(
+ _WDIR *dirp, struct _wdirent *entry, struct _wdirent **result);
+
+static int closedir (DIR *dirp);
+static int _wclosedir (_WDIR *dirp);
+
+static void rewinddir (DIR* dirp);
+static void _wrewinddir (_WDIR* dirp);
+
+static int scandir (const char *dirname, struct dirent ***namelist,
+ int (*filter)(const struct dirent*),
+ int (*compare)(const struct dirent**, const struct dirent**));
+
+static int alphasort (const struct dirent **a, const struct dirent **b);
+
+static int versionsort (const struct dirent **a, const struct dirent **b);
+
+
+/* For compatibility with Symbian */
+#define wdirent _wdirent
+#define WDIR _WDIR
+#define wopendir _wopendir
+#define wreaddir _wreaddir
+#define wclosedir _wclosedir
+#define wrewinddir _wrewinddir
+
+
+/* Internal utility functions */
+static WIN32_FIND_DATAW *dirent_first (_WDIR *dirp);
+static WIN32_FIND_DATAW *dirent_next (_WDIR *dirp);
+
+static int dirent_mbstowcs_s(
+ size_t *pReturnValue,
+ wchar_t *wcstr,
+ size_t sizeInWords,
+ const char *mbstr,
+ size_t count);
+
+static int dirent_wcstombs_s(
+ size_t *pReturnValue,
+ char *mbstr,
+ size_t sizeInBytes,
+ const wchar_t *wcstr,
+ size_t count);
+
+static void dirent_set_errno (int error);
+
+
+/*
+ * Open directory stream DIRNAME for read and return a pointer to the
+ * internal working area that is used to retrieve individual directory
+ * entries.
+ */
+static _WDIR*
+_wopendir(
+ const wchar_t *dirname)
+{
+ _WDIR *dirp;
+ DWORD n;
+ wchar_t *p;
+
+ /* Must have directory name */
+ if (dirname == nullptr || dirname[0] == '\0') {
+ dirent_set_errno(ENOENT);
+ return nullptr;
+ }
+
+ /* Allocate new _WDIR structure */
+ dirp = (_WDIR*) malloc (sizeof (struct _WDIR));
+ if (!dirp) {
+ return nullptr;
+ }
+
+ /* Reset _WDIR structure */
+ dirp->handle = INVALID_HANDLE_VALUE;
+ dirp->patt = nullptr;
+ dirp->cached = 0;
+
+ /*
+ * Compute the length of full path plus zero terminator
+ *
+ * Note that on WinRT there's no way to convert relative paths
+ * into absolute paths, so just assume it is an absolute path.
+ */
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+ /* Desktop */
+ n = GetFullPathNameW(dirname, 0, nullptr, nullptr);
+#else
+ /* WinRT */
+ n = wcslen (dirname);
+#endif
+
+ /* Allocate room for absolute directory name and search pattern */
+ dirp->patt = (wchar_t*) malloc (sizeof (wchar_t) * n + 16);
+ if (dirp->patt == nullptr) {
+ goto exit_closedir;
+ }
+
+ /*
+ * Convert relative directory name to an absolute one. This
+ * allows rewinddir() to function correctly even when current
+ * working directory is changed between opendir() and rewinddir().
+ *
+ * Note that on WinRT there's no way to convert relative paths
+ * into absolute paths, so just assume it is an absolute path.
+ */
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+ /* Desktop */
+ n = GetFullPathNameW(dirname, n, dirp->patt, nullptr);
+ if (n <= 0) {
+ goto exit_closedir;
+ }
+#else
+ /* WinRT */
+ wcsncpy_s (dirp->patt, n+1, dirname, n);
+#endif
+
+ /* Append search pattern \* to the directory name */
+ p = dirp->patt + n;
+ switch (p[-1]) {
+ case '\\':
+ case '/':
+ case ':':
+ /* Directory ends in path separator, e.g. c:\temp\ */
+ /*NOP*/;
+ break;
+
+ default:
+ /* Directory name doesn't end in path separator */
+ *p++ = '\\';
+ }
+ *p++ = '*';
+ *p = '\0';
+
+ /* Open directory stream and retrieve the first entry */
+ if (!dirent_first (dirp)) {
+ goto exit_closedir;
+ }
+
+ /* Success */
+ return dirp;
+
+ /* Failure */
+exit_closedir:
+ _wclosedir (dirp);
+ return nullptr;
+}
+
+/*
+ * Read next directory entry.
+ *
+ * Returns pointer to static directory entry which may be overwritten by
+ * subsequent calls to _wreaddir().
+ */
+static struct _wdirent*
+_wreaddir(
+ _WDIR *dirp)
+{
+ struct _wdirent *entry;
+
+ /*
+ * Read directory entry to buffer. We can safely ignore the return value
+ * as entry will be set to nullptr in case of error.
+ */
+ (void) _wreaddir_r (dirp, &dirp->ent, &entry);
+
+ /* Return pointer to statically allocated directory entry */
+ return entry;
+}
+
+/*
+ * Read next directory entry.
+ *
+ * Returns zero on success. If end of directory stream is reached, then sets
+ * result to nullptr and returns zero.
+ */
+static int
+_wreaddir_r(
+ _WDIR *dirp,
+ struct _wdirent *entry,
+ struct _wdirent **result)
+{
+ WIN32_FIND_DATAW *datap;
+
+ /* Read next directory entry */
+ datap = dirent_next (dirp);
+ if (datap) {
+ size_t n;
+ DWORD attr;
+
+ /*
+ * Copy file name as wide-character string. If the file name is too
+ * long to fit in to the destination buffer, then truncate file name
+ * to PATH_MAX characters and zero-terminate the buffer.
+ */
+ n = 0;
+ while (n < PATH_MAX && datap->cFileName[n] != 0) {
+ entry->d_name[n] = datap->cFileName[n];
+ n++;
+ }
+ entry->d_name[n] = 0;
+
+ /* Length of file name excluding zero terminator */
+ entry->d_namlen = n;
+
+ /* File type */
+ attr = datap->dwFileAttributes;
+ if ((attr & FILE_ATTRIBUTE_DEVICE) != 0) {
+ entry->d_type = DT_CHR;
+ } else if ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0) {
+ entry->d_type = DT_DIR;
+ } else {
+ entry->d_type = DT_REG;
+ }
+
+ /* Reset dummy fields */
+ entry->d_ino = 0;
+ entry->d_off = 0;
+ entry->d_reclen = sizeof (struct _wdirent);
+
+ /* Set result address */
+ *result = entry;
+
+ } else {
+ /* Return nullptr to indicate end of directory */
+ *result = nullptr;
+ }
+
+ return /*OK*/0;
+}
+
+/*
+ * Close directory stream opened by opendir() function. This invalidates the
+ * DIR structure as well as any directory entry read previously by
+ * _wreaddir().
+ */
+static int
+_wclosedir(
+ _WDIR *dirp)
+{
+ int ok;
+ if (dirp) {
+
+ /* Release search handle */
+ if (dirp->handle != INVALID_HANDLE_VALUE) {
+ FindClose (dirp->handle);
+ }
+
+ /* Release search pattern */
+ free (dirp->patt);
+
+ /* Release directory structure */
+ free (dirp);
+ ok = /*success*/0;
+
+ } else {
+
+ /* Invalid directory stream */
+ dirent_set_errno (EBADF);
+ ok = /*failure*/-1;
+
+ }
+ return ok;
+}
+
+/*
+ * Rewind directory stream such that _wreaddir() returns the very first
+ * file name again.
+ */
+static void
+_wrewinddir(
+ _WDIR* dirp)
+{
+ if (dirp) {
+ /* Release existing search handle */
+ if (dirp->handle != INVALID_HANDLE_VALUE) {
+ FindClose (dirp->handle);
+ }
+
+ /* Open new search handle */
+ dirent_first (dirp);
+ }
+}
+
+/* Get first directory entry (internal) */
+static WIN32_FIND_DATAW*
+dirent_first(
+ _WDIR *dirp)
+{
+ WIN32_FIND_DATAW *datap;
+ DWORD error;
+
+ /* Open directory and retrieve the first entry */
+ dirp->handle = FindFirstFileExW(dirp->patt, FindExInfoStandard, &dirp->data,
+ FindExSearchNameMatch, nullptr, 0);
+ if (dirp->handle != INVALID_HANDLE_VALUE) {
+
+ /* a directory entry is now waiting in memory */
+ datap = &dirp->data;
+ dirp->cached = 1;
+
+ } else {
+
+ /* Failed to open directory: no directory entry in memory */
+ dirp->cached = 0;
+ datap = nullptr;
+
+ /* Set error code */
+ error = GetLastError ();
+ switch (error) {
+ case ERROR_ACCESS_DENIED:
+ /* No read access to directory */
+ dirent_set_errno (EACCES);
+ break;
+
+ case ERROR_DIRECTORY:
+ /* Directory name is invalid */
+ dirent_set_errno (ENOTDIR);
+ break;
+
+ case ERROR_PATH_NOT_FOUND:
+ default:
+ /* Cannot find the file */
+ dirent_set_errno (ENOENT);
+ }
+
+ }
+ return datap;
+}
+
+/*
+ * Get next directory entry (internal).
+ *
+ * Returns
+ */
+static WIN32_FIND_DATAW*
+dirent_next(
+ _WDIR *dirp)
+{
+ WIN32_FIND_DATAW *p;
+
+ /* Get next directory entry */
+ if (dirp->cached != 0) {
+
+ /* A valid directory entry already in memory */
+ p = &dirp->data;
+ dirp->cached = 0;
+
+ } else if (dirp->handle != INVALID_HANDLE_VALUE) {
+
+ /* Get the next directory entry from stream */
+ if (FindNextFileW (dirp->handle, &dirp->data) != FALSE) {
+ /* Got a file */
+ p = &dirp->data;
+ } else {
+ /* The very last entry has been processed or an error occurred */
+ FindClose (dirp->handle);
+ dirp->handle = INVALID_HANDLE_VALUE;
+ p = nullptr;
+ }
+
+ } else {
+
+ /* End of directory stream reached */
+ p = nullptr;
+ }
+
+ return p;
+}
+
+/*
+ * Open directory stream using plain old C-string.
+ */
+static DIR*
+opendir(
+ const char *dirname)
+{
+ struct DIR *dirp;
+
+ /* Must have directory name */
+ if (dirname == nullptr || dirname[0] == '\0') {
+ dirent_set_errno (ENOENT);
+ return nullptr;
+ }
+
+ /* Allocate memory for DIR structure */
+ dirp = (DIR*) malloc (sizeof (struct DIR));
+ if (!dirp) {
+ return nullptr;
+ }
+ {
+ int error;
+ wchar_t wname[PATH_MAX + 1];
+ size_t n;
+
+ /* Convert directory name to wide-character string */
+ error = dirent_mbstowcs_s(
+ &n, wname, PATH_MAX + 1, dirname, PATH_MAX + 1);
+ if (error) {
+ /*
+ * Cannot convert file name to wide-character string. This
+ * occurs if the string contains invalid multi-byte sequences or
+ * the output buffer is too small to contain the resulting
+ * string.
+ */
+ goto exit_free;
+ }
+
+
+ /* Open directory stream using wide-character name */
+ dirp->wdirp = _wopendir (wname);
+ if (!dirp->wdirp) {
+ goto exit_free;
+ }
+
+ }
+
+ /* Success */
+ return dirp;
+
+ /* Failure */
+exit_free:
+ free (dirp);
+ return nullptr;
+}
+
+/*
+ * Read next directory entry.
+ */
+static struct dirent*
+readdir(
+ DIR *dirp)
+{
+ struct dirent *entry;
+
+ /*
+ * Read directory entry to buffer. We can safely ignore the return value
+ * as entry will be set to nullptr in case of error.
+ */
+ (void) readdir_r (dirp, &dirp->ent, &entry);
+
+ /* Return pointer to statically allocated directory entry */
+ return entry;
+}
+
+/*
+ * Read next directory entry into called-allocated buffer.
+ *
+ * Returns zero on success. If the end of directory stream is reached, then
+ * sets result to nullptr and returns zero.
+ */
+static int
+readdir_r(
+ DIR *dirp,
+ struct dirent *entry,
+ struct dirent **result)
+{
+ WIN32_FIND_DATAW *datap;
+
+ /* Read next directory entry */
+ datap = dirent_next (dirp->wdirp);
+ if (datap) {
+ size_t n;
+ int error;
+
+ /* Attempt to convert file name to multi-byte string */
+ error = dirent_wcstombs_s(
+ &n, entry->d_name, PATH_MAX + 1, datap->cFileName, PATH_MAX + 1);
+
+ /*
+ * If the file name cannot be represented by a multi-byte string,
+ * then attempt to use old 8+3 file name. This allows traditional
+ * Unix-code to access some file names despite of unicode
+ * characters, although file names may seem unfamiliar to the user.
+ *
+ * Be ware that the code below cannot come up with a short file
+ * name unless the file system provides one. At least
+ * VirtualBox shared folders fail to do this.
+ */
+ if (error && datap->cAlternateFileName[0] != '\0') {
+ error = dirent_wcstombs_s(
+ &n, entry->d_name, PATH_MAX + 1,
+ datap->cAlternateFileName, PATH_MAX + 1);
+ }
+
+ if (!error) {
+ DWORD attr;
+
+ /* Length of file name excluding zero terminator */
+ entry->d_namlen = n - 1;
+
+ /* File attributes */
+ attr = datap->dwFileAttributes;
+ if ((attr & FILE_ATTRIBUTE_DEVICE) != 0) {
+ entry->d_type = DT_CHR;
+ } else if ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0) {
+ entry->d_type = DT_DIR;
+ } else {
+ entry->d_type = DT_REG;
+ }
+
+ /* Reset dummy fields */
+ entry->d_ino = 0;
+ entry->d_off = 0;
+ entry->d_reclen = sizeof (struct dirent);
+
+ } else {
+ /*
+ * Cannot convert file name to multi-byte string so construct
+ * an erroneous directory entry and return that. Note that
+ * we cannot return nullptr as that would stop the processing
+ * of directory entries completely.
+ */
+ entry->d_name[0] = '?';
+ entry->d_name[1] = '\0';
+ entry->d_namlen = 1;
+ entry->d_type = DT_UNKNOWN;
+ entry->d_ino = 0;
+ entry->d_off = -1;
+ entry->d_reclen = 0;
+
+ }
+
+ /* Return pointer to directory entry */
+ *result = entry;
+
+ } else {
+
+ /* No more directory entries */
+ *result = nullptr;
+ }
+
+ return /*OK*/0;
+}
+
+/*
+ * Close directory stream.
+ */
+static int
+closedir(
+ DIR *dirp)
+{
+ int ok;
+ if (dirp) {
+
+ /* Close wide-character directory stream */
+ ok = _wclosedir (dirp->wdirp);
+ dirp->wdirp = nullptr;
+
+ /* Release multi-byte character version */
+ free (dirp);
+
+ } else {
+
+ /* Invalid directory stream */
+ dirent_set_errno (EBADF);
+ ok = /*failure*/-1;
+
+ }
+ return ok;
+}
+
+/*
+ * Rewind directory stream to beginning.
+ */
+static void
+rewinddir(
+ DIR* dirp)
+{
+ /* Rewind wide-character string directory stream */
+ _wrewinddir (dirp->wdirp);
+}
+
+/*
+ * Scan directory for entries.
+ */
+static int
+scandir(
+ const char *dirname,
+ struct dirent ***namelist,
+ int (*filter)(const struct dirent*),
+ int (*compare)(const struct dirent**, const struct dirent**))
+{
+ struct dirent **files = nullptr;
+ size_t size = 0;
+ size_t allocated = 0;
+ const size_t init_size = 1;
+ DIR *dir = nullptr;
+ struct dirent *entry;
+ struct dirent *tmp = nullptr;
+ size_t i;
+ int result = 0;
+
+ /* Open directory stream */
+ dir = opendir (dirname);
+ if (dir) {
+
+ /* Read directory entries to memory */
+ while (1) {
+
+ /* Enlarge pointer table to make room for another pointer */
+ if (size >= allocated) {
+ void *p;
+ size_t num_entries;
+
+ /* Compute number of entries in the enlarged pointer table */
+ if (size < init_size) {
+ /* Allocate initial pointer table */
+ num_entries = init_size;
+ } else {
+ /* Double the size */
+ num_entries = size * 2;
+ }
+
+ /* Allocate first pointer table or enlarge existing table */
+ p = realloc (files, sizeof (void*) * num_entries);
+ if (p != nullptr) {
+ /* Got the memory */
+ files = (dirent**) p;
+ allocated = num_entries;
+ } else {
+ /* Out of memory */
+ result = -1;
+ break;
+ }
+ }
+
+ /* Allocate room for temporary directory entry */
+ if (tmp == nullptr) {
+ tmp = (struct dirent*) malloc (sizeof (struct dirent));
+ if (tmp == nullptr) {
+ /* Cannot allocate temporary directory entry */
+ result = -1;
+ break;
+ }
+ }
+
+ /* Read directory entry to temporary area */
+ if (readdir_r (dir, tmp, &entry) == /*OK*/0) {
+
+ /* Did we get an entry? */
+ if (entry != nullptr) {
+ int pass;
+
+ /* Determine whether to include the entry in result */
+ if (filter) {
+ /* Let the filter function decide */
+ pass = filter (tmp);
+ } else {
+ /* No filter function, include everything */
+ pass = 1;
+ }
+
+ if (pass) {
+ /* Store the temporary entry to pointer table */
+ files[size++] = tmp;
+ tmp = nullptr;
+
+ /* Keep up with the number of files */
+ result++;
+ }
+
+ } else {
+ /*
+ * End of directory stream reached => sort entries and
+ * exit.
+ */
+ qsort (files, size, sizeof (void*),
+ (int (*) (const void*, const void*)) compare);
+ break;
+ }
+
+ } else {
+ /* Error reading directory entry */
+ result = /*Error*/ -1;
+ break;
+ }
+
+ }
+
+ } else {
+ /* Cannot open directory */
+ result = /*Error*/ -1;
+ }
+
+ /* Release temporary directory entry */
+ free (tmp);
+
+ /* Release allocated memory on error */
+ if (result < 0) {
+ for (i = 0; i < size; i++) {
+ free (files[i]);
+ }
+ free (files);
+ files = nullptr;
+ }
+
+ /* Close directory stream */
+ if (dir) {
+ closedir (dir);
+ }
+
+ /* Pass pointer table to caller */
+ if (namelist) {
+ *namelist = files;
+ }
+ return result;
+}
+
+/* Alphabetical sorting */
+static int
+alphasort(
+ const struct dirent **a, const struct dirent **b)
+{
+ return strcoll ((*a)->d_name, (*b)->d_name);
+}
+
+/* Sort versions */
+static int
+versionsort(
+ const struct dirent **a, const struct dirent **b)
+{
+ /* FIXME: implement strverscmp and use that */
+ return alphasort (a, b);
+}
+
+/* Convert multi-byte string to wide character string */
+static int
+dirent_mbstowcs_s(
+ size_t *pReturnValue,
+ wchar_t *wcstr,
+ size_t sizeInWords,
+ const char *mbstr,
+ size_t count)
+{
+ int error;
+
+#if defined(_MSC_VER) && _MSC_VER >= 1400
+
+ /* Microsoft Visual Studio 2005 or later */
+ error = mbstowcs_s (pReturnValue, wcstr, sizeInWords, mbstr, count);
+
+#else
+
+ /* Older Visual Studio or non-Microsoft compiler */
+ size_t n;
+
+ /* Convert to wide-character string (or count characters) */
+ n = mbstowcs (wcstr, mbstr, sizeInWords);
+ if (!wcstr || n < count) {
+
+ /* Zero-terminate output buffer */
+ if (wcstr && sizeInWords) {
+ if (n >= sizeInWords) {
+ n = sizeInWords - 1;
+ }
+ wcstr[n] = 0;
+ }
+
+ /* Length of resulting multi-byte string WITH zero terminator */
+ if (pReturnValue) {
+ *pReturnValue = n + 1;
+ }
+
+ /* Success */
+ error = 0;
+
+ } else {
+
+ /* Could not convert string */
+ error = 1;
+
+ }
+
+#endif
+ return error;
+}
+
+/* Convert wide-character string to multi-byte string */
+static int
+dirent_wcstombs_s(
+ size_t *pReturnValue,
+ char *mbstr,
+ size_t sizeInBytes, /* max size of mbstr */
+ const wchar_t *wcstr,
+ size_t count)
+{
+ int error;
+
+#if defined(_MSC_VER) && _MSC_VER >= 1400
+
+ /* Microsoft Visual Studio 2005 or later */
+ error = wcstombs_s (pReturnValue, mbstr, sizeInBytes, wcstr, count);
+
+#else
+
+ /* Older Visual Studio or non-Microsoft compiler */
+ size_t n;
+
+ /* Convert to multi-byte string (or count the number of bytes needed) */
+ n = wcstombs (mbstr, wcstr, sizeInBytes);
+ if (!mbstr || n < count) {
+
+ /* Zero-terminate output buffer */
+ if (mbstr && sizeInBytes) {
+ if (n >= sizeInBytes) {
+ n = sizeInBytes - 1;
+ }
+ mbstr[n] = '\0';
+ }
+
+ /* Length of resulting multi-bytes string WITH zero-terminator */
+ if (pReturnValue) {
+ *pReturnValue = n + 1;
+ }
+
+ /* Success */
+ error = 0;
+
+ } else {
+
+ /* Cannot convert string */
+ error = 1;
+
+ }
+
+#endif
+ return error;
+}
+
+/* Set errno variable */
+static void
+dirent_set_errno(
+ int error)
+{
+#if defined(_MSC_VER) && _MSC_VER >= 1400
+
+ /* Microsoft Visual Studio 2005 and later */
+ _set_errno (error);
+
+#else
+
+ /* Non-Microsoft compiler or older Microsoft compiler */
+ errno = error;
+
+#endif
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*DIRENT_H*/
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/windows/port.cc b/funasr/runtime/onnxruntime/third_party/glog/src/windows/port.cc
new file mode 100755
index 0000000..f80a54a
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/windows/port.cc
@@ -0,0 +1,75 @@
+/* Copyright (c) 2008, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ---
+ * Author: Craig Silverstein
+ * Copied from google-perftools and modified by Shinichiro Hamaji
+ */
+
+#ifndef _WIN32
+# error You should only be including windows/port.cc in a windows environment!
+#endif
+
+#include "port.h"
+
+#include <cstdarg> // for va_list, va_start, va_end
+#include <ctime>
+
+#include "config.h"
+
+// These call the windows _vsnprintf, but always NUL-terminate.
+int safe_vsnprintf(char* str, std::size_t size, const char* format,
+ va_list ap) {
+ if (size == 0) // not even room for a \0?
+ return -1; // not what C99 says to do, but what windows does
+ str[size-1] = '\0';
+ return _vsnprintf(str, size-1, format, ap);
+}
+
+#ifndef HAVE_LOCALTIME_R
+struct tm* localtime_r(const std::time_t* timep, std::tm* result) {
+ localtime_s(result, timep);
+ return result;
+}
+#endif // not HAVE_LOCALTIME_R
+#ifndef HAVE_GMTIME_R
+struct tm* gmtime_r(const std::time_t* timep, std::tm* result) {
+ gmtime_s(result, timep);
+ return result;
+}
+#endif // not HAVE_GMTIME_R
+#ifndef HAVE_SNPRINTF
+int snprintf(char *str, size_t size, const char *format, ...) {
+ va_list ap;
+ va_start(ap, format);
+ const int r = vsnprintf(str, size, format, ap);
+ va_end(ap);
+ return r;
+}
+#endif
diff --git a/funasr/runtime/onnxruntime/third_party/glog/src/windows/port.h b/funasr/runtime/onnxruntime/third_party/glog/src/windows/port.h
new file mode 100755
index 0000000..9611e10
--- /dev/null
+++ b/funasr/runtime/onnxruntime/third_party/glog/src/windows/port.h
@@ -0,0 +1,181 @@
+/* Copyright (c) 2023, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ---
+ * Author: Craig Silverstein
+ * Copied from google-perftools and modified by Shinichiro Hamaji
+ *
+ * These are some portability typedefs and defines to make it a bit
+ * easier to compile this code under VC++.
+ *
+ * Several of these are taken from glib:
+ * http://developer.gnome.org/doc/API/glib/glib-windows-compatability-functions.html
+ */
+
+#ifndef CTEMPLATE_WINDOWS_PORT_H_
+#define CTEMPLATE_WINDOWS_PORT_H_
+
+#include "config.h"
+
+#ifdef _WIN32
+
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN /* We always want minimal includes */
+#endif
+
+#include <windows.h>
+#include <winsock.h> /* for gethostname */
+#include <io.h> /* because we so often use open/close/etc */
+#include <direct.h> /* for _getcwd() */
+#include <process.h> /* for _getpid() */
+#include <cstdarg> /* template_dictionary.cc uses va_copy */
+#include <cstdio> /* read in vsnprintf decl. before redifining it */
+#include <cstring> /* for _strnicmp(), strerror_s() */
+#include <ctime> /* for localtime_s() */
+/* Note: the C++ #includes are all together at the bottom. This file is
+ * used by both C and C++ code, so we put all the C++ together.
+ */
+
+#include <glog/logging.h>
+
+#ifdef _MSC_VER
+
+/* 4244: otherwise we get problems when substracting two size_t's to an int
+ * 4251: it's complaining about a private struct I've chosen not to dllexport
+ * 4355: we use this in a constructor, but we do it safely
+ * 4715: for some reason VC++ stopped realizing you can't return after abort()
+ * 4800: we know we're casting ints/char*'s to bools, and we're ok with that
+ * 4996: Yes, we're ok using "unsafe" functions like fopen() and strerror()
+ * 4312: Converting uint32_t to a pointer when testing %p
+ * 4267: also subtracting two size_t to int
+ * 4722: Destructor never returns due to abort()
+ */
+#pragma warning(disable:4244 4251 4355 4715 4800 4996 4267 4312 4722)
+
+/* file I/O */
+#define PATH_MAX 1024
+#define access _access
+#define getcwd _getcwd
+#define open _open
+#define read _read
+#define write(fd, p, n) _write(fd, p, n)
+#define lseek _lseek
+#define close _close
+#define popen _popen
+#define pclose _pclose
+#define R_OK 04 /* read-only (for access()) */
+#define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
+
+#define O_WRONLY _O_WRONLY
+#define O_CREAT _O_CREAT
+#define O_EXCL _O_EXCL
+
+#ifndef __MINGW32__
+enum { STDIN_FILENO = 0, STDOUT_FILENO = 1, STDERR_FILENO = 2 };
+#endif
+#define S_IRUSR S_IREAD
+#define S_IWUSR S_IWRITE
+
+/* Not quite as lightweight as a hard-link, but more than good enough for us. */
+#define link(oldpath, newpath) CopyFileA(oldpath, newpath, false)
+
+#define strcasecmp _stricmp
+#define strncasecmp _strnicmp
+
+/* In windows-land, hash<> is called hash_compare<> (from xhash.h) */
+/* VC11 provides std::hash */
+#if defined(_MSC_VER) && (_MSC_VER < 1700)
+#define hash hash_compare
+#endif
+
+/* Sleep is in ms, on windows */
+#define sleep(secs) Sleep((secs) * 1000)
+
+/* We can't just use _vsnprintf and _snprintf as drop-in-replacements,
+ * because they don't always NUL-terminate. :-( We also can't use the
+ * name vsnprintf, since windows defines that (but not snprintf (!)).
+ */
+#ifndef HAVE_SNPRINTF
+extern int GLOG_EXPORT snprintf(char* str, size_t size, const char* format,
+ ...);
+#endif
+extern int GLOG_EXPORT safe_vsnprintf(char* str, size_t size,
+ const char* format, va_list ap);
+#define vsnprintf(str, size, format, ap) safe_vsnprintf(str, size, format, ap)
+#ifndef va_copy
+#define va_copy(dst, src) (dst) = (src)
+#endif
+
+/* Windows doesn't support specifying the number of buckets as a
+ * hash_map constructor arg, so we leave this blank.
+ */
+#define CTEMPLATE_SMALL_HASHTABLE
+
+#define DEFAULT_TEMPLATE_ROOTDIR ".."
+
+// ----------------------------------- SYSTEM/PROCESS
+typedef int pid_t;
+#define getpid _getpid
+
+#endif // _MSC_VER
+
+// ----------------------------------- THREADS
+#if defined(HAVE_PTHREAD)
+# include <pthread.h>
+#else // no PTHREAD
+typedef DWORD pthread_t;
+typedef DWORD pthread_key_t;
+typedef LONG pthread_once_t;
+enum { PTHREAD_ONCE_INIT = 0 }; // important that this be 0! for SpinLock
+#define pthread_self GetCurrentThreadId
+#define pthread_equal(pthread_t_1, pthread_t_2) ((pthread_t_1)==(pthread_t_2))
+#endif // HAVE_PTHREAD
+
+#ifndef HAVE_LOCALTIME_R
+extern GLOG_EXPORT std::tm* localtime_r(const std::time_t* timep,
+ std::tm* result);
+#endif // not HAVE_LOCALTIME_R
+
+#ifndef HAVE_GMTIME_R
+extern GLOG_EXPORT std::tm* gmtime_r(const std::time_t* timep, std::tm* result);
+#endif // not HAVE_GMTIME_R
+
+inline char* strerror_r(int errnum, char* buf, std::size_t buflen) {
+ strerror_s(buf, buflen, errnum);
+ return buf;
+}
+
+#ifndef __cplusplus
+/* I don't see how to get inlining for C code in MSVC. Ah well. */
+#define inline
+#endif
+
+#endif /* _WIN32 */
+
+#endif /* CTEMPLATE_WINDOWS_PORT_H_ */
diff --git a/funasr/runtime/onnxruntime/win/bin/x64/libfftw3-3.dll b/funasr/runtime/onnxruntime/win/bin/x64/libfftw3-3.dll
deleted file mode 100644
index 75080e4..0000000
--- a/funasr/runtime/onnxruntime/win/bin/x64/libfftw3-3.dll
+++ /dev/null
Binary files differ
diff --git a/funasr/runtime/onnxruntime/win/bin/x64/libfftw3f-3.dll b/funasr/runtime/onnxruntime/win/bin/x64/libfftw3f-3.dll
deleted file mode 100644
index 32a3fcf..0000000
--- a/funasr/runtime/onnxruntime/win/bin/x64/libfftw3f-3.dll
+++ /dev/null
Binary files differ
diff --git a/funasr/runtime/onnxruntime/win/bin/x64/libfftw3l-3.dll b/funasr/runtime/onnxruntime/win/bin/x64/libfftw3l-3.dll
deleted file mode 100644
index 3e46d34..0000000
--- a/funasr/runtime/onnxruntime/win/bin/x64/libfftw3l-3.dll
+++ /dev/null
Binary files differ
diff --git a/funasr/runtime/onnxruntime/win/bin/x64/onnxruntime.dll b/funasr/runtime/onnxruntime/win/bin/x64/onnxruntime.dll
deleted file mode 100644
index 087a1b4..0000000
--- a/funasr/runtime/onnxruntime/win/bin/x64/onnxruntime.dll
+++ /dev/null
Binary files differ
diff --git a/funasr/runtime/onnxruntime/win/bin/x86/libfftw3-3.dll b/funasr/runtime/onnxruntime/win/bin/x86/libfftw3-3.dll
deleted file mode 100644
index f5a97b4..0000000
--- a/funasr/runtime/onnxruntime/win/bin/x86/libfftw3-3.dll
+++ /dev/null
Binary files differ
diff --git a/funasr/runtime/onnxruntime/win/bin/x86/libfftw3f-3.dll b/funasr/runtime/onnxruntime/win/bin/x86/libfftw3f-3.dll
deleted file mode 100644
index b0a053a..0000000
--- a/funasr/runtime/onnxruntime/win/bin/x86/libfftw3f-3.dll
+++ /dev/null
Binary files differ
diff --git a/funasr/runtime/onnxruntime/win/bin/x86/libfftw3l-3.dll b/funasr/runtime/onnxruntime/win/bin/x86/libfftw3l-3.dll
deleted file mode 100644
index abc81ea..0000000
--- a/funasr/runtime/onnxruntime/win/bin/x86/libfftw3l-3.dll
+++ /dev/null
Binary files differ
diff --git a/funasr/runtime/onnxruntime/win/bin/x86/onnxruntime.dll b/funasr/runtime/onnxruntime/win/bin/x86/onnxruntime.dll
deleted file mode 100644
index e284b45..0000000
--- a/funasr/runtime/onnxruntime/win/bin/x86/onnxruntime.dll
+++ /dev/null
Binary files differ
diff --git a/funasr/runtime/onnxruntime/win/images/sample.png b/funasr/runtime/onnxruntime/win/images/sample.png
deleted file mode 100644
index cbd7cd3..0000000
--- a/funasr/runtime/onnxruntime/win/images/sample.png
+++ /dev/null
Binary files differ
diff --git a/funasr/runtime/onnxruntime/win/include/cpu_provider_factory.h b/funasr/runtime/onnxruntime/win/include/cpu_provider_factory.h
deleted file mode 100644
index 2926786..0000000
--- a/funasr/runtime/onnxruntime/win/include/cpu_provider_factory.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-#include "onnxruntime_c_api.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \param use_arena zero: false. non-zero: true.
- */
-ORT_EXPORT
-ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_CPU, _In_ OrtSessionOptions* options, int use_arena)
-ORT_ALL_ARGS_NONNULL;
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/funasr/runtime/onnxruntime/win/include/fftw3.h b/funasr/runtime/onnxruntime/win/include/fftw3.h
deleted file mode 100644
index 39661d2..0000000
--- a/funasr/runtime/onnxruntime/win/include/fftw3.h
+++ /dev/null
@@ -1,415 +0,0 @@
-/*
- * Copyright (c) 2003, 2007-14 Matteo Frigo
- * Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
- *
- * The following statement of license applies *only* to this header file,
- * and *not* to the other files distributed with FFTW or derived therefrom:
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/***************************** NOTE TO USERS *********************************
- *
- * THIS IS A HEADER FILE, NOT A MANUAL
- *
- * If you want to know how to use FFTW, please read the manual,
- * online at http://www.fftw.org/doc/ and also included with FFTW.
- * For a quick start, see the manual's tutorial section.
- *
- * (Reading header files to learn how to use a library is a habit
- * stemming from code lacking a proper manual. Arguably, it's a
- * *bad* habit in most cases, because header files can contain
- * interfaces that are not part of the public, stable API.)
- *
- ****************************************************************************/
-
-#ifndef FFTW3_H
-#define FFTW3_H
-
-#include <stdio.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-/* If <complex.h> is included, use the C99 complex type. Otherwise
- define a type bit-compatible with C99 complex */
-#if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined(complex) && defined(I)
-# define FFTW_DEFINE_COMPLEX(R, C) typedef R _Complex C
-#else
-# define FFTW_DEFINE_COMPLEX(R, C) typedef R C[2]
-#endif
-
-#define FFTW_CONCAT(prefix, name) prefix ## name
-#define FFTW_MANGLE_DOUBLE(name) FFTW_CONCAT(fftw_, name)
-#define FFTW_MANGLE_FLOAT(name) FFTW_CONCAT(fftwf_, name)
-#define FFTW_MANGLE_LONG_DOUBLE(name) FFTW_CONCAT(fftwl_, name)
-#define FFTW_MANGLE_QUAD(name) FFTW_CONCAT(fftwq_, name)
-
-/* IMPORTANT: for Windows compilers, you should add a line
-*/
-#define FFTW_DLL
-/*
- here and in kernel/ifftw.h if you are compiling/using FFTW as a
- DLL, in order to do the proper importing/exporting, or
- alternatively compile with -DFFTW_DLL or the equivalent
- command-line flag. This is not necessary under MinGW/Cygwin, where
- libtool does the imports/exports automatically. */
-#if defined(FFTW_DLL) && (defined(_WIN32) || defined(__WIN32__))
- /* annoying Windows syntax for shared-library declarations */
-# if defined(COMPILING_FFTW) /* defined in api.h when compiling FFTW */
-# define FFTW_EXTERN extern __declspec(dllexport)
-# else /* user is calling FFTW; import symbol */
-# define FFTW_EXTERN extern __declspec(dllimport)
-# endif
-#else
-# define FFTW_EXTERN extern
-#endif
-
-enum fftw_r2r_kind_do_not_use_me {
- FFTW_R2HC=0, FFTW_HC2R=1, FFTW_DHT=2,
- FFTW_REDFT00=3, FFTW_REDFT01=4, FFTW_REDFT10=5, FFTW_REDFT11=6,
- FFTW_RODFT00=7, FFTW_RODFT01=8, FFTW_RODFT10=9, FFTW_RODFT11=10
-};
-
-struct fftw_iodim_do_not_use_me {
- int n; /* dimension size */
- int is; /* input stride */
- int os; /* output stride */
-};
-
-#include <stddef.h> /* for ptrdiff_t */
-struct fftw_iodim64_do_not_use_me {
- ptrdiff_t n; /* dimension size */
- ptrdiff_t is; /* input stride */
- ptrdiff_t os; /* output stride */
-};
-
-typedef void (*fftw_write_char_func_do_not_use_me)(char c, void *);
-typedef int (*fftw_read_char_func_do_not_use_me)(void *);
-
-/*
- huge second-order macro that defines prototypes for all API
- functions. We expand this macro for each supported precision
-
- X: name-mangling macro
- R: real data type
- C: complex data type
-*/
-
-#define FFTW_DEFINE_API(X, R, C) \
- \
-FFTW_DEFINE_COMPLEX(R, C); \
- \
-typedef struct X(plan_s) *X(plan); \
- \
-typedef struct fftw_iodim_do_not_use_me X(iodim); \
-typedef struct fftw_iodim64_do_not_use_me X(iodim64); \
- \
-typedef enum fftw_r2r_kind_do_not_use_me X(r2r_kind); \
- \
-typedef fftw_write_char_func_do_not_use_me X(write_char_func); \
-typedef fftw_read_char_func_do_not_use_me X(read_char_func); \
- \
-FFTW_EXTERN void X(execute)(const X(plan) p); \
- \
-FFTW_EXTERN X(plan) X(plan_dft)(int rank, const int *n, \
- C *in, C *out, int sign, unsigned flags); \
- \
-FFTW_EXTERN X(plan) X(plan_dft_1d)(int n, C *in, C *out, int sign, \
- unsigned flags); \
-FFTW_EXTERN X(plan) X(plan_dft_2d)(int n0, int n1, \
- C *in, C *out, int sign, unsigned flags); \
-FFTW_EXTERN X(plan) X(plan_dft_3d)(int n0, int n1, int n2, \
- C *in, C *out, int sign, unsigned flags); \
- \
-FFTW_EXTERN X(plan) X(plan_many_dft)(int rank, const int *n, \
- int howmany, \
- C *in, const int *inembed, \
- int istride, int idist, \
- C *out, const int *onembed, \
- int ostride, int odist, \
- int sign, unsigned flags); \
- \
-FFTW_EXTERN X(plan) X(plan_guru_dft)(int rank, const X(iodim) *dims, \
- int howmany_rank, \
- const X(iodim) *howmany_dims, \
- C *in, C *out, \
- int sign, unsigned flags); \
-FFTW_EXTERN X(plan) X(plan_guru_split_dft)(int rank, const X(iodim) *dims, \
- int howmany_rank, \
- const X(iodim) *howmany_dims, \
- R *ri, R *ii, R *ro, R *io, \
- unsigned flags); \
- \
-FFTW_EXTERN X(plan) X(plan_guru64_dft)(int rank, \
- const X(iodim64) *dims, \
- int howmany_rank, \
- const X(iodim64) *howmany_dims, \
- C *in, C *out, \
- int sign, unsigned flags); \
-FFTW_EXTERN X(plan) X(plan_guru64_split_dft)(int rank, \
- const X(iodim64) *dims, \
- int howmany_rank, \
- const X(iodim64) *howmany_dims, \
- R *ri, R *ii, R *ro, R *io, \
- unsigned flags); \
- \
-FFTW_EXTERN void X(execute_dft)(const X(plan) p, C *in, C *out); \
-FFTW_EXTERN void X(execute_split_dft)(const X(plan) p, R *ri, R *ii, \
- R *ro, R *io); \
- \
-FFTW_EXTERN X(plan) X(plan_many_dft_r2c)(int rank, const int *n, \
- int howmany, \
- R *in, const int *inembed, \
- int istride, int idist, \
- C *out, const int *onembed, \
- int ostride, int odist, \
- unsigned flags); \
- \
-FFTW_EXTERN X(plan) X(plan_dft_r2c)(int rank, const int *n, \
- R *in, C *out, unsigned flags); \
- \
-FFTW_EXTERN X(plan) X(plan_dft_r2c_1d)(int n,R *in,C *out,unsigned flags); \
-FFTW_EXTERN X(plan) X(plan_dft_r2c_2d)(int n0, int n1, \
- R *in, C *out, unsigned flags); \
-FFTW_EXTERN X(plan) X(plan_dft_r2c_3d)(int n0, int n1, \
- int n2, \
- R *in, C *out, unsigned flags); \
- \
- \
-FFTW_EXTERN X(plan) X(plan_many_dft_c2r)(int rank, const int *n, \
- int howmany, \
- C *in, const int *inembed, \
- int istride, int idist, \
- R *out, const int *onembed, \
- int ostride, int odist, \
- unsigned flags); \
- \
-FFTW_EXTERN X(plan) X(plan_dft_c2r)(int rank, const int *n, \
- C *in, R *out, unsigned flags); \
- \
-FFTW_EXTERN X(plan) X(plan_dft_c2r_1d)(int n,C *in,R *out,unsigned flags); \
-FFTW_EXTERN X(plan) X(plan_dft_c2r_2d)(int n0, int n1, \
- C *in, R *out, unsigned flags); \
-FFTW_EXTERN X(plan) X(plan_dft_c2r_3d)(int n0, int n1, \
- int n2, \
- C *in, R *out, unsigned flags); \
- \
-FFTW_EXTERN X(plan) X(plan_guru_dft_r2c)(int rank, const X(iodim) *dims, \
- int howmany_rank, \
- const X(iodim) *howmany_dims, \
- R *in, C *out, \
- unsigned flags); \
-FFTW_EXTERN X(plan) X(plan_guru_dft_c2r)(int rank, const X(iodim) *dims, \
- int howmany_rank, \
- const X(iodim) *howmany_dims, \
- C *in, R *out, \
- unsigned flags); \
- \
-FFTW_EXTERN X(plan) X(plan_guru_split_dft_r2c)( \
- int rank, const X(iodim) *dims, \
- int howmany_rank, \
- const X(iodim) *howmany_dims, \
- R *in, R *ro, R *io, \
- unsigned flags); \
-FFTW_EXTERN X(plan) X(plan_guru_split_dft_c2r)( \
- int rank, const X(iodim) *dims, \
- int howmany_rank, \
- const X(iodim) *howmany_dims, \
- R *ri, R *ii, R *out, \
- unsigned flags); \
- \
-FFTW_EXTERN X(plan) X(plan_guru64_dft_r2c)(int rank, \
- const X(iodim64) *dims, \
- int howmany_rank, \
- const X(iodim64) *howmany_dims, \
- R *in, C *out, \
- unsigned flags); \
-FFTW_EXTERN X(plan) X(plan_guru64_dft_c2r)(int rank, \
- const X(iodim64) *dims, \
- int howmany_rank, \
- const X(iodim64) *howmany_dims, \
- C *in, R *out, \
- unsigned flags); \
- \
-FFTW_EXTERN X(plan) X(plan_guru64_split_dft_r2c)( \
- int rank, const X(iodim64) *dims, \
- int howmany_rank, \
- const X(iodim64) *howmany_dims, \
- R *in, R *ro, R *io, \
- unsigned flags); \
-FFTW_EXTERN X(plan) X(plan_guru64_split_dft_c2r)( \
- int rank, const X(iodim64) *dims, \
- int howmany_rank, \
- const X(iodim64) *howmany_dims, \
- R *ri, R *ii, R *out, \
- unsigned flags); \
- \
-FFTW_EXTERN void X(execute_dft_r2c)(const X(plan) p, R *in, C *out); \
-FFTW_EXTERN void X(execute_dft_c2r)(const X(plan) p, C *in, R *out); \
- \
-FFTW_EXTERN void X(execute_split_dft_r2c)(const X(plan) p, \
- R *in, R *ro, R *io); \
-FFTW_EXTERN void X(execute_split_dft_c2r)(const X(plan) p, \
- R *ri, R *ii, R *out); \
- \
-FFTW_EXTERN X(plan) X(plan_many_r2r)(int rank, const int *n, \
- int howmany, \
- R *in, const int *inembed, \
- int istride, int idist, \
- R *out, const int *onembed, \
- int ostride, int odist, \
- const X(r2r_kind) *kind, unsigned flags); \
- \
-FFTW_EXTERN X(plan) X(plan_r2r)(int rank, const int *n, R *in, R *out, \
- const X(r2r_kind) *kind, unsigned flags); \
- \
-FFTW_EXTERN X(plan) X(plan_r2r_1d)(int n, R *in, R *out, \
- X(r2r_kind) kind, unsigned flags); \
-FFTW_EXTERN X(plan) X(plan_r2r_2d)(int n0, int n1, R *in, R *out, \
- X(r2r_kind) kind0, X(r2r_kind) kind1, \
- unsigned flags); \
-FFTW_EXTERN X(plan) X(plan_r2r_3d)(int n0, int n1, int n2, \
- R *in, R *out, X(r2r_kind) kind0, \
- X(r2r_kind) kind1, X(r2r_kind) kind2, \
- unsigned flags); \
- \
-FFTW_EXTERN X(plan) X(plan_guru_r2r)(int rank, const X(iodim) *dims, \
- int howmany_rank, \
- const X(iodim) *howmany_dims, \
- R *in, R *out, \
- const X(r2r_kind) *kind, unsigned flags); \
- \
-FFTW_EXTERN X(plan) X(plan_guru64_r2r)(int rank, const X(iodim64) *dims, \
- int howmany_rank, \
- const X(iodim64) *howmany_dims, \
- R *in, R *out, \
- const X(r2r_kind) *kind, unsigned flags); \
- \
-FFTW_EXTERN void X(execute_r2r)(const X(plan) p, R *in, R *out); \
- \
-FFTW_EXTERN void X(destroy_plan)(X(plan) p); \
-FFTW_EXTERN void X(forget_wisdom)(void); \
-FFTW_EXTERN void X(cleanup)(void); \
- \
-FFTW_EXTERN void X(set_timelimit)(double t); \
- \
-FFTW_EXTERN void X(plan_with_nthreads)(int nthreads); \
-FFTW_EXTERN int X(init_threads)(void); \
-FFTW_EXTERN void X(cleanup_threads)(void); \
-FFTW_EXTERN void X(make_planner_thread_safe)(void); \
- \
-FFTW_EXTERN int X(export_wisdom_to_filename)(const char *filename); \
-FFTW_EXTERN void X(export_wisdom_to_file)(FILE *output_file); \
-FFTW_EXTERN char *X(export_wisdom_to_string)(void); \
-FFTW_EXTERN void X(export_wisdom)(X(write_char_func) write_char, \
- void *data); \
-FFTW_EXTERN int X(import_system_wisdom)(void); \
-FFTW_EXTERN int X(import_wisdom_from_filename)(const char *filename); \
-FFTW_EXTERN int X(import_wisdom_from_file)(FILE *input_file); \
-FFTW_EXTERN int X(import_wisdom_from_string)(const char *input_string); \
-FFTW_EXTERN int X(import_wisdom)(X(read_char_func) read_char, void *data); \
- \
-FFTW_EXTERN void X(fprint_plan)(const X(plan) p, FILE *output_file); \
-FFTW_EXTERN void X(print_plan)(const X(plan) p); \
-FFTW_EXTERN char *X(sprint_plan)(const X(plan) p); \
- \
-FFTW_EXTERN void *X(malloc)(size_t n); \
-FFTW_EXTERN R *X(alloc_real)(size_t n); \
-FFTW_EXTERN C *X(alloc_complex)(size_t n); \
-FFTW_EXTERN void X(free)(void *p); \
- \
-FFTW_EXTERN void X(flops)(const X(plan) p, \
- double *add, double *mul, double *fmas); \
-FFTW_EXTERN double X(estimate_cost)(const X(plan) p); \
-FFTW_EXTERN double X(cost)(const X(plan) p); \
- \
-FFTW_EXTERN int X(alignment_of)(R *p); \
-FFTW_EXTERN const char X(version)[]; \
-FFTW_EXTERN const char X(cc)[]; \
-FFTW_EXTERN const char X(codelet_optim)[];
-
-
-/* end of FFTW_DEFINE_API macro */
-
-FFTW_DEFINE_API(FFTW_MANGLE_DOUBLE, double, fftw_complex)
-FFTW_DEFINE_API(FFTW_MANGLE_FLOAT, float, fftwf_complex)
-FFTW_DEFINE_API(FFTW_MANGLE_LONG_DOUBLE, long double, fftwl_complex)
-
-/* __float128 (quad precision) is a gcc extension on i386, x86_64, and ia64
- for gcc >= 4.6 (compiled in FFTW with --enable-quad-precision) */
-#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) \
- && !(defined(__ICC) || defined(__INTEL_COMPILER) || defined(__CUDACC__) || defined(__PGI)) \
- && (defined(__i386__) || defined(__x86_64__) || defined(__ia64__))
-# if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined(complex) && defined(I)
-/* note: __float128 is a typedef, which is not supported with the _Complex
- keyword in gcc, so instead we use this ugly __attribute__ version.
- However, we can't simply pass the __attribute__ version to
- FFTW_DEFINE_API because the __attribute__ confuses gcc in pointer
- types. Hence redefining FFTW_DEFINE_COMPLEX. Ugh. */
-# undef FFTW_DEFINE_COMPLEX
-# define FFTW_DEFINE_COMPLEX(R, C) typedef _Complex float __attribute__((mode(TC))) C
-# endif
-FFTW_DEFINE_API(FFTW_MANGLE_QUAD, __float128, fftwq_complex)
-#endif
-
-#define FFTW_FORWARD (-1)
-#define FFTW_BACKWARD (+1)
-
-#define FFTW_NO_TIMELIMIT (-1.0)
-
-/* documented flags */
-#define FFTW_MEASURE (0U)
-#define FFTW_DESTROY_INPUT (1U << 0)
-#define FFTW_UNALIGNED (1U << 1)
-#define FFTW_CONSERVE_MEMORY (1U << 2)
-#define FFTW_EXHAUSTIVE (1U << 3) /* NO_EXHAUSTIVE is default */
-#define FFTW_PRESERVE_INPUT (1U << 4) /* cancels FFTW_DESTROY_INPUT */
-#define FFTW_PATIENT (1U << 5) /* IMPATIENT is default */
-#define FFTW_ESTIMATE (1U << 6)
-#define FFTW_WISDOM_ONLY (1U << 21)
-
-/* undocumented beyond-guru flags */
-#define FFTW_ESTIMATE_PATIENT (1U << 7)
-#define FFTW_BELIEVE_PCOST (1U << 8)
-#define FFTW_NO_DFT_R2HC (1U << 9)
-#define FFTW_NO_NONTHREADED (1U << 10)
-#define FFTW_NO_BUFFERING (1U << 11)
-#define FFTW_NO_INDIRECT_OP (1U << 12)
-#define FFTW_ALLOW_LARGE_GENERIC (1U << 13) /* NO_LARGE_GENERIC is default */
-#define FFTW_NO_RANK_SPLITS (1U << 14)
-#define FFTW_NO_VRANK_SPLITS (1U << 15)
-#define FFTW_NO_VRECURSE (1U << 16)
-#define FFTW_NO_SIMD (1U << 17)
-#define FFTW_NO_SLOW (1U << 18)
-#define FFTW_NO_FIXED_RADIX_LARGE_N (1U << 19)
-#define FFTW_ALLOW_PRUNING (1U << 20)
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif /* __cplusplus */
-
-#endif /* FFTW3_H */
diff --git a/funasr/runtime/onnxruntime/win/include/onnxruntime_c_api.h b/funasr/runtime/onnxruntime/win/include/onnxruntime_c_api.h
deleted file mode 100644
index 44875b0..0000000
--- a/funasr/runtime/onnxruntime/win/include/onnxruntime_c_api.h
+++ /dev/null
@@ -1,3987 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-// See docs\c_cxx\README.md on generating the Doxygen documentation from this file
-
-/** \mainpage C & C++ APIs
- *
- * <h1>C</h1>
- *
- * ::OrtApi - Click here to go to the structure with all C API functions.
- *
- * <h1>C++</h1>
- *
- * ::Ort - Click here to go to the namespace holding all of the C++ wrapper classes
- *
- * It is a set of header only wrapper classes around the C API. The goal is to turn the C style return value error codes into C++ exceptions, and to
- * automate memory management through standard C++ RAII principles.
- *
- * \addtogroup Global
- * ONNX Runtime C API
- * @{
- */
-
-#pragma once
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-
-/** \brief The API version defined in this header
- *
- * This value is used by some API functions to behave as this version of the header expects.
- */
-#define ORT_API_VERSION 14
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-//! @}
-// SAL2 Definitions
-#ifndef _WIN32
-#define _In_
-#define _In_z_
-#define _In_opt_
-#define _In_opt_z_
-#define _Out_
-#define _Outptr_
-#define _Out_opt_
-#define _Inout_
-#define _Inout_opt_
-#define _Frees_ptr_opt_
-#define _Ret_maybenull_
-#define _Ret_notnull_
-#define _Check_return_
-#define _Outptr_result_maybenull_
-#define _In_reads_(X)
-#define _Inout_updates_all_(X)
-#define _Out_writes_bytes_all_(X)
-#define _Out_writes_all_(X)
-#define _Success_(X)
-#define _Outptr_result_buffer_maybenull_(X)
-#define ORT_ALL_ARGS_NONNULL __attribute__((nonnull))
-#else
-#include <specstrings.h>
-#define ORT_ALL_ARGS_NONNULL
-#endif
-
-#ifdef _WIN32
-// Define ORT_DLL_IMPORT if your program is dynamically linked to Ort.
-// dllexport is not used, we use a .def file.
-#ifdef ORT_DLL_IMPORT
-#define ORT_EXPORT __declspec(dllimport)
-#else
-#define ORT_EXPORT
-#endif
-#define ORT_API_CALL _stdcall
-#define ORT_MUST_USE_RESULT
-#define ORTCHAR_T wchar_t
-#else
-// To make symbols visible on macOS/iOS
-#ifdef __APPLE__
-#define ORT_EXPORT __attribute__((visibility("default")))
-#else
-#define ORT_EXPORT
-#endif
-#define ORT_API_CALL
-#define ORT_MUST_USE_RESULT __attribute__((warn_unused_result))
-#define ORTCHAR_T char
-#endif
-
-#ifndef ORT_TSTR
-#ifdef _WIN32
-#define ORT_TSTR(X) L##X
-#else
-#define ORT_TSTR(X) X
-#endif
-#endif
-
-// Any pointer marked with _In_ or _Out_, cannot be NULL.
-
-// Windows users should use unicode paths when possible to bypass the MAX_PATH limitation
-// Every pointer marked with _In_ or _Out_, cannot be NULL. Caller should ensure that.
-// for ReleaseXXX(...) functions, they can accept NULL pointer.
-
-#ifdef __cplusplus
-// For any compiler with C++11 support, MSVC 2015 and greater, or Clang version supporting noexcept.
-// Such complex condition is needed because compilers set __cplusplus value differently.
-#ifndef __has_feature
-#define __has_feature(x) 0
-#endif
-#if ((__cplusplus >= 201103L) || (_MSC_VER >= 1900) || (defined(__has_feature) && __has_feature(cxx_noexcept)))
-#define NO_EXCEPTION noexcept
-#else
-#define NO_EXCEPTION throw()
-#endif
-#else
-#define NO_EXCEPTION
-#endif
-
-// __VA_ARGS__ on Windows and Linux are different
-#define ORT_API(RETURN_TYPE, NAME, ...) RETURN_TYPE ORT_API_CALL NAME(__VA_ARGS__) NO_EXCEPTION
-
-#define ORT_API_STATUS(NAME, ...) \
- _Success_(return == 0) _Check_return_ _Ret_maybenull_ OrtStatusPtr ORT_API_CALL NAME(__VA_ARGS__) \
- NO_EXCEPTION ORT_MUST_USE_RESULT
-
-// XXX: Unfortunately, SAL annotations are known to not work with function pointers
-#define ORT_API2_STATUS(NAME, ...) \
- _Check_return_ _Ret_maybenull_ OrtStatusPtr(ORT_API_CALL* NAME)(__VA_ARGS__) NO_EXCEPTION ORT_MUST_USE_RESULT
-
-// Used in *.cc files. Almost as same as ORT_API_STATUS, except without ORT_MUST_USE_RESULT and ORT_EXPORT
-#define ORT_API_STATUS_IMPL(NAME, ...) \
- _Success_(return == 0) _Check_return_ _Ret_maybenull_ OrtStatusPtr ORT_API_CALL NAME(__VA_ARGS__) NO_EXCEPTION
-
-#define ORT_CLASS_RELEASE(X) void(ORT_API_CALL * Release##X)(_Frees_ptr_opt_ Ort##X * input)
-
-#ifdef __DOXYGEN__
-#undef ORT_API_STATUS
-#define ORT_API_STATUS(NAME, ...) OrtStatus* NAME(__VA_ARGS__)
-#undef ORT_API2_STATUS
-#define ORT_API2_STATUS(NAME, ...) OrtStatus* NAME(__VA_ARGS__)
-#undef ORT_CLASS_RELEASE
-#define ORT_CLASS_RELEASE(X) void Release##X(Ort##X* input)
-#undef NO_EXCEPTION
-#define NO_EXCEPTION
-#endif
-/** \addtogroup Global
- * ONNX Runtime C API
- * @{
- */
-
-/** Copied from TensorProto::DataType
- * Currently, Ort doesn't support complex64, complex128
- */
-typedef enum ONNXTensorElementDataType {
- ONNX_TENSOR_ELEMENT_DATA_TYPE_UNDEFINED,
- ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT, // maps to c type float
- ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT8, // maps to c type uint8_t
- ONNX_TENSOR_ELEMENT_DATA_TYPE_INT8, // maps to c type int8_t
- ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT16, // maps to c type uint16_t
- ONNX_TENSOR_ELEMENT_DATA_TYPE_INT16, // maps to c type int16_t
- ONNX_TENSOR_ELEMENT_DATA_TYPE_INT32, // maps to c type int32_t
- ONNX_TENSOR_ELEMENT_DATA_TYPE_INT64, // maps to c type int64_t
- ONNX_TENSOR_ELEMENT_DATA_TYPE_STRING, // maps to c++ type std::string
- ONNX_TENSOR_ELEMENT_DATA_TYPE_BOOL,
- ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT16,
- ONNX_TENSOR_ELEMENT_DATA_TYPE_DOUBLE, // maps to c type double
- ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT32, // maps to c type uint32_t
- ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT64, // maps to c type uint64_t
- ONNX_TENSOR_ELEMENT_DATA_TYPE_COMPLEX64, // complex with float32 real and imaginary components
- ONNX_TENSOR_ELEMENT_DATA_TYPE_COMPLEX128, // complex with float64 real and imaginary components
- ONNX_TENSOR_ELEMENT_DATA_TYPE_BFLOAT16 // Non-IEEE floating-point format based on IEEE754 single-precision
-} ONNXTensorElementDataType;
-
-// Synced with onnx TypeProto oneof
-typedef enum ONNXType {
- ONNX_TYPE_UNKNOWN,
- ONNX_TYPE_TENSOR,
- ONNX_TYPE_SEQUENCE,
- ONNX_TYPE_MAP,
- ONNX_TYPE_OPAQUE,
- ONNX_TYPE_SPARSETENSOR,
- ONNX_TYPE_OPTIONAL
-} ONNXType;
-
-// These types are synced with internal
-// SparseFormatFlags
-typedef enum OrtSparseFormat {
- ORT_SPARSE_UNDEFINED = 0,
- ORT_SPARSE_COO = 0x1,
- ORT_SPARSE_CSRC = 0x2,
- ORT_SPARSE_BLOCK_SPARSE = 0x4
-} OrtSparseFormat;
-
-// Enum allows to query sparse tensor indices
-enum OrtSparseIndicesFormat {
- ORT_SPARSE_COO_INDICES,
- ORT_SPARSE_CSR_INNER_INDICES,
- ORT_SPARSE_CSR_OUTER_INDICES,
- ORT_SPARSE_BLOCK_SPARSE_INDICES
-};
-
-/** \brief Logging severity levels
- *
- * In typical API usage, specifying a logging severity level specifies the minimum severity of log messages to show.
- */
-typedef enum OrtLoggingLevel {
- ORT_LOGGING_LEVEL_VERBOSE, ///< Verbose informational messages (least severe).
- ORT_LOGGING_LEVEL_INFO, ///< Informational messages.
- ORT_LOGGING_LEVEL_WARNING, ///< Warning messages.
- ORT_LOGGING_LEVEL_ERROR, ///< Error messages.
- ORT_LOGGING_LEVEL_FATAL, ///< Fatal error messages (most severe).
-} OrtLoggingLevel;
-
-typedef enum OrtErrorCode {
- ORT_OK,
- ORT_FAIL,
- ORT_INVALID_ARGUMENT,
- ORT_NO_SUCHFILE,
- ORT_NO_MODEL,
- ORT_ENGINE_ERROR,
- ORT_RUNTIME_EXCEPTION,
- ORT_INVALID_PROTOBUF,
- ORT_MODEL_LOADED,
- ORT_NOT_IMPLEMENTED,
- ORT_INVALID_GRAPH,
- ORT_EP_FAIL,
-} OrtErrorCode;
-
-typedef enum OrtOpAttrType {
- ORT_OP_ATTR_UNDEFINED = 0,
- ORT_OP_ATTR_INT,
- ORT_OP_ATTR_INTS,
- ORT_OP_ATTR_FLOAT,
- ORT_OP_ATTR_FLOATS,
- ORT_OP_ATTR_STRING,
- ORT_OP_ATTR_STRINGS,
-} OrtOpAttrType;
-
-//! @}
-#define ORT_RUNTIME_CLASS(X) \
- struct Ort##X; \
- typedef struct Ort##X Ort##X;
-
-/** \addtogroup Global
- * ONNX Runtime C API
- * @{
- */
-// The actual types defined have an Ort prefix
-ORT_RUNTIME_CLASS(Env);
-ORT_RUNTIME_CLASS(Status); // nullptr for Status* indicates success
-ORT_RUNTIME_CLASS(MemoryInfo);
-ORT_RUNTIME_CLASS(IoBinding);
-ORT_RUNTIME_CLASS(Session); // Don't call ReleaseSession from Dllmain (because session owns a thread pool)
-ORT_RUNTIME_CLASS(Value);
-ORT_RUNTIME_CLASS(RunOptions);
-ORT_RUNTIME_CLASS(TypeInfo);
-ORT_RUNTIME_CLASS(TensorTypeAndShapeInfo);
-ORT_RUNTIME_CLASS(SessionOptions);
-ORT_RUNTIME_CLASS(CustomOpDomain);
-ORT_RUNTIME_CLASS(MapTypeInfo);
-ORT_RUNTIME_CLASS(SequenceTypeInfo);
-ORT_RUNTIME_CLASS(ModelMetadata);
-ORT_RUNTIME_CLASS(ThreadPoolParams);
-ORT_RUNTIME_CLASS(ThreadingOptions);
-ORT_RUNTIME_CLASS(ArenaCfg);
-ORT_RUNTIME_CLASS(PrepackedWeightsContainer);
-ORT_RUNTIME_CLASS(TensorRTProviderOptionsV2);
-ORT_RUNTIME_CLASS(CUDAProviderOptionsV2);
-ORT_RUNTIME_CLASS(CANNProviderOptions);
-ORT_RUNTIME_CLASS(Op);
-ORT_RUNTIME_CLASS(OpAttr);
-
-#ifdef _WIN32
-typedef _Return_type_success_(return == 0) OrtStatus* OrtStatusPtr;
-#else
-typedef OrtStatus* OrtStatusPtr;
-#endif
-
-/** \brief Memory allocation interface
- *
- * Structure of function pointers that defines a memory allocator. This can be created and filled in by the user for custom allocators.
- *
- * When an allocator is passed to any function, be sure that the allocator object is not destroyed until the last allocated object using it is freed.
- */
-typedef struct OrtAllocator {
- uint32_t version; ///< Must be initialized to ORT_API_VERSION
- void*(ORT_API_CALL* Alloc)(struct OrtAllocator* this_, size_t size); ///< Returns a pointer to an allocated block of `size` bytes
- void(ORT_API_CALL* Free)(struct OrtAllocator* this_, void* p); ///< Free a block of memory previously allocated with OrtAllocator::Alloc
- const struct OrtMemoryInfo*(ORT_API_CALL* Info)(const struct OrtAllocator* this_); ///< Return a pointer to an ::OrtMemoryInfo that describes this allocator
-} OrtAllocator;
-
-typedef void(ORT_API_CALL* OrtLoggingFunction)(
- void* param, OrtLoggingLevel severity, const char* category, const char* logid, const char* code_location,
- const char* message);
-
-/** \brief Graph optimization level
- *
- * Refer to https://www.onnxruntime.ai/docs/resources/graph-optimizations.html
- * for an in-depth understanding of Graph Optimizations
- */
-typedef enum GraphOptimizationLevel {
- ORT_DISABLE_ALL = 0,
- ORT_ENABLE_BASIC = 1,
- ORT_ENABLE_EXTENDED = 2,
- ORT_ENABLE_ALL = 99
-} GraphOptimizationLevel;
-
-typedef enum ExecutionMode {
- ORT_SEQUENTIAL = 0,
- ORT_PARALLEL = 1,
-} ExecutionMode;
-
-/** \brief Language projection identifiers
- * /see OrtApi::SetLanguageProjection
- */
-typedef enum OrtLanguageProjection {
- ORT_PROJECTION_C = 0,
- ORT_PROJECTION_CPLUSPLUS = 1,
- ORT_PROJECTION_CSHARP = 2,
- ORT_PROJECTION_PYTHON = 3,
- ORT_PROJECTION_JAVA = 4,
- ORT_PROJECTION_WINML = 5,
- ORT_PROJECTION_NODEJS = 6,
-} OrtLanguageProjection;
-
-struct OrtKernelInfo;
-typedef struct OrtKernelInfo OrtKernelInfo;
-struct OrtKernelContext;
-typedef struct OrtKernelContext OrtKernelContext;
-struct OrtCustomOp;
-typedef struct OrtCustomOp OrtCustomOp;
-
-typedef enum OrtAllocatorType {
- OrtInvalidAllocator = -1,
- OrtDeviceAllocator = 0,
- OrtArenaAllocator = 1
-} OrtAllocatorType;
-
-/** \brief Memory types for allocated memory, execution provider specific types should be extended in each provider.
- */
-// Whenever this struct is updated, please also update the MakeKey function in onnxruntime / core / framework / execution_provider.cc
-typedef enum OrtMemType {
- OrtMemTypeCPUInput = -2, ///< Any CPU memory used by non-CPU execution provider
- OrtMemTypeCPUOutput = -1, ///< CPU accessible memory outputted by non-CPU execution provider, i.e. CUDA_PINNED
- OrtMemTypeCPU = OrtMemTypeCPUOutput, ///< Temporary CPU accessible memory allocated by non-CPU execution provider, i.e. CUDA_PINNED
- OrtMemTypeDefault = 0, ///< The default allocator for execution provider
-} OrtMemType;
-
-/** \brief This mimics OrtDevice type constants so they can be returned in the API
- */
-typedef enum OrtMemoryInfoDeviceType {
- OrtMemoryInfoDeviceType_CPU = 0,
- OrtMemoryInfoDeviceType_GPU = 1,
- OrtMemoryInfoDeviceType_FPGA = 2
-} OrtMemoryInfoDeviceType;
-
-/** \brief Algorithm to use for cuDNN Convolution Op
- */
-typedef enum OrtCudnnConvAlgoSearch {
- OrtCudnnConvAlgoSearchExhaustive, // expensive exhaustive benchmarking using cudnnFindConvolutionForwardAlgorithmEx
- OrtCudnnConvAlgoSearchHeuristic, // lightweight heuristic based search using cudnnGetConvolutionForwardAlgorithm_v7
- OrtCudnnConvAlgoSearchDefault, // default algorithm using CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM
-} OrtCudnnConvAlgoSearch;
-
-/** \brief CUDA Provider Options
- *
- * \see OrtApi::SessionOptionsAppendExecutionProvider_CUDA
- */
-typedef struct OrtCUDAProviderOptions {
-#ifdef __cplusplus
- OrtCUDAProviderOptions()
- : device_id{},
- cudnn_conv_algo_search{OrtCudnnConvAlgoSearchExhaustive},
- gpu_mem_limit{SIZE_MAX},
- arena_extend_strategy{},
- do_copy_in_default_stream{1},
- has_user_compute_stream{},
- user_compute_stream{},
- default_memory_arena_cfg{},
- tunable_op_enabled{false} {}
-#endif
-
- /** \brief CUDA device Id
- * Defaults to 0.
- */
- int device_id;
-
- /** \brief CUDA Convolution algorithm search configuration.
- * See enum OrtCudnnConvAlgoSearch for more details.
- * Defaults to OrtCudnnConvAlgoSearchExhaustive.
- */
- OrtCudnnConvAlgoSearch cudnn_conv_algo_search;
-
- /** \brief CUDA memory limit (To use all possible memory pass in maximum size_t)
- * Defaults to SIZE_MAX.
- * \note If a ::OrtArenaCfg has been applied, it will override this field
- */
- size_t gpu_mem_limit;
-
- /** \brief Strategy used to grow the memory arena
- * 0 = kNextPowerOfTwo<br>
- * 1 = kSameAsRequested<br>
- * Defaults to 0.
- * \note If a ::OrtArenaCfg has been applied, it will override this field
- */
- int arena_extend_strategy;
-
- /** \brief Flag indicating if copying needs to take place on the same stream as the compute stream in the CUDA EP
- * 0 = Use separate streams for copying and compute.
- * 1 = Use the same stream for copying and compute.
- * Defaults to 1.
- * WARNING: Setting this to 0 may result in data races for some models.
- * Please see issue #4829 for more details.
- */
- int do_copy_in_default_stream;
-
- /** \brief Flag indicating if there is a user provided compute stream
- * Defaults to 0.
- */
- int has_user_compute_stream;
-
- /** \brief User provided compute stream.
- * If provided, please set `has_user_compute_stream` to 1.
- */
- void* user_compute_stream;
-
- /** \brief CUDA memory arena configuration parameters
- */
- OrtArenaCfg* default_memory_arena_cfg;
-
- /** \brief Enable TunableOp.
- * Set it to 1 to enable TunableOp. Otherwise, it is disabled by default.
- * This option can be superseded by environment variable ORT_CUDA_TUNABLE_OP_ENABLED.
- */
- int tunable_op_enabled;
-
-} OrtCUDAProviderOptions;
-
-/** \brief ROCM Provider Options
- *
- * \see OrtApi::SessionOptionsAppendExecutionProvider_ROCM
- */
-typedef struct OrtROCMProviderOptions {
-#ifdef __cplusplus
- OrtROCMProviderOptions()
- : device_id{},
- miopen_conv_exhaustive_search{0},
- gpu_mem_limit{SIZE_MAX},
- arena_extend_strategy{},
- do_copy_in_default_stream{1},
- has_user_compute_stream{},
- user_compute_stream{},
- default_memory_arena_cfg{},
- tunable_op_enabled{false} {}
-#endif
-
- /** \brief ROCM device Id
- * Defaults to 0.
- */
- int device_id;
-
- /** \brief ROCM MIOpen Convolution algorithm exaustive search option.
- * Defaults to 0 (false).
- */
- int miopen_conv_exhaustive_search;
-
- /** \brief ROCM memory limit (To use all possible memory pass in maximum size_t)
- * Defaults to SIZE_MAX.
- * \note If a ::OrtArenaCfg has been applied, it will override this field
- */
- size_t gpu_mem_limit;
-
- /** \brief Strategy used to grow the memory arena
- * 0 = kNextPowerOfTwo<br>
- * 1 = kSameAsRequested<br>
- * Defaults to 0.
- * \note If a ::OrtArenaCfg has been applied, it will override this field
- */
- int arena_extend_strategy;
-
- /** \brief Flag indicating if copying needs to take place on the same stream as the compute stream in the ROCM EP
- * 0 = Use separate streams for copying and compute.
- * 1 = Use the same stream for copying and compute.
- * Defaults to 1.
- * WARNING: Setting this to 0 may result in data races for some models.
- * Please see issue #4829 for more details.
- */
- int do_copy_in_default_stream;
-
- /** \brief Flag indicating if there is a user provided compute stream
- * Defaults to 0.
- */
- int has_user_compute_stream;
-
- /** \brief User provided compute stream.
- * If provided, please set `has_user_compute_stream` to 1.
- */
- void* user_compute_stream;
-
- /** \brief ROCM memory arena configuration parameters
- */
- OrtArenaCfg* default_memory_arena_cfg;
-
- /** \brief Enable TunableOp.
- * Set it to 1 to enable TunableOp. Otherwise, it is disabled by default.
- * This option can be superseded by environment variable ORT_ROCM_TUNABLE_OP_ENABLED.
- */
- int tunable_op_enabled;
-
-} OrtROCMProviderOptions;
-
-/** \brief TensorRT Provider Options
- *
- * \see OrtApi::SessionOptionsAppendExecutionProvider_TensorRT
- */
-typedef struct OrtTensorRTProviderOptions {
- int device_id; ///< CUDA device id (0 = default device)
- int has_user_compute_stream; // indicator of user specified CUDA compute stream.
- void* user_compute_stream; // user specified CUDA compute stream.
- int trt_max_partition_iterations; // maximum iterations for TensorRT parser to get capability
- int trt_min_subgraph_size; // minimum size of TensorRT subgraphs
- size_t trt_max_workspace_size; // maximum workspace size for TensorRT.
- int trt_fp16_enable; // enable TensorRT FP16 precision. Default 0 = false, nonzero = true
- int trt_int8_enable; // enable TensorRT INT8 precision. Default 0 = false, nonzero = true
- const char* trt_int8_calibration_table_name; // TensorRT INT8 calibration table name.
- int trt_int8_use_native_calibration_table; // use native TensorRT generated calibration table. Default 0 = false, nonzero = true
- int trt_dla_enable; // enable DLA. Default 0 = false, nonzero = true
- int trt_dla_core; // DLA core number. Default 0
- int trt_dump_subgraphs; // dump TRT subgraph. Default 0 = false, nonzero = true
- int trt_engine_cache_enable; // enable engine caching. Default 0 = false, nonzero = true
- const char* trt_engine_cache_path; // specify engine cache path
- int trt_engine_decryption_enable; // enable engine decryption. Default 0 = false, nonzero = true
- const char* trt_engine_decryption_lib_path; // specify engine decryption library path
- int trt_force_sequential_engine_build; // force building TensorRT engine sequentially. Default 0 = false, nonzero = true
- // This is the legacy struct and don't add new fields here.
- // For new field that can be represented by string, please add it in include/onnxruntime/core/providers/tensorrt/tensorrt_provider_options.h
- // For non-string field, need to create a new separate api to handle it.
-} OrtTensorRTProviderOptions;
-
-/** \brief MIGraphX Provider Options
- *
- * \see OrtApi::SessionOptionsAppendExecutionProvider_MIGraphX
- */
-typedef struct OrtMIGraphXProviderOptions {
- int device_id; // hip device id.
- int migraphx_fp16_enable; // enable MIGraphX FP16 precision. Default 0 = false, nonzero = true
- int migraphx_int8_enable; // enable MIGraphX INT8 precision. Default 0 = false, nonzero = true
-} OrtMIGraphXProviderOptions;
-
-/** \brief OpenVINO Provider Options
- *
- * \see OrtApi::SessionOptionsAppendExecutionProvider_OpenVINO
- */
-typedef struct OrtOpenVINOProviderOptions {
-#ifdef __cplusplus
- OrtOpenVINOProviderOptions() : device_type{}, enable_vpu_fast_compile{}, device_id{},
- num_of_threads{}, cache_dir{},
- context{}, enable_opencl_throttling{}, enable_dynamic_shapes{} {}
-#endif
- /** \brief Device type string
- *
- * Valid settings are one of: "CPU_FP32", "CPU_FP16", "GPU_FP32", "GPU_FP16", "MYRIAD_FP16", "VAD-M_FP16" or "VAD-F_FP32"
- */
- const char* device_type;
- unsigned char enable_vpu_fast_compile; ///< 0 = disabled, nonzero = enabled
- const char* device_id;
- size_t num_of_threads; ///< 0 = Use default number of threads
- const char* cache_dir; // path is set to empty by default
- void* context;
- unsigned char enable_opencl_throttling; ///< 0 = disabled, nonzero = enabled
- unsigned char enable_dynamic_shapes; ///< 0 = disabled, nonzero = enabled
-} OrtOpenVINOProviderOptions;
-
-struct OrtApi;
-typedef struct OrtApi OrtApi;
-
-struct OrtTrainingApi;
-typedef struct OrtTrainingApi OrtTrainingApi;
-
-/** \brief The helper interface to get the right version of OrtApi
- *
- * Get a pointer to this structure through ::OrtGetApiBase
- */
-struct OrtApiBase {
- /** \brief Get a pointer to the requested version of the ::OrtApi
- *
- * \param[in] version Must be ::ORT_API_VERSION
- * \return The ::OrtApi for the version requested, nullptr will be returned if this version is unsupported, for example when using a runtime
- * older than the version created with this header file.
- */
- const OrtApi*(ORT_API_CALL* GetApi)(uint32_t version)NO_EXCEPTION;
- const char*(ORT_API_CALL* GetVersionString)(void)NO_EXCEPTION; ///< Returns a null terminated string of the version of the Onnxruntime library (eg: "1.8.1")
-};
-typedef struct OrtApiBase OrtApiBase;
-
-/** \brief The Onnxruntime library's entry point to access the C API
- *
- * Call this to get the a pointer to an ::OrtApiBase
- */
-ORT_EXPORT const OrtApiBase* ORT_API_CALL OrtGetApiBase(void) NO_EXCEPTION;
-
-/** \brief Thread work loop function
- *
- * Onnxruntime will provide the working loop on custom thread creation
- * Argument is an onnxruntime built-in type which will be provided when thread pool calls OrtCustomCreateThreadFn
- */
-typedef void (*OrtThreadWorkerFn)(void* ort_worker_fn_param);
-
-typedef const struct OrtCustomHandleType {
- char __place_holder;
-}* OrtCustomThreadHandle;
-
-/** \brief Ort custom thread creation function
- *
- * The function should return a thread handle to be used in onnxruntime thread pools
- * Onnxruntime will throw exception on return value of nullptr or 0, indicating that the function failed to create a thread
- */
-typedef OrtCustomThreadHandle (*OrtCustomCreateThreadFn)(void* ort_custom_thread_creation_options, OrtThreadWorkerFn ort_thread_worker_fn, void* ort_worker_fn_param);
-
-/** \brief Custom thread join function
- *
- * Onnxruntime thread pool destructor will call the function to join a custom thread.
- * Argument ort_custom_thread_handle is the value returned by OrtCustomCreateThreadFn
- */
-typedef void (*OrtCustomJoinThreadFn)(OrtCustomThreadHandle ort_custom_thread_handle);
-
-typedef OrtStatus*(ORT_API_CALL* RegisterCustomOpsFn)(OrtSessionOptions* options, const OrtApiBase* api);
-
-/** \brief The C API
- *
- * All C API functions are defined inside this structure as pointers to functions.
- * Call OrtApiBase::GetApi to get a pointer to it
- *
- * \nosubgrouping
- */
-struct OrtApi {
- /// \name OrtStatus
- /// @{
-
- /**
- * \brief Create an OrtStatus from a null terminated string
- *
- * \param[in] code
- * \param[in] msg A null-terminated string. Its contents will be copied.
- * \return A new OrtStatus object, must be destroyed with OrtApi::ReleaseStatus
- */
- OrtStatus*(ORT_API_CALL* CreateStatus)(OrtErrorCode code, _In_ const char* msg)NO_EXCEPTION ORT_ALL_ARGS_NONNULL;
-
- /** \brief Get OrtErrorCode from OrtStatus
- *
- * \param[in] status
- * \return OrtErrorCode that \p status was created with
- */
- OrtErrorCode(ORT_API_CALL* GetErrorCode)(_In_ const OrtStatus* status) NO_EXCEPTION ORT_ALL_ARGS_NONNULL;
-
- /** \brief Get error string from OrtStatus
- *
- * \param[in] status
- * \return The error message inside the `status`. Do not free the returned value.
- */
- const char*(ORT_API_CALL* GetErrorMessage)(_In_ const OrtStatus* status)NO_EXCEPTION ORT_ALL_ARGS_NONNULL;
-
- /// @}
- /// \name OrtEnv
- /// @{
-
- /** \brief Create an OrtEnv
- *
- * \param[in] log_severity_level The log severity level.
- * \param[in] logid The log identifier.
- * \param[out] out Returned newly created OrtEnv. Must be freed with OrtApi::ReleaseEnv
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreateEnv, OrtLoggingLevel log_severity_level, _In_ const char* logid, _Outptr_ OrtEnv** out);
-
- /** \brief Create an OrtEnv
- *
- * \param[in] logging_function A pointer to a logging function.
- * \param[in] logger_param A pointer to arbitrary data passed as the ::OrtLoggingFunction `param` parameter to
- * `logging_function`.
- * \param[in] log_severity_level The log severity level.
- * \param[in] logid The log identifier.
- * \param[out] out Returned newly created OrtEnv. Must be freed with OrtApi::ReleaseEnv
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreateEnvWithCustomLogger, OrtLoggingFunction logging_function, _In_opt_ void* logger_param,
- OrtLoggingLevel log_severity_level, _In_ const char* logid, _Outptr_ OrtEnv** out);
-
- /** \brief Enable Telemetry
- *
- * \note Telemetry events are on by default since they are lightweight
- * \param[in] env
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(EnableTelemetryEvents, _In_ const OrtEnv* env);
- /** \brief Disable Telemetry
- *
- * \see OrtApi::EnableTelemetryEvents
- * \param[in] env
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(DisableTelemetryEvents, _In_ const OrtEnv* env);
-
- /// @}
- /// \name OrtSession
- /// @{
-
- /** \brief Create an OrtSession from a model file
- *
- * \param[in] env
- * \param[in] model_path
- * \param[in] options
- * \param[out] out Returned newly created OrtSession. Must be freed with OrtApi::ReleaseSession
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- // TODO: document the path separator convention? '/' vs '\'
- // TODO: should specify the access characteristics of model_path. Is this read only during the
- // execution of CreateSession, or does the OrtSession retain a handle to the file/directory
- // and continue to access throughout the OrtSession lifetime?
- // What sort of access is needed to model_path : read or read/write?
- ORT_API2_STATUS(CreateSession, _In_ const OrtEnv* env, _In_ const ORTCHAR_T* model_path,
- _In_ const OrtSessionOptions* options, _Outptr_ OrtSession** out);
-
- /** \brief Create an OrtSession from memory
- *
- * \param[in] env
- * \param[in] model_data
- * \param[in] model_data_length
- * \param[in] options
- * \param[out] out Returned newly created OrtSession. Must be freed with OrtApi::ReleaseSession
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreateSessionFromArray, _In_ const OrtEnv* env, _In_ const void* model_data, size_t model_data_length,
- _In_ const OrtSessionOptions* options, _Outptr_ OrtSession** out);
-
- /** \brief Run the model in an ::OrtSession
- *
- * Will not return until the model run has completed. Multiple threads might be used to run the model based on
- * the options in the ::OrtSession and settings used when creating the ::OrtEnv
- *
- * \param[in] session
- * \param[in] run_options If nullptr, will use a default ::OrtRunOptions
- * \param[in] input_names Array of null terminated UTF8 encoded strings of the input names
- * \param[in] inputs Array of ::OrtValue%s of the input values
- * \param[in] input_len Number of elements in the input_names and inputs arrays
- * \param[in] output_names Array of null terminated UTF8 encoded strings of the output names
- * \param[in] output_names_len Number of elements in the output_names and outputs array
- * \param[out] outputs Array of ::OrtValue%s that the outputs are stored in. This can also be
- * an array of nullptr values, in this case ::OrtValue objects will be allocated and pointers
- * to them will be set into the `outputs` array.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(Run, _Inout_ OrtSession* session, _In_opt_ const OrtRunOptions* run_options,
- _In_reads_(input_len) const char* const* input_names,
- _In_reads_(input_len) const OrtValue* const* inputs, size_t input_len,
- _In_reads_(output_names_len) const char* const* output_names, size_t output_names_len,
- _Inout_updates_all_(output_names_len) OrtValue** outputs);
-
- /// @}
- /// \name OrtSessionOptions
- /// @{
-
- /** \brief Create an ::OrtSessionOptions object
- *
- * To use additional providers, you must build ORT with the extra providers enabled. Then call one of these
- * functions to enable them in the session:<br>
- * OrtSessionOptionsAppendExecutionProvider_CPU<br>
- * OrtSessionOptionsAppendExecutionProvider_CUDA<br>
- * OrtSessionOptionsAppendExecutionProvider_(remaining providers...)<br>
- * The order they are called indicates the preference order as well. In other words call this method
- * on your most preferred execution provider first followed by the less preferred ones.
- * If none are called Ort will use its internal CPU execution provider.
- *
- * \param[out] options The newly created OrtSessionOptions. Must be freed with OrtApi::ReleaseSessionOptions
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreateSessionOptions, _Outptr_ OrtSessionOptions** options);
-
- /** \brief Set filepath to save optimized model after graph level transformations
- *
- * \param[in] options
- * \param[in] optimized_model_filepath
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SetOptimizedModelFilePath, _Inout_ OrtSessionOptions* options,
- _In_ const ORTCHAR_T* optimized_model_filepath);
-
- /** \brief Create a copy of an existing ::OrtSessionOptions
- *
- * \param[in] in_options OrtSessionOptions to copy
- * \param[out] out_options Returned newly created ::OrtSessionOptions. Must be freed with OrtApi::ReleaseSessionOptions
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CloneSessionOptions, _In_ const OrtSessionOptions* in_options,
- _Outptr_ OrtSessionOptions** out_options);
-
- /** \brief Set execution mode
- *
- * Controls whether you want to execute operators in your graph sequentially or in parallel. Usually when the model
- * has many branches, setting this option to ExecutionMode.ORT_PARALLEL will give you better performance.
- * See [docs/ONNX_Runtime_Perf_Tuning.md] for more details.
- *
- * \param[in] options
- * \param[in] execution_mode
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SetSessionExecutionMode, _Inout_ OrtSessionOptions* options, ExecutionMode execution_mode);
-
- /** \brief Enable profiling for a session
- *
- * \param[in] options
- * \param[in] profile_file_prefix
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(EnableProfiling, _Inout_ OrtSessionOptions* options, _In_ const ORTCHAR_T* profile_file_prefix);
-
- /** \brief Disable profiling for a session
- *
- * \param[in] options
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(DisableProfiling, _Inout_ OrtSessionOptions* options);
-
- /** \brief Enable the memory pattern optimization
- *
- * The idea is if the input shapes are the same, we could trace the internal memory allocation
- * and generate a memory pattern for future request. So next time we could just do one allocation
- * with a big chunk for all the internal memory allocation.
- * \note Memory pattern optimization is only available when Sequential Execution mode is enabled (see OrtApi::SetSessionExecutionMode)
- *
- * \see OrtApi::DisableMemPattern
- *
- * \param[in] options
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(EnableMemPattern, _Inout_ OrtSessionOptions* options);
-
- /** \brief Disable the memory pattern optimization
- *
- * \see OrtApi::EnableMemPattern
- *
- * \param[in] options
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(DisableMemPattern, _Inout_ OrtSessionOptions* options);
-
- /** \brief Enable the memory arena on CPU
- *
- * Arena may pre-allocate memory for future usage.
- *
- * \param[in] options
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(EnableCpuMemArena, _Inout_ OrtSessionOptions* options);
-
- /** \brief Disable the memory arena on CPU
- *
- * \param[in] options
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(DisableCpuMemArena, _Inout_ OrtSessionOptions* options);
-
- /** \brief Set session log id
- *
- * \param[in] options
- * \param[in] logid The log identifier.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SetSessionLogId, _Inout_ OrtSessionOptions* options, const char* logid);
-
- /** \brief Set session log verbosity level
- *
- * Applies to session load, initialization, etc
- *
- * \param[in] options
- * \param[in] session_log_verbosity_level \snippet{doc} snippets.dox Log Verbosity Level
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SetSessionLogVerbosityLevel, _Inout_ OrtSessionOptions* options, int session_log_verbosity_level);
-
- /** \brief Set session log severity level
- *
- * \param[in] options
- * \param[in] session_log_severity_level The log severity level (refer to ::OrtLoggingLevel for possible values).
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SetSessionLogSeverityLevel, _Inout_ OrtSessionOptions* options, int session_log_severity_level);
-
- /** \brief Set the optimization level to apply when loading a graph
- *
- * Please see https://www.onnxruntime.ai/docs/resources/graph-optimizations.html for an in-depth explanation
- * \param[in,out] options The session options object
- * \param[in] graph_optimization_level The optimization level
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SetSessionGraphOptimizationLevel, _Inout_ OrtSessionOptions* options,
- GraphOptimizationLevel graph_optimization_level);
-
- /** \brief Sets the number of threads used to parallelize the execution within nodes
- *
- * When running a single node operation, ex. add, this sets the maximum number of threads to use.
- *
- * \note If built with OpenMP, this has no effect on the number of threads used. In this case
- * use the OpenMP env variables to configure the number of intra op num threads.
- *
- * \param[in] options
- * \param[in] intra_op_num_threads Number of threads to use<br>
- * A value of 0 will use the default number of threads<br>
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SetIntraOpNumThreads, _Inout_ OrtSessionOptions* options, int intra_op_num_threads);
-
- /** \brief Sets the number of threads used to parallelize the execution of the graph
- *
- * If nodes can be run in parallel, this sets the maximum number of threads to use to run them in parallel.
- *
- * \note If sequential execution is enabled this value is ignored, it acts as if it was set to 1.
- *
- * \param[in] options
- * \param[in] inter_op_num_threads Number of threads to use<br>
- * A value of 0 will use the default number of threads<br>
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SetInterOpNumThreads, _Inout_ OrtSessionOptions* options, int inter_op_num_threads);
-
- /// @}
- /// \name OrtCustomOpDomain
- /// @{
-
- /** \brief Create a custom op domain
- *
- * \param[in] domain
- * \param[out] out Newly created domain. Must be freed with OrtApi::ReleaseCustomOpDomain
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreateCustomOpDomain, _In_ const char* domain, _Outptr_ OrtCustomOpDomain** out);
-
- /** \brief Add a custom op to a custom op domain
- *
- * \note The OrtCustomOp* pointer must remain valid until the ::OrtCustomOpDomain using it is released
- *
- * \param[in] custom_op_domain
- * \param[in] op
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CustomOpDomain_Add, _Inout_ OrtCustomOpDomain* custom_op_domain, _In_ const OrtCustomOp* op);
-
- /// @}
- /// \name OrtSessionOptions
- /// @{
-
- /** \brief Add custom op domain to a session options
- *
- * \note The OrtCustomOpDomain* must not be deleted until all sessions using it are released
- *
- * \param[in] options
- * \param[in] custom_op_domain
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(AddCustomOpDomain, _Inout_ OrtSessionOptions* options, _In_ OrtCustomOpDomain* custom_op_domain);
-
- /** \deprecated Use OrtApi::RegisterCustomOpsLibrary_V2.
- *
- * Registers custom ops from a shared library.
- *
- * Loads a shared library (dll on windows, so on linux, etc) named 'library_path' and looks for this entry point:
- * OrtStatus* RegisterCustomOps(OrtSessionOptions * options, const OrtApiBase* api);
- * It then passes in the provided session options to this function along with the api base.
- * The handle to the loaded library is returned in library_handle. It can be freed by the caller after all sessions using the passed in
- * session options are destroyed, or if an error occurs and it is non null.
- *
- * \param[in] options
- * \param[in] library_path
- * \param[out] library_handle OS specific handle to the loaded library (Use FreeLibrary on Windows, dlclose on Linux, etc.. to unload)
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(RegisterCustomOpsLibrary, _Inout_ OrtSessionOptions* options, _In_ const char* library_path, _Outptr_ void** library_handle);
-
- /// @}
- /// \name OrtSession
- /// @{
-
- /** \brief Get input count for a session
- *
- * This number must also match the number of inputs passed to OrtApi::Run
- *
- * \see OrtApi::SessionGetInputTypeInfo, OrtApi::SessionGetInputName, OrtApi::Session
- *
- * \param[in] session
- * \param[out] out Number of inputs
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SessionGetInputCount, _In_ const OrtSession* session, _Out_ size_t* out);
-
- /** \brief Get output count for a session
- *
- * This number must also match the number of outputs returned by OrtApi::Run
- *
- * \see OrtApi::SessionGetOutputTypeInfo, OrtApi::SessionGetOutputName, OrtApi::Session
- *
- * \param[in] session
- * \param[out] out Number of outputs
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SessionGetOutputCount, _In_ const OrtSession* session, _Out_ size_t* out);
-
- /** \brief Get overridable initializer count
- *
- * \see OrtApi::SessionGetOverridableInitializerTypeInfo, OrtApi::SessionGetOverridableInitializerName
- *
- * \param[in] session
- * \param[in] out
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SessionGetOverridableInitializerCount, _In_ const OrtSession* session, _Out_ size_t* out);
-
- /** \brief Get input type information
- *
- * \param[in] session
- * \param[in] index Must be between 0 (inclusive) and what OrtApi::SessionGetInputCount returns (exclusive)
- * \param[out] type_info Must be freed with OrtApi::ReleaseTypeInfo
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SessionGetInputTypeInfo, _In_ const OrtSession* session, size_t index, _Outptr_ OrtTypeInfo** type_info);
-
- /** \brief Get output type information
- *
- * \param[in] session
- * \param[in] index Must be between 0 (inclusive) and what OrtApi::SessionGetOutputCount returns (exclusive)
- * \param[out] type_info Must be freed with OrtApi::ReleaseTypeInfo
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SessionGetOutputTypeInfo, _In_ const OrtSession* session, size_t index, _Outptr_ OrtTypeInfo** type_info);
-
- /** \brief Get overridable initializer type information
- *
- * \param[in] session
- * \param[in] index Must be between 0 (inclusive) and what OrtApi::SessionGetOverridableInitializerCount returns (exclusive)
- * \param[out] type_info Must be freed with OrtApi::ReleaseTypeInfo
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SessionGetOverridableInitializerTypeInfo, _In_ const OrtSession* session, size_t index, _Outptr_ OrtTypeInfo** type_info);
-
- /** \brief Get input name
- *
- * \param[in] session
- * \param[in] index Must be between 0 (inclusive) and what OrtApi::SessionGetInputCount returns (exclusive)
- * \param[in] allocator
- * \param[out] value Set to a null terminated UTF-8 encoded string allocated using `allocator`. Must be freed using `allocator`.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SessionGetInputName, _In_ const OrtSession* session, size_t index, _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
-
- /** \brief Get output name
- *
- * \param[in] session
- * \param[in] index Must be between 0 (inclusive) and what OrtApi::SessionGetOutputCount returns (exclusive)
- * \param[in] allocator
- * \param[out] value Set to a null terminated UTF-8 encoded string allocated using `allocator`. Must be freed using `allocator`.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SessionGetOutputName, _In_ const OrtSession* session, size_t index, _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
-
- /** \brief Get overridable initializer name
- *
- * \param[in] session
- * \param[in] index Must be between 0 (inclusive) and what OrtApi::SessionGetOverridableInitializerCount returns (exclusive)
- * \param[in] allocator
- * \param[out] value Set to a null terminated UTF-8 encoded string allocated using `allocator`. Must be freed using `allocator`.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SessionGetOverridableInitializerName, _In_ const OrtSession* session, size_t index,
- _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
-
- /// @}
- /// \name OrtRunOptions
- /// @{
-
- /** \brief Create an OrtRunOptions
- *
- * \param[out] out Returned newly created ::OrtRunOptions. Must be freed with OrtApi::ReleaseRunOptions
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreateRunOptions, _Outptr_ OrtRunOptions** out);
-
- /** \brief Set per-run log verbosity level
- *
- * \see OrtApi::RunOptionsGetRunLogVerbosityLevel
- *
- * \param[in] options
- * \param[in] log_verbosity_level \snippet{doc} snippets.dox Log Verbosity Level
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(RunOptionsSetRunLogVerbosityLevel, _Inout_ OrtRunOptions* options, int log_verbosity_level);
-
- /** \brief Set per-run log severity level
- *
- * \see OrtApi::RunOptionsGetRunLogSeverityLevel
- *
- * \param[in] options
- * \param[in] log_severity_level The log severity level (refer to ::OrtLoggingLevel for possible values).
- */
- ORT_API2_STATUS(RunOptionsSetRunLogSeverityLevel, _Inout_ OrtRunOptions* options, int log_severity_level);
-
- /** \brief Set per-run tag
- *
- * This is used in a per-run log identifier.
- *
- * \see OrtApi::RunOptionsGetRunTag
- *
- * \param[in] options
- * \param[in] run_tag The run tag.
- */
- ORT_API2_STATUS(RunOptionsSetRunTag, _Inout_ OrtRunOptions* options, _In_ const char* run_tag);
-
- /** \brief Get per-run log verbosity level
- *
- * \see OrtApi::RunOptionsSetRunLogVerbosityLevel
- *
- * \param[in] options
- * \param[out] log_verbosity_level \snippet{doc} snippets.dox Log Verbosity Level
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(RunOptionsGetRunLogVerbosityLevel, _In_ const OrtRunOptions* options,
- _Out_ int* log_verbosity_level);
-
- /** \brief Get per-run log severity level
- *
- * \see OrtApi::RunOptionsSetRunLogSeverityLevel
- *
- * \param[in] options
- * \param[out] log_severity_level The log severity level (refer to ::OrtLoggingLevel for possible values).
- */
- ORT_API2_STATUS(RunOptionsGetRunLogSeverityLevel, _In_ const OrtRunOptions* options, _Out_ int* log_severity_level);
-
- /** \brief Get per-run tag
- *
- * This is used in a per-run log identifier.
- *
- * \see OrtApi::RunOptionsSetRunTag
- *
- * \param[in] options
- * \param[out] run_tag The run tag.
- * Do not free this value, it is owned by `options`. It will be invalidated if the run tag
- * changes (i.e., with OrtApi::RunOptionsSetRunTag) or `options` is freed.
- */
- ORT_API2_STATUS(RunOptionsGetRunTag, _In_ const OrtRunOptions* options, _Out_ const char** run_tag);
-
- /** \brief Set terminate flag
- *
- * If a currently executing session needs to be force terminated, this can be called from another thread to force it to fail with an error.
- *
- * \param[in] options
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(RunOptionsSetTerminate, _Inout_ OrtRunOptions* options);
-
- /** \brief Clears the terminate flag
- *
- * Used so the OrtRunOptions instance can be used in a new OrtApi::Run call without it instantly terminating
- *
- * \param[in] options
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(RunOptionsUnsetTerminate, _Inout_ OrtRunOptions* options);
-
- /// @}
- /// \name OrtValue
- /// @{
-
- /** \brief Create a tensor
- *
- * Create a tensor using a supplied ::OrtAllocator
- *
- * \param[in] allocator
- * \param[in] shape Pointer to the tensor shape dimensions.
- * \param[in] shape_len The number of tensor shape dimensions.
- * \param[in] type
- * \param[out] out Returns newly created ::OrtValue. Must be freed with OrtApi::ReleaseValue
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreateTensorAsOrtValue, _Inout_ OrtAllocator* allocator, _In_ const int64_t* shape, size_t shape_len,
- ONNXTensorElementDataType type, _Outptr_ OrtValue** out);
-
- /** \brief Create a tensor backed by a user supplied buffer
- *
- * Create a tensor with user's buffer. You can fill the buffer either before calling this function or after.
- * p_data is owned by caller. ReleaseValue won't release p_data.
- *
- * \param[in] info Memory description of where the p_data buffer resides (CPU vs GPU etc).
- * \param[in] p_data Pointer to the data buffer.
- * \param[in] p_data_len The number of bytes in the data buffer.
- * \param[in] shape Pointer to the tensor shape dimensions.
- * \param[in] shape_len The number of tensor shape dimensions.
- * \param[in] type The data type.
- * \param[out] out Returns newly created ::OrtValue. Must be freed with OrtApi::ReleaseValue
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreateTensorWithDataAsOrtValue, _In_ const OrtMemoryInfo* info, _Inout_ void* p_data,
- size_t p_data_len, _In_ const int64_t* shape, size_t shape_len, ONNXTensorElementDataType type,
- _Outptr_ OrtValue** out);
-
- /** \brief Return if an ::OrtValue is a tensor type
- *
- * \param[in] value A tensor type (string tensors are not supported)
- * \param[out] out Set to 1 iff ::OrtValue is a tensor, 0 otherwise
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(IsTensor, _In_ const OrtValue* value, _Out_ int* out);
-
- /** \brief Get a pointer to the raw data inside a tensor
- *
- * Used to read/write/modify the internal tensor data directly.
- * \note The returned pointer is valid until the \p value is destroyed.
- *
- * \param[in] value A tensor type (string tensors are not supported)
- * \param[out] out Filled in with a pointer to the internal storage
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetTensorMutableData, _In_ OrtValue* value, _Outptr_ void** out);
-
- /** \brief Set all strings at once in a string tensor
- *
- * \param[in,out] value A tensor of type ONNX_TENSOR_ELEMENT_DATA_TYPE_STRING
- * \param[in] s An array of strings. Each string in this array must be null terminated.
- * \param[in] s_len Count of strings in s (Must match the size of \p value's tensor shape)
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(FillStringTensor, _Inout_ OrtValue* value, _In_ const char* const* s, size_t s_len);
-
- /** \brief Get total byte length for all strings in a string tensor
- *
- * Typically used with OrtApi::GetStringTensorContent
- *
- * \param[in] value A tensor of type ONNX_TENSOR_ELEMENT_DATA_TYPE_STRING
- * \param[out] len Total byte length of all strings (does not include trailing nulls)
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetStringTensorDataLength, _In_ const OrtValue* value, _Out_ size_t* len);
-
- /** \brief Get all strings from a string tensor
- *
- * An example of the results:<br>
- * Given \p value is a string tensor with the strings { "This" "is" "a" "test" }<br>
- * \p s must have a size of 11 bytes<br>
- * \p offsets must have 4 elements<br>
- * After the call, these values will be filled in:<br>
- * \p s will contain "Thisisatest"<br>
- * \p offsets will contain { 0, 4, 6, 7 }<br>
- * The length of the last string is just s_len - offsets[last]
- *
- * \param[in] value A tensor of type ONNX_TENSOR_ELEMENT_DATA_TYPE_STRING
- * \param[in] s Buffer to sequentially write all tensor strings to. Each string is NOT null-terminated.
- * \param[in] s_len Number of bytes of buffer pointed to by \p s (Get it from OrtApi::GetStringTensorDataLength)
- * \param[out] offsets Array of start offsets into the strings written to \p s
- * \param[in] offsets_len Number of elements in offsets
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetStringTensorContent, _In_ const OrtValue* value, _Out_writes_bytes_all_(s_len) void* s,
- size_t s_len, _Out_writes_all_(offsets_len) size_t* offsets, size_t offsets_len);
-
- /// @}
- /// \name OrtTypeInfo
- /// @{
-
- /** \brief Get ::OrtTensorTypeAndShapeInfo from an ::OrtTypeInfo
- *
- * \param[in] type_info
- * \param[out] out Do not free this value, it will be valid until type_info is freed.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CastTypeInfoToTensorInfo, _In_ const OrtTypeInfo* type_info,
- _Outptr_result_maybenull_ const OrtTensorTypeAndShapeInfo** out);
-
- /** \brief Get ::ONNXType from ::OrtTypeInfo
- *
- * \param[in] type_info
- * \param[out] out
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetOnnxTypeFromTypeInfo, _In_ const OrtTypeInfo* type_info, _Out_ enum ONNXType* out);
-
- /// @}
- /// \name OrtTensorTypeAndShapeInfo
- /// @{
-
- /** \brief Create an ::OrtTensorTypeAndShapeInfo object
- *
- * \param[out] out Returns newly created ::OrtTensorTypeAndShapeInfo. Must be freed with OrtApi::ReleaseTensorTypeAndShapeInfo
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreateTensorTypeAndShapeInfo, _Outptr_ OrtTensorTypeAndShapeInfo** out);
-
- /** \brief Set element type in ::OrtTensorTypeAndShapeInfo
- *
- * \param[in] info
- * \param[in] type
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SetTensorElementType, _Inout_ OrtTensorTypeAndShapeInfo* info, enum ONNXTensorElementDataType type);
-
- /** \brief Set shape information in ::OrtTensorTypeAndShapeInfo
- *
- * \param[in] info
- * \param[in] dim_values Array with `dim_count` elements. Can contain negative values.
- * \param[in] dim_count Number of elements in `dim_values`
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SetDimensions, OrtTensorTypeAndShapeInfo* info, _In_ const int64_t* dim_values, size_t dim_count);
-
- /** \brief Get element type in ::OrtTensorTypeAndShapeInfo
- *
- * \see OrtApi::SetTensorElementType
- *
- * \param[in] info
- * \param[out] out
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetTensorElementType, _In_ const OrtTensorTypeAndShapeInfo* info,
- _Out_ enum ONNXTensorElementDataType* out);
-
- /** \brief Get dimension count in ::OrtTensorTypeAndShapeInfo
- *
- * \see OrtApi::GetDimensions
- *
- * \param[in] info
- * \param[out] out
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetDimensionsCount, _In_ const OrtTensorTypeAndShapeInfo* info, _Out_ size_t* out);
-
- /** \brief Get dimensions in ::OrtTensorTypeAndShapeInfo
- *
- * \param[in] info
- * \param[out] dim_values Array with `dim_values_length` elements. On return, filled with the dimensions stored in the ::OrtTensorTypeAndShapeInfo
- * \param[in] dim_values_length Number of elements in `dim_values`. Use OrtApi::GetDimensionsCount to get this value
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetDimensions, _In_ const OrtTensorTypeAndShapeInfo* info, _Out_ int64_t* dim_values,
- size_t dim_values_length);
-
- /** \brief Get symbolic dimension names in ::OrtTensorTypeAndShapeInfo
- *
- * \param[in] info
- * \param[in] dim_params Array with `dim_params_length` elements. On return filled with pointers to null terminated strings of the dimension names
- * \param[in] dim_params_length Number of elements in `dim_params`. Use OrtApi::GetDimensionsCount to get this value
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetSymbolicDimensions, _In_ const OrtTensorTypeAndShapeInfo* info,
- _Out_writes_all_(dim_params_length) const char* dim_params[], size_t dim_params_length);
-
- /** \brief Get total number of elements in a tensor shape from an ::OrtTensorTypeAndShapeInfo
- *
- * Return the number of elements specified by the tensor shape (all dimensions multiplied by each other).
- * For 0 dimensions, 1 is returned. If any dimension is less than 0, the result is always -1.
- *
- * Examples:<br>
- * [] = 1<br>
- * [1,3,4] = 12<br>
- * [2,0,4] = 0<br>
- * [-1,3,4] = -1<br>
- *
- * \param[in] info
- * \param[out] out Number of elements
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetTensorShapeElementCount, _In_ const OrtTensorTypeAndShapeInfo* info, _Out_ size_t* out);
-
- /// @}
- /// \name OrtValue
- /// @{
-
- /** \brief Get type and shape information from a tensor ::OrtValue
- *
- * \param[in] value Must be a tensor (not a map/sequence/etc) or will return failure
- * \param[out] out Newly created ::OrtTensorTypeAndShapeInfo. Must be freed with OrtApi::ReleaseTensorTypeAndShapeInfo
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetTensorTypeAndShape, _In_ const OrtValue* value, _Outptr_ OrtTensorTypeAndShapeInfo** out);
-
- /** \brief Get type information of an OrtValue
- *
- * \param[in] value
- * \param[out] out Newly created ::OrtTypeInfo. Must be freed with OrtApi::ReleaseTypeInfo
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetTypeInfo, _In_ const OrtValue* value, _Outptr_result_maybenull_ OrtTypeInfo** out);
-
- /** \brief Get ONNXType of an ::OrtValue
- *
- * \param[in] value
- * \param[out] out
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetValueType, _In_ const OrtValue* value, _Out_ enum ONNXType* out);
-
- /// @}
- /// \name OrtMemoryInfo
- /// @{
-
- /** \brief Create an ::OrtMemoryInfo
- *
- * \param[in] name
- * \param[in] type
- * \param[in] id
- * \param[in] mem_type
- * \param[out] out Newly created ::OrtMemoryInfo. Must be freed with OrtAPi::ReleaseMemoryInfo
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreateMemoryInfo, _In_ const char* name, enum OrtAllocatorType type, int id,
- enum OrtMemType mem_type, _Outptr_ OrtMemoryInfo** out);
-
- /** \brief Create an ::OrtMemoryInfo for CPU memory
- *
- * Special case version of OrtApi::CreateMemoryInfo for CPU based memory. Same as using OrtApi::CreateMemoryInfo with name = "Cpu" and id = 0.
- *
- * \param[in] type
- * \param[in] mem_type
- * \param[out] out
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreateCpuMemoryInfo, enum OrtAllocatorType type, enum OrtMemType mem_type,
- _Outptr_ OrtMemoryInfo** out);
-
- /** \brief Compare ::OrtMemoryInfo objects for equality
- *
- * Compares all settings of each ::OrtMemoryInfo for equality
- *
- * \param[in] info1
- * \param[in] info2
- * \param[out] out Set to 0 if equal, -1 if not equal
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CompareMemoryInfo, _In_ const OrtMemoryInfo* info1, _In_ const OrtMemoryInfo* info2, _Out_ int* out);
-
- /** \brief Get name from ::OrtMemoryInfo
- *
- * \param[in] ptr
- * \param[out] out Writes null terminated string to this pointer. Do NOT free the returned pointer. It is valid for the lifetime of the ::OrtMemoryInfo
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(MemoryInfoGetName, _In_ const OrtMemoryInfo* ptr, _Out_ const char** out);
-
- /** \brief Get the id from ::OrtMemoryInfo
- */
- ORT_API2_STATUS(MemoryInfoGetId, _In_ const OrtMemoryInfo* ptr, _Out_ int* out);
-
- /** \brief Get the ::OrtMemType from ::OrtMemoryInfo
- */
- ORT_API2_STATUS(MemoryInfoGetMemType, _In_ const OrtMemoryInfo* ptr, _Out_ OrtMemType* out);
-
- /** \brief Get the ::OrtAllocatorType from ::OrtMemoryInfo
- */
- ORT_API2_STATUS(MemoryInfoGetType, _In_ const OrtMemoryInfo* ptr, _Out_ OrtAllocatorType* out);
-
- /// @}
- /// \name OrtAllocator
- /// @{
-
- /// \brief Calls OrtAllocator::Alloc function
- ORT_API2_STATUS(AllocatorAlloc, _Inout_ OrtAllocator* ort_allocator, size_t size, _Outptr_ void** out);
- /// \brief Calls OrtAllocator::Free function
- ORT_API2_STATUS(AllocatorFree, _Inout_ OrtAllocator* ort_allocator, void* p);
- /// \brief Calls OrtAllocator::Info function
- ORT_API2_STATUS(AllocatorGetInfo, _In_ const OrtAllocator* ort_allocator, _Outptr_ const struct OrtMemoryInfo** out);
-
- /** \brief Get the default allocator
- *
- * The default allocator is a CPU based, non-arena. Always returns the same pointer to the same default allocator.
- *
- * \param[out] out Returned value should NOT be freed
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetAllocatorWithDefaultOptions, _Outptr_ OrtAllocator** out);
-
- /// @}
- /// \name OrtSessionOptions
- /// @{
-
- /** \brief Override session symbolic dimensions
- *
- * Override symbolic dimensions (by specific denotation strings) with actual values if known at session initialization time to enable
- * optimizations that can take advantage of fixed values (such as memory planning, etc)
- *
- * \param[in] options
- * \param[in] dim_denotation
- * \param[in] dim_value
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(AddFreeDimensionOverride, _Inout_ OrtSessionOptions* options, _In_ const char* dim_denotation,
- _In_ int64_t dim_value);
-
- /// @}
- /// \name OrtValue
- /// @{
-
- /* Internal information (not seen in Doxygen)
- *
- * APIs to support non-tensor types - map and sequence.
- * Currently only the following types are supported
- * Note: the following types should be kept in sync with data_types.h
- * Map types
- * =========
- * std::map<std::string, std::string>
- * std::map<std::string, int64_t>
- * std::map<std::string, float>
- * std::map<std::string, double>
- * std::map<int64_t, std::string>
- * std::map<int64_t, int64_t>
- * std::map<int64_t, float>
- * std::map<int64_t, double>
- *
- * Sequence types
- * ==============
- * std::vector<std::string>
- * std::vector<int64_t>
- * std::vector<float>
- * std::vector<double>
- * std::vector<std::map<std::string, float>>
- * std::vector<std::map<int64_t, float>
- */
-
- /** \brief Get non tensor data from an ::OrtValue
- *
- * If `value` is of type ONNX_TYPE_MAP, you need to retrieve the keys and values
- * separately. Use index=0 to retrieve keys and index=1 to retrieve values.
- * If `value` is of type ONNX_TYPE_SEQUENCE, use index to retrieve the index'th element
- * of the sequence.
- *
- * \param[in] value
- * \param[in] index See above for usage based on `value` type
- * \param[in] allocator Allocator used to allocate ::OrtValue
- * \param[out] out Created ::OrtValue that holds the element requested. Must be freed with OrtApi::ReleaseValue
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetValue, _In_ const OrtValue* value, int index, _Inout_ OrtAllocator* allocator,
- _Outptr_ OrtValue** out);
-
- /** \brief Get non tensor value count from an ::OrtValue
- *
- * If `value` is of type ONNX_TYPE_MAP 2 will always be returned. For ONNX_TYPE_SEQUENCE
- * the number of elements in the sequence will be returned
- *
- * \param[in] value
- * \param[out] out
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetValueCount, _In_ const OrtValue* value, _Out_ size_t* out);
-
- /** \brief Create a map or sequence ::OrtValue
- *
- * To construct a map (ONNX_TYPE_MAP), use num_values = 2 and `in` should be an array of 2 ::OrtValue%s
- * representing keys and values.<br>
- *
- * To construct a sequence (ONNX_TYPE_SEQUENCE), use num_values = N where N is the number of the elements in the
- * sequence. 'in' should be an array of N ::OrtValue%s.
- *
- * \param[in] in See above for details
- * \param[in] num_values
- * \param[in] value_type Must be either ONNX_TYPE_MAP or ONNX_TYPE_SEQUENCE
- * \param[out] out Newly created ::OrtValue. Must be freed with OrtApi::ReleaseValue
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreateValue, _In_reads_(num_values) const OrtValue* const* in, size_t num_values,
- enum ONNXType value_type, _Outptr_ OrtValue** out);
-
- /** \brief Create an opaque (custom user defined type) ::OrtValue
- *
- * Constructs an ::OrtValue that contains a value of non-standard type created for
- * experiments or while awaiting standardization. ::OrtValue in this case would contain
- * an internal representation of the Opaque type. Opaque types are distinguished from
- * each other by two strings 1) domain and 2) type name. The combination of the two
- * must be unique, so the type representation is properly identified internally. The combination
- * must be properly registered from within ORT at both compile/run time or by another API.
- *
- * To construct the ::OrtValue pass domain and type names, also a pointer to a data container
- * the type of which must be known to both ORT and the client program. That data container may or may
- * not match the internal representation of the Opaque type. The sizeof(data_container) is passed for
- * verification purposes.
- *
- * \param[in] domain_name Null terminated string of the domain name
- * \param[in] type_name Null terminated string of the type name
- * \param[in] data_container User pointer Data to populate ::OrtValue
- * \param[in] data_container_size Size in bytes of what `data_container` points to
- * \param[out] out Newly created ::OrtValue. Must be freed with OrtApi::ReleaseValue
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreateOpaqueValue, _In_z_ const char* domain_name, _In_z_ const char* type_name,
- _In_ const void* data_container, size_t data_container_size, _Outptr_ OrtValue** out);
-
- /** \brief Get internal data from an opaque (custom user defined type) ::OrtValue
- *
- * Copies internal data from an opaque value into a user provided buffer
- *
- * \see OrtApi::CreateOpaqueValue
- *
- * \param[in] domain_name Null terminated string of the domain name
- * \param[in] type_name Null terminated string of the type name
- * \param[in] in The opaque ::OrtValue
- * \param[out] data_container Buffer to copy data into
- * \param[out] data_container_size Size in bytes of the buffer pointed to by data_container. Must match the size of the internal buffer.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetOpaqueValue, _In_ const char* domain_name, _In_ const char* type_name, _In_ const OrtValue* in,
- _Out_ void* data_container, size_t data_container_size);
-
- /// @}
- /// \name OrtKernelInfo
- /// Custom operator APIs.
- /// @{
-
- /** \brief Get a float stored as an attribute in the graph node
- *
- * \param[in] info ::OrtKernelInfo instance
- * \param[in] name Null terminated string of the name of the attribute
- * \param[out] out Pointer to memory where the attribute will be stored
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(KernelInfoGetAttribute_float, _In_ const OrtKernelInfo* info, _In_ const char* name,
- _Out_ float* out);
-
- /** \brief Fetch a 64-bit int stored as an attribute in the graph node
- *
- * \param[in] info ::OrtKernelInfo instance
- * \param[in] name Null terminated string of the name of the attribute
- * \param[out] out Pointer to memory where the attribute will be stored
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(KernelInfoGetAttribute_int64, _In_ const OrtKernelInfo* info, _In_ const char* name,
- _Out_ int64_t* out);
-
- /** \brief Fetch a string stored as an attribute in the graph node
- *
- * If `out` is nullptr, the value of `size` is set to the true size of the string
- * attribute, and a success status is returned.
- *
- * If the `size` parameter is greater than or equal to the actual string attribute's size,
- * the value of `size` is set to the true size of the string attribute, the provided memory
- * is filled with the attribute's contents, and a success status is returned.
- *
- * If the `size` parameter is less than the actual string attribute's size and `out`
- * is not nullptr, the value of `size` is set to the true size of the string attribute
- * and a failure status is returned.)
- *
- * \param[in] info ::OrtKernelInfo instance
- * \param[in] name Null terminated string of the name of the attribute
- * \param[out] out Pointer to memory where the attribute will be stored
- * \param[in,out] size See above comments for details
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(KernelInfoGetAttribute_string, _In_ const OrtKernelInfo* info, _In_ const char* name, _Out_ char* out,
- _Inout_ size_t* size);
-
- /// @}
- /// \name OrtKernelContext
- /// Custom operator APIs.
- /// @{
-
- /** \brief Used for custom operators, get the input count of a kernel
- *
- * \see ::OrtCustomOp
- */
- ORT_API2_STATUS(KernelContext_GetInputCount, _In_ const OrtKernelContext* context, _Out_ size_t* out);
-
- /** \brief Used for custom operators, get the output count of a kernel
- *
- * \see ::OrtCustomOp
- */
- ORT_API2_STATUS(KernelContext_GetOutputCount, _In_ const OrtKernelContext* context, _Out_ size_t* out);
-
- /** \brief Used for custom operators, get an input of a kernel
- *
- * \see ::OrtCustomOp
- */
- ORT_API2_STATUS(KernelContext_GetInput, _In_ const OrtKernelContext* context, _In_ size_t index,
- _Out_ const OrtValue** out);
-
- /** \brief Used for custom operators, get an output of a kernel
- *
- * \see ::OrtCustomOp
- */
- ORT_API2_STATUS(KernelContext_GetOutput, _Inout_ OrtKernelContext* context, _In_ size_t index,
- _In_ const int64_t* dim_values, size_t dim_count, _Outptr_ OrtValue** out);
-
- /// @}
- /// \name OrtEnv
- /// @{
- ORT_CLASS_RELEASE(Env);
- /// @}
- /// \name OrtStatus
- /// @{
- ORT_CLASS_RELEASE(Status);
- /// @}
- /// \name OrtMemoryInfo
- /// @{
- ORT_CLASS_RELEASE(MemoryInfo);
- /// @}
- /// \name OrtSession
- /// @{
- ORT_CLASS_RELEASE(Session); // Don't call ReleaseSession from Dllmain (because session owns a thread pool)
- /// @}
- /// \name OrtValue
- /// @{
- ORT_CLASS_RELEASE(Value);
- /// @}
- /// \name OrtRunOptions
- /// @{
- ORT_CLASS_RELEASE(RunOptions);
- /// @}
- /// \name OrtTypeInfo
- /// @{
- ORT_CLASS_RELEASE(TypeInfo);
- /// @}
- /// \name OrtTensorTypeAndShapeInfo
- /// @{
- ORT_CLASS_RELEASE(TensorTypeAndShapeInfo);
- /// @}
- /// \name OrtSessionOptions
- /// @{
- ORT_CLASS_RELEASE(SessionOptions);
- /// @}
- /// \name OrtCustomOpDomain
- /// @{
- ORT_CLASS_RELEASE(CustomOpDomain);
-
- /// @}
- /// \name OrtTypeInfo
- /// @{
-
- /** \brief Get denotation from type information
- *
- * Augments ::OrtTypeInfo to return denotations on the type.
- *
- * This is used by WinML to determine if an input/output is intended to be an Image or a Tensor.
- *
- * \param[in] type_info
- * \param[out] denotation Pointer to the null terminated denotation string is written to this pointer. This pointer is valid until the object is destroyed or the name is changed, do not free.
- * \param[out] len Length in bytes of the string returned in `denotation`
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetDenotationFromTypeInfo, _In_ const OrtTypeInfo* type_info, _Out_ const char** const denotation,
- _Out_ size_t* len);
-
- /** \brief Get detailed map information from an ::OrtTypeInfo
- *
- * This augments ::OrtTypeInfo to return an ::OrtMapTypeInfo when the type is a map.
- * The OrtMapTypeInfo has additional information about the map's key type and value type.
- *
- * This is used by WinML to support model reflection APIs.
- *
- * \param[out] type_info
- * \param[out] out A pointer to the ::OrtMapTypeInfo. Do not free this value
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CastTypeInfoToMapTypeInfo, _In_ const OrtTypeInfo* type_info,
- _Outptr_result_maybenull_ const OrtMapTypeInfo** out);
-
- /** \brief Cast ::OrtTypeInfo to an ::OrtSequenceTypeInfo
- *
- * This api augments ::OrtTypeInfo to return an ::OrtSequenceTypeInfo when the type is a sequence.
- * The ::OrtSequenceTypeInfo has additional information about the sequence's element type.
- *
- * This is used by WinML to support model reflection APIs.
- *
- * \param[in] type_info
- * \param[out] out A pointer to the OrtSequenceTypeInfo. Do not free this value
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CastTypeInfoToSequenceTypeInfo, _In_ const OrtTypeInfo* type_info,
- _Outptr_result_maybenull_ const OrtSequenceTypeInfo** out);
-
- /// @}
- /// \name OrtMapTypeInfo
- /// @{
-
- /** \brief Get key type from an ::OrtMapTypeInfo
- *
- * Key types are restricted to being scalar types.
- *
- * This is used by WinML to support model reflection APIs.
- *
- * \param[in] map_type_info
- * \param[out] out
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetMapKeyType, _In_ const OrtMapTypeInfo* map_type_info, _Out_ enum ONNXTensorElementDataType* out);
-
- /** \brief Get the value type from an ::OrtMapTypeInfo
- *
- * \param[in] map_type_info
- * \param[out] type_info
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetMapValueType, _In_ const OrtMapTypeInfo* map_type_info, _Outptr_ OrtTypeInfo** type_info);
-
- /// @}
- /// \name OrtSequenceTypeInfo
- /// @{
-
- /** \brief Get element type from an ::OrtSequenceTypeInfo
- *
- * This is used by WinML to support model reflection APIs.
- *
- * \param[in] sequence_type_info
- * \param[out] type_info
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetSequenceElementType, _In_ const OrtSequenceTypeInfo* sequence_type_info,
- _Outptr_ OrtTypeInfo** type_info);
-
- /// @}
- /// \name OrtMapTypeInfo
- /// @{
- ORT_CLASS_RELEASE(MapTypeInfo);
- /// @}
- /// \name OrtSequenceTypeInfo
- /// @{
- ORT_CLASS_RELEASE(SequenceTypeInfo);
-
- /// @}
- /// \name OrtSession
- /// @{
-
- /** \brief End profiling and return filename of the profile data
- *
- * Profiling is turned on through OrtApi::EnableProfiling
- *
- * \param[in] session
- * \param[in] allocator
- * \param[out] out Null terminated string of the filename, allocated using `allocator`. Must be freed using `allocator`
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SessionEndProfiling, _In_ OrtSession* session, _Inout_ OrtAllocator* allocator, _Outptr_ char** out);
-
- /** \brief Get ::OrtModelMetadata from an ::OrtSession
- *
- * \param[in] session
- * \param[out] out Newly created ::OrtModelMetadata. Must be freed using OrtApi::ReleaseModelMetadata
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SessionGetModelMetadata, _In_ const OrtSession* session, _Outptr_ OrtModelMetadata** out);
-
- /// @}
- /// \name OrtModelMetadata
- /// @{
-
- /** \brief Get `producer name` from an ::OrtModelMetadata
- *
- * \param[in] model_metadata
- * \param[in] allocator
- * \param[out] value Set to a null terminated string allocated using `allocator`. Must be freed using `allocator`
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(ModelMetadataGetProducerName, _In_ const OrtModelMetadata* model_metadata,
- _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
-
- /** \brief Get `graph name` from an ::OrtModelMetadata
- *
- * \param[in] model_metadata
- * \param[in] allocator
- * \param[out] value Set to a null terminated string allocated using `allocator`. Must be freed using `allocator`
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(ModelMetadataGetGraphName, _In_ const OrtModelMetadata* model_metadata,
- _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
-
- /** \brief Get `domain` from an ::OrtModelMetadata
- *
- * \param[in] model_metadata
- * \param[in] allocator
- * \param[out] value Set to a null terminated string allocated using `allocator`. Must be freed using `allocator`
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(ModelMetadataGetDomain, _In_ const OrtModelMetadata* model_metadata, _Inout_ OrtAllocator* allocator,
- _Outptr_ char** value);
-
- /** \brief Get `description` from an ::OrtModelMetadata
- *
- * \param[in] model_metadata
- * \param[in] allocator
- * \param[out] value Set to a null terminated string allocated using `allocator`. Must be freed using `allocator`
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(ModelMetadataGetDescription, _In_ const OrtModelMetadata* model_metadata,
- _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
-
- /** \brief Return data for a key in the custom metadata map in an ::OrtModelMetadata
- *
- * \param[in] model_metadata
- * \param[in] allocator
- * \param[in] key Null terminated string
- * \param[out] value Set to a null terminated string allocated using `allocator`. Must be freed using `allocator`
- * `value` will be set to nullptr if the given key is not found in the custom metadata map.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(ModelMetadataLookupCustomMetadataMap, _In_ const OrtModelMetadata* model_metadata,
- _Inout_ OrtAllocator* allocator, _In_ const char* key, _Outptr_result_maybenull_ char** value);
-
- /** \brief Get version number from an ::OrtModelMetadata
- *
- * \param[in] model_metadata
- * \param[out] value Set to the version number
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(ModelMetadataGetVersion, _In_ const OrtModelMetadata* model_metadata, _Out_ int64_t* value);
-
- ORT_CLASS_RELEASE(ModelMetadata);
-
- /// @}
- /// \name OrtEnv
- /// @{
-
- /** \brief Create an OrtEnv
- *
- * Create an environment with global threadpools that will be shared across sessions.
- * Use this in conjunction with OrtApi::DisablePerSessionThreads or else the session will use
- * its own thread pools.
- *
- * \param[in] log_severity_level The log severity level.
- * \param[in] logid The log identifier.
- * \param[in] tp_options
- * \param[out] out Returned newly created OrtEnv. Must be freed with OrtApi::ReleaseEnv
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreateEnvWithGlobalThreadPools, OrtLoggingLevel log_severity_level, _In_ const char* logid,
- _In_ const OrtThreadingOptions* tp_options, _Outptr_ OrtEnv** out);
-
- /// @}
- /// \name OrtSessionOptions
- /// @{
-
- /** \brief Use global thread pool on a session
- *
- * Disable using per session thread pool and use the shared global threadpool.
- * This should be used in conjunction with OrtApi::CreateEnvWithGlobalThreadPools.
- *
- * \param[in] options
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(DisablePerSessionThreads, _Inout_ OrtSessionOptions* options);
-
- /// @}
- /// \name OrtThreadingOptions
- /// @{
-
- /** \brief Create an ::OrtThreadingOptions
- *
- * \param[out] out Newly created ::OrtThreadingOptions. Must be freed with OrtApi::ReleaseThreadingOptions
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreateThreadingOptions, _Outptr_ OrtThreadingOptions** out);
-
- ORT_CLASS_RELEASE(ThreadingOptions);
-
- /// @}
- /// \name OrtModelMetadata
- /// @{
-
- /**
- *
- * \param[in] model_metadata
- * \param[in] allocator
- * \param[out] keys Array of null terminated strings (array count = num_keys) allocated using `allocator`.
- * The strings and the pointer array must be freed using `allocator`
- * `keys` will be set to nullptr if the custom metadata map is empty.
- * \param[out] num_keys Set to the number of elements in the `keys` array
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(ModelMetadataGetCustomMetadataMapKeys, _In_ const OrtModelMetadata* model_metadata,
- _Inout_ OrtAllocator* allocator, _Outptr_result_buffer_maybenull_(*num_keys) char*** keys, _Out_ int64_t* num_keys);
-
- /// @}
- /// \name OrtSessionOptions
- /// @{
-
- /**
- *
- * Override symbolic dimensions (by specific name strings) with actual values
- * if known at session initialization time to enable optimizations that can
- * take advantage of fixed values (such as memory planning, etc)
- *
- */
- ORT_API2_STATUS(AddFreeDimensionOverrideByName,
- _Inout_ OrtSessionOptions* options, _In_ const char* dim_name,
- _In_ int64_t dim_value);
-
- /// @}
- /// \name Misc
- /// @{
-
- /** \brief Get the names of all available providers
- *
- * \note The providers in the list are not guaranteed to be usable. They may fail to load due to missing system dependencies.
- * For example, if the CUDA/cuDNN libraries are not installed, the CUDA provider will report an error when it is added to the session options.
- *
- * \param[out] out_ptr Set to a pointer to an array of null terminated strings of the available providers. The entries and the
- * array itself must be freed using OrtApi::ReleaseAvailableProviders
- * \param[out] provider_length Set to the number of entries in the `out_ptr` array
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetAvailableProviders, _Outptr_ char*** out_ptr, _Out_ int* provider_length);
-
- /** \brief Release data from OrtApi::GetAvailableProviders
- *
- * \param[in] ptr The `out_ptr` result from OrtApi::GetAvailableProviders.
- * \param[in] providers_length The `provider_length` result from OrtApi::GetAvailableProviders
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(ReleaseAvailableProviders, _In_ char** ptr,
- _In_ int providers_length);
-
- /// @}
- /// \name OrtValue
- /// @{
-
- /** \brief Get the length of a single string in a string tensor
- *
- * \param[in] value A string tensor
- * \param[in] index Index of the string in the tensor
- * \param[out] out Set to number of bytes of the string element
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetStringTensorElementLength, _In_ const OrtValue* value, size_t index, _Out_ size_t* out);
-
- /** \brief Get a single string from a string tensor
- *
- * \param[in] value A string tensor
- * \param[in] s_len Number of bytes in the `s` buffer. Must match the value returned by OrtApi::GetStringTensorElementLength.
- * \param[in] index Index of the string in the tensor
- * \param[out] s The string element contents in UTF-8 encoding. The string is NOT null-terminated.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetStringTensorElement, _In_ const OrtValue* value, size_t s_len, size_t index, _Out_writes_bytes_all_(s_len) void* s);
-
- /** \brief Set a single string in a string tensor
- *
- * \param[in] value A string tensor
- * \param[in] s A null terminated UTF-8 encoded string
- * \param[in] index Index of the string in the tensor to set
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(FillStringTensorElement, _Inout_ OrtValue* value, _In_ const char* s, size_t index);
-
- /// @}
- /// \name OrtSessionOptions
- /// @{
-
- /** \brief Set a session configuration entry as a pair of strings
- *
- * If a configuration with same key exists, this will overwrite the configuration with the given config_value.
- *
- * The config_key and the format of config_value are defined in onnxruntime_session_options_config_keys.h
- *
- * \param[in] options
- * \param[in] config_key A null terminated string representation of the config key
- * \param[in] config_value A null terminated string representation of the config value
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(AddSessionConfigEntry, _Inout_ OrtSessionOptions* options,
- _In_z_ const char* config_key, _In_z_ const char* config_value);
-
- /// @}
- /// \name OrtAllocator
- /// @{
-
- /** \brief Create an allocator for an ::OrtSession following an ::OrtMemoryInfo
- *
- * \param[in] session
- * \param[in] mem_info valid ::OrtMemoryInfo instance
- * \param[out] out Newly created ::OrtAllocator. Must be freed with OrtApi::ReleaseAllocator
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreateAllocator, _In_ const OrtSession* session, _In_ const OrtMemoryInfo* mem_info,
- _Outptr_ OrtAllocator** out);
-
- /** \brief Release an ::OrtAllocator obtained from OrtApi::CreateAllocator
- */
- ORT_CLASS_RELEASE(Allocator);
-
- /// @}
- /// \name OrtSession
- /// @{
-
- /** \brief Run a model using Io Bindings for the inputs & outputs
- *
- * \see OrtApi::Run
- *
- * \param[in] session
- * \param[in] run_options
- * \param[in] binding_ptr
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(RunWithBinding, _Inout_ OrtSession* session, _In_ const OrtRunOptions* run_options, _In_ const OrtIoBinding* binding_ptr);
-
- /** \brief Create an ::OrtIoBinding instance
- *
- * An IoBinding object allows one to bind pre-allocated ::OrtValue%s to input names.
- * Thus if you want to use a raw on device buffer as input or output you can avoid
- * extra copy during runtime.
- *
- * \param[in] session
- * \param[out] out Newly created ::OrtIoBinding. Must be freed with OrtApi::ReleaseIoBinding
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreateIoBinding, _Inout_ OrtSession* session, _Outptr_ OrtIoBinding** out);
-
- /// @}
- /// \name OrtIoBinding
- /// @{
-
- /** \brief Release an ::OrtIoBinding obtained from OrtApi::CreateIoBinding
- */
- ORT_CLASS_RELEASE(IoBinding);
-
- /** \brief Bind an ::OrtValue to an ::OrtIoBinding input
- *
- * When using OrtApi::RunWithBinding this value is used for the named input
- *
- * \param[in] binding_ptr
- * \param[in] name Name for the model input
- * \param[in] val_ptr ::OrtValue of Tensor type.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(BindInput, _Inout_ OrtIoBinding* binding_ptr, _In_ const char* name, _In_ const OrtValue* val_ptr);
-
- /** \brief Bind an ::OrtValue to an ::OrtIoBinding output
- *
- * When using OrtApi::RunWithBinding this value is used for the named output
- *
- * \param[in] binding_ptr
- * \param[in] name Null terminated string of the model output name
- * \param[in] val_ptr ::OrtValue of Tensor type.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(BindOutput, _Inout_ OrtIoBinding* binding_ptr, _In_ const char* name, _In_ const OrtValue* val_ptr);
-
- /** \brief Bind an ::OrtIoBinding output to a device
- *
- * Binds the ::OrtValue to a device which is specified by ::OrtMemoryInfo.
- * You can either create an instance of ::OrtMemoryInfo with a device id or obtain one from the allocator that you have created/are using
- * This is useful when one or more outputs have dynamic shapes and, it is hard to pre-allocate and bind a chunk of
- * memory within ::OrtValue ahead of time.
- *
- * \see OrtApi::RunWithBinding
- *
- * \param[in] binding_ptr
- * \param[in] name Null terminated string of the device name
- * \param[in] mem_info_ptr
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(BindOutputToDevice, _Inout_ OrtIoBinding* binding_ptr, _In_ const char* name, _In_ const OrtMemoryInfo* mem_info_ptr);
-
- /** \brief Get the names of an ::OrtIoBinding's outputs
- *
- * Returns the names of the outputs in the order they were bound. This is useful after running the model
- * with bound outputs because the returned names are in order in which output ::OrtValue are returned. This is useful if
- * the order of outputs and their names is not known.
- *
- * \param[in] binding_ptr
- * \param[in] allocator Allocator used to allocate continuous buffers for output strings and lengths.
- * \param[out] buffer Returns an array of non-null terminated UTF-8 strings. The number of strings stored is returned in the count parameter.
- * This buffer is allocated using `allocator` and must be freed using it.
- * \param[out] lengths Returns an array of `count` lengths of the strings returned in `buffer`
- * This buffer is allocated using `allocator` and must be freed using it.
- * \param[out] count Number of strings returned. If `binding_ptr` has no bound outputs, zero is returned,
- * no memory allocation is performed and buffer and lengths are set to nullptr.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetBoundOutputNames, _In_ const OrtIoBinding* binding_ptr, _In_ OrtAllocator* allocator,
- _Out_ char** buffer, _Out_writes_all_(count) size_t** lengths, _Out_ size_t* count);
-
- /** \brief Get the output ::OrtValue objects from an ::OrtIoBinding
- *
- * Returns an array of pointers to individually allocated ::OrtValue%s that contain results of a model execution with OrtApi::RunWithBinding
- * The array contains the same number of ::OrtValue%s and they are in the same order as they were bound with OrtApi::BindOutput
- * or OrtApi::BindOutputToDevice.
- *
- * The returned ::OrtValue%s must be released using OrtApi::ReleaseValue after they are no longer needed.
- * The array is allocated using the specified instance of the allocator and must be freed using the same allocator after
- * all the ::OrtValue%s contained therein are individually released.
- *
- * \param[in] binding_ptr
- * \param[in] allocator Allocator used to allocate output array
- * \param[out] output Set to the allocated array of allocated ::OrtValue outputs. Set to nullptr if there are 0 outputs.
- * \param[out] output_count Set to number of ::OrtValue%s returned
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetBoundOutputValues, _In_ const OrtIoBinding* binding_ptr, _In_ OrtAllocator* allocator,
- _Out_writes_all_(output_count) OrtValue*** output, _Out_ size_t* output_count);
-
- /** \brief Clears any previously set Inputs for an ::OrtIoBinding
- */
- void(ORT_API_CALL* ClearBoundInputs)(_Inout_ OrtIoBinding* binding_ptr) NO_EXCEPTION ORT_ALL_ARGS_NONNULL;
-
- /** \brief Clears any previously set Outputs for an ::OrtIoBinding
- */
- void(ORT_API_CALL* ClearBoundOutputs)(_Inout_ OrtIoBinding* binding_ptr) NO_EXCEPTION ORT_ALL_ARGS_NONNULL;
-
- /// @}
- /// \name OrtValue
- /// @{
-
- /** \brief Direct memory access to a specified tensor element
- *
- * For example, given a tensor with shape of [3,224,224], a pointer to the element at location [2,150,128] can be retrieved
- *
- * This function only works for numeric type tensors (No strings, etc).
- * This is a no-copy method whose returned pointer is valid until the passed in ::OrtValue is free'd.
- *
- * \param[in] value
- * \param[in] location_values Pointer to an array of index values that specify an element's location relative to its shape
- * \param[in] location_values_count Number of elements in location_values. Must match the number of elements in the tensor's shape.
- * \param[out] out Set to a pointer to the element specified
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(TensorAt, _Inout_ OrtValue* value, const int64_t* location_values, size_t location_values_count, _Outptr_ void** out);
-
- /// @}
- /// \name OrtEnv
- /// @{
-
- /** \brief Create an allocator and register it with the ::OrtEnv
- *
- * Enables sharing the allocator between multiple sessions that use the same env instance.
- * Lifetime of the created allocator will be valid for the duration of the environment.
- * Returns an error if an allocator with the same ::OrtMemoryInfo is already registered.
- *
- * See https://onnxruntime.ai/docs/reference/api/c-api.html for details.
- *
- * \param[in] env ::OrtEnv instance
- * \param[in] mem_info
- * \param[in] arena_cfg Pass nullptr for defaults
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreateAndRegisterAllocator, _Inout_ OrtEnv* env, _In_ const OrtMemoryInfo* mem_info,
- _In_ const OrtArenaCfg* arena_cfg);
-
- /** \brief Set language projection
- *
- * Set the language projection for collecting telemetry data when Env is created.
- *
- * The default is ORT_PROJECTION_C, which means it will classify the language not in the list to C also.
- *
- * \param[in] ort_env
- * \param[in] projection
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SetLanguageProjection, _In_ const OrtEnv* ort_env, _In_ OrtLanguageProjection projection);
-
- /// @}
- /// \name OrtSession
- /// @{
-
- /** \brief Return the time that profiling was started
- *
- * \note The timer precision varies per platform. On Windows and MacOS, the precision will be ~100ns
- *
- * \param[in] session
- * \param[out] out nanoseconds of profiling's start time
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SessionGetProfilingStartTimeNs, _In_ const OrtSession* session, _Outptr_ uint64_t* out);
-
- /// @}
- /// \name OrtThreadingOptions
- /// @{
-
- /** \brief Set global intra-op thread count
- *
- * This configures the global thread pool options to be used in the call to OrtApi::CreateEnvWithGlobalThreadPools
- *
- * \param[in] tp_options
- * \param[in] intra_op_num_threads Number of threads, special values:<br>
- * 0 = Use default thread count<br>
- * 1 = The invoking thread will be used; no threads will be created in the thread pool.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SetGlobalIntraOpNumThreads, _Inout_ OrtThreadingOptions* tp_options, int intra_op_num_threads);
-
- /** \brief Set global inter-op thread count
- *
- * This configures the global thread pool options to be used in the call to OrtApi::CreateEnvWithGlobalThreadPools
- *
- * \param[in] tp_options
- * \param[in] inter_op_num_threads Number of threads, special values:<br>
- * 0 = Use default thread count<br>
- * 1 = The invoking thread will be used; no threads will be created in the thread pool.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SetGlobalInterOpNumThreads, _Inout_ OrtThreadingOptions* tp_options, int inter_op_num_threads);
-
- /** \brief Set global spin control options
- *
- * This will configure the global thread pool options to be used in the call to OrtApi::CreateEnvWithGlobalThreadPools.
- * Allow spinning of thread pools when their queues are empty. This will set the value for both
- * inter_op and intra_op threadpools.
- *
- * \param[in] tp_options
- * \param[in] allow_spinning Valid values are 0 or 1.<br>
- * 0 = It won't spin (recommended if CPU usage is high)<br>
- * 1 = Threadpool will spin to wait for queue to become non-empty
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SetGlobalSpinControl, _Inout_ OrtThreadingOptions* tp_options, int allow_spinning);
-
- /// @}
- /// \name OrtSessionOptions
- /// @{
-
- /** \brief Add a pre-allocated initializer to a session
- *
- * If a model contains an initializer with a name that is same as the name passed to this call,
- * ORT will use this initializer instance instead of deserializing one from the model file. This
- * is useful when you want to share the same initializer across sessions.
- *
- * \param[in] options
- * \param[in] name Null terminated string of the initializer name
- * \param[in] val ::OrtValue containing the initializer. Its lifetime and the underlying initializer buffer must be
- * managed by the user (created using the OrtApi::CreateTensorWithDataAsOrtValue) and it must outlive the session object
- * to which it is added.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(AddInitializer, _Inout_ OrtSessionOptions* options, _In_z_ const char* name,
- _In_ const OrtValue* val);
-
- /// @}
- /// \name OrtEnv
- /// @{
-
- /**
- * Create a custom environment with global threadpools and logger that will be shared across sessions.
- * Use this in conjunction with OrtApi::DisablePerSessionThreads or else the session will use
- * its own thread pools.
- *
- * \param[in] logging_function A pointer to a logging function.
- * \param[in] logger_param A pointer to arbitrary data passed as the ::OrtLoggingFunction `param` parameter to
- * `logging_function`.
- * \param[in] log_severity_level The log severity level.
- * \param[in] logid The log identifier.
- * \param[in] tp_options
- * \param[out] out Newly created OrtEnv. Must be freed with OrtApi::ReleaseEnv
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreateEnvWithCustomLoggerAndGlobalThreadPools, OrtLoggingFunction logging_function, _In_opt_ void* logger_param, OrtLoggingLevel log_severity_level,
- _In_ const char* logid, _In_ const struct OrtThreadingOptions* tp_options, _Outptr_ OrtEnv** out);
-
- /// @}
- /// \name OrtSessionOptions
- /// @{
-
- /** \brief Append CUDA provider to session options
- *
- * If CUDA is not available (due to a non CUDA enabled build, or if CUDA is not installed on the system), this function will return failure.
- *
- * \param[in] options
- * \param[in] cuda_options
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SessionOptionsAppendExecutionProvider_CUDA,
- _In_ OrtSessionOptions* options, _In_ const OrtCUDAProviderOptions* cuda_options);
-
- /** \brief Append ROCM execution provider to the session options
- *
- * If ROCM is not available (due to a non ROCM enabled build, or if ROCM is not installed on the system), this function will return failure.
- *
- * \param[in] options
- * \param[in] rocm_options
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SessionOptionsAppendExecutionProvider_ROCM,
- _In_ OrtSessionOptions* options, _In_ const OrtROCMProviderOptions* rocm_options);
-
- /** \brief Append OpenVINO execution provider to the session options
- *
- * If OpenVINO is not available (due to a non OpenVINO enabled build, or if OpenVINO is not installed on the system), this function will fail.
- *
- * \param[in] options
- * \param[in] provider_options
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SessionOptionsAppendExecutionProvider_OpenVINO,
- _In_ OrtSessionOptions* options, _In_ const OrtOpenVINOProviderOptions* provider_options);
-
- /// @}
- /// \name OrtThreadingOptions
- /// @{
-
- /** \brief Set threading flush-to-zero and denormal-as-zero
- *
- * Sets global thread pool options to be used in the call to OrtApi::CreateEnvWithGlobalThreadPools.
- * Flush-to-zero and denormal-as-zero are applied to threads in both intra and inter global thread pool.
- * \note This option is not needed if the models used have no denormals. Having no denormals is recommended as this option may hurt model accuracy.
- *
- * \param[in] tp_options
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SetGlobalDenormalAsZero, _Inout_ OrtThreadingOptions* tp_options);
-
- /// @}
- /// \name OrtArenaCfg
- /// @{
-
- /** \deprecated Use OrtApi::CreateArenaCfgV2
- *
- * This will create the configuration of an arena that can eventually be used to define an arena based allocator's behavior
- *
- * \param[in] max_mem Use 0 to allow ORT to choose the default
- * \param[in] arena_extend_strategy Use -1 to allow ORT to choose the default, 0 = kNextPowerOfTwo, 1 = kSameAsRequested
- * \param[in] initial_chunk_size_bytes Use -1 to allow ORT to choose the default
- * \param[in] max_dead_bytes_per_chunk Use -1 to allow ORT to choose the default
- * \param[in] out A pointer to an OrtArenaCfg instance
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreateArenaCfg, _In_ size_t max_mem, int arena_extend_strategy, int initial_chunk_size_bytes,
- int max_dead_bytes_per_chunk, _Outptr_ OrtArenaCfg** out);
-
- ORT_CLASS_RELEASE(ArenaCfg);
-
- /// @}
- /// \name OrtModelMetadata
- /// @{
-
- /**
- * Use this to obtain the description of the graph present in the model
- * (doc_string field of the GraphProto message within the ModelProto message).
- * If it doesn't exist, an empty string will be returned.
- *
- * \param[in] model_metadata An instance of ::OrtModelMetadata
- * \param[in] allocator Allocator used to allocate the string that will be returned back
- * \param[out] value Set to a null terminated string allocated using `allocator`. The caller is responsible for freeing it using `allocator`
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(ModelMetadataGetGraphDescription, _In_ const OrtModelMetadata* model_metadata,
- _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
-
- /// @}
- /// \name OrtSessionOptions
- /// @{
-
- /** \brief Append TensorRT provider to session options
- *
- * If TensorRT is not available (due to a non TensorRT enabled build, or if TensorRT is not installed on the system), this function will return failure.
- *
- * \param[in] options
- * \param[in] tensorrt_options
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SessionOptionsAppendExecutionProvider_TensorRT,
- _In_ OrtSessionOptions* options, _In_ const OrtTensorRTProviderOptions* tensorrt_options);
-
- /// @}
- /// \name Misc
- /// @{
-
- /** \brief Set current GPU device ID
- *
- * Set the current device id of the GPU execution provider (CUDA/tensorrt/rocm). The device id should be less
- * than the total number of devices available. This is only useful when multiple-GPUs are installed and it is
- * required to restrict execution to a single GPU.
- *
- * \param[in] device_id
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SetCurrentGpuDeviceId, _In_ int device_id);
-
- /** \brief Get current GPU device ID
- *
- * Get the current device id of the GPU execution provider (CUDA/tensorrt/rocm).
- *
- * \see OrtApi::SetCurrentGpuDeviceId
- *
- * \param[out] device_id
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetCurrentGpuDeviceId, _In_ int* device_id);
-
- /// @}
- /// \name OrtKernelInfo
- /// Custom operator APIs.
- /// @{
-
- /** \brief Fetch an array of int64_t values stored as an attribute in the graph node
- *
- *
- * If `out` is nullptr, the value of `size` is set to the true size of the attribute
- * array's size, and a success status is returned.
- *
- * If the `size` parameter is greater than or equal to the actual attribute array's size,
- * the value of `size` is set to the true size of the attribute array's size,
- * the provided memory is filled with the attribute's contents,
- * and a success status is returned.
- *
- * If the `size` parameter is less than the actual attribute array's size and `out`
- * is not nullptr, the value of `size` is set to the true size of the attribute array's size
- * and a failure status is returned.)
- *
- * \param[in] info instance
- * \param[in] name name of the attribute to be parsed
- * \param[out] out pointer to memory where the attribute's contents are to be stored
- * \param[in, out] size actual size of attribute array
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(KernelInfoGetAttributeArray_float, _In_ const OrtKernelInfo* info, _In_ const char* name,
- _Out_ float* out, _Inout_ size_t* size);
-
- /** \brief Fetch an array of int64_t values stored as an attribute in the graph node
- *
- * If `out` is nullptr, the value of `size` is set to the true size of the attribute
- * array's size, and a success status is returned.
- *
- * If the `size` parameter is greater than or equal to the actual attribute array's size,
- * the value of `size` is set to the true size of the attribute array's size,
- * the provided memory is filled with the attribute's contents,
- * and a success status is returned.
- *
- * If the `size` parameter is less than the actual attribute array's size and `out`
- * is not nullptr, the value of `size` is set to the true size of the attribute array's size
- * and a failure status is returned.)
- *
- * \param[in] info instance
- * \param[in] name name of the attribute to be parsed
- * \param[out] out pointer to memory where the attribute's contents are to be stored
- * \param[in, out] size actual size of attribute array
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(KernelInfoGetAttributeArray_int64, _In_ const OrtKernelInfo* info, _In_ const char* name,
- _Out_ int64_t* out, _Inout_ size_t* size);
-
- /// @}
- /// \name OrtArenaCfg
- /// @{
-
- /** \brief Create an ::OrtArenaCfg
- *
- * Create the configuration of an arena that can eventually be used to define an arena based allocator's behavior.
- *
- * Supported keys are (See https://onnxruntime.ai/docs/reference/api/c-api.html for details on what the
- * following parameters mean and how to choose these values.):
- * "max_mem": Maximum memory that can be allocated by the arena based allocator.
- * Use 0 for ORT to pick the best value. Default is 0.
- * "arena_extend_strategy": 0 = kNextPowerOfTwo, 1 = kSameAsRequested.
- * Use -1 to allow ORT to choose the default.
- * "initial_chunk_size_bytes": (Possible) Size of the first allocation in the arena.
- * Only relevant if arena strategy is `kNextPowerOfTwo`. Use -1 to allow ORT to choose the default.
- * Ultimately, the first allocation size is determined by the allocation memory request.
- * "max_dead_bytes_per_chunk": Threshold of unused memory in an allocated chunk of arena memory after
- * crossing which the current chunk is chunked into 2.
- * "initial_growth_chunk_size_bytes": (Possible) Size of the second allocation in the arena.
- * Only relevant if arena strategy is `kNextPowerOfTwo`. Use -1 to allow ORT to choose the default.
- * Ultimately, the allocation size is determined by the allocation memory request.
- * Further allocation sizes are governed by the arena extend strategy.
- *
- * \param[in] arena_config_keys Keys to configure the arena
- * \param[in] arena_config_values Values to configure the arena
- * \param[in] num_keys Number of keys in `arena_config_keys` and `arena_config_values`
- * \param[out] out Newly created ::OrtArenaCfg. Must be freed with OrtApi::ReleaseArenaCfg
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreateArenaCfgV2, _In_reads_(num_keys) const char* const* arena_config_keys,
- _In_reads_(num_keys) const size_t* arena_config_values, _In_ size_t num_keys,
- _Outptr_ OrtArenaCfg** out);
-
- /// @}
- /// \name OrtRunOptions
- /// @{
-
- /** \brief Set a single run configuration entry as a pair of strings
- *
- * If a configuration with same key exists, this will overwrite the configuration with the given config_value
- *
- * The config_key and the format of config_value are defined in onnxruntime_run_options_config_keys.h
- *
- * \param[in] options
- * \param[in] config_key A null terminated string representation of the config key
- * \param[in] config_value A null terminated string representation of the config value
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(AddRunConfigEntry, _Inout_ OrtRunOptions* options,
- _In_z_ const char* config_key, _In_z_ const char* config_value);
-
- /// @}
- /// \name OrtPrepackedWeightsContainer
- /// @{
-
- /** \brief Create an ::OrtPrepackedWeightsContainer
- *
- * This container will hold pre-packed buffers of shared initializers for sharing between sessions
- * (i.e.) if there are shared initializers that can be shared between sessions, the pre-packed buffers
- * of these (if any) may possibly be shared to provide memory footprint savings. Pass this container
- * to sessions that you would like to share pre-packed buffers of shared initializers at session
- * creation time.
- *
- * \param[out] out Newly created ::OrtPrepackedWeightsContainer. Must be freed with OrtApi::ReleasePrepackedWeightsContainer
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreatePrepackedWeightsContainer, _Outptr_ OrtPrepackedWeightsContainer** out);
-
- /** \brief Release OrtPrepackedWeightsContainer instance
- *
- * \note instance must not be released until the sessions using it are released
- */
- ORT_CLASS_RELEASE(PrepackedWeightsContainer);
-
- /// @}
- /// \name OrtSession
- /// @{
-
- /** \brief Create session with prepacked weights container
- *
- * Same functionality offered by OrtApi::CreateSession except that a container that contains
- * pre-packed weights' buffers is written into/read from by the created session.
- * This is useful when used in conjunction with OrtApi::AddInitializer which injects
- * shared initializer info into sessions. Wherever possible, the pre-packed versions of these
- * shared initializers are cached in this container so that multiple sessions can just re-use
- * these instead of duplicating these in memory.
- *
- * \param[in] env OrtEnv instance instance
- * \param[in] model_path Null terminated string of the path (wchar on Windows, char otherwise)
- * \param[in] options
- * \param[in] prepacked_weights_container
- * \param[out] out Newly created ::OrtSession. Must be freed with OrtApi::ReleaseSession
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreateSessionWithPrepackedWeightsContainer, _In_ const OrtEnv* env, _In_ const ORTCHAR_T* model_path,
- _In_ const OrtSessionOptions* options, _Inout_ OrtPrepackedWeightsContainer* prepacked_weights_container,
- _Outptr_ OrtSession** out);
-
- /** \brief Create session from memory with prepacked weights container
- *
- * Same functionality offered by OrtApi::CreateSessionFromArray except that a container that contains
- * pre-packed weights' buffers is written into/read from by the created session.
- * This is useful when used in conjunction with OrtApi::AddInitializer which injects
- * shared initializer info into sessions. Wherever possible, the pre-packed versions of these
- * shared initializers are cached in this container so that multiple sessions can just re-use
- * these instead of duplicating these in memory.
- *
- * \param[in] env
- * \param[in] model_data Array of bytes holding the model
- * \param[in] model_data_length Number of bytes in `model_data_model`
- * \param[in] options
- * \param[in] prepacked_weights_container
- * \param[out] out Newly created ::OrtSession. Must be freed with OrtApi::ReleaseSession
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreateSessionFromArrayWithPrepackedWeightsContainer, _In_ const OrtEnv* env,
- _In_ const void* model_data, size_t model_data_length,
- _In_ const OrtSessionOptions* options, _Inout_ OrtPrepackedWeightsContainer* prepacked_weights_container,
- _Outptr_ OrtSession** out);
-
- /// @}
- /// \name OrtSessionOptions
- /// @{
-
- /** \brief Append TensorRT execution provider to the session options
- *
- * If TensorRT is not available (due to a non TensorRT enabled build), this function will return failure.
- *
- * This is slightly different from OrtApi::SessionOptionsAppendExecutionProvider_TensorRT, it takes an
- * ::OrtTensorRTProviderOptions which is publicly defined. This takes an opaque ::OrtTensorRTProviderOptionsV2
- * which must be created with OrtApi::CreateTensorRTProviderOptions.
- *
- * For OrtApi::SessionOptionsAppendExecutionProvider_TensorRT, the user needs to instantiate ::OrtTensorRTProviderOptions
- * as well as allocate/release buffers for some members of ::OrtTensorRTProviderOptions.
- * Here, OrtApi::CreateTensorRTProviderOptions and Ortapi::ReleaseTensorRTProviderOptions will do the memory management for you.
- *
- * \param[in] options
- * \param[in] tensorrt_options
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SessionOptionsAppendExecutionProvider_TensorRT_V2,
- _In_ OrtSessionOptions* options, _In_ const OrtTensorRTProviderOptionsV2* tensorrt_options);
-
- /// @}
- /// \name OrtTensorRTProviderOptionsV2
- /// @{
-
- /** \brief Create an OrtTensorRTProviderOptionsV2
- *
- * \param[out] out Newly created ::OrtTensorRTProviderOptionsV2. Must be released with OrtApi::ReleaseTensorRTProviderOptions
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreateTensorRTProviderOptions, _Outptr_ OrtTensorRTProviderOptionsV2** out);
-
- /** \brief Set options in a TensorRT Execution Provider.
- *
- * Please refer to https://www.onnxruntime.ai/docs/reference/execution-providers/TensorRT-ExecutionProvider.html#c-api-example
- * to know the available keys and values. Key should be in null terminated string format of the member of ::OrtTensorRTProviderOptionsV2
- * and value should be its related range.
- *
- * For example, key="trt_max_workspace_size" and value="2147483648"
- *
- * \param[in] tensorrt_options
- * \param[in] provider_options_keys Array of UTF-8 null-terminated string for provider options keys
- * \param[in] provider_options_values Array of UTF-8 null-terminated string for provider options values
- * \param[in] num_keys Number of elements in the `provider_option_keys` and `provider_options_values` arrays
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(UpdateTensorRTProviderOptions, _Inout_ OrtTensorRTProviderOptionsV2* tensorrt_options,
- _In_reads_(num_keys) const char* const* provider_options_keys,
- _In_reads_(num_keys) const char* const* provider_options_values,
- _In_ size_t num_keys);
-
- /** \brief Get serialized TensorRT provider options string.
- *
- * For example, "trt_max_workspace_size=2147483648;trt_max_partition_iterations=10;trt_int8_enable=1;......"
- *
- * \param tensorrt_options - OrTensorRTProviderOptionsV2 instance
- * \param allocator - a ptr to an instance of OrtAllocator obtained with OrtApi::CreateAllocator or OrtApi::GetAllocatorWithDefaultOptions
- * the specified allocator will be used to allocate continuous buffers for output strings and lengths.
- * \param ptr - is a UTF-8 null terminated string allocated using 'allocator'. The caller is responsible for using the same allocator to free it.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetTensorRTProviderOptionsAsString, _In_ const OrtTensorRTProviderOptionsV2* tensorrt_options, _Inout_ OrtAllocator* allocator, _Outptr_ char** ptr);
-
- /** \brief Release an ::OrtTensorRTProviderOptionsV2
- *
- * \note This is an exception in the naming convention of other Release* functions, as the name of the method does not have the V2 suffix, but the type does
- */
- void(ORT_API_CALL* ReleaseTensorRTProviderOptions)(_Frees_ptr_opt_ OrtTensorRTProviderOptionsV2* input);
-
- /// @}
- /// \name OrtSessionOptions
- /// @{
-
- /** \brief Enable custom operators
- *
- * See onnxruntime-extensions: https://github.com/microsoft/onnxruntime-extensions.git
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(EnableOrtCustomOps, _Inout_ OrtSessionOptions* options);
-
- /// @}
- /// \name OrtAllocator
- /// @{
-
- /** \brief Register a custom allocator
- *
- * Enables sharing between multiple sessions that use the same env instance.
- * Returns an error if an allocator with the same ::OrtMemoryInfo is already registered.
- *
- * The behavior of this is exactly the same as OrtApi::CreateAndRegisterAllocator except
- * instead of ORT creating an allocator based on provided info, in this case
- * ORT uses the user-provided custom allocator.
- * See https://onnxruntime.ai/docs/reference/api/c-api.html for details.
- *
- * \param[in] env
- * \param[in] allocator User provided allocator
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(RegisterAllocator, _Inout_ OrtEnv* env, _In_ OrtAllocator* allocator);
-
- /** \brief Unregister a custom allocator
- *
- * It is an error if you provide an ::OrtMemoryInfo not corresponding to any
- * registered allocators for sharing.
- *
- * \param[in] env
- * \param[in] mem_info
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(UnregisterAllocator, _Inout_ OrtEnv* env,
- _In_ const OrtMemoryInfo* mem_info);
-
- /// @}
- /// \name OrtValue
- /// @{
-
- /** \brief Sets *out to 1 iff an ::OrtValue is a SparseTensor, and 0 otherwise
- *
- * \param[in] value existing ::OrtValue
- * \param[out] out unless an error occurs, contains 1 iff the value contains an instance
- * of sparse tensor or 0 otherwise.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(IsSparseTensor, _In_ const OrtValue* value, _Out_ int* out);
-
- /** \brief Create an ::OrtValue with a sparse tensor that is empty.
- *
- * Use FillSparseTensor<Format>() functions to populate sparse tensor with non-zero values and
- * format specific indices data.
- * Use ReleaseValue to destroy the sparse tensor, this will also release the buffer inside the output value
- * if any was allocated.
- * \param[in,out] allocator allocator to use when performing an allocation. Allocation will be performed
- * by FillSparseTensor<Format>() APIs. The lifespan of the allocator instance must eclipse the lifespan
- * this sparse tensor instance as the same allocator will be used to free memory.
- * \param[in] dense_shape shape of the original dense tensor
- * \param[in] dense_shape_len number of shape dimensions being passed
- * \param[in] type must be one of TENSOR_ELEMENT_DATA_TYPE_xxxx
- * \param[out] out Should be freed by calling ReleaseValue
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreateSparseTensorAsOrtValue, _Inout_ OrtAllocator* allocator, _In_ const int64_t* dense_shape,
- size_t dense_shape_len, ONNXTensorElementDataType type, _Outptr_ OrtValue** out);
-
- /**
- * This fills populates an empty tensor that was created using OrtApi::CreateSparseTensorAsOrtValue.
- * This will allocate required memory and copy the supplied NNZ values and COO indices into that memory allocation.
- * Memory allocation is performed using the allocator that was specified with OrtApi::CreateSparseTensorAsOrtValue.
- *
- * \param[in,out] ort_value ::OrtValue to populate with data
- * \param[in] data_mem_info serves to identify the location of the data to be copied. If the allocator specified
- * at the creation time has memory info that is not the same as mem_info argument to this function a X-device copy will be performed.
- * String data is assumed to be on CPU and will only be copied into a CPU allocated buffer.
- * \param[in] values_shape pointer to values shape array
- * \param[in] values_shape_len length of the values_shape
- * \param[in] values pointer to an array of values. For strings, pass const char**.
- * \param[in] indices_data pointer to a location of COO indices
- * \param[in] indices_num number of COO indices
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(FillSparseTensorCoo, _Inout_ OrtValue* ort_value, _In_ const OrtMemoryInfo* data_mem_info,
- _In_ const int64_t* values_shape, size_t values_shape_len, _In_ const void* values,
- _In_ const int64_t* indices_data, size_t indices_num);
-
- /**
- * This fills populates an empty tensor that was created using OrtApi::CreateSparseTensorAsOrtValue.
- * This will allocate required memory and copy the supplied NNZ values and CSR indices into that memory allocation.
- * Memory allocation is performed using the allocator that was specified with OrtApi::CreateSparseTensorAsOrtValue.
- *
- * \param[in,out] ort_value ::OrtValue to populate with data
- * \param[in] data_mem_info serves to identify the location of the data to be copied. If the allocator specified
- * at the creation time has memory info that is not the same as mem_info argument to this function a X-device copy will be performed.
- * String data is assumed to be on CPU and will only be copied into a CPU allocated buffer.
- * \param[in] values_shape pointer to values shape array
- * \param[in] values_shape_len length of the values_shape
- * \param[in] values - pointer to an array of values. For strings, pass const char**.
- * \param[in] inner_indices_data pointer to a location of CSR inner indices
- * \param[in] inner_indices_num number of CSR inner indices
- * \param[in] outer_indices_data pointer to a location of CSR outer indices
- * \param[in] outer_indices_num number of CSR outer indices
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(FillSparseTensorCsr, _Inout_ OrtValue* ort_value, _In_ const OrtMemoryInfo* data_mem_info,
- _In_ const int64_t* values_shape, size_t values_shape_len, _In_ const void* values,
- _In_ const int64_t* inner_indices_data, size_t inner_indices_num,
- _In_ const int64_t* outer_indices_data, size_t outer_indices_num);
-
- /**
- * This fills populates an empty tensor that was created using OrtApi::CreateSparseTensorAsOrtValue.
- * This will allocate required memory and copy the supplied NNZ values and BlockSparse indices into that memory allocation.
- * Memory allocation is performed using the allocator that was specified with OrtApi::CreateSparseTensorAsOrtValue.
- *
- * \param[in,out] ort_value ::OrtValue to populate with data
- * \param[in] data_mem_info serves to identify the location of the data to be copied. If the allocator specified
- * at the creation time has memory info that is not the same as mem_info argument to this function a X-device copy will be performed.
- * String data is assumed to be on CPU and will only be copied into a CPU allocated buffer.
- * \param[in] values_shape
- * \param[in] values_shape_len
- * \param[in] values structure with values information
- * \param[in] indices_shape_data pointer to a location of indices shape
- * \param[in] indices_shape_len length of the block sparse indices shape
- * \param[in] indices_data pointer to a location of indices data. Shape will determine the length of the indices data.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(FillSparseTensorBlockSparse, _Inout_ OrtValue* ort_value, _In_ const OrtMemoryInfo* data_mem_info,
- _In_ const int64_t* values_shape, size_t values_shape_len, _In_ const void* values,
- _In_ const int64_t* indices_shape_data, size_t indices_shape_len,
- _In_ const int32_t* indices_data);
-
- /**
- * Create an ::OrtValue with a sparse tensor. This is the first step.
- * Next, use Use<Format>Indices() functions to supply sparse tensor with
- * format specific indices data and set its sparse format to a specific enum value.
- * This will not perform memory allocations. It will
- * use supplied user buffer which should outlive the created sparse tensor.
- * Use OrtApi::ReleaseValue to destroy the sparse tensor. It would not release the supplied values buffer.
- * This function can not be used to map strings from the user allocated memory. Strings must always be copied
- * and have UTF-8 encoding. Therefore, use OrtApi::CreateSparseTensorAsOrtValue above and then fill it with data
- * using appropriate Make*() function.
- *
- * \param[in] info memory info where sparse values reside.
- * \param[in,out] p_data pointer to a user allocated buffer with values. To create a full sparse tensor with no non-zero
- * values, pass nullptr
- * \param[in] dense_shape shape of the original dense tensor
- * \param[in] dense_shape_len number of shape dimensions being passed
- * \param[in] values_shape shape of the values data. To create a fully sparse tensor with no non-zero values,
- * pass {0} shape.
- * \param[in] values_shape_len number of values shape dimensions
- * \param[in] type must be one of TENSOR_ELEMENT_DATA_TYPE_xxxx
- * \param[out] out Should be freed by calling ReleaseValue
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(CreateSparseTensorWithValuesAsOrtValue, _In_ const OrtMemoryInfo* info, _Inout_ void* p_data,
- _In_ const int64_t* dense_shape, size_t dense_shape_len,
- _In_ const int64_t* values_shape, size_t values_shape_len,
- ONNXTensorElementDataType type, _Outptr_ OrtValue** out);
-
- /**
- * This assigns Coo format indices to the SparseTensor that was created by
- * OrtApi::CreateSparseTensorWithValuesAsOrtValue above. It also sets OrtSparseFormat to
- * ORT_SPARSE_COO. This will not allocate any additional memory for data. The life span of
- * indices_data buffer should eclipse the life span of this ::OrtValue.
- *
- * \param[in,out] ort_value ::OrtValue instance constructed with OrtApi::CreateSparseTensorWithValuesAsOrtValue
- * \param[in,out] indices_data pointer to a user pre-allocated buffer or nullptr for fully sparse tensors.
- * \param[in] indices_num number of COO indices. Should either be 0 for fully sparse tensors, be equal
- * to the number of nnz values specified to OrtApi::CreateSparseTensorWithValuesAsOrtValue for 1-D {nnz} indices or
- * be twice as number of nnz values for a 2-D indices {nnz, 2}
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(UseCooIndices, _Inout_ OrtValue* ort_value, _Inout_ int64_t* indices_data, size_t indices_num);
-
- /**
- * The assigns CSR format indices to the SparseTensor that was created by
- * OrtApi::CreateSparseTensorWithValuesAsOrtValue above. It also sets OrtSparseFormat to
- * ORT_SPARSE_CSRC. This will not allocate any additional memory for data. The life spans of
- * inner_data and outer_data buffers should eclipse the life span of this ::OrtValue.
- *
- * \param[in,out] ort_value ::OrtValue instance constructed with OrtApi::CreateSparseTensorWithValuesAsOrtValue
- * \param[in,out] inner_data pointer to a user pre-allocated buffer or nullptr for fully sparse tensors.
- * \param[in] inner_num number of inner CSR indices. Should either be 0 for fully sparse tensors or be equal
- * to the number of nnz values specified to OrtApi::CreateSparseTensorWithValuesAsOrtValue.
- * \param[in,out] outer_data pointer to user pre-allocated buffer or nullptr for fully sparse tensors.
- * \param[in] outer_num number of CSR outer indices. Should either be 0 for fully sparse tensors or
- * equal to rows + 1 of the dense shape.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(UseCsrIndices, _Inout_ OrtValue* ort_value, _Inout_ int64_t* inner_data, size_t inner_num,
- _Inout_ int64_t* outer_data, size_t outer_num);
-
- /**
- * The assigns BlockSparse format indices to the SparseTensor that was created by
- * OrtApi::CreateSparseTensorWithValuesAsOrtValue above. It also sets OrtSparseFormat to
- * ORT_SPARSE_BLOCK_SPARSE. This will not allocate any additional memory for data. The life span of
- * indices_data buffer must eclipse the lifespan of this ::OrtValue.
- *
- * \param[in,out] ort_value OrtValue instance constructed with OrtApi::CreateSparseTensorWithValuesAsOrtValue
- * \param[in] indices_shape pointer to indices shape. Use {0} for fully sparse tensors
- * \param[in] indices_shape_len length of the indices shape
- * \param[in,out] indices_data pointer to user pre-allocated buffer or nullptr for fully sparse tensors.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(UseBlockSparseIndices, _Inout_ OrtValue* ort_value, const int64_t* indices_shape, size_t indices_shape_len, _Inout_ int32_t* indices_data);
-
- /** \brief Returns sparse tensor format enum iff a given ort value contains an instance of sparse tensor.
- *
- * \param[in] ort_value ::OrtValue that contains an instance of sparse tensor
- * \param[out] out pointer to out parameter
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetSparseTensorFormat, _In_ const OrtValue* ort_value, _Out_ enum OrtSparseFormat* out);
-
- /** \brief Returns data type and shape of sparse tensor values (nnz) iff ::OrtValue contains a SparseTensor.
- *
- * \param[in] ort_value An ::OrtValue that contains a fully constructed sparse tensor
- * \param[out] out Must be freed by OrtApi::ReleaseTensorTypeAndShapeInfo
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetSparseTensorValuesTypeAndShape, _In_ const OrtValue* ort_value, _Outptr_ OrtTensorTypeAndShapeInfo** out);
-
- /** \brief Returns numeric data for sparse tensor values (nnz). For string values use GetStringTensor*().
- *
- * \param[in] ort_value an instance of ::OrtValue containing sparse tensor
- * \param[out] out returns a pointer to values data. Do not attempt to free this ptr.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetSparseTensorValues, _In_ const OrtValue* ort_value, _Outptr_ const void** out);
-
- /** \brief Returns data type, shape for the type of indices specified by indices_format.
- *
- * \param[in] ort_value ::OrtValue containing sparse tensor.
- * \param[in] indices_format One of the indices formats. It is an error to request a format that the sparse
- * tensor does not contain.
- * \param[out] out an instance of ::OrtTensorTypeAndShapeInfo. Must be freed by OrtApi::ReleaseTensorTypeAndShapeInfo
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetSparseTensorIndicesTypeShape, _In_ const OrtValue* ort_value, enum OrtSparseIndicesFormat indices_format, _Outptr_ OrtTensorTypeAndShapeInfo** out);
-
- /** \brief Returns indices data for the type of the indices specified by indices_format
- *
- * \param[in] ort_value ::OrtValue containing sparse tensor.
- * \param[in] indices_format One of the indices formats. It is an error to request a format that the sparse tensor does not contain.
- * \param[out] num_indices Pointer to where the number of indices entries is returned
- * \param[out] indices Returned pointer to the indices data. Do not free the returned pointer as it refers to internal data owned by the ::OrtValue
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetSparseTensorIndices, _In_ const OrtValue* ort_value, enum OrtSparseIndicesFormat indices_format, _Out_ size_t* num_indices, _Outptr_ const void** indices);
- /// @}
- /// \name OrtSessionOptions
- /// @{
-
- /**
- * \brief Sets out to 1 iff an optional type OrtValue has an element, 0 otherwise (OrtValue is None)
- * Use this API to find if the optional type OrtValue is None or not.
- * If the optional type OrtValue is not None, use the OrtValue just like any other OrtValue.
- * For example, if you get an OrtValue that corresponds to Optional(tensor) and
- * if HasValue() returns true, use it as tensor and so on.
-
- * \param[in] value Input OrtValue.
- * \param[out] out indicating if the input OrtValue contains data (1) or if it is a None (0)
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(HasValue, _In_ const OrtValue* value, _Out_ int* out);
-
- /// @}
- /// \name OrtKernelContext
- /// Custom operator APIs.
- /// @{
-
- /** \brief Used for custom operators, gets the GPU compute stream to use to launch the custom a GPU kernel
- * \see ::OrtCustomOp
- * \param[in] context OrtKernelContext instance
- * \param[out] out Returns pointer to a GPU compute stream that can be used to launch the custom GPU kernel.
- * If retrieving the GPU compute stream is not relevant (GPU not enabled in the build, kernel partitioned to
- * some other EP), then a nullptr is returned as the output param.
- * Do not free or mutate the returned pointer as it refers to internal data owned by the underlying session.
- * Only use it for custom kernel launching.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(KernelContext_GetGPUComputeStream, _In_ const OrtKernelContext* context, _Outptr_ void** out);
-
- /// @}
- /// \name GetTensorMemoryInfo
- /// @{
- /** \brief Returns a pointer to the ::OrtMemoryInfo of a Tensor
- * \param[in] value ::OrtValue containing tensor.
- * \param[out] mem_info ::OrtMemoryInfo of the tensor. Do NOT free the returned pointer. It is valid for the lifetime of the ::OrtValue
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetTensorMemoryInfo, _In_ const OrtValue* value, _Out_ const OrtMemoryInfo** mem_info);
-
- /// @}
- /// \name GetExecutionProviderApi
- /// @{
- /** \brief Get a pointer to the requested version of the Execution Provider specific
- * API extensions to the OrtApi
- * \param[in] provider_name The name of the execution provider name. Currently only the following
- * values are supported: "DML".
- * \param[in] version Must be ::ORT_API_VERSION.
- * \param[out] provider_api A void pointer containing a reference to the execution provider versioned api structure.
- * For example, the provider_api pointer can be cast to the OrtDmlApi* when the provider_name is "DML".
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(GetExecutionProviderApi, _In_ const char* provider_name, _In_ uint32_t version, _Outptr_ const void** provider_api);
-
- /// @}
-
- /// \name SessionOptions
- /// @{
- /** \brief Set custom thread creation function
- *
- * \param[in] options Session options
- * \param[in] ort_custom_create_thread_fn Custom thread creation function
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SessionOptionsSetCustomCreateThreadFn, _Inout_ OrtSessionOptions* options, _In_ OrtCustomCreateThreadFn ort_custom_create_thread_fn);
-
- /** \brief Set creation options for custom thread
- *
- * \param[in] options Session options
- * \param[in] ort_custom_thread_creation_options Custom thread creation options (can be nullptr)
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SessionOptionsSetCustomThreadCreationOptions, _Inout_ OrtSessionOptions* options, _In_ void* ort_custom_thread_creation_options);
-
- /** \brief Set custom thread join function
- *
- * \param[in] options Session options
- * \param[in] ort_custom_join_thread_fn Custom join thread function, must not be nullptr when ort_custom_create_thread_fn is set
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SessionOptionsSetCustomJoinThreadFn, _Inout_ OrtSessionOptions* options, _In_ OrtCustomJoinThreadFn ort_custom_join_thread_fn);
- /// @}
-
- /// \name OrtThreadingOptions
- /// @{
- /** \brief Set custom thread creation function for global thread pools
- *
- * \param[inout] tp_options
- * \param[in] ort_custom_create_thread_fn Custom thread creation function
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SetGlobalCustomCreateThreadFn, _Inout_ OrtThreadingOptions* tp_options, _In_ OrtCustomCreateThreadFn ort_custom_create_thread_fn);
-
- /** \brief Set custom thread creation options for global thread pools
- *
- * \param[inout] tp_options
- * \param[in] ort_custom_thread_creation_options Custom thread creation options (can be nullptr)
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SetGlobalCustomThreadCreationOptions, _Inout_ OrtThreadingOptions* tp_options, _In_ void* ort_custom_thread_creation_options);
-
- /** \brief Set custom thread join function for global thread pools
- *
- * \param[inout] tp_options
- * \param[in] ort_custom_join_thread_fn Custom thread join function, must not be nullptr when global ort_custom_create_thread_fn is set
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SetGlobalCustomJoinThreadFn, _Inout_ OrtThreadingOptions* tp_options, _In_ OrtCustomJoinThreadFn ort_custom_join_thread_fn);
- /// @}
-
- /** \brief Synchronize bound inputs. The call may be necessary for some providers, such as cuda,
- * in case the system that allocated bound memory operated on a different stream. However, the
- * operation is provider specific and could be a no-op.
- *
- * \param[inout] binding_ptr
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SynchronizeBoundInputs, _Inout_ OrtIoBinding* binding_ptr);
-
- /** \brief Synchronize bound outputs. The call may be necessary for some providers, such as cuda,
- * in case the system that allocated bound memory operated on a different stream. However, the
- * operation is provider specific and could be a no-op.
- *
- * \param[inout] binding_ptr
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(SynchronizeBoundOutputs, _Inout_ OrtIoBinding* binding_ptr);
-
- /// \name OrtSessionOptions
- /// @{
-
- /** \brief Append CUDA execution provider to the session options
- *
- * If CUDA is not available (due to a non CUDA enabled build), this function will return failure.
- *
- * This is slightly different from OrtApi::SessionOptionsAppendExecutionProvider_CUDA, it takes an
- * ::OrtCUDAProviderOptions which is publicly defined. This takes an opaque ::OrtCUDAProviderOptionsV2
- * which must be created with OrtApi::CreateCUDAProviderOptions.
- *
- * For OrtApi::SessionOptionsAppendExecutionProvider_CUDA, the user needs to instantiate ::OrtCUDAProviderOptions
- * as well as allocate/release buffers for some members of ::OrtCUDAProviderOptions.
- * Here, OrtApi::CreateCUDAProviderOptions and Ortapi::ReleaseCUDAProviderOptions will do the memory management for you.
- *
- * \param[in] options
- * \param[in] cuda_options
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- *
- * \since Version 1.11.
- */
- ORT_API2_STATUS(SessionOptionsAppendExecutionProvider_CUDA_V2,
- _In_ OrtSessionOptions* options, _In_ const OrtCUDAProviderOptionsV2* cuda_options);
-
- /// @}
- /// \name OrtCUDAProviderOptionsV2
- /// @{
-
- /** \brief Create an OrtCUDAProviderOptionsV2
- *
- * \param[out] out Newly created ::OrtCUDAProviderOptionsV2. Must be released with OrtApi::ReleaseCudaProviderOptions
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- *
- * \since Version 1.11.
- */
- ORT_API2_STATUS(CreateCUDAProviderOptions, _Outptr_ OrtCUDAProviderOptionsV2** out);
-
- /** \brief Set options in a CUDA Execution Provider.
- *
- * Please refer to https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#configuration-options
- * to know the available keys and values. Key should be in null terminated string format of the member of ::OrtCUDAProviderOptionsV2
- * and value should be its related range.
- *
- * For example, key="device_id" and value="0"
- *
- * \param[in] cuda_options
- * \param[in] provider_options_keys Array of UTF-8 null-terminated string for provider options keys
- * \param[in] provider_options_values Array of UTF-8 null-terminated string for provider options values
- * \param[in] num_keys Number of elements in the `provider_option_keys` and `provider_options_values` arrays
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- *
- * \since Version 1.11.
- */
- ORT_API2_STATUS(UpdateCUDAProviderOptions, _Inout_ OrtCUDAProviderOptionsV2* cuda_options,
- _In_reads_(num_keys) const char* const* provider_options_keys,
- _In_reads_(num_keys) const char* const* provider_options_values,
- _In_ size_t num_keys);
-
- /**
- * Get serialized CUDA provider options string.
- *
- * For example, "device_id=0;arena_extend_strategy=0;......"
- *
- * \param cuda_options - OrtCUDAProviderOptionsV2 instance
- * \param allocator - a ptr to an instance of OrtAllocator obtained with CreateAllocator() or GetAllocatorWithDefaultOptions()
- * the specified allocator will be used to allocate continuous buffers for output strings and lengths.
- * \param ptr - is a UTF-8 null terminated string allocated using 'allocator'. The caller is responsible for using the same allocator to free it.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- *
- * \since Version 1.11.
- */
- ORT_API2_STATUS(GetCUDAProviderOptionsAsString, _In_ const OrtCUDAProviderOptionsV2* cuda_options, _Inout_ OrtAllocator* allocator, _Outptr_ char** ptr);
-
- /** \brief Release an ::OrtCUDAProviderOptionsV2
- *
- * \note This is an exception in the naming convention of other Release* functions, as the name of the method does not have the V2 suffix, but the type does
- *
- * \since Version 1.11.
- */
- void(ORT_API_CALL* ReleaseCUDAProviderOptions)(_Frees_ptr_opt_ OrtCUDAProviderOptionsV2* input);
-
- /// @}
-
- /** \brief Append MIGraphX provider to session options
- *
- * If MIGraphX is not available (due to a non MIGraphX enabled build, or if MIGraphX is not installed on the system), this function will return failure.
- *
- * \param[in] options
- * \param[in] migraphx_options
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- *
- * \since Version 1.11.
- */
- ORT_API2_STATUS(SessionOptionsAppendExecutionProvider_MIGraphX,
- _In_ OrtSessionOptions* options, _In_ const OrtMIGraphXProviderOptions* migraphx_options);
-
- /** \brief Replace initialized Tensors with external data with the data provided in initializers.
- *
- * The function will find the initialized TensorProtos with external data in the graph with the provided names and
- * replace them with the provided tensors. The API verifies that the TensorProto being replaced
- * has an external data reference and has the same name, dimensions and data type as its replacement. The replacement
- * will occur before any of the optimizations take place. The data will be copied into the graph
- * since TensorProto can't refer to the user provided buffers.
- *
- * Once the model has been loaded, the OrtValue(s) added to SessionOptions instance will be removed
- * from the internal SessionOptions copy to save memory, the user provided buffers can then be deallocated
- * and the SessionOptions instance that refers to them can be destroyed.
- *
- * \param[in] options
- * \param[in] initializer_names Array of null terminated UTF-8 encoded strings of the initializers names.
- * \param[in] initializers Array of ::OrtValue type
- * \param[in] initializers_num Number of elements in the initializer_names and initializers
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- *
- * \since Version 1.12.
- */
- ORT_API2_STATUS(AddExternalInitializers, _In_ OrtSessionOptions* options,
- _In_reads_(input_len) const char* const* initializer_names,
- _In_reads_(input_len) const OrtValue* const* initializers, size_t initializers_num);
-
- /** \brief: Create attribute of onnxruntime operator
- *
- * \param[in] name Name of the attribute
- * \param[in] data Data content of the attribute
- * \param[in] len Number of bytes stored in data
- * \param[in] type Data type
- * \param[out] op_attr Attribute that has been created, which must be released by OrtApi::ReleaseOpAttr
- *
- * \since Version 1.12.
- */
- ORT_API2_STATUS(CreateOpAttr,
- _In_ const char* name,
- _In_ const void* data,
- _In_ int len,
- _In_ OrtOpAttrType type,
- _Outptr_ OrtOpAttr** op_attr);
-
- /* \brief: Release op attribute
- *
- * \param[in] opAttr Attribute created by OrtApi::CreateOpAttr
- *
- * \since Version 1.12.
- */
- ORT_CLASS_RELEASE(OpAttr);
-
- /** \brief: Create onnxruntime native operator
- *
- * \param[in] info Kernel info
- * \param[in] op_name Operator name
- * \param[in] domain Operator domain
- * \param[in] version Operator opset version
- * \param[in] type_constraint_names Name of the type contraints, such as "T" or "T1"
- * \param[in] type_constraint_values Type of each contraints
- * \param[in] type_constraint_count Number of contraints
- * \param[in] attr_values Attributes used to initialize the operator
- * \param[in] attr_count Number of the attributes
- * \param[in] input_count Number of inputs
- * \param[in] output_count Number of outputs
- * \param[out] ort_op Operator that has been created
- *
- * \since Version 1.12.
- */
- ORT_API2_STATUS(CreateOp,
- _In_ const OrtKernelInfo* info,
- _In_ const char* op_name,
- _In_ const char* domain,
- _In_ int version,
- _In_opt_ const char** type_constraint_names,
- _In_opt_ const ONNXTensorElementDataType* type_constraint_values,
- _In_opt_ int type_constraint_count,
- _In_opt_ const OrtOpAttr* const* attr_values,
- _In_opt_ int attr_count,
- _In_ int input_count,
- _In_ int output_count,
- _Outptr_ OrtOp** ort_op);
-
- /** \brief: Invoke the operator created by OrtApi::CreateOp
- * The inputs must follow the order as specified in onnx specification
- *
- * \param[in] context Kernel context
- * \param[in] ort_op Operator that has been created
- * \param[in] input_values Array of inputs
- * \param[in] input_count Number of inputs
- * \param[in] output_values Array of outputs
- * \param[in] output_count Number of outputs
- *
- * \since Version 1.12.
- */
- ORT_API2_STATUS(InvokeOp,
- _In_ const OrtKernelContext* context,
- _In_ const OrtOp* ort_op,
- _In_ const OrtValue* const* input_values,
- _In_ int input_count,
- _Inout_ OrtValue* const* output_values,
- _In_ int output_count);
-
- /* \brief: Release an onnxruntime operator
- *
- * \param[in] Op Operator created by OrtApi::CreateOp
- *
- * \since Version 1.12.
- */
- ORT_CLASS_RELEASE(Op);
-
- /** \brief: Append execution provider to the session options.
- * \param[in] options
- * \param[in] provider_name - provider to add.
- * \param[in] provider_options_keys - keys to configure the provider options
- * \param[in] provider_options_values - values to configure the provider options
- * \param[in] num_keys - number of keys passed in
- *
- * Currently supported providers:
- * SNPE
- * XNNPACK
- *
- * Note: If an execution provider has a dedicated SessionOptionsAppendExecutionProvider_<provider name> function
- * that should be used to add it.
- *
- * SNPE supported keys:
- * "runtime": SNPE runtime engine, options: "CPU", "CPU_FLOAT32", "GPU", "GPU_FLOAT32_16_HYBRID", "GPU_FLOAT16",
- * "DSP", "DSP_FIXED8_TF", "AIP_FIXED_TF", "AIP_FIXED8_TF".
- * Mapping to SNPE Runtime_t definition: CPU, CPU_FLOAT32 => zdl::DlSystem::Runtime_t::CPU;
- * GPU, GPU_FLOAT32_16_HYBRID => zdl::DlSystem::Runtime_t::GPU;
- * GPU_FLOAT16 => zdl::DlSystem::Runtime_t::GPU_FLOAT16;
- * DSP, DSP_FIXED8_TF => zdl::DlSystem::Runtime_t::DSP.
- * AIP_FIXED_TF, AIP_FIXED8_TF => zdl::DlSystem::Runtime_t::AIP_FIXED_TF.
- * "priority": execution priority, options: "low", "normal".
- * "buffer_type": ITensor or user buffers, options: "ITENSOR", user buffer with different types - "TF8", "TF16", "UINT8", "FLOAT".
- * "ITENSOR" -- default, ITensor which is float only.
- * "TF8" -- quantized model required, "FLOAT" -- for both quantized or non-quantized model
- * If SNPE is not available (due to a non Snpe enabled build or its dependencies not being installed), this function will fail.
- *
- * XNNPACK supported keys:
- * "intra_op_num_threads": number of thread-pool size to use for XNNPACK execution provider.
- * default value is 0, which means to use the session thread-pool size.
- *
- * \since Version 1.12.
- */
- ORT_API2_STATUS(SessionOptionsAppendExecutionProvider, _In_ OrtSessionOptions* options,
- _In_ const char* provider_name,
- _In_reads_(num_keys) const char* const* provider_options_keys,
- _In_reads_(num_keys) const char* const* provider_options_values,
- _In_ size_t num_keys);
-
- /* \brief: Get a copy of kernel info
- *
- * \param[in] info Kernel info
- * \param[out] info_copy Copy of kernel info
- *
- * \since Version 1.12.
- */
- ORT_API2_STATUS(CopyKernelInfo,
- _In_ const OrtKernelInfo* info,
- _Outptr_ OrtKernelInfo** info_copy);
-
- /* \brief: Release kernel info
- *
- * \param[in] KernelInfo A copy of kernel info returned by CopyKernelInfo
- *
- * \since Version 1.12.
- */
- ORT_CLASS_RELEASE(KernelInfo);
-
- /* \brief: Get the training C Api
- *
- * \since Version 1.13
- */
- const OrtTrainingApi*(ORT_API_CALL* GetTrainingApi)(uint32_t version)NO_EXCEPTION;
-
- /** \brief Append CANN provider to session options
- *
- * If CANN is not available (due to a non CANN enabled build, or if CANN is not installed on the system), this function will return failure.
- *
- * \param[in] options
- * \param[in] cann_options
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- *
- * \since Version 1.13.
- */
- ORT_API2_STATUS(SessionOptionsAppendExecutionProvider_CANN,
- _In_ OrtSessionOptions* options, _In_ const OrtCANNProviderOptions* cann_options);
-
- /** \brief Create an OrtCANNProviderOptions
- *
- * \param[out] out created ::OrtCANNProviderOptions. Must be released with OrtApi::ReleaseCANNProviderOptions
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- *
- * \since Version 1.13.
- */
- ORT_API2_STATUS(CreateCANNProviderOptions, _Outptr_ OrtCANNProviderOptions** out);
-
- /** \brief Set options in a CANN Execution Provider.
- *
- * \param[in] cann_options
- * \param[in] provider_options_keys Array of UTF-8 null-terminated string for provider options keys
- * \param[in] provider_options_values Array of UTF-8 null-terminated string for provider options values
- * \param[in] num_keys Number of elements in the `provider_option_keys` and `provider_options_values` arrays
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- *
- * \since Version 1.13.
- */
- ORT_API2_STATUS(UpdateCANNProviderOptions, _Inout_ OrtCANNProviderOptions* cann_options,
- _In_reads_(num_keys) const char* const* provider_options_keys,
- _In_reads_(num_keys) const char* const* provider_options_values,
- _In_ size_t num_keys);
-
- /** \brief Get serialized CANN provider options string.
- *
- * \param[in] cann_options OrtCANNProviderOptions instance
- * \param[in] allocator a ptr to an instance of OrtAllocator obtained with CreateAllocator()
- * or GetAllocatorWithDefaultOptions(), the specified allocator will be used to allocate
- * continuous buffers for output strings and lengths.
- * \param[out] ptr is a UTF-8 null terminated string allocated using 'allocator'.
- * The caller is responsible for using the same allocator to free it.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- *
- * \since Version 1.13.
- */
- ORT_API2_STATUS(GetCANNProviderOptionsAsString, _In_ const OrtCANNProviderOptions* cann_options,
- _Inout_ OrtAllocator* allocator, _Outptr_ char** ptr);
-
- /** \brief Release an OrtCANNProviderOptions
- *
- * \param[in] the pointer of OrtCANNProviderOptions which will been deleted
- *
- * \since Version 1.13.
- */
- void(ORT_API_CALL* ReleaseCANNProviderOptions)(_Frees_ptr_opt_ OrtCANNProviderOptions* input);
-
- /* \brief Get OrtDevice type from MemoryInfo
- *
- * \since Version 1.14
- */
- void(ORT_API_CALL* MemoryInfoGetDeviceType)(_In_ const OrtMemoryInfo* ptr, _Out_ OrtMemoryInfoDeviceType* out);
-
- /* \brief Update the OrtEnv instance with custom log severity level
- *
- * \param[in] ort_env The OrtEnv instance being used
- * \param[in] log_severity_level The log severity level.
- *
- * \since Version 1.14.
- */
- ORT_API2_STATUS(UpdateEnvWithCustomLogLevel, _In_ OrtEnv* ort_env, OrtLoggingLevel log_severity_level);
-
- /* \brief Set affinities for intra op threads
- *
- * Affinity string follows format:
- * logical_processor_id,logical_processor_id;logical_processor_id,logical_processor_id
- * Semicolon isolates configurations among threads, while comma split processors where ith thread expected to attach to.
- * e.g. 1,2,3;4,5
- * specifies affinities for two threads, with the 1st thread attach to the 1st, 2nd, and 3rd processor, and 2nd thread to the 4th and 5th.
- * To ease the configuration, an "interval" is also allowed:
- * e.g. 1-8;8-16;17-24
- * orders that the 1st thread runs on first eight processors, 2nd thread runs on next eight processors, and so forth.
- * Note:
- * 1. Once set, the number of thread affinities must equal to intra_op_num_threads - 1,
- * ort does not set affinity on the main thread which is started and managed by the calling app;
- * 2. For windows, ort will infer the group id from a logical processor id, for example, assuming there are two groups with each has 64 logical processors,
- * an id of 64 will be inferred as the last processor of the 1st group, while 65 will be interpreted as the 1st processor of the second group.
- * Hence 64-65 is an invalid configuration, because a windows thread cannot be attached to processors across group boundary.
- *
- * \since Version 1.14
- */
- ORT_API2_STATUS(SetGlobalIntraOpThreadAffinity, _Inout_ OrtThreadingOptions* tp_options, const char* affinity_string);
-
- /** \brief Register custom ops from a shared library.
- *
- * Loads a shared library (.dll on windows, .so on linux, etc) named 'library_name' and looks for this entry point:
- * OrtStatus* RegisterCustomOps(OrtSessionOptions * options, const OrtApiBase* api);
- * It then passes in the provided session options to this function along with the api base.
- *
- * The handle to the loaded library is automatically released by ORT when the last OrtSession that references the
- * library handle is released. If no OrtSession is created, then the library handle is released when the provided
- * OrtSessionOptions is released.
- *
- * \param[in] options The session options.
- * \param[in] library_name The name of the shared library to load and register. Refer to OS-specific dynamic library
- * loading utilities (e.g., LoadLibraryEx on Windows or dlopen on Linux/MacOS) for information
- * on the format of library names and search paths.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- * \since Version 1.14
- */
- ORT_API2_STATUS(RegisterCustomOpsLibrary_V2, _Inout_ OrtSessionOptions* options, _In_ const ORTCHAR_T* library_name);
-
- /** \brief Register custom ops by calling a RegisterCustomOpsFn function.
- *
- * Searches for registration_func_name and if found calls it.
- *
- * The library containing the function must either be linked against or previously loaded by the executable.
- *
- * If you want ONNX Runtime to load the library and manage its lifetime, use RegisterCustomOpsLibrary_V2.
- *
- * RegisterCustomOpsUsingFunction can be used in scenarios where it may not be possible for ONNX Runtime to load
- * the library from a path. e.g. mobile platforms where the library must be linked into the app.
- *
- * The registration function must have the signature of RegisterCustomOpsFn:
- * OrtStatus* (*fn)(OrtSessionOptions* options, const OrtApiBase* api);
- *
- * See https://onnxruntime.ai/docs/reference/operators/add-custom-op.html for details on how the registration
- * function should be implemented.
- *
- * \param[in] options OrtSessionOptions that is passed through as the first argument in the call to the
- * registration function.
- * \param[in] registration_func_name Name of registration function to use.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- * \since Version 1.14
- */
- ORT_API2_STATUS(RegisterCustomOpsUsingFunction, _Inout_ OrtSessionOptions* options,
- _In_ const char* registration_func_name);
-
- /// @}
- /// \name OrtKernelInfo
- /// Custom operator APIs.
- /// @{
-
- /** \brief Get the number of inputs from ::OrtKernelInfo.
- *
- * Used in the CreateKernel callback of an OrtCustomOp to query the number of inputs
- * during kernel/session creation.
- *
- * \param[in] info Instance of ::OrtKernelInfo.
- * \param[out] out Pointer to variable assigned with the result on success.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- * \since Version 1.14
- */
- ORT_API2_STATUS(KernelInfo_GetInputCount, _In_ const OrtKernelInfo* info, _Out_ size_t* out);
-
- /** \brief Get the number of outputs from ::OrtKernelInfo.
- *
- * Used in the CreateKernel callback of an OrtCustomOp to query the number of outputs
- * during kernel/session creation.
- *
- * \param[in] info Instance of ::OrtKernelInfo.
- * \param[out] out Pointer to variable assigned with the result on success.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- * \since Version 1.14
- */
- ORT_API2_STATUS(KernelInfo_GetOutputCount, _In_ const OrtKernelInfo* info, _Out_ size_t* out);
-
- /** \brief Get the name of a ::OrtKernelInfo's input.
- *
- * Used in the CreateKernel callback of an OrtCustomOp to query an input's name
- * during kernel/session creation.
- *
- * If `out` is nullptr, the value of `size` is set to the size of the name
- * string (including null-terminator), and a success status is returned.
- *
- * If the `size` parameter is greater than or equal to the name string's size,
- * the value of `size` is set to the true size of the string (including null-terminator),
- * the provided memory is filled with the string's contents, and a success status is returned.
- *
- * If the `size` parameter is less than the actual string's size and `out`
- * is not nullptr, the value of `size` is set to the true size of the string
- * and a failure status is returned.
- *
- * \param[in] info An instance of ::OrtKernelInfo.
- * \param[in] index The index of the input name to get. Returns a failure status if out-of-bounds.
- * \param[out] out Memory location into which to write the UTF-8 null-terminated string representing the input's name.
- * \param[in,out] size Pointer to the size of the `out` buffer. See above comments for details.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- * \since Version 1.14
- */
- ORT_API2_STATUS(KernelInfo_GetInputName, _In_ const OrtKernelInfo* info, size_t index, _Out_ char* out,
- _Inout_ size_t* size);
-
- /** \brief Get the name of a ::OrtKernelInfo's output.
- *
- * Used in the CreateKernel callback of an OrtCustomOp to query an output's name
- * during kernel/session creation.
- *
- * If `out` is nullptr, the value of `size` is set to the size of the name
- * string (including null-terminator), and a success status is returned.
- *
- * If the `size` parameter is greater than or equal to the name string's size,
- * the value of `size` is set to the true size of the string (including null-terminator),
- * the provided memory is filled with the string's contents, and a success status is returned.
- *
- * If the `size` parameter is less than the actual string's size and `out`
- * is not nullptr, the value of `size` is set to the true size of the string
- * and a failure status is returned.
- *
- * \param[in] info An instance of ::OrtKernelInfo.
- * \param[in] index The index of the output name to get. Returns a failure status if out-of-bounds.
- * \param[out] out Memory location into which to write the UTF-8 null-terminated string representing the output's
- * name.
- * \param[in,out] size Pointer to the size of the `out` buffer. See above comments for details.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- * \since Version 1.14
- */
- ORT_API2_STATUS(KernelInfo_GetOutputName, _In_ const OrtKernelInfo* info, size_t index, _Out_ char* out,
- _Inout_ size_t* size);
-
- /** \brief Get the type information for a ::OrtKernelInfo's input.
- *
- * Used in the CreateKernel callback of an OrtCustomOp to query the shape and type information
- * of an input during kernel/session creation.
- *
- * \param[in] info An instance of ::OrtKernelInfo.
- * \param[out] type_info Pointer set to the resulting ::OrtTypeInfo. Must be freed with OrtApi::ReleaseTypeInfo.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- * \since Version 1.14
- */
- ORT_API2_STATUS(KernelInfo_GetInputTypeInfo, _In_ const OrtKernelInfo* info, size_t index,
- _Outptr_ OrtTypeInfo** type_info);
-
- /** \brief Get the type information for a ::OrtKernelInfo's output.
- *
- * Used in the CreateKernel callback of an OrtCustomOp to query the shape and type information
- * of an output during kernel/session creation.
- *
- * \param[in] info An instance of ::OrtKernelInfo.
- * \param[out] type_info Pointer set to the resulting ::OrtTypeInfo. Must be freed with OrtApi::ReleaseTypeInfo.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- * \since Version 1.14
- */
- ORT_API2_STATUS(KernelInfo_GetOutputTypeInfo, _In_ const OrtKernelInfo* info, size_t index,
- _Outptr_ OrtTypeInfo** type_info);
-
- /** \brief Get a ::OrtValue tensor stored as an attribute in the graph node.
- *
- * Used in the CreateKernel callback of an OrtCustomOp to get a tensor attribute.
- *
- * \param[in] info ::OrtKernelInfo instance.
- * \param[in] name UTF-8 null-terminated string representing the attribute's name.
- * \param[in] allocator Allocator used to allocate the internal tensor state.
- * \param[out] out Returns newly created ::OrtValue. Must be freed with OrtApi::ReleaseValue,
- * which will also free internal tensor state allocated with the provided allocator.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- */
- ORT_API2_STATUS(KernelInfoGetAttribute_tensor, _In_ const OrtKernelInfo* info, _In_z_ const char* name,
- _Inout_ OrtAllocator* allocator, _Outptr_ OrtValue** out);
-
- /// @}
- /// \name OrtSessionOptions
- /// Custom operator APIs
- /// @{
-
- /** \brief Checks if the given session configuration entry exists.
- *
- * The config_key formats are defined in onnxruntime_session_options_config_keys.h
- *
- * Can be used in a custom operator library to check for session configuration entries
- * that target one or more custom operators in the library. Example: The config entry
- * custom_op.myop.some_key targets a custom op named "myop".
- *
- * \param[in] options The ::OrtSessionOptions instance.
- * \param[in] config_key A null-terminated UTF-8 string representation of the configuration key.
- * \param[out] out Pointer set to 1 if the entry exists and 0 otherwise.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- * \since Version 1.14
- */
- ORT_API2_STATUS(HasSessionConfigEntry, _In_ const OrtSessionOptions* options,
- _In_z_ const char* config_key, _Out_ int* out);
-
- /** \brief Get a session configuration value.
- *
- * Returns a failure status if the configuration key does not exist.
- * The config_key and the format of config_value are defined in onnxruntime_session_options_config_keys.h
- *
- * If `config_value` is nullptr, the value of `size` is set to the true size of the string
- * value (including null-terminator), and a success status is returned.
- *
- * If the `size` parameter is greater than or equal to the actual string value's size,
- * the value of `size` is set to the true size of the string value, the provided memory
- * is filled with the value's contents, and a success status is returned.
- *
- * If the `size` parameter is less than the actual string value's size and `config_value`
- * is not nullptr, the value of `size` is set to the true size of the string value
- * and a failure status is returned.
- *
- * Can be used in a custom operator library to get session configuration entries
- * that target one or more custom operators in the library. Example: The config entry
- * custom_op.myop.some_key targets a custom op named "myop".
- *
- * \param[in] options The session options.
- * \param[in] config_key A null-terminated UTF-8 string representation of the config key.
- * \param[in] config_value Pointer to memory where the null-terminated UTF-8 string value will be stored.
- * \param[in,out] size Pointer to the size of the `config_value` buffer. See above comments for details.
- *
- * \snippet{doc} snippets.dox OrtStatus Return Value
- * \since Version 1.14
- */
- ORT_API2_STATUS(GetSessionConfigEntry, _In_ const OrtSessionOptions* options,
- _In_z_ const char* config_key, _Out_ char* config_value, _Inout_ size_t* size);
-
- /// @}
-
-#ifdef __cplusplus
- OrtApi(const OrtApi&) = delete; // Prevent users from accidentally copying the API structure, it should always be passed as a pointer
-#endif
-};
-
-/*
- * Steps to use a custom op:
- * 1 Create an OrtCustomOpDomain with the domain name used by the custom ops
- * 2 Create an OrtCustomOp structure for each op and add them to the domain
- * 3 Call OrtAddCustomOpDomain to add the custom domain of ops to the session options
- */
-
-// Specifies some characteristics of inputs/outputs of custom ops:
-// Specify if the inputs/outputs are one of:
-// 1) Non-optional (input/output must be present in the node)
-// 2) Optional (input/output may be absent in the node)
-// 3) Variadic: A variadic input or output specifies N (i.e., the minimum arity) or more operands.
-// Only the last input or output of a custom op may be marked as variadic.
-// The homogeneity of the variadic input or output determines whether all operands must be of the same
-// tensor element type.
-typedef enum OrtCustomOpInputOutputCharacteristic {
- INPUT_OUTPUT_REQUIRED = 0,
- INPUT_OUTPUT_OPTIONAL,
- INPUT_OUTPUT_VARIADIC,
-} OrtCustomOpInputOutputCharacteristic;
-
-/*
- * The OrtCustomOp structure defines a custom op's schema and its kernel callbacks. The callbacks are filled in by
- * the implementor of the custom op.
- */
-struct OrtCustomOp {
- uint32_t version; // Must be initialized to ORT_API_VERSION
-
- // This callback creates the kernel, which is a user defined parameter that is passed to the Kernel* callbacks below.
- void*(ORT_API_CALL* CreateKernel)(_In_ const struct OrtCustomOp* op, _In_ const OrtApi* api,
- _In_ const OrtKernelInfo* info);
-
- // Returns the name of the op
- const char*(ORT_API_CALL* GetName)(_In_ const struct OrtCustomOp* op);
-
- // Returns the type of the execution provider, return nullptr to use CPU execution provider
- const char*(ORT_API_CALL* GetExecutionProviderType)(_In_ const struct OrtCustomOp* op);
-
- // Returns the count and types of the input & output tensors
- ONNXTensorElementDataType(ORT_API_CALL* GetInputType)(_In_ const struct OrtCustomOp* op, _In_ size_t index);
- size_t(ORT_API_CALL* GetInputTypeCount)(_In_ const struct OrtCustomOp* op);
- ONNXTensorElementDataType(ORT_API_CALL* GetOutputType)(_In_ const struct OrtCustomOp* op, _In_ size_t index);
- size_t(ORT_API_CALL* GetOutputTypeCount)(_In_ const struct OrtCustomOp* op);
-
- // Op kernel callbacks
- void(ORT_API_CALL* KernelCompute)(_In_ void* op_kernel, _In_ OrtKernelContext* context);
- void(ORT_API_CALL* KernelDestroy)(_In_ void* op_kernel);
-
- // Returns the characteristics of the input & output tensors
- OrtCustomOpInputOutputCharacteristic(ORT_API_CALL* GetInputCharacteristic)(_In_ const struct OrtCustomOp* op, _In_ size_t index);
- OrtCustomOpInputOutputCharacteristic(ORT_API_CALL* GetOutputCharacteristic)(_In_ const struct OrtCustomOp* op, _In_ size_t index);
-
- // Returns the memory type of the input tensors. This API allows the custom op
- // to place the inputs on specific devices. By default, it returns
- // OrtMemTypeDefault, which means the input is placed on the default device for
- // the execution provider. If the inputs need to be with different memory tyeps,
- // this function can be overridden to return the specific memory types.
- OrtMemType(ORT_API_CALL* GetInputMemoryType)(_In_ const struct OrtCustomOp* op, _In_ size_t index);
-
- // Returns the minimum number of input arguments expected for the variadic input.
- // Applicable only for custom ops that have a variadic input.
- int(ORT_API_CALL* GetVariadicInputMinArity)(_In_ const struct OrtCustomOp* op);
-
- // Returns true (non-zero) if all arguments of a variadic input have to be of the same type (homogeneous),
- // and false (zero) otherwise.
- // Applicable only for custom ops that have a variadic input.
- int(ORT_API_CALL* GetVariadicInputHomogeneity)(_In_ const struct OrtCustomOp* op);
-
- // Returns the minimum number of output values expected for the variadic output.
- // Applicable only for custom ops that have a variadic output.
- int(ORT_API_CALL* GetVariadicOutputMinArity)(_In_ const struct OrtCustomOp* op);
-
- // Returns true (non-zero) if all outputs values of a variadic output have to be of the same type (homogeneous),
- // and false (zero) otherwise.
- // Applicable only for custom ops that have a variadic output.
- int(ORT_API_CALL* GetVariadicOutputHomogeneity)(_In_ const struct OrtCustomOp* op);
-};
-
-/*
- * This is the old way to add the CUDA provider to the session, please use SessionOptionsAppendExecutionProvider_CUDA above to access the latest functionality
- * This function always exists, but will only succeed if Onnxruntime was built with CUDA support and the CUDA provider shared library exists
- *
- * \param device_id CUDA device id, starts from zero.
- */
-ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_CUDA, _In_ OrtSessionOptions* options, int device_id);
-
-/*
- * This is the old way to add the MIGraphX provider to the session, please use
- * SessionOptionsAppendExecutionProvider_MIGraphX above to access the latest functionality
- * This function always exists, but will only succeed if Onnxruntime was built with
- * HIP support and the MIGraphX provider shared library exists
- *
- * \param device_id HIP device id, starts from zero.
- */
-ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_MIGraphX, _In_ OrtSessionOptions* options, int device_id);
-
-#ifdef __cplusplus
-}
-#endif
-
-//! @}
diff --git a/funasr/runtime/onnxruntime/win/include/onnxruntime_cxx_api.h b/funasr/runtime/onnxruntime/win/include/onnxruntime_cxx_api.h
deleted file mode 100644
index 97b2aa4..0000000
--- a/funasr/runtime/onnxruntime/win/include/onnxruntime_cxx_api.h
+++ /dev/null
@@ -1,1876 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-// Summary: The Ort C++ API is a header only wrapper around the Ort C API.
-//
-// The C++ API simplifies usage by returning values directly instead of error codes, throwing exceptions on errors
-// and automatically releasing resources in the destructors. The primary purpose of C++ API is exception safety so
-// all the resources follow RAII and do not leak memory.
-//
-// Each of the C++ wrapper classes holds only a pointer to the C internal object. Treat them like smart pointers.
-// To create an empty object, pass 'nullptr' to the constructor (for example, Env e{nullptr};). However, you can't use them
-// until you assign an instance that actually holds an underlying object.
-//
-// For Ort objects only move assignment between objects is allowed, there are no copy constructors.
-// Some objects have explicit 'Clone' methods for this purpose.
-//
-// ConstXXXX types are copyable since they do not own the underlying C object, so you can pass them to functions as arguments
-// by value or by reference. ConstXXXX types are restricted to const only interfaces.
-//
-// UnownedXXXX are similar to ConstXXXX but also allow non-const interfaces.
-//
-// The lifetime of the corresponding owning object must eclipse the lifetimes of the ConstXXXX/UnownedXXXX types. They exists so you do not
-// have to fallback to C types and the API with the usual pitfalls. In general, do not use C API from your C++ code.
-
-#pragma once
-#include "onnxruntime_c_api.h"
-#include <cstddef>
-#include <array>
-#include <memory>
-#include <stdexcept>
-#include <string>
-#include <vector>
-#include <unordered_map>
-#include <utility>
-#include <type_traits>
-
-#ifdef ORT_NO_EXCEPTIONS
-#include <iostream>
-#endif
-
-/** \brief All C++ Onnxruntime APIs are defined inside this namespace
- *
- */
-namespace Ort {
-
-/** \brief All C++ methods that can fail will throw an exception of this type
- *
- * If <tt>ORT_NO_EXCEPTIONS</tt> is defined, then any error will result in a call to abort()
- */
-struct Exception : std::exception {
- Exception(std::string&& string, OrtErrorCode code) : message_{std::move(string)}, code_{code} {}
-
- OrtErrorCode GetOrtErrorCode() const { return code_; }
- const char* what() const noexcept override { return message_.c_str(); }
-
- private:
- std::string message_;
- OrtErrorCode code_;
-};
-
-#ifdef ORT_NO_EXCEPTIONS
-// The #ifndef is for the very special case where the user of this library wants to define their own way of handling errors.
-// NOTE: This header expects control flow to not continue after calling ORT_CXX_API_THROW
-#ifndef ORT_CXX_API_THROW
-#define ORT_CXX_API_THROW(string, code) \
- do { \
- std::cerr << Ort::Exception(string, code) \
- .what() \
- << std::endl; \
- abort(); \
- } while (false)
-#endif
-#else
-#define ORT_CXX_API_THROW(string, code) \
- throw Ort::Exception(string, code)
-#endif
-
-// This is used internally by the C++ API. This class holds the global variable that points to the OrtApi,
-// it's in a template so that we can define a global variable in a header and make
-// it transparent to the users of the API.
-template <typename T>
-struct Global {
- static const OrtApi* api_;
-};
-
-// If macro ORT_API_MANUAL_INIT is defined, no static initialization will be performed. Instead, user must call InitApi() before using it.
-template <typename T>
-#ifdef ORT_API_MANUAL_INIT
-const OrtApi* Global<T>::api_{};
-inline void InitApi() { Global<void>::api_ = OrtGetApiBase()->GetApi(ORT_API_VERSION); }
-
-// Used by custom operator libraries that are not linked to onnxruntime. Sets the global API object, which is
-// required by C++ APIs.
-//
-// Example mycustomop.cc:
-//
-// #define ORT_API_MANUAL_INIT
-// #include <onnxruntime_cxx_api.h>
-// #undef ORT_API_MANUAL_INIT
-//
-// OrtStatus* ORT_API_CALL RegisterCustomOps(OrtSessionOptions* options, const OrtApiBase* api_base) {
-// Ort::InitApi(api_base->GetApi(ORT_API_VERSION));
-// // ...
-// }
-//
-inline void InitApi(const OrtApi* api) { Global<void>::api_ = api; }
-#else
-#if defined(_MSC_VER) && !defined(__clang__)
-#pragma warning(push)
-// "Global initializer calls a non-constexpr function." Therefore you can't use ORT APIs in the other global initializers.
-// Please define ORT_API_MANUAL_INIT if it conerns you.
-#pragma warning(disable : 26426)
-#endif
-const OrtApi* Global<T>::api_ = OrtGetApiBase()->GetApi(ORT_API_VERSION);
-#if defined(_MSC_VER) && !defined(__clang__)
-#pragma warning(pop)
-#endif
-#endif
-
-/// This returns a reference to the OrtApi interface in use
-inline const OrtApi& GetApi() { return *Global<void>::api_; }
-
-/// <summary>
-/// This is a C++ wrapper for OrtApi::GetAvailableProviders() and
-/// returns a vector of strings representing the available execution providers.
-/// </summary>
-/// <returns>vector of strings</returns>
-std::vector<std::string> GetAvailableProviders();
-
-/** \brief IEEE 754 half-precision floating point data type
- * \details It is necessary for type dispatching to make use of C++ API
- * The type is implicitly convertible to/from uint16_t.
- * The size of the structure should align with uint16_t and one can freely cast
- * uint16_t buffers to/from Ort::Float16_t to feed and retrieve data.
- *
- * Generally, you can feed any of your types as float16/blfoat16 data to create a tensor
- * on top of it, providing it can form a continuous buffer with 16-bit elements with no padding.
- * And you can also feed a array of uint16_t elements directly. For example,
- *
- * \code{.unparsed}
- * uint16_t values[] = { 15360, 16384, 16896, 17408, 17664};
- * constexpr size_t values_length = sizeof(values) / sizeof(values[0]);
- * std::vector<int64_t> dims = {values_length}; // one dimensional example
- * Ort::MemoryInfo info("Cpu", OrtDeviceAllocator, 0, OrtMemTypeDefault);
- * // Note we are passing bytes count in this api, not number of elements -> sizeof(values)
- * auto float16_tensor = Ort::Value::CreateTensor(info, values, sizeof(values),
- * dims.data(), dims.size(), ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT16);
- * \endcode
- *
- * Here is another example, a little bit more elaborate. Let's assume that you use your own float16 type and you want to use
- * a templated version of the API above so the type is automatically set based on your type. You will need to supply an extra
- * template specialization.
- *
- * \code{.unparsed}
- * namespace yours { struct half {}; } // assume this is your type, define this:
- * namespace Ort {
- * template<>
- * struct TypeToTensorType<yours::half> { static constexpr ONNXTensorElementDataType type = ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT16; };
- * } //namespace Ort
- *
- * std::vector<yours::half> values;
- * std::vector<int64_t> dims = {values.size()}; // one dimensional example
- * Ort::MemoryInfo info("Cpu", OrtDeviceAllocator, 0, OrtMemTypeDefault);
- * // Here we are passing element count -> values.size()
- * auto float16_tensor = Ort::Value::CreateTensor<yours::half>(info, values.data(), values.size(), dims.data(), dims.size());
- *
- * \endcode
- */
-struct Float16_t {
- uint16_t value;
- constexpr Float16_t() noexcept : value(0) {}
- constexpr Float16_t(uint16_t v) noexcept : value(v) {}
- constexpr operator uint16_t() const noexcept { return value; }
- constexpr bool operator==(const Float16_t& rhs) const noexcept { return value == rhs.value; };
- constexpr bool operator!=(const Float16_t& rhs) const noexcept { return value != rhs.value; };
-};
-
-static_assert(sizeof(Float16_t) == sizeof(uint16_t), "Sizes must match");
-
-/** \brief bfloat16 (Brain Floating Point) data type
- * \details It is necessary for type dispatching to make use of C++ API
- * The type is implicitly convertible to/from uint16_t.
- * The size of the structure should align with uint16_t and one can freely cast
- * uint16_t buffers to/from Ort::BFloat16_t to feed and retrieve data.
- *
- * See also code examples for Float16_t above.
- */
-struct BFloat16_t {
- uint16_t value;
- constexpr BFloat16_t() noexcept : value(0) {}
- constexpr BFloat16_t(uint16_t v) noexcept : value(v) {}
- constexpr operator uint16_t() const noexcept { return value; }
- constexpr bool operator==(const BFloat16_t& rhs) const noexcept { return value == rhs.value; };
- constexpr bool operator!=(const BFloat16_t& rhs) const noexcept { return value != rhs.value; };
-};
-
-static_assert(sizeof(BFloat16_t) == sizeof(uint16_t), "Sizes must match");
-
-namespace detail {
-// This is used internally by the C++ API. This macro is to make it easy to generate overloaded methods for all of the various OrtRelease* functions for every Ort* type
-// This can't be done in the C API since C doesn't have function overloading.
-#define ORT_DEFINE_RELEASE(NAME) \
- inline void OrtRelease(Ort##NAME* ptr) { GetApi().Release##NAME(ptr); }
-
-ORT_DEFINE_RELEASE(Allocator);
-ORT_DEFINE_RELEASE(MemoryInfo);
-ORT_DEFINE_RELEASE(CustomOpDomain);
-ORT_DEFINE_RELEASE(ThreadingOptions);
-ORT_DEFINE_RELEASE(Env);
-ORT_DEFINE_RELEASE(RunOptions);
-ORT_DEFINE_RELEASE(Session);
-ORT_DEFINE_RELEASE(SessionOptions);
-ORT_DEFINE_RELEASE(TensorTypeAndShapeInfo);
-ORT_DEFINE_RELEASE(SequenceTypeInfo);
-ORT_DEFINE_RELEASE(MapTypeInfo);
-ORT_DEFINE_RELEASE(TypeInfo);
-ORT_DEFINE_RELEASE(Value);
-ORT_DEFINE_RELEASE(ModelMetadata);
-ORT_DEFINE_RELEASE(IoBinding);
-ORT_DEFINE_RELEASE(ArenaCfg);
-ORT_DEFINE_RELEASE(Status);
-ORT_DEFINE_RELEASE(OpAttr);
-ORT_DEFINE_RELEASE(Op);
-ORT_DEFINE_RELEASE(KernelInfo);
-
-#undef ORT_DEFINE_RELEASE
-
-/** \brief This is a tagging template type. Use it with Base<T> to indicate that the C++ interface object
- * has no ownership of the underlying C object.
- */
-template <typename T>
-struct Unowned {
- using Type = T;
-};
-
-/** \brief Used internally by the C++ API. C++ wrapper types inherit from this.
- * This is a zero cost abstraction to wrap the C API objects and delete them on destruction.
- *
- * All of the C++ classes
- * a) serve as containers for pointers to objects that are created by the underlying C API.
- * Their size is just a pointer size, no need to dynamically allocate them. Use them by value.
- * b) Each of struct XXXX, XXX instances function as smart pointers to the underlying C API objects.
- * they would release objects owned automatically when going out of scope, they are move-only.
- * c) ConstXXXX and UnownedXXX structs function as non-owning, copyable containers for the above pointers.
- * ConstXXXX allow calling const interfaces only. They give access to objects that are owned by somebody else
- * such as Onnxruntime or instances of XXXX classes.
- * d) serve convenient interfaces that return C++ objects and further enhance exception and type safety so they can be used
- * in C++ code.
- *
- */
-
-/// <summary>
-/// This is a non-const pointer holder that is move-only. Disposes of the pointer on destruction.
-/// </summary>
-template <typename T>
-struct Base {
- using contained_type = T;
-
- constexpr Base() = default;
- constexpr explicit Base(contained_type* p) noexcept : p_{p} {}
- ~Base() { OrtRelease(p_); }
-
- Base(const Base&) = delete;
- Base& operator=(const Base&) = delete;
-
- Base(Base&& v) noexcept : p_{v.p_} { v.p_ = nullptr; }
- Base& operator=(Base&& v) noexcept {
- OrtRelease(p_);
- p_ = v.release();
- return *this;
- }
-
- constexpr operator contained_type*() const noexcept { return p_; }
-
- /// \brief Relinquishes ownership of the contained C object pointer
- /// The underlying object is not destroyed
- contained_type* release() {
- T* p = p_;
- p_ = nullptr;
- return p;
- }
-
- protected:
- contained_type* p_{};
-};
-
-// Undefined. For const types use Base<Unowned<const T>>
-template <typename T>
-struct Base<const T>;
-
-/// <summary>
-/// Covers unowned pointers owned by either the ORT
-/// or some other instance of CPP wrappers.
-/// Used for ConstXXX and UnownedXXXX types that are copyable.
-/// Also convenient to wrap raw OrtXX pointers .
-/// </summary>
-/// <typeparam name="T"></typeparam>
-template <typename T>
-struct Base<Unowned<T>> {
- using contained_type = typename Unowned<T>::Type;
-
- constexpr Base() = default;
- constexpr explicit Base(contained_type* p) noexcept : p_{p} {}
-
- ~Base() = default;
-
- Base(const Base&) = default;
- Base& operator=(const Base&) = default;
-
- Base(Base&& v) noexcept : p_{v.p_} { v.p_ = nullptr; }
- Base& operator=(Base&& v) noexcept {
- p_ = nullptr;
- std::swap(p_, v.p_);
- return *this;
- }
-
- constexpr operator contained_type*() const noexcept { return p_; }
-
- protected:
- contained_type* p_{};
-};
-
-// Light functor to release memory with OrtAllocator
-struct AllocatedFree {
- OrtAllocator* allocator_;
- explicit AllocatedFree(OrtAllocator* allocator)
- : allocator_(allocator) {}
- void operator()(void* ptr) const {
- if (ptr) allocator_->Free(allocator_, ptr);
- }
-};
-
-} // namespace detail
-
-struct AllocatorWithDefaultOptions;
-struct Env;
-struct TypeInfo;
-struct Value;
-struct ModelMetadata;
-
-/** \brief unique_ptr typedef used to own strings allocated by OrtAllocators
- * and release them at the end of the scope. The lifespan of the given allocator
- * must eclipse the lifespan of AllocatedStringPtr instance
- */
-using AllocatedStringPtr = std::unique_ptr<char, detail::AllocatedFree>;
-
-/** \brief The Status that holds ownership of OrtStatus received from C API
- * Use it to safely destroy OrtStatus* returned from the C API. Use appropriate
- * constructors to construct an instance of a Status object from exceptions.
- */
-struct Status : detail::Base<OrtStatus> {
- explicit Status(std::nullptr_t) {} ///< Create an empty object, must be assigned a valid one to be used
- explicit Status(OrtStatus* status); ///< Takes ownership of OrtStatus instance returned from the C API. Must be non-null
- explicit Status(const Exception&); ///< Creates status instance out of exception
- explicit Status(const std::exception&); ///< Creates status instance out of exception
- std::string GetErrorMessage() const;
- OrtErrorCode GetErrorCode() const;
-};
-
-/** \brief The ThreadingOptions
- *
- * The ThreadingOptions used for set global threadpools' options of The Env.
- */
-struct ThreadingOptions : detail::Base<OrtThreadingOptions> {
- /// \brief Wraps OrtApi::CreateThreadingOptions
- ThreadingOptions();
-
- /// \brief Wraps OrtApi::SetGlobalIntraOpNumThreads
- ThreadingOptions& SetGlobalIntraOpNumThreads(int intra_op_num_threads);
-
- /// \brief Wraps OrtApi::SetGlobalInterOpNumThreads
- ThreadingOptions& SetGlobalInterOpNumThreads(int inter_op_num_threads);
-
- /// \brief Wraps OrtApi::SetGlobalSpinControl
- ThreadingOptions& SetGlobalSpinControl(int allow_spinning);
-
- /// \brief Wraps OrtApi::SetGlobalDenormalAsZero
- ThreadingOptions& SetGlobalDenormalAsZero();
-
- /// \brief Wraps OrtApi::SetGlobalCustomCreateThreadFn
- ThreadingOptions& SetGlobalCustomCreateThreadFn(OrtCustomCreateThreadFn ort_custom_create_thread_fn);
-
- /// \brief Wraps OrtApi::SetGlobalCustomThreadCreationOptions
- ThreadingOptions& SetGlobalCustomThreadCreationOptions(void* ort_custom_thread_creation_options);
-
- /// \brief Wraps OrtApi::SetGlobalCustomJoinThreadFn
- ThreadingOptions& SetGlobalCustomJoinThreadFn(OrtCustomJoinThreadFn ort_custom_join_thread_fn);
-};
-
-/** \brief The Env (Environment)
- *
- * The Env holds the logging state used by all other objects.
- * <b>Note:</b> One Env must be created before using any other Onnxruntime functionality
- */
-struct Env : detail::Base<OrtEnv> {
- explicit Env(std::nullptr_t) {} ///< Create an empty Env object, must be assigned a valid one to be used
-
- /// \brief Wraps OrtApi::CreateEnv
- Env(OrtLoggingLevel logging_level = ORT_LOGGING_LEVEL_WARNING, _In_ const char* logid = "");
-
- /// \brief Wraps OrtApi::CreateEnvWithCustomLogger
- Env(OrtLoggingLevel logging_level, const char* logid, OrtLoggingFunction logging_function, void* logger_param);
-
- /// \brief Wraps OrtApi::CreateEnvWithGlobalThreadPools
- Env(const OrtThreadingOptions* tp_options, OrtLoggingLevel logging_level = ORT_LOGGING_LEVEL_WARNING, _In_ const char* logid = "");
-
- /// \brief Wraps OrtApi::CreateEnvWithCustomLoggerAndGlobalThreadPools
- Env(const OrtThreadingOptions* tp_options, OrtLoggingFunction logging_function, void* logger_param,
- OrtLoggingLevel logging_level = ORT_LOGGING_LEVEL_WARNING, _In_ const char* logid = "");
-
- /// \brief C Interop Helper
- explicit Env(OrtEnv* p) : Base<OrtEnv>{p} {}
-
- Env& EnableTelemetryEvents(); ///< Wraps OrtApi::EnableTelemetryEvents
- Env& DisableTelemetryEvents(); ///< Wraps OrtApi::DisableTelemetryEvents
-
- Env& UpdateEnvWithCustomLogLevel(OrtLoggingLevel log_severity_level); ///< Wraps OrtApi::UpdateEnvWithCustomLogLevel
-
- Env& CreateAndRegisterAllocator(const OrtMemoryInfo* mem_info, const OrtArenaCfg* arena_cfg); ///< Wraps OrtApi::CreateAndRegisterAllocator
-};
-
-/** \brief Custom Op Domain
- *
- */
-struct CustomOpDomain : detail::Base<OrtCustomOpDomain> {
- explicit CustomOpDomain(std::nullptr_t) {} ///< Create an empty CustomOpDomain object, must be assigned a valid one to be used
-
- /// \brief Wraps OrtApi::CreateCustomOpDomain
- explicit CustomOpDomain(const char* domain);
-
- // This does not take ownership of the op, simply registers it.
- void Add(const OrtCustomOp* op); ///< Wraps CustomOpDomain_Add
-};
-
-/** \brief RunOptions
- *
- */
-struct RunOptions : detail::Base<OrtRunOptions> {
- explicit RunOptions(std::nullptr_t) {} ///< Create an empty RunOptions object, must be assigned a valid one to be used
- RunOptions(); ///< Wraps OrtApi::CreateRunOptions
-
- RunOptions& SetRunLogVerbosityLevel(int); ///< Wraps OrtApi::RunOptionsSetRunLogVerbosityLevel
- int GetRunLogVerbosityLevel() const; ///< Wraps OrtApi::RunOptionsGetRunLogVerbosityLevel
-
- RunOptions& SetRunLogSeverityLevel(int); ///< Wraps OrtApi::RunOptionsSetRunLogSeverityLevel
- int GetRunLogSeverityLevel() const; ///< Wraps OrtApi::RunOptionsGetRunLogSeverityLevel
-
- RunOptions& SetRunTag(const char* run_tag); ///< wraps OrtApi::RunOptionsSetRunTag
- const char* GetRunTag() const; ///< Wraps OrtApi::RunOptionsGetRunTag
-
- RunOptions& AddConfigEntry(const char* config_key, const char* config_value); ///< Wraps OrtApi::AddRunConfigEntry
-
- /** \brief Terminates all currently executing Session::Run calls that were made using this RunOptions instance
- *
- * If a currently executing session needs to be force terminated, this can be called from another thread to force it to fail with an error
- * Wraps OrtApi::RunOptionsSetTerminate
- */
- RunOptions& SetTerminate();
-
- /** \brief Clears the terminate flag so this RunOptions instance can be used in a new Session::Run call without it instantly terminating
- *
- * Wraps OrtApi::RunOptionsUnsetTerminate
- */
- RunOptions& UnsetTerminate();
-};
-
-
-namespace detail {
-// Utility function that returns a SessionOption config entry key for a specific custom operator.
-// Ex: custom_op.[custom_op_name].[config]
-std::string MakeCustomOpConfigEntryKey(const char* custom_op_name, const char* config);
-} // namespace detail
-
-/// <summary>
-/// Class that represents session configuration entries for one or more custom operators.
-///
-/// Example:
-/// Ort::CustomOpConfigs op_configs;
-/// op_configs.AddConfig("my_custom_op", "device_type", "CPU");
-///
-/// Passed to Ort::SessionOptions::RegisterCustomOpsLibrary.
-/// </summary>
-struct CustomOpConfigs {
- CustomOpConfigs() = default;
- ~CustomOpConfigs() = default;
- CustomOpConfigs(const CustomOpConfigs&) = default;
- CustomOpConfigs& operator=(const CustomOpConfigs&) = default;
- CustomOpConfigs(CustomOpConfigs&& o) = default;
- CustomOpConfigs& operator=(CustomOpConfigs&& o) = default;
-
- /** \brief Adds a session configuration entry/value for a specific custom operator.
- *
- * \param custom_op_name The name of the custom operator for which to add a configuration entry.
- * Must match the name returned by the CustomOp's GetName() method.
- * \param config_key The name of the configuration entry.
- * \param config_value The value of the configuration entry.
- * \return A reference to this object to enable call chaining.
- */
- CustomOpConfigs& AddConfig(const char* custom_op_name, const char* config_key, const char* config_value);
-
- /** \brief Returns a flattened map of custom operator configuration entries and their values.
- *
- * The keys has been flattened to include both the custom operator name and the configuration entry key name.
- * For example, a prior call to AddConfig("my_op", "key", "value") corresponds to the flattened key/value pair
- * {"my_op.key", "value"}.
- *
- * \return An unordered map of flattened configurations.
- */
- const std::unordered_map<std::string, std::string>& GetFlattenedConfigs() const;
-
- private:
- std::unordered_map<std::string, std::string> flat_configs_;
-};
-
-/** \brief Options object used when creating a new Session object
- *
- * Wraps ::OrtSessionOptions object and methods
- */
-
-struct SessionOptions;
-
-namespace detail {
-// we separate const-only methods because passing const ptr to non-const methods
-// is only discovered when inline methods are compiled which is counter-intuitive
-template <typename T>
-struct ConstSessionOptionsImpl : Base<T> {
- using B = Base<T>;
- using B::B;
-
- SessionOptions Clone() const; ///< Creates and returns a copy of this SessionOptions object. Wraps OrtApi::CloneSessionOptions
-
- std::string GetConfigEntry(const char* config_key) const; ///< Wraps OrtApi::GetSessionConfigEntry
- bool HasConfigEntry(const char* config_key) const; ///< Wraps OrtApi::HasSessionConfigEntry
- std::string GetConfigEntryOrDefault(const char* config_key, const std::string& def);
-};
-
-template <typename T>
-struct SessionOptionsImpl : ConstSessionOptionsImpl<T> {
- using B = ConstSessionOptionsImpl<T>;
- using B::B;
-
- SessionOptionsImpl& SetIntraOpNumThreads(int intra_op_num_threads); ///< Wraps OrtApi::SetIntraOpNumThreads
- SessionOptionsImpl& SetInterOpNumThreads(int inter_op_num_threads); ///< Wraps OrtApi::SetInterOpNumThreads
- SessionOptionsImpl& SetGraphOptimizationLevel(GraphOptimizationLevel graph_optimization_level); ///< Wraps OrtApi::SetSessionGraphOptimizationLevel
-
- SessionOptionsImpl& EnableCpuMemArena(); ///< Wraps OrtApi::EnableCpuMemArena
- SessionOptionsImpl& DisableCpuMemArena(); ///< Wraps OrtApi::DisableCpuMemArena
-
- SessionOptionsImpl& SetOptimizedModelFilePath(const ORTCHAR_T* optimized_model_file); ///< Wraps OrtApi::SetOptimizedModelFilePath
-
- SessionOptionsImpl& EnableProfiling(const ORTCHAR_T* profile_file_prefix); ///< Wraps OrtApi::EnableProfiling
- SessionOptionsImpl& DisableProfiling(); ///< Wraps OrtApi::DisableProfiling
-
- SessionOptionsImpl& EnableOrtCustomOps(); ///< Wraps OrtApi::EnableOrtCustomOps
-
- SessionOptionsImpl& EnableMemPattern(); ///< Wraps OrtApi::EnableMemPattern
- SessionOptionsImpl& DisableMemPattern(); ///< Wraps OrtApi::DisableMemPattern
-
- SessionOptionsImpl& SetExecutionMode(ExecutionMode execution_mode); ///< Wraps OrtApi::SetSessionExecutionMode
-
- SessionOptionsImpl& SetLogId(const char* logid); ///< Wraps OrtApi::SetSessionLogId
- SessionOptionsImpl& SetLogSeverityLevel(int level); ///< Wraps OrtApi::SetSessionLogSeverityLevel
-
- SessionOptionsImpl& Add(OrtCustomOpDomain* custom_op_domain); ///< Wraps OrtApi::AddCustomOpDomain
-
- SessionOptionsImpl& DisablePerSessionThreads(); ///< Wraps OrtApi::DisablePerSessionThreads
-
- SessionOptionsImpl& AddConfigEntry(const char* config_key, const char* config_value); ///< Wraps OrtApi::AddSessionConfigEntry
-
- SessionOptionsImpl& AddInitializer(const char* name, const OrtValue* ort_val); ///< Wraps OrtApi::AddInitializer
- SessionOptionsImpl& AddExternalInitializers(const std::vector<std::string>& names, const std::vector<Value>& ort_values); ///< Wraps OrtApi::AddExternalInitializers
-
- SessionOptionsImpl& AppendExecutionProvider_CUDA(const OrtCUDAProviderOptions& provider_options); ///< Wraps OrtApi::SessionOptionsAppendExecutionProvider_CUDA
- SessionOptionsImpl& AppendExecutionProvider_CUDA_V2(const OrtCUDAProviderOptionsV2& provider_options); ///< Wraps OrtApi::SessionOptionsAppendExecutionProvider_CUDA_V2
- SessionOptionsImpl& AppendExecutionProvider_ROCM(const OrtROCMProviderOptions& provider_options); ///< Wraps OrtApi::SessionOptionsAppendExecutionProvider_ROCM
- SessionOptionsImpl& AppendExecutionProvider_OpenVINO(const OrtOpenVINOProviderOptions& provider_options); ///< Wraps OrtApi::SessionOptionsAppendExecutionProvider_OpenVINO
- SessionOptionsImpl& AppendExecutionProvider_TensorRT(const OrtTensorRTProviderOptions& provider_options); ///< Wraps OrtApi::SessionOptionsAppendExecutionProvider_TensorRT
- SessionOptionsImpl& AppendExecutionProvider_TensorRT_V2(const OrtTensorRTProviderOptionsV2& provider_options); ///< Wraps OrtApi::SessionOptionsAppendExecutionProvider_TensorRT
- SessionOptionsImpl& AppendExecutionProvider_MIGraphX(const OrtMIGraphXProviderOptions& provider_options); ///< Wraps OrtApi::SessionOptionsAppendExecutionProvider_MIGraphX
- ///< Wraps OrtApi::SessionOptionsAppendExecutionProvider_CANN
- SessionOptionsImpl& AppendExecutionProvider_CANN(const OrtCANNProviderOptions& provider_options);
- /// Wraps OrtApi::SessionOptionsAppendExecutionProvider. Currently supports SNPE and XNNPACK.
- SessionOptionsImpl& AppendExecutionProvider(const std::string& provider_name,
- const std::unordered_map<std::string, std::string>& provider_options = {});
-
- SessionOptionsImpl& SetCustomCreateThreadFn(OrtCustomCreateThreadFn ort_custom_create_thread_fn); ///< Wraps OrtApi::SessionOptionsSetCustomCreateThreadFn
- SessionOptionsImpl& SetCustomThreadCreationOptions(void* ort_custom_thread_creation_options); ///< Wraps OrtApi::SessionOptionsSetCustomThreadCreationOptions
- SessionOptionsImpl& SetCustomJoinThreadFn(OrtCustomJoinThreadFn ort_custom_join_thread_fn); ///< Wraps OrtApi::SessionOptionsSetCustomJoinThreadFn
-
- ///< Registers the custom operator from the specified shared library via OrtApi::RegisterCustomOpsLibrary_V2.
- ///< The custom operator configurations are optional. If provided, custom operator configs are set via
- ///< OrtApi::AddSessionConfigEntry.
- SessionOptionsImpl& RegisterCustomOpsLibrary(const ORTCHAR_T* library_name, const CustomOpConfigs& custom_op_configs = {});
-
- SessionOptionsImpl& RegisterCustomOpsUsingFunction(const char* function_name); ///< Wraps OrtApi::RegisterCustomOpsUsingFunction
-};
-} // namespace detail
-
-using UnownedSessionOptions = detail::SessionOptionsImpl<detail::Unowned<OrtSessionOptions>>;
-using ConstSessionOptions = detail::ConstSessionOptionsImpl<detail::Unowned<const OrtSessionOptions>>;
-
-/** \brief Wrapper around ::OrtSessionOptions
- *
- */
-struct SessionOptions : detail::SessionOptionsImpl<OrtSessionOptions> {
- explicit SessionOptions(std::nullptr_t) {} ///< Create an empty SessionOptions object, must be assigned a valid one to be used
- SessionOptions(); ///< Wraps OrtApi::CreateSessionOptions
- explicit SessionOptions(OrtSessionOptions* p) : SessionOptionsImpl<OrtSessionOptions>{p} {} ///< Used for interop with the C API
- UnownedSessionOptions GetUnowned() const { return UnownedSessionOptions{this->p_}; }
- ConstSessionOptions GetConst() const { return ConstSessionOptions{this->p_}; }
-};
-
-/** \brief Wrapper around ::OrtModelMetadata
- *
- */
-struct ModelMetadata : detail::Base<OrtModelMetadata> {
- explicit ModelMetadata(std::nullptr_t) {} ///< Create an empty ModelMetadata object, must be assigned a valid one to be used
- explicit ModelMetadata(OrtModelMetadata* p) : Base<OrtModelMetadata>{p} {} ///< Used for interop with the C API
-
- /** \brief Returns a copy of the producer name.
- *
- * \param allocator to allocate memory for the copy of the name returned
- * \return a instance of smart pointer that would deallocate the buffer when out of scope.
- * The OrtAllocator instances must be valid at the point of memory release.
- */
- AllocatedStringPtr GetProducerNameAllocated(OrtAllocator* allocator) const; ///< Wraps OrtApi::ModelMetadataGetProducerName
-
- /** \brief Returns a copy of the graph name.
- *
- * \param allocator to allocate memory for the copy of the name returned
- * \return a instance of smart pointer that would deallocate the buffer when out of scope.
- * The OrtAllocator instances must be valid at the point of memory release.
- */
- AllocatedStringPtr GetGraphNameAllocated(OrtAllocator* allocator) const; ///< Wraps OrtApi::ModelMetadataGetGraphName
-
- /** \brief Returns a copy of the domain name.
- *
- * \param allocator to allocate memory for the copy of the name returned
- * \return a instance of smart pointer that would deallocate the buffer when out of scope.
- * The OrtAllocator instances must be valid at the point of memory release.
- */
- AllocatedStringPtr GetDomainAllocated(OrtAllocator* allocator) const; ///< Wraps OrtApi::ModelMetadataGetDomain
-
- /** \brief Returns a copy of the description.
- *
- * \param allocator to allocate memory for the copy of the string returned
- * \return a instance of smart pointer that would deallocate the buffer when out of scope.
- * The OrtAllocator instances must be valid at the point of memory release.
- */
- AllocatedStringPtr GetDescriptionAllocated(OrtAllocator* allocator) const; ///< Wraps OrtApi::ModelMetadataGetDescription
-
- /** \brief Returns a copy of the graph description.
- *
- * \param allocator to allocate memory for the copy of the string returned
- * \return a instance of smart pointer that would deallocate the buffer when out of scope.
- * The OrtAllocator instances must be valid at the point of memory release.
- */
- AllocatedStringPtr GetGraphDescriptionAllocated(OrtAllocator* allocator) const; ///< Wraps OrtApi::ModelMetadataGetGraphDescription
-
- /** \brief Returns a vector of copies of the custom metadata keys.
- *
- * \param allocator to allocate memory for the copy of the string returned
- * \return a instance std::vector of smart pointers that would deallocate the buffers when out of scope.
- * The OrtAllocator instance must be valid at the point of memory release.
- */
- std::vector<AllocatedStringPtr> GetCustomMetadataMapKeysAllocated(OrtAllocator* allocator) const; ///< Wraps OrtApi::ModelMetadataGetCustomMetadataMapKeys
-
- /** \brief Looks up a value by a key in the Custom Metadata map
- *
- * \param key zero terminated string key to lookup
- * \param allocator to allocate memory for the copy of the string returned
- * \return a instance of smart pointer that would deallocate the buffer when out of scope.
- * maybe nullptr if key is not found.
- *
- * The OrtAllocator instances must be valid at the point of memory release.
- */
- AllocatedStringPtr LookupCustomMetadataMapAllocated(const char* key, OrtAllocator* allocator) const; ///< Wraps OrtApi::ModelMetadataLookupCustomMetadataMap
-
- int64_t GetVersion() const; ///< Wraps OrtApi::ModelMetadataGetVersion
-};
-
-struct IoBinding;
-
-namespace detail {
-
-// we separate const-only methods because passing const ptr to non-const methods
-// is only discovered when inline methods are compiled which is counter-intuitive
-template <typename T>
-struct ConstSessionImpl : Base<T> {
- using B = Base<T>;
- using B::B;
-
- size_t GetInputCount() const; ///< Returns the number of model inputs
- size_t GetOutputCount() const; ///< Returns the number of model outputs
- size_t GetOverridableInitializerCount() const; ///< Returns the number of inputs that have defaults that can be overridden
-
- /** \brief Returns a copy of input name at the specified index.
- *
- * \param index must less than the value returned by GetInputCount()
- * \param allocator to allocate memory for the copy of the name returned
- * \return a instance of smart pointer that would deallocate the buffer when out of scope.
- * The OrtAllocator instances must be valid at the point of memory release.
- */
- AllocatedStringPtr GetInputNameAllocated(size_t index, OrtAllocator* allocator) const;
-
- /** \brief Returns a copy of output name at then specified index.
- *
- * \param index must less than the value returned by GetOutputCount()
- * \param allocator to allocate memory for the copy of the name returned
- * \return a instance of smart pointer that would deallocate the buffer when out of scope.
- * The OrtAllocator instances must be valid at the point of memory release.
- */
- AllocatedStringPtr GetOutputNameAllocated(size_t index, OrtAllocator* allocator) const;
-
- /** \brief Returns a copy of the overridable initializer name at then specified index.
- *
- * \param index must less than the value returned by GetOverridableInitializerCount()
- * \param allocator to allocate memory for the copy of the name returned
- * \return a instance of smart pointer that would deallocate the buffer when out of scope.
- * The OrtAllocator instances must be valid at the point of memory release.
- */
- AllocatedStringPtr GetOverridableInitializerNameAllocated(size_t index, OrtAllocator* allocator) const; ///< Wraps OrtApi::SessionGetOverridableInitializerName
-
- uint64_t GetProfilingStartTimeNs() const; ///< Wraps OrtApi::SessionGetProfilingStartTimeNs
- ModelMetadata GetModelMetadata() const; ///< Wraps OrtApi::SessionGetModelMetadata
-
- TypeInfo GetInputTypeInfo(size_t index) const; ///< Wraps OrtApi::SessionGetInputTypeInfo
- TypeInfo GetOutputTypeInfo(size_t index) const; ///< Wraps OrtApi::SessionGetOutputTypeInfo
- TypeInfo GetOverridableInitializerTypeInfo(size_t index) const; ///< Wraps OrtApi::SessionGetOverridableInitializerTypeInfo
-};
-
-template <typename T>
-struct SessionImpl : ConstSessionImpl<T> {
- using B = ConstSessionImpl<T>;
- using B::B;
-
- /** \brief Run the model returning results in an Ort allocated vector.
- *
- * Wraps OrtApi::Run
- *
- * The caller provides a list of inputs and a list of the desired outputs to return.
- *
- * See the output logs for more information on warnings/errors that occur while processing the model.
- * Common errors are.. (TODO)
- *
- * \param[in] run_options
- * \param[in] input_names Array of null terminated strings of length input_count that is the list of input names
- * \param[in] input_values Array of Value objects of length input_count that is the list of input values
- * \param[in] input_count Number of inputs (the size of the input_names & input_values arrays)
- * \param[in] output_names Array of C style strings of length output_count that is the list of output names
- * \param[in] output_count Number of outputs (the size of the output_names array)
- * \return A std::vector of Value objects that directly maps to the output_names array (eg. output_name[0] is the first entry of the returned vector)
- */
- std::vector<Value> Run(const RunOptions& run_options, const char* const* input_names, const Value* input_values, size_t input_count,
- const char* const* output_names, size_t output_count);
-
- /** \brief Run the model returning results in user provided outputs
- * Same as Run(const RunOptions&, const char* const*, const Value*, size_t,const char* const*, size_t)
- */
- void Run(const RunOptions& run_options, const char* const* input_names, const Value* input_values, size_t input_count,
- const char* const* output_names, Value* output_values, size_t output_count);
-
- void Run(const RunOptions& run_options, const IoBinding&); ///< Wraps OrtApi::RunWithBinding
-
- /** \brief End profiling and return a copy of the profiling file name.
- *
- * \param allocator to allocate memory for the copy of the string returned
- * \return a instance of smart pointer that would deallocate the buffer when out of scope.
- * The OrtAllocator instances must be valid at the point of memory release.
- */
- AllocatedStringPtr EndProfilingAllocated(OrtAllocator* allocator); ///< Wraps OrtApi::SessionEndProfiling
-};
-
-} // namespace detail
-
-using ConstSession = detail::ConstSessionImpl<detail::Unowned<const OrtSession>>;
-using UnownedSession = detail::SessionImpl<detail::Unowned<OrtSession>>;
-
-/** \brief Wrapper around ::OrtSession
- *
- */
-struct Session : detail::SessionImpl<OrtSession> {
- explicit Session(std::nullptr_t) {} ///< Create an empty Session object, must be assigned a valid one to be used
- Session(const Env& env, const ORTCHAR_T* model_path, const SessionOptions& options); ///< Wraps OrtApi::CreateSession
- Session(const Env& env, const ORTCHAR_T* model_path, const SessionOptions& options,
- OrtPrepackedWeightsContainer* prepacked_weights_container); ///< Wraps OrtApi::CreateSessionWithPrepackedWeightsContainer
- Session(const Env& env, const void* model_data, size_t model_data_length, const SessionOptions& options); ///< Wraps OrtApi::CreateSessionFromArray
- Session(const Env& env, const void* model_data, size_t model_data_length, const SessionOptions& options,
- OrtPrepackedWeightsContainer* prepacked_weights_container); ///< Wraps OrtApi::CreateSessionFromArrayWithPrepackedWeightsContainer
-
- ConstSession GetConst() const { return ConstSession{this->p_}; }
- UnownedSession GetUnowned() const { return UnownedSession{this->p_}; }
-};
-
-namespace detail {
-template <typename T>
-struct MemoryInfoImpl : Base<T> {
- using B = Base<T>;
- using B::B;
-
- std::string GetAllocatorName() const;
- OrtAllocatorType GetAllocatorType() const;
- int GetDeviceId() const;
- OrtMemoryInfoDeviceType GetDeviceType() const;
- OrtMemType GetMemoryType() const;
-
- template <typename U>
- bool operator==(const MemoryInfoImpl<U>& o) const;
-};
-} // namespace detail
-
-// Const object holder that does not own the underlying object
-using ConstMemoryInfo = detail::MemoryInfoImpl<detail::Unowned<const OrtMemoryInfo>>;
-
-/** \brief Wrapper around ::OrtMemoryInfo
- *
- */
-struct MemoryInfo : detail::MemoryInfoImpl<OrtMemoryInfo> {
- static MemoryInfo CreateCpu(OrtAllocatorType type, OrtMemType mem_type1);
- explicit MemoryInfo(std::nullptr_t) {} ///< No instance is created
- explicit MemoryInfo(OrtMemoryInfo* p) : MemoryInfoImpl<OrtMemoryInfo>{p} {} ///< Take ownership of a pointer created by C Api
- MemoryInfo(const char* name, OrtAllocatorType type, int id, OrtMemType mem_type);
- ConstMemoryInfo GetConst() const { return ConstMemoryInfo{this->p_}; }
-};
-
-namespace detail {
-template <typename T>
-struct TensorTypeAndShapeInfoImpl : Base<T> {
- using B = Base<T>;
- using B::B;
-
- ONNXTensorElementDataType GetElementType() const; ///< Wraps OrtApi::GetTensorElementType
- size_t GetElementCount() const; ///< Wraps OrtApi::GetTensorShapeElementCount
-
- size_t GetDimensionsCount() const; ///< Wraps OrtApi::GetDimensionsCount
-
- /** \deprecated use GetShape() returning std::vector
- * [[deprecated]]
- * This interface is unsafe to use
- */
- [[deprecated("use GetShape()")]] void GetDimensions(int64_t* values, size_t values_count) const; ///< Wraps OrtApi::GetDimensions
-
- void GetSymbolicDimensions(const char** values, size_t values_count) const; ///< Wraps OrtApi::GetSymbolicDimensions
-
- std::vector<int64_t> GetShape() const; ///< Uses GetDimensionsCount & GetDimensions to return a std::vector of the shape
-};
-
-} // namespace detail
-
-using ConstTensorTypeAndShapeInfo = detail::TensorTypeAndShapeInfoImpl<detail::Unowned<const OrtTensorTypeAndShapeInfo>>;
-
-/** \brief Wrapper around ::OrtTensorTypeAndShapeInfo
- *
- */
-struct TensorTypeAndShapeInfo : detail::TensorTypeAndShapeInfoImpl<OrtTensorTypeAndShapeInfo> {
- explicit TensorTypeAndShapeInfo(std::nullptr_t) {} ///< Create an empty TensorTypeAndShapeInfo object, must be assigned a valid one to be used
- explicit TensorTypeAndShapeInfo(OrtTensorTypeAndShapeInfo* p) : TensorTypeAndShapeInfoImpl{p} {} ///< Used for interop with the C API
- ConstTensorTypeAndShapeInfo GetConst() const { return ConstTensorTypeAndShapeInfo{this->p_}; }
-};
-
-namespace detail {
-template <typename T>
-struct SequenceTypeInfoImpl : Base<T> {
- using B = Base<T>;
- using B::B;
- TypeInfo GetSequenceElementType() const; ///< Wraps OrtApi::GetSequenceElementType
-};
-
-} // namespace detail
-
-using ConstSequenceTypeInfo = detail::SequenceTypeInfoImpl<detail::Unowned<const OrtSequenceTypeInfo>>;
-
-/** \brief Wrapper around ::OrtSequenceTypeInfo
- *
- */
-struct SequenceTypeInfo : detail::SequenceTypeInfoImpl<OrtSequenceTypeInfo> {
- explicit SequenceTypeInfo(std::nullptr_t) {} ///< Create an empty SequenceTypeInfo object, must be assigned a valid one to be used
- explicit SequenceTypeInfo(OrtSequenceTypeInfo* p) : SequenceTypeInfoImpl<OrtSequenceTypeInfo>{p} {} ///< Used for interop with the C API
- ConstSequenceTypeInfo GetConst() const { return ConstSequenceTypeInfo{this->p_}; }
-};
-
-namespace detail {
-template <typename T>
-struct MapTypeInfoImpl : detail::Base<T> {
- using B = Base<T>;
- using B::B;
- ONNXTensorElementDataType GetMapKeyType() const; ///< Wraps OrtApi::GetMapKeyType
- TypeInfo GetMapValueType() const; ///< Wraps OrtApi::GetMapValueType
-};
-
-} // namespace detail
-
-using ConstMapTypeInfo = detail::MapTypeInfoImpl<detail::Unowned<const OrtMapTypeInfo>>;
-
-/** \brief Wrapper around ::OrtMapTypeInfo
- *
- */
-struct MapTypeInfo : detail::MapTypeInfoImpl<OrtMapTypeInfo> {
- explicit MapTypeInfo(std::nullptr_t) {} ///< Create an empty MapTypeInfo object, must be assigned a valid one to be used
- explicit MapTypeInfo(OrtMapTypeInfo* p) : MapTypeInfoImpl<OrtMapTypeInfo>{p} {} ///< Used for interop with the C API
- ConstMapTypeInfo GetConst() const { return ConstMapTypeInfo{this->p_}; }
-};
-
-namespace detail {
-template <typename T>
-struct TypeInfoImpl : detail::Base<T> {
- using B = Base<T>;
- using B::B;
-
- ConstTensorTypeAndShapeInfo GetTensorTypeAndShapeInfo() const; ///< Wraps OrtApi::CastTypeInfoToTensorInfo
- ConstSequenceTypeInfo GetSequenceTypeInfo() const; ///< Wraps OrtApi::CastTypeInfoToSequenceTypeInfo
- ConstMapTypeInfo GetMapTypeInfo() const; ///< Wraps OrtApi::CastTypeInfoToMapTypeInfo
-
- ONNXType GetONNXType() const;
-};
-} // namespace detail
-
-/// <summary>
-/// Contains a constant, unowned OrtTypeInfo that can be copied and passed around by value.
-/// Provides access to const OrtTypeInfo APIs.
-/// </summary>
-using ConstTypeInfo = detail::TypeInfoImpl<detail::Unowned<const OrtTypeInfo>>;
-
-/// <summary>
-/// Type information that may contain either TensorTypeAndShapeInfo or
-/// the information about contained sequence or map depending on the ONNXType.
-/// </summary>
-struct TypeInfo : detail::TypeInfoImpl<OrtTypeInfo> {
- explicit TypeInfo(std::nullptr_t) {} ///< Create an empty TypeInfo object, must be assigned a valid one to be used
- explicit TypeInfo(OrtTypeInfo* p) : TypeInfoImpl<OrtTypeInfo>{p} {} ///< C API Interop
-
- ConstTypeInfo GetConst() const { return ConstTypeInfo{this->p_}; }
-};
-
-namespace detail {
-// This structure is used to feed sparse tensor values
-// information for use with FillSparseTensor<Format>() API
-// if the data type for the sparse tensor values is numeric
-// use data.p_data, otherwise, use data.str pointer to feed
-// values. data.str is an array of const char* that are zero terminated.
-// number of strings in the array must match shape size.
-// For fully sparse tensors use shape {0} and set p_data/str
-// to nullptr.
-struct OrtSparseValuesParam {
- const int64_t* values_shape;
- size_t values_shape_len;
- union {
- const void* p_data;
- const char** str;
- } data;
-};
-
-// Provides a way to pass shape in a single
-// argument
-struct Shape {
- const int64_t* shape;
- size_t shape_len;
-};
-
-template <typename T>
-struct ConstValueImpl : Base<T> {
- using B = Base<T>;
- using B::B;
-
- /// <summary>
- /// Obtains a pointer to a user defined data for experimental purposes
- /// </summary>
- template <typename R>
- void GetOpaqueData(const char* domain, const char* type_name, R&) const; ///< Wraps OrtApi::GetOpaqueValue
-
- bool IsTensor() const; ///< Returns true if Value is a tensor, false for other types like map/sequence/etc
- bool HasValue() const; /// < Return true if OrtValue contains data and returns false if the OrtValue is a None
-
- size_t GetCount() const; // If a non tensor, returns 2 for map and N for sequence, where N is the number of elements
- Value GetValue(int index, OrtAllocator* allocator) const;
-
- /// <summary>
- /// This API returns a full length of string data contained within either a tensor or a sparse Tensor.
- /// For sparse tensor it returns a full length of stored non-empty strings (values). The API is useful
- /// for allocating necessary memory and calling GetStringTensorContent().
- /// </summary>
- /// <returns>total length of UTF-8 encoded bytes contained. No zero terminators counted.</returns>
- size_t GetStringTensorDataLength() const;
-
- /// <summary>
- /// The API copies all of the UTF-8 encoded string data contained within a tensor or a sparse tensor
- /// into a supplied buffer. Use GetStringTensorDataLength() to find out the length of the buffer to allocate.
- /// The user must also allocate offsets buffer with the number of entries equal to that of the contained
- /// strings.
- ///
- /// Strings are always assumed to be on CPU, no X-device copy.
- /// </summary>
- /// <param name="buffer">user allocated buffer</param>
- /// <param name="buffer_length">length in bytes of the allocated buffer</param>
- /// <param name="offsets">a pointer to the offsets user allocated buffer</param>
- /// <param name="offsets_count">count of offsets, must be equal to the number of strings contained.
- /// that can be obtained from the shape of the tensor or from GetSparseTensorValuesTypeAndShapeInfo()
- /// for sparse tensors</param>
- void GetStringTensorContent(void* buffer, size_t buffer_length, size_t* offsets, size_t offsets_count) const;
-
- /// <summary>
- /// Returns a const typed pointer to the tensor contained data.
- /// No type checking is performed, the caller must ensure the type matches the tensor type.
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <returns>const pointer to data, no copies made</returns>
- template <typename R>
- const R* GetTensorData() const; ///< Wraps OrtApi::GetTensorMutableData /// <summary>
-
- /// <summary>
- /// Returns a non-typed pointer to a tensor contained data.
- /// </summary>
- /// <returns>const pointer to data, no copies made</returns>
- const void* GetTensorRawData() const;
-
- /// <summary>
- /// The API returns type information for data contained in a tensor. For sparse
- /// tensors it returns type information for contained non-zero values.
- /// It returns dense shape for sparse tensors.
- /// </summary>
- /// <returns>TypeInfo</returns>
- TypeInfo GetTypeInfo() const;
-
- /// <summary>
- /// The API returns type information for data contained in a tensor. For sparse
- /// tensors it returns type information for contained non-zero values.
- /// It returns dense shape for sparse tensors.
- /// </summary>
- /// <returns>TensorTypeAndShapeInfo</returns>
- TensorTypeAndShapeInfo GetTensorTypeAndShapeInfo() const;
-
- /// <summary>
- /// This API returns information about the memory allocation used to hold data.
- /// </summary>
- /// <returns>Non owning instance of MemoryInfo</returns>
- ConstMemoryInfo GetTensorMemoryInfo() const;
-
- /// <summary>
- /// The API copies UTF-8 encoded bytes for the requested string element
- /// contained within a tensor or a sparse tensor into a provided buffer.
- /// Use GetStringTensorElementLength() to obtain the length of the buffer to allocate.
- /// </summary>
- /// <param name="buffer_length"></param>
- /// <param name="element_index"></param>
- /// <param name="buffer"></param>
- void GetStringTensorElement(size_t buffer_length, size_t element_index, void* buffer) const;
-
- /// <summary>
- /// The API returns a byte length of UTF-8 encoded string element
- /// contained in either a tensor or a spare tensor values.
- /// </summary>
- /// <param name="element_index"></param>
- /// <returns>byte length for the specified string element</returns>
- size_t GetStringTensorElementLength(size_t element_index) const;
-
-#if !defined(DISABLE_SPARSE_TENSORS)
- /// <summary>
- /// The API returns the sparse data format this OrtValue holds in a sparse tensor.
- /// If the sparse tensor was not fully constructed, i.e. Use*() or Fill*() API were not used
- /// the value returned is ORT_SPARSE_UNDEFINED.
- /// </summary>
- /// <returns>Format enum</returns>
- OrtSparseFormat GetSparseFormat() const;
-
- /// <summary>
- /// The API returns type and shape information for stored non-zero values of the
- /// sparse tensor. Use GetSparseTensorValues() to obtain values buffer pointer.
- /// </summary>
- /// <returns>TensorTypeAndShapeInfo values information</returns>
- TensorTypeAndShapeInfo GetSparseTensorValuesTypeAndShapeInfo() const;
-
- /// <summary>
- /// The API returns type and shape information for the specified indices. Each supported
- /// indices have their own enum values even if a give format has more than one kind of indices.
- /// Use GetSparseTensorIndicesData() to obtain pointer to indices buffer.
- /// </summary>
- /// <param name="format">enum requested</param>
- /// <returns>type and shape information</returns>
- TensorTypeAndShapeInfo GetSparseTensorIndicesTypeShapeInfo(OrtSparseIndicesFormat format) const;
-
- /// <summary>
- /// The API retrieves a pointer to the internal indices buffer. The API merely performs
- /// a convenience data type casting on the return type pointer. Make sure you are requesting
- /// the right type, use GetSparseTensorIndicesTypeShapeInfo();
- /// </summary>
- /// <typeparam name="T">type to cast to</typeparam>
- /// <param name="indices_format">requested indices kind</param>
- /// <param name="num_indices">number of indices entries</param>
- /// <returns>Pinter to the internal sparse tensor buffer containing indices. Do not free this pointer.</returns>
- template <typename R>
- const R* GetSparseTensorIndicesData(OrtSparseIndicesFormat indices_format, size_t& num_indices) const;
-
- /// <summary>
- /// Returns true if the OrtValue contains a sparse tensor
- /// </summary>
- /// <returns></returns>
- bool IsSparseTensor() const;
-
- /// <summary>
- /// The API returns a pointer to an internal buffer of the sparse tensor
- /// containing non-zero values. The API merely does casting. Make sure you
- /// are requesting the right data type by calling GetSparseTensorValuesTypeAndShapeInfo()
- /// first.
- /// </summary>
- /// <typeparam name="T">numeric data types only. Use GetStringTensor*() to retrieve strings.</typeparam>
- /// <returns>a pointer to the internal values buffer. Do not free this pointer.</returns>
- template <typename R>
- const R* GetSparseTensorValues() const;
-
-#endif
-};
-
-template <typename T>
-struct ValueImpl : ConstValueImpl<T> {
- using B = ConstValueImpl<T>;
- using B::B;
-
- /// <summary>
- /// Returns a non-const typed pointer to an OrtValue/Tensor contained buffer
- /// No type checking is performed, the caller must ensure the type matches the tensor type.
- /// </summary>
- /// <returns>non-const pointer to data, no copies made</returns>
- template <typename R>
- R* GetTensorMutableData();
-
- /// <summary>
- /// Returns a non-typed non-const pointer to a tensor contained data.
- /// </summary>
- /// <returns>pointer to data, no copies made</returns>
- void* GetTensorMutableRawData();
-
- /// <summary>
- // Obtain a reference to an element of data at the location specified
- /// by the vector of dims.
- /// </summary>
- /// <typeparam name="R"></typeparam>
- /// <param name="location">[in] expressed by a vecotr of dimensions offsets</param>
- /// <returns></returns>
- template <typename R>
- R& At(const std::vector<int64_t>& location);
-
- /// <summary>
- /// Set all strings at once in a string tensor
- /// </summary>
- /// <param name="s">[in] An array of strings. Each string in this array must be null terminated.</param>
- /// <param name="s_len">[in] Count of strings in s (Must match the size of \p value's tensor shape)</param>
- void FillStringTensor(const char* const* s, size_t s_len);
-
- /// <summary>
- /// Set a single string in a string tensor
- /// </summary>
- /// <param name="s">[in] A null terminated UTF-8 encoded string</param>
- /// <param name="index">[in] Index of the string in the tensor to set</param>
- void FillStringTensorElement(const char* s, size_t index);
-
-#if !defined(DISABLE_SPARSE_TENSORS)
- /// <summary>
- /// Supplies COO format specific indices and marks the contained sparse tensor as being a COO format tensor.
- /// Values are supplied with a CreateSparseTensor() API. The supplied indices are not copied and the user
- /// allocated buffers lifespan must eclipse that of the OrtValue.
- /// The location of the indices is assumed to be the same as specified by OrtMemoryInfo argument at the creation time.
- /// </summary>
- /// <param name="indices_data">pointer to the user allocated buffer with indices. Use nullptr for fully sparse tensors.</param>
- /// <param name="indices_num">number of indices entries. Use 0 for fully sparse tensors</param>
- void UseCooIndices(int64_t* indices_data, size_t indices_num);
-
- /// <summary>
- /// Supplies CSR format specific indices and marks the contained sparse tensor as being a CSR format tensor.
- /// Values are supplied with a CreateSparseTensor() API. The supplied indices are not copied and the user
- /// allocated buffers lifespan must eclipse that of the OrtValue.
- /// The location of the indices is assumed to be the same as specified by OrtMemoryInfo argument at the creation time.
- /// </summary>
- /// <param name="inner_data">pointer to the user allocated buffer with inner indices or nullptr for fully sparse tensors</param>
- /// <param name="inner_num">number of csr inner indices or 0 for fully sparse tensors</param>
- /// <param name="outer_data">pointer to the user allocated buffer with outer indices or nullptr for fully sparse tensors</param>
- /// <param name="outer_num">number of csr outer indices or 0 for fully sparse tensors</param>
- void UseCsrIndices(int64_t* inner_data, size_t inner_num, int64_t* outer_data, size_t outer_num);
-
- /// <summary>
- /// Supplies BlockSparse format specific indices and marks the contained sparse tensor as being a BlockSparse format tensor.
- /// Values are supplied with a CreateSparseTensor() API. The supplied indices are not copied and the user
- /// allocated buffers lifespan must eclipse that of the OrtValue.
- /// The location of the indices is assumed to be the same as specified by OrtMemoryInfo argument at the creation time.
- /// </summary>
- /// <param name="indices_shape">indices shape or a {0} for fully sparse</param>
- /// <param name="indices_data">user allocated buffer with indices or nullptr for fully spare tensors</param>
- void UseBlockSparseIndices(const Shape& indices_shape, int32_t* indices_data);
-
- /// <summary>
- /// The API will allocate memory using the allocator instance supplied to the CreateSparseTensor() API
- /// and copy the values and COO indices into it. If data_mem_info specifies that the data is located
- /// at difference device than the allocator, a X-device copy will be performed if possible.
- /// </summary>
- /// <param name="data_mem_info">specified buffer memory description</param>
- /// <param name="values_param">values buffer information.</param>
- /// <param name="indices_data">coo indices buffer or nullptr for fully sparse data</param>
- /// <param name="indices_num">number of COO indices or 0 for fully sparse data</param>
- void FillSparseTensorCoo(const OrtMemoryInfo* data_mem_info, const OrtSparseValuesParam& values_param,
- const int64_t* indices_data, size_t indices_num);
-
- /// <summary>
- /// The API will allocate memory using the allocator instance supplied to the CreateSparseTensor() API
- /// and copy the values and CSR indices into it. If data_mem_info specifies that the data is located
- /// at difference device than the allocator, a X-device copy will be performed if possible.
- /// </summary>
- /// <param name="data_mem_info">specified buffer memory description</param>
- /// <param name="values">values buffer information</param>
- /// <param name="inner_indices_data">csr inner indices pointer or nullptr for fully sparse tensors</param>
- /// <param name="inner_indices_num">number of csr inner indices or 0 for fully sparse tensors</param>
- /// <param name="outer_indices_data">pointer to csr indices data or nullptr for fully sparse tensors</param>
- /// <param name="outer_indices_num">number of csr outer indices or 0</param>
- void FillSparseTensorCsr(const OrtMemoryInfo* data_mem_info,
- const OrtSparseValuesParam& values,
- const int64_t* inner_indices_data, size_t inner_indices_num,
- const int64_t* outer_indices_data, size_t outer_indices_num);
-
- /// <summary>
- /// The API will allocate memory using the allocator instance supplied to the CreateSparseTensor() API
- /// and copy the values and BlockSparse indices into it. If data_mem_info specifies that the data is located
- /// at difference device than the allocator, a X-device copy will be performed if possible.
- /// </summary>
- /// <param name="data_mem_info">specified buffer memory description</param>
- /// <param name="values">values buffer information</param>
- /// <param name="indices_shape">indices shape. use {0} for fully sparse tensors</param>
- /// <param name="indices_data">pointer to indices data or nullptr for fully sparse tensors</param>
- void FillSparseTensorBlockSparse(const OrtMemoryInfo* data_mem_info,
- const OrtSparseValuesParam& values,
- const Shape& indices_shape,
- const int32_t* indices_data);
-
-#endif
-};
-
-} // namespace detail
-
-using ConstValue = detail::ConstValueImpl<detail::Unowned<const OrtValue>>;
-using UnownedValue = detail::ValueImpl<detail::Unowned<OrtValue>>;
-
-/** \brief Wrapper around ::OrtValue
- *
- */
-struct Value : detail::ValueImpl<OrtValue> {
- using Base = detail::ValueImpl<OrtValue>;
- using OrtSparseValuesParam = detail::OrtSparseValuesParam;
- using Shape = detail::Shape;
-
- explicit Value(std::nullptr_t) {} ///< Create an empty Value object, must be assigned a valid one to be used
- explicit Value(OrtValue* p) : Base{p} {} ///< Used for interop with the C API
- Value(Value&&) = default;
- Value& operator=(Value&&) = default;
-
- ConstValue GetConst() const { return ConstValue{this->p_}; }
- UnownedValue GetUnowned() const { return UnownedValue{this->p_}; }
-
- /** \brief Creates a tensor with a user supplied buffer. Wraps OrtApi::CreateTensorWithDataAsOrtValue.
- * \tparam T The numeric datatype. This API is not suitable for strings.
- * \param info Memory description of where the p_data buffer resides (CPU vs GPU etc).
- * \param p_data Pointer to the data buffer.
- * \param p_data_element_count The number of elements in the data buffer.
- * \param shape Pointer to the tensor shape dimensions.
- * \param shape_len The number of tensor shape dimensions.
- */
- template <typename T>
- static Value CreateTensor(const OrtMemoryInfo* info, T* p_data, size_t p_data_element_count, const int64_t* shape, size_t shape_len);
-
- /** \brief Creates a tensor with a user supplied buffer. Wraps OrtApi::CreateTensorWithDataAsOrtValue.
- * \param info Memory description of where the p_data buffer resides (CPU vs GPU etc).
- * \param p_data Pointer to the data buffer.
- * \param p_data_byte_count The number of bytes in the data buffer.
- * \param shape Pointer to the tensor shape dimensions.
- * \param shape_len The number of tensor shape dimensions.
- * \param type The data type.
- */
- static Value CreateTensor(const OrtMemoryInfo* info, void* p_data, size_t p_data_byte_count, const int64_t* shape, size_t shape_len,
- ONNXTensorElementDataType type);
-
- /** \brief Creates a tensor using a supplied OrtAllocator. Wraps OrtApi::CreateTensorAsOrtValue.
- * \tparam T The numeric datatype. This API is not suitable for strings.
- * \param allocator The allocator to use.
- * \param shape Pointer to the tensor shape dimensions.
- * \param shape_len The number of tensor shape dimensions.
- */
- template <typename T>
- static Value CreateTensor(OrtAllocator* allocator, const int64_t* shape, size_t shape_len);
-
- /** \brief Creates a tensor using a supplied OrtAllocator. Wraps OrtApi::CreateTensorAsOrtValue.
- * \param allocator The allocator to use.
- * \param shape Pointer to the tensor shape dimensions.
- * \param shape_len The number of tensor shape dimensions.
- * \param type The data type.
- */
- static Value CreateTensor(OrtAllocator* allocator, const int64_t* shape, size_t shape_len, ONNXTensorElementDataType type);
-
- static Value CreateMap(Value& keys, Value& values); ///< Wraps OrtApi::CreateValue
- static Value CreateSequence(std::vector<Value>& values); ///< Wraps OrtApi::CreateValue
-
- template <typename T>
- static Value CreateOpaque(const char* domain, const char* type_name, const T&); ///< Wraps OrtApi::CreateOpaqueValue
-
-#if !defined(DISABLE_SPARSE_TENSORS)
- /// <summary>
- /// This is a simple forwarding method to the other overload that helps deducing
- /// data type enum value from the type of the buffer.
- /// </summary>
- /// <typeparam name="T">numeric datatype. This API is not suitable for strings.</typeparam>
- /// <param name="info">Memory description where the user buffers reside (CPU vs GPU etc)</param>
- /// <param name="p_data">pointer to the user supplied buffer, use nullptr for fully sparse tensors</param>
- /// <param name="dense_shape">a would be dense shape of the tensor</param>
- /// <param name="values_shape">non zero values shape. Use a single 0 shape for fully sparse tensors.</param>
- /// <returns></returns>
- template <typename T>
- static Value CreateSparseTensor(const OrtMemoryInfo* info, T* p_data, const Shape& dense_shape,
- const Shape& values_shape);
-
- /// <summary>
- /// Creates an OrtValue instance containing SparseTensor. This constructs
- /// a sparse tensor that makes use of user allocated buffers. It does not make copies
- /// of the user provided data and does not modify it. The lifespan of user provided buffers should
- /// eclipse the life span of the resulting OrtValue. This call constructs an instance that only contain
- /// a pointer to non-zero values. To fully populate the sparse tensor call Use<Format>Indices() API below
- /// to supply a sparse format specific indices.
- /// This API is not suitable for string data. Use CreateSparseTensor() with allocator specified so strings
- /// can be properly copied into the allocated buffer.
- /// </summary>
- /// <param name="info">Memory description where the user buffers reside (CPU vs GPU etc)</param>
- /// <param name="p_data">pointer to the user supplied buffer, use nullptr for fully sparse tensors</param>
- /// <param name="dense_shape">a would be dense shape of the tensor</param>
- /// <param name="values_shape">non zero values shape. Use a single 0 shape for fully sparse tensors.</param>
- /// <param name="type">data type</param>
- /// <returns>Ort::Value instance containing SparseTensor</returns>
- static Value CreateSparseTensor(const OrtMemoryInfo* info, void* p_data, const Shape& dense_shape,
- const Shape& values_shape, ONNXTensorElementDataType type);
-
- /// <summary>
- /// This is a simple forwarding method to the below CreateSparseTensor.
- /// This helps to specify data type enum in terms of C++ data type.
- /// Use CreateSparseTensor<T>
- /// </summary>
- /// <typeparam name="T">numeric data type only. String data enum must be specified explicitly.</typeparam>
- /// <param name="allocator">allocator to use</param>
- /// <param name="dense_shape">a would be dense shape of the tensor</param>
- /// <returns>Ort::Value</returns>
- template <typename T>
- static Value CreateSparseTensor(OrtAllocator* allocator, const Shape& dense_shape);
-
- /// <summary>
- /// Creates an instance of OrtValue containing sparse tensor. The created instance has no data.
- /// The data must be supplied by on of the FillSparseTensor<Format>() methods that take both non-zero values
- /// and indices. The data will be copied into a buffer that would be allocated using the supplied allocator.
- /// Use this API to create OrtValues that contain sparse tensors with all supported data types including
- /// strings.
- /// </summary>
- /// <param name="allocator">allocator to use. The allocator lifespan must eclipse that of the resulting OrtValue</param>
- /// <param name="dense_shape">a would be dense shape of the tensor</param>
- /// <param name="type">data type</param>
- /// <returns>an instance of Ort::Value</returns>
- static Value CreateSparseTensor(OrtAllocator* allocator, const Shape& dense_shape, ONNXTensorElementDataType type);
-
-#endif // !defined(DISABLE_SPARSE_TENSORS)
-};
-
-/// <summary>
-/// Represents native memory allocation coming from one of the
-/// OrtAllocators registered with OnnxRuntime.
-/// Use it to wrap an allocation made by an allocator
-/// so it can be automatically released when no longer needed.
-/// </summary>
-struct MemoryAllocation {
- MemoryAllocation(OrtAllocator* allocator, void* p, size_t size);
- ~MemoryAllocation();
- MemoryAllocation(const MemoryAllocation&) = delete;
- MemoryAllocation& operator=(const MemoryAllocation&) = delete;
- MemoryAllocation(MemoryAllocation&&) noexcept;
- MemoryAllocation& operator=(MemoryAllocation&&) noexcept;
-
- void* get() { return p_; }
- size_t size() const { return size_; }
-
- private:
- OrtAllocator* allocator_;
- void* p_;
- size_t size_;
-};
-
-namespace detail {
-template <typename T>
-struct AllocatorImpl : Base<T> {
- using B = Base<T>;
- using B::B;
-
- void* Alloc(size_t size);
- MemoryAllocation GetAllocation(size_t size);
- void Free(void* p);
- ConstMemoryInfo GetInfo() const;
-};
-
-} // namespace detail
-
-/** \brief Wrapper around ::OrtAllocator default instance that is owned by Onnxruntime
- *
- */
-struct AllocatorWithDefaultOptions : detail::AllocatorImpl<detail::Unowned<OrtAllocator>> {
- explicit AllocatorWithDefaultOptions(std::nullptr_t) {} ///< Convenience to create a class member and then replace with an instance
- AllocatorWithDefaultOptions();
-};
-
-/** \brief Wrapper around ::OrtAllocator
- *
- */
-struct Allocator : detail::AllocatorImpl<OrtAllocator> {
- explicit Allocator(std::nullptr_t) {} ///< Convenience to create a class member and then replace with an instance
- Allocator(const Session& session, const OrtMemoryInfo*);
-};
-
-using UnownedAllocator = detail::AllocatorImpl<detail::Unowned<OrtAllocator>>;
-
-namespace detail {
-namespace binding_utils {
-// Bring these out of template
-std::vector<std::string> GetOutputNamesHelper(const OrtIoBinding* binding, OrtAllocator*);
-std::vector<Value> GetOutputValuesHelper(const OrtIoBinding* binding, OrtAllocator*);
-} // namespace binding_utils
-
-template <typename T>
-struct ConstIoBindingImpl : Base<T> {
- using B = Base<T>;
- using B::B;
-
- std::vector<std::string> GetOutputNames() const;
- std::vector<std::string> GetOutputNames(OrtAllocator*) const;
- std::vector<Value> GetOutputValues() const;
- std::vector<Value> GetOutputValues(OrtAllocator*) const;
-};
-
-template <typename T>
-struct IoBindingImpl : ConstIoBindingImpl<T> {
- using B = ConstIoBindingImpl<T>;
- using B::B;
-
- void BindInput(const char* name, const Value&);
- void BindOutput(const char* name, const Value&);
- void BindOutput(const char* name, const OrtMemoryInfo*);
- void ClearBoundInputs();
- void ClearBoundOutputs();
- void SynchronizeInputs();
- void SynchronizeOutputs();
-};
-
-} // namespace detail
-
-using ConstIoBinding = detail::ConstIoBindingImpl<detail::Unowned<const OrtIoBinding>>;
-using UnownedIoBinding = detail::IoBindingImpl<detail::Unowned<OrtIoBinding>>;
-
-/** \brief Wrapper around ::OrtIoBinding
- *
- */
-struct IoBinding : detail::IoBindingImpl<OrtIoBinding> {
- explicit IoBinding(std::nullptr_t) {} ///< Create an empty object for convenience. Sometimes, we want to initialize members later.
- explicit IoBinding(Session& session);
- ConstIoBinding GetConst() const { return ConstIoBinding{this->p_}; }
- UnownedIoBinding GetUnowned() const { return UnownedIoBinding{this->p_}; }
-};
-
-/*! \struct Ort::ArenaCfg
- * \brief it is a structure that represents the configuration of an arena based allocator
- * \details Please see docs/C_API.md for details
- */
-struct ArenaCfg : detail::Base<OrtArenaCfg> {
- explicit ArenaCfg(std::nullptr_t) {} ///< Create an empty ArenaCfg object, must be assigned a valid one to be used
- /**
- * Wraps OrtApi::CreateArenaCfg
- * \param max_mem - use 0 to allow ORT to choose the default
- * \param arena_extend_strategy - use -1 to allow ORT to choose the default, 0 = kNextPowerOfTwo, 1 = kSameAsRequested
- * \param initial_chunk_size_bytes - use -1 to allow ORT to choose the default
- * \param max_dead_bytes_per_chunk - use -1 to allow ORT to choose the default
- * See docs/C_API.md for details on what the following parameters mean and how to choose these values
- */
- ArenaCfg(size_t max_mem, int arena_extend_strategy, int initial_chunk_size_bytes, int max_dead_bytes_per_chunk);
-};
-
-//
-// Custom OPs (only needed to implement custom OPs)
-//
-
-/// <summary>
-/// This struct provides life time management for custom op attribute
-/// </summary>
-struct OpAttr : detail::Base<OrtOpAttr> {
- OpAttr(const char* name, const void* data, int len, OrtOpAttrType type);
-};
-
-/// <summary>
-/// This class wraps a raw pointer OrtKernelContext* that is being passed
-/// to the custom kernel Compute() method. Use it to safely access context
-/// attributes, input and output parameters with exception safety guarantees.
-/// See usage example in onnxruntime/test/testdata/custom_op_library/custom_op_library.cc
-/// </summary>
-struct KernelContext {
- explicit KernelContext(OrtKernelContext* context);
- size_t GetInputCount() const;
- size_t GetOutputCount() const;
- ConstValue GetInput(size_t index) const;
- UnownedValue GetOutput(size_t index, const int64_t* dim_values, size_t dim_count) const;
- UnownedValue GetOutput(size_t index, const std::vector<int64_t>& dims) const;
- void* GetGPUComputeStream() const;
-
- private:
- OrtKernelContext* ctx_;
-};
-
-struct KernelInfo;
-
-namespace detail {
-namespace attr_utils {
-void GetAttr(const OrtKernelInfo* p, const char* name, float&);
-void GetAttr(const OrtKernelInfo* p, const char* name, int64_t&);
-void GetAttr(const OrtKernelInfo* p, const char* name, std::string&);
-void GetAttrs(const OrtKernelInfo* p, const char* name, std::vector<float>&);
-void GetAttrs(const OrtKernelInfo* p, const char* name, std::vector<int64_t>&);
-} // namespace attr_utils
-
-template <typename T>
-struct KernelInfoImpl : Base<T> {
- using B = Base<T>;
- using B::B;
-
- KernelInfo Copy() const;
-
- template <typename R> // R is only implemented for float, int64_t, and string
- R GetAttribute(const char* name) const {
- R val;
- attr_utils::GetAttr(this->p_, name, val);
- return val;
- }
-
- template <typename R> // R is only implemented for std::vector<float>, std::vector<int64_t>
- std::vector<R> GetAttributes(const char* name) const {
- std::vector<R> result;
- attr_utils::GetAttrs(this->p_, name, result);
- return result;
- }
-
- Value GetTensorAttribute(const char* name, OrtAllocator* allocator) const;
-
- size_t GetInputCount() const;
- size_t GetOutputCount() const;
-
- std::string GetInputName(size_t index) const;
- std::string GetOutputName(size_t index) const;
-
- TypeInfo GetInputTypeInfo(size_t index) const;
- TypeInfo GetOutputTypeInfo(size_t index) const;
-};
-
-} // namespace detail
-
-using ConstKernelInfo = detail::KernelInfoImpl<detail::Unowned<const OrtKernelInfo>>;
-
-/// <summary>
-/// This struct owns the OrtKernInfo* pointer when a copy is made.
-/// For convenient wrapping of OrtKernelInfo* passed to kernel constructor
-/// and query attributes, warp the pointer with Ort::Unowned<KernelInfo> instance
-/// so it does not destroy the pointer the kernel does not own.
-/// </summary>
-struct KernelInfo : detail::KernelInfoImpl<OrtKernelInfo> {
- explicit KernelInfo(std::nullptr_t) {} ///< Create an empty instance to initialize later
- explicit KernelInfo(OrtKernelInfo* info); ///< Take ownership of the instance
- ConstKernelInfo GetConst() const { return ConstKernelInfo{this->p_}; }
-};
-
-/// <summary>
-/// Create and own custom defined operation.
-/// </summary>
-struct Op : detail::Base<OrtOp> {
- explicit Op(std::nullptr_t) {} ///< Create an empty Operator object, must be assigned a valid one to be used
-
- explicit Op(OrtOp*); ///< Take ownership of the OrtOp
-
- static Op Create(const OrtKernelInfo* info, const char* op_name, const char* domain,
- int version, const char** type_constraint_names,
- const ONNXTensorElementDataType* type_constraint_values,
- size_t type_constraint_count,
- const OpAttr* attr_values,
- size_t attr_count,
- size_t input_count, size_t output_count);
-
- void Invoke(const OrtKernelContext* context,
- const Value* input_values,
- size_t input_count,
- Value* output_values,
- size_t output_count);
-
- // For easier refactoring
- void Invoke(const OrtKernelContext* context,
- const OrtValue* const* input_values,
- size_t input_count,
- OrtValue* const* output_values,
- size_t output_count);
-};
-
-/// <summary>
-/// This entire structure is deprecated, but we not marking
-/// it as a whole yet since we want to preserve for the next release.
-/// </summary>
-struct CustomOpApi {
- CustomOpApi(const OrtApi& api) : api_(api) {}
-
- /** \deprecated use Ort::Value::GetTensorTypeAndShape()
- * [[deprecated]]
- * This interface produces a pointer that must be released. Not exception safe.
- */
- [[deprecated("use Ort::Value::GetTensorTypeAndShape()")]] OrtTensorTypeAndShapeInfo* GetTensorTypeAndShape(_In_ const OrtValue* value);
-
- /** \deprecated use Ort::TensorTypeAndShapeInfo::GetElementCount()
- * [[deprecated]]
- * This interface is redundant.
- */
- [[deprecated("use Ort::TensorTypeAndShapeInfo::GetElementCount()")]] size_t GetTensorShapeElementCount(_In_ const OrtTensorTypeAndShapeInfo* info);
-
- /** \deprecated use Ort::TensorTypeAndShapeInfo::GetElementType()
- * [[deprecated]]
- * This interface is redundant.
- */
- [[deprecated("use Ort::TensorTypeAndShapeInfo::GetElementType()")]] ONNXTensorElementDataType GetTensorElementType(const OrtTensorTypeAndShapeInfo* info);
-
- /** \deprecated use Ort::TensorTypeAndShapeInfo::GetDimensionsCount()
- * [[deprecated]]
- * This interface is redundant.
- */
- [[deprecated("use Ort::TensorTypeAndShapeInfo::GetDimensionsCount()")]] size_t GetDimensionsCount(_In_ const OrtTensorTypeAndShapeInfo* info);
-
- /** \deprecated use Ort::TensorTypeAndShapeInfo::GetShape()
- * [[deprecated]]
- * This interface is redundant.
- */
- [[deprecated("use Ort::TensorTypeAndShapeInfo::GetShape()")]] void GetDimensions(_In_ const OrtTensorTypeAndShapeInfo* info, _Out_ int64_t* dim_values, size_t dim_values_length);
-
- /** \deprecated
- * [[deprecated]]
- * This interface sets dimensions to TensorTypeAndShapeInfo, but has no effect on the OrtValue.
- */
- [[deprecated("Do not use")]] void SetDimensions(OrtTensorTypeAndShapeInfo* info, _In_ const int64_t* dim_values, size_t dim_count);
-
- /** \deprecated use Ort::Value::GetTensorMutableData()
- * [[deprecated]]
- * This interface is redundant.
- */
- template <typename T>
- [[deprecated("use Ort::Value::GetTensorMutableData()")]] T* GetTensorMutableData(_Inout_ OrtValue* value);
-
- /** \deprecated use Ort::Value::GetTensorData()
- * [[deprecated]]
- * This interface is redundant.
- */
- template <typename T>
- [[deprecated("use Ort::Value::GetTensorData()")]] const T* GetTensorData(_Inout_ const OrtValue* value);
-
- /** \deprecated use Ort::Value::GetTensorMemoryInfo()
- * [[deprecated]]
- * This interface is redundant.
- */
- [[deprecated("use Ort::Value::GetTensorMemoryInfo()")]] const OrtMemoryInfo* GetTensorMemoryInfo(_In_ const OrtValue* value);
-
- /** \deprecated use Ort::TensorTypeAndShapeInfo::GetShape()
- * [[deprecated]]
- * This interface is redundant.
- */
- [[deprecated("use Ort::TensorTypeAndShapeInfo::GetShape()")]] std::vector<int64_t> GetTensorShape(const OrtTensorTypeAndShapeInfo* info);
-
- /** \deprecated use TensorTypeAndShapeInfo instances for automatic ownership.
- * [[deprecated]]
- * This interface is not exception safe.
- */
- [[deprecated("use TensorTypeAndShapeInfo")]] void ReleaseTensorTypeAndShapeInfo(OrtTensorTypeAndShapeInfo* input);
-
- /** \deprecated use Ort::KernelContext::GetInputCount
- * [[deprecated]]
- * This interface is redundant.
- */
- [[deprecated("use Ort::KernelContext::GetInputCount")]] size_t KernelContext_GetInputCount(const OrtKernelContext* context);
-
- /** \deprecated use Ort::KernelContext::GetInput
- * [[deprecated]]
- * This interface is redundant.
- */
- [[deprecated("use Ort::KernelContext::GetInput")]] const OrtValue* KernelContext_GetInput(const OrtKernelContext* context, _In_ size_t index);
-
- /** \deprecated use Ort::KernelContext::GetOutputCount
- * [[deprecated]]
- * This interface is redundant.
- */
- [[deprecated("use Ort::KernelContext::GetOutputCount")]] size_t KernelContext_GetOutputCount(const OrtKernelContext* context);
-
- /** \deprecated use Ort::KernelContext::GetOutput
- * [[deprecated]]
- * This interface is redundant.
- */
- [[deprecated("use Ort::KernelContext::GetOutput")]] OrtValue* KernelContext_GetOutput(OrtKernelContext* context, _In_ size_t index, _In_ const int64_t* dim_values, size_t dim_count);
-
- /** \deprecated use Ort::KernelContext::GetGPUComputeStream
- * [[deprecated]]
- * This interface is redundant.
- */
- [[deprecated("use Ort::KernelContext::GetGPUComputeStream")]] void* KernelContext_GetGPUComputeStream(const OrtKernelContext* context);
-
- /** \deprecated use Ort::ThrowOnError()
- * [[deprecated]]
- * This interface is redundant.
- */
- [[deprecated("use Ort::ThrowOnError()")]] void ThrowOnError(OrtStatus* result);
-
- /** \deprecated use Ort::OpAttr
- * [[deprecated]]
- * This interface is not exception safe.
- */
- [[deprecated("use Ort::OpAttr")]] OrtOpAttr* CreateOpAttr(_In_ const char* name,
- _In_ const void* data,
- _In_ int len,
- _In_ OrtOpAttrType type);
-
- /** \deprecated use Ort::OpAttr
- * [[deprecated]]
- * This interface is not exception safe.
- */
- [[deprecated("use Ort::OpAttr")]] void ReleaseOpAttr(_Frees_ptr_opt_ OrtOpAttr* op_attr);
-
- /** \deprecated use Ort::Op
- * [[deprecated]]
- * This interface is not exception safe.
- */
- [[deprecated("use Ort::Op")]] OrtOp* CreateOp(_In_ const OrtKernelInfo* info,
- _In_ const char* op_name,
- _In_ const char* domain,
- _In_ int version,
- _In_opt_ const char** type_constraint_names,
- _In_opt_ const ONNXTensorElementDataType* type_constraint_values,
- _In_opt_ int type_constraint_count,
- _In_opt_ const OrtOpAttr* const* attr_values,
- _In_opt_ int attr_count,
- _In_ int input_count,
- _In_ int output_count);
-
- /** \deprecated use Ort::Op::Invoke
- * [[deprecated]]
- * This interface is redundant
- */
- [[deprecated("use Ort::Op::Invoke")]] void InvokeOp(_In_ const OrtKernelContext* context,
- _In_ const OrtOp* ort_op,
- _In_ const OrtValue* const* input_values,
- _In_ int input_count,
- _Inout_ OrtValue* const* output_values,
- _In_ int output_count);
-
- /** \deprecated use Ort::Op for automatic lifespan management.
- * [[deprecated]]
- * This interface is not exception safe.
- */
- [[deprecated("use Ort::Op")]] void ReleaseOp(_Frees_ptr_opt_ OrtOp* ort_op);
-
- /** \deprecated use Ort::KernelInfo for automatic lifespan management or for
- * querying attributes
- * [[deprecated]]
- * This interface is redundant
- */
- template <typename T> // T is only implemented for std::vector<float>, std::vector<int64_t>, float, int64_t, and string
- [[deprecated("use Ort::KernelInfo::GetAttribute")]] T KernelInfoGetAttribute(_In_ const OrtKernelInfo* info, _In_ const char* name);
-
- /** \deprecated use Ort::KernelInfo::Copy
- * querying attributes
- * [[deprecated]]
- * This interface is not exception safe
- */
- [[deprecated("use Ort::KernelInfo::Copy")]] OrtKernelInfo* CopyKernelInfo(_In_ const OrtKernelInfo* info);
-
- /** \deprecated use Ort::KernelInfo for lifespan management
- * querying attributes
- * [[deprecated]]
- * This interface is not exception safe
- */
- [[deprecated("use Ort::KernelInfo")]] void ReleaseKernelInfo(_Frees_ptr_opt_ OrtKernelInfo* info_copy);
-
- private:
- const OrtApi& api_;
-};
-
-template <typename TOp, typename TKernel>
-struct CustomOpBase : OrtCustomOp {
- CustomOpBase() {
- OrtCustomOp::version = ORT_API_VERSION;
- OrtCustomOp::CreateKernel = [](const OrtCustomOp* this_, const OrtApi* api, const OrtKernelInfo* info) { return static_cast<const TOp*>(this_)->CreateKernel(*api, info); };
- OrtCustomOp::GetName = [](const OrtCustomOp* this_) { return static_cast<const TOp*>(this_)->GetName(); };
-
- OrtCustomOp::GetExecutionProviderType = [](const OrtCustomOp* this_) { return static_cast<const TOp*>(this_)->GetExecutionProviderType(); };
-
- OrtCustomOp::GetInputTypeCount = [](const OrtCustomOp* this_) { return static_cast<const TOp*>(this_)->GetInputTypeCount(); };
- OrtCustomOp::GetInputType = [](const OrtCustomOp* this_, size_t index) { return static_cast<const TOp*>(this_)->GetInputType(index); };
- OrtCustomOp::GetInputMemoryType = [](const OrtCustomOp* this_, size_t index) { return static_cast<const TOp*>(this_)->GetInputMemoryType(index); };
-
- OrtCustomOp::GetOutputTypeCount = [](const OrtCustomOp* this_) { return static_cast<const TOp*>(this_)->GetOutputTypeCount(); };
- OrtCustomOp::GetOutputType = [](const OrtCustomOp* this_, size_t index) { return static_cast<const TOp*>(this_)->GetOutputType(index); };
-
- OrtCustomOp::KernelCompute = [](void* op_kernel, OrtKernelContext* context) { static_cast<TKernel*>(op_kernel)->Compute(context); };
-#if defined(_MSC_VER) && !defined(__clang__)
-#pragma warning(push)
-#pragma warning(disable : 26409)
-#endif
- OrtCustomOp::KernelDestroy = [](void* op_kernel) { delete static_cast<TKernel*>(op_kernel); };
-#if defined(_MSC_VER) && !defined(__clang__)
-#pragma warning(pop)
-#endif
- OrtCustomOp::GetInputCharacteristic = [](const OrtCustomOp* this_, size_t index) { return static_cast<const TOp*>(this_)->GetInputCharacteristic(index); };
- OrtCustomOp::GetOutputCharacteristic = [](const OrtCustomOp* this_, size_t index) { return static_cast<const TOp*>(this_)->GetOutputCharacteristic(index); };
-
- OrtCustomOp::GetVariadicInputMinArity = [](const OrtCustomOp* this_) { return static_cast<const TOp*>(this_)->GetVariadicInputMinArity(); };
- OrtCustomOp::GetVariadicInputHomogeneity = [](const OrtCustomOp* this_) { return static_cast<int>(static_cast<const TOp*>(this_)->GetVariadicInputHomogeneity()); };
- OrtCustomOp::GetVariadicOutputMinArity = [](const OrtCustomOp* this_) { return static_cast<const TOp*>(this_)->GetVariadicOutputMinArity(); };
- OrtCustomOp::GetVariadicOutputHomogeneity = [](const OrtCustomOp* this_) { return static_cast<int>(static_cast<const TOp*>(this_)->GetVariadicOutputHomogeneity()); };
- }
-
- // Default implementation of GetExecutionProviderType that returns nullptr to default to the CPU provider
- const char* GetExecutionProviderType() const { return nullptr; }
-
- // Default implementations of GetInputCharacteristic() and GetOutputCharacteristic() below
- // (inputs and outputs are required by default)
- OrtCustomOpInputOutputCharacteristic GetInputCharacteristic(size_t /*index*/) const {
- return OrtCustomOpInputOutputCharacteristic::INPUT_OUTPUT_REQUIRED;
- }
-
- OrtCustomOpInputOutputCharacteristic GetOutputCharacteristic(size_t /*index*/) const {
- return OrtCustomOpInputOutputCharacteristic::INPUT_OUTPUT_REQUIRED;
- }
-
- // Default implemention of GetInputMemoryType() that returns OrtMemTypeDefault
- OrtMemType GetInputMemoryType(size_t /*index*/) const {
- return OrtMemTypeDefault;
- }
-
- // Default implementation of GetVariadicInputMinArity() returns 1 to specify that a variadic input
- // should expect at least 1 argument.
- int GetVariadicInputMinArity() const {
- return 1;
- }
-
- // Default implementation of GetVariadicInputHomegeneity() returns true to specify that all arguments
- // to a variadic input should be of the same type.
- bool GetVariadicInputHomogeneity() const {
- return true;
- }
-
- // Default implementation of GetVariadicOutputMinArity() returns 1 to specify that a variadic output
- // should produce at least 1 output value.
- int GetVariadicOutputMinArity() const {
- return 1;
- }
-
- // Default implementation of GetVariadicOutputHomegeneity() returns true to specify that all output values
- // produced by a variadic output should be of the same type.
- bool GetVariadicOutputHomogeneity() const {
- return true;
- }
-
- // Declare list of session config entries used by this Custom Op.
- // Implement this function in order to get configs from CustomOpBase::GetSessionConfigs().
- // This default implementation returns an empty vector of config entries.
- std::vector<std::string> GetSessionConfigKeys() const {
- return std::vector<std::string>{};
- }
-
- protected:
- // Helper function that returns a map of session config entries specified by CustomOpBase::GetSessionConfigKeys.
- void GetSessionConfigs(std::unordered_map<std::string, std::string>& out, ConstSessionOptions options) const;
-};
-
-} // namespace Ort
-
-#include "onnxruntime_cxx_inline.h"
diff --git a/funasr/runtime/onnxruntime/win/include/onnxruntime_cxx_inline.h b/funasr/runtime/onnxruntime/win/include/onnxruntime_cxx_inline.h
deleted file mode 100644
index 6d391ad..0000000
--- a/funasr/runtime/onnxruntime/win/include/onnxruntime_cxx_inline.h
+++ /dev/null
@@ -1,1874 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-// Do not include this file directly. Please include "onnxruntime_cxx_api.h" instead.
-// If interested in trying out features of the new experimental C++ API, include "experimental_onnxruntime_cxx_api.h" instead.
-//
-// These are the inline implementations of the C++ header APIs. They're in this separate file as to not clutter
-// the main C++ file with implementation details.
-
-namespace Ort {
-
-namespace detail {
-inline void ThrowStatus(const Status& st) {
- std::string error_message = st.GetErrorMessage();
- OrtErrorCode error_code = st.GetErrorCode();
- ORT_CXX_API_THROW(std::move(error_message), error_code);
-}
-} // namespace detail
-
-inline void ThrowOnError(OrtStatus* ort_status) {
- if (ort_status) {
- Ort::Status st(ort_status);
- detail::ThrowStatus(st);
- }
-}
-
-inline void ThrowOnError(const Status& st) {
- if (st) {
- detail::ThrowStatus(st);
- }
-}
-
-inline Status::Status(OrtStatus* status) : Base<OrtStatus>{status} {
-}
-
-inline Status::Status(const std::exception& e) {
- p_ = GetApi().CreateStatus(ORT_FAIL, e.what());
-}
-
-inline Status::Status(const Exception& e) {
- p_ = GetApi().CreateStatus(e.GetOrtErrorCode(), e.what());
-}
-
-inline std::string Status::GetErrorMessage() const {
- std::string message(GetApi().GetErrorMessage(p_));
- return message;
-}
-
-inline OrtErrorCode Status::GetErrorCode() const {
- return GetApi().GetErrorCode(p_);
-}
-
-// This template converts a C++ type into it's ONNXTensorElementDataType
-template <typename T>
-struct TypeToTensorType;
-template <>
-struct TypeToTensorType<float> {
- static constexpr ONNXTensorElementDataType type = ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT;
-};
-template <>
-struct TypeToTensorType<Float16_t> {
- static constexpr ONNXTensorElementDataType type = ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT16;
-};
-template <>
-struct TypeToTensorType<BFloat16_t> {
- static constexpr ONNXTensorElementDataType type = ONNX_TENSOR_ELEMENT_DATA_TYPE_BFLOAT16;
-};
-template <>
-struct TypeToTensorType<double> {
- static constexpr ONNXTensorElementDataType type = ONNX_TENSOR_ELEMENT_DATA_TYPE_DOUBLE;
-};
-template <>
-struct TypeToTensorType<int8_t> {
- static constexpr ONNXTensorElementDataType type = ONNX_TENSOR_ELEMENT_DATA_TYPE_INT8;
-};
-template <>
-struct TypeToTensorType<int16_t> {
- static constexpr ONNXTensorElementDataType type = ONNX_TENSOR_ELEMENT_DATA_TYPE_INT16;
-};
-template <>
-struct TypeToTensorType<int32_t> {
- static constexpr ONNXTensorElementDataType type = ONNX_TENSOR_ELEMENT_DATA_TYPE_INT32;
-};
-template <>
-struct TypeToTensorType<int64_t> {
- static constexpr ONNXTensorElementDataType type = ONNX_TENSOR_ELEMENT_DATA_TYPE_INT64;
-};
-template <>
-struct TypeToTensorType<uint8_t> {
- static constexpr ONNXTensorElementDataType type = ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT8;
-};
-template <>
-struct TypeToTensorType<uint16_t> {
- static constexpr ONNXTensorElementDataType type = ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT16;
-};
-template <>
-struct TypeToTensorType<uint32_t> {
- static constexpr ONNXTensorElementDataType type = ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT32;
-};
-template <>
-struct TypeToTensorType<uint64_t> {
- static constexpr ONNXTensorElementDataType type = ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT64;
-};
-template <>
-struct TypeToTensorType<bool> {
- static constexpr ONNXTensorElementDataType type = ONNX_TENSOR_ELEMENT_DATA_TYPE_BOOL;
-};
-
-inline MemoryAllocation::MemoryAllocation(OrtAllocator* allocator, void* p, size_t size)
- : allocator_(allocator), p_(p), size_(size) {
-}
-
-inline MemoryAllocation::~MemoryAllocation() {
- if (p_ != nullptr) {
- // We do not throw out of destructor
- auto ret = GetApi().AllocatorFree(allocator_, p_);
- static_cast<void>(ret);
- }
-}
-
-inline MemoryAllocation::MemoryAllocation(MemoryAllocation&& o) noexcept : allocator_(nullptr), p_(nullptr), size_(0) {
- *this = std::move(o);
-}
-
-inline MemoryAllocation& MemoryAllocation::operator=(MemoryAllocation&& o) noexcept {
- OrtAllocator* alloc = nullptr;
- void* p = nullptr;
- size_t sz = 0;
-
- // Swap out this
- std::swap(alloc, allocator_);
- std::swap(p, p_);
- std::swap(sz, size_);
-
- // Swap with incoming
- std::swap(allocator_, o.allocator_);
- std::swap(p_, o.p_);
- std::swap(size_, o.size_);
-
- // Destroy this instance if needed
- MemoryAllocation this_alloc(alloc, p, sz);
- return *this;
-}
-
-namespace detail {
-
-template <typename T>
-inline void* AllocatorImpl<T>::Alloc(size_t size) {
- void* out;
- ThrowOnError(GetApi().AllocatorAlloc(this->p_, size, &out));
- return out;
-}
-
-template <typename T>
-inline MemoryAllocation AllocatorImpl<T>::GetAllocation(size_t size) {
- void* out;
- ThrowOnError(GetApi().AllocatorAlloc(this->p_, size, &out));
- MemoryAllocation result(this->p_, out, size);
- return result;
-}
-
-template <typename T>
-inline void AllocatorImpl<T>::Free(void* p) {
- ThrowOnError(GetApi().AllocatorFree(this->p_, p));
-}
-
-template <typename T>
-inline ConstMemoryInfo AllocatorImpl<T>::GetInfo() const {
- const OrtMemoryInfo* out;
- ThrowOnError(GetApi().AllocatorGetInfo(this->p_, &out));
- return ConstMemoryInfo{out};
-}
-
-} // namespace detail
-
-inline AllocatorWithDefaultOptions::AllocatorWithDefaultOptions() {
- ThrowOnError(GetApi().GetAllocatorWithDefaultOptions(&this->p_));
-}
-
-inline Allocator::Allocator(const Session& sess, const OrtMemoryInfo* mem_info) {
- ThrowOnError(GetApi().CreateAllocator(sess, mem_info, &this->p_));
-}
-
-namespace detail {
-
-template <typename T>
-inline std::string MemoryInfoImpl<T>::GetAllocatorName() const {
- const char* name = nullptr;
- ThrowOnError(GetApi().MemoryInfoGetName(this->p_, &name));
- return std::string(name);
-}
-
-template <typename T>
-inline OrtAllocatorType MemoryInfoImpl<T>::GetAllocatorType() const {
- OrtAllocatorType type;
- ThrowOnError(GetApi().MemoryInfoGetType(this->p_, &type));
- return type;
-}
-
-template <typename T>
-inline int MemoryInfoImpl<T>::GetDeviceId() const {
- int id = 0;
- ThrowOnError(GetApi().MemoryInfoGetId(this->p_, &id));
- return id;
-}
-
-template <typename T>
-inline OrtMemoryInfoDeviceType MemoryInfoImpl<T>::GetDeviceType() const {
- OrtMemoryInfoDeviceType type;
- GetApi().MemoryInfoGetDeviceType(this->p_, &type);
- return type;
-}
-
-template <typename T>
-inline OrtMemType MemoryInfoImpl<T>::GetMemoryType() const {
- OrtMemType type;
- ThrowOnError(GetApi().MemoryInfoGetMemType(this->p_, &type));
- return type;
-}
-
-template <typename T>
-template <typename U>
-inline bool MemoryInfoImpl<T>::operator==(const MemoryInfoImpl<U>& o) const {
- int comp_result = 0;
- ThrowOnError(Ort::GetApi().CompareMemoryInfo(this->p_, o, &comp_result));
- return comp_result == 0;
-}
-
-} // namespace detail
-
-inline MemoryInfo MemoryInfo::CreateCpu(OrtAllocatorType type, OrtMemType mem_type) {
- OrtMemoryInfo* p;
- ThrowOnError(GetApi().CreateCpuMemoryInfo(type, mem_type, &p));
- return MemoryInfo(p);
-}
-
-inline MemoryInfo::MemoryInfo(const char* name, OrtAllocatorType type, int id, OrtMemType mem_type) {
- ThrowOnError(GetApi().CreateMemoryInfo(name, type, id, mem_type, &this->p_));
-}
-
-namespace detail {
-template <typename T>
-inline std::vector<std::string> ConstIoBindingImpl<T>::GetOutputNames() const {
- AllocatorWithDefaultOptions allocator;
- return binding_utils::GetOutputNamesHelper(this->p_, allocator);
-}
-
-template <typename T>
-inline std::vector<std::string> ConstIoBindingImpl<T>::GetOutputNames(OrtAllocator* allocator) const {
- return binding_utils::GetOutputNamesHelper(this->p_, allocator);
-}
-
-template <typename T>
-inline std::vector<Value> ConstIoBindingImpl<T>::GetOutputValues() const {
- AllocatorWithDefaultOptions allocator;
- return binding_utils::GetOutputValuesHelper(this->p_, allocator);
-}
-
-template <typename T>
-inline std::vector<Value> ConstIoBindingImpl<T>::GetOutputValues(OrtAllocator* allocator) const {
- return binding_utils::GetOutputValuesHelper(this->p_, allocator);
-}
-
-template <typename T>
-inline void IoBindingImpl<T>::BindInput(const char* name, const Value& value) {
- ThrowOnError(GetApi().BindInput(this->p_, name, value));
-}
-
-template <typename T>
-inline void IoBindingImpl<T>::BindOutput(const char* name, const Value& value) {
- ThrowOnError(GetApi().BindOutput(this->p_, name, value));
-}
-
-template <typename T>
-inline void IoBindingImpl<T>::BindOutput(const char* name, const OrtMemoryInfo* mem_info) {
- ThrowOnError(GetApi().BindOutputToDevice(this->p_, name, mem_info));
-}
-
-template <typename T>
-inline void IoBindingImpl<T>::ClearBoundInputs() {
- GetApi().ClearBoundInputs(this->p_);
-}
-
-template <typename T>
-inline void IoBindingImpl<T>::ClearBoundOutputs() {
- GetApi().ClearBoundOutputs(this->p_);
-}
-
-template <typename T>
-inline void IoBindingImpl<T>::SynchronizeInputs() {
- ThrowOnError(GetApi().SynchronizeBoundInputs(this->p_));
-}
-
-template <typename T>
-inline void IoBindingImpl<T>::SynchronizeOutputs() {
- ThrowOnError(GetApi().SynchronizeBoundOutputs(this->p_));
-}
-
-namespace binding_utils {
-inline std::vector<std::string> GetOutputNamesHelper(const OrtIoBinding* binding, OrtAllocator* allocator) {
- std::vector<std::string> result;
- auto free_fn = detail::AllocatedFree(allocator);
- using Ptr = std::unique_ptr<void, decltype(free_fn)>;
-
- char* buffer = nullptr;
- size_t* lengths = nullptr;
- size_t count = 0;
- ThrowOnError(GetApi().GetBoundOutputNames(binding, allocator, &buffer, &lengths, &count));
-
- if (count == 0) {
- return result;
- }
-
- Ptr buffer_g(buffer, free_fn);
- Ptr lengths_g(lengths, free_fn);
-
- result.reserve(count);
- for (size_t i = 0; i < count; ++i) {
- auto sz = *lengths;
- result.emplace_back(buffer, sz);
- buffer += sz;
- ++lengths;
- }
- return result;
-}
-
-inline std::vector<Value> GetOutputValuesHelper(const OrtIoBinding* binding, OrtAllocator* allocator) {
- std::vector<Value> result;
- size_t owned = 0;
- size_t output_count = 0;
- // Lambda to release the buffer when no longer needed and
- // make sure that we destroy all instances on exception
- auto free_fn = [&owned, &output_count, allocator](OrtValue** buffer) {
- if (buffer) {
- while (owned < output_count) {
- auto* p = buffer + owned++;
- GetApi().ReleaseValue(*p);
- }
- allocator->Free(allocator, buffer);
- }
- };
- using Ptr = std::unique_ptr<OrtValue*, decltype(free_fn)>;
-
- OrtValue** output_buffer = nullptr;
- ThrowOnError(GetApi().GetBoundOutputValues(binding, allocator, &output_buffer, &output_count));
- if (output_count == 0) {
- return result;
- }
-
- Ptr buffer_g(output_buffer, free_fn);
-
- result.reserve(output_count);
- for (size_t i = 0; i < output_count; ++i) {
- result.emplace_back(output_buffer[i]);
- ++owned;
- }
- return result;
-}
-
-} // namespace binding_utils
-} // namespace detail
-
-inline IoBinding::IoBinding(Session& session) {
- ThrowOnError(GetApi().CreateIoBinding(session, &this->p_));
-}
-
-inline ArenaCfg::ArenaCfg(size_t max_mem, int arena_extend_strategy, int initial_chunk_size_bytes, int max_dead_bytes_per_chunk) {
- ThrowOnError(GetApi().CreateArenaCfg(max_mem, arena_extend_strategy, initial_chunk_size_bytes, max_dead_bytes_per_chunk, &p_));
-}
-
-inline ThreadingOptions::ThreadingOptions() {
- ThrowOnError(GetApi().CreateThreadingOptions(&p_));
-}
-
-inline ThreadingOptions& ThreadingOptions::SetGlobalIntraOpNumThreads(int intra_op_num_threads) {
- ThrowOnError(GetApi().SetGlobalIntraOpNumThreads(p_, intra_op_num_threads));
- return *this;
-}
-
-inline ThreadingOptions& ThreadingOptions::SetGlobalInterOpNumThreads(int inter_op_num_threads) {
- ThrowOnError(GetApi().SetGlobalInterOpNumThreads(p_, inter_op_num_threads));
- return *this;
-}
-
-inline ThreadingOptions& ThreadingOptions::SetGlobalSpinControl(int allow_spinning) {
- ThrowOnError(GetApi().SetGlobalSpinControl(p_, allow_spinning));
- return *this;
-}
-
-inline ThreadingOptions& ThreadingOptions::SetGlobalDenormalAsZero() {
- ThrowOnError(GetApi().SetGlobalDenormalAsZero(p_));
- return *this;
-}
-
-inline ThreadingOptions& ThreadingOptions::SetGlobalCustomCreateThreadFn(OrtCustomCreateThreadFn ort_custom_create_thread_fn) {
- ThrowOnError(GetApi().SetGlobalCustomCreateThreadFn(p_, ort_custom_create_thread_fn));
- return *this;
-}
-
-inline ThreadingOptions& ThreadingOptions::SetGlobalCustomThreadCreationOptions(void* ort_custom_thread_creation_options) {
- ThrowOnError(GetApi().SetGlobalCustomThreadCreationOptions(p_, ort_custom_thread_creation_options));
- return *this;
-}
-
-inline ThreadingOptions& ThreadingOptions::SetGlobalCustomJoinThreadFn(OrtCustomJoinThreadFn ort_custom_join_thread_fn) {
- ThrowOnError(GetApi().SetGlobalCustomJoinThreadFn(p_, ort_custom_join_thread_fn));
- return *this;
-}
-
-inline Env::Env(OrtLoggingLevel logging_level, _In_ const char* logid) {
- ThrowOnError(GetApi().CreateEnv(logging_level, logid, &p_));
- if (strcmp(logid, "onnxruntime-node") == 0) {
- ThrowOnError(GetApi().SetLanguageProjection(p_, OrtLanguageProjection::ORT_PROJECTION_NODEJS));
- } else {
- ThrowOnError(GetApi().SetLanguageProjection(p_, OrtLanguageProjection::ORT_PROJECTION_CPLUSPLUS));
- }
-}
-
-inline Env::Env(OrtLoggingLevel logging_level, const char* logid, OrtLoggingFunction logging_function, void* logger_param) {
- ThrowOnError(GetApi().CreateEnvWithCustomLogger(logging_function, logger_param, logging_level, logid, &p_));
- if (strcmp(logid, "onnxruntime-node") == 0) {
- ThrowOnError(GetApi().SetLanguageProjection(p_, OrtLanguageProjection::ORT_PROJECTION_NODEJS));
- } else {
- ThrowOnError(GetApi().SetLanguageProjection(p_, OrtLanguageProjection::ORT_PROJECTION_CPLUSPLUS));
- }
-}
-
-inline Env::Env(const OrtThreadingOptions* tp_options, OrtLoggingLevel logging_level, _In_ const char* logid) {
- ThrowOnError(GetApi().CreateEnvWithGlobalThreadPools(logging_level, logid, tp_options, &p_));
- if (strcmp(logid, "onnxruntime-node") == 0) {
- ThrowOnError(GetApi().SetLanguageProjection(p_, OrtLanguageProjection::ORT_PROJECTION_NODEJS));
- } else {
- ThrowOnError(GetApi().SetLanguageProjection(p_, OrtLanguageProjection::ORT_PROJECTION_CPLUSPLUS));
- }
-}
-
-inline Env::Env(const OrtThreadingOptions* tp_options, OrtLoggingFunction logging_function, void* logger_param,
- OrtLoggingLevel logging_level, _In_ const char* logid) {
- ThrowOnError(GetApi().CreateEnvWithCustomLoggerAndGlobalThreadPools(logging_function, logger_param, logging_level, logid, tp_options, &p_));
- if (strcmp(logid, "onnxruntime-node") == 0) {
- ThrowOnError(GetApi().SetLanguageProjection(p_, OrtLanguageProjection::ORT_PROJECTION_NODEJS));
- } else {
- ThrowOnError(GetApi().SetLanguageProjection(p_, OrtLanguageProjection::ORT_PROJECTION_CPLUSPLUS));
- }
-}
-
-inline Env& Env::EnableTelemetryEvents() {
- ThrowOnError(GetApi().EnableTelemetryEvents(p_));
- return *this;
-}
-
-inline Env& Env::DisableTelemetryEvents() {
- ThrowOnError(GetApi().DisableTelemetryEvents(p_));
- return *this;
-}
-
-inline Env& Env::UpdateEnvWithCustomLogLevel(OrtLoggingLevel log_severity_level) {
- ThrowOnError(GetApi().UpdateEnvWithCustomLogLevel(p_, log_severity_level));
- return *this;
-}
-
-inline Env& Env::CreateAndRegisterAllocator(const OrtMemoryInfo* mem_info, const OrtArenaCfg* arena_cfg) {
- ThrowOnError(GetApi().CreateAndRegisterAllocator(p_, mem_info, arena_cfg));
- return *this;
-}
-
-inline CustomOpDomain::CustomOpDomain(const char* domain) {
- ThrowOnError(GetApi().CreateCustomOpDomain(domain, &p_));
-}
-
-inline void CustomOpDomain::Add(const OrtCustomOp* op) {
- ThrowOnError(GetApi().CustomOpDomain_Add(p_, op));
-}
-
-inline RunOptions::RunOptions() {
- ThrowOnError(GetApi().CreateRunOptions(&p_));
-}
-
-inline RunOptions& RunOptions::SetRunLogVerbosityLevel(int level) {
- ThrowOnError(GetApi().RunOptionsSetRunLogVerbosityLevel(p_, level));
- return *this;
-}
-
-inline RunOptions& RunOptions::SetRunLogSeverityLevel(int level) {
- ThrowOnError(GetApi().RunOptionsSetRunLogSeverityLevel(p_, level));
- return *this;
-}
-
-inline int RunOptions::GetRunLogVerbosityLevel() const {
- int out;
- ThrowOnError(GetApi().RunOptionsGetRunLogVerbosityLevel(p_, &out));
- return out;
-}
-
-inline int RunOptions::GetRunLogSeverityLevel() const {
- int out;
- ThrowOnError(GetApi().RunOptionsGetRunLogSeverityLevel(p_, &out));
- return out;
-}
-
-inline RunOptions& RunOptions::SetRunTag(const char* run_tag) {
- ThrowOnError(GetApi().RunOptionsSetRunTag(p_, run_tag));
- return *this;
-}
-
-inline const char* RunOptions::GetRunTag() const {
- const char* out;
- ThrowOnError(GetApi().RunOptionsGetRunTag(p_, &out));
- return out;
-}
-
-inline RunOptions& RunOptions::AddConfigEntry(const char* config_key, const char* config_value) {
- ThrowOnError(GetApi().AddRunConfigEntry(p_, config_key, config_value));
- return *this;
-}
-
-inline RunOptions& RunOptions::SetTerminate() {
- ThrowOnError(GetApi().RunOptionsSetTerminate(p_));
- return *this;
-}
-
-inline RunOptions& RunOptions::UnsetTerminate() {
- ThrowOnError(GetApi().RunOptionsUnsetTerminate(p_));
- return *this;
-}
-
-namespace detail {
-
-template <typename T>
-inline Ort::SessionOptions ConstSessionOptionsImpl<T>::Clone() const {
- OrtSessionOptions* out;
- ThrowOnError(GetApi().CloneSessionOptions(this->p_, &out));
- return SessionOptions{out};
-}
-
-template <typename T>
-inline std::string ConstSessionOptionsImpl<T>::GetConfigEntry(const char* config_key) const {
- size_t size = 0;
- // Feed nullptr for the data buffer to query the true size of the string value
- Ort::ThrowOnError(GetApi().GetSessionConfigEntry(this->p_, config_key, nullptr, &size));
-
- std::string out;
- out.resize(size);
- Ort::ThrowOnError(GetApi().GetSessionConfigEntry(this->p_, config_key, &out[0], &size));
- out.resize(size - 1); // remove the terminating character '\0'
-
- return out;
-}
-
-template <typename T>
-inline bool ConstSessionOptionsImpl<T>::HasConfigEntry(const char* config_key) const {
- int out = 0;
- Ort::ThrowOnError(GetApi().HasSessionConfigEntry(this->p_, config_key, &out));
- return static_cast<bool>(out);
-}
-
-template <typename T>
-inline std::string ConstSessionOptionsImpl<T>::GetConfigEntryOrDefault(const char* config_key, const std::string& def) {
- if (!this->HasConfigEntry(config_key)) {
- return def;
- }
-
- return this->GetConfigEntry(config_key);
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::SetIntraOpNumThreads(int intra_op_num_threads) {
- ThrowOnError(GetApi().SetIntraOpNumThreads(this->p_, intra_op_num_threads));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::SetInterOpNumThreads(int inter_op_num_threads) {
- ThrowOnError(GetApi().SetInterOpNumThreads(this->p_, inter_op_num_threads));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::SetGraphOptimizationLevel(GraphOptimizationLevel graph_optimization_level) {
- ThrowOnError(GetApi().SetSessionGraphOptimizationLevel(this->p_, graph_optimization_level));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::SetOptimizedModelFilePath(const ORTCHAR_T* optimized_model_filepath) {
- ThrowOnError(GetApi().SetOptimizedModelFilePath(this->p_, optimized_model_filepath));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::EnableProfiling(const ORTCHAR_T* profile_file_prefix) {
- ThrowOnError(GetApi().EnableProfiling(this->p_, profile_file_prefix));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::DisableProfiling() {
- ThrowOnError(GetApi().DisableProfiling(this->p_));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::EnableOrtCustomOps() {
- ThrowOnError(GetApi().EnableOrtCustomOps(this->p_));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::EnableMemPattern() {
- ThrowOnError(GetApi().EnableMemPattern(this->p_));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::DisableMemPattern() {
- ThrowOnError(GetApi().DisableMemPattern(this->p_));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::EnableCpuMemArena() {
- ThrowOnError(GetApi().EnableCpuMemArena(this->p_));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::DisableCpuMemArena() {
- ThrowOnError(GetApi().DisableCpuMemArena(this->p_));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::SetExecutionMode(ExecutionMode execution_mode) {
- ThrowOnError(GetApi().SetSessionExecutionMode(this->p_, execution_mode));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::SetLogId(const char* logid) {
- ThrowOnError(GetApi().SetSessionLogId(this->p_, logid));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::SetLogSeverityLevel(int level) {
- ThrowOnError(GetApi().SetSessionLogSeverityLevel(this->p_, level));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::Add(OrtCustomOpDomain* custom_op_domain) {
- ThrowOnError(GetApi().AddCustomOpDomain(this->p_, custom_op_domain));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::AddConfigEntry(const char* config_key, const char* config_value) {
- ThrowOnError(GetApi().AddSessionConfigEntry(this->p_, config_key, config_value));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::AddInitializer(const char* name, const OrtValue* ort_val) {
- ThrowOnError(GetApi().AddInitializer(this->p_, name, ort_val));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::DisablePerSessionThreads() {
- ThrowOnError(GetApi().DisablePerSessionThreads(this->p_));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::AddExternalInitializers(const std::vector<std::string>& names,
- const std::vector<Value>& ort_values) {
- const size_t inputs_num = names.size();
- if (inputs_num != ort_values.size()) {
- ORT_CXX_API_THROW("Expecting names and ort_values to have the same length", ORT_INVALID_ARGUMENT);
- }
- std::vector<const char*> names_ptr;
- std::vector<const OrtValue*> ort_values_ptrs;
- names_ptr.reserve(inputs_num);
- ort_values_ptrs.reserve(inputs_num);
- for (size_t i = 0; i < inputs_num; ++i) {
- names_ptr.push_back(names[i].c_str());
- ort_values_ptrs.push_back(ort_values[i]);
- }
- ThrowOnError(GetApi().AddExternalInitializers(this->p_, names_ptr.data(), ort_values_ptrs.data(), inputs_num));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::AppendExecutionProvider_CUDA(const OrtCUDAProviderOptions& provider_options) {
- ThrowOnError(GetApi().SessionOptionsAppendExecutionProvider_CUDA(this->p_, &provider_options));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::AppendExecutionProvider_CUDA_V2(const OrtCUDAProviderOptionsV2& provider_options) {
- ThrowOnError(GetApi().SessionOptionsAppendExecutionProvider_CUDA_V2(this->p_, &provider_options));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::AppendExecutionProvider_ROCM(const OrtROCMProviderOptions& provider_options) {
- ThrowOnError(GetApi().SessionOptionsAppendExecutionProvider_ROCM(this->p_, &provider_options));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::AppendExecutionProvider_TensorRT(const OrtTensorRTProviderOptions& provider_options) {
- ThrowOnError(GetApi().SessionOptionsAppendExecutionProvider_TensorRT(this->p_, &provider_options));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::AppendExecutionProvider_TensorRT_V2(const OrtTensorRTProviderOptionsV2& provider_options) {
- ThrowOnError(GetApi().SessionOptionsAppendExecutionProvider_TensorRT_V2(this->p_, &provider_options));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::AppendExecutionProvider_MIGraphX(const OrtMIGraphXProviderOptions& provider_options) {
- ThrowOnError(GetApi().SessionOptionsAppendExecutionProvider_MIGraphX(this->p_, &provider_options));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::AppendExecutionProvider_CANN(const OrtCANNProviderOptions& provider_options) {
- ThrowOnError(GetApi().SessionOptionsAppendExecutionProvider_CANN(this->p_, &provider_options));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::AppendExecutionProvider(
- const std::string& provider_name,
- const std::unordered_map<std::string, std::string>& provider_options) {
- auto num_entries = provider_options.size();
- std::vector<const char*> keys, values;
- if (num_entries > 0) {
- keys.reserve(num_entries);
- values.reserve(num_entries);
-
- for (const auto& entry : provider_options) {
- keys.push_back(entry.first.c_str());
- values.push_back(entry.second.c_str());
- }
- }
-
- ThrowOnError(GetApi().SessionOptionsAppendExecutionProvider(this->p_, provider_name.c_str(),
- keys.data(), values.data(), num_entries));
-
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::SetCustomCreateThreadFn(OrtCustomCreateThreadFn ort_custom_create_thread_fn) {
- ThrowOnError(GetApi().SessionOptionsSetCustomCreateThreadFn(this->p_, ort_custom_create_thread_fn));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::SetCustomThreadCreationOptions(void* ort_custom_thread_creation_options) {
- ThrowOnError(GetApi().SessionOptionsSetCustomThreadCreationOptions(this->p_, ort_custom_thread_creation_options));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::SetCustomJoinThreadFn(OrtCustomJoinThreadFn ort_custom_join_thread_fn) {
- ThrowOnError(GetApi().SessionOptionsSetCustomJoinThreadFn(this->p_, ort_custom_join_thread_fn));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::AppendExecutionProvider_OpenVINO(const OrtOpenVINOProviderOptions& provider_options) {
- ThrowOnError(GetApi().SessionOptionsAppendExecutionProvider_OpenVINO(this->p_, &provider_options));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::RegisterCustomOpsLibrary(const ORTCHAR_T* library_name,
- const CustomOpConfigs& custom_op_configs) {
- // Add custom op config entries before registering the custom op library. Otherwise, the config entries _may_ be ignored by
- // the custom op library.
- for (const auto& config_iter : custom_op_configs.GetFlattenedConfigs()) {
- AddConfigEntry(config_iter.first.c_str(), config_iter.second.c_str());
- }
-
- ThrowOnError(GetApi().RegisterCustomOpsLibrary_V2(this->p_, library_name));
- return *this;
-}
-
-template <typename T>
-inline SessionOptionsImpl<T>& SessionOptionsImpl<T>::RegisterCustomOpsUsingFunction(const char* registration_function_name) {
- ThrowOnError(GetApi().RegisterCustomOpsUsingFunction(this->p_, registration_function_name));
- return *this;
-}
-
-/// Session
-template <typename T>
-inline size_t ConstSessionImpl<T>::GetInputCount() const {
- size_t out;
- ThrowOnError(GetApi().SessionGetInputCount(this->p_, &out));
- return out;
-}
-
-template <typename T>
-inline size_t ConstSessionImpl<T>::GetOutputCount() const {
- size_t out;
- ThrowOnError(GetApi().SessionGetOutputCount(this->p_, &out));
- return out;
-}
-
-template <typename T>
-inline size_t ConstSessionImpl<T>::GetOverridableInitializerCount() const {
- size_t out;
- ThrowOnError(GetApi().SessionGetOverridableInitializerCount(this->p_, &out));
- return out;
-}
-
-template <typename T>
-inline AllocatedStringPtr ConstSessionImpl<T>::GetInputNameAllocated(size_t index, OrtAllocator* allocator) const {
- char* out;
- ThrowOnError(GetApi().SessionGetInputName(this->p_, index, allocator, &out));
- return AllocatedStringPtr(out, detail::AllocatedFree(allocator));
-}
-
-template <typename T>
-inline AllocatedStringPtr ConstSessionImpl<T>::GetOutputNameAllocated(size_t index, OrtAllocator* allocator) const {
- char* out;
- ThrowOnError(GetApi().SessionGetOutputName(this->p_, index, allocator, &out));
- return AllocatedStringPtr(out, detail::AllocatedFree(allocator));
-}
-
-template <typename T>
-inline AllocatedStringPtr ConstSessionImpl<T>::GetOverridableInitializerNameAllocated(size_t index, OrtAllocator* allocator) const {
- char* out;
- ThrowOnError(GetApi().SessionGetOverridableInitializerName(this->p_, index, allocator, &out));
- return AllocatedStringPtr(out, detail::AllocatedFree(allocator));
-}
-
-template <typename T>
-inline uint64_t ConstSessionImpl<T>::GetProfilingStartTimeNs() const {
- uint64_t out;
- ThrowOnError(GetApi().SessionGetProfilingStartTimeNs(this->p_, &out));
- return out;
-}
-
-template <typename T>
-inline ModelMetadata ConstSessionImpl<T>::GetModelMetadata() const {
- OrtModelMetadata* out;
- ThrowOnError(GetApi().SessionGetModelMetadata(this->p_, &out));
- return ModelMetadata{out};
-}
-
-template <typename T>
-inline TypeInfo ConstSessionImpl<T>::GetInputTypeInfo(size_t index) const {
- OrtTypeInfo* out;
- ThrowOnError(GetApi().SessionGetInputTypeInfo(this->p_, index, &out));
- return TypeInfo{out};
-}
-
-template <typename T>
-inline TypeInfo ConstSessionImpl<T>::GetOutputTypeInfo(size_t index) const {
- OrtTypeInfo* out;
- ThrowOnError(GetApi().SessionGetOutputTypeInfo(this->p_, index, &out));
- return TypeInfo{out};
-}
-
-template <typename T>
-inline TypeInfo ConstSessionImpl<T>::GetOverridableInitializerTypeInfo(size_t index) const {
- OrtTypeInfo* out;
- ThrowOnError(GetApi().SessionGetOverridableInitializerTypeInfo(this->p_, index, &out));
- return TypeInfo{out};
-}
-
-template <typename T>
-inline std::vector<Value> SessionImpl<T>::Run(const RunOptions& run_options, const char* const* input_names, const Value* input_values, size_t input_count,
- const char* const* output_names, size_t output_count) {
- std::vector<Value> output_values;
- output_values.reserve(output_count);
- for (size_t i = 0; i < output_count; i++)
- output_values.emplace_back(nullptr);
- Run(run_options, input_names, input_values, input_count, output_names, output_values.data(), output_count);
- return output_values;
-}
-
-template <typename T>
-inline void SessionImpl<T>::Run(const RunOptions& run_options, const char* const* input_names, const Value* input_values, size_t input_count,
- const char* const* output_names, Value* output_values, size_t output_count) {
- static_assert(sizeof(Value) == sizeof(OrtValue*), "Value is really just an array of OrtValue* in memory, so we can reinterpret_cast safely");
- auto ort_input_values = reinterpret_cast<const OrtValue* const*>(input_values);
- auto ort_output_values = reinterpret_cast<OrtValue**>(output_values);
- ThrowOnError(GetApi().Run(this->p_, run_options, input_names, ort_input_values, input_count, output_names, output_count, ort_output_values));
-}
-
-template <typename T>
-inline void SessionImpl<T>::Run(const RunOptions& run_options, const IoBinding& io_binding) {
- ThrowOnError(GetApi().RunWithBinding(this->p_, run_options, io_binding));
-}
-
-template <typename T>
-inline AllocatedStringPtr SessionImpl<T>::EndProfilingAllocated(OrtAllocator* allocator) {
- char* out = nullptr;
- ThrowOnError(GetApi().SessionEndProfiling(this->p_, allocator, &out));
- return AllocatedStringPtr(out, detail::AllocatedFree(allocator));
-}
-
-} // namespace detail
-
-inline SessionOptions::SessionOptions() {
- ThrowOnError(GetApi().CreateSessionOptions(&this->p_));
-}
-
-/// CustomOpConfigs
-inline std::string detail::MakeCustomOpConfigEntryKey(const char* custom_op_name, const char* config) {
- std::string config_key = "custom_op.";
-
- config_key += custom_op_name;
- config_key += ".";
- config_key += config;
-
- return config_key;
-}
-
-inline CustomOpConfigs& CustomOpConfigs::AddConfig(const char* custom_op_name, const char* config_key, const char* config_value) {
- const std::string full_flat_key = detail::MakeCustomOpConfigEntryKey(custom_op_name, config_key);
- flat_configs_[full_flat_key] = config_value;
- return *this;
-}
-
-inline const std::unordered_map<std::string, std::string>& CustomOpConfigs::GetFlattenedConfigs() const {
- return flat_configs_;
-}
-
-inline Session::Session(const Env& env, const ORTCHAR_T* model_path, const SessionOptions& options) {
- ThrowOnError(GetApi().CreateSession(env, model_path, options, &this->p_));
-}
-
-inline Session::Session(const Env& env, const ORTCHAR_T* model_path, const SessionOptions& options,
- OrtPrepackedWeightsContainer* prepacked_weights_container) {
- ThrowOnError(GetApi().CreateSessionWithPrepackedWeightsContainer(env, model_path, options, prepacked_weights_container, &this->p_));
-}
-
-inline Session::Session(const Env& env, const void* model_data, size_t model_data_length, const SessionOptions& options) {
- ThrowOnError(GetApi().CreateSessionFromArray(env, model_data, model_data_length, options, &this->p_));
-}
-
-inline Session::Session(const Env& env, const void* model_data, size_t model_data_length,
- const SessionOptions& options, OrtPrepackedWeightsContainer* prepacked_weights_container) {
- ThrowOnError(GetApi().CreateSessionFromArrayWithPrepackedWeightsContainer(env, model_data, model_data_length, options,
- prepacked_weights_container, &this->p_));
-}
-
-inline AllocatedStringPtr ModelMetadata::GetProducerNameAllocated(OrtAllocator* allocator) const {
- char* out;
- ThrowOnError(GetApi().ModelMetadataGetProducerName(p_, allocator, &out));
- return AllocatedStringPtr(out, detail::AllocatedFree(allocator));
-}
-
-inline AllocatedStringPtr ModelMetadata::GetGraphNameAllocated(OrtAllocator* allocator) const {
- char* out;
- ThrowOnError(GetApi().ModelMetadataGetGraphName(p_, allocator, &out));
- return AllocatedStringPtr(out, detail::AllocatedFree(allocator));
-}
-
-inline AllocatedStringPtr ModelMetadata::GetDomainAllocated(OrtAllocator* allocator) const {
- char* out;
- ThrowOnError(GetApi().ModelMetadataGetDomain(p_, allocator, &out));
- return AllocatedStringPtr(out, detail::AllocatedFree(allocator));
-}
-
-inline AllocatedStringPtr Ort::ModelMetadata::GetDescriptionAllocated(OrtAllocator* allocator) const {
- char* out;
- ThrowOnError(GetApi().ModelMetadataGetDescription(p_, allocator, &out));
- return AllocatedStringPtr(out, detail::AllocatedFree(allocator));
-}
-
-inline AllocatedStringPtr ModelMetadata::GetGraphDescriptionAllocated(OrtAllocator* allocator) const {
- char* out;
- ThrowOnError(GetApi().ModelMetadataGetGraphDescription(p_, allocator, &out));
- return AllocatedStringPtr(out, detail::AllocatedFree(allocator));
-}
-
-inline AllocatedStringPtr ModelMetadata::LookupCustomMetadataMapAllocated(const char* key, OrtAllocator* allocator) const {
- char* out;
- ThrowOnError(GetApi().ModelMetadataLookupCustomMetadataMap(p_, allocator, key, &out));
- return AllocatedStringPtr(out, detail::AllocatedFree(allocator));
-}
-
-inline std::vector<AllocatedStringPtr> ModelMetadata::GetCustomMetadataMapKeysAllocated(OrtAllocator* allocator) const {
- auto deletor = detail::AllocatedFree(allocator);
- std::vector<AllocatedStringPtr> result;
-
- char** out = nullptr;
- int64_t num_keys = 0;
- ThrowOnError(GetApi().ModelMetadataGetCustomMetadataMapKeys(p_, allocator, &out, &num_keys));
- if (num_keys <= 0) {
- return result;
- }
-
- // array of pointers will be freed
- std::unique_ptr<void, decltype(deletor)> array_guard(out, deletor);
- // reserve may throw
- auto strings_deletor = [&deletor, num_keys](char** out) { for(int64_t i = 0; i < num_keys; ++i) deletor(out[i]); };
- std::unique_ptr<char*, decltype(strings_deletor)> strings_guard(out, strings_deletor);
- result.reserve(static_cast<size_t>(num_keys));
- strings_guard.release();
- for (int64_t i = 0; i < num_keys; ++i) {
- result.push_back(AllocatedStringPtr(out[i], deletor));
- }
-
- return result;
-}
-
-inline int64_t ModelMetadata::GetVersion() const {
- int64_t out;
- ThrowOnError(GetApi().ModelMetadataGetVersion(p_, &out));
- return out;
-}
-
-namespace detail {
-
-template <typename T>
-inline ONNXTensorElementDataType TensorTypeAndShapeInfoImpl<T>::GetElementType() const {
- ONNXTensorElementDataType out;
- ThrowOnError(GetApi().GetTensorElementType(this->p_, &out));
- return out;
-}
-
-template <typename T>
-inline size_t TensorTypeAndShapeInfoImpl<T>::GetElementCount() const {
- size_t out;
- ThrowOnError(GetApi().GetTensorShapeElementCount(this->p_, &out));
- return static_cast<size_t>(out);
-}
-
-template <typename T>
-inline size_t TensorTypeAndShapeInfoImpl<T>::GetDimensionsCount() const {
- size_t out;
- ThrowOnError(GetApi().GetDimensionsCount(this->p_, &out));
- return out;
-}
-
-template <typename T>
-inline void TensorTypeAndShapeInfoImpl<T>::GetDimensions(int64_t* values, size_t values_count) const {
- ThrowOnError(GetApi().GetDimensions(this->p_, values, values_count));
-}
-
-template <typename T>
-inline void TensorTypeAndShapeInfoImpl<T>::GetSymbolicDimensions(const char** values, size_t values_count) const {
- ThrowOnError(GetApi().GetSymbolicDimensions(this->p_, values, values_count));
-}
-
-template <typename T>
-inline std::vector<int64_t> TensorTypeAndShapeInfoImpl<T>::GetShape() const {
- std::vector<int64_t> out(GetDimensionsCount(), 0);
- ThrowOnError(GetApi().GetDimensions(this->p_, out.data(), out.size()));
- return out;
-}
-
-} // namespace detail
-
-namespace detail {
-template <typename T>
-inline ConstTensorTypeAndShapeInfo TypeInfoImpl<T>::GetTensorTypeAndShapeInfo() const {
- const OrtTensorTypeAndShapeInfo* out;
- ThrowOnError(GetApi().CastTypeInfoToTensorInfo(this->p_, &out));
- return ConstTensorTypeAndShapeInfo{out};
-}
-
-template <typename T>
-inline ConstSequenceTypeInfo TypeInfoImpl<T>::GetSequenceTypeInfo() const {
- const OrtSequenceTypeInfo* out;
- ThrowOnError(GetApi().CastTypeInfoToSequenceTypeInfo(this->p_, &out));
- return ConstSequenceTypeInfo{out};
-}
-
-template <typename T>
-inline ConstMapTypeInfo TypeInfoImpl<T>::GetMapTypeInfo() const {
- const OrtMapTypeInfo* out;
- ThrowOnError(GetApi().CastTypeInfoToMapTypeInfo(this->p_, &out));
- return ConstMapTypeInfo{out};
-}
-
-template <typename T>
-inline ONNXType TypeInfoImpl<T>::GetONNXType() const {
- ONNXType out;
- ThrowOnError(GetApi().GetOnnxTypeFromTypeInfo(this->p_, &out));
- return out;
-}
-
-} // namespace detail
-
-namespace detail {
-template <typename T>
-inline TypeInfo SequenceTypeInfoImpl<T>::GetSequenceElementType() const {
- OrtTypeInfo* output;
- ThrowOnError(GetApi().GetSequenceElementType(this->p_, &output));
- return TypeInfo{output};
-}
-
-} // namespace detail
-
-namespace detail {
-template <typename T>
-inline ONNXTensorElementDataType MapTypeInfoImpl<T>::GetMapKeyType() const {
- ONNXTensorElementDataType out;
- ThrowOnError(GetApi().GetMapKeyType(this->p_, &out));
- return out;
-}
-
-template <typename T>
-inline TypeInfo MapTypeInfoImpl<T>::GetMapValueType() const {
- OrtTypeInfo* output;
- ThrowOnError(GetApi().GetMapValueType(this->p_, &output));
- return TypeInfo{output};
-}
-} // namespace detail
-
-namespace detail {
-
-template <typename T>
-template <typename R>
-inline void ConstValueImpl<T>::GetOpaqueData(const char* domain, const char* type_name, R& out) const {
- ThrowOnError(GetApi().GetOpaqueValue(domain, type_name, this->p_, &out, sizeof(R)));
-}
-
-template <typename T>
-inline bool ConstValueImpl<T>::IsTensor() const {
- int out;
- ThrowOnError(GetApi().IsTensor(this->p_, &out));
- return out != 0;
-}
-
-template <typename T>
-inline bool ConstValueImpl<T>::HasValue() const {
- int out;
- ThrowOnError(GetApi().HasValue(this->p_, &out));
- return out != 0;
-}
-
-template <typename T>
-inline size_t ConstValueImpl<T>::GetCount() const {
- size_t out;
- ThrowOnError(GetApi().GetValueCount(this->p_, &out));
- return out;
-}
-
-template <typename T>
-inline Value ConstValueImpl<T>::GetValue(int index, OrtAllocator* allocator) const {
- OrtValue* out;
- ThrowOnError(GetApi().GetValue(this->p_, index, allocator, &out));
- return Value{out};
-}
-
-template <typename T>
-inline size_t ConstValueImpl<T>::GetStringTensorDataLength() const {
- size_t out;
- ThrowOnError(GetApi().GetStringTensorDataLength(this->p_, &out));
- return out;
-}
-
-template <typename T>
-inline size_t ConstValueImpl<T>::GetStringTensorElementLength(size_t element_index) const {
- size_t out;
- ThrowOnError(GetApi().GetStringTensorElementLength(this->p_, element_index, &out));
- return out;
-}
-
-template <typename T>
-template <typename R>
-inline const R* ConstValueImpl<T>::GetTensorData() const {
- R* out;
- ThrowOnError(GetApi().GetTensorMutableData(const_cast<OrtValue*>(this->p_), (void**)&out));
- return out;
-}
-
-template <typename T>
-inline const void* ConstValueImpl<T>::GetTensorRawData() const {
- void* out;
- ThrowOnError(GetApi().GetTensorMutableData(const_cast<OrtValue*>(this->p_), &out));
- return out;
-}
-
-template <typename T>
-inline TypeInfo ConstValueImpl<T>::GetTypeInfo() const {
- OrtTypeInfo* output;
- ThrowOnError(GetApi().GetTypeInfo(this->p_, &output));
- return TypeInfo{output};
-}
-
-template <typename T>
-inline TensorTypeAndShapeInfo ConstValueImpl<T>::GetTensorTypeAndShapeInfo() const {
- OrtTensorTypeAndShapeInfo* output;
- ThrowOnError(GetApi().GetTensorTypeAndShape(this->p_, &output));
- return TensorTypeAndShapeInfo{output};
-}
-
-template <typename T>
-inline ConstMemoryInfo ConstValueImpl<T>::GetTensorMemoryInfo() const {
- const OrtMemoryInfo* mem_info;
- ThrowOnError(GetApi().GetTensorMemoryInfo(this->p_, &mem_info));
- return ConstMemoryInfo(mem_info);
-}
-
-template <typename T>
-inline void ConstValueImpl<T>::GetStringTensorElement(size_t buffer_length, size_t element_index, void* buffer) const {
- ThrowOnError(GetApi().GetStringTensorElement(this->p_, buffer_length, element_index, buffer));
-}
-
-template <typename T>
-inline void ConstValueImpl<T>::GetStringTensorContent(void* buffer, size_t buffer_length, size_t* offsets, size_t offsets_count) const {
- ThrowOnError(GetApi().GetStringTensorContent(this->p_, buffer, buffer_length, offsets, offsets_count));
-}
-
-#if !defined(DISABLE_SPARSE_TENSORS)
-template <typename T>
-inline OrtSparseFormat ConstValueImpl<T>::GetSparseFormat() const {
- OrtSparseFormat format;
- ThrowOnError(GetApi().GetSparseTensorFormat(this->p_, &format));
- return format;
-}
-
-template <typename T>
-inline TensorTypeAndShapeInfo ConstValueImpl<T>::GetSparseTensorValuesTypeAndShapeInfo() const {
- OrtTensorTypeAndShapeInfo* output;
- ThrowOnError(GetApi().GetSparseTensorValuesTypeAndShape(this->p_, &output));
- return TensorTypeAndShapeInfo{output};
-}
-
-template <typename T>
-inline TensorTypeAndShapeInfo ConstValueImpl<T>::GetSparseTensorIndicesTypeShapeInfo(OrtSparseIndicesFormat indices_format) const {
- OrtTensorTypeAndShapeInfo* output;
- ThrowOnError(GetApi().GetSparseTensorIndicesTypeShape(this->p_, indices_format, &output));
- return TensorTypeAndShapeInfo{output};
-}
-
-template <typename T>
-template <typename R>
-inline const R* ConstValueImpl<T>::GetSparseTensorIndicesData(OrtSparseIndicesFormat indices_format, size_t& num_indices) const {
- const void* out;
- ThrowOnError(GetApi().GetSparseTensorIndices(this->p_, indices_format, &num_indices, &out));
- return reinterpret_cast<const R*>(out);
-}
-
-template <typename T>
-inline bool ConstValueImpl<T>::IsSparseTensor() const {
- int out;
- ThrowOnError(GetApi().IsSparseTensor(this->p_, &out));
- return out != 0;
-}
-
-template <typename T>
-template <typename R>
-inline const R* ConstValueImpl<T>::GetSparseTensorValues() const {
- const void* out;
- ThrowOnError(GetApi().GetSparseTensorValues(this->p_, &out));
- return reinterpret_cast<const R*>(out);
-}
-
-#endif
-
-template <typename T>
-void ValueImpl<T>::FillStringTensor(const char* const* s, size_t s_len) {
- ThrowOnError(GetApi().FillStringTensor(this->p_, s, s_len));
-}
-
-template <typename T>
-void ValueImpl<T>::FillStringTensorElement(const char* s, size_t index) {
- ThrowOnError(GetApi().FillStringTensorElement(this->p_, s, index));
-}
-
-template <typename T>
-void* ValueImpl<T>::GetTensorMutableRawData() {
- void* out;
- ThrowOnError(GetApi().GetTensorMutableData(this->p_, &out));
- return out;
-}
-
-template <typename T>
-template <typename R>
-R* ValueImpl<T>::GetTensorMutableData() {
- R* out;
- ThrowOnError(GetApi().GetTensorMutableData(this->p_, (void**)&out));
- return out;
-}
-
-template <typename T>
-template <typename R>
-R& ValueImpl<T>::At(const std::vector<int64_t>& location) {
- static_assert(!std::is_same<T, std::string>::value, "this api does not support std::string");
- R* out;
- ThrowOnError(GetApi().TensorAt(this->p_, location.data(), location.size(), (void**)&out));
- return *out;
-}
-
-#if !defined(DISABLE_SPARSE_TENSORS)
-template <typename T>
-void ValueImpl<T>::UseCooIndices(int64_t* indices_data, size_t indices_num) {
- ThrowOnError(GetApi().UseCooIndices(this->p_, indices_data, indices_num));
-}
-
-template <typename T>
-void ValueImpl<T>::UseCsrIndices(int64_t* inner_data, size_t inner_num, int64_t* outer_data, size_t outer_num) {
- ThrowOnError(GetApi().UseCsrIndices(this->p_, inner_data, inner_num, outer_data, outer_num));
-}
-
-template <typename T>
-void ValueImpl<T>::UseBlockSparseIndices(const Shape& indices_shape, int32_t* indices_data) {
- ThrowOnError(GetApi().UseBlockSparseIndices(this->p_, indices_shape.shape, indices_shape.shape_len, indices_data));
-}
-
-template <typename T>
-void ValueImpl<T>::FillSparseTensorCoo(const OrtMemoryInfo* mem_info, const OrtSparseValuesParam& values_param,
- const int64_t* indices_data, size_t indices_num) {
- ThrowOnError(GetApi().FillSparseTensorCoo(this->p_, mem_info, values_param.values_shape,
- values_param.values_shape_len, values_param.data.p_data,
- indices_data, indices_num));
-}
-
-template <typename T>
-void ValueImpl<T>::FillSparseTensorCsr(const OrtMemoryInfo* data_mem_info,
- const OrtSparseValuesParam& values,
- const int64_t* inner_indices_data, size_t inner_indices_num,
- const int64_t* outer_indices_data, size_t outer_indices_num) {
- ThrowOnError(GetApi().FillSparseTensorCsr(this->p_, data_mem_info, values.values_shape, values.values_shape_len, values.data.p_data,
- inner_indices_data, inner_indices_num,
- outer_indices_data, outer_indices_num));
-}
-
-template <typename T>
-void ValueImpl<T>::FillSparseTensorBlockSparse(const OrtMemoryInfo* data_mem_info,
- const OrtSparseValuesParam& values,
- const Shape& indices_shape,
- const int32_t* indices_data) {
- ThrowOnError(GetApi().FillSparseTensorBlockSparse(this->p_, data_mem_info, values.values_shape, values.values_shape_len, values.data.p_data,
- indices_shape.shape, indices_shape.shape_len,
- indices_data));
-}
-
-#endif // !defined(DISABLE_SPARSE_TENSORS)
-
-} // namespace detail
-
-template <typename T>
-inline Value Value::CreateTensor(const OrtMemoryInfo* info, T* p_data, size_t p_data_element_count, const int64_t* shape, size_t shape_len) {
- return CreateTensor(info, p_data, p_data_element_count * sizeof(T), shape, shape_len, TypeToTensorType<T>::type);
-}
-
-inline Value Value::CreateTensor(const OrtMemoryInfo* info, void* p_data, size_t p_data_byte_count, const int64_t* shape, size_t shape_len,
- ONNXTensorElementDataType type) {
- OrtValue* out;
- ThrowOnError(GetApi().CreateTensorWithDataAsOrtValue(info, p_data, p_data_byte_count, shape, shape_len, type, &out));
- return Value{out};
-}
-
-template <typename T>
-inline Value Value::CreateTensor(OrtAllocator* allocator, const int64_t* shape, size_t shape_len) {
- return CreateTensor(allocator, shape, shape_len, TypeToTensorType<T>::type);
-}
-
-inline Value Value::CreateTensor(OrtAllocator* allocator, const int64_t* shape, size_t shape_len, ONNXTensorElementDataType type) {
- OrtValue* out;
- ThrowOnError(GetApi().CreateTensorAsOrtValue(allocator, shape, shape_len, type, &out));
- return Value{out};
-}
-
-#if !defined(DISABLE_SPARSE_TENSORS)
-
-template <typename T>
-inline Value Value::CreateSparseTensor(const OrtMemoryInfo* info, T* p_data, const Shape& dense_shape,
- const Shape& values_shape) {
- return CreateSparseTensor(info, p_data, dense_shape, values_shape, TypeToTensorType<T>::type);
-}
-
-inline Value Value::CreateSparseTensor(const OrtMemoryInfo* info, void* p_data, const Shape& dense_shape,
- const Shape& values_shape, ONNXTensorElementDataType type) {
- OrtValue* out;
- ThrowOnError(GetApi().CreateSparseTensorWithValuesAsOrtValue(info, p_data, dense_shape.shape, dense_shape.shape_len,
- values_shape.shape, values_shape.shape_len, type, &out));
- return Value{out};
-}
-
-template <typename T>
-inline Value Value::CreateSparseTensor(OrtAllocator* allocator, const Shape& dense_shape) {
- return CreateSparseTensor(allocator, dense_shape, TypeToTensorType<T>::type);
-}
-
-inline Value Value::CreateSparseTensor(OrtAllocator* allocator, const Shape& dense_shape,
- ONNXTensorElementDataType type) {
- OrtValue* out;
- ThrowOnError(GetApi().CreateSparseTensorAsOrtValue(allocator, dense_shape.shape, dense_shape.shape_len, type, &out));
- return Value{out};
-}
-#endif // !defined(DISABLE_SPARSE_TENSORS)
-
-inline Value Value::CreateMap(Value& keys, Value& values) {
- OrtValue* out;
- OrtValue* inputs[2] = {keys, values};
- ThrowOnError(GetApi().CreateValue(inputs, 2, ONNX_TYPE_MAP, &out));
- return Value{out};
-}
-
-inline Value Value::CreateSequence(std::vector<Value>& values) {
- OrtValue* out;
- std::vector<OrtValue*> values_ort{values.data(), values.data() + values.size()};
- ThrowOnError(GetApi().CreateValue(values_ort.data(), values_ort.size(), ONNX_TYPE_SEQUENCE, &out));
- return Value{out};
-}
-
-template <typename T>
-inline Value Value::CreateOpaque(const char* domain, const char* type_name, const T& data_container) {
- OrtValue* out;
- ThrowOnError(GetApi().CreateOpaqueValue(domain, type_name, &data_container, sizeof(T), &out));
- return Value{out};
-}
-
-//
-// Custom OP Inlines
-//
-inline KernelContext::KernelContext(OrtKernelContext* context) : ctx_(context) {
-}
-
-inline size_t KernelContext::GetInputCount() const {
- size_t out = 0;
- Ort::ThrowOnError(GetApi().KernelContext_GetInputCount(ctx_, &out));
- return out;
-}
-
-inline size_t KernelContext::GetOutputCount() const {
- size_t out = 0;
- Ort::ThrowOnError(GetApi().KernelContext_GetOutputCount(ctx_, &out));
- return out;
-}
-
-inline ConstValue KernelContext::GetInput(size_t index) const {
- const OrtValue* out = nullptr;
- Ort::ThrowOnError(GetApi().KernelContext_GetInput(ctx_, index, &out));
- return ConstValue{out};
-}
-
-inline UnownedValue KernelContext::GetOutput(size_t index, const int64_t* dim_values, size_t dim_count) const {
- OrtValue* out = nullptr;
- Ort::ThrowOnError(GetApi().KernelContext_GetOutput(ctx_, index, dim_values, dim_count, &out));
- return UnownedValue(out);
-}
-
-inline UnownedValue KernelContext::GetOutput(size_t index, const std::vector<int64_t>& dims) const {
- OrtValue* out = nullptr;
- Ort::ThrowOnError(GetApi().KernelContext_GetOutput(ctx_, index, dims.data(), dims.size(), &out));
- return UnownedValue(out);
-}
-
-inline void* KernelContext::GetGPUComputeStream() const {
- void* out = nullptr;
- Ort::ThrowOnError(GetApi().KernelContext_GetGPUComputeStream(ctx_, &out));
- return out;
-}
-
-inline OpAttr::OpAttr(const char* name, const void* data, int len, OrtOpAttrType type) {
- Ort::ThrowOnError(GetApi().CreateOpAttr(name, data, len, type, &p_));
-}
-
-namespace detail {
-template <typename T>
-inline KernelInfo KernelInfoImpl<T>::Copy() const {
- OrtKernelInfo* info_copy = nullptr;
- Ort::ThrowOnError(GetApi().CopyKernelInfo(this->p_, &info_copy));
- return KernelInfo{info_copy};
-}
-
-template <typename T>
-inline size_t KernelInfoImpl<T>::GetInputCount() const {
- size_t out = 0;
- ThrowOnError(GetApi().KernelInfo_GetInputCount(this->p_, &out));
- return out;
-}
-
-template <typename T>
-inline size_t KernelInfoImpl<T>::GetOutputCount() const {
- size_t out = 0;
- ThrowOnError(GetApi().KernelInfo_GetOutputCount(this->p_, &out));
- return out;
-}
-
-template <typename T>
-inline std::string KernelInfoImpl<T>::GetInputName(size_t index) const {
- size_t size = 0;
-
- // Feed nullptr for the data buffer to query the true size of the string value
- Ort::ThrowOnError(GetApi().KernelInfo_GetInputName(this->p_, index, nullptr, &size));
-
- std::string out;
- out.resize(size);
- Ort::ThrowOnError(GetApi().KernelInfo_GetInputName(this->p_, index, &out[0], &size));
- out.resize(size - 1); // remove the terminating character '\0'
-
- return out;
-}
-
-template <typename T>
-inline std::string KernelInfoImpl<T>::GetOutputName(size_t index) const {
- size_t size = 0;
-
- // Feed nullptr for the data buffer to query the true size of the string value
- Ort::ThrowOnError(GetApi().KernelInfo_GetOutputName(this->p_, index, nullptr, &size));
-
- std::string out;
- out.resize(size);
- Ort::ThrowOnError(GetApi().KernelInfo_GetOutputName(this->p_, index, &out[0], &size));
- out.resize(size - 1); // remove the terminating character '\0'
-
- return out;
-}
-
-template <typename T>
-inline TypeInfo KernelInfoImpl<T>::GetInputTypeInfo(size_t index) const {
- OrtTypeInfo* out = nullptr;
- ThrowOnError(GetApi().KernelInfo_GetInputTypeInfo(this->p_, index, &out));
- return TypeInfo{out};
-}
-
-template <typename T>
-inline TypeInfo KernelInfoImpl<T>::GetOutputTypeInfo(size_t index) const {
- OrtTypeInfo* out = nullptr;
- ThrowOnError(GetApi().KernelInfo_GetOutputTypeInfo(this->p_, index, &out));
- return TypeInfo{out};
-}
-
-template <typename T>
-inline Value KernelInfoImpl<T>::GetTensorAttribute(const char* name, OrtAllocator* allocator) const {
- OrtValue* out = nullptr;
- ThrowOnError(GetApi().KernelInfoGetAttribute_tensor(this->p_, name, allocator, &out));
- return Value{out};
-}
-
-inline void attr_utils::GetAttr(const OrtKernelInfo* p, const char* name, float& out) {
- Ort::ThrowOnError(GetApi().KernelInfoGetAttribute_float(p, name, &out));
-}
-
-inline void attr_utils::GetAttr(const OrtKernelInfo* p, const char* name, int64_t& out) {
- Ort::ThrowOnError(GetApi().KernelInfoGetAttribute_int64(p, name, &out));
-}
-
-inline void attr_utils::GetAttr(const OrtKernelInfo* p, const char* name, std::string& result) {
- size_t size = 0;
- // Feed nullptr for the data buffer to query the true size of the string attribute
- Ort::ThrowOnError(GetApi().KernelInfoGetAttribute_string(p, name, nullptr, &size));
-
- std::string out;
- out.resize(size);
- Ort::ThrowOnError(GetApi().KernelInfoGetAttribute_string(p, name, &out[0], &size));
- out.resize(size - 1); // remove the terminating character '\0'
- out.swap(result);
-}
-
-inline void attr_utils::GetAttrs(const OrtKernelInfo* p, const char* name, std::vector<float>& result) {
- size_t size = 0;
- // Feed nullptr for the data buffer to query the true size of the attribute
- Ort::ThrowOnError(GetApi().KernelInfoGetAttributeArray_float(p, name, nullptr, &size));
-
- std::vector<float> out;
- out.resize(size);
- Ort::ThrowOnError(GetApi().KernelInfoGetAttributeArray_float(p, name, out.data(), &size));
- out.swap(result);
-}
-
-inline void attr_utils::GetAttrs(const OrtKernelInfo* p, const char* name, std::vector<int64_t>& result) {
- size_t size = 0;
-
- // Feed nullptr for the data buffer to query the true size of the attribute
- Ort::ThrowOnError(GetApi().KernelInfoGetAttributeArray_int64(p, name, nullptr, &size));
-
- std::vector<int64_t> out;
- out.resize(size);
- Ort::ThrowOnError(GetApi().KernelInfoGetAttributeArray_int64(p, name, out.data(), &size));
- out.swap(result);
-}
-} // namespace detail
-
-inline KernelInfo::KernelInfo(OrtKernelInfo* info) : detail::KernelInfoImpl<OrtKernelInfo>{info} {}
-
-inline Op::Op(OrtOp* p) : Base<OrtOp>(p) {}
-
-inline Op Op::Create(const OrtKernelInfo* info, const char* op_name, const char* domain, int version,
- const char** type_constraint_names,
- const ONNXTensorElementDataType* type_constraint_values,
- size_t type_constraint_count,
- const OpAttr* attr_values, size_t attr_count,
- size_t input_count, size_t output_count) {
- static_assert(sizeof(OpAttr) == sizeof(OrtOpAttr*),
- "OpAttr's is expected to be just an array of OrtOpAttr in memory so we can reinterpret safely");
- auto attr_input_values = reinterpret_cast<const OrtOpAttr* const*>(attr_values);
- OrtOp* op;
- Ort::ThrowOnError(GetApi().CreateOp(info, op_name, domain, version, type_constraint_names, type_constraint_values,
- static_cast<int>(type_constraint_count),
- attr_input_values,
- static_cast<int>(attr_count),
- static_cast<int>(input_count),
- static_cast<int>(output_count), &op));
- return Op{op};
-}
-
-inline void Op::Invoke(const OrtKernelContext* context,
- const Value* input_values,
- size_t input_count,
- Value* output_values,
- size_t output_count) {
- static_assert(sizeof(Value) == sizeof(OrtValue*),
- "Value is really just an array of OrtValue* in memory, so we can reinterpret_cast safely");
- auto ort_input_values = reinterpret_cast<const OrtValue* const*>(input_values);
- auto ort_output_values = reinterpret_cast<OrtValue**>(output_values);
- Ort::ThrowOnError(GetApi().InvokeOp(context, p_, ort_input_values, static_cast<int>(input_count),
- ort_output_values, static_cast<int>(output_count)));
-}
-
-inline void Op::Invoke(const OrtKernelContext* context,
- const OrtValue* const* input_values,
- size_t input_count,
- OrtValue* const* output_values,
- size_t output_count) {
- Ort::ThrowOnError(GetApi().InvokeOp(context, p_, input_values, static_cast<int>(input_count),
- output_values, static_cast<int>(output_count)));
-}
-
-inline void CustomOpApi::ThrowOnError(OrtStatus* status) {
- Ort::ThrowOnError(status);
-}
-
-template <>
-inline float CustomOpApi::KernelInfoGetAttribute<float>(_In_ const OrtKernelInfo* info, _In_ const char* name) {
- float out;
- Ort::ThrowOnError(api_.KernelInfoGetAttribute_float(info, name, &out));
- return out;
-}
-
-template <>
-inline int64_t CustomOpApi::KernelInfoGetAttribute<int64_t>(_In_ const OrtKernelInfo* info, _In_ const char* name) {
- int64_t out;
- Ort::ThrowOnError(api_.KernelInfoGetAttribute_int64(info, name, &out));
- return out;
-}
-
-template <>
-inline std::string CustomOpApi::KernelInfoGetAttribute<std::string>(_In_ const OrtKernelInfo* info, _In_ const char* name) {
- size_t size = 0;
- std::string out;
-
- // Feed nullptr for the data buffer to query the true size of the string attribute
- OrtStatus* status = api_.KernelInfoGetAttribute_string(info, name, nullptr, &size);
-
- if (status == nullptr) {
- out.resize(size);
- Ort::ThrowOnError(api_.KernelInfoGetAttribute_string(info, name, &out[0], &size));
- out.resize(size - 1); // remove the terminating character '\0'
- } else {
- Ort::ThrowOnError(status);
- }
- return out;
-}
-
-template <>
-inline std::vector<float> CustomOpApi::KernelInfoGetAttribute(_In_ const OrtKernelInfo* info, _In_ const char* name) {
- size_t size = 0;
- std::vector<float> out;
-
- // Feed nullptr for the data buffer to query the true size of the attribute
- OrtStatus* status = api_.KernelInfoGetAttributeArray_float(info, name, nullptr, &size);
-
- if (status == nullptr) {
- out.resize(size);
- Ort::ThrowOnError(api_.KernelInfoGetAttributeArray_float(info, name, out.data(), &size));
- } else {
- Ort::ThrowOnError(status);
- }
- return out;
-}
-
-template <>
-inline std::vector<int64_t> CustomOpApi::KernelInfoGetAttribute(_In_ const OrtKernelInfo* info, _In_ const char* name) {
- size_t size = 0;
- std::vector<int64_t> out;
-
- // Feed nullptr for the data buffer to query the true size of the attribute
- OrtStatus* status = api_.KernelInfoGetAttributeArray_int64(info, name, nullptr, &size);
-
- if (status == nullptr) {
- out.resize(size);
- Ort::ThrowOnError(api_.KernelInfoGetAttributeArray_int64(info, name, out.data(), &size));
- } else {
- Ort::ThrowOnError(status);
- }
- return out;
-}
-inline OrtTensorTypeAndShapeInfo* CustomOpApi::GetTensorTypeAndShape(_In_ const OrtValue* value) {
- OrtTensorTypeAndShapeInfo* out;
- Ort::ThrowOnError(api_.GetTensorTypeAndShape(value, &out));
- return out;
-}
-
-inline size_t CustomOpApi::GetTensorShapeElementCount(_In_ const OrtTensorTypeAndShapeInfo* info) {
- size_t out;
- Ort::ThrowOnError(api_.GetTensorShapeElementCount(info, &out));
- return out;
-}
-
-inline ONNXTensorElementDataType CustomOpApi::GetTensorElementType(const OrtTensorTypeAndShapeInfo* info) {
- ONNXTensorElementDataType out;
- Ort::ThrowOnError(api_.GetTensorElementType(info, &out));
- return out;
-}
-
-inline size_t CustomOpApi::GetDimensionsCount(_In_ const OrtTensorTypeAndShapeInfo* info) {
- size_t out;
- Ort::ThrowOnError(api_.GetDimensionsCount(info, &out));
- return out;
-}
-
-inline void CustomOpApi::GetDimensions(_In_ const OrtTensorTypeAndShapeInfo* info, _Out_ int64_t* dim_values, size_t dim_values_length) {
- Ort::ThrowOnError(api_.GetDimensions(info, dim_values, dim_values_length));
-}
-
-inline void CustomOpApi::SetDimensions(OrtTensorTypeAndShapeInfo* info, _In_ const int64_t* dim_values, size_t dim_count) {
- Ort::ThrowOnError(api_.SetDimensions(info, dim_values, dim_count));
-}
-
-template <typename T>
-inline T* CustomOpApi::GetTensorMutableData(_Inout_ OrtValue* value) {
- T* data;
- Ort::ThrowOnError(api_.GetTensorMutableData(value, reinterpret_cast<void**>(&data)));
- return data;
-}
-
-inline const OrtMemoryInfo* CustomOpApi::GetTensorMemoryInfo(_In_ const OrtValue* value) {
- const OrtMemoryInfo* mem_info;
- Ort::ThrowOnError(api_.GetTensorMemoryInfo(value, &mem_info));
- return mem_info;
-}
-
-template <typename T>
-inline const T* CustomOpApi::GetTensorData(_Inout_ const OrtValue* value) {
- T* data = nullptr;
- Ort::ThrowOnError(api_.GetTensorMutableData(const_cast<OrtValue*>(value), reinterpret_cast<void**>(&data)));
- return data;
-}
-
-inline std::vector<int64_t> CustomOpApi::GetTensorShape(const OrtTensorTypeAndShapeInfo* info) {
- size_t out;
- Ort::ThrowOnError(api_.GetDimensionsCount(info, &out));
- std::vector<int64_t> output(out);
- Ort::ThrowOnError(api_.GetDimensions(info, output.data(), out));
- return output;
-}
-
-inline void CustomOpApi::ReleaseTensorTypeAndShapeInfo(OrtTensorTypeAndShapeInfo* input) {
- api_.ReleaseTensorTypeAndShapeInfo(input);
-}
-
-inline size_t CustomOpApi::KernelContext_GetInputCount(const OrtKernelContext* context) {
- size_t out;
- Ort::ThrowOnError(api_.KernelContext_GetInputCount(context, &out));
- return out;
-}
-
-inline const OrtValue* CustomOpApi::KernelContext_GetInput(const OrtKernelContext* context, _In_ size_t index) {
- const OrtValue* out;
- Ort::ThrowOnError(api_.KernelContext_GetInput(context, index, &out));
- return out;
-}
-
-inline size_t CustomOpApi::KernelContext_GetOutputCount(const OrtKernelContext* context) {
- size_t out;
- Ort::ThrowOnError(api_.KernelContext_GetOutputCount(context, &out));
- return out;
-}
-
-inline OrtValue* CustomOpApi::KernelContext_GetOutput(OrtKernelContext* context, _In_ size_t index,
- _In_ const int64_t* dim_values, size_t dim_count) {
- OrtValue* out;
- Ort::ThrowOnError(api_.KernelContext_GetOutput(context, index, dim_values, dim_count, &out));
- return out;
-}
-
-inline void* CustomOpApi::KernelContext_GetGPUComputeStream(const OrtKernelContext* context) {
- void* out;
- Ort::ThrowOnError(api_.KernelContext_GetGPUComputeStream(context, &out));
- return out;
-}
-
-inline OrtOpAttr* CustomOpApi::CreateOpAttr(_In_ const char* name,
- _In_ const void* data,
- _In_ int len,
- _In_ OrtOpAttrType type) {
- OrtOpAttr* op_attr{};
- Ort::ThrowOnError(api_.CreateOpAttr(name, data, len, type, &op_attr));
- return op_attr;
-}
-
-inline void CustomOpApi::ReleaseOpAttr(_Frees_ptr_opt_ OrtOpAttr* op_attr) {
- api_.ReleaseOpAttr(op_attr);
-}
-
-inline OrtOp* CustomOpApi::CreateOp(_In_ const OrtKernelInfo* info,
- _In_ const char* op_name,
- _In_ const char* domain,
- _In_ int version,
- _In_opt_ const char** type_constraint_names,
- _In_opt_ const ONNXTensorElementDataType* type_constraint_values,
- _In_opt_ int type_constraint_count,
- _In_opt_ const OrtOpAttr* const* attr_values,
- _In_opt_ int attr_count,
- _In_ int input_count,
- _In_ int output_count) {
- OrtOp* ort_op{};
- Ort::ThrowOnError(api_.CreateOp(info, op_name, domain, version, type_constraint_names, type_constraint_values,
- type_constraint_count, attr_values, attr_count, input_count, output_count, &ort_op));
- return ort_op;
-}
-
-inline void CustomOpApi::InvokeOp(_In_ const OrtKernelContext* context,
- _In_ const OrtOp* ort_op,
- _In_ const OrtValue* const* input_values,
- _In_ int input_count,
- _Inout_ OrtValue* const* output_values,
- _In_ int output_count) {
- Ort::ThrowOnError(api_.InvokeOp(context, ort_op, input_values, input_count, output_values, output_count));
-}
-
-inline void CustomOpApi::ReleaseOp(_Frees_ptr_opt_ OrtOp* ort_op) {
- api_.ReleaseOp(ort_op);
-}
-
-inline OrtKernelInfo* CustomOpApi::CopyKernelInfo(_In_ const OrtKernelInfo* info) {
- OrtKernelInfo* info_copy{};
- Ort::ThrowOnError(api_.CopyKernelInfo(info, &info_copy));
- return info_copy;
-}
-
-inline void CustomOpApi::ReleaseKernelInfo(_Frees_ptr_opt_ OrtKernelInfo* info_copy) {
- api_.ReleaseKernelInfo(info_copy);
-}
-
-inline std::vector<std::string> GetAvailableProviders() {
- int len;
- char** providers;
- ThrowOnError(GetApi().GetAvailableProviders(&providers, &len));
- std::vector<std::string> available_providers(providers, providers + len);
- ThrowOnError(GetApi().ReleaseAvailableProviders(providers, len));
- return available_providers;
-}
-
-SessionOptions& AddInitializer(const char* name, const OrtValue* ort_val);
-
-template <typename TOp, typename TKernel>
-void CustomOpBase<TOp, TKernel>::GetSessionConfigs(std::unordered_map<std::string, std::string>& out,
- ConstSessionOptions options) const {
- const TOp* derived = static_cast<const TOp*>(this);
- std::vector<std::string> keys = derived->GetSessionConfigKeys();
-
- out.reserve(keys.size());
-
- std::string config_entry_key = detail::MakeCustomOpConfigEntryKey(derived->GetName(), "");
- const size_t prefix_size = config_entry_key.length();
-
- for (const auto& key : keys) {
- config_entry_key.resize(prefix_size);
- config_entry_key.append(key);
- out[key] = options.GetConfigEntryOrDefault(config_entry_key.c_str(), "");
- }
-}
-
-} // namespace Ort
diff --git a/funasr/runtime/onnxruntime/win/include/onnxruntime_run_options_config_keys.h b/funasr/runtime/onnxruntime/win/include/onnxruntime_run_options_config_keys.h
deleted file mode 100644
index 1f5fcd5..0000000
--- a/funasr/runtime/onnxruntime/win/include/onnxruntime_run_options_config_keys.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-#pragma once
-
-/*
- * This file defines RunOptions Config Keys and format of the Config Values.
- *
- * The Naming Convention for a RunOptions Config Key,
- * "[Area][.[SubArea1].[SubArea2]...].[Keyname]"
- * Such as "ep.cuda.use_arena"
- * The Config Key cannot be empty
- * The maximum length of the Config Key is 128
- *
- * The string format of a RunOptions Config Value is defined individually for each Config.
- * The maximum length of the Config Value is 1024
- */
-
-// Key for enabling shrinkages of user listed device memory arenas.
-// Expects a list of semi-colon separated key value pairs separated by colon in the following format:
-// "device_0:device_id_0;device_1:device_id_1"
-// No white-spaces allowed in the provided list string.
-// Currently, the only supported devices are : "cpu", "gpu" (case sensitive).
-// If "cpu" is included in the list, DisableCpuMemArena() API must not be called (i.e.) arena for cpu should be enabled.
-// Example usage: "cpu:0;gpu:0" (or) "gpu:0"
-// By default, the value for this key is empty (i.e.) no memory arenas are shrunk
-static const char* const kOrtRunOptionsConfigEnableMemoryArenaShrinkage = "memory.enable_memory_arena_shrinkage";
-
-// Set to '1' to not synchronize execution providers with CPU at the end of session run.
-// Per default it will be set to '0'
-// Taking CUDA EP as an example, it omit triggering cudaStreamSynchronize on the compute stream.
-static const char* const kOrtRunOptionsConfigDisableSynchronizeExecutionProviders = "disable_synchronize_execution_providers";
diff --git a/funasr/runtime/onnxruntime/win/include/onnxruntime_session_options_config_keys.h b/funasr/runtime/onnxruntime/win/include/onnxruntime_session_options_config_keys.h
deleted file mode 100644
index 92482d7..0000000
--- a/funasr/runtime/onnxruntime/win/include/onnxruntime_session_options_config_keys.h
+++ /dev/null
@@ -1,186 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-#pragma once
-
-/*
- * This file defines SessionOptions Config Keys and format of the Config Values.
- *
- * The Naming Convention for a SessionOptions Config Key,
- * "[Area][.[SubArea1].[SubArea2]...].[Keyname]"
- * Such as "ep.cuda.use_arena"
- * The Config Key cannot be empty
- * The maximum length of the Config Key is 128
- *
- * The string format of a SessionOptions Config Value is defined individually for each Config.
- * The maximum length of the Config Value is 1024
- */
-
-// Key for disable PrePacking,
-// If the config value is set to "1" then the prepacking is disabled, otherwise prepacking is enabled (default value)
-static const char* const kOrtSessionOptionsConfigDisablePrepacking = "session.disable_prepacking";
-
-// A value of "1" means allocators registered in the env will be used. "0" means the allocators created in the session
-// will be used. Use this to override the usage of env allocators on a per session level.
-static const char* const kOrtSessionOptionsConfigUseEnvAllocators = "session.use_env_allocators";
-
-// Set to 'ORT' (case sensitive) to load an ORT format model.
-// If unset, model type will default to ONNX unless inferred from filename ('.ort' == ORT format) or bytes to be ORT
-static const char* const kOrtSessionOptionsConfigLoadModelFormat = "session.load_model_format";
-
-// Set to 'ORT' (case sensitive) to save optimized model in ORT format when SessionOptions.optimized_model_path is set.
-// If unset, format will default to ONNX unless optimized_model_filepath ends in '.ort'.
-static const char* const kOrtSessionOptionsConfigSaveModelFormat = "session.save_model_format";
-
-// If a value is "1", flush-to-zero and denormal-as-zero are applied. The default is "0".
-// When multiple sessions are created, a main thread doesn't override changes from succeeding session options,
-// but threads in session thread pools follow option changes.
-// When ORT runs with OpenMP, the same rule is applied, i.e. the first session option to flush-to-zero and
-// denormal-as-zero is only applied to global OpenMP thread pool, which doesn't support per-session thread pool.
-// Note that an alternative way not using this option at runtime is to train and export a model without denormals
-// and that's recommended because turning this option on may hurt model accuracy.
-static const char* const kOrtSessionOptionsConfigSetDenormalAsZero = "session.set_denormal_as_zero";
-
-// It controls to run quantization model in QDQ (QuantizelinearDeQuantizelinear) format or not.
-// "0": enable. ORT does fusion logic for QDQ format.
-// "1": disable. ORT doesn't do fusion logic for QDQ format.
-// Its default value is "0"
-static const char* const kOrtSessionOptionsDisableQuantQDQ = "session.disable_quant_qdq";
-
-// It controls whether to enable Double QDQ remover and Identical Children Consolidation
-// "0": not to disable. ORT does remove the middle 2 Nodes from a Q->(QD->Q)->QD pairs
-// "1": disable. ORT doesn't remove the middle 2 Nodes from a Q->(QD->Q)->QD pairs
-// Its default value is "0"
-static const char* const kOrtSessionOptionsDisableDoubleQDQRemover = "session.disable_double_qdq_remover";
-
-// If set to "1", enables the removal of QuantizeLinear/DequantizeLinear node pairs once all QDQ handling has been
-// completed. e.g. If after all QDQ handling has completed and we have -> FloatOp -> Q -> DQ -> FloatOp -> the
-// Q -> DQ could potentially be removed. This will provide a performance benefit by avoiding going from float to
-// 8-bit and back to float, but could impact accuracy. The impact on accuracy will be model specific and depend on
-// other factors like whether the model was created using Quantization Aware Training or Post Training Quantization.
-// As such, it's best to test to determine if enabling this works well for your scenario.
-// The default value is "0"
-// Available since version 1.11.
-static const char* const kOrtSessionOptionsEnableQuantQDQCleanup = "session.enable_quant_qdq_cleanup";
-
-// Enable or disable gelu approximation in graph optimization. "0": disable; "1": enable. The default is "0".
-// GeluApproximation has side effects which may change the inference results. It is disabled by default due to this.
-static const char* const kOrtSessionOptionsEnableGeluApproximation = "optimization.enable_gelu_approximation";
-
-#ifdef ENABLE_TRAINING
-// Specifies a list of op types for memory footprint reduction.
-// The value should be a ","-delimited list of pair of
-// <subgraph string : optimization strategy : number of subgraph to apply>.
-// For example, "Gelu+Cast+:1:0,Dropout+:1:1".
-// A valid "subgraph string" should be one subgraph representation output by ORT graph transformations.
-// "optimization strategy" currently has valid values: 0 - disabled, 1 - recompute.
-// "number of subgraph to apply" is used to control how many subgraphs to apply optimization, to avoid "oversaving"
-// the memory.
-static const char* const kOrtSessionOptionsMemoryOptimizerEnabler = "optimization.enable_memory_optimizer";
-
-// Specifies the level for detecting subgraphs for memory footprint reduction.
-// The value should be an integer. The default value is 0.
-static const char* const kOrtSessionOptionsMemoryOptimizerProbeLevel = "optimization.enable_memory_probe_recompute_level";
-#endif
-
-// Enable or disable using device allocator for allocating initialized tensor memory. "1": enable; "0": disable. The default is "0".
-// Using device allocators means the memory allocation is made using malloc/new.
-static const char* const kOrtSessionOptionsUseDeviceAllocatorForInitializers = "session.use_device_allocator_for_initializers";
-
-// Configure whether to allow the inter_op/intra_op threads spinning a number of times before blocking
-// "0": thread will block if found no job to run
-// "1": default, thread will spin a number of times before blocking
-static const char* const kOrtSessionOptionsConfigAllowInterOpSpinning = "session.inter_op.allow_spinning";
-static const char* const kOrtSessionOptionsConfigAllowIntraOpSpinning = "session.intra_op.allow_spinning";
-
-// Key for using model bytes directly for ORT format
-// If a session is created using an input byte array contains the ORT format model data,
-// By default we will copy the model bytes at the time of session creation to ensure the model bytes
-// buffer is valid.
-// Setting this option to "1" will disable copy the model bytes, and use the model bytes directly. The caller
-// has to guarantee that the model bytes are valid until the ORT session using the model bytes is destroyed.
-static const char* const kOrtSessionOptionsConfigUseORTModelBytesDirectly = "session.use_ort_model_bytes_directly";
-
-/// <summary>
-/// Key for using the ORT format model flatbuffer bytes directly for initializers.
-/// This avoids copying the bytes and reduces peak memory usage during model loading and initialization.
-/// Requires `session.use_ort_model_bytes_directly` to be true.
-/// If set, the flatbuffer bytes provided when creating the InferenceSession MUST remain valid for the entire
-/// duration of the InferenceSession.
-/// </summary>
-static const char* const kOrtSessionOptionsConfigUseORTModelBytesForInitializers =
- "session.use_ort_model_bytes_for_initializers";
-
-// This should only be specified when exporting an ORT format model for use on a different platform.
-// If the ORT format model will be used on ARM platforms set to "1". For other platforms set to "0"
-// Available since version 1.11.
-static const char* const kOrtSessionOptionsQDQIsInt8Allowed = "session.qdqisint8allowed";
-
-// x64 SSE4.1/AVX2/AVX512(with no VNNI) has overflow problem with quantizied matrix multiplication with U8S8.
-// To avoid this we need to use slower U8U8 matrix multiplication instead. This option, if
-// turned on, use slower U8U8 matrix multiplications. Only effective with AVX2 or AVX512
-// platforms.
-static const char* const kOrtSessionOptionsAvx2PrecisionMode = "session.x64quantprecision";
-
-// Specifies how minimal build graph optimizations are handled in a full build.
-// These optimizations are at the extended level or higher.
-// Possible values and their effects are:
-// "save": Save runtime optimizations when saving an ORT format model.
-// "apply": Only apply optimizations available in a minimal build.
-// ""/<unspecified>: Apply optimizations available in a full build.
-// Available since version 1.11.
-static const char* const kOrtSessionOptionsConfigMinimalBuildOptimizations =
- "optimization.minimal_build_optimizations";
-
-// Note: The options specific to an EP should be specified prior to appending that EP to the session options object in
-// order for them to take effect.
-
-// Specifies a list of stop op types. Nodes of a type in the stop op types and nodes downstream from them will not be
-// run by the NNAPI EP.
-// The value should be a ","-delimited list of op types. For example, "Add,Sub".
-// If not specified, the default set of stop ops is used. To specify an empty stop ops types list and disable stop op
-// exclusion, set the value to "".
-static const char* const kOrtSessionOptionsConfigNnapiEpPartitioningStopOps = "ep.nnapi.partitioning_stop_ops";
-
-// Enabling dynamic block-sizing for multithreading.
-// With a positive value, thread pool will split a task of N iterations to blocks of size starting from:
-// N / (num_of_threads * dynamic_block_base)
-// As execution progresses, the size will decrease according to the diminishing residual of N,
-// meaning the task will be distributed in smaller granularity for better parallelism.
-// For some models, it helps to reduce the variance of E2E inference latency and boost performance.
-// The feature will not function by default, specify any positive integer, e.g. "4", to enable it.
-// Available since version 1.11.
-static const char* const kOrtSessionOptionsConfigDynamicBlockBase = "session.dynamic_block_base";
-
-// This option allows to decrease CPU usage between infrequent
-// requests and forces any TP threads spinning stop immediately when the last of
-// concurrent Run() call returns.
-// Spinning is restarted on the next Run() call.
-// Applies only to internal thread-pools
-static const char* const kOrtSessionOptionsConfigForceSpinningStop = "session.force_spinning_stop";
-
-// "1": all inconsistencies encountered during shape and type inference
-// will result in failures.
-// "0": in some cases warnings will be logged but processing will continue. The default.
-// May be useful to expose bugs in models.
-static const char* const kOrtSessionOptionsConfigStrictShapeTypeInference = "session.strict_shape_type_inference";
-
-// The file saves configuration for partitioning node among logic streams
-static const char* const kNodePartitionConfigFile = "session.node_partition_config_file";
-
-// This Option allows setting affinities for intra op threads.
-// Affinity string follows format:
-// logical_processor_id,logical_processor_id;logical_processor_id,logical_processor_id
-// Semicolon isolates configurations among threads, while comma split processors where ith thread expected to attach to.
-// e.g.1,2,3;4,5
-// specifies affinities for two threads, with the 1st thread attach to the 1st, 2nd, and 3rd processor, and 2nd thread to the 4th and 5th.
-// To ease the configuration, an "interval" is also allowed:
-// e.g. 1-8;8-16;17-24
-// orders that the 1st thread runs on first eight processors, 2nd thread runs on next eight processors, and so forth.
-// Note:
-// 1. Once set, the number of thread affinities must equal to intra_op_num_threads - 1, since ort does not set affinity on the main thread which
-// is started and managed by the calling app;
-// 2. For windows, ort will infer the group id from a logical processor id, for example, assuming there are two groups with each has 64 logical processors,
-// an id of 64 will be inferred as the last processor of the 1st group, while 65 will be interpreted as the 1st processor of the second group.
-// Hence 64-65 is an invalid configuration, because a windows thread cannot be attached to processors across group boundary.
-static const char* const kOrtSessionOptionsConfigIntraOpThreadAffinities = "session.intra_op_thread_affinities";
diff --git a/funasr/runtime/onnxruntime/win/include/provider_options.h b/funasr/runtime/onnxruntime/win/include/provider_options.h
deleted file mode 100644
index aab13e8..0000000
--- a/funasr/runtime/onnxruntime/win/include/provider_options.h
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-#pragma once
-
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-namespace onnxruntime {
-
-// data types for execution provider options
-
-using ProviderOptions = std::unordered_map<std::string, std::string>;
-using ProviderOptionsVector = std::vector<ProviderOptions>;
-using ProviderOptionsMap = std::unordered_map<std::string, ProviderOptions>;
-
-} // namespace onnxruntime
diff --git a/funasr/runtime/onnxruntime/win/include/tensorrt_provider_factory.h b/funasr/runtime/onnxruntime/win/include/tensorrt_provider_factory.h
deleted file mode 100644
index 44debc9..0000000
--- a/funasr/runtime/onnxruntime/win/include/tensorrt_provider_factory.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-#include "onnxruntime_c_api.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_Tensorrt, _In_ OrtSessionOptions* options, int device_id);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/funasr/runtime/onnxruntime/win/lib/x64/libfftw3-3.def b/funasr/runtime/onnxruntime/win/lib/x64/libfftw3-3.def
deleted file mode 100644
index 4b50ecd..0000000
--- a/funasr/runtime/onnxruntime/win/lib/x64/libfftw3-3.def
+++ /dev/null
@@ -1,1017 +0,0 @@
-LIBRARY libfftw3-3.dll
-EXPORTS
-dfftw_cleanup_
-dfftw_cleanup__
-dfftw_cleanup_threads_
-dfftw_cleanup_threads__
-dfftw_cost_
-dfftw_cost__
-dfftw_destroy_plan_
-dfftw_destroy_plan__
-dfftw_estimate_cost_
-dfftw_estimate_cost__
-dfftw_execute_
-dfftw_execute__
-dfftw_execute_dft_
-dfftw_execute_dft__
-dfftw_execute_dft_c2r_
-dfftw_execute_dft_c2r__
-dfftw_execute_dft_r2c_
-dfftw_execute_dft_r2c__
-dfftw_execute_r2r_
-dfftw_execute_r2r__
-dfftw_execute_split_dft_
-dfftw_execute_split_dft__
-dfftw_execute_split_dft_c2r_
-dfftw_execute_split_dft_c2r__
-dfftw_execute_split_dft_r2c_
-dfftw_execute_split_dft_r2c__
-dfftw_export_wisdom_
-dfftw_export_wisdom__
-dfftw_flops_
-dfftw_flops__
-dfftw_forget_wisdom_
-dfftw_forget_wisdom__
-dfftw_import_system_wisdom_
-dfftw_import_system_wisdom__
-dfftw_import_wisdom_
-dfftw_import_wisdom__
-dfftw_init_threads_
-dfftw_init_threads__
-dfftw_plan_dft_
-dfftw_plan_dft__
-dfftw_plan_dft_1d_
-dfftw_plan_dft_1d__
-dfftw_plan_dft_2d_
-dfftw_plan_dft_2d__
-dfftw_plan_dft_3d_
-dfftw_plan_dft_3d__
-dfftw_plan_dft_c2r_
-dfftw_plan_dft_c2r__
-dfftw_plan_dft_c2r_1d_
-dfftw_plan_dft_c2r_1d__
-dfftw_plan_dft_c2r_2d_
-dfftw_plan_dft_c2r_2d__
-dfftw_plan_dft_c2r_3d_
-dfftw_plan_dft_c2r_3d__
-dfftw_plan_dft_r2c_
-dfftw_plan_dft_r2c__
-dfftw_plan_dft_r2c_1d_
-dfftw_plan_dft_r2c_1d__
-dfftw_plan_dft_r2c_2d_
-dfftw_plan_dft_r2c_2d__
-dfftw_plan_dft_r2c_3d_
-dfftw_plan_dft_r2c_3d__
-dfftw_plan_guru_dft_
-dfftw_plan_guru_dft__
-dfftw_plan_guru_dft_c2r_
-dfftw_plan_guru_dft_c2r__
-dfftw_plan_guru_dft_r2c_
-dfftw_plan_guru_dft_r2c__
-dfftw_plan_guru_r2r_
-dfftw_plan_guru_r2r__
-dfftw_plan_guru_split_dft_
-dfftw_plan_guru_split_dft__
-dfftw_plan_guru_split_dft_c2r_
-dfftw_plan_guru_split_dft_c2r__
-dfftw_plan_guru_split_dft_r2c_
-dfftw_plan_guru_split_dft_r2c__
-dfftw_plan_many_dft_
-dfftw_plan_many_dft__
-dfftw_plan_many_dft_c2r_
-dfftw_plan_many_dft_c2r__
-dfftw_plan_many_dft_r2c_
-dfftw_plan_many_dft_r2c__
-dfftw_plan_many_r2r_
-dfftw_plan_many_r2r__
-dfftw_plan_r2r_
-dfftw_plan_r2r__
-dfftw_plan_r2r_1d_
-dfftw_plan_r2r_1d__
-dfftw_plan_r2r_2d_
-dfftw_plan_r2r_2d__
-dfftw_plan_r2r_3d_
-dfftw_plan_r2r_3d__
-dfftw_plan_with_nthreads_
-dfftw_plan_with_nthreads__
-dfftw_print_plan_
-dfftw_print_plan__
-dfftw_set_timelimit_
-dfftw_set_timelimit__
-fftw_alignment_of
-fftw_alloc_complex
-fftw_alloc_real
-fftw_assertion_failed
-fftw_bufdist
-fftw_check_alignment_of_sse2_pm
-fftw_choose_radix
-fftw_cleanup
-fftw_cleanup_threads
-fftw_codelet_e01_8
-fftw_codelet_e10_8
-fftw_codelet_hb_10
-fftw_codelet_hb_12
-fftw_codelet_hb_15
-fftw_codelet_hb_16
-fftw_codelet_hb_2
-fftw_codelet_hb_20
-fftw_codelet_hb2_16
-fftw_codelet_hb2_20
-fftw_codelet_hb2_25
-fftw_codelet_hb2_32
-fftw_codelet_hb2_4
-fftw_codelet_hb_25
-fftw_codelet_hb2_5
-fftw_codelet_hb2_8
-fftw_codelet_hb_3
-fftw_codelet_hb_32
-fftw_codelet_hb_4
-fftw_codelet_hb_5
-fftw_codelet_hb_6
-fftw_codelet_hb_64
-fftw_codelet_hb_7
-fftw_codelet_hb_8
-fftw_codelet_hb_9
-fftw_codelet_hc2cb_10
-fftw_codelet_hc2cb_12
-fftw_codelet_hc2cb_16
-fftw_codelet_hc2cb_2
-fftw_codelet_hc2cb_20
-fftw_codelet_hc2cb2_16
-fftw_codelet_hc2cb2_20
-fftw_codelet_hc2cb2_32
-fftw_codelet_hc2cb2_4
-fftw_codelet_hc2cb2_8
-fftw_codelet_hc2cb_32
-fftw_codelet_hc2cb_4
-fftw_codelet_hc2cb_6
-fftw_codelet_hc2cb_8
-fftw_codelet_hc2cbdft_10
-fftw_codelet_hc2cbdft_12
-fftw_codelet_hc2cbdft_16
-fftw_codelet_hc2cbdft_2
-fftw_codelet_hc2cbdft_20
-fftw_codelet_hc2cbdft2_16
-fftw_codelet_hc2cbdft2_20
-fftw_codelet_hc2cbdft2_32
-fftw_codelet_hc2cbdft2_4
-fftw_codelet_hc2cbdft2_8
-fftw_codelet_hc2cbdft_32
-fftw_codelet_hc2cbdft_4
-fftw_codelet_hc2cbdft_6
-fftw_codelet_hc2cbdft_8
-fftw_codelet_hc2cbdftv_10_avx
-fftw_codelet_hc2cbdftv_10_sse2
-fftw_codelet_hc2cbdftv_12_avx
-fftw_codelet_hc2cbdftv_12_sse2
-fftw_codelet_hc2cbdftv_16_avx
-fftw_codelet_hc2cbdftv_16_sse2
-fftw_codelet_hc2cbdftv_20_avx
-fftw_codelet_hc2cbdftv_20_sse2
-fftw_codelet_hc2cbdftv_2_avx
-fftw_codelet_hc2cbdftv_2_sse2
-fftw_codelet_hc2cbdftv_32_avx
-fftw_codelet_hc2cbdftv_32_sse2
-fftw_codelet_hc2cbdftv_4_avx
-fftw_codelet_hc2cbdftv_4_sse2
-fftw_codelet_hc2cbdftv_6_avx
-fftw_codelet_hc2cbdftv_6_sse2
-fftw_codelet_hc2cbdftv_8_avx
-fftw_codelet_hc2cbdftv_8_sse2
-fftw_codelet_hc2cf_10
-fftw_codelet_hc2cf_12
-fftw_codelet_hc2cf_16
-fftw_codelet_hc2cf_2
-fftw_codelet_hc2cf_20
-fftw_codelet_hc2cf2_16
-fftw_codelet_hc2cf2_20
-fftw_codelet_hc2cf2_32
-fftw_codelet_hc2cf2_4
-fftw_codelet_hc2cf2_8
-fftw_codelet_hc2cf_32
-fftw_codelet_hc2cf_4
-fftw_codelet_hc2cf_6
-fftw_codelet_hc2cf_8
-fftw_codelet_hc2cfdft_10
-fftw_codelet_hc2cfdft_12
-fftw_codelet_hc2cfdft_16
-fftw_codelet_hc2cfdft_2
-fftw_codelet_hc2cfdft_20
-fftw_codelet_hc2cfdft2_16
-fftw_codelet_hc2cfdft2_20
-fftw_codelet_hc2cfdft2_32
-fftw_codelet_hc2cfdft2_4
-fftw_codelet_hc2cfdft2_8
-fftw_codelet_hc2cfdft_32
-fftw_codelet_hc2cfdft_4
-fftw_codelet_hc2cfdft_6
-fftw_codelet_hc2cfdft_8
-fftw_codelet_hc2cfdftv_10_avx
-fftw_codelet_hc2cfdftv_10_sse2
-fftw_codelet_hc2cfdftv_12_avx
-fftw_codelet_hc2cfdftv_12_sse2
-fftw_codelet_hc2cfdftv_16_avx
-fftw_codelet_hc2cfdftv_16_sse2
-fftw_codelet_hc2cfdftv_20_avx
-fftw_codelet_hc2cfdftv_20_sse2
-fftw_codelet_hc2cfdftv_2_avx
-fftw_codelet_hc2cfdftv_2_sse2
-fftw_codelet_hc2cfdftv_32_avx
-fftw_codelet_hc2cfdftv_32_sse2
-fftw_codelet_hc2cfdftv_4_avx
-fftw_codelet_hc2cfdftv_4_sse2
-fftw_codelet_hc2cfdftv_6_avx
-fftw_codelet_hc2cfdftv_6_sse2
-fftw_codelet_hc2cfdftv_8_avx
-fftw_codelet_hc2cfdftv_8_sse2
-fftw_codelet_hf_10
-fftw_codelet_hf_12
-fftw_codelet_hf_15
-fftw_codelet_hf_16
-fftw_codelet_hf_2
-fftw_codelet_hf_20
-fftw_codelet_hf2_16
-fftw_codelet_hf2_20
-fftw_codelet_hf2_25
-fftw_codelet_hf2_32
-fftw_codelet_hf2_4
-fftw_codelet_hf_25
-fftw_codelet_hf2_5
-fftw_codelet_hf2_8
-fftw_codelet_hf_3
-fftw_codelet_hf_32
-fftw_codelet_hf_4
-fftw_codelet_hf_5
-fftw_codelet_hf_6
-fftw_codelet_hf_64
-fftw_codelet_hf_7
-fftw_codelet_hf_8
-fftw_codelet_hf_9
-fftw_codelet_n1_10
-fftw_codelet_n1_11
-fftw_codelet_n1_12
-fftw_codelet_n1_13
-fftw_codelet_n1_14
-fftw_codelet_n1_15
-fftw_codelet_n1_16
-fftw_codelet_n1_2
-fftw_codelet_n1_20
-fftw_codelet_n1_25
-fftw_codelet_n1_3
-fftw_codelet_n1_32
-fftw_codelet_n1_4
-fftw_codelet_n1_5
-fftw_codelet_n1_6
-fftw_codelet_n1_64
-fftw_codelet_n1_7
-fftw_codelet_n1_8
-fftw_codelet_n1_9
-fftw_codelet_n1bv_10_avx
-fftw_codelet_n1bv_10_sse2
-fftw_codelet_n1bv_11_avx
-fftw_codelet_n1bv_11_sse2
-fftw_codelet_n1bv_128_avx
-fftw_codelet_n1bv_128_sse2
-fftw_codelet_n1bv_12_avx
-fftw_codelet_n1bv_12_sse2
-fftw_codelet_n1bv_13_avx
-fftw_codelet_n1bv_13_sse2
-fftw_codelet_n1bv_14_avx
-fftw_codelet_n1bv_14_sse2
-fftw_codelet_n1bv_15_avx
-fftw_codelet_n1bv_15_sse2
-fftw_codelet_n1bv_16_avx
-fftw_codelet_n1bv_16_sse2
-fftw_codelet_n1bv_20_avx
-fftw_codelet_n1bv_20_sse2
-fftw_codelet_n1bv_25_avx
-fftw_codelet_n1bv_25_sse2
-fftw_codelet_n1bv_2_avx
-fftw_codelet_n1bv_2_sse2
-fftw_codelet_n1bv_32_avx
-fftw_codelet_n1bv_32_sse2
-fftw_codelet_n1bv_3_avx
-fftw_codelet_n1bv_3_sse2
-fftw_codelet_n1bv_4_avx
-fftw_codelet_n1bv_4_sse2
-fftw_codelet_n1bv_5_avx
-fftw_codelet_n1bv_5_sse2
-fftw_codelet_n1bv_64_avx
-fftw_codelet_n1bv_64_sse2
-fftw_codelet_n1bv_6_avx
-fftw_codelet_n1bv_6_sse2
-fftw_codelet_n1bv_7_avx
-fftw_codelet_n1bv_7_sse2
-fftw_codelet_n1bv_8_avx
-fftw_codelet_n1bv_8_sse2
-fftw_codelet_n1bv_9_avx
-fftw_codelet_n1bv_9_sse2
-fftw_codelet_n1fv_10_avx
-fftw_codelet_n1fv_10_sse2
-fftw_codelet_n1fv_11_avx
-fftw_codelet_n1fv_11_sse2
-fftw_codelet_n1fv_128_avx
-fftw_codelet_n1fv_128_sse2
-fftw_codelet_n1fv_12_avx
-fftw_codelet_n1fv_12_sse2
-fftw_codelet_n1fv_13_avx
-fftw_codelet_n1fv_13_sse2
-fftw_codelet_n1fv_14_avx
-fftw_codelet_n1fv_14_sse2
-fftw_codelet_n1fv_15_avx
-fftw_codelet_n1fv_15_sse2
-fftw_codelet_n1fv_16_avx
-fftw_codelet_n1fv_16_sse2
-fftw_codelet_n1fv_20_avx
-fftw_codelet_n1fv_20_sse2
-fftw_codelet_n1fv_25_avx
-fftw_codelet_n1fv_25_sse2
-fftw_codelet_n1fv_2_avx
-fftw_codelet_n1fv_2_sse2
-fftw_codelet_n1fv_32_avx
-fftw_codelet_n1fv_32_sse2
-fftw_codelet_n1fv_3_avx
-fftw_codelet_n1fv_3_sse2
-fftw_codelet_n1fv_4_avx
-fftw_codelet_n1fv_4_sse2
-fftw_codelet_n1fv_5_avx
-fftw_codelet_n1fv_5_sse2
-fftw_codelet_n1fv_64_avx
-fftw_codelet_n1fv_64_sse2
-fftw_codelet_n1fv_6_avx
-fftw_codelet_n1fv_6_sse2
-fftw_codelet_n1fv_7_avx
-fftw_codelet_n1fv_7_sse2
-fftw_codelet_n1fv_8_avx
-fftw_codelet_n1fv_8_sse2
-fftw_codelet_n1fv_9_avx
-fftw_codelet_n1fv_9_sse2
-fftw_codelet_n2bv_10_avx
-fftw_codelet_n2bv_10_sse2
-fftw_codelet_n2bv_12_avx
-fftw_codelet_n2bv_12_sse2
-fftw_codelet_n2bv_14_avx
-fftw_codelet_n2bv_14_sse2
-fftw_codelet_n2bv_16_avx
-fftw_codelet_n2bv_16_sse2
-fftw_codelet_n2bv_20_avx
-fftw_codelet_n2bv_20_sse2
-fftw_codelet_n2bv_2_avx
-fftw_codelet_n2bv_2_sse2
-fftw_codelet_n2bv_32_avx
-fftw_codelet_n2bv_32_sse2
-fftw_codelet_n2bv_4_avx
-fftw_codelet_n2bv_4_sse2
-fftw_codelet_n2bv_64_avx
-fftw_codelet_n2bv_64_sse2
-fftw_codelet_n2bv_6_avx
-fftw_codelet_n2bv_6_sse2
-fftw_codelet_n2bv_8_avx
-fftw_codelet_n2bv_8_sse2
-fftw_codelet_n2fv_10_avx
-fftw_codelet_n2fv_10_sse2
-fftw_codelet_n2fv_12_avx
-fftw_codelet_n2fv_12_sse2
-fftw_codelet_n2fv_14_avx
-fftw_codelet_n2fv_14_sse2
-fftw_codelet_n2fv_16_avx
-fftw_codelet_n2fv_16_sse2
-fftw_codelet_n2fv_20_avx
-fftw_codelet_n2fv_20_sse2
-fftw_codelet_n2fv_2_avx
-fftw_codelet_n2fv_2_sse2
-fftw_codelet_n2fv_32_avx
-fftw_codelet_n2fv_32_sse2
-fftw_codelet_n2fv_4_avx
-fftw_codelet_n2fv_4_sse2
-fftw_codelet_n2fv_64_avx
-fftw_codelet_n2fv_64_sse2
-fftw_codelet_n2fv_6_avx
-fftw_codelet_n2fv_6_sse2
-fftw_codelet_n2fv_8_avx
-fftw_codelet_n2fv_8_sse2
-fftw_codelet_n2sv_16_avx
-fftw_codelet_n2sv_16_sse2
-fftw_codelet_n2sv_32_avx
-fftw_codelet_n2sv_32_sse2
-fftw_codelet_n2sv_4_avx
-fftw_codelet_n2sv_4_sse2
-fftw_codelet_n2sv_64_avx
-fftw_codelet_n2sv_64_sse2
-fftw_codelet_n2sv_8_avx
-fftw_codelet_n2sv_8_sse2
-fftw_codelet_q1_2
-fftw_codelet_q1_3
-fftw_codelet_q1_4
-fftw_codelet_q1_5
-fftw_codelet_q1_6
-fftw_codelet_q1_8
-fftw_codelet_q1bv_2_avx
-fftw_codelet_q1bv_2_sse2
-fftw_codelet_q1bv_4_avx
-fftw_codelet_q1bv_4_sse2
-fftw_codelet_q1bv_5_avx
-fftw_codelet_q1bv_5_sse2
-fftw_codelet_q1bv_8_avx
-fftw_codelet_q1bv_8_sse2
-fftw_codelet_q1fv_2_avx
-fftw_codelet_q1fv_2_sse2
-fftw_codelet_q1fv_4_avx
-fftw_codelet_q1fv_4_sse2
-fftw_codelet_q1fv_5_avx
-fftw_codelet_q1fv_5_sse2
-fftw_codelet_q1fv_8_avx
-fftw_codelet_q1fv_8_sse2
-fftw_codelet_r2cb_10
-fftw_codelet_r2cb_11
-fftw_codelet_r2cb_12
-fftw_codelet_r2cb_128
-fftw_codelet_r2cb_13
-fftw_codelet_r2cb_14
-fftw_codelet_r2cb_15
-fftw_codelet_r2cb_16
-fftw_codelet_r2cb_2
-fftw_codelet_r2cb_20
-fftw_codelet_r2cb_25
-fftw_codelet_r2cb_3
-fftw_codelet_r2cb_32
-fftw_codelet_r2cb_4
-fftw_codelet_r2cb_5
-fftw_codelet_r2cb_6
-fftw_codelet_r2cb_64
-fftw_codelet_r2cb_7
-fftw_codelet_r2cb_8
-fftw_codelet_r2cb_9
-fftw_codelet_r2cbIII_10
-fftw_codelet_r2cbIII_12
-fftw_codelet_r2cbIII_15
-fftw_codelet_r2cbIII_16
-fftw_codelet_r2cbIII_2
-fftw_codelet_r2cbIII_20
-fftw_codelet_r2cbIII_25
-fftw_codelet_r2cbIII_3
-fftw_codelet_r2cbIII_32
-fftw_codelet_r2cbIII_4
-fftw_codelet_r2cbIII_5
-fftw_codelet_r2cbIII_6
-fftw_codelet_r2cbIII_64
-fftw_codelet_r2cbIII_7
-fftw_codelet_r2cbIII_8
-fftw_codelet_r2cbIII_9
-fftw_codelet_r2cf_10
-fftw_codelet_r2cf_11
-fftw_codelet_r2cf_12
-fftw_codelet_r2cf_128
-fftw_codelet_r2cf_13
-fftw_codelet_r2cf_14
-fftw_codelet_r2cf_15
-fftw_codelet_r2cf_16
-fftw_codelet_r2cf_2
-fftw_codelet_r2cf_20
-fftw_codelet_r2cf_25
-fftw_codelet_r2cf_3
-fftw_codelet_r2cf_32
-fftw_codelet_r2cf_4
-fftw_codelet_r2cf_5
-fftw_codelet_r2cf_6
-fftw_codelet_r2cf_64
-fftw_codelet_r2cf_7
-fftw_codelet_r2cf_8
-fftw_codelet_r2cf_9
-fftw_codelet_r2cfII_10
-fftw_codelet_r2cfII_12
-fftw_codelet_r2cfII_15
-fftw_codelet_r2cfII_16
-fftw_codelet_r2cfII_2
-fftw_codelet_r2cfII_20
-fftw_codelet_r2cfII_25
-fftw_codelet_r2cfII_3
-fftw_codelet_r2cfII_32
-fftw_codelet_r2cfII_4
-fftw_codelet_r2cfII_5
-fftw_codelet_r2cfII_6
-fftw_codelet_r2cfII_64
-fftw_codelet_r2cfII_7
-fftw_codelet_r2cfII_8
-fftw_codelet_r2cfII_9
-fftw_codelet_t1_10
-fftw_codelet_t1_12
-fftw_codelet_t1_15
-fftw_codelet_t1_16
-fftw_codelet_t1_2
-fftw_codelet_t1_20
-fftw_codelet_t1_25
-fftw_codelet_t1_3
-fftw_codelet_t1_32
-fftw_codelet_t1_4
-fftw_codelet_t1_5
-fftw_codelet_t1_6
-fftw_codelet_t1_64
-fftw_codelet_t1_7
-fftw_codelet_t1_8
-fftw_codelet_t1_9
-fftw_codelet_t1buv_10_avx
-fftw_codelet_t1buv_10_sse2
-fftw_codelet_t1buv_2_avx
-fftw_codelet_t1buv_2_sse2
-fftw_codelet_t1buv_3_avx
-fftw_codelet_t1buv_3_sse2
-fftw_codelet_t1buv_4_avx
-fftw_codelet_t1buv_4_sse2
-fftw_codelet_t1buv_5_avx
-fftw_codelet_t1buv_5_sse2
-fftw_codelet_t1buv_6_avx
-fftw_codelet_t1buv_6_sse2
-fftw_codelet_t1buv_7_avx
-fftw_codelet_t1buv_7_sse2
-fftw_codelet_t1buv_8_avx
-fftw_codelet_t1buv_8_sse2
-fftw_codelet_t1buv_9_avx
-fftw_codelet_t1buv_9_sse2
-fftw_codelet_t1bv_10_avx
-fftw_codelet_t1bv_10_sse2
-fftw_codelet_t1bv_12_avx
-fftw_codelet_t1bv_12_sse2
-fftw_codelet_t1bv_15_avx
-fftw_codelet_t1bv_15_sse2
-fftw_codelet_t1bv_16_avx
-fftw_codelet_t1bv_16_sse2
-fftw_codelet_t1bv_20_avx
-fftw_codelet_t1bv_20_sse2
-fftw_codelet_t1bv_25_avx
-fftw_codelet_t1bv_25_sse2
-fftw_codelet_t1bv_2_avx
-fftw_codelet_t1bv_2_sse2
-fftw_codelet_t1bv_32_avx
-fftw_codelet_t1bv_32_sse2
-fftw_codelet_t1bv_3_avx
-fftw_codelet_t1bv_3_sse2
-fftw_codelet_t1bv_4_avx
-fftw_codelet_t1bv_4_sse2
-fftw_codelet_t1bv_5_avx
-fftw_codelet_t1bv_5_sse2
-fftw_codelet_t1bv_64_avx
-fftw_codelet_t1bv_64_sse2
-fftw_codelet_t1bv_6_avx
-fftw_codelet_t1bv_6_sse2
-fftw_codelet_t1bv_7_avx
-fftw_codelet_t1bv_7_sse2
-fftw_codelet_t1bv_8_avx
-fftw_codelet_t1bv_8_sse2
-fftw_codelet_t1bv_9_avx
-fftw_codelet_t1bv_9_sse2
-fftw_codelet_t1fuv_10_avx
-fftw_codelet_t1fuv_10_sse2
-fftw_codelet_t1fuv_2_avx
-fftw_codelet_t1fuv_2_sse2
-fftw_codelet_t1fuv_3_avx
-fftw_codelet_t1fuv_3_sse2
-fftw_codelet_t1fuv_4_avx
-fftw_codelet_t1fuv_4_sse2
-fftw_codelet_t1fuv_5_avx
-fftw_codelet_t1fuv_5_sse2
-fftw_codelet_t1fuv_6_avx
-fftw_codelet_t1fuv_6_sse2
-fftw_codelet_t1fuv_7_avx
-fftw_codelet_t1fuv_7_sse2
-fftw_codelet_t1fuv_8_avx
-fftw_codelet_t1fuv_8_sse2
-fftw_codelet_t1fuv_9_avx
-fftw_codelet_t1fuv_9_sse2
-fftw_codelet_t1fv_10_avx
-fftw_codelet_t1fv_10_sse2
-fftw_codelet_t1fv_12_avx
-fftw_codelet_t1fv_12_sse2
-fftw_codelet_t1fv_15_avx
-fftw_codelet_t1fv_15_sse2
-fftw_codelet_t1fv_16_avx
-fftw_codelet_t1fv_16_sse2
-fftw_codelet_t1fv_20_avx
-fftw_codelet_t1fv_20_sse2
-fftw_codelet_t1fv_25_avx
-fftw_codelet_t1fv_25_sse2
-fftw_codelet_t1fv_2_avx
-fftw_codelet_t1fv_2_sse2
-fftw_codelet_t1fv_32_avx
-fftw_codelet_t1fv_32_sse2
-fftw_codelet_t1fv_3_avx
-fftw_codelet_t1fv_3_sse2
-fftw_codelet_t1fv_4_avx
-fftw_codelet_t1fv_4_sse2
-fftw_codelet_t1fv_5_avx
-fftw_codelet_t1fv_5_sse2
-fftw_codelet_t1fv_64_avx
-fftw_codelet_t1fv_64_sse2
-fftw_codelet_t1fv_6_avx
-fftw_codelet_t1fv_6_sse2
-fftw_codelet_t1fv_7_avx
-fftw_codelet_t1fv_7_sse2
-fftw_codelet_t1fv_8_avx
-fftw_codelet_t1fv_8_sse2
-fftw_codelet_t1fv_9_avx
-fftw_codelet_t1fv_9_sse2
-fftw_codelet_t1sv_16_avx
-fftw_codelet_t1sv_16_sse2
-fftw_codelet_t1sv_2_avx
-fftw_codelet_t1sv_2_sse2
-fftw_codelet_t1sv_32_avx
-fftw_codelet_t1sv_32_sse2
-fftw_codelet_t1sv_4_avx
-fftw_codelet_t1sv_4_sse2
-fftw_codelet_t1sv_8_avx
-fftw_codelet_t1sv_8_sse2
-fftw_codelet_t2_10
-fftw_codelet_t2_16
-fftw_codelet_t2_20
-fftw_codelet_t2_25
-fftw_codelet_t2_32
-fftw_codelet_t2_4
-fftw_codelet_t2_5
-fftw_codelet_t2_64
-fftw_codelet_t2_8
-fftw_codelet_t2bv_10_avx
-fftw_codelet_t2bv_10_sse2
-fftw_codelet_t2bv_16_avx
-fftw_codelet_t2bv_16_sse2
-fftw_codelet_t2bv_20_avx
-fftw_codelet_t2bv_20_sse2
-fftw_codelet_t2bv_25_avx
-fftw_codelet_t2bv_25_sse2
-fftw_codelet_t2bv_2_avx
-fftw_codelet_t2bv_2_sse2
-fftw_codelet_t2bv_32_avx
-fftw_codelet_t2bv_32_sse2
-fftw_codelet_t2bv_4_avx
-fftw_codelet_t2bv_4_sse2
-fftw_codelet_t2bv_5_avx
-fftw_codelet_t2bv_5_sse2
-fftw_codelet_t2bv_64_avx
-fftw_codelet_t2bv_64_sse2
-fftw_codelet_t2bv_8_avx
-fftw_codelet_t2bv_8_sse2
-fftw_codelet_t2fv_10_avx
-fftw_codelet_t2fv_10_sse2
-fftw_codelet_t2fv_16_avx
-fftw_codelet_t2fv_16_sse2
-fftw_codelet_t2fv_20_avx
-fftw_codelet_t2fv_20_sse2
-fftw_codelet_t2fv_25_avx
-fftw_codelet_t2fv_25_sse2
-fftw_codelet_t2fv_2_avx
-fftw_codelet_t2fv_2_sse2
-fftw_codelet_t2fv_32_avx
-fftw_codelet_t2fv_32_sse2
-fftw_codelet_t2fv_4_avx
-fftw_codelet_t2fv_4_sse2
-fftw_codelet_t2fv_5_avx
-fftw_codelet_t2fv_5_sse2
-fftw_codelet_t2fv_64_avx
-fftw_codelet_t2fv_64_sse2
-fftw_codelet_t2fv_8_avx
-fftw_codelet_t2fv_8_sse2
-fftw_codelet_t2sv_16_avx
-fftw_codelet_t2sv_16_sse2
-fftw_codelet_t2sv_32_avx
-fftw_codelet_t2sv_32_sse2
-fftw_codelet_t2sv_4_avx
-fftw_codelet_t2sv_4_sse2
-fftw_codelet_t2sv_8_avx
-fftw_codelet_t2sv_8_sse2
-fftw_codelet_t3bv_10_avx
-fftw_codelet_t3bv_10_sse2
-fftw_codelet_t3bv_16_avx
-fftw_codelet_t3bv_16_sse2
-fftw_codelet_t3bv_20_avx
-fftw_codelet_t3bv_20_sse2
-fftw_codelet_t3bv_25_avx
-fftw_codelet_t3bv_25_sse2
-fftw_codelet_t3bv_32_avx
-fftw_codelet_t3bv_32_sse2
-fftw_codelet_t3bv_4_avx
-fftw_codelet_t3bv_4_sse2
-fftw_codelet_t3bv_5_avx
-fftw_codelet_t3bv_5_sse2
-fftw_codelet_t3bv_8_avx
-fftw_codelet_t3bv_8_sse2
-fftw_codelet_t3fv_10_avx
-fftw_codelet_t3fv_10_sse2
-fftw_codelet_t3fv_16_avx
-fftw_codelet_t3fv_16_sse2
-fftw_codelet_t3fv_20_avx
-fftw_codelet_t3fv_20_sse2
-fftw_codelet_t3fv_25_avx
-fftw_codelet_t3fv_25_sse2
-fftw_codelet_t3fv_32_avx
-fftw_codelet_t3fv_32_sse2
-fftw_codelet_t3fv_4_avx
-fftw_codelet_t3fv_4_sse2
-fftw_codelet_t3fv_5_avx
-fftw_codelet_t3fv_5_sse2
-fftw_codelet_t3fv_8_avx
-fftw_codelet_t3fv_8_sse2
-fftw_compute_tilesz
-fftw_configure_planner
-fftw_cost
-fftw_cpy1d
-fftw_cpy2d
-fftw_cpy2d_ci
-fftw_cpy2d_co
-fftw_cpy2d_pair
-fftw_cpy2d_pair_ci
-fftw_cpy2d_pair_co
-fftw_cpy2d_tiled
-fftw_cpy2d_tiledbuf
-fftw_ct_applicable
-fftw_ct_genericbuf_register
-fftw_ct_generic_register
-fftw_ct_uglyp
-fftw_destroy_plan
-fftw_dft_bluestein_register
-fftw_dft_buffered_register
-fftw_dft_conf_standard
-fftw_dft_generic_register
-fftw_dft_indirect_register
-fftw_dft_indirect_transpose_register
-fftw_dft_nop_register
-fftw_dft_r2hc_register
-fftw_dft_rader_register
-fftw_dft_rank_geq2_register
-fftw_dft_solve
-fftw_dft_thr_vrank_geq1_register
-fftw_dft_vrank_geq1_register
-fftw_dft_zerotens
-fftw_dht_r2hc_register
-fftw_dht_rader_register
-fftw_dimcmp
-fftw_elapsed_since
-fftw_estimate_cost
-fftw_execute
-fftw_execute_dft
-fftw_execute_dft_c2r
-fftw_execute_dft_r2c
-fftw_execute_r2r
-fftw_execute_split_dft
-fftw_execute_split_dft_c2r
-fftw_execute_split_dft_r2c
-fftw_export_wisdom
-fftw_export_wisdom_to_file
-fftw_export_wisdom_to_filename
-fftw_export_wisdom_to_string
-fftw_extract_reim
-fftw_factors_into
-fftw_factors_into_small_primes
-fftw_find_generator
-fftw_first_divisor
-fftw_flops
-fftw_forget_wisdom
-fftw_fprint_plan
-fftw_free
-fftw_get_crude_time
-fftw_guru64_kosherp
-fftw_guru_kosherp
-fftw_hash
-fftw_have_simd_avx
-fftw_have_simd_sse2
-fftw_hc2hc_applicable
-fftw_hc2hc_generic_register
-fftw_iabs
-fftw_ialignment_of
-fftw_iestimate_cost
-fftw_ifree
-fftw_ifree0
-fftw_imax
-fftw_imin
-fftw_import_system_wisdom
-fftw_import_wisdom
-fftw_import_wisdom_from_file
-fftw_import_wisdom_from_filename
-fftw_import_wisdom_from_string
-fftw_init_threads
-fftw_is_prime
-fftw_isqrt
-fftw_ithreads_init
-fftw_join_taint
-fftw_kdft_dif_register
-fftw_kdft_difsq_register
-fftw_kdft_dit_register
-fftw_kdft_register
-fftw_kernel_free
-fftw_kernel_malloc
-fftw_khc2c_register
-fftw_khc2hc_register
-fftw_kr2c_register
-fftw_kr2r_register
-fftw_make_planner_thread_safe
-fftw_malloc
-fftw_malloc_plain
-fftw_many_kosherp
-fftw_mapflags
-fftw_map_r2r_kind
-fftw_md5begin
-fftw_md5end
-fftw_md5int
-fftw_md5INT
-fftw_md5putb
-fftw_md5putc
-fftw_md5puts
-fftw_md5unsigned
-fftw_measure_execution_time
-fftw_mkapiplan
-fftw_mkplan
-fftw_mkplan_d
-fftw_mkplan_dft
-fftw_mkplan_dftw
-fftw_mkplan_f_d
-fftw_mkplan_hc2c
-fftw_mkplan_hc2hc
-fftw_mkplanner
-fftw_mkplan_rdft
-fftw_mkplan_rdft2
-fftw_mkprinter
-fftw_mkprinter_cnt
-fftw_mkprinter_file
-fftw_mkprinter_str
-fftw_mkproblem
-fftw_mkproblem_dft
-fftw_mkproblem_dft_d
-fftw_mkproblem_rdft
-fftw_mkproblem_rdft_0_d
-fftw_mkproblem_rdft_1
-fftw_mkproblem_rdft_1_d
-fftw_mkproblem_rdft2
-fftw_mkproblem_rdft2_d
-fftw_mkproblem_rdft2_d_3pointers
-fftw_mkproblem_rdft_d
-fftw_mkproblem_unsolvable
-fftw_mkscanner
-fftw_mksolver
-fftw_mksolver_ct
-fftw_mksolver_ct_threads
-fftw_mksolver_dft_direct
-fftw_mksolver_dft_directbuf
-fftw_mksolver_hc2c
-fftw_mksolver_hc2hc
-fftw_mksolver_hc2hc_threads
-fftw_mksolver_rdft2_direct
-fftw_mksolver_rdft_r2c_direct
-fftw_mksolver_rdft_r2c_directbuf
-fftw_mksolver_rdft_r2r_direct
-fftw_mkstride
-fftw_mktensor
-fftw_mktensor_0d
-fftw_mktensor_1d
-fftw_mktensor_2d
-fftw_mktensor_3d
-fftw_mktensor_4d
-fftw_mktensor_5d
-fftw_mktensor_iodims
-fftw_mktensor_iodims64
-fftw_mktensor_rowmajor
-fftw_mktriggen
-fftw_modulo
-fftw_nbuf
-fftw_nbuf_redundant
-fftw_next_prime
-fftw_null_awake
-fftw_ops_add
-fftw_ops_add2
-fftw_ops_cpy
-fftw_ops_madd
-fftw_ops_madd2
-fftw_ops_other
-fftw_ops_zero
-fftw_pickdim
-fftw_plan_awake
-fftw_plan_destroy_internal
-fftw_plan_dft
-fftw_plan_dft_1d
-fftw_plan_dft_2d
-fftw_plan_dft_3d
-fftw_plan_dft_c2r
-fftw_plan_dft_c2r_1d
-fftw_plan_dft_c2r_2d
-fftw_plan_dft_c2r_3d
-fftw_plan_dft_r2c
-fftw_plan_dft_r2c_1d
-fftw_plan_dft_r2c_2d
-fftw_plan_dft_r2c_3d
-fftw_plan_guru64_dft
-fftw_plan_guru64_dft_c2r
-fftw_plan_guru64_dft_r2c
-fftw_plan_guru64_r2r
-fftw_plan_guru64_split_dft
-fftw_plan_guru64_split_dft_c2r
-fftw_plan_guru64_split_dft_r2c
-fftw_plan_guru_dft
-fftw_plan_guru_dft_c2r
-fftw_plan_guru_dft_r2c
-fftw_plan_guru_r2r
-fftw_plan_guru_split_dft
-fftw_plan_guru_split_dft_c2r
-fftw_plan_guru_split_dft_r2c
-fftw_plan_many_dft
-fftw_plan_many_dft_c2r
-fftw_plan_many_dft_r2c
-fftw_plan_many_r2r
-fftw_planner_destroy
-fftw_plan_null_destroy
-fftw_plan_r2r
-fftw_plan_r2r_1d
-fftw_plan_r2r_2d
-fftw_plan_r2r_3d
-fftw_plan_with_nthreads
-fftw_power_mod
-fftw_printer_destroy
-fftw_print_plan
-fftw_problem_destroy
-fftw_rader_tl_delete
-fftw_rader_tl_find
-fftw_rader_tl_insert
-fftw_rdft2_buffered_register
-fftw_rdft2_complex_n
-fftw_rdft2_inplace_strides
-fftw_rdft2_nop_register
-fftw_rdft2_pad
-fftw_rdft2_rank0_register
-fftw_rdft2_rank_geq2_register
-fftw_rdft2_rdft_register
-fftw_rdft2_solve
-fftw_rdft2_strides
-fftw_rdft2_tensor_max_index
-fftw_rdft2_thr_vrank_geq1_register
-fftw_rdft2_vrank_geq1_register
-fftw_rdft_buffered_register
-fftw_rdft_conf_standard
-fftw_rdft_dht_register
-fftw_rdft_generic_register
-fftw_rdft_indirect_register
-fftw_rdft_kind_str
-fftw_rdft_nop_register
-fftw_rdft_rank0_register
-fftw_rdft_rank_geq2_register
-fftw_rdft_solve
-fftw_rdft_thr_vrank_geq1_register
-fftw_rdft_vrank3_transpose_register
-fftw_rdft_vrank_geq1_register
-fftw_rdft_zerotens
-fftw_redft00e_r2hc_pad_register
-fftw_regsolver_ct_directw
-fftw_regsolver_ct_directwsq
-fftw_regsolver_hc2c_direct
-fftw_regsolver_hc2hc_direct
-fftw_reodft00e_splitradix_register
-fftw_reodft010e_r2hc_register
-fftw_reodft11e_r2hc_odd_register
-fftw_reodft11e_radix2_r2hc_register
-fftw_reodft_conf_standard
-fftw_rodft00e_r2hc_pad_register
-fftw_safe_mulmod
-fftw_scanner_destroy
-fftw_set_planner_hooks
-fftw_set_timelimit
-fftw_solver_destroy
-fftw_solver_register
-fftw_solver_use
-fftw_solvtab_exec
-fftw_spawn_loop
-fftw_sprint_plan
-fftw_stride_destroy
-fftw_taint
-fftw_tensor_append
-fftw_tensor_compress
-fftw_tensor_compress_contiguous
-fftw_tensor_copy
-fftw_tensor_copy_except
-fftw_tensor_copy_inplace
-fftw_tensor_copy_sub
-fftw_tensor_destroy
-fftw_tensor_destroy2
-fftw_tensor_destroy4
-fftw_tensor_equal
-fftw_tensor_inplace_locations
-fftw_tensor_inplace_strides
-fftw_tensor_inplace_strides2
-fftw_tensor_kosherp
-fftw_tensor_max_index
-fftw_tensor_md5
-fftw_tensor_min_istride
-fftw_tensor_min_ostride
-fftw_tensor_min_stride
-fftw_tensor_print
-fftw_tensor_split
-fftw_tensor_strides_decrease
-fftw_tensor_sz
-fftw_tensor_tornk1
-fftw_the_planner
-fftw_threads_cleanup
-fftw_threads_conf_standard
-fftw_threads_register_planner_hooks
-fftw_tile2d
-fftw_toobig
-fftw_transpose
-fftw_transpose_tiled
-fftw_transpose_tiledbuf
-fftw_triggen_destroy
-fftw_twiddle_awake
-fftw_twiddle_length
-fftw_zero1d_pair
diff --git a/funasr/runtime/onnxruntime/win/lib/x64/libfftw3-3.exp b/funasr/runtime/onnxruntime/win/lib/x64/libfftw3-3.exp
deleted file mode 100644
index 9ab00ba..0000000
--- a/funasr/runtime/onnxruntime/win/lib/x64/libfftw3-3.exp
+++ /dev/null
Binary files differ
diff --git a/funasr/runtime/onnxruntime/win/lib/x64/libfftw3-3.lib b/funasr/runtime/onnxruntime/win/lib/x64/libfftw3-3.lib
deleted file mode 100644
index 48c4af9..0000000
--- a/funasr/runtime/onnxruntime/win/lib/x64/libfftw3-3.lib
+++ /dev/null
Binary files differ
diff --git a/funasr/runtime/onnxruntime/win/lib/x64/libfftw3f-3.def b/funasr/runtime/onnxruntime/win/lib/x64/libfftw3f-3.def
deleted file mode 100644
index d61a2c3..0000000
--- a/funasr/runtime/onnxruntime/win/lib/x64/libfftw3f-3.def
+++ /dev/null
@@ -1,1017 +0,0 @@
-LIBRARY libfftw3f-3.dll
-EXPORTS
-fftwf_alignment_of
-fftwf_alloc_complex
-fftwf_alloc_real
-fftwf_assertion_failed
-fftwf_bufdist
-fftwf_check_alignment_of_sse2_pm
-fftwf_choose_radix
-fftwf_cleanup
-fftwf_cleanup_threads
-fftwf_codelet_e01_8
-fftwf_codelet_e10_8
-fftwf_codelet_hb_10
-fftwf_codelet_hb_12
-fftwf_codelet_hb_15
-fftwf_codelet_hb_16
-fftwf_codelet_hb_2
-fftwf_codelet_hb_20
-fftwf_codelet_hb2_16
-fftwf_codelet_hb2_20
-fftwf_codelet_hb2_25
-fftwf_codelet_hb2_32
-fftwf_codelet_hb2_4
-fftwf_codelet_hb_25
-fftwf_codelet_hb2_5
-fftwf_codelet_hb2_8
-fftwf_codelet_hb_3
-fftwf_codelet_hb_32
-fftwf_codelet_hb_4
-fftwf_codelet_hb_5
-fftwf_codelet_hb_6
-fftwf_codelet_hb_64
-fftwf_codelet_hb_7
-fftwf_codelet_hb_8
-fftwf_codelet_hb_9
-fftwf_codelet_hc2cb_10
-fftwf_codelet_hc2cb_12
-fftwf_codelet_hc2cb_16
-fftwf_codelet_hc2cb_2
-fftwf_codelet_hc2cb_20
-fftwf_codelet_hc2cb2_16
-fftwf_codelet_hc2cb2_20
-fftwf_codelet_hc2cb2_32
-fftwf_codelet_hc2cb2_4
-fftwf_codelet_hc2cb2_8
-fftwf_codelet_hc2cb_32
-fftwf_codelet_hc2cb_4
-fftwf_codelet_hc2cb_6
-fftwf_codelet_hc2cb_8
-fftwf_codelet_hc2cbdft_10
-fftwf_codelet_hc2cbdft_12
-fftwf_codelet_hc2cbdft_16
-fftwf_codelet_hc2cbdft_2
-fftwf_codelet_hc2cbdft_20
-fftwf_codelet_hc2cbdft2_16
-fftwf_codelet_hc2cbdft2_20
-fftwf_codelet_hc2cbdft2_32
-fftwf_codelet_hc2cbdft2_4
-fftwf_codelet_hc2cbdft2_8
-fftwf_codelet_hc2cbdft_32
-fftwf_codelet_hc2cbdft_4
-fftwf_codelet_hc2cbdft_6
-fftwf_codelet_hc2cbdft_8
-fftwf_codelet_hc2cbdftv_10_avx
-fftwf_codelet_hc2cbdftv_10_sse2
-fftwf_codelet_hc2cbdftv_12_avx
-fftwf_codelet_hc2cbdftv_12_sse2
-fftwf_codelet_hc2cbdftv_16_avx
-fftwf_codelet_hc2cbdftv_16_sse2
-fftwf_codelet_hc2cbdftv_20_avx
-fftwf_codelet_hc2cbdftv_20_sse2
-fftwf_codelet_hc2cbdftv_2_avx
-fftwf_codelet_hc2cbdftv_2_sse2
-fftwf_codelet_hc2cbdftv_32_avx
-fftwf_codelet_hc2cbdftv_32_sse2
-fftwf_codelet_hc2cbdftv_4_avx
-fftwf_codelet_hc2cbdftv_4_sse2
-fftwf_codelet_hc2cbdftv_6_avx
-fftwf_codelet_hc2cbdftv_6_sse2
-fftwf_codelet_hc2cbdftv_8_avx
-fftwf_codelet_hc2cbdftv_8_sse2
-fftwf_codelet_hc2cf_10
-fftwf_codelet_hc2cf_12
-fftwf_codelet_hc2cf_16
-fftwf_codelet_hc2cf_2
-fftwf_codelet_hc2cf_20
-fftwf_codelet_hc2cf2_16
-fftwf_codelet_hc2cf2_20
-fftwf_codelet_hc2cf2_32
-fftwf_codelet_hc2cf2_4
-fftwf_codelet_hc2cf2_8
-fftwf_codelet_hc2cf_32
-fftwf_codelet_hc2cf_4
-fftwf_codelet_hc2cf_6
-fftwf_codelet_hc2cf_8
-fftwf_codelet_hc2cfdft_10
-fftwf_codelet_hc2cfdft_12
-fftwf_codelet_hc2cfdft_16
-fftwf_codelet_hc2cfdft_2
-fftwf_codelet_hc2cfdft_20
-fftwf_codelet_hc2cfdft2_16
-fftwf_codelet_hc2cfdft2_20
-fftwf_codelet_hc2cfdft2_32
-fftwf_codelet_hc2cfdft2_4
-fftwf_codelet_hc2cfdft2_8
-fftwf_codelet_hc2cfdft_32
-fftwf_codelet_hc2cfdft_4
-fftwf_codelet_hc2cfdft_6
-fftwf_codelet_hc2cfdft_8
-fftwf_codelet_hc2cfdftv_10_avx
-fftwf_codelet_hc2cfdftv_10_sse2
-fftwf_codelet_hc2cfdftv_12_avx
-fftwf_codelet_hc2cfdftv_12_sse2
-fftwf_codelet_hc2cfdftv_16_avx
-fftwf_codelet_hc2cfdftv_16_sse2
-fftwf_codelet_hc2cfdftv_20_avx
-fftwf_codelet_hc2cfdftv_20_sse2
-fftwf_codelet_hc2cfdftv_2_avx
-fftwf_codelet_hc2cfdftv_2_sse2
-fftwf_codelet_hc2cfdftv_32_avx
-fftwf_codelet_hc2cfdftv_32_sse2
-fftwf_codelet_hc2cfdftv_4_avx
-fftwf_codelet_hc2cfdftv_4_sse2
-fftwf_codelet_hc2cfdftv_6_avx
-fftwf_codelet_hc2cfdftv_6_sse2
-fftwf_codelet_hc2cfdftv_8_avx
-fftwf_codelet_hc2cfdftv_8_sse2
-fftwf_codelet_hf_10
-fftwf_codelet_hf_12
-fftwf_codelet_hf_15
-fftwf_codelet_hf_16
-fftwf_codelet_hf_2
-fftwf_codelet_hf_20
-fftwf_codelet_hf2_16
-fftwf_codelet_hf2_20
-fftwf_codelet_hf2_25
-fftwf_codelet_hf2_32
-fftwf_codelet_hf2_4
-fftwf_codelet_hf_25
-fftwf_codelet_hf2_5
-fftwf_codelet_hf2_8
-fftwf_codelet_hf_3
-fftwf_codelet_hf_32
-fftwf_codelet_hf_4
-fftwf_codelet_hf_5
-fftwf_codelet_hf_6
-fftwf_codelet_hf_64
-fftwf_codelet_hf_7
-fftwf_codelet_hf_8
-fftwf_codelet_hf_9
-fftwf_codelet_n1_10
-fftwf_codelet_n1_11
-fftwf_codelet_n1_12
-fftwf_codelet_n1_13
-fftwf_codelet_n1_14
-fftwf_codelet_n1_15
-fftwf_codelet_n1_16
-fftwf_codelet_n1_2
-fftwf_codelet_n1_20
-fftwf_codelet_n1_25
-fftwf_codelet_n1_3
-fftwf_codelet_n1_32
-fftwf_codelet_n1_4
-fftwf_codelet_n1_5
-fftwf_codelet_n1_6
-fftwf_codelet_n1_64
-fftwf_codelet_n1_7
-fftwf_codelet_n1_8
-fftwf_codelet_n1_9
-fftwf_codelet_n1bv_10_avx
-fftwf_codelet_n1bv_10_sse2
-fftwf_codelet_n1bv_11_avx
-fftwf_codelet_n1bv_11_sse2
-fftwf_codelet_n1bv_128_avx
-fftwf_codelet_n1bv_128_sse2
-fftwf_codelet_n1bv_12_avx
-fftwf_codelet_n1bv_12_sse2
-fftwf_codelet_n1bv_13_avx
-fftwf_codelet_n1bv_13_sse2
-fftwf_codelet_n1bv_14_avx
-fftwf_codelet_n1bv_14_sse2
-fftwf_codelet_n1bv_15_avx
-fftwf_codelet_n1bv_15_sse2
-fftwf_codelet_n1bv_16_avx
-fftwf_codelet_n1bv_16_sse2
-fftwf_codelet_n1bv_20_avx
-fftwf_codelet_n1bv_20_sse2
-fftwf_codelet_n1bv_25_avx
-fftwf_codelet_n1bv_25_sse2
-fftwf_codelet_n1bv_2_avx
-fftwf_codelet_n1bv_2_sse2
-fftwf_codelet_n1bv_32_avx
-fftwf_codelet_n1bv_32_sse2
-fftwf_codelet_n1bv_3_avx
-fftwf_codelet_n1bv_3_sse2
-fftwf_codelet_n1bv_4_avx
-fftwf_codelet_n1bv_4_sse2
-fftwf_codelet_n1bv_5_avx
-fftwf_codelet_n1bv_5_sse2
-fftwf_codelet_n1bv_64_avx
-fftwf_codelet_n1bv_64_sse2
-fftwf_codelet_n1bv_6_avx
-fftwf_codelet_n1bv_6_sse2
-fftwf_codelet_n1bv_7_avx
-fftwf_codelet_n1bv_7_sse2
-fftwf_codelet_n1bv_8_avx
-fftwf_codelet_n1bv_8_sse2
-fftwf_codelet_n1bv_9_avx
-fftwf_codelet_n1bv_9_sse2
-fftwf_codelet_n1fv_10_avx
-fftwf_codelet_n1fv_10_sse2
-fftwf_codelet_n1fv_11_avx
-fftwf_codelet_n1fv_11_sse2
-fftwf_codelet_n1fv_128_avx
-fftwf_codelet_n1fv_128_sse2
-fftwf_codelet_n1fv_12_avx
-fftwf_codelet_n1fv_12_sse2
-fftwf_codelet_n1fv_13_avx
-fftwf_codelet_n1fv_13_sse2
-fftwf_codelet_n1fv_14_avx
-fftwf_codelet_n1fv_14_sse2
-fftwf_codelet_n1fv_15_avx
-fftwf_codelet_n1fv_15_sse2
-fftwf_codelet_n1fv_16_avx
-fftwf_codelet_n1fv_16_sse2
-fftwf_codelet_n1fv_20_avx
-fftwf_codelet_n1fv_20_sse2
-fftwf_codelet_n1fv_25_avx
-fftwf_codelet_n1fv_25_sse2
-fftwf_codelet_n1fv_2_avx
-fftwf_codelet_n1fv_2_sse2
-fftwf_codelet_n1fv_32_avx
-fftwf_codelet_n1fv_32_sse2
-fftwf_codelet_n1fv_3_avx
-fftwf_codelet_n1fv_3_sse2
-fftwf_codelet_n1fv_4_avx
-fftwf_codelet_n1fv_4_sse2
-fftwf_codelet_n1fv_5_avx
-fftwf_codelet_n1fv_5_sse2
-fftwf_codelet_n1fv_64_avx
-fftwf_codelet_n1fv_64_sse2
-fftwf_codelet_n1fv_6_avx
-fftwf_codelet_n1fv_6_sse2
-fftwf_codelet_n1fv_7_avx
-fftwf_codelet_n1fv_7_sse2
-fftwf_codelet_n1fv_8_avx
-fftwf_codelet_n1fv_8_sse2
-fftwf_codelet_n1fv_9_avx
-fftwf_codelet_n1fv_9_sse2
-fftwf_codelet_n2bv_10_avx
-fftwf_codelet_n2bv_10_sse2
-fftwf_codelet_n2bv_12_avx
-fftwf_codelet_n2bv_12_sse2
-fftwf_codelet_n2bv_14_avx
-fftwf_codelet_n2bv_14_sse2
-fftwf_codelet_n2bv_16_avx
-fftwf_codelet_n2bv_16_sse2
-fftwf_codelet_n2bv_20_avx
-fftwf_codelet_n2bv_20_sse2
-fftwf_codelet_n2bv_2_avx
-fftwf_codelet_n2bv_2_sse2
-fftwf_codelet_n2bv_32_avx
-fftwf_codelet_n2bv_32_sse2
-fftwf_codelet_n2bv_4_avx
-fftwf_codelet_n2bv_4_sse2
-fftwf_codelet_n2bv_64_avx
-fftwf_codelet_n2bv_64_sse2
-fftwf_codelet_n2bv_6_avx
-fftwf_codelet_n2bv_6_sse2
-fftwf_codelet_n2bv_8_avx
-fftwf_codelet_n2bv_8_sse2
-fftwf_codelet_n2fv_10_avx
-fftwf_codelet_n2fv_10_sse2
-fftwf_codelet_n2fv_12_avx
-fftwf_codelet_n2fv_12_sse2
-fftwf_codelet_n2fv_14_avx
-fftwf_codelet_n2fv_14_sse2
-fftwf_codelet_n2fv_16_avx
-fftwf_codelet_n2fv_16_sse2
-fftwf_codelet_n2fv_20_avx
-fftwf_codelet_n2fv_20_sse2
-fftwf_codelet_n2fv_2_avx
-fftwf_codelet_n2fv_2_sse2
-fftwf_codelet_n2fv_32_avx
-fftwf_codelet_n2fv_32_sse2
-fftwf_codelet_n2fv_4_avx
-fftwf_codelet_n2fv_4_sse2
-fftwf_codelet_n2fv_64_avx
-fftwf_codelet_n2fv_64_sse2
-fftwf_codelet_n2fv_6_avx
-fftwf_codelet_n2fv_6_sse2
-fftwf_codelet_n2fv_8_avx
-fftwf_codelet_n2fv_8_sse2
-fftwf_codelet_n2sv_16_avx
-fftwf_codelet_n2sv_16_sse2
-fftwf_codelet_n2sv_32_avx
-fftwf_codelet_n2sv_32_sse2
-fftwf_codelet_n2sv_4_avx
-fftwf_codelet_n2sv_4_sse2
-fftwf_codelet_n2sv_64_avx
-fftwf_codelet_n2sv_64_sse2
-fftwf_codelet_n2sv_8_avx
-fftwf_codelet_n2sv_8_sse2
-fftwf_codelet_q1_2
-fftwf_codelet_q1_3
-fftwf_codelet_q1_4
-fftwf_codelet_q1_5
-fftwf_codelet_q1_6
-fftwf_codelet_q1_8
-fftwf_codelet_q1bv_2_avx
-fftwf_codelet_q1bv_2_sse2
-fftwf_codelet_q1bv_4_avx
-fftwf_codelet_q1bv_4_sse2
-fftwf_codelet_q1bv_5_avx
-fftwf_codelet_q1bv_5_sse2
-fftwf_codelet_q1bv_8_avx
-fftwf_codelet_q1bv_8_sse2
-fftwf_codelet_q1fv_2_avx
-fftwf_codelet_q1fv_2_sse2
-fftwf_codelet_q1fv_4_avx
-fftwf_codelet_q1fv_4_sse2
-fftwf_codelet_q1fv_5_avx
-fftwf_codelet_q1fv_5_sse2
-fftwf_codelet_q1fv_8_avx
-fftwf_codelet_q1fv_8_sse2
-fftwf_codelet_r2cb_10
-fftwf_codelet_r2cb_11
-fftwf_codelet_r2cb_12
-fftwf_codelet_r2cb_128
-fftwf_codelet_r2cb_13
-fftwf_codelet_r2cb_14
-fftwf_codelet_r2cb_15
-fftwf_codelet_r2cb_16
-fftwf_codelet_r2cb_2
-fftwf_codelet_r2cb_20
-fftwf_codelet_r2cb_25
-fftwf_codelet_r2cb_3
-fftwf_codelet_r2cb_32
-fftwf_codelet_r2cb_4
-fftwf_codelet_r2cb_5
-fftwf_codelet_r2cb_6
-fftwf_codelet_r2cb_64
-fftwf_codelet_r2cb_7
-fftwf_codelet_r2cb_8
-fftwf_codelet_r2cb_9
-fftwf_codelet_r2cbIII_10
-fftwf_codelet_r2cbIII_12
-fftwf_codelet_r2cbIII_15
-fftwf_codelet_r2cbIII_16
-fftwf_codelet_r2cbIII_2
-fftwf_codelet_r2cbIII_20
-fftwf_codelet_r2cbIII_25
-fftwf_codelet_r2cbIII_3
-fftwf_codelet_r2cbIII_32
-fftwf_codelet_r2cbIII_4
-fftwf_codelet_r2cbIII_5
-fftwf_codelet_r2cbIII_6
-fftwf_codelet_r2cbIII_64
-fftwf_codelet_r2cbIII_7
-fftwf_codelet_r2cbIII_8
-fftwf_codelet_r2cbIII_9
-fftwf_codelet_r2cf_10
-fftwf_codelet_r2cf_11
-fftwf_codelet_r2cf_12
-fftwf_codelet_r2cf_128
-fftwf_codelet_r2cf_13
-fftwf_codelet_r2cf_14
-fftwf_codelet_r2cf_15
-fftwf_codelet_r2cf_16
-fftwf_codelet_r2cf_2
-fftwf_codelet_r2cf_20
-fftwf_codelet_r2cf_25
-fftwf_codelet_r2cf_3
-fftwf_codelet_r2cf_32
-fftwf_codelet_r2cf_4
-fftwf_codelet_r2cf_5
-fftwf_codelet_r2cf_6
-fftwf_codelet_r2cf_64
-fftwf_codelet_r2cf_7
-fftwf_codelet_r2cf_8
-fftwf_codelet_r2cf_9
-fftwf_codelet_r2cfII_10
-fftwf_codelet_r2cfII_12
-fftwf_codelet_r2cfII_15
-fftwf_codelet_r2cfII_16
-fftwf_codelet_r2cfII_2
-fftwf_codelet_r2cfII_20
-fftwf_codelet_r2cfII_25
-fftwf_codelet_r2cfII_3
-fftwf_codelet_r2cfII_32
-fftwf_codelet_r2cfII_4
-fftwf_codelet_r2cfII_5
-fftwf_codelet_r2cfII_6
-fftwf_codelet_r2cfII_64
-fftwf_codelet_r2cfII_7
-fftwf_codelet_r2cfII_8
-fftwf_codelet_r2cfII_9
-fftwf_codelet_t1_10
-fftwf_codelet_t1_12
-fftwf_codelet_t1_15
-fftwf_codelet_t1_16
-fftwf_codelet_t1_2
-fftwf_codelet_t1_20
-fftwf_codelet_t1_25
-fftwf_codelet_t1_3
-fftwf_codelet_t1_32
-fftwf_codelet_t1_4
-fftwf_codelet_t1_5
-fftwf_codelet_t1_6
-fftwf_codelet_t1_64
-fftwf_codelet_t1_7
-fftwf_codelet_t1_8
-fftwf_codelet_t1_9
-fftwf_codelet_t1buv_10_avx
-fftwf_codelet_t1buv_10_sse2
-fftwf_codelet_t1buv_2_avx
-fftwf_codelet_t1buv_2_sse2
-fftwf_codelet_t1buv_3_avx
-fftwf_codelet_t1buv_3_sse2
-fftwf_codelet_t1buv_4_avx
-fftwf_codelet_t1buv_4_sse2
-fftwf_codelet_t1buv_5_avx
-fftwf_codelet_t1buv_5_sse2
-fftwf_codelet_t1buv_6_avx
-fftwf_codelet_t1buv_6_sse2
-fftwf_codelet_t1buv_7_avx
-fftwf_codelet_t1buv_7_sse2
-fftwf_codelet_t1buv_8_avx
-fftwf_codelet_t1buv_8_sse2
-fftwf_codelet_t1buv_9_avx
-fftwf_codelet_t1buv_9_sse2
-fftwf_codelet_t1bv_10_avx
-fftwf_codelet_t1bv_10_sse2
-fftwf_codelet_t1bv_12_avx
-fftwf_codelet_t1bv_12_sse2
-fftwf_codelet_t1bv_15_avx
-fftwf_codelet_t1bv_15_sse2
-fftwf_codelet_t1bv_16_avx
-fftwf_codelet_t1bv_16_sse2
-fftwf_codelet_t1bv_20_avx
-fftwf_codelet_t1bv_20_sse2
-fftwf_codelet_t1bv_25_avx
-fftwf_codelet_t1bv_25_sse2
-fftwf_codelet_t1bv_2_avx
-fftwf_codelet_t1bv_2_sse2
-fftwf_codelet_t1bv_32_avx
-fftwf_codelet_t1bv_32_sse2
-fftwf_codelet_t1bv_3_avx
-fftwf_codelet_t1bv_3_sse2
-fftwf_codelet_t1bv_4_avx
-fftwf_codelet_t1bv_4_sse2
-fftwf_codelet_t1bv_5_avx
-fftwf_codelet_t1bv_5_sse2
-fftwf_codelet_t1bv_64_avx
-fftwf_codelet_t1bv_64_sse2
-fftwf_codelet_t1bv_6_avx
-fftwf_codelet_t1bv_6_sse2
-fftwf_codelet_t1bv_7_avx
-fftwf_codelet_t1bv_7_sse2
-fftwf_codelet_t1bv_8_avx
-fftwf_codelet_t1bv_8_sse2
-fftwf_codelet_t1bv_9_avx
-fftwf_codelet_t1bv_9_sse2
-fftwf_codelet_t1fuv_10_avx
-fftwf_codelet_t1fuv_10_sse2
-fftwf_codelet_t1fuv_2_avx
-fftwf_codelet_t1fuv_2_sse2
-fftwf_codelet_t1fuv_3_avx
-fftwf_codelet_t1fuv_3_sse2
-fftwf_codelet_t1fuv_4_avx
-fftwf_codelet_t1fuv_4_sse2
-fftwf_codelet_t1fuv_5_avx
-fftwf_codelet_t1fuv_5_sse2
-fftwf_codelet_t1fuv_6_avx
-fftwf_codelet_t1fuv_6_sse2
-fftwf_codelet_t1fuv_7_avx
-fftwf_codelet_t1fuv_7_sse2
-fftwf_codelet_t1fuv_8_avx
-fftwf_codelet_t1fuv_8_sse2
-fftwf_codelet_t1fuv_9_avx
-fftwf_codelet_t1fuv_9_sse2
-fftwf_codelet_t1fv_10_avx
-fftwf_codelet_t1fv_10_sse2
-fftwf_codelet_t1fv_12_avx
-fftwf_codelet_t1fv_12_sse2
-fftwf_codelet_t1fv_15_avx
-fftwf_codelet_t1fv_15_sse2
-fftwf_codelet_t1fv_16_avx
-fftwf_codelet_t1fv_16_sse2
-fftwf_codelet_t1fv_20_avx
-fftwf_codelet_t1fv_20_sse2
-fftwf_codelet_t1fv_25_avx
-fftwf_codelet_t1fv_25_sse2
-fftwf_codelet_t1fv_2_avx
-fftwf_codelet_t1fv_2_sse2
-fftwf_codelet_t1fv_32_avx
-fftwf_codelet_t1fv_32_sse2
-fftwf_codelet_t1fv_3_avx
-fftwf_codelet_t1fv_3_sse2
-fftwf_codelet_t1fv_4_avx
-fftwf_codelet_t1fv_4_sse2
-fftwf_codelet_t1fv_5_avx
-fftwf_codelet_t1fv_5_sse2
-fftwf_codelet_t1fv_64_avx
-fftwf_codelet_t1fv_64_sse2
-fftwf_codelet_t1fv_6_avx
-fftwf_codelet_t1fv_6_sse2
-fftwf_codelet_t1fv_7_avx
-fftwf_codelet_t1fv_7_sse2
-fftwf_codelet_t1fv_8_avx
-fftwf_codelet_t1fv_8_sse2
-fftwf_codelet_t1fv_9_avx
-fftwf_codelet_t1fv_9_sse2
-fftwf_codelet_t1sv_16_avx
-fftwf_codelet_t1sv_16_sse2
-fftwf_codelet_t1sv_2_avx
-fftwf_codelet_t1sv_2_sse2
-fftwf_codelet_t1sv_32_avx
-fftwf_codelet_t1sv_32_sse2
-fftwf_codelet_t1sv_4_avx
-fftwf_codelet_t1sv_4_sse2
-fftwf_codelet_t1sv_8_avx
-fftwf_codelet_t1sv_8_sse2
-fftwf_codelet_t2_10
-fftwf_codelet_t2_16
-fftwf_codelet_t2_20
-fftwf_codelet_t2_25
-fftwf_codelet_t2_32
-fftwf_codelet_t2_4
-fftwf_codelet_t2_5
-fftwf_codelet_t2_64
-fftwf_codelet_t2_8
-fftwf_codelet_t2bv_10_avx
-fftwf_codelet_t2bv_10_sse2
-fftwf_codelet_t2bv_16_avx
-fftwf_codelet_t2bv_16_sse2
-fftwf_codelet_t2bv_20_avx
-fftwf_codelet_t2bv_20_sse2
-fftwf_codelet_t2bv_25_avx
-fftwf_codelet_t2bv_25_sse2
-fftwf_codelet_t2bv_2_avx
-fftwf_codelet_t2bv_2_sse2
-fftwf_codelet_t2bv_32_avx
-fftwf_codelet_t2bv_32_sse2
-fftwf_codelet_t2bv_4_avx
-fftwf_codelet_t2bv_4_sse2
-fftwf_codelet_t2bv_5_avx
-fftwf_codelet_t2bv_5_sse2
-fftwf_codelet_t2bv_64_avx
-fftwf_codelet_t2bv_64_sse2
-fftwf_codelet_t2bv_8_avx
-fftwf_codelet_t2bv_8_sse2
-fftwf_codelet_t2fv_10_avx
-fftwf_codelet_t2fv_10_sse2
-fftwf_codelet_t2fv_16_avx
-fftwf_codelet_t2fv_16_sse2
-fftwf_codelet_t2fv_20_avx
-fftwf_codelet_t2fv_20_sse2
-fftwf_codelet_t2fv_25_avx
-fftwf_codelet_t2fv_25_sse2
-fftwf_codelet_t2fv_2_avx
-fftwf_codelet_t2fv_2_sse2
-fftwf_codelet_t2fv_32_avx
-fftwf_codelet_t2fv_32_sse2
-fftwf_codelet_t2fv_4_avx
-fftwf_codelet_t2fv_4_sse2
-fftwf_codelet_t2fv_5_avx
-fftwf_codelet_t2fv_5_sse2
-fftwf_codelet_t2fv_64_avx
-fftwf_codelet_t2fv_64_sse2
-fftwf_codelet_t2fv_8_avx
-fftwf_codelet_t2fv_8_sse2
-fftwf_codelet_t2sv_16_avx
-fftwf_codelet_t2sv_16_sse2
-fftwf_codelet_t2sv_32_avx
-fftwf_codelet_t2sv_32_sse2
-fftwf_codelet_t2sv_4_avx
-fftwf_codelet_t2sv_4_sse2
-fftwf_codelet_t2sv_8_avx
-fftwf_codelet_t2sv_8_sse2
-fftwf_codelet_t3bv_10_avx
-fftwf_codelet_t3bv_10_sse2
-fftwf_codelet_t3bv_16_avx
-fftwf_codelet_t3bv_16_sse2
-fftwf_codelet_t3bv_20_avx
-fftwf_codelet_t3bv_20_sse2
-fftwf_codelet_t3bv_25_avx
-fftwf_codelet_t3bv_25_sse2
-fftwf_codelet_t3bv_32_avx
-fftwf_codelet_t3bv_32_sse2
-fftwf_codelet_t3bv_4_avx
-fftwf_codelet_t3bv_4_sse2
-fftwf_codelet_t3bv_5_avx
-fftwf_codelet_t3bv_5_sse2
-fftwf_codelet_t3bv_8_avx
-fftwf_codelet_t3bv_8_sse2
-fftwf_codelet_t3fv_10_avx
-fftwf_codelet_t3fv_10_sse2
-fftwf_codelet_t3fv_16_avx
-fftwf_codelet_t3fv_16_sse2
-fftwf_codelet_t3fv_20_avx
-fftwf_codelet_t3fv_20_sse2
-fftwf_codelet_t3fv_25_avx
-fftwf_codelet_t3fv_25_sse2
-fftwf_codelet_t3fv_32_avx
-fftwf_codelet_t3fv_32_sse2
-fftwf_codelet_t3fv_4_avx
-fftwf_codelet_t3fv_4_sse2
-fftwf_codelet_t3fv_5_avx
-fftwf_codelet_t3fv_5_sse2
-fftwf_codelet_t3fv_8_avx
-fftwf_codelet_t3fv_8_sse2
-fftwf_compute_tilesz
-fftwf_configure_planner
-fftwf_cost
-fftwf_cpy1d
-fftwf_cpy2d
-fftwf_cpy2d_ci
-fftwf_cpy2d_co
-fftwf_cpy2d_pair
-fftwf_cpy2d_pair_ci
-fftwf_cpy2d_pair_co
-fftwf_cpy2d_tiled
-fftwf_cpy2d_tiledbuf
-fftwf_ct_applicable
-fftwf_ct_genericbuf_register
-fftwf_ct_generic_register
-fftwf_ct_uglyp
-fftwf_destroy_plan
-fftwf_dft_bluestein_register
-fftwf_dft_buffered_register
-fftwf_dft_conf_standard
-fftwf_dft_generic_register
-fftwf_dft_indirect_register
-fftwf_dft_indirect_transpose_register
-fftwf_dft_nop_register
-fftwf_dft_r2hc_register
-fftwf_dft_rader_register
-fftwf_dft_rank_geq2_register
-fftwf_dft_solve
-fftwf_dft_thr_vrank_geq1_register
-fftwf_dft_vrank_geq1_register
-fftwf_dft_zerotens
-fftwf_dht_r2hc_register
-fftwf_dht_rader_register
-fftwf_dimcmp
-fftwf_elapsed_since
-fftwf_estimate_cost
-fftwf_execute
-fftwf_execute_dft
-fftwf_execute_dft_c2r
-fftwf_execute_dft_r2c
-fftwf_execute_r2r
-fftwf_execute_split_dft
-fftwf_execute_split_dft_c2r
-fftwf_execute_split_dft_r2c
-fftwf_export_wisdom
-fftwf_export_wisdom_to_file
-fftwf_export_wisdom_to_filename
-fftwf_export_wisdom_to_string
-fftwf_extract_reim
-fftwf_factors_into
-fftwf_factors_into_small_primes
-fftwf_find_generator
-fftwf_first_divisor
-fftwf_flops
-fftwf_forget_wisdom
-fftwf_fprint_plan
-fftwf_free
-fftwf_get_crude_time
-fftwf_guru64_kosherp
-fftwf_guru_kosherp
-fftwf_hash
-fftwf_have_simd_avx
-fftwf_have_simd_sse2
-fftwf_hc2hc_applicable
-fftwf_hc2hc_generic_register
-fftwf_iabs
-fftwf_ialignment_of
-fftwf_iestimate_cost
-fftwf_ifree
-fftwf_ifree0
-fftwf_imax
-fftwf_imin
-fftwf_import_system_wisdom
-fftwf_import_wisdom
-fftwf_import_wisdom_from_file
-fftwf_import_wisdom_from_filename
-fftwf_import_wisdom_from_string
-fftwf_init_threads
-fftwf_is_prime
-fftwf_isqrt
-fftwf_ithreads_init
-fftwf_join_taint
-fftwf_kdft_dif_register
-fftwf_kdft_difsq_register
-fftwf_kdft_dit_register
-fftwf_kdft_register
-fftwf_kernel_free
-fftwf_kernel_malloc
-fftwf_khc2c_register
-fftwf_khc2hc_register
-fftwf_kr2c_register
-fftwf_kr2r_register
-fftwf_make_planner_thread_safe
-fftwf_malloc
-fftwf_malloc_plain
-fftwf_many_kosherp
-fftwf_mapflags
-fftwf_map_r2r_kind
-fftwf_md5begin
-fftwf_md5end
-fftwf_md5int
-fftwf_md5INT
-fftwf_md5putb
-fftwf_md5putc
-fftwf_md5puts
-fftwf_md5unsigned
-fftwf_measure_execution_time
-fftwf_mkapiplan
-fftwf_mkplan
-fftwf_mkplan_d
-fftwf_mkplan_dft
-fftwf_mkplan_dftw
-fftwf_mkplan_f_d
-fftwf_mkplan_hc2c
-fftwf_mkplan_hc2hc
-fftwf_mkplanner
-fftwf_mkplan_rdft
-fftwf_mkplan_rdft2
-fftwf_mkprinter
-fftwf_mkprinter_cnt
-fftwf_mkprinter_file
-fftwf_mkprinter_str
-fftwf_mkproblem
-fftwf_mkproblem_dft
-fftwf_mkproblem_dft_d
-fftwf_mkproblem_rdft
-fftwf_mkproblem_rdft_0_d
-fftwf_mkproblem_rdft_1
-fftwf_mkproblem_rdft_1_d
-fftwf_mkproblem_rdft2
-fftwf_mkproblem_rdft2_d
-fftwf_mkproblem_rdft2_d_3pointers
-fftwf_mkproblem_rdft_d
-fftwf_mkproblem_unsolvable
-fftwf_mkscanner
-fftwf_mksolver
-fftwf_mksolver_ct
-fftwf_mksolver_ct_threads
-fftwf_mksolver_dft_direct
-fftwf_mksolver_dft_directbuf
-fftwf_mksolver_hc2c
-fftwf_mksolver_hc2hc
-fftwf_mksolver_hc2hc_threads
-fftwf_mksolver_rdft2_direct
-fftwf_mksolver_rdft_r2c_direct
-fftwf_mksolver_rdft_r2c_directbuf
-fftwf_mksolver_rdft_r2r_direct
-fftwf_mkstride
-fftwf_mktensor
-fftwf_mktensor_0d
-fftwf_mktensor_1d
-fftwf_mktensor_2d
-fftwf_mktensor_3d
-fftwf_mktensor_4d
-fftwf_mktensor_5d
-fftwf_mktensor_iodims
-fftwf_mktensor_iodims64
-fftwf_mktensor_rowmajor
-fftwf_mktriggen
-fftwf_modulo
-fftwf_nbuf
-fftwf_nbuf_redundant
-fftwf_next_prime
-fftwf_null_awake
-fftwf_ops_add
-fftwf_ops_add2
-fftwf_ops_cpy
-fftwf_ops_madd
-fftwf_ops_madd2
-fftwf_ops_other
-fftwf_ops_zero
-fftwf_pickdim
-fftwf_plan_awake
-fftwf_plan_destroy_internal
-fftwf_plan_dft
-fftwf_plan_dft_1d
-fftwf_plan_dft_2d
-fftwf_plan_dft_3d
-fftwf_plan_dft_c2r
-fftwf_plan_dft_c2r_1d
-fftwf_plan_dft_c2r_2d
-fftwf_plan_dft_c2r_3d
-fftwf_plan_dft_r2c
-fftwf_plan_dft_r2c_1d
-fftwf_plan_dft_r2c_2d
-fftwf_plan_dft_r2c_3d
-fftwf_plan_guru64_dft
-fftwf_plan_guru64_dft_c2r
-fftwf_plan_guru64_dft_r2c
-fftwf_plan_guru64_r2r
-fftwf_plan_guru64_split_dft
-fftwf_plan_guru64_split_dft_c2r
-fftwf_plan_guru64_split_dft_r2c
-fftwf_plan_guru_dft
-fftwf_plan_guru_dft_c2r
-fftwf_plan_guru_dft_r2c
-fftwf_plan_guru_r2r
-fftwf_plan_guru_split_dft
-fftwf_plan_guru_split_dft_c2r
-fftwf_plan_guru_split_dft_r2c
-fftwf_plan_many_dft
-fftwf_plan_many_dft_c2r
-fftwf_plan_many_dft_r2c
-fftwf_plan_many_r2r
-fftwf_planner_destroy
-fftwf_plan_null_destroy
-fftwf_plan_r2r
-fftwf_plan_r2r_1d
-fftwf_plan_r2r_2d
-fftwf_plan_r2r_3d
-fftwf_plan_with_nthreads
-fftwf_power_mod
-fftwf_printer_destroy
-fftwf_print_plan
-fftwf_problem_destroy
-fftwf_rader_tl_delete
-fftwf_rader_tl_find
-fftwf_rader_tl_insert
-fftwf_rdft2_buffered_register
-fftwf_rdft2_complex_n
-fftwf_rdft2_inplace_strides
-fftwf_rdft2_nop_register
-fftwf_rdft2_pad
-fftwf_rdft2_rank0_register
-fftwf_rdft2_rank_geq2_register
-fftwf_rdft2_rdft_register
-fftwf_rdft2_solve
-fftwf_rdft2_strides
-fftwf_rdft2_tensor_max_index
-fftwf_rdft2_thr_vrank_geq1_register
-fftwf_rdft2_vrank_geq1_register
-fftwf_rdft_buffered_register
-fftwf_rdft_conf_standard
-fftwf_rdft_dht_register
-fftwf_rdft_generic_register
-fftwf_rdft_indirect_register
-fftwf_rdft_kind_str
-fftwf_rdft_nop_register
-fftwf_rdft_rank0_register
-fftwf_rdft_rank_geq2_register
-fftwf_rdft_solve
-fftwf_rdft_thr_vrank_geq1_register
-fftwf_rdft_vrank3_transpose_register
-fftwf_rdft_vrank_geq1_register
-fftwf_rdft_zerotens
-fftwf_redft00e_r2hc_pad_register
-fftwf_regsolver_ct_directw
-fftwf_regsolver_ct_directwsq
-fftwf_regsolver_hc2c_direct
-fftwf_regsolver_hc2hc_direct
-fftwf_reodft00e_splitradix_register
-fftwf_reodft010e_r2hc_register
-fftwf_reodft11e_r2hc_odd_register
-fftwf_reodft11e_radix2_r2hc_register
-fftwf_reodft_conf_standard
-fftwf_rodft00e_r2hc_pad_register
-fftwf_safe_mulmod
-fftwf_scanner_destroy
-fftwf_set_planner_hooks
-fftwf_set_timelimit
-fftwf_solver_destroy
-fftwf_solver_register
-fftwf_solver_use
-fftwf_solvtab_exec
-fftwf_spawn_loop
-fftwf_sprint_plan
-fftwf_stride_destroy
-fftwf_taint
-fftwf_tensor_append
-fftwf_tensor_compress
-fftwf_tensor_compress_contiguous
-fftwf_tensor_copy
-fftwf_tensor_copy_except
-fftwf_tensor_copy_inplace
-fftwf_tensor_copy_sub
-fftwf_tensor_destroy
-fftwf_tensor_destroy2
-fftwf_tensor_destroy4
-fftwf_tensor_equal
-fftwf_tensor_inplace_locations
-fftwf_tensor_inplace_strides
-fftwf_tensor_inplace_strides2
-fftwf_tensor_kosherp
-fftwf_tensor_max_index
-fftwf_tensor_md5
-fftwf_tensor_min_istride
-fftwf_tensor_min_ostride
-fftwf_tensor_min_stride
-fftwf_tensor_print
-fftwf_tensor_split
-fftwf_tensor_strides_decrease
-fftwf_tensor_sz
-fftwf_tensor_tornk1
-fftwf_the_planner
-fftwf_threads_cleanup
-fftwf_threads_conf_standard
-fftwf_threads_register_planner_hooks
-fftwf_tile2d
-fftwf_toobig
-fftwf_transpose
-fftwf_transpose_tiled
-fftwf_transpose_tiledbuf
-fftwf_triggen_destroy
-fftwf_twiddle_awake
-fftwf_twiddle_length
-fftwf_zero1d_pair
-sfftw_cleanup_
-sfftw_cleanup__
-sfftw_cleanup_threads_
-sfftw_cleanup_threads__
-sfftw_cost_
-sfftw_cost__
-sfftw_destroy_plan_
-sfftw_destroy_plan__
-sfftw_estimate_cost_
-sfftw_estimate_cost__
-sfftw_execute_
-sfftw_execute__
-sfftw_execute_dft_
-sfftw_execute_dft__
-sfftw_execute_dft_c2r_
-sfftw_execute_dft_c2r__
-sfftw_execute_dft_r2c_
-sfftw_execute_dft_r2c__
-sfftw_execute_r2r_
-sfftw_execute_r2r__
-sfftw_execute_split_dft_
-sfftw_execute_split_dft__
-sfftw_execute_split_dft_c2r_
-sfftw_execute_split_dft_c2r__
-sfftw_execute_split_dft_r2c_
-sfftw_execute_split_dft_r2c__
-sfftw_export_wisdom_
-sfftw_export_wisdom__
-sfftw_flops_
-sfftw_flops__
-sfftw_forget_wisdom_
-sfftw_forget_wisdom__
-sfftw_import_system_wisdom_
-sfftw_import_system_wisdom__
-sfftw_import_wisdom_
-sfftw_import_wisdom__
-sfftw_init_threads_
-sfftw_init_threads__
-sfftw_plan_dft_
-sfftw_plan_dft__
-sfftw_plan_dft_1d_
-sfftw_plan_dft_1d__
-sfftw_plan_dft_2d_
-sfftw_plan_dft_2d__
-sfftw_plan_dft_3d_
-sfftw_plan_dft_3d__
-sfftw_plan_dft_c2r_
-sfftw_plan_dft_c2r__
-sfftw_plan_dft_c2r_1d_
-sfftw_plan_dft_c2r_1d__
-sfftw_plan_dft_c2r_2d_
-sfftw_plan_dft_c2r_2d__
-sfftw_plan_dft_c2r_3d_
-sfftw_plan_dft_c2r_3d__
-sfftw_plan_dft_r2c_
-sfftw_plan_dft_r2c__
-sfftw_plan_dft_r2c_1d_
-sfftw_plan_dft_r2c_1d__
-sfftw_plan_dft_r2c_2d_
-sfftw_plan_dft_r2c_2d__
-sfftw_plan_dft_r2c_3d_
-sfftw_plan_dft_r2c_3d__
-sfftw_plan_guru_dft_
-sfftw_plan_guru_dft__
-sfftw_plan_guru_dft_c2r_
-sfftw_plan_guru_dft_c2r__
-sfftw_plan_guru_dft_r2c_
-sfftw_plan_guru_dft_r2c__
-sfftw_plan_guru_r2r_
-sfftw_plan_guru_r2r__
-sfftw_plan_guru_split_dft_
-sfftw_plan_guru_split_dft__
-sfftw_plan_guru_split_dft_c2r_
-sfftw_plan_guru_split_dft_c2r__
-sfftw_plan_guru_split_dft_r2c_
-sfftw_plan_guru_split_dft_r2c__
-sfftw_plan_many_dft_
-sfftw_plan_many_dft__
-sfftw_plan_many_dft_c2r_
-sfftw_plan_many_dft_c2r__
-sfftw_plan_many_dft_r2c_
-sfftw_plan_many_dft_r2c__
-sfftw_plan_many_r2r_
-sfftw_plan_many_r2r__
-sfftw_plan_r2r_
-sfftw_plan_r2r__
-sfftw_plan_r2r_1d_
-sfftw_plan_r2r_1d__
-sfftw_plan_r2r_2d_
-sfftw_plan_r2r_2d__
-sfftw_plan_r2r_3d_
-sfftw_plan_r2r_3d__
-sfftw_plan_with_nthreads_
-sfftw_plan_with_nthreads__
-sfftw_print_plan_
-sfftw_print_plan__
-sfftw_set_timelimit_
-sfftw_set_timelimit__
diff --git a/funasr/runtime/onnxruntime/win/lib/x64/libfftw3f-3.exp b/funasr/runtime/onnxruntime/win/lib/x64/libfftw3f-3.exp
deleted file mode 100644
index 65b8806..0000000
--- a/funasr/runtime/onnxruntime/win/lib/x64/libfftw3f-3.exp
+++ /dev/null
Binary files differ
diff --git a/funasr/runtime/onnxruntime/win/lib/x64/libfftw3f-3.lib b/funasr/runtime/onnxruntime/win/lib/x64/libfftw3f-3.lib
deleted file mode 100644
index e8f03dd..0000000
--- a/funasr/runtime/onnxruntime/win/lib/x64/libfftw3f-3.lib
+++ /dev/null
Binary files differ
diff --git a/funasr/runtime/onnxruntime/win/lib/x64/libfftw3l-3.def b/funasr/runtime/onnxruntime/win/lib/x64/libfftw3l-3.def
deleted file mode 100644
index 62a5e42..0000000
--- a/funasr/runtime/onnxruntime/win/lib/x64/libfftw3l-3.def
+++ /dev/null
@@ -1,634 +0,0 @@
-LIBRARY libfftw3l-3.dll
-EXPORTS
-fftwl_alignment_of
-fftwl_alloc_complex
-fftwl_alloc_real
-fftwl_assertion_failed
-fftwl_bufdist
-fftwl_choose_radix
-fftwl_cleanup
-fftwl_cleanup_threads
-fftwl_codelet_e01_8
-fftwl_codelet_e10_8
-fftwl_codelet_hb_10
-fftwl_codelet_hb_12
-fftwl_codelet_hb_15
-fftwl_codelet_hb_16
-fftwl_codelet_hb_2
-fftwl_codelet_hb_20
-fftwl_codelet_hb2_16
-fftwl_codelet_hb2_20
-fftwl_codelet_hb2_25
-fftwl_codelet_hb2_32
-fftwl_codelet_hb2_4
-fftwl_codelet_hb_25
-fftwl_codelet_hb2_5
-fftwl_codelet_hb2_8
-fftwl_codelet_hb_3
-fftwl_codelet_hb_32
-fftwl_codelet_hb_4
-fftwl_codelet_hb_5
-fftwl_codelet_hb_6
-fftwl_codelet_hb_64
-fftwl_codelet_hb_7
-fftwl_codelet_hb_8
-fftwl_codelet_hb_9
-fftwl_codelet_hc2cb_10
-fftwl_codelet_hc2cb_12
-fftwl_codelet_hc2cb_16
-fftwl_codelet_hc2cb_2
-fftwl_codelet_hc2cb_20
-fftwl_codelet_hc2cb2_16
-fftwl_codelet_hc2cb2_20
-fftwl_codelet_hc2cb2_32
-fftwl_codelet_hc2cb2_4
-fftwl_codelet_hc2cb2_8
-fftwl_codelet_hc2cb_32
-fftwl_codelet_hc2cb_4
-fftwl_codelet_hc2cb_6
-fftwl_codelet_hc2cb_8
-fftwl_codelet_hc2cbdft_10
-fftwl_codelet_hc2cbdft_12
-fftwl_codelet_hc2cbdft_16
-fftwl_codelet_hc2cbdft_2
-fftwl_codelet_hc2cbdft_20
-fftwl_codelet_hc2cbdft2_16
-fftwl_codelet_hc2cbdft2_20
-fftwl_codelet_hc2cbdft2_32
-fftwl_codelet_hc2cbdft2_4
-fftwl_codelet_hc2cbdft2_8
-fftwl_codelet_hc2cbdft_32
-fftwl_codelet_hc2cbdft_4
-fftwl_codelet_hc2cbdft_6
-fftwl_codelet_hc2cbdft_8
-fftwl_codelet_hc2cf_10
-fftwl_codelet_hc2cf_12
-fftwl_codelet_hc2cf_16
-fftwl_codelet_hc2cf_2
-fftwl_codelet_hc2cf_20
-fftwl_codelet_hc2cf2_16
-fftwl_codelet_hc2cf2_20
-fftwl_codelet_hc2cf2_32
-fftwl_codelet_hc2cf2_4
-fftwl_codelet_hc2cf2_8
-fftwl_codelet_hc2cf_32
-fftwl_codelet_hc2cf_4
-fftwl_codelet_hc2cf_6
-fftwl_codelet_hc2cf_8
-fftwl_codelet_hc2cfdft_10
-fftwl_codelet_hc2cfdft_12
-fftwl_codelet_hc2cfdft_16
-fftwl_codelet_hc2cfdft_2
-fftwl_codelet_hc2cfdft_20
-fftwl_codelet_hc2cfdft2_16
-fftwl_codelet_hc2cfdft2_20
-fftwl_codelet_hc2cfdft2_32
-fftwl_codelet_hc2cfdft2_4
-fftwl_codelet_hc2cfdft2_8
-fftwl_codelet_hc2cfdft_32
-fftwl_codelet_hc2cfdft_4
-fftwl_codelet_hc2cfdft_6
-fftwl_codelet_hc2cfdft_8
-fftwl_codelet_hf_10
-fftwl_codelet_hf_12
-fftwl_codelet_hf_15
-fftwl_codelet_hf_16
-fftwl_codelet_hf_2
-fftwl_codelet_hf_20
-fftwl_codelet_hf2_16
-fftwl_codelet_hf2_20
-fftwl_codelet_hf2_25
-fftwl_codelet_hf2_32
-fftwl_codelet_hf2_4
-fftwl_codelet_hf_25
-fftwl_codelet_hf2_5
-fftwl_codelet_hf2_8
-fftwl_codelet_hf_3
-fftwl_codelet_hf_32
-fftwl_codelet_hf_4
-fftwl_codelet_hf_5
-fftwl_codelet_hf_6
-fftwl_codelet_hf_64
-fftwl_codelet_hf_7
-fftwl_codelet_hf_8
-fftwl_codelet_hf_9
-fftwl_codelet_n1_10
-fftwl_codelet_n1_11
-fftwl_codelet_n1_12
-fftwl_codelet_n1_13
-fftwl_codelet_n1_14
-fftwl_codelet_n1_15
-fftwl_codelet_n1_16
-fftwl_codelet_n1_2
-fftwl_codelet_n1_20
-fftwl_codelet_n1_25
-fftwl_codelet_n1_3
-fftwl_codelet_n1_32
-fftwl_codelet_n1_4
-fftwl_codelet_n1_5
-fftwl_codelet_n1_6
-fftwl_codelet_n1_64
-fftwl_codelet_n1_7
-fftwl_codelet_n1_8
-fftwl_codelet_n1_9
-fftwl_codelet_q1_2
-fftwl_codelet_q1_3
-fftwl_codelet_q1_4
-fftwl_codelet_q1_5
-fftwl_codelet_q1_6
-fftwl_codelet_q1_8
-fftwl_codelet_r2cb_10
-fftwl_codelet_r2cb_11
-fftwl_codelet_r2cb_12
-fftwl_codelet_r2cb_128
-fftwl_codelet_r2cb_13
-fftwl_codelet_r2cb_14
-fftwl_codelet_r2cb_15
-fftwl_codelet_r2cb_16
-fftwl_codelet_r2cb_2
-fftwl_codelet_r2cb_20
-fftwl_codelet_r2cb_25
-fftwl_codelet_r2cb_3
-fftwl_codelet_r2cb_32
-fftwl_codelet_r2cb_4
-fftwl_codelet_r2cb_5
-fftwl_codelet_r2cb_6
-fftwl_codelet_r2cb_64
-fftwl_codelet_r2cb_7
-fftwl_codelet_r2cb_8
-fftwl_codelet_r2cb_9
-fftwl_codelet_r2cbIII_10
-fftwl_codelet_r2cbIII_12
-fftwl_codelet_r2cbIII_15
-fftwl_codelet_r2cbIII_16
-fftwl_codelet_r2cbIII_2
-fftwl_codelet_r2cbIII_20
-fftwl_codelet_r2cbIII_25
-fftwl_codelet_r2cbIII_3
-fftwl_codelet_r2cbIII_32
-fftwl_codelet_r2cbIII_4
-fftwl_codelet_r2cbIII_5
-fftwl_codelet_r2cbIII_6
-fftwl_codelet_r2cbIII_64
-fftwl_codelet_r2cbIII_7
-fftwl_codelet_r2cbIII_8
-fftwl_codelet_r2cbIII_9
-fftwl_codelet_r2cf_10
-fftwl_codelet_r2cf_11
-fftwl_codelet_r2cf_12
-fftwl_codelet_r2cf_128
-fftwl_codelet_r2cf_13
-fftwl_codelet_r2cf_14
-fftwl_codelet_r2cf_15
-fftwl_codelet_r2cf_16
-fftwl_codelet_r2cf_2
-fftwl_codelet_r2cf_20
-fftwl_codelet_r2cf_25
-fftwl_codelet_r2cf_3
-fftwl_codelet_r2cf_32
-fftwl_codelet_r2cf_4
-fftwl_codelet_r2cf_5
-fftwl_codelet_r2cf_6
-fftwl_codelet_r2cf_64
-fftwl_codelet_r2cf_7
-fftwl_codelet_r2cf_8
-fftwl_codelet_r2cf_9
-fftwl_codelet_r2cfII_10
-fftwl_codelet_r2cfII_12
-fftwl_codelet_r2cfII_15
-fftwl_codelet_r2cfII_16
-fftwl_codelet_r2cfII_2
-fftwl_codelet_r2cfII_20
-fftwl_codelet_r2cfII_25
-fftwl_codelet_r2cfII_3
-fftwl_codelet_r2cfII_32
-fftwl_codelet_r2cfII_4
-fftwl_codelet_r2cfII_5
-fftwl_codelet_r2cfII_6
-fftwl_codelet_r2cfII_64
-fftwl_codelet_r2cfII_7
-fftwl_codelet_r2cfII_8
-fftwl_codelet_r2cfII_9
-fftwl_codelet_t1_10
-fftwl_codelet_t1_12
-fftwl_codelet_t1_15
-fftwl_codelet_t1_16
-fftwl_codelet_t1_2
-fftwl_codelet_t1_20
-fftwl_codelet_t1_25
-fftwl_codelet_t1_3
-fftwl_codelet_t1_32
-fftwl_codelet_t1_4
-fftwl_codelet_t1_5
-fftwl_codelet_t1_6
-fftwl_codelet_t1_64
-fftwl_codelet_t1_7
-fftwl_codelet_t1_8
-fftwl_codelet_t1_9
-fftwl_codelet_t2_10
-fftwl_codelet_t2_16
-fftwl_codelet_t2_20
-fftwl_codelet_t2_25
-fftwl_codelet_t2_32
-fftwl_codelet_t2_4
-fftwl_codelet_t2_5
-fftwl_codelet_t2_64
-fftwl_codelet_t2_8
-fftwl_compute_tilesz
-fftwl_configure_planner
-fftwl_cost
-fftwl_cpy1d
-fftwl_cpy2d
-fftwl_cpy2d_ci
-fftwl_cpy2d_co
-fftwl_cpy2d_pair
-fftwl_cpy2d_pair_ci
-fftwl_cpy2d_pair_co
-fftwl_cpy2d_tiled
-fftwl_cpy2d_tiledbuf
-fftwl_ct_applicable
-fftwl_ct_genericbuf_register
-fftwl_ct_generic_register
-fftwl_ct_uglyp
-fftwl_destroy_plan
-fftwl_dft_bluestein_register
-fftwl_dft_buffered_register
-fftwl_dft_conf_standard
-fftwl_dft_generic_register
-fftwl_dft_indirect_register
-fftwl_dft_indirect_transpose_register
-fftwl_dft_nop_register
-fftwl_dft_r2hc_register
-fftwl_dft_rader_register
-fftwl_dft_rank_geq2_register
-fftwl_dft_solve
-fftwl_dft_thr_vrank_geq1_register
-fftwl_dft_vrank_geq1_register
-fftwl_dft_zerotens
-fftwl_dht_r2hc_register
-fftwl_dht_rader_register
-fftwl_dimcmp
-fftwl_elapsed_since
-fftwl_estimate_cost
-fftwl_execute
-fftwl_execute_dft
-fftwl_execute_dft_c2r
-fftwl_execute_dft_r2c
-fftwl_execute_r2r
-fftwl_execute_split_dft
-fftwl_execute_split_dft_c2r
-fftwl_execute_split_dft_r2c
-fftwl_export_wisdom
-fftwl_export_wisdom_to_file
-fftwl_export_wisdom_to_filename
-fftwl_export_wisdom_to_string
-fftwl_extract_reim
-fftwl_factors_into
-fftwl_factors_into_small_primes
-fftwl_find_generator
-fftwl_first_divisor
-fftwl_flops
-fftwl_forget_wisdom
-fftwl_fprint_plan
-fftwl_free
-fftwl_get_crude_time
-fftwl_guru64_kosherp
-fftwl_guru_kosherp
-fftwl_hash
-fftwl_hc2hc_applicable
-fftwl_hc2hc_generic_register
-fftwl_iabs
-fftwl_ialignment_of
-fftwl_iestimate_cost
-fftwl_ifree
-fftwl_ifree0
-fftwl_imax
-fftwl_imin
-fftwl_import_system_wisdom
-fftwl_import_wisdom
-fftwl_import_wisdom_from_file
-fftwl_import_wisdom_from_filename
-fftwl_import_wisdom_from_string
-fftwl_init_threads
-fftwl_is_prime
-fftwl_isqrt
-fftwl_ithreads_init
-fftwl_kdft_dif_register
-fftwl_kdft_difsq_register
-fftwl_kdft_dit_register
-fftwl_kdft_register
-fftwl_kernel_free
-fftwl_kernel_malloc
-fftwl_khc2c_register
-fftwl_khc2hc_register
-fftwl_kr2c_register
-fftwl_kr2r_register
-fftwl_make_planner_thread_safe
-fftwl_malloc
-fftwl_malloc_plain
-fftwl_many_kosherp
-fftwl_mapflags
-fftwl_map_r2r_kind
-fftwl_md5begin
-fftwl_md5end
-fftwl_md5int
-fftwl_md5INT
-fftwl_md5putb
-fftwl_md5putc
-fftwl_md5puts
-fftwl_md5unsigned
-fftwl_measure_execution_time
-fftwl_mkapiplan
-fftwl_mkplan
-fftwl_mkplan_d
-fftwl_mkplan_dft
-fftwl_mkplan_dftw
-fftwl_mkplan_f_d
-fftwl_mkplan_hc2c
-fftwl_mkplan_hc2hc
-fftwl_mkplanner
-fftwl_mkplan_rdft
-fftwl_mkplan_rdft2
-fftwl_mkprinter
-fftwl_mkprinter_cnt
-fftwl_mkprinter_file
-fftwl_mkprinter_str
-fftwl_mkproblem
-fftwl_mkproblem_dft
-fftwl_mkproblem_dft_d
-fftwl_mkproblem_rdft
-fftwl_mkproblem_rdft_0_d
-fftwl_mkproblem_rdft_1
-fftwl_mkproblem_rdft_1_d
-fftwl_mkproblem_rdft2
-fftwl_mkproblem_rdft2_d
-fftwl_mkproblem_rdft2_d_3pointers
-fftwl_mkproblem_rdft_d
-fftwl_mkproblem_unsolvable
-fftwl_mkscanner
-fftwl_mksolver
-fftwl_mksolver_ct
-fftwl_mksolver_ct_threads
-fftwl_mksolver_dft_direct
-fftwl_mksolver_dft_directbuf
-fftwl_mksolver_hc2c
-fftwl_mksolver_hc2hc
-fftwl_mksolver_hc2hc_threads
-fftwl_mksolver_rdft2_direct
-fftwl_mksolver_rdft_r2c_direct
-fftwl_mksolver_rdft_r2c_directbuf
-fftwl_mksolver_rdft_r2r_direct
-fftwl_mktensor
-fftwl_mktensor_0d
-fftwl_mktensor_1d
-fftwl_mktensor_2d
-fftwl_mktensor_3d
-fftwl_mktensor_4d
-fftwl_mktensor_5d
-fftwl_mktensor_iodims
-fftwl_mktensor_iodims64
-fftwl_mktensor_rowmajor
-fftwl_mktriggen
-fftwl_modulo
-fftwl_nbuf
-fftwl_nbuf_redundant
-fftwl_next_prime
-fftwl_null_awake
-fftwl_ops_add
-fftwl_ops_add2
-fftwl_ops_cpy
-fftwl_ops_madd
-fftwl_ops_madd2
-fftwl_ops_other
-fftwl_ops_zero
-fftwl_pickdim
-fftwl_plan_awake
-fftwl_plan_destroy_internal
-fftwl_plan_dft
-fftwl_plan_dft_1d
-fftwl_plan_dft_2d
-fftwl_plan_dft_3d
-fftwl_plan_dft_c2r
-fftwl_plan_dft_c2r_1d
-fftwl_plan_dft_c2r_2d
-fftwl_plan_dft_c2r_3d
-fftwl_plan_dft_r2c
-fftwl_plan_dft_r2c_1d
-fftwl_plan_dft_r2c_2d
-fftwl_plan_dft_r2c_3d
-fftwl_plan_guru64_dft
-fftwl_plan_guru64_dft_c2r
-fftwl_plan_guru64_dft_r2c
-fftwl_plan_guru64_r2r
-fftwl_plan_guru64_split_dft
-fftwl_plan_guru64_split_dft_c2r
-fftwl_plan_guru64_split_dft_r2c
-fftwl_plan_guru_dft
-fftwl_plan_guru_dft_c2r
-fftwl_plan_guru_dft_r2c
-fftwl_plan_guru_r2r
-fftwl_plan_guru_split_dft
-fftwl_plan_guru_split_dft_c2r
-fftwl_plan_guru_split_dft_r2c
-fftwl_plan_many_dft
-fftwl_plan_many_dft_c2r
-fftwl_plan_many_dft_r2c
-fftwl_plan_many_r2r
-fftwl_planner_destroy
-fftwl_plan_null_destroy
-fftwl_plan_r2r
-fftwl_plan_r2r_1d
-fftwl_plan_r2r_2d
-fftwl_plan_r2r_3d
-fftwl_plan_with_nthreads
-fftwl_power_mod
-fftwl_printer_destroy
-fftwl_print_plan
-fftwl_problem_destroy
-fftwl_rader_tl_delete
-fftwl_rader_tl_find
-fftwl_rader_tl_insert
-fftwl_rdft2_buffered_register
-fftwl_rdft2_complex_n
-fftwl_rdft2_inplace_strides
-fftwl_rdft2_nop_register
-fftwl_rdft2_pad
-fftwl_rdft2_rank0_register
-fftwl_rdft2_rank_geq2_register
-fftwl_rdft2_rdft_register
-fftwl_rdft2_solve
-fftwl_rdft2_strides
-fftwl_rdft2_tensor_max_index
-fftwl_rdft2_thr_vrank_geq1_register
-fftwl_rdft2_vrank_geq1_register
-fftwl_rdft_buffered_register
-fftwl_rdft_conf_standard
-fftwl_rdft_dht_register
-fftwl_rdft_generic_register
-fftwl_rdft_indirect_register
-fftwl_rdft_kind_str
-fftwl_rdft_nop_register
-fftwl_rdft_rank0_register
-fftwl_rdft_rank_geq2_register
-fftwl_rdft_solve
-fftwl_rdft_thr_vrank_geq1_register
-fftwl_rdft_vrank3_transpose_register
-fftwl_rdft_vrank_geq1_register
-fftwl_rdft_zerotens
-fftwl_redft00e_r2hc_pad_register
-fftwl_regsolver_ct_directw
-fftwl_regsolver_ct_directwsq
-fftwl_regsolver_hc2c_direct
-fftwl_regsolver_hc2hc_direct
-fftwl_reodft00e_splitradix_register
-fftwl_reodft010e_r2hc_register
-fftwl_reodft11e_r2hc_odd_register
-fftwl_reodft11e_radix2_r2hc_register
-fftwl_reodft_conf_standard
-fftwl_rodft00e_r2hc_pad_register
-fftwl_safe_mulmod
-fftwl_scanner_destroy
-fftwl_set_planner_hooks
-fftwl_set_timelimit
-fftwl_solver_destroy
-fftwl_solver_register
-fftwl_solver_use
-fftwl_solvtab_exec
-fftwl_spawn_loop
-fftwl_sprint_plan
-fftwl_tensor_append
-fftwl_tensor_compress
-fftwl_tensor_compress_contiguous
-fftwl_tensor_copy
-fftwl_tensor_copy_except
-fftwl_tensor_copy_inplace
-fftwl_tensor_copy_sub
-fftwl_tensor_destroy
-fftwl_tensor_destroy2
-fftwl_tensor_destroy4
-fftwl_tensor_equal
-fftwl_tensor_inplace_locations
-fftwl_tensor_inplace_strides
-fftwl_tensor_inplace_strides2
-fftwl_tensor_kosherp
-fftwl_tensor_max_index
-fftwl_tensor_md5
-fftwl_tensor_min_istride
-fftwl_tensor_min_ostride
-fftwl_tensor_min_stride
-fftwl_tensor_print
-fftwl_tensor_split
-fftwl_tensor_strides_decrease
-fftwl_tensor_sz
-fftwl_tensor_tornk1
-fftwl_the_planner
-fftwl_threads_cleanup
-fftwl_threads_conf_standard
-fftwl_threads_register_planner_hooks
-fftwl_tile2d
-fftwl_toobig
-fftwl_transpose
-fftwl_transpose_tiled
-fftwl_transpose_tiledbuf
-fftwl_triggen_destroy
-fftwl_twiddle_awake
-fftwl_twiddle_length
-fftwl_zero1d_pair
-lfftw_cleanup_
-lfftw_cleanup__
-lfftw_cleanup_threads_
-lfftw_cleanup_threads__
-lfftw_cost_
-lfftw_cost__
-lfftw_destroy_plan_
-lfftw_destroy_plan__
-lfftw_estimate_cost_
-lfftw_estimate_cost__
-lfftw_execute_
-lfftw_execute__
-lfftw_execute_dft_
-lfftw_execute_dft__
-lfftw_execute_dft_c2r_
-lfftw_execute_dft_c2r__
-lfftw_execute_dft_r2c_
-lfftw_execute_dft_r2c__
-lfftw_execute_r2r_
-lfftw_execute_r2r__
-lfftw_execute_split_dft_
-lfftw_execute_split_dft__
-lfftw_execute_split_dft_c2r_
-lfftw_execute_split_dft_c2r__
-lfftw_execute_split_dft_r2c_
-lfftw_execute_split_dft_r2c__
-lfftw_export_wisdom_
-lfftw_export_wisdom__
-lfftw_flops_
-lfftw_flops__
-lfftw_forget_wisdom_
-lfftw_forget_wisdom__
-lfftw_import_system_wisdom_
-lfftw_import_system_wisdom__
-lfftw_import_wisdom_
-lfftw_import_wisdom__
-lfftw_init_threads_
-lfftw_init_threads__
-lfftw_plan_dft_
-lfftw_plan_dft__
-lfftw_plan_dft_1d_
-lfftw_plan_dft_1d__
-lfftw_plan_dft_2d_
-lfftw_plan_dft_2d__
-lfftw_plan_dft_3d_
-lfftw_plan_dft_3d__
-lfftw_plan_dft_c2r_
-lfftw_plan_dft_c2r__
-lfftw_plan_dft_c2r_1d_
-lfftw_plan_dft_c2r_1d__
-lfftw_plan_dft_c2r_2d_
-lfftw_plan_dft_c2r_2d__
-lfftw_plan_dft_c2r_3d_
-lfftw_plan_dft_c2r_3d__
-lfftw_plan_dft_r2c_
-lfftw_plan_dft_r2c__
-lfftw_plan_dft_r2c_1d_
-lfftw_plan_dft_r2c_1d__
-lfftw_plan_dft_r2c_2d_
-lfftw_plan_dft_r2c_2d__
-lfftw_plan_dft_r2c_3d_
-lfftw_plan_dft_r2c_3d__
-lfftw_plan_guru_dft_
-lfftw_plan_guru_dft__
-lfftw_plan_guru_dft_c2r_
-lfftw_plan_guru_dft_c2r__
-lfftw_plan_guru_dft_r2c_
-lfftw_plan_guru_dft_r2c__
-lfftw_plan_guru_r2r_
-lfftw_plan_guru_r2r__
-lfftw_plan_guru_split_dft_
-lfftw_plan_guru_split_dft__
-lfftw_plan_guru_split_dft_c2r_
-lfftw_plan_guru_split_dft_c2r__
-lfftw_plan_guru_split_dft_r2c_
-lfftw_plan_guru_split_dft_r2c__
-lfftw_plan_many_dft_
-lfftw_plan_many_dft__
-lfftw_plan_many_dft_c2r_
-lfftw_plan_many_dft_c2r__
-lfftw_plan_many_dft_r2c_
-lfftw_plan_many_dft_r2c__
-lfftw_plan_many_r2r_
-lfftw_plan_many_r2r__
-lfftw_plan_r2r_
-lfftw_plan_r2r__
-lfftw_plan_r2r_1d_
-lfftw_plan_r2r_1d__
-lfftw_plan_r2r_2d_
-lfftw_plan_r2r_2d__
-lfftw_plan_r2r_3d_
-lfftw_plan_r2r_3d__
-lfftw_plan_with_nthreads_
-lfftw_plan_with_nthreads__
-lfftw_print_plan_
-lfftw_print_plan__
-lfftw_set_timelimit_
-lfftw_set_timelimit__
diff --git a/funasr/runtime/onnxruntime/win/lib/x64/libfftw3l-3.exp b/funasr/runtime/onnxruntime/win/lib/x64/libfftw3l-3.exp
deleted file mode 100644
index 1c98b3a..0000000
--- a/funasr/runtime/onnxruntime/win/lib/x64/libfftw3l-3.exp
+++ /dev/null
Binary files differ
diff --git a/funasr/runtime/onnxruntime/win/lib/x64/libfftw3l-3.lib b/funasr/runtime/onnxruntime/win/lib/x64/libfftw3l-3.lib
deleted file mode 100644
index 3661f5a..0000000
--- a/funasr/runtime/onnxruntime/win/lib/x64/libfftw3l-3.lib
+++ /dev/null
Binary files differ
diff --git a/funasr/runtime/onnxruntime/win/lib/x64/onnxruntime.lib b/funasr/runtime/onnxruntime/win/lib/x64/onnxruntime.lib
deleted file mode 100644
index b1a314c..0000000
--- a/funasr/runtime/onnxruntime/win/lib/x64/onnxruntime.lib
+++ /dev/null
Binary files differ
diff --git a/funasr/runtime/onnxruntime/win/lib/x86/libfftw3-3.def b/funasr/runtime/onnxruntime/win/lib/x86/libfftw3-3.def
deleted file mode 100644
index 4b50ecd..0000000
--- a/funasr/runtime/onnxruntime/win/lib/x86/libfftw3-3.def
+++ /dev/null
@@ -1,1017 +0,0 @@
-LIBRARY libfftw3-3.dll
-EXPORTS
-dfftw_cleanup_
-dfftw_cleanup__
-dfftw_cleanup_threads_
-dfftw_cleanup_threads__
-dfftw_cost_
-dfftw_cost__
-dfftw_destroy_plan_
-dfftw_destroy_plan__
-dfftw_estimate_cost_
-dfftw_estimate_cost__
-dfftw_execute_
-dfftw_execute__
-dfftw_execute_dft_
-dfftw_execute_dft__
-dfftw_execute_dft_c2r_
-dfftw_execute_dft_c2r__
-dfftw_execute_dft_r2c_
-dfftw_execute_dft_r2c__
-dfftw_execute_r2r_
-dfftw_execute_r2r__
-dfftw_execute_split_dft_
-dfftw_execute_split_dft__
-dfftw_execute_split_dft_c2r_
-dfftw_execute_split_dft_c2r__
-dfftw_execute_split_dft_r2c_
-dfftw_execute_split_dft_r2c__
-dfftw_export_wisdom_
-dfftw_export_wisdom__
-dfftw_flops_
-dfftw_flops__
-dfftw_forget_wisdom_
-dfftw_forget_wisdom__
-dfftw_import_system_wisdom_
-dfftw_import_system_wisdom__
-dfftw_import_wisdom_
-dfftw_import_wisdom__
-dfftw_init_threads_
-dfftw_init_threads__
-dfftw_plan_dft_
-dfftw_plan_dft__
-dfftw_plan_dft_1d_
-dfftw_plan_dft_1d__
-dfftw_plan_dft_2d_
-dfftw_plan_dft_2d__
-dfftw_plan_dft_3d_
-dfftw_plan_dft_3d__
-dfftw_plan_dft_c2r_
-dfftw_plan_dft_c2r__
-dfftw_plan_dft_c2r_1d_
-dfftw_plan_dft_c2r_1d__
-dfftw_plan_dft_c2r_2d_
-dfftw_plan_dft_c2r_2d__
-dfftw_plan_dft_c2r_3d_
-dfftw_plan_dft_c2r_3d__
-dfftw_plan_dft_r2c_
-dfftw_plan_dft_r2c__
-dfftw_plan_dft_r2c_1d_
-dfftw_plan_dft_r2c_1d__
-dfftw_plan_dft_r2c_2d_
-dfftw_plan_dft_r2c_2d__
-dfftw_plan_dft_r2c_3d_
-dfftw_plan_dft_r2c_3d__
-dfftw_plan_guru_dft_
-dfftw_plan_guru_dft__
-dfftw_plan_guru_dft_c2r_
-dfftw_plan_guru_dft_c2r__
-dfftw_plan_guru_dft_r2c_
-dfftw_plan_guru_dft_r2c__
-dfftw_plan_guru_r2r_
-dfftw_plan_guru_r2r__
-dfftw_plan_guru_split_dft_
-dfftw_plan_guru_split_dft__
-dfftw_plan_guru_split_dft_c2r_
-dfftw_plan_guru_split_dft_c2r__
-dfftw_plan_guru_split_dft_r2c_
-dfftw_plan_guru_split_dft_r2c__
-dfftw_plan_many_dft_
-dfftw_plan_many_dft__
-dfftw_plan_many_dft_c2r_
-dfftw_plan_many_dft_c2r__
-dfftw_plan_many_dft_r2c_
-dfftw_plan_many_dft_r2c__
-dfftw_plan_many_r2r_
-dfftw_plan_many_r2r__
-dfftw_plan_r2r_
-dfftw_plan_r2r__
-dfftw_plan_r2r_1d_
-dfftw_plan_r2r_1d__
-dfftw_plan_r2r_2d_
-dfftw_plan_r2r_2d__
-dfftw_plan_r2r_3d_
-dfftw_plan_r2r_3d__
-dfftw_plan_with_nthreads_
-dfftw_plan_with_nthreads__
-dfftw_print_plan_
-dfftw_print_plan__
-dfftw_set_timelimit_
-dfftw_set_timelimit__
-fftw_alignment_of
-fftw_alloc_complex
-fftw_alloc_real
-fftw_assertion_failed
-fftw_bufdist
-fftw_check_alignment_of_sse2_pm
-fftw_choose_radix
-fftw_cleanup
-fftw_cleanup_threads
-fftw_codelet_e01_8
-fftw_codelet_e10_8
-fftw_codelet_hb_10
-fftw_codelet_hb_12
-fftw_codelet_hb_15
-fftw_codelet_hb_16
-fftw_codelet_hb_2
-fftw_codelet_hb_20
-fftw_codelet_hb2_16
-fftw_codelet_hb2_20
-fftw_codelet_hb2_25
-fftw_codelet_hb2_32
-fftw_codelet_hb2_4
-fftw_codelet_hb_25
-fftw_codelet_hb2_5
-fftw_codelet_hb2_8
-fftw_codelet_hb_3
-fftw_codelet_hb_32
-fftw_codelet_hb_4
-fftw_codelet_hb_5
-fftw_codelet_hb_6
-fftw_codelet_hb_64
-fftw_codelet_hb_7
-fftw_codelet_hb_8
-fftw_codelet_hb_9
-fftw_codelet_hc2cb_10
-fftw_codelet_hc2cb_12
-fftw_codelet_hc2cb_16
-fftw_codelet_hc2cb_2
-fftw_codelet_hc2cb_20
-fftw_codelet_hc2cb2_16
-fftw_codelet_hc2cb2_20
-fftw_codelet_hc2cb2_32
-fftw_codelet_hc2cb2_4
-fftw_codelet_hc2cb2_8
-fftw_codelet_hc2cb_32
-fftw_codelet_hc2cb_4
-fftw_codelet_hc2cb_6
-fftw_codelet_hc2cb_8
-fftw_codelet_hc2cbdft_10
-fftw_codelet_hc2cbdft_12
-fftw_codelet_hc2cbdft_16
-fftw_codelet_hc2cbdft_2
-fftw_codelet_hc2cbdft_20
-fftw_codelet_hc2cbdft2_16
-fftw_codelet_hc2cbdft2_20
-fftw_codelet_hc2cbdft2_32
-fftw_codelet_hc2cbdft2_4
-fftw_codelet_hc2cbdft2_8
-fftw_codelet_hc2cbdft_32
-fftw_codelet_hc2cbdft_4
-fftw_codelet_hc2cbdft_6
-fftw_codelet_hc2cbdft_8
-fftw_codelet_hc2cbdftv_10_avx
-fftw_codelet_hc2cbdftv_10_sse2
-fftw_codelet_hc2cbdftv_12_avx
-fftw_codelet_hc2cbdftv_12_sse2
-fftw_codelet_hc2cbdftv_16_avx
-fftw_codelet_hc2cbdftv_16_sse2
-fftw_codelet_hc2cbdftv_20_avx
-fftw_codelet_hc2cbdftv_20_sse2
-fftw_codelet_hc2cbdftv_2_avx
-fftw_codelet_hc2cbdftv_2_sse2
-fftw_codelet_hc2cbdftv_32_avx
-fftw_codelet_hc2cbdftv_32_sse2
-fftw_codelet_hc2cbdftv_4_avx
-fftw_codelet_hc2cbdftv_4_sse2
-fftw_codelet_hc2cbdftv_6_avx
-fftw_codelet_hc2cbdftv_6_sse2
-fftw_codelet_hc2cbdftv_8_avx
-fftw_codelet_hc2cbdftv_8_sse2
-fftw_codelet_hc2cf_10
-fftw_codelet_hc2cf_12
-fftw_codelet_hc2cf_16
-fftw_codelet_hc2cf_2
-fftw_codelet_hc2cf_20
-fftw_codelet_hc2cf2_16
-fftw_codelet_hc2cf2_20
-fftw_codelet_hc2cf2_32
-fftw_codelet_hc2cf2_4
-fftw_codelet_hc2cf2_8
-fftw_codelet_hc2cf_32
-fftw_codelet_hc2cf_4
-fftw_codelet_hc2cf_6
-fftw_codelet_hc2cf_8
-fftw_codelet_hc2cfdft_10
-fftw_codelet_hc2cfdft_12
-fftw_codelet_hc2cfdft_16
-fftw_codelet_hc2cfdft_2
-fftw_codelet_hc2cfdft_20
-fftw_codelet_hc2cfdft2_16
-fftw_codelet_hc2cfdft2_20
-fftw_codelet_hc2cfdft2_32
-fftw_codelet_hc2cfdft2_4
-fftw_codelet_hc2cfdft2_8
-fftw_codelet_hc2cfdft_32
-fftw_codelet_hc2cfdft_4
-fftw_codelet_hc2cfdft_6
-fftw_codelet_hc2cfdft_8
-fftw_codelet_hc2cfdftv_10_avx
-fftw_codelet_hc2cfdftv_10_sse2
-fftw_codelet_hc2cfdftv_12_avx
-fftw_codelet_hc2cfdftv_12_sse2
-fftw_codelet_hc2cfdftv_16_avx
-fftw_codelet_hc2cfdftv_16_sse2
-fftw_codelet_hc2cfdftv_20_avx
-fftw_codelet_hc2cfdftv_20_sse2
-fftw_codelet_hc2cfdftv_2_avx
-fftw_codelet_hc2cfdftv_2_sse2
-fftw_codelet_hc2cfdftv_32_avx
-fftw_codelet_hc2cfdftv_32_sse2
-fftw_codelet_hc2cfdftv_4_avx
-fftw_codelet_hc2cfdftv_4_sse2
-fftw_codelet_hc2cfdftv_6_avx
-fftw_codelet_hc2cfdftv_6_sse2
-fftw_codelet_hc2cfdftv_8_avx
-fftw_codelet_hc2cfdftv_8_sse2
-fftw_codelet_hf_10
-fftw_codelet_hf_12
-fftw_codelet_hf_15
-fftw_codelet_hf_16
-fftw_codelet_hf_2
-fftw_codelet_hf_20
-fftw_codelet_hf2_16
-fftw_codelet_hf2_20
-fftw_codelet_hf2_25
-fftw_codelet_hf2_32
-fftw_codelet_hf2_4
-fftw_codelet_hf_25
-fftw_codelet_hf2_5
-fftw_codelet_hf2_8
-fftw_codelet_hf_3
-fftw_codelet_hf_32
-fftw_codelet_hf_4
-fftw_codelet_hf_5
-fftw_codelet_hf_6
-fftw_codelet_hf_64
-fftw_codelet_hf_7
-fftw_codelet_hf_8
-fftw_codelet_hf_9
-fftw_codelet_n1_10
-fftw_codelet_n1_11
-fftw_codelet_n1_12
-fftw_codelet_n1_13
-fftw_codelet_n1_14
-fftw_codelet_n1_15
-fftw_codelet_n1_16
-fftw_codelet_n1_2
-fftw_codelet_n1_20
-fftw_codelet_n1_25
-fftw_codelet_n1_3
-fftw_codelet_n1_32
-fftw_codelet_n1_4
-fftw_codelet_n1_5
-fftw_codelet_n1_6
-fftw_codelet_n1_64
-fftw_codelet_n1_7
-fftw_codelet_n1_8
-fftw_codelet_n1_9
-fftw_codelet_n1bv_10_avx
-fftw_codelet_n1bv_10_sse2
-fftw_codelet_n1bv_11_avx
-fftw_codelet_n1bv_11_sse2
-fftw_codelet_n1bv_128_avx
-fftw_codelet_n1bv_128_sse2
-fftw_codelet_n1bv_12_avx
-fftw_codelet_n1bv_12_sse2
-fftw_codelet_n1bv_13_avx
-fftw_codelet_n1bv_13_sse2
-fftw_codelet_n1bv_14_avx
-fftw_codelet_n1bv_14_sse2
-fftw_codelet_n1bv_15_avx
-fftw_codelet_n1bv_15_sse2
-fftw_codelet_n1bv_16_avx
-fftw_codelet_n1bv_16_sse2
-fftw_codelet_n1bv_20_avx
-fftw_codelet_n1bv_20_sse2
-fftw_codelet_n1bv_25_avx
-fftw_codelet_n1bv_25_sse2
-fftw_codelet_n1bv_2_avx
-fftw_codelet_n1bv_2_sse2
-fftw_codelet_n1bv_32_avx
-fftw_codelet_n1bv_32_sse2
-fftw_codelet_n1bv_3_avx
-fftw_codelet_n1bv_3_sse2
-fftw_codelet_n1bv_4_avx
-fftw_codelet_n1bv_4_sse2
-fftw_codelet_n1bv_5_avx
-fftw_codelet_n1bv_5_sse2
-fftw_codelet_n1bv_64_avx
-fftw_codelet_n1bv_64_sse2
-fftw_codelet_n1bv_6_avx
-fftw_codelet_n1bv_6_sse2
-fftw_codelet_n1bv_7_avx
-fftw_codelet_n1bv_7_sse2
-fftw_codelet_n1bv_8_avx
-fftw_codelet_n1bv_8_sse2
-fftw_codelet_n1bv_9_avx
-fftw_codelet_n1bv_9_sse2
-fftw_codelet_n1fv_10_avx
-fftw_codelet_n1fv_10_sse2
-fftw_codelet_n1fv_11_avx
-fftw_codelet_n1fv_11_sse2
-fftw_codelet_n1fv_128_avx
-fftw_codelet_n1fv_128_sse2
-fftw_codelet_n1fv_12_avx
-fftw_codelet_n1fv_12_sse2
-fftw_codelet_n1fv_13_avx
-fftw_codelet_n1fv_13_sse2
-fftw_codelet_n1fv_14_avx
-fftw_codelet_n1fv_14_sse2
-fftw_codelet_n1fv_15_avx
-fftw_codelet_n1fv_15_sse2
-fftw_codelet_n1fv_16_avx
-fftw_codelet_n1fv_16_sse2
-fftw_codelet_n1fv_20_avx
-fftw_codelet_n1fv_20_sse2
-fftw_codelet_n1fv_25_avx
-fftw_codelet_n1fv_25_sse2
-fftw_codelet_n1fv_2_avx
-fftw_codelet_n1fv_2_sse2
-fftw_codelet_n1fv_32_avx
-fftw_codelet_n1fv_32_sse2
-fftw_codelet_n1fv_3_avx
-fftw_codelet_n1fv_3_sse2
-fftw_codelet_n1fv_4_avx
-fftw_codelet_n1fv_4_sse2
-fftw_codelet_n1fv_5_avx
-fftw_codelet_n1fv_5_sse2
-fftw_codelet_n1fv_64_avx
-fftw_codelet_n1fv_64_sse2
-fftw_codelet_n1fv_6_avx
-fftw_codelet_n1fv_6_sse2
-fftw_codelet_n1fv_7_avx
-fftw_codelet_n1fv_7_sse2
-fftw_codelet_n1fv_8_avx
-fftw_codelet_n1fv_8_sse2
-fftw_codelet_n1fv_9_avx
-fftw_codelet_n1fv_9_sse2
-fftw_codelet_n2bv_10_avx
-fftw_codelet_n2bv_10_sse2
-fftw_codelet_n2bv_12_avx
-fftw_codelet_n2bv_12_sse2
-fftw_codelet_n2bv_14_avx
-fftw_codelet_n2bv_14_sse2
-fftw_codelet_n2bv_16_avx
-fftw_codelet_n2bv_16_sse2
-fftw_codelet_n2bv_20_avx
-fftw_codelet_n2bv_20_sse2
-fftw_codelet_n2bv_2_avx
-fftw_codelet_n2bv_2_sse2
-fftw_codelet_n2bv_32_avx
-fftw_codelet_n2bv_32_sse2
-fftw_codelet_n2bv_4_avx
-fftw_codelet_n2bv_4_sse2
-fftw_codelet_n2bv_64_avx
-fftw_codelet_n2bv_64_sse2
-fftw_codelet_n2bv_6_avx
-fftw_codelet_n2bv_6_sse2
-fftw_codelet_n2bv_8_avx
-fftw_codelet_n2bv_8_sse2
-fftw_codelet_n2fv_10_avx
-fftw_codelet_n2fv_10_sse2
-fftw_codelet_n2fv_12_avx
-fftw_codelet_n2fv_12_sse2
-fftw_codelet_n2fv_14_avx
-fftw_codelet_n2fv_14_sse2
-fftw_codelet_n2fv_16_avx
-fftw_codelet_n2fv_16_sse2
-fftw_codelet_n2fv_20_avx
-fftw_codelet_n2fv_20_sse2
-fftw_codelet_n2fv_2_avx
-fftw_codelet_n2fv_2_sse2
-fftw_codelet_n2fv_32_avx
-fftw_codelet_n2fv_32_sse2
-fftw_codelet_n2fv_4_avx
-fftw_codelet_n2fv_4_sse2
-fftw_codelet_n2fv_64_avx
-fftw_codelet_n2fv_64_sse2
-fftw_codelet_n2fv_6_avx
-fftw_codelet_n2fv_6_sse2
-fftw_codelet_n2fv_8_avx
-fftw_codelet_n2fv_8_sse2
-fftw_codelet_n2sv_16_avx
-fftw_codelet_n2sv_16_sse2
-fftw_codelet_n2sv_32_avx
-fftw_codelet_n2sv_32_sse2
-fftw_codelet_n2sv_4_avx
-fftw_codelet_n2sv_4_sse2
-fftw_codelet_n2sv_64_avx
-fftw_codelet_n2sv_64_sse2
-fftw_codelet_n2sv_8_avx
-fftw_codelet_n2sv_8_sse2
-fftw_codelet_q1_2
-fftw_codelet_q1_3
-fftw_codelet_q1_4
-fftw_codelet_q1_5
-fftw_codelet_q1_6
-fftw_codelet_q1_8
-fftw_codelet_q1bv_2_avx
-fftw_codelet_q1bv_2_sse2
-fftw_codelet_q1bv_4_avx
-fftw_codelet_q1bv_4_sse2
-fftw_codelet_q1bv_5_avx
-fftw_codelet_q1bv_5_sse2
-fftw_codelet_q1bv_8_avx
-fftw_codelet_q1bv_8_sse2
-fftw_codelet_q1fv_2_avx
-fftw_codelet_q1fv_2_sse2
-fftw_codelet_q1fv_4_avx
-fftw_codelet_q1fv_4_sse2
-fftw_codelet_q1fv_5_avx
-fftw_codelet_q1fv_5_sse2
-fftw_codelet_q1fv_8_avx
-fftw_codelet_q1fv_8_sse2
-fftw_codelet_r2cb_10
-fftw_codelet_r2cb_11
-fftw_codelet_r2cb_12
-fftw_codelet_r2cb_128
-fftw_codelet_r2cb_13
-fftw_codelet_r2cb_14
-fftw_codelet_r2cb_15
-fftw_codelet_r2cb_16
-fftw_codelet_r2cb_2
-fftw_codelet_r2cb_20
-fftw_codelet_r2cb_25
-fftw_codelet_r2cb_3
-fftw_codelet_r2cb_32
-fftw_codelet_r2cb_4
-fftw_codelet_r2cb_5
-fftw_codelet_r2cb_6
-fftw_codelet_r2cb_64
-fftw_codelet_r2cb_7
-fftw_codelet_r2cb_8
-fftw_codelet_r2cb_9
-fftw_codelet_r2cbIII_10
-fftw_codelet_r2cbIII_12
-fftw_codelet_r2cbIII_15
-fftw_codelet_r2cbIII_16
-fftw_codelet_r2cbIII_2
-fftw_codelet_r2cbIII_20
-fftw_codelet_r2cbIII_25
-fftw_codelet_r2cbIII_3
-fftw_codelet_r2cbIII_32
-fftw_codelet_r2cbIII_4
-fftw_codelet_r2cbIII_5
-fftw_codelet_r2cbIII_6
-fftw_codelet_r2cbIII_64
-fftw_codelet_r2cbIII_7
-fftw_codelet_r2cbIII_8
-fftw_codelet_r2cbIII_9
-fftw_codelet_r2cf_10
-fftw_codelet_r2cf_11
-fftw_codelet_r2cf_12
-fftw_codelet_r2cf_128
-fftw_codelet_r2cf_13
-fftw_codelet_r2cf_14
-fftw_codelet_r2cf_15
-fftw_codelet_r2cf_16
-fftw_codelet_r2cf_2
-fftw_codelet_r2cf_20
-fftw_codelet_r2cf_25
-fftw_codelet_r2cf_3
-fftw_codelet_r2cf_32
-fftw_codelet_r2cf_4
-fftw_codelet_r2cf_5
-fftw_codelet_r2cf_6
-fftw_codelet_r2cf_64
-fftw_codelet_r2cf_7
-fftw_codelet_r2cf_8
-fftw_codelet_r2cf_9
-fftw_codelet_r2cfII_10
-fftw_codelet_r2cfII_12
-fftw_codelet_r2cfII_15
-fftw_codelet_r2cfII_16
-fftw_codelet_r2cfII_2
-fftw_codelet_r2cfII_20
-fftw_codelet_r2cfII_25
-fftw_codelet_r2cfII_3
-fftw_codelet_r2cfII_32
-fftw_codelet_r2cfII_4
-fftw_codelet_r2cfII_5
-fftw_codelet_r2cfII_6
-fftw_codelet_r2cfII_64
-fftw_codelet_r2cfII_7
-fftw_codelet_r2cfII_8
-fftw_codelet_r2cfII_9
-fftw_codelet_t1_10
-fftw_codelet_t1_12
-fftw_codelet_t1_15
-fftw_codelet_t1_16
-fftw_codelet_t1_2
-fftw_codelet_t1_20
-fftw_codelet_t1_25
-fftw_codelet_t1_3
-fftw_codelet_t1_32
-fftw_codelet_t1_4
-fftw_codelet_t1_5
-fftw_codelet_t1_6
-fftw_codelet_t1_64
-fftw_codelet_t1_7
-fftw_codelet_t1_8
-fftw_codelet_t1_9
-fftw_codelet_t1buv_10_avx
-fftw_codelet_t1buv_10_sse2
-fftw_codelet_t1buv_2_avx
-fftw_codelet_t1buv_2_sse2
-fftw_codelet_t1buv_3_avx
-fftw_codelet_t1buv_3_sse2
-fftw_codelet_t1buv_4_avx
-fftw_codelet_t1buv_4_sse2
-fftw_codelet_t1buv_5_avx
-fftw_codelet_t1buv_5_sse2
-fftw_codelet_t1buv_6_avx
-fftw_codelet_t1buv_6_sse2
-fftw_codelet_t1buv_7_avx
-fftw_codelet_t1buv_7_sse2
-fftw_codelet_t1buv_8_avx
-fftw_codelet_t1buv_8_sse2
-fftw_codelet_t1buv_9_avx
-fftw_codelet_t1buv_9_sse2
-fftw_codelet_t1bv_10_avx
-fftw_codelet_t1bv_10_sse2
-fftw_codelet_t1bv_12_avx
-fftw_codelet_t1bv_12_sse2
-fftw_codelet_t1bv_15_avx
-fftw_codelet_t1bv_15_sse2
-fftw_codelet_t1bv_16_avx
-fftw_codelet_t1bv_16_sse2
-fftw_codelet_t1bv_20_avx
-fftw_codelet_t1bv_20_sse2
-fftw_codelet_t1bv_25_avx
-fftw_codelet_t1bv_25_sse2
-fftw_codelet_t1bv_2_avx
-fftw_codelet_t1bv_2_sse2
-fftw_codelet_t1bv_32_avx
-fftw_codelet_t1bv_32_sse2
-fftw_codelet_t1bv_3_avx
-fftw_codelet_t1bv_3_sse2
-fftw_codelet_t1bv_4_avx
-fftw_codelet_t1bv_4_sse2
-fftw_codelet_t1bv_5_avx
-fftw_codelet_t1bv_5_sse2
-fftw_codelet_t1bv_64_avx
-fftw_codelet_t1bv_64_sse2
-fftw_codelet_t1bv_6_avx
-fftw_codelet_t1bv_6_sse2
-fftw_codelet_t1bv_7_avx
-fftw_codelet_t1bv_7_sse2
-fftw_codelet_t1bv_8_avx
-fftw_codelet_t1bv_8_sse2
-fftw_codelet_t1bv_9_avx
-fftw_codelet_t1bv_9_sse2
-fftw_codelet_t1fuv_10_avx
-fftw_codelet_t1fuv_10_sse2
-fftw_codelet_t1fuv_2_avx
-fftw_codelet_t1fuv_2_sse2
-fftw_codelet_t1fuv_3_avx
-fftw_codelet_t1fuv_3_sse2
-fftw_codelet_t1fuv_4_avx
-fftw_codelet_t1fuv_4_sse2
-fftw_codelet_t1fuv_5_avx
-fftw_codelet_t1fuv_5_sse2
-fftw_codelet_t1fuv_6_avx
-fftw_codelet_t1fuv_6_sse2
-fftw_codelet_t1fuv_7_avx
-fftw_codelet_t1fuv_7_sse2
-fftw_codelet_t1fuv_8_avx
-fftw_codelet_t1fuv_8_sse2
-fftw_codelet_t1fuv_9_avx
-fftw_codelet_t1fuv_9_sse2
-fftw_codelet_t1fv_10_avx
-fftw_codelet_t1fv_10_sse2
-fftw_codelet_t1fv_12_avx
-fftw_codelet_t1fv_12_sse2
-fftw_codelet_t1fv_15_avx
-fftw_codelet_t1fv_15_sse2
-fftw_codelet_t1fv_16_avx
-fftw_codelet_t1fv_16_sse2
-fftw_codelet_t1fv_20_avx
-fftw_codelet_t1fv_20_sse2
-fftw_codelet_t1fv_25_avx
-fftw_codelet_t1fv_25_sse2
-fftw_codelet_t1fv_2_avx
-fftw_codelet_t1fv_2_sse2
-fftw_codelet_t1fv_32_avx
-fftw_codelet_t1fv_32_sse2
-fftw_codelet_t1fv_3_avx
-fftw_codelet_t1fv_3_sse2
-fftw_codelet_t1fv_4_avx
-fftw_codelet_t1fv_4_sse2
-fftw_codelet_t1fv_5_avx
-fftw_codelet_t1fv_5_sse2
-fftw_codelet_t1fv_64_avx
-fftw_codelet_t1fv_64_sse2
-fftw_codelet_t1fv_6_avx
-fftw_codelet_t1fv_6_sse2
-fftw_codelet_t1fv_7_avx
-fftw_codelet_t1fv_7_sse2
-fftw_codelet_t1fv_8_avx
-fftw_codelet_t1fv_8_sse2
-fftw_codelet_t1fv_9_avx
-fftw_codelet_t1fv_9_sse2
-fftw_codelet_t1sv_16_avx
-fftw_codelet_t1sv_16_sse2
-fftw_codelet_t1sv_2_avx
-fftw_codelet_t1sv_2_sse2
-fftw_codelet_t1sv_32_avx
-fftw_codelet_t1sv_32_sse2
-fftw_codelet_t1sv_4_avx
-fftw_codelet_t1sv_4_sse2
-fftw_codelet_t1sv_8_avx
-fftw_codelet_t1sv_8_sse2
-fftw_codelet_t2_10
-fftw_codelet_t2_16
-fftw_codelet_t2_20
-fftw_codelet_t2_25
-fftw_codelet_t2_32
-fftw_codelet_t2_4
-fftw_codelet_t2_5
-fftw_codelet_t2_64
-fftw_codelet_t2_8
-fftw_codelet_t2bv_10_avx
-fftw_codelet_t2bv_10_sse2
-fftw_codelet_t2bv_16_avx
-fftw_codelet_t2bv_16_sse2
-fftw_codelet_t2bv_20_avx
-fftw_codelet_t2bv_20_sse2
-fftw_codelet_t2bv_25_avx
-fftw_codelet_t2bv_25_sse2
-fftw_codelet_t2bv_2_avx
-fftw_codelet_t2bv_2_sse2
-fftw_codelet_t2bv_32_avx
-fftw_codelet_t2bv_32_sse2
-fftw_codelet_t2bv_4_avx
-fftw_codelet_t2bv_4_sse2
-fftw_codelet_t2bv_5_avx
-fftw_codelet_t2bv_5_sse2
-fftw_codelet_t2bv_64_avx
-fftw_codelet_t2bv_64_sse2
-fftw_codelet_t2bv_8_avx
-fftw_codelet_t2bv_8_sse2
-fftw_codelet_t2fv_10_avx
-fftw_codelet_t2fv_10_sse2
-fftw_codelet_t2fv_16_avx
-fftw_codelet_t2fv_16_sse2
-fftw_codelet_t2fv_20_avx
-fftw_codelet_t2fv_20_sse2
-fftw_codelet_t2fv_25_avx
-fftw_codelet_t2fv_25_sse2
-fftw_codelet_t2fv_2_avx
-fftw_codelet_t2fv_2_sse2
-fftw_codelet_t2fv_32_avx
-fftw_codelet_t2fv_32_sse2
-fftw_codelet_t2fv_4_avx
-fftw_codelet_t2fv_4_sse2
-fftw_codelet_t2fv_5_avx
-fftw_codelet_t2fv_5_sse2
-fftw_codelet_t2fv_64_avx
-fftw_codelet_t2fv_64_sse2
-fftw_codelet_t2fv_8_avx
-fftw_codelet_t2fv_8_sse2
-fftw_codelet_t2sv_16_avx
-fftw_codelet_t2sv_16_sse2
-fftw_codelet_t2sv_32_avx
-fftw_codelet_t2sv_32_sse2
-fftw_codelet_t2sv_4_avx
-fftw_codelet_t2sv_4_sse2
-fftw_codelet_t2sv_8_avx
-fftw_codelet_t2sv_8_sse2
-fftw_codelet_t3bv_10_avx
-fftw_codelet_t3bv_10_sse2
-fftw_codelet_t3bv_16_avx
-fftw_codelet_t3bv_16_sse2
-fftw_codelet_t3bv_20_avx
-fftw_codelet_t3bv_20_sse2
-fftw_codelet_t3bv_25_avx
-fftw_codelet_t3bv_25_sse2
-fftw_codelet_t3bv_32_avx
-fftw_codelet_t3bv_32_sse2
-fftw_codelet_t3bv_4_avx
-fftw_codelet_t3bv_4_sse2
-fftw_codelet_t3bv_5_avx
-fftw_codelet_t3bv_5_sse2
-fftw_codelet_t3bv_8_avx
-fftw_codelet_t3bv_8_sse2
-fftw_codelet_t3fv_10_avx
-fftw_codelet_t3fv_10_sse2
-fftw_codelet_t3fv_16_avx
-fftw_codelet_t3fv_16_sse2
-fftw_codelet_t3fv_20_avx
-fftw_codelet_t3fv_20_sse2
-fftw_codelet_t3fv_25_avx
-fftw_codelet_t3fv_25_sse2
-fftw_codelet_t3fv_32_avx
-fftw_codelet_t3fv_32_sse2
-fftw_codelet_t3fv_4_avx
-fftw_codelet_t3fv_4_sse2
-fftw_codelet_t3fv_5_avx
-fftw_codelet_t3fv_5_sse2
-fftw_codelet_t3fv_8_avx
-fftw_codelet_t3fv_8_sse2
-fftw_compute_tilesz
-fftw_configure_planner
-fftw_cost
-fftw_cpy1d
-fftw_cpy2d
-fftw_cpy2d_ci
-fftw_cpy2d_co
-fftw_cpy2d_pair
-fftw_cpy2d_pair_ci
-fftw_cpy2d_pair_co
-fftw_cpy2d_tiled
-fftw_cpy2d_tiledbuf
-fftw_ct_applicable
-fftw_ct_genericbuf_register
-fftw_ct_generic_register
-fftw_ct_uglyp
-fftw_destroy_plan
-fftw_dft_bluestein_register
-fftw_dft_buffered_register
-fftw_dft_conf_standard
-fftw_dft_generic_register
-fftw_dft_indirect_register
-fftw_dft_indirect_transpose_register
-fftw_dft_nop_register
-fftw_dft_r2hc_register
-fftw_dft_rader_register
-fftw_dft_rank_geq2_register
-fftw_dft_solve
-fftw_dft_thr_vrank_geq1_register
-fftw_dft_vrank_geq1_register
-fftw_dft_zerotens
-fftw_dht_r2hc_register
-fftw_dht_rader_register
-fftw_dimcmp
-fftw_elapsed_since
-fftw_estimate_cost
-fftw_execute
-fftw_execute_dft
-fftw_execute_dft_c2r
-fftw_execute_dft_r2c
-fftw_execute_r2r
-fftw_execute_split_dft
-fftw_execute_split_dft_c2r
-fftw_execute_split_dft_r2c
-fftw_export_wisdom
-fftw_export_wisdom_to_file
-fftw_export_wisdom_to_filename
-fftw_export_wisdom_to_string
-fftw_extract_reim
-fftw_factors_into
-fftw_factors_into_small_primes
-fftw_find_generator
-fftw_first_divisor
-fftw_flops
-fftw_forget_wisdom
-fftw_fprint_plan
-fftw_free
-fftw_get_crude_time
-fftw_guru64_kosherp
-fftw_guru_kosherp
-fftw_hash
-fftw_have_simd_avx
-fftw_have_simd_sse2
-fftw_hc2hc_applicable
-fftw_hc2hc_generic_register
-fftw_iabs
-fftw_ialignment_of
-fftw_iestimate_cost
-fftw_ifree
-fftw_ifree0
-fftw_imax
-fftw_imin
-fftw_import_system_wisdom
-fftw_import_wisdom
-fftw_import_wisdom_from_file
-fftw_import_wisdom_from_filename
-fftw_import_wisdom_from_string
-fftw_init_threads
-fftw_is_prime
-fftw_isqrt
-fftw_ithreads_init
-fftw_join_taint
-fftw_kdft_dif_register
-fftw_kdft_difsq_register
-fftw_kdft_dit_register
-fftw_kdft_register
-fftw_kernel_free
-fftw_kernel_malloc
-fftw_khc2c_register
-fftw_khc2hc_register
-fftw_kr2c_register
-fftw_kr2r_register
-fftw_make_planner_thread_safe
-fftw_malloc
-fftw_malloc_plain
-fftw_many_kosherp
-fftw_mapflags
-fftw_map_r2r_kind
-fftw_md5begin
-fftw_md5end
-fftw_md5int
-fftw_md5INT
-fftw_md5putb
-fftw_md5putc
-fftw_md5puts
-fftw_md5unsigned
-fftw_measure_execution_time
-fftw_mkapiplan
-fftw_mkplan
-fftw_mkplan_d
-fftw_mkplan_dft
-fftw_mkplan_dftw
-fftw_mkplan_f_d
-fftw_mkplan_hc2c
-fftw_mkplan_hc2hc
-fftw_mkplanner
-fftw_mkplan_rdft
-fftw_mkplan_rdft2
-fftw_mkprinter
-fftw_mkprinter_cnt
-fftw_mkprinter_file
-fftw_mkprinter_str
-fftw_mkproblem
-fftw_mkproblem_dft
-fftw_mkproblem_dft_d
-fftw_mkproblem_rdft
-fftw_mkproblem_rdft_0_d
-fftw_mkproblem_rdft_1
-fftw_mkproblem_rdft_1_d
-fftw_mkproblem_rdft2
-fftw_mkproblem_rdft2_d
-fftw_mkproblem_rdft2_d_3pointers
-fftw_mkproblem_rdft_d
-fftw_mkproblem_unsolvable
-fftw_mkscanner
-fftw_mksolver
-fftw_mksolver_ct
-fftw_mksolver_ct_threads
-fftw_mksolver_dft_direct
-fftw_mksolver_dft_directbuf
-fftw_mksolver_hc2c
-fftw_mksolver_hc2hc
-fftw_mksolver_hc2hc_threads
-fftw_mksolver_rdft2_direct
-fftw_mksolver_rdft_r2c_direct
-fftw_mksolver_rdft_r2c_directbuf
-fftw_mksolver_rdft_r2r_direct
-fftw_mkstride
-fftw_mktensor
-fftw_mktensor_0d
-fftw_mktensor_1d
-fftw_mktensor_2d
-fftw_mktensor_3d
-fftw_mktensor_4d
-fftw_mktensor_5d
-fftw_mktensor_iodims
-fftw_mktensor_iodims64
-fftw_mktensor_rowmajor
-fftw_mktriggen
-fftw_modulo
-fftw_nbuf
-fftw_nbuf_redundant
-fftw_next_prime
-fftw_null_awake
-fftw_ops_add
-fftw_ops_add2
-fftw_ops_cpy
-fftw_ops_madd
-fftw_ops_madd2
-fftw_ops_other
-fftw_ops_zero
-fftw_pickdim
-fftw_plan_awake
-fftw_plan_destroy_internal
-fftw_plan_dft
-fftw_plan_dft_1d
-fftw_plan_dft_2d
-fftw_plan_dft_3d
-fftw_plan_dft_c2r
-fftw_plan_dft_c2r_1d
-fftw_plan_dft_c2r_2d
-fftw_plan_dft_c2r_3d
-fftw_plan_dft_r2c
-fftw_plan_dft_r2c_1d
-fftw_plan_dft_r2c_2d
-fftw_plan_dft_r2c_3d
-fftw_plan_guru64_dft
-fftw_plan_guru64_dft_c2r
-fftw_plan_guru64_dft_r2c
-fftw_plan_guru64_r2r
-fftw_plan_guru64_split_dft
-fftw_plan_guru64_split_dft_c2r
-fftw_plan_guru64_split_dft_r2c
-fftw_plan_guru_dft
-fftw_plan_guru_dft_c2r
-fftw_plan_guru_dft_r2c
-fftw_plan_guru_r2r
-fftw_plan_guru_split_dft
-fftw_plan_guru_split_dft_c2r
-fftw_plan_guru_split_dft_r2c
-fftw_plan_many_dft
-fftw_plan_many_dft_c2r
-fftw_plan_many_dft_r2c
-fftw_plan_many_r2r
-fftw_planner_destroy
-fftw_plan_null_destroy
-fftw_plan_r2r
-fftw_plan_r2r_1d
-fftw_plan_r2r_2d
-fftw_plan_r2r_3d
-fftw_plan_with_nthreads
-fftw_power_mod
-fftw_printer_destroy
-fftw_print_plan
-fftw_problem_destroy
-fftw_rader_tl_delete
-fftw_rader_tl_find
-fftw_rader_tl_insert
-fftw_rdft2_buffered_register
-fftw_rdft2_complex_n
-fftw_rdft2_inplace_strides
-fftw_rdft2_nop_register
-fftw_rdft2_pad
-fftw_rdft2_rank0_register
-fftw_rdft2_rank_geq2_register
-fftw_rdft2_rdft_register
-fftw_rdft2_solve
-fftw_rdft2_strides
-fftw_rdft2_tensor_max_index
-fftw_rdft2_thr_vrank_geq1_register
-fftw_rdft2_vrank_geq1_register
-fftw_rdft_buffered_register
-fftw_rdft_conf_standard
-fftw_rdft_dht_register
-fftw_rdft_generic_register
-fftw_rdft_indirect_register
-fftw_rdft_kind_str
-fftw_rdft_nop_register
-fftw_rdft_rank0_register
-fftw_rdft_rank_geq2_register
-fftw_rdft_solve
-fftw_rdft_thr_vrank_geq1_register
-fftw_rdft_vrank3_transpose_register
-fftw_rdft_vrank_geq1_register
-fftw_rdft_zerotens
-fftw_redft00e_r2hc_pad_register
-fftw_regsolver_ct_directw
-fftw_regsolver_ct_directwsq
-fftw_regsolver_hc2c_direct
-fftw_regsolver_hc2hc_direct
-fftw_reodft00e_splitradix_register
-fftw_reodft010e_r2hc_register
-fftw_reodft11e_r2hc_odd_register
-fftw_reodft11e_radix2_r2hc_register
-fftw_reodft_conf_standard
-fftw_rodft00e_r2hc_pad_register
-fftw_safe_mulmod
-fftw_scanner_destroy
-fftw_set_planner_hooks
-fftw_set_timelimit
-fftw_solver_destroy
-fftw_solver_register
-fftw_solver_use
-fftw_solvtab_exec
-fftw_spawn_loop
-fftw_sprint_plan
-fftw_stride_destroy
-fftw_taint
-fftw_tensor_append
-fftw_tensor_compress
-fftw_tensor_compress_contiguous
-fftw_tensor_copy
-fftw_tensor_copy_except
-fftw_tensor_copy_inplace
-fftw_tensor_copy_sub
-fftw_tensor_destroy
-fftw_tensor_destroy2
-fftw_tensor_destroy4
-fftw_tensor_equal
-fftw_tensor_inplace_locations
-fftw_tensor_inplace_strides
-fftw_tensor_inplace_strides2
-fftw_tensor_kosherp
-fftw_tensor_max_index
-fftw_tensor_md5
-fftw_tensor_min_istride
-fftw_tensor_min_ostride
-fftw_tensor_min_stride
-fftw_tensor_print
-fftw_tensor_split
-fftw_tensor_strides_decrease
-fftw_tensor_sz
-fftw_tensor_tornk1
-fftw_the_planner
-fftw_threads_cleanup
-fftw_threads_conf_standard
-fftw_threads_register_planner_hooks
-fftw_tile2d
-fftw_toobig
-fftw_transpose
-fftw_transpose_tiled
-fftw_transpose_tiledbuf
-fftw_triggen_destroy
-fftw_twiddle_awake
-fftw_twiddle_length
-fftw_zero1d_pair
diff --git a/funasr/runtime/onnxruntime/win/lib/x86/libfftw3-3.exp b/funasr/runtime/onnxruntime/win/lib/x86/libfftw3-3.exp
deleted file mode 100644
index 5048009..0000000
--- a/funasr/runtime/onnxruntime/win/lib/x86/libfftw3-3.exp
+++ /dev/null
Binary files differ
diff --git a/funasr/runtime/onnxruntime/win/lib/x86/libfftw3-3.lib b/funasr/runtime/onnxruntime/win/lib/x86/libfftw3-3.lib
deleted file mode 100644
index 7103673..0000000
--- a/funasr/runtime/onnxruntime/win/lib/x86/libfftw3-3.lib
+++ /dev/null
Binary files differ
diff --git a/funasr/runtime/onnxruntime/win/lib/x86/libfftw3f-3.def b/funasr/runtime/onnxruntime/win/lib/x86/libfftw3f-3.def
deleted file mode 100644
index d61a2c3..0000000
--- a/funasr/runtime/onnxruntime/win/lib/x86/libfftw3f-3.def
+++ /dev/null
@@ -1,1017 +0,0 @@
-LIBRARY libfftw3f-3.dll
-EXPORTS
-fftwf_alignment_of
-fftwf_alloc_complex
-fftwf_alloc_real
-fftwf_assertion_failed
-fftwf_bufdist
-fftwf_check_alignment_of_sse2_pm
-fftwf_choose_radix
-fftwf_cleanup
-fftwf_cleanup_threads
-fftwf_codelet_e01_8
-fftwf_codelet_e10_8
-fftwf_codelet_hb_10
-fftwf_codelet_hb_12
-fftwf_codelet_hb_15
-fftwf_codelet_hb_16
-fftwf_codelet_hb_2
-fftwf_codelet_hb_20
-fftwf_codelet_hb2_16
-fftwf_codelet_hb2_20
-fftwf_codelet_hb2_25
-fftwf_codelet_hb2_32
-fftwf_codelet_hb2_4
-fftwf_codelet_hb_25
-fftwf_codelet_hb2_5
-fftwf_codelet_hb2_8
-fftwf_codelet_hb_3
-fftwf_codelet_hb_32
-fftwf_codelet_hb_4
-fftwf_codelet_hb_5
-fftwf_codelet_hb_6
-fftwf_codelet_hb_64
-fftwf_codelet_hb_7
-fftwf_codelet_hb_8
-fftwf_codelet_hb_9
-fftwf_codelet_hc2cb_10
-fftwf_codelet_hc2cb_12
-fftwf_codelet_hc2cb_16
-fftwf_codelet_hc2cb_2
-fftwf_codelet_hc2cb_20
-fftwf_codelet_hc2cb2_16
-fftwf_codelet_hc2cb2_20
-fftwf_codelet_hc2cb2_32
-fftwf_codelet_hc2cb2_4
-fftwf_codelet_hc2cb2_8
-fftwf_codelet_hc2cb_32
-fftwf_codelet_hc2cb_4
-fftwf_codelet_hc2cb_6
-fftwf_codelet_hc2cb_8
-fftwf_codelet_hc2cbdft_10
-fftwf_codelet_hc2cbdft_12
-fftwf_codelet_hc2cbdft_16
-fftwf_codelet_hc2cbdft_2
-fftwf_codelet_hc2cbdft_20
-fftwf_codelet_hc2cbdft2_16
-fftwf_codelet_hc2cbdft2_20
-fftwf_codelet_hc2cbdft2_32
-fftwf_codelet_hc2cbdft2_4
-fftwf_codelet_hc2cbdft2_8
-fftwf_codelet_hc2cbdft_32
-fftwf_codelet_hc2cbdft_4
-fftwf_codelet_hc2cbdft_6
-fftwf_codelet_hc2cbdft_8
-fftwf_codelet_hc2cbdftv_10_avx
-fftwf_codelet_hc2cbdftv_10_sse2
-fftwf_codelet_hc2cbdftv_12_avx
-fftwf_codelet_hc2cbdftv_12_sse2
-fftwf_codelet_hc2cbdftv_16_avx
-fftwf_codelet_hc2cbdftv_16_sse2
-fftwf_codelet_hc2cbdftv_20_avx
-fftwf_codelet_hc2cbdftv_20_sse2
-fftwf_codelet_hc2cbdftv_2_avx
-fftwf_codelet_hc2cbdftv_2_sse2
-fftwf_codelet_hc2cbdftv_32_avx
-fftwf_codelet_hc2cbdftv_32_sse2
-fftwf_codelet_hc2cbdftv_4_avx
-fftwf_codelet_hc2cbdftv_4_sse2
-fftwf_codelet_hc2cbdftv_6_avx
-fftwf_codelet_hc2cbdftv_6_sse2
-fftwf_codelet_hc2cbdftv_8_avx
-fftwf_codelet_hc2cbdftv_8_sse2
-fftwf_codelet_hc2cf_10
-fftwf_codelet_hc2cf_12
-fftwf_codelet_hc2cf_16
-fftwf_codelet_hc2cf_2
-fftwf_codelet_hc2cf_20
-fftwf_codelet_hc2cf2_16
-fftwf_codelet_hc2cf2_20
-fftwf_codelet_hc2cf2_32
-fftwf_codelet_hc2cf2_4
-fftwf_codelet_hc2cf2_8
-fftwf_codelet_hc2cf_32
-fftwf_codelet_hc2cf_4
-fftwf_codelet_hc2cf_6
-fftwf_codelet_hc2cf_8
-fftwf_codelet_hc2cfdft_10
-fftwf_codelet_hc2cfdft_12
-fftwf_codelet_hc2cfdft_16
-fftwf_codelet_hc2cfdft_2
-fftwf_codelet_hc2cfdft_20
-fftwf_codelet_hc2cfdft2_16
-fftwf_codelet_hc2cfdft2_20
-fftwf_codelet_hc2cfdft2_32
-fftwf_codelet_hc2cfdft2_4
-fftwf_codelet_hc2cfdft2_8
-fftwf_codelet_hc2cfdft_32
-fftwf_codelet_hc2cfdft_4
-fftwf_codelet_hc2cfdft_6
-fftwf_codelet_hc2cfdft_8
-fftwf_codelet_hc2cfdftv_10_avx
-fftwf_codelet_hc2cfdftv_10_sse2
-fftwf_codelet_hc2cfdftv_12_avx
-fftwf_codelet_hc2cfdftv_12_sse2
-fftwf_codelet_hc2cfdftv_16_avx
-fftwf_codelet_hc2cfdftv_16_sse2
-fftwf_codelet_hc2cfdftv_20_avx
-fftwf_codelet_hc2cfdftv_20_sse2
-fftwf_codelet_hc2cfdftv_2_avx
-fftwf_codelet_hc2cfdftv_2_sse2
-fftwf_codelet_hc2cfdftv_32_avx
-fftwf_codelet_hc2cfdftv_32_sse2
-fftwf_codelet_hc2cfdftv_4_avx
-fftwf_codelet_hc2cfdftv_4_sse2
-fftwf_codelet_hc2cfdftv_6_avx
-fftwf_codelet_hc2cfdftv_6_sse2
-fftwf_codelet_hc2cfdftv_8_avx
-fftwf_codelet_hc2cfdftv_8_sse2
-fftwf_codelet_hf_10
-fftwf_codelet_hf_12
-fftwf_codelet_hf_15
-fftwf_codelet_hf_16
-fftwf_codelet_hf_2
-fftwf_codelet_hf_20
-fftwf_codelet_hf2_16
-fftwf_codelet_hf2_20
-fftwf_codelet_hf2_25
-fftwf_codelet_hf2_32
-fftwf_codelet_hf2_4
-fftwf_codelet_hf_25
-fftwf_codelet_hf2_5
-fftwf_codelet_hf2_8
-fftwf_codelet_hf_3
-fftwf_codelet_hf_32
-fftwf_codelet_hf_4
-fftwf_codelet_hf_5
-fftwf_codelet_hf_6
-fftwf_codelet_hf_64
-fftwf_codelet_hf_7
-fftwf_codelet_hf_8
-fftwf_codelet_hf_9
-fftwf_codelet_n1_10
-fftwf_codelet_n1_11
-fftwf_codelet_n1_12
-fftwf_codelet_n1_13
-fftwf_codelet_n1_14
-fftwf_codelet_n1_15
-fftwf_codelet_n1_16
-fftwf_codelet_n1_2
-fftwf_codelet_n1_20
-fftwf_codelet_n1_25
-fftwf_codelet_n1_3
-fftwf_codelet_n1_32
-fftwf_codelet_n1_4
-fftwf_codelet_n1_5
-fftwf_codelet_n1_6
-fftwf_codelet_n1_64
-fftwf_codelet_n1_7
-fftwf_codelet_n1_8
-fftwf_codelet_n1_9
-fftwf_codelet_n1bv_10_avx
-fftwf_codelet_n1bv_10_sse2
-fftwf_codelet_n1bv_11_avx
-fftwf_codelet_n1bv_11_sse2
-fftwf_codelet_n1bv_128_avx
-fftwf_codelet_n1bv_128_sse2
-fftwf_codelet_n1bv_12_avx
-fftwf_codelet_n1bv_12_sse2
-fftwf_codelet_n1bv_13_avx
-fftwf_codelet_n1bv_13_sse2
-fftwf_codelet_n1bv_14_avx
-fftwf_codelet_n1bv_14_sse2
-fftwf_codelet_n1bv_15_avx
-fftwf_codelet_n1bv_15_sse2
-fftwf_codelet_n1bv_16_avx
-fftwf_codelet_n1bv_16_sse2
-fftwf_codelet_n1bv_20_avx
-fftwf_codelet_n1bv_20_sse2
-fftwf_codelet_n1bv_25_avx
-fftwf_codelet_n1bv_25_sse2
-fftwf_codelet_n1bv_2_avx
-fftwf_codelet_n1bv_2_sse2
-fftwf_codelet_n1bv_32_avx
-fftwf_codelet_n1bv_32_sse2
-fftwf_codelet_n1bv_3_avx
-fftwf_codelet_n1bv_3_sse2
-fftwf_codelet_n1bv_4_avx
-fftwf_codelet_n1bv_4_sse2
-fftwf_codelet_n1bv_5_avx
-fftwf_codelet_n1bv_5_sse2
-fftwf_codelet_n1bv_64_avx
-fftwf_codelet_n1bv_64_sse2
-fftwf_codelet_n1bv_6_avx
-fftwf_codelet_n1bv_6_sse2
-fftwf_codelet_n1bv_7_avx
-fftwf_codelet_n1bv_7_sse2
-fftwf_codelet_n1bv_8_avx
-fftwf_codelet_n1bv_8_sse2
-fftwf_codelet_n1bv_9_avx
-fftwf_codelet_n1bv_9_sse2
-fftwf_codelet_n1fv_10_avx
-fftwf_codelet_n1fv_10_sse2
-fftwf_codelet_n1fv_11_avx
-fftwf_codelet_n1fv_11_sse2
-fftwf_codelet_n1fv_128_avx
-fftwf_codelet_n1fv_128_sse2
-fftwf_codelet_n1fv_12_avx
-fftwf_codelet_n1fv_12_sse2
-fftwf_codelet_n1fv_13_avx
-fftwf_codelet_n1fv_13_sse2
-fftwf_codelet_n1fv_14_avx
-fftwf_codelet_n1fv_14_sse2
-fftwf_codelet_n1fv_15_avx
-fftwf_codelet_n1fv_15_sse2
-fftwf_codelet_n1fv_16_avx
-fftwf_codelet_n1fv_16_sse2
-fftwf_codelet_n1fv_20_avx
-fftwf_codelet_n1fv_20_sse2
-fftwf_codelet_n1fv_25_avx
-fftwf_codelet_n1fv_25_sse2
-fftwf_codelet_n1fv_2_avx
-fftwf_codelet_n1fv_2_sse2
-fftwf_codelet_n1fv_32_avx
-fftwf_codelet_n1fv_32_sse2
-fftwf_codelet_n1fv_3_avx
-fftwf_codelet_n1fv_3_sse2
-fftwf_codelet_n1fv_4_avx
-fftwf_codelet_n1fv_4_sse2
-fftwf_codelet_n1fv_5_avx
-fftwf_codelet_n1fv_5_sse2
-fftwf_codelet_n1fv_64_avx
-fftwf_codelet_n1fv_64_sse2
-fftwf_codelet_n1fv_6_avx
-fftwf_codelet_n1fv_6_sse2
-fftwf_codelet_n1fv_7_avx
-fftwf_codelet_n1fv_7_sse2
-fftwf_codelet_n1fv_8_avx
-fftwf_codelet_n1fv_8_sse2
-fftwf_codelet_n1fv_9_avx
-fftwf_codelet_n1fv_9_sse2
-fftwf_codelet_n2bv_10_avx
-fftwf_codelet_n2bv_10_sse2
-fftwf_codelet_n2bv_12_avx
-fftwf_codelet_n2bv_12_sse2
-fftwf_codelet_n2bv_14_avx
-fftwf_codelet_n2bv_14_sse2
-fftwf_codelet_n2bv_16_avx
-fftwf_codelet_n2bv_16_sse2
-fftwf_codelet_n2bv_20_avx
-fftwf_codelet_n2bv_20_sse2
-fftwf_codelet_n2bv_2_avx
-fftwf_codelet_n2bv_2_sse2
-fftwf_codelet_n2bv_32_avx
-fftwf_codelet_n2bv_32_sse2
-fftwf_codelet_n2bv_4_avx
-fftwf_codelet_n2bv_4_sse2
-fftwf_codelet_n2bv_64_avx
-fftwf_codelet_n2bv_64_sse2
-fftwf_codelet_n2bv_6_avx
-fftwf_codelet_n2bv_6_sse2
-fftwf_codelet_n2bv_8_avx
-fftwf_codelet_n2bv_8_sse2
-fftwf_codelet_n2fv_10_avx
-fftwf_codelet_n2fv_10_sse2
-fftwf_codelet_n2fv_12_avx
-fftwf_codelet_n2fv_12_sse2
-fftwf_codelet_n2fv_14_avx
-fftwf_codelet_n2fv_14_sse2
-fftwf_codelet_n2fv_16_avx
-fftwf_codelet_n2fv_16_sse2
-fftwf_codelet_n2fv_20_avx
-fftwf_codelet_n2fv_20_sse2
-fftwf_codelet_n2fv_2_avx
-fftwf_codelet_n2fv_2_sse2
-fftwf_codelet_n2fv_32_avx
-fftwf_codelet_n2fv_32_sse2
-fftwf_codelet_n2fv_4_avx
-fftwf_codelet_n2fv_4_sse2
-fftwf_codelet_n2fv_64_avx
-fftwf_codelet_n2fv_64_sse2
-fftwf_codelet_n2fv_6_avx
-fftwf_codelet_n2fv_6_sse2
-fftwf_codelet_n2fv_8_avx
-fftwf_codelet_n2fv_8_sse2
-fftwf_codelet_n2sv_16_avx
-fftwf_codelet_n2sv_16_sse2
-fftwf_codelet_n2sv_32_avx
-fftwf_codelet_n2sv_32_sse2
-fftwf_codelet_n2sv_4_avx
-fftwf_codelet_n2sv_4_sse2
-fftwf_codelet_n2sv_64_avx
-fftwf_codelet_n2sv_64_sse2
-fftwf_codelet_n2sv_8_avx
-fftwf_codelet_n2sv_8_sse2
-fftwf_codelet_q1_2
-fftwf_codelet_q1_3
-fftwf_codelet_q1_4
-fftwf_codelet_q1_5
-fftwf_codelet_q1_6
-fftwf_codelet_q1_8
-fftwf_codelet_q1bv_2_avx
-fftwf_codelet_q1bv_2_sse2
-fftwf_codelet_q1bv_4_avx
-fftwf_codelet_q1bv_4_sse2
-fftwf_codelet_q1bv_5_avx
-fftwf_codelet_q1bv_5_sse2
-fftwf_codelet_q1bv_8_avx
-fftwf_codelet_q1bv_8_sse2
-fftwf_codelet_q1fv_2_avx
-fftwf_codelet_q1fv_2_sse2
-fftwf_codelet_q1fv_4_avx
-fftwf_codelet_q1fv_4_sse2
-fftwf_codelet_q1fv_5_avx
-fftwf_codelet_q1fv_5_sse2
-fftwf_codelet_q1fv_8_avx
-fftwf_codelet_q1fv_8_sse2
-fftwf_codelet_r2cb_10
-fftwf_codelet_r2cb_11
-fftwf_codelet_r2cb_12
-fftwf_codelet_r2cb_128
-fftwf_codelet_r2cb_13
-fftwf_codelet_r2cb_14
-fftwf_codelet_r2cb_15
-fftwf_codelet_r2cb_16
-fftwf_codelet_r2cb_2
-fftwf_codelet_r2cb_20
-fftwf_codelet_r2cb_25
-fftwf_codelet_r2cb_3
-fftwf_codelet_r2cb_32
-fftwf_codelet_r2cb_4
-fftwf_codelet_r2cb_5
-fftwf_codelet_r2cb_6
-fftwf_codelet_r2cb_64
-fftwf_codelet_r2cb_7
-fftwf_codelet_r2cb_8
-fftwf_codelet_r2cb_9
-fftwf_codelet_r2cbIII_10
-fftwf_codelet_r2cbIII_12
-fftwf_codelet_r2cbIII_15
-fftwf_codelet_r2cbIII_16
-fftwf_codelet_r2cbIII_2
-fftwf_codelet_r2cbIII_20
-fftwf_codelet_r2cbIII_25
-fftwf_codelet_r2cbIII_3
-fftwf_codelet_r2cbIII_32
-fftwf_codelet_r2cbIII_4
-fftwf_codelet_r2cbIII_5
-fftwf_codelet_r2cbIII_6
-fftwf_codelet_r2cbIII_64
-fftwf_codelet_r2cbIII_7
-fftwf_codelet_r2cbIII_8
-fftwf_codelet_r2cbIII_9
-fftwf_codelet_r2cf_10
-fftwf_codelet_r2cf_11
-fftwf_codelet_r2cf_12
-fftwf_codelet_r2cf_128
-fftwf_codelet_r2cf_13
-fftwf_codelet_r2cf_14
-fftwf_codelet_r2cf_15
-fftwf_codelet_r2cf_16
-fftwf_codelet_r2cf_2
-fftwf_codelet_r2cf_20
-fftwf_codelet_r2cf_25
-fftwf_codelet_r2cf_3
-fftwf_codelet_r2cf_32
-fftwf_codelet_r2cf_4
-fftwf_codelet_r2cf_5
-fftwf_codelet_r2cf_6
-fftwf_codelet_r2cf_64
-fftwf_codelet_r2cf_7
-fftwf_codelet_r2cf_8
-fftwf_codelet_r2cf_9
-fftwf_codelet_r2cfII_10
-fftwf_codelet_r2cfII_12
-fftwf_codelet_r2cfII_15
-fftwf_codelet_r2cfII_16
-fftwf_codelet_r2cfII_2
-fftwf_codelet_r2cfII_20
-fftwf_codelet_r2cfII_25
-fftwf_codelet_r2cfII_3
-fftwf_codelet_r2cfII_32
-fftwf_codelet_r2cfII_4
-fftwf_codelet_r2cfII_5
-fftwf_codelet_r2cfII_6
-fftwf_codelet_r2cfII_64
-fftwf_codelet_r2cfII_7
-fftwf_codelet_r2cfII_8
-fftwf_codelet_r2cfII_9
-fftwf_codelet_t1_10
-fftwf_codelet_t1_12
-fftwf_codelet_t1_15
-fftwf_codelet_t1_16
-fftwf_codelet_t1_2
-fftwf_codelet_t1_20
-fftwf_codelet_t1_25
-fftwf_codelet_t1_3
-fftwf_codelet_t1_32
-fftwf_codelet_t1_4
-fftwf_codelet_t1_5
-fftwf_codelet_t1_6
-fftwf_codelet_t1_64
-fftwf_codelet_t1_7
-fftwf_codelet_t1_8
-fftwf_codelet_t1_9
-fftwf_codelet_t1buv_10_avx
-fftwf_codelet_t1buv_10_sse2
-fftwf_codelet_t1buv_2_avx
-fftwf_codelet_t1buv_2_sse2
-fftwf_codelet_t1buv_3_avx
-fftwf_codelet_t1buv_3_sse2
-fftwf_codelet_t1buv_4_avx
-fftwf_codelet_t1buv_4_sse2
-fftwf_codelet_t1buv_5_avx
-fftwf_codelet_t1buv_5_sse2
-fftwf_codelet_t1buv_6_avx
-fftwf_codelet_t1buv_6_sse2
-fftwf_codelet_t1buv_7_avx
-fftwf_codelet_t1buv_7_sse2
-fftwf_codelet_t1buv_8_avx
-fftwf_codelet_t1buv_8_sse2
-fftwf_codelet_t1buv_9_avx
-fftwf_codelet_t1buv_9_sse2
-fftwf_codelet_t1bv_10_avx
-fftwf_codelet_t1bv_10_sse2
-fftwf_codelet_t1bv_12_avx
-fftwf_codelet_t1bv_12_sse2
-fftwf_codelet_t1bv_15_avx
-fftwf_codelet_t1bv_15_sse2
-fftwf_codelet_t1bv_16_avx
-fftwf_codelet_t1bv_16_sse2
-fftwf_codelet_t1bv_20_avx
-fftwf_codelet_t1bv_20_sse2
-fftwf_codelet_t1bv_25_avx
-fftwf_codelet_t1bv_25_sse2
-fftwf_codelet_t1bv_2_avx
-fftwf_codelet_t1bv_2_sse2
-fftwf_codelet_t1bv_32_avx
-fftwf_codelet_t1bv_32_sse2
-fftwf_codelet_t1bv_3_avx
-fftwf_codelet_t1bv_3_sse2
-fftwf_codelet_t1bv_4_avx
-fftwf_codelet_t1bv_4_sse2
-fftwf_codelet_t1bv_5_avx
-fftwf_codelet_t1bv_5_sse2
-fftwf_codelet_t1bv_64_avx
-fftwf_codelet_t1bv_64_sse2
-fftwf_codelet_t1bv_6_avx
-fftwf_codelet_t1bv_6_sse2
-fftwf_codelet_t1bv_7_avx
-fftwf_codelet_t1bv_7_sse2
-fftwf_codelet_t1bv_8_avx
-fftwf_codelet_t1bv_8_sse2
-fftwf_codelet_t1bv_9_avx
-fftwf_codelet_t1bv_9_sse2
-fftwf_codelet_t1fuv_10_avx
-fftwf_codelet_t1fuv_10_sse2
-fftwf_codelet_t1fuv_2_avx
-fftwf_codelet_t1fuv_2_sse2
-fftwf_codelet_t1fuv_3_avx
-fftwf_codelet_t1fuv_3_sse2
-fftwf_codelet_t1fuv_4_avx
-fftwf_codelet_t1fuv_4_sse2
-fftwf_codelet_t1fuv_5_avx
-fftwf_codelet_t1fuv_5_sse2
-fftwf_codelet_t1fuv_6_avx
-fftwf_codelet_t1fuv_6_sse2
-fftwf_codelet_t1fuv_7_avx
-fftwf_codelet_t1fuv_7_sse2
-fftwf_codelet_t1fuv_8_avx
-fftwf_codelet_t1fuv_8_sse2
-fftwf_codelet_t1fuv_9_avx
-fftwf_codelet_t1fuv_9_sse2
-fftwf_codelet_t1fv_10_avx
-fftwf_codelet_t1fv_10_sse2
-fftwf_codelet_t1fv_12_avx
-fftwf_codelet_t1fv_12_sse2
-fftwf_codelet_t1fv_15_avx
-fftwf_codelet_t1fv_15_sse2
-fftwf_codelet_t1fv_16_avx
-fftwf_codelet_t1fv_16_sse2
-fftwf_codelet_t1fv_20_avx
-fftwf_codelet_t1fv_20_sse2
-fftwf_codelet_t1fv_25_avx
-fftwf_codelet_t1fv_25_sse2
-fftwf_codelet_t1fv_2_avx
-fftwf_codelet_t1fv_2_sse2
-fftwf_codelet_t1fv_32_avx
-fftwf_codelet_t1fv_32_sse2
-fftwf_codelet_t1fv_3_avx
-fftwf_codelet_t1fv_3_sse2
-fftwf_codelet_t1fv_4_avx
-fftwf_codelet_t1fv_4_sse2
-fftwf_codelet_t1fv_5_avx
-fftwf_codelet_t1fv_5_sse2
-fftwf_codelet_t1fv_64_avx
-fftwf_codelet_t1fv_64_sse2
-fftwf_codelet_t1fv_6_avx
-fftwf_codelet_t1fv_6_sse2
-fftwf_codelet_t1fv_7_avx
-fftwf_codelet_t1fv_7_sse2
-fftwf_codelet_t1fv_8_avx
-fftwf_codelet_t1fv_8_sse2
-fftwf_codelet_t1fv_9_avx
-fftwf_codelet_t1fv_9_sse2
-fftwf_codelet_t1sv_16_avx
-fftwf_codelet_t1sv_16_sse2
-fftwf_codelet_t1sv_2_avx
-fftwf_codelet_t1sv_2_sse2
-fftwf_codelet_t1sv_32_avx
-fftwf_codelet_t1sv_32_sse2
-fftwf_codelet_t1sv_4_avx
-fftwf_codelet_t1sv_4_sse2
-fftwf_codelet_t1sv_8_avx
-fftwf_codelet_t1sv_8_sse2
-fftwf_codelet_t2_10
-fftwf_codelet_t2_16
-fftwf_codelet_t2_20
-fftwf_codelet_t2_25
-fftwf_codelet_t2_32
-fftwf_codelet_t2_4
-fftwf_codelet_t2_5
-fftwf_codelet_t2_64
-fftwf_codelet_t2_8
-fftwf_codelet_t2bv_10_avx
-fftwf_codelet_t2bv_10_sse2
-fftwf_codelet_t2bv_16_avx
-fftwf_codelet_t2bv_16_sse2
-fftwf_codelet_t2bv_20_avx
-fftwf_codelet_t2bv_20_sse2
-fftwf_codelet_t2bv_25_avx
-fftwf_codelet_t2bv_25_sse2
-fftwf_codelet_t2bv_2_avx
-fftwf_codelet_t2bv_2_sse2
-fftwf_codelet_t2bv_32_avx
-fftwf_codelet_t2bv_32_sse2
-fftwf_codelet_t2bv_4_avx
-fftwf_codelet_t2bv_4_sse2
-fftwf_codelet_t2bv_5_avx
-fftwf_codelet_t2bv_5_sse2
-fftwf_codelet_t2bv_64_avx
-fftwf_codelet_t2bv_64_sse2
-fftwf_codelet_t2bv_8_avx
-fftwf_codelet_t2bv_8_sse2
-fftwf_codelet_t2fv_10_avx
-fftwf_codelet_t2fv_10_sse2
-fftwf_codelet_t2fv_16_avx
-fftwf_codelet_t2fv_16_sse2
-fftwf_codelet_t2fv_20_avx
-fftwf_codelet_t2fv_20_sse2
-fftwf_codelet_t2fv_25_avx
-fftwf_codelet_t2fv_25_sse2
-fftwf_codelet_t2fv_2_avx
-fftwf_codelet_t2fv_2_sse2
-fftwf_codelet_t2fv_32_avx
-fftwf_codelet_t2fv_32_sse2
-fftwf_codelet_t2fv_4_avx
-fftwf_codelet_t2fv_4_sse2
-fftwf_codelet_t2fv_5_avx
-fftwf_codelet_t2fv_5_sse2
-fftwf_codelet_t2fv_64_avx
-fftwf_codelet_t2fv_64_sse2
-fftwf_codelet_t2fv_8_avx
-fftwf_codelet_t2fv_8_sse2
-fftwf_codelet_t2sv_16_avx
-fftwf_codelet_t2sv_16_sse2
-fftwf_codelet_t2sv_32_avx
-fftwf_codelet_t2sv_32_sse2
-fftwf_codelet_t2sv_4_avx
-fftwf_codelet_t2sv_4_sse2
-fftwf_codelet_t2sv_8_avx
-fftwf_codelet_t2sv_8_sse2
-fftwf_codelet_t3bv_10_avx
-fftwf_codelet_t3bv_10_sse2
-fftwf_codelet_t3bv_16_avx
-fftwf_codelet_t3bv_16_sse2
-fftwf_codelet_t3bv_20_avx
-fftwf_codelet_t3bv_20_sse2
-fftwf_codelet_t3bv_25_avx
-fftwf_codelet_t3bv_25_sse2
-fftwf_codelet_t3bv_32_avx
-fftwf_codelet_t3bv_32_sse2
-fftwf_codelet_t3bv_4_avx
-fftwf_codelet_t3bv_4_sse2
-fftwf_codelet_t3bv_5_avx
-fftwf_codelet_t3bv_5_sse2
-fftwf_codelet_t3bv_8_avx
-fftwf_codelet_t3bv_8_sse2
-fftwf_codelet_t3fv_10_avx
-fftwf_codelet_t3fv_10_sse2
-fftwf_codelet_t3fv_16_avx
-fftwf_codelet_t3fv_16_sse2
-fftwf_codelet_t3fv_20_avx
-fftwf_codelet_t3fv_20_sse2
-fftwf_codelet_t3fv_25_avx
-fftwf_codelet_t3fv_25_sse2
-fftwf_codelet_t3fv_32_avx
-fftwf_codelet_t3fv_32_sse2
-fftwf_codelet_t3fv_4_avx
-fftwf_codelet_t3fv_4_sse2
-fftwf_codelet_t3fv_5_avx
-fftwf_codelet_t3fv_5_sse2
-fftwf_codelet_t3fv_8_avx
-fftwf_codelet_t3fv_8_sse2
-fftwf_compute_tilesz
-fftwf_configure_planner
-fftwf_cost
-fftwf_cpy1d
-fftwf_cpy2d
-fftwf_cpy2d_ci
-fftwf_cpy2d_co
-fftwf_cpy2d_pair
-fftwf_cpy2d_pair_ci
-fftwf_cpy2d_pair_co
-fftwf_cpy2d_tiled
-fftwf_cpy2d_tiledbuf
-fftwf_ct_applicable
-fftwf_ct_genericbuf_register
-fftwf_ct_generic_register
-fftwf_ct_uglyp
-fftwf_destroy_plan
-fftwf_dft_bluestein_register
-fftwf_dft_buffered_register
-fftwf_dft_conf_standard
-fftwf_dft_generic_register
-fftwf_dft_indirect_register
-fftwf_dft_indirect_transpose_register
-fftwf_dft_nop_register
-fftwf_dft_r2hc_register
-fftwf_dft_rader_register
-fftwf_dft_rank_geq2_register
-fftwf_dft_solve
-fftwf_dft_thr_vrank_geq1_register
-fftwf_dft_vrank_geq1_register
-fftwf_dft_zerotens
-fftwf_dht_r2hc_register
-fftwf_dht_rader_register
-fftwf_dimcmp
-fftwf_elapsed_since
-fftwf_estimate_cost
-fftwf_execute
-fftwf_execute_dft
-fftwf_execute_dft_c2r
-fftwf_execute_dft_r2c
-fftwf_execute_r2r
-fftwf_execute_split_dft
-fftwf_execute_split_dft_c2r
-fftwf_execute_split_dft_r2c
-fftwf_export_wisdom
-fftwf_export_wisdom_to_file
-fftwf_export_wisdom_to_filename
-fftwf_export_wisdom_to_string
-fftwf_extract_reim
-fftwf_factors_into
-fftwf_factors_into_small_primes
-fftwf_find_generator
-fftwf_first_divisor
-fftwf_flops
-fftwf_forget_wisdom
-fftwf_fprint_plan
-fftwf_free
-fftwf_get_crude_time
-fftwf_guru64_kosherp
-fftwf_guru_kosherp
-fftwf_hash
-fftwf_have_simd_avx
-fftwf_have_simd_sse2
-fftwf_hc2hc_applicable
-fftwf_hc2hc_generic_register
-fftwf_iabs
-fftwf_ialignment_of
-fftwf_iestimate_cost
-fftwf_ifree
-fftwf_ifree0
-fftwf_imax
-fftwf_imin
-fftwf_import_system_wisdom
-fftwf_import_wisdom
-fftwf_import_wisdom_from_file
-fftwf_import_wisdom_from_filename
-fftwf_import_wisdom_from_string
-fftwf_init_threads
-fftwf_is_prime
-fftwf_isqrt
-fftwf_ithreads_init
-fftwf_join_taint
-fftwf_kdft_dif_register
-fftwf_kdft_difsq_register
-fftwf_kdft_dit_register
-fftwf_kdft_register
-fftwf_kernel_free
-fftwf_kernel_malloc
-fftwf_khc2c_register
-fftwf_khc2hc_register
-fftwf_kr2c_register
-fftwf_kr2r_register
-fftwf_make_planner_thread_safe
-fftwf_malloc
-fftwf_malloc_plain
-fftwf_many_kosherp
-fftwf_mapflags
-fftwf_map_r2r_kind
-fftwf_md5begin
-fftwf_md5end
-fftwf_md5int
-fftwf_md5INT
-fftwf_md5putb
-fftwf_md5putc
-fftwf_md5puts
-fftwf_md5unsigned
-fftwf_measure_execution_time
-fftwf_mkapiplan
-fftwf_mkplan
-fftwf_mkplan_d
-fftwf_mkplan_dft
-fftwf_mkplan_dftw
-fftwf_mkplan_f_d
-fftwf_mkplan_hc2c
-fftwf_mkplan_hc2hc
-fftwf_mkplanner
-fftwf_mkplan_rdft
-fftwf_mkplan_rdft2
-fftwf_mkprinter
-fftwf_mkprinter_cnt
-fftwf_mkprinter_file
-fftwf_mkprinter_str
-fftwf_mkproblem
-fftwf_mkproblem_dft
-fftwf_mkproblem_dft_d
-fftwf_mkproblem_rdft
-fftwf_mkproblem_rdft_0_d
-fftwf_mkproblem_rdft_1
-fftwf_mkproblem_rdft_1_d
-fftwf_mkproblem_rdft2
-fftwf_mkproblem_rdft2_d
-fftwf_mkproblem_rdft2_d_3pointers
-fftwf_mkproblem_rdft_d
-fftwf_mkproblem_unsolvable
-fftwf_mkscanner
-fftwf_mksolver
-fftwf_mksolver_ct
-fftwf_mksolver_ct_threads
-fftwf_mksolver_dft_direct
-fftwf_mksolver_dft_directbuf
-fftwf_mksolver_hc2c
-fftwf_mksolver_hc2hc
-fftwf_mksolver_hc2hc_threads
-fftwf_mksolver_rdft2_direct
-fftwf_mksolver_rdft_r2c_direct
-fftwf_mksolver_rdft_r2c_directbuf
-fftwf_mksolver_rdft_r2r_direct
-fftwf_mkstride
-fftwf_mktensor
-fftwf_mktensor_0d
-fftwf_mktensor_1d
-fftwf_mktensor_2d
-fftwf_mktensor_3d
-fftwf_mktensor_4d
-fftwf_mktensor_5d
-fftwf_mktensor_iodims
-fftwf_mktensor_iodims64
-fftwf_mktensor_rowmajor
-fftwf_mktriggen
-fftwf_modulo
-fftwf_nbuf
-fftwf_nbuf_redundant
-fftwf_next_prime
-fftwf_null_awake
-fftwf_ops_add
-fftwf_ops_add2
-fftwf_ops_cpy
-fftwf_ops_madd
-fftwf_ops_madd2
-fftwf_ops_other
-fftwf_ops_zero
-fftwf_pickdim
-fftwf_plan_awake
-fftwf_plan_destroy_internal
-fftwf_plan_dft
-fftwf_plan_dft_1d
-fftwf_plan_dft_2d
-fftwf_plan_dft_3d
-fftwf_plan_dft_c2r
-fftwf_plan_dft_c2r_1d
-fftwf_plan_dft_c2r_2d
-fftwf_plan_dft_c2r_3d
-fftwf_plan_dft_r2c
-fftwf_plan_dft_r2c_1d
-fftwf_plan_dft_r2c_2d
-fftwf_plan_dft_r2c_3d
-fftwf_plan_guru64_dft
-fftwf_plan_guru64_dft_c2r
-fftwf_plan_guru64_dft_r2c
-fftwf_plan_guru64_r2r
-fftwf_plan_guru64_split_dft
-fftwf_plan_guru64_split_dft_c2r
-fftwf_plan_guru64_split_dft_r2c
-fftwf_plan_guru_dft
-fftwf_plan_guru_dft_c2r
-fftwf_plan_guru_dft_r2c
-fftwf_plan_guru_r2r
-fftwf_plan_guru_split_dft
-fftwf_plan_guru_split_dft_c2r
-fftwf_plan_guru_split_dft_r2c
-fftwf_plan_many_dft
-fftwf_plan_many_dft_c2r
-fftwf_plan_many_dft_r2c
-fftwf_plan_many_r2r
-fftwf_planner_destroy
-fftwf_plan_null_destroy
-fftwf_plan_r2r
-fftwf_plan_r2r_1d
-fftwf_plan_r2r_2d
-fftwf_plan_r2r_3d
-fftwf_plan_with_nthreads
-fftwf_power_mod
-fftwf_printer_destroy
-fftwf_print_plan
-fftwf_problem_destroy
-fftwf_rader_tl_delete
-fftwf_rader_tl_find
-fftwf_rader_tl_insert
-fftwf_rdft2_buffered_register
-fftwf_rdft2_complex_n
-fftwf_rdft2_inplace_strides
-fftwf_rdft2_nop_register
-fftwf_rdft2_pad
-fftwf_rdft2_rank0_register
-fftwf_rdft2_rank_geq2_register
-fftwf_rdft2_rdft_register
-fftwf_rdft2_solve
-fftwf_rdft2_strides
-fftwf_rdft2_tensor_max_index
-fftwf_rdft2_thr_vrank_geq1_register
-fftwf_rdft2_vrank_geq1_register
-fftwf_rdft_buffered_register
-fftwf_rdft_conf_standard
-fftwf_rdft_dht_register
-fftwf_rdft_generic_register
-fftwf_rdft_indirect_register
-fftwf_rdft_kind_str
-fftwf_rdft_nop_register
-fftwf_rdft_rank0_register
-fftwf_rdft_rank_geq2_register
-fftwf_rdft_solve
-fftwf_rdft_thr_vrank_geq1_register
-fftwf_rdft_vrank3_transpose_register
-fftwf_rdft_vrank_geq1_register
-fftwf_rdft_zerotens
-fftwf_redft00e_r2hc_pad_register
-fftwf_regsolver_ct_directw
-fftwf_regsolver_ct_directwsq
-fftwf_regsolver_hc2c_direct
-fftwf_regsolver_hc2hc_direct
-fftwf_reodft00e_splitradix_register
-fftwf_reodft010e_r2hc_register
-fftwf_reodft11e_r2hc_odd_register
-fftwf_reodft11e_radix2_r2hc_register
-fftwf_reodft_conf_standard
-fftwf_rodft00e_r2hc_pad_register
-fftwf_safe_mulmod
-fftwf_scanner_destroy
-fftwf_set_planner_hooks
-fftwf_set_timelimit
-fftwf_solver_destroy
-fftwf_solver_register
-fftwf_solver_use
-fftwf_solvtab_exec
-fftwf_spawn_loop
-fftwf_sprint_plan
-fftwf_stride_destroy
-fftwf_taint
-fftwf_tensor_append
-fftwf_tensor_compress
-fftwf_tensor_compress_contiguous
-fftwf_tensor_copy
-fftwf_tensor_copy_except
-fftwf_tensor_copy_inplace
-fftwf_tensor_copy_sub
-fftwf_tensor_destroy
-fftwf_tensor_destroy2
-fftwf_tensor_destroy4
-fftwf_tensor_equal
-fftwf_tensor_inplace_locations
-fftwf_tensor_inplace_strides
-fftwf_tensor_inplace_strides2
-fftwf_tensor_kosherp
-fftwf_tensor_max_index
-fftwf_tensor_md5
-fftwf_tensor_min_istride
-fftwf_tensor_min_ostride
-fftwf_tensor_min_stride
-fftwf_tensor_print
-fftwf_tensor_split
-fftwf_tensor_strides_decrease
-fftwf_tensor_sz
-fftwf_tensor_tornk1
-fftwf_the_planner
-fftwf_threads_cleanup
-fftwf_threads_conf_standard
-fftwf_threads_register_planner_hooks
-fftwf_tile2d
-fftwf_toobig
-fftwf_transpose
-fftwf_transpose_tiled
-fftwf_transpose_tiledbuf
-fftwf_triggen_destroy
-fftwf_twiddle_awake
-fftwf_twiddle_length
-fftwf_zero1d_pair
-sfftw_cleanup_
-sfftw_cleanup__
-sfftw_cleanup_threads_
-sfftw_cleanup_threads__
-sfftw_cost_
-sfftw_cost__
-sfftw_destroy_plan_
-sfftw_destroy_plan__
-sfftw_estimate_cost_
-sfftw_estimate_cost__
-sfftw_execute_
-sfftw_execute__
-sfftw_execute_dft_
-sfftw_execute_dft__
-sfftw_execute_dft_c2r_
-sfftw_execute_dft_c2r__
-sfftw_execute_dft_r2c_
-sfftw_execute_dft_r2c__
-sfftw_execute_r2r_
-sfftw_execute_r2r__
-sfftw_execute_split_dft_
-sfftw_execute_split_dft__
-sfftw_execute_split_dft_c2r_
-sfftw_execute_split_dft_c2r__
-sfftw_execute_split_dft_r2c_
-sfftw_execute_split_dft_r2c__
-sfftw_export_wisdom_
-sfftw_export_wisdom__
-sfftw_flops_
-sfftw_flops__
-sfftw_forget_wisdom_
-sfftw_forget_wisdom__
-sfftw_import_system_wisdom_
-sfftw_import_system_wisdom__
-sfftw_import_wisdom_
-sfftw_import_wisdom__
-sfftw_init_threads_
-sfftw_init_threads__
-sfftw_plan_dft_
-sfftw_plan_dft__
-sfftw_plan_dft_1d_
-sfftw_plan_dft_1d__
-sfftw_plan_dft_2d_
-sfftw_plan_dft_2d__
-sfftw_plan_dft_3d_
-sfftw_plan_dft_3d__
-sfftw_plan_dft_c2r_
-sfftw_plan_dft_c2r__
-sfftw_plan_dft_c2r_1d_
-sfftw_plan_dft_c2r_1d__
-sfftw_plan_dft_c2r_2d_
-sfftw_plan_dft_c2r_2d__
-sfftw_plan_dft_c2r_3d_
-sfftw_plan_dft_c2r_3d__
-sfftw_plan_dft_r2c_
-sfftw_plan_dft_r2c__
-sfftw_plan_dft_r2c_1d_
-sfftw_plan_dft_r2c_1d__
-sfftw_plan_dft_r2c_2d_
-sfftw_plan_dft_r2c_2d__
-sfftw_plan_dft_r2c_3d_
-sfftw_plan_dft_r2c_3d__
-sfftw_plan_guru_dft_
-sfftw_plan_guru_dft__
-sfftw_plan_guru_dft_c2r_
-sfftw_plan_guru_dft_c2r__
-sfftw_plan_guru_dft_r2c_
-sfftw_plan_guru_dft_r2c__
-sfftw_plan_guru_r2r_
-sfftw_plan_guru_r2r__
-sfftw_plan_guru_split_dft_
-sfftw_plan_guru_split_dft__
-sfftw_plan_guru_split_dft_c2r_
-sfftw_plan_guru_split_dft_c2r__
-sfftw_plan_guru_split_dft_r2c_
-sfftw_plan_guru_split_dft_r2c__
-sfftw_plan_many_dft_
-sfftw_plan_many_dft__
-sfftw_plan_many_dft_c2r_
-sfftw_plan_many_dft_c2r__
-sfftw_plan_many_dft_r2c_
-sfftw_plan_many_dft_r2c__
-sfftw_plan_many_r2r_
-sfftw_plan_many_r2r__
-sfftw_plan_r2r_
-sfftw_plan_r2r__
-sfftw_plan_r2r_1d_
-sfftw_plan_r2r_1d__
-sfftw_plan_r2r_2d_
-sfftw_plan_r2r_2d__
-sfftw_plan_r2r_3d_
-sfftw_plan_r2r_3d__
-sfftw_plan_with_nthreads_
-sfftw_plan_with_nthreads__
-sfftw_print_plan_
-sfftw_print_plan__
-sfftw_set_timelimit_
-sfftw_set_timelimit__
diff --git a/funasr/runtime/onnxruntime/win/lib/x86/libfftw3f-3.exp b/funasr/runtime/onnxruntime/win/lib/x86/libfftw3f-3.exp
deleted file mode 100644
index c238065..0000000
--- a/funasr/runtime/onnxruntime/win/lib/x86/libfftw3f-3.exp
+++ /dev/null
Binary files differ
diff --git a/funasr/runtime/onnxruntime/win/lib/x86/libfftw3f-3.lib b/funasr/runtime/onnxruntime/win/lib/x86/libfftw3f-3.lib
deleted file mode 100644
index 55fd550..0000000
--- a/funasr/runtime/onnxruntime/win/lib/x86/libfftw3f-3.lib
+++ /dev/null
Binary files differ
diff --git a/funasr/runtime/onnxruntime/win/lib/x86/libfftw3l-3.def b/funasr/runtime/onnxruntime/win/lib/x86/libfftw3l-3.def
deleted file mode 100644
index 62a5e42..0000000
--- a/funasr/runtime/onnxruntime/win/lib/x86/libfftw3l-3.def
+++ /dev/null
@@ -1,634 +0,0 @@
-LIBRARY libfftw3l-3.dll
-EXPORTS
-fftwl_alignment_of
-fftwl_alloc_complex
-fftwl_alloc_real
-fftwl_assertion_failed
-fftwl_bufdist
-fftwl_choose_radix
-fftwl_cleanup
-fftwl_cleanup_threads
-fftwl_codelet_e01_8
-fftwl_codelet_e10_8
-fftwl_codelet_hb_10
-fftwl_codelet_hb_12
-fftwl_codelet_hb_15
-fftwl_codelet_hb_16
-fftwl_codelet_hb_2
-fftwl_codelet_hb_20
-fftwl_codelet_hb2_16
-fftwl_codelet_hb2_20
-fftwl_codelet_hb2_25
-fftwl_codelet_hb2_32
-fftwl_codelet_hb2_4
-fftwl_codelet_hb_25
-fftwl_codelet_hb2_5
-fftwl_codelet_hb2_8
-fftwl_codelet_hb_3
-fftwl_codelet_hb_32
-fftwl_codelet_hb_4
-fftwl_codelet_hb_5
-fftwl_codelet_hb_6
-fftwl_codelet_hb_64
-fftwl_codelet_hb_7
-fftwl_codelet_hb_8
-fftwl_codelet_hb_9
-fftwl_codelet_hc2cb_10
-fftwl_codelet_hc2cb_12
-fftwl_codelet_hc2cb_16
-fftwl_codelet_hc2cb_2
-fftwl_codelet_hc2cb_20
-fftwl_codelet_hc2cb2_16
-fftwl_codelet_hc2cb2_20
-fftwl_codelet_hc2cb2_32
-fftwl_codelet_hc2cb2_4
-fftwl_codelet_hc2cb2_8
-fftwl_codelet_hc2cb_32
-fftwl_codelet_hc2cb_4
-fftwl_codelet_hc2cb_6
-fftwl_codelet_hc2cb_8
-fftwl_codelet_hc2cbdft_10
-fftwl_codelet_hc2cbdft_12
-fftwl_codelet_hc2cbdft_16
-fftwl_codelet_hc2cbdft_2
-fftwl_codelet_hc2cbdft_20
-fftwl_codelet_hc2cbdft2_16
-fftwl_codelet_hc2cbdft2_20
-fftwl_codelet_hc2cbdft2_32
-fftwl_codelet_hc2cbdft2_4
-fftwl_codelet_hc2cbdft2_8
-fftwl_codelet_hc2cbdft_32
-fftwl_codelet_hc2cbdft_4
-fftwl_codelet_hc2cbdft_6
-fftwl_codelet_hc2cbdft_8
-fftwl_codelet_hc2cf_10
-fftwl_codelet_hc2cf_12
-fftwl_codelet_hc2cf_16
-fftwl_codelet_hc2cf_2
-fftwl_codelet_hc2cf_20
-fftwl_codelet_hc2cf2_16
-fftwl_codelet_hc2cf2_20
-fftwl_codelet_hc2cf2_32
-fftwl_codelet_hc2cf2_4
-fftwl_codelet_hc2cf2_8
-fftwl_codelet_hc2cf_32
-fftwl_codelet_hc2cf_4
-fftwl_codelet_hc2cf_6
-fftwl_codelet_hc2cf_8
-fftwl_codelet_hc2cfdft_10
-fftwl_codelet_hc2cfdft_12
-fftwl_codelet_hc2cfdft_16
-fftwl_codelet_hc2cfdft_2
-fftwl_codelet_hc2cfdft_20
-fftwl_codelet_hc2cfdft2_16
-fftwl_codelet_hc2cfdft2_20
-fftwl_codelet_hc2cfdft2_32
-fftwl_codelet_hc2cfdft2_4
-fftwl_codelet_hc2cfdft2_8
-fftwl_codelet_hc2cfdft_32
-fftwl_codelet_hc2cfdft_4
-fftwl_codelet_hc2cfdft_6
-fftwl_codelet_hc2cfdft_8
-fftwl_codelet_hf_10
-fftwl_codelet_hf_12
-fftwl_codelet_hf_15
-fftwl_codelet_hf_16
-fftwl_codelet_hf_2
-fftwl_codelet_hf_20
-fftwl_codelet_hf2_16
-fftwl_codelet_hf2_20
-fftwl_codelet_hf2_25
-fftwl_codelet_hf2_32
-fftwl_codelet_hf2_4
-fftwl_codelet_hf_25
-fftwl_codelet_hf2_5
-fftwl_codelet_hf2_8
-fftwl_codelet_hf_3
-fftwl_codelet_hf_32
-fftwl_codelet_hf_4
-fftwl_codelet_hf_5
-fftwl_codelet_hf_6
-fftwl_codelet_hf_64
-fftwl_codelet_hf_7
-fftwl_codelet_hf_8
-fftwl_codelet_hf_9
-fftwl_codelet_n1_10
-fftwl_codelet_n1_11
-fftwl_codelet_n1_12
-fftwl_codelet_n1_13
-fftwl_codelet_n1_14
-fftwl_codelet_n1_15
-fftwl_codelet_n1_16
-fftwl_codelet_n1_2
-fftwl_codelet_n1_20
-fftwl_codelet_n1_25
-fftwl_codelet_n1_3
-fftwl_codelet_n1_32
-fftwl_codelet_n1_4
-fftwl_codelet_n1_5
-fftwl_codelet_n1_6
-fftwl_codelet_n1_64
-fftwl_codelet_n1_7
-fftwl_codelet_n1_8
-fftwl_codelet_n1_9
-fftwl_codelet_q1_2
-fftwl_codelet_q1_3
-fftwl_codelet_q1_4
-fftwl_codelet_q1_5
-fftwl_codelet_q1_6
-fftwl_codelet_q1_8
-fftwl_codelet_r2cb_10
-fftwl_codelet_r2cb_11
-fftwl_codelet_r2cb_12
-fftwl_codelet_r2cb_128
-fftwl_codelet_r2cb_13
-fftwl_codelet_r2cb_14
-fftwl_codelet_r2cb_15
-fftwl_codelet_r2cb_16
-fftwl_codelet_r2cb_2
-fftwl_codelet_r2cb_20
-fftwl_codelet_r2cb_25
-fftwl_codelet_r2cb_3
-fftwl_codelet_r2cb_32
-fftwl_codelet_r2cb_4
-fftwl_codelet_r2cb_5
-fftwl_codelet_r2cb_6
-fftwl_codelet_r2cb_64
-fftwl_codelet_r2cb_7
-fftwl_codelet_r2cb_8
-fftwl_codelet_r2cb_9
-fftwl_codelet_r2cbIII_10
-fftwl_codelet_r2cbIII_12
-fftwl_codelet_r2cbIII_15
-fftwl_codelet_r2cbIII_16
-fftwl_codelet_r2cbIII_2
-fftwl_codelet_r2cbIII_20
-fftwl_codelet_r2cbIII_25
-fftwl_codelet_r2cbIII_3
-fftwl_codelet_r2cbIII_32
-fftwl_codelet_r2cbIII_4
-fftwl_codelet_r2cbIII_5
-fftwl_codelet_r2cbIII_6
-fftwl_codelet_r2cbIII_64
-fftwl_codelet_r2cbIII_7
-fftwl_codelet_r2cbIII_8
-fftwl_codelet_r2cbIII_9
-fftwl_codelet_r2cf_10
-fftwl_codelet_r2cf_11
-fftwl_codelet_r2cf_12
-fftwl_codelet_r2cf_128
-fftwl_codelet_r2cf_13
-fftwl_codelet_r2cf_14
-fftwl_codelet_r2cf_15
-fftwl_codelet_r2cf_16
-fftwl_codelet_r2cf_2
-fftwl_codelet_r2cf_20
-fftwl_codelet_r2cf_25
-fftwl_codelet_r2cf_3
-fftwl_codelet_r2cf_32
-fftwl_codelet_r2cf_4
-fftwl_codelet_r2cf_5
-fftwl_codelet_r2cf_6
-fftwl_codelet_r2cf_64
-fftwl_codelet_r2cf_7
-fftwl_codelet_r2cf_8
-fftwl_codelet_r2cf_9
-fftwl_codelet_r2cfII_10
-fftwl_codelet_r2cfII_12
-fftwl_codelet_r2cfII_15
-fftwl_codelet_r2cfII_16
-fftwl_codelet_r2cfII_2
-fftwl_codelet_r2cfII_20
-fftwl_codelet_r2cfII_25
-fftwl_codelet_r2cfII_3
-fftwl_codelet_r2cfII_32
-fftwl_codelet_r2cfII_4
-fftwl_codelet_r2cfII_5
-fftwl_codelet_r2cfII_6
-fftwl_codelet_r2cfII_64
-fftwl_codelet_r2cfII_7
-fftwl_codelet_r2cfII_8
-fftwl_codelet_r2cfII_9
-fftwl_codelet_t1_10
-fftwl_codelet_t1_12
-fftwl_codelet_t1_15
-fftwl_codelet_t1_16
-fftwl_codelet_t1_2
-fftwl_codelet_t1_20
-fftwl_codelet_t1_25
-fftwl_codelet_t1_3
-fftwl_codelet_t1_32
-fftwl_codelet_t1_4
-fftwl_codelet_t1_5
-fftwl_codelet_t1_6
-fftwl_codelet_t1_64
-fftwl_codelet_t1_7
-fftwl_codelet_t1_8
-fftwl_codelet_t1_9
-fftwl_codelet_t2_10
-fftwl_codelet_t2_16
-fftwl_codelet_t2_20
-fftwl_codelet_t2_25
-fftwl_codelet_t2_32
-fftwl_codelet_t2_4
-fftwl_codelet_t2_5
-fftwl_codelet_t2_64
-fftwl_codelet_t2_8
-fftwl_compute_tilesz
-fftwl_configure_planner
-fftwl_cost
-fftwl_cpy1d
-fftwl_cpy2d
-fftwl_cpy2d_ci
-fftwl_cpy2d_co
-fftwl_cpy2d_pair
-fftwl_cpy2d_pair_ci
-fftwl_cpy2d_pair_co
-fftwl_cpy2d_tiled
-fftwl_cpy2d_tiledbuf
-fftwl_ct_applicable
-fftwl_ct_genericbuf_register
-fftwl_ct_generic_register
-fftwl_ct_uglyp
-fftwl_destroy_plan
-fftwl_dft_bluestein_register
-fftwl_dft_buffered_register
-fftwl_dft_conf_standard
-fftwl_dft_generic_register
-fftwl_dft_indirect_register
-fftwl_dft_indirect_transpose_register
-fftwl_dft_nop_register
-fftwl_dft_r2hc_register
-fftwl_dft_rader_register
-fftwl_dft_rank_geq2_register
-fftwl_dft_solve
-fftwl_dft_thr_vrank_geq1_register
-fftwl_dft_vrank_geq1_register
-fftwl_dft_zerotens
-fftwl_dht_r2hc_register
-fftwl_dht_rader_register
-fftwl_dimcmp
-fftwl_elapsed_since
-fftwl_estimate_cost
-fftwl_execute
-fftwl_execute_dft
-fftwl_execute_dft_c2r
-fftwl_execute_dft_r2c
-fftwl_execute_r2r
-fftwl_execute_split_dft
-fftwl_execute_split_dft_c2r
-fftwl_execute_split_dft_r2c
-fftwl_export_wisdom
-fftwl_export_wisdom_to_file
-fftwl_export_wisdom_to_filename
-fftwl_export_wisdom_to_string
-fftwl_extract_reim
-fftwl_factors_into
-fftwl_factors_into_small_primes
-fftwl_find_generator
-fftwl_first_divisor
-fftwl_flops
-fftwl_forget_wisdom
-fftwl_fprint_plan
-fftwl_free
-fftwl_get_crude_time
-fftwl_guru64_kosherp
-fftwl_guru_kosherp
-fftwl_hash
-fftwl_hc2hc_applicable
-fftwl_hc2hc_generic_register
-fftwl_iabs
-fftwl_ialignment_of
-fftwl_iestimate_cost
-fftwl_ifree
-fftwl_ifree0
-fftwl_imax
-fftwl_imin
-fftwl_import_system_wisdom
-fftwl_import_wisdom
-fftwl_import_wisdom_from_file
-fftwl_import_wisdom_from_filename
-fftwl_import_wisdom_from_string
-fftwl_init_threads
-fftwl_is_prime
-fftwl_isqrt
-fftwl_ithreads_init
-fftwl_kdft_dif_register
-fftwl_kdft_difsq_register
-fftwl_kdft_dit_register
-fftwl_kdft_register
-fftwl_kernel_free
-fftwl_kernel_malloc
-fftwl_khc2c_register
-fftwl_khc2hc_register
-fftwl_kr2c_register
-fftwl_kr2r_register
-fftwl_make_planner_thread_safe
-fftwl_malloc
-fftwl_malloc_plain
-fftwl_many_kosherp
-fftwl_mapflags
-fftwl_map_r2r_kind
-fftwl_md5begin
-fftwl_md5end
-fftwl_md5int
-fftwl_md5INT
-fftwl_md5putb
-fftwl_md5putc
-fftwl_md5puts
-fftwl_md5unsigned
-fftwl_measure_execution_time
-fftwl_mkapiplan
-fftwl_mkplan
-fftwl_mkplan_d
-fftwl_mkplan_dft
-fftwl_mkplan_dftw
-fftwl_mkplan_f_d
-fftwl_mkplan_hc2c
-fftwl_mkplan_hc2hc
-fftwl_mkplanner
-fftwl_mkplan_rdft
-fftwl_mkplan_rdft2
-fftwl_mkprinter
-fftwl_mkprinter_cnt
-fftwl_mkprinter_file
-fftwl_mkprinter_str
-fftwl_mkproblem
-fftwl_mkproblem_dft
-fftwl_mkproblem_dft_d
-fftwl_mkproblem_rdft
-fftwl_mkproblem_rdft_0_d
-fftwl_mkproblem_rdft_1
-fftwl_mkproblem_rdft_1_d
-fftwl_mkproblem_rdft2
-fftwl_mkproblem_rdft2_d
-fftwl_mkproblem_rdft2_d_3pointers
-fftwl_mkproblem_rdft_d
-fftwl_mkproblem_unsolvable
-fftwl_mkscanner
-fftwl_mksolver
-fftwl_mksolver_ct
-fftwl_mksolver_ct_threads
-fftwl_mksolver_dft_direct
-fftwl_mksolver_dft_directbuf
-fftwl_mksolver_hc2c
-fftwl_mksolver_hc2hc
-fftwl_mksolver_hc2hc_threads
-fftwl_mksolver_rdft2_direct
-fftwl_mksolver_rdft_r2c_direct
-fftwl_mksolver_rdft_r2c_directbuf
-fftwl_mksolver_rdft_r2r_direct
-fftwl_mktensor
-fftwl_mktensor_0d
-fftwl_mktensor_1d
-fftwl_mktensor_2d
-fftwl_mktensor_3d
-fftwl_mktensor_4d
-fftwl_mktensor_5d
-fftwl_mktensor_iodims
-fftwl_mktensor_iodims64
-fftwl_mktensor_rowmajor
-fftwl_mktriggen
-fftwl_modulo
-fftwl_nbuf
-fftwl_nbuf_redundant
-fftwl_next_prime
-fftwl_null_awake
-fftwl_ops_add
-fftwl_ops_add2
-fftwl_ops_cpy
-fftwl_ops_madd
-fftwl_ops_madd2
-fftwl_ops_other
-fftwl_ops_zero
-fftwl_pickdim
-fftwl_plan_awake
-fftwl_plan_destroy_internal
-fftwl_plan_dft
-fftwl_plan_dft_1d
-fftwl_plan_dft_2d
-fftwl_plan_dft_3d
-fftwl_plan_dft_c2r
-fftwl_plan_dft_c2r_1d
-fftwl_plan_dft_c2r_2d
-fftwl_plan_dft_c2r_3d
-fftwl_plan_dft_r2c
-fftwl_plan_dft_r2c_1d
-fftwl_plan_dft_r2c_2d
-fftwl_plan_dft_r2c_3d
-fftwl_plan_guru64_dft
-fftwl_plan_guru64_dft_c2r
-fftwl_plan_guru64_dft_r2c
-fftwl_plan_guru64_r2r
-fftwl_plan_guru64_split_dft
-fftwl_plan_guru64_split_dft_c2r
-fftwl_plan_guru64_split_dft_r2c
-fftwl_plan_guru_dft
-fftwl_plan_guru_dft_c2r
-fftwl_plan_guru_dft_r2c
-fftwl_plan_guru_r2r
-fftwl_plan_guru_split_dft
-fftwl_plan_guru_split_dft_c2r
-fftwl_plan_guru_split_dft_r2c
-fftwl_plan_many_dft
-fftwl_plan_many_dft_c2r
-fftwl_plan_many_dft_r2c
-fftwl_plan_many_r2r
-fftwl_planner_destroy
-fftwl_plan_null_destroy
-fftwl_plan_r2r
-fftwl_plan_r2r_1d
-fftwl_plan_r2r_2d
-fftwl_plan_r2r_3d
-fftwl_plan_with_nthreads
-fftwl_power_mod
-fftwl_printer_destroy
-fftwl_print_plan
-fftwl_problem_destroy
-fftwl_rader_tl_delete
-fftwl_rader_tl_find
-fftwl_rader_tl_insert
-fftwl_rdft2_buffered_register
-fftwl_rdft2_complex_n
-fftwl_rdft2_inplace_strides
-fftwl_rdft2_nop_register
-fftwl_rdft2_pad
-fftwl_rdft2_rank0_register
-fftwl_rdft2_rank_geq2_register
-fftwl_rdft2_rdft_register
-fftwl_rdft2_solve
-fftwl_rdft2_strides
-fftwl_rdft2_tensor_max_index
-fftwl_rdft2_thr_vrank_geq1_register
-fftwl_rdft2_vrank_geq1_register
-fftwl_rdft_buffered_register
-fftwl_rdft_conf_standard
-fftwl_rdft_dht_register
-fftwl_rdft_generic_register
-fftwl_rdft_indirect_register
-fftwl_rdft_kind_str
-fftwl_rdft_nop_register
-fftwl_rdft_rank0_register
-fftwl_rdft_rank_geq2_register
-fftwl_rdft_solve
-fftwl_rdft_thr_vrank_geq1_register
-fftwl_rdft_vrank3_transpose_register
-fftwl_rdft_vrank_geq1_register
-fftwl_rdft_zerotens
-fftwl_redft00e_r2hc_pad_register
-fftwl_regsolver_ct_directw
-fftwl_regsolver_ct_directwsq
-fftwl_regsolver_hc2c_direct
-fftwl_regsolver_hc2hc_direct
-fftwl_reodft00e_splitradix_register
-fftwl_reodft010e_r2hc_register
-fftwl_reodft11e_r2hc_odd_register
-fftwl_reodft11e_radix2_r2hc_register
-fftwl_reodft_conf_standard
-fftwl_rodft00e_r2hc_pad_register
-fftwl_safe_mulmod
-fftwl_scanner_destroy
-fftwl_set_planner_hooks
-fftwl_set_timelimit
-fftwl_solver_destroy
-fftwl_solver_register
-fftwl_solver_use
-fftwl_solvtab_exec
-fftwl_spawn_loop
-fftwl_sprint_plan
-fftwl_tensor_append
-fftwl_tensor_compress
-fftwl_tensor_compress_contiguous
-fftwl_tensor_copy
-fftwl_tensor_copy_except
-fftwl_tensor_copy_inplace
-fftwl_tensor_copy_sub
-fftwl_tensor_destroy
-fftwl_tensor_destroy2
-fftwl_tensor_destroy4
-fftwl_tensor_equal
-fftwl_tensor_inplace_locations
-fftwl_tensor_inplace_strides
-fftwl_tensor_inplace_strides2
-fftwl_tensor_kosherp
-fftwl_tensor_max_index
-fftwl_tensor_md5
-fftwl_tensor_min_istride
-fftwl_tensor_min_ostride
-fftwl_tensor_min_stride
-fftwl_tensor_print
-fftwl_tensor_split
-fftwl_tensor_strides_decrease
-fftwl_tensor_sz
-fftwl_tensor_tornk1
-fftwl_the_planner
-fftwl_threads_cleanup
-fftwl_threads_conf_standard
-fftwl_threads_register_planner_hooks
-fftwl_tile2d
-fftwl_toobig
-fftwl_transpose
-fftwl_transpose_tiled
-fftwl_transpose_tiledbuf
-fftwl_triggen_destroy
-fftwl_twiddle_awake
-fftwl_twiddle_length
-fftwl_zero1d_pair
-lfftw_cleanup_
-lfftw_cleanup__
-lfftw_cleanup_threads_
-lfftw_cleanup_threads__
-lfftw_cost_
-lfftw_cost__
-lfftw_destroy_plan_
-lfftw_destroy_plan__
-lfftw_estimate_cost_
-lfftw_estimate_cost__
-lfftw_execute_
-lfftw_execute__
-lfftw_execute_dft_
-lfftw_execute_dft__
-lfftw_execute_dft_c2r_
-lfftw_execute_dft_c2r__
-lfftw_execute_dft_r2c_
-lfftw_execute_dft_r2c__
-lfftw_execute_r2r_
-lfftw_execute_r2r__
-lfftw_execute_split_dft_
-lfftw_execute_split_dft__
-lfftw_execute_split_dft_c2r_
-lfftw_execute_split_dft_c2r__
-lfftw_execute_split_dft_r2c_
-lfftw_execute_split_dft_r2c__
-lfftw_export_wisdom_
-lfftw_export_wisdom__
-lfftw_flops_
-lfftw_flops__
-lfftw_forget_wisdom_
-lfftw_forget_wisdom__
-lfftw_import_system_wisdom_
-lfftw_import_system_wisdom__
-lfftw_import_wisdom_
-lfftw_import_wisdom__
-lfftw_init_threads_
-lfftw_init_threads__
-lfftw_plan_dft_
-lfftw_plan_dft__
-lfftw_plan_dft_1d_
-lfftw_plan_dft_1d__
-lfftw_plan_dft_2d_
-lfftw_plan_dft_2d__
-lfftw_plan_dft_3d_
-lfftw_plan_dft_3d__
-lfftw_plan_dft_c2r_
-lfftw_plan_dft_c2r__
-lfftw_plan_dft_c2r_1d_
-lfftw_plan_dft_c2r_1d__
-lfftw_plan_dft_c2r_2d_
-lfftw_plan_dft_c2r_2d__
-lfftw_plan_dft_c2r_3d_
-lfftw_plan_dft_c2r_3d__
-lfftw_plan_dft_r2c_
-lfftw_plan_dft_r2c__
-lfftw_plan_dft_r2c_1d_
-lfftw_plan_dft_r2c_1d__
-lfftw_plan_dft_r2c_2d_
-lfftw_plan_dft_r2c_2d__
-lfftw_plan_dft_r2c_3d_
-lfftw_plan_dft_r2c_3d__
-lfftw_plan_guru_dft_
-lfftw_plan_guru_dft__
-lfftw_plan_guru_dft_c2r_
-lfftw_plan_guru_dft_c2r__
-lfftw_plan_guru_dft_r2c_
-lfftw_plan_guru_dft_r2c__
-lfftw_plan_guru_r2r_
-lfftw_plan_guru_r2r__
-lfftw_plan_guru_split_dft_
-lfftw_plan_guru_split_dft__
-lfftw_plan_guru_split_dft_c2r_
-lfftw_plan_guru_split_dft_c2r__
-lfftw_plan_guru_split_dft_r2c_
-lfftw_plan_guru_split_dft_r2c__
-lfftw_plan_many_dft_
-lfftw_plan_many_dft__
-lfftw_plan_many_dft_c2r_
-lfftw_plan_many_dft_c2r__
-lfftw_plan_many_dft_r2c_
-lfftw_plan_many_dft_r2c__
-lfftw_plan_many_r2r_
-lfftw_plan_many_r2r__
-lfftw_plan_r2r_
-lfftw_plan_r2r__
-lfftw_plan_r2r_1d_
-lfftw_plan_r2r_1d__
-lfftw_plan_r2r_2d_
-lfftw_plan_r2r_2d__
-lfftw_plan_r2r_3d_
-lfftw_plan_r2r_3d__
-lfftw_plan_with_nthreads_
-lfftw_plan_with_nthreads__
-lfftw_print_plan_
-lfftw_print_plan__
-lfftw_set_timelimit_
-lfftw_set_timelimit__
diff --git a/funasr/runtime/onnxruntime/win/lib/x86/libfftw3l-3.exp b/funasr/runtime/onnxruntime/win/lib/x86/libfftw3l-3.exp
deleted file mode 100644
index cc66aff..0000000
--- a/funasr/runtime/onnxruntime/win/lib/x86/libfftw3l-3.exp
+++ /dev/null
Binary files differ
diff --git a/funasr/runtime/onnxruntime/win/lib/x86/libfftw3l-3.lib b/funasr/runtime/onnxruntime/win/lib/x86/libfftw3l-3.lib
deleted file mode 100644
index bdceb32..0000000
--- a/funasr/runtime/onnxruntime/win/lib/x86/libfftw3l-3.lib
+++ /dev/null
Binary files differ
diff --git a/funasr/runtime/onnxruntime/win/lib/x86/onnxruntime.lib b/funasr/runtime/onnxruntime/win/lib/x86/onnxruntime.lib
deleted file mode 100644
index b00709f..0000000
--- a/funasr/runtime/onnxruntime/win/lib/x86/onnxruntime.lib
+++ /dev/null
Binary files differ
diff --git a/funasr/runtime/onnxruntime/win/readme.md b/funasr/runtime/onnxruntime/win/readme.md
deleted file mode 100644
index 8b13789..0000000
--- a/funasr/runtime/onnxruntime/win/readme.md
+++ /dev/null
@@ -1 +0,0 @@
-
--
Gitblit v1.9.1