7272#define AUTOIT_INFO ( _message ) do { \
7373 std::ostringstream _out; _out << _message; \
7474 fflush (stdout); fflush (stderr); \
75- fprintf (stderr, AUTOIT_QUOTE_STRING (AUTOIT_LIB_NAME) " (%s) Info: %s (%s) in %s, file %s, line %d\n " , AUTOIT_QUOTE_STRING (AUTOIT_LIB_VERSION), _out.str ().c_str (), " " , AutoIt_Func, __FILE__, __LINE__); \
75+ fprintf (stderr, AUTOIT_QUOTE_STRING (AUTOIT_LIB_NAME) " (%s) Info: %s in %s, file %s, line %d\n " , AUTOIT_QUOTE_STRING (AUTOIT_LIB_VERSION), _out.str ().c_str (), AutoIt_Func, __FILE__, __LINE__); \
7676 fflush (stdout); fflush (stderr); \
7777} while (0 )
7878#endif
8181#define AUTOIT_WARN ( _message ) do { \
8282 std::ostringstream _out; _out << _message; \
8383 fflush (stdout); fflush (stderr); \
84- fprintf (stderr, AUTOIT_QUOTE_STRING (AUTOIT_LIB_NAME) " (%s) Warning: %s (%s) in %s, file %s, line %d\n " , AUTOIT_QUOTE_STRING (AUTOIT_LIB_VERSION), _out.str ().c_str (), " " , AutoIt_Func, __FILE__, __LINE__); \
84+ fprintf (stderr, AUTOIT_QUOTE_STRING (AUTOIT_LIB_NAME) " (%s) Warning: %s in %s, file %s, line %d\n " , AUTOIT_QUOTE_STRING (AUTOIT_LIB_VERSION), _out.str ().c_str (), AutoIt_Func, __FILE__, __LINE__); \
8585 fflush (stdout); fflush (stderr); \
8686} while (0 )
8787#endif
9090#define AUTOIT_ERROR ( _message ) do { \
9191 std::ostringstream _out; _out << _message; \
9292 fflush (stdout); fflush (stderr); \
93- fprintf (stderr, AUTOIT_QUOTE_STRING (AUTOIT_LIB_NAME) " (%s) Error: %s (%s) in %s, file %s, line %d\n " , AUTOIT_QUOTE_STRING (AUTOIT_LIB_VERSION), _out.str ().c_str (), " " , AutoIt_Func, __FILE__, __LINE__); \
93+ fprintf (stderr, AUTOIT_QUOTE_STRING (AUTOIT_LIB_NAME) " (%s) Error: %s in %s, file %s, line %d\n " , AUTOIT_QUOTE_STRING (AUTOIT_LIB_VERSION), _out.str ().c_str (), AutoIt_Func, __FILE__, __LINE__); \
9494 fflush (stdout); fflush (stderr); \
9595} while (0 )
9696#endif
9999#define AUTOIT_THROW ( _message ) do { \
100100 std::ostringstream _out; _out << _message; \
101101 fflush (stdout); fflush (stderr); \
102- fprintf (stderr, AUTOIT_QUOTE_STRING (AUTOIT_LIB_NAME) " (%s) Error: %s (%s) in %s, file %s, line %d\n " , AUTOIT_QUOTE_STRING (AUTOIT_LIB_VERSION), _out.str ().c_str (), " " , AutoIt_Func, __FILE__, __LINE__); \
102+ fprintf (stderr, AUTOIT_QUOTE_STRING (AUTOIT_LIB_NAME) " (%s) Error: %s in %s, file %s, line %d\n " , AUTOIT_QUOTE_STRING (AUTOIT_LIB_VERSION), _out.str ().c_str (), AutoIt_Func, __FILE__, __LINE__); \
103103 fflush (stdout); fflush (stderr); \
104104 throw std::exception (_out.str ().c_str ()); \
105105} while (0 )
117117
118118#ifndef AUTOIT_ASSERT_SET_HR
119119#define AUTOIT_ASSERT_SET_HR ( expr ) do { if (!!(expr)) { hr = S_OK; } else { \
120+ fflush (stdout); fflush (stderr); \
120121fprintf (stderr, AUTOIT_QUOTE_STRING (AUTOIT_LIB_NAME) " (%s) Error: (%s) in %s, file %s, line %d\n " , AUTOIT_QUOTE_STRING (AUTOIT_LIB_VERSION), #expr, AutoIt_Func, __FILE__, __LINE__); \
122+ fflush (stdout); fflush (stderr); \
121123hr = E_FAIL; } \
122124} while (0 )
123125#endif
@@ -808,8 +810,8 @@ namespace autoit {
808810 /* *
809811 * https://github.com/ThePhD/sol2/blob/v3.3.0/include/sol/stack_core.hpp#L1352
810812 */
811- template <typename T>
812- std::string adl_default_to_string (const T& obj) {
813+ template <typename T>
814+ inline std::string adl_default_to_string (const T& obj) {
813815 return std::to_string (obj);
814816 }
815817
@@ -878,7 +880,7 @@ namespace autoit {
878880 bool __eq__ (const std::vector<T>& v1, const std::vector<T>& v2);
879881
880882 template <typename T>
881- bool __eq__ (const T& o1, const T& o2) {
883+ inline bool __eq__ (const T& o1, const T& o2) {
882884 if constexpr (requires (const T & a, const T & b) { static_cast <bool >(a == b); }) {
883885 return static_cast <bool >(o1 == o2);
884886 }
@@ -888,15 +890,15 @@ namespace autoit {
888890 }
889891
890892 template <typename T>
891- bool __eq__ (const std::shared_ptr<T>& p1, const std::shared_ptr<T>& p2) {
893+ inline bool __eq__ (const std::shared_ptr<T>& p1, const std::shared_ptr<T>& p2) {
892894 if (static_cast <bool >(p1) && static_cast <bool >(p2)) {
893895 return __eq__ (*p1, *p2);
894896 }
895897 return !static_cast <bool >(p1) && !static_cast <bool >(p2);
896898 }
897899
898900 template <typename K, typename V>
899- bool __eq__ (const std::map<K, V>& m1, const std::map<K, V>& m2) {
901+ inline bool __eq__ (const std::map<K, V>& m1, const std::map<K, V>& m2) {
900902 if (m1.size () != m2.size ()) {
901903 return false ;
902904 }
@@ -911,48 +913,48 @@ namespace autoit {
911913 }
912914
913915 template <typename T1, typename T2>
914- bool __eq__ (const std::pair<T1, T2>& p1, const std::pair<T1, T2>& p2) {
916+ inline bool __eq__ (const std::pair<T1, T2>& p1, const std::pair<T1, T2>& p2) {
915917 return __eq__ (p1.first , p2.first ) && __eq__ (p1.second , p2.second );
916918 }
917919
918920 template <typename T>
919- bool __eq__ (const std::vector<T>& v1, const std::vector<T>& v2) {
921+ inline bool __eq__ (const std::vector<T>& v1, const std::vector<T>& v2) {
920922 if (v1.size () != v2.size ()) {
921923 return false ;
922924 }
923925 const auto mismatched = std::mismatch (v1.begin (), v1.end (), v2.begin (), static_cast <bool (*)(const T&, const T&)>(__eq__));
924926 return mismatched.first == v1.end ();
925927 }
926928
927- template <typename _Tp>
929+ template <typename _Tp>
928930 AUTOIT_PTR<typename _Tp> cast (IDispatch* element);
929931
930- template <typename _Tp>
932+ template <typename _Tp>
931933 const AUTOIT_PTR<typename _Tp> cast (const IDispatch* element);
932934
933935 template <typename _Tp>
934- _Tp cast (VARIANT const * const & in_val) {
936+ inline _Tp cast (VARIANT const * const & in_val) {
935937 _Tp value;
936938 AUTOIT_ASSERT_THROW (SUCCEEDED (autoit_to (in_val, value)), " Invalid argument" );
937939 return value;
938940 }
939941
940- template <typename _Tp>
941- const AUTOIT_PTR<typename _Tp> reference_internal (_Tp* element) {
942+ template <typename _Tp>
943+ inline const AUTOIT_PTR<typename _Tp> reference_internal (_Tp* element) {
942944 return AUTOIT_PTR<_Tp>(AUTOIT_PTR<_Tp>{}, element);
943945 }
944946
945- template <typename _Tp>
946- const AUTOIT_PTR<typename _Tp> reference_internal (const _Tp* element) {
947+ template <typename _Tp>
948+ inline const AUTOIT_PTR<typename _Tp> reference_internal (const _Tp* element) {
947949 return AUTOIT_PTR<_Tp>(AUTOIT_PTR<_Tp>{}, const_cast <_Tp*>(element));
948950 }
949951
950- template <typename _Tp>
952+ template <typename _Tp>
951953 const AUTOIT_PTR<typename _Tp> reference_internal (_Tp& element) {
952954 return AUTOIT_PTR<_Tp>(AUTOIT_PTR<_Tp>{}, & element);
953955 }
954956
955- template <typename _Tp>
957+ template <typename _Tp>
956958 const AUTOIT_PTR<typename _Tp> reference_internal (const _Tp& element) {
957959 return AUTOIT_PTR<_Tp>(AUTOIT_PTR<_Tp>{}, const_cast <_Tp*>(&element));
958960 }
@@ -979,7 +981,7 @@ namespace autoit {
979981 }
980982 };
981983
982- template <typename destination_type, typename _Ty1, typename _Ty2>
984+ template <typename destination_type, typename _Ty1, typename _Ty2>
983985 struct _GenericCopy <destination_type, std::pair<_Ty1, _Ty2>> {
984986 inline static HRESULT copy (destination_type* pTo, const std::pair<_Ty1, _Ty2>* pFrom) {
985987 return autoit_from (*pFrom, pTo);
0 commit comments