From fb50c3b28d2a0c796edf54cc122c13d90b28b697 Mon Sep 17 00:00:00 2001 From: Ge Wang Date: Sat, 21 Oct 2023 23:42:59 -0700 Subject: [PATCH] tweak chugin api version printing --- src/core/chuck_compile.cpp | 2 +- src/core/chuck_dl.cpp | 21 +++++++++++---------- src/core/chuck_dl.h | 6 +++--- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/core/chuck_compile.cpp b/src/core/chuck_compile.cpp index c999d933c..5182212e9 100644 --- a/src/core/chuck_compile.cpp +++ b/src/core/chuck_compile.cpp @@ -1037,7 +1037,7 @@ t_CKBOOL load_external_module_at_path( Chuck_Compiler * compiler, } // print - EM_log_opts( CK_LOG_SEVERE, EM_LOG_NO_PREFIX, "[%s] (API version: %d.%d)", TC::green("OK",true).c_str(), dll->versionMajor(), dll->versionMinor() ); + EM_log_opts( CK_LOG_SEVERE, EM_LOG_NO_PREFIX, "[%s]", TC::green("OK",true).c_str() ); // add to compiler compiler->m_dlls.push_back(dll); // commit operator overloads | 1.5.1.5 diff --git a/src/core/chuck_dl.cpp b/src/core/chuck_dl.cpp index f960ddaf3..aff45bbca 100644 --- a/src/core/chuck_dl.cpp +++ b/src/core/chuck_dl.cpp @@ -917,12 +917,12 @@ const Chuck_DL_Query * Chuck_DLL::query() // check version t_CKUINT dll_version = m_api_version_func(); // get major and minor version numbers - m_versionMajor = CK_DLL_VERSION_GETMAJOR(dll_version); - m_versionMinor = CK_DLL_VERSION_GETMINOR(dll_version); + m_apiVersionMajor = CK_DLL_VERSION_GETMAJOR(dll_version); + m_apiVersionMinor = CK_DLL_VERSION_GETMINOR(dll_version); // is version ok t_CKBOOL version_ok = FALSE; // major version must be same; minor version must less than or equal - if( m_versionMajor == CK_DLL_VERSION_MAJOR && m_versionMinor <= CK_DLL_VERSION_MINOR) + if( m_apiVersionMajor == CK_DLL_VERSION_MAJOR && m_apiVersionMinor <= CK_DLL_VERSION_MINOR) version_ok = TRUE; // if version not okay @@ -932,7 +932,7 @@ const Chuck_DL_Query * Chuck_DLL::query() ostringstream oss; oss << "chugin API version incompatible..." << endl << "chugin path: '" << m_filename << "'" << endl - << "chugin API version: " << m_versionMajor << "." << m_versionMinor + << "chugin API version: " << m_apiVersionMajor << "." << m_apiVersionMinor << " VS host API version: " << CK_DLL_VERSION_MAJOR << "." << CK_DLL_VERSION_MINOR; m_last_error = oss.str(); return NULL; @@ -1082,8 +1082,8 @@ t_CKBOOL Chuck_DLL::probe() // check version t_CKUINT dll_version = m_api_version_func(); // get major and minor version numbers - m_versionMajor = CK_DLL_VERSION_GETMAJOR(dll_version); - m_versionMinor = CK_DLL_VERSION_GETMINOR(dll_version); + m_apiVersionMajor = CK_DLL_VERSION_GETMAJOR(dll_version); + m_apiVersionMinor = CK_DLL_VERSION_GETMINOR(dll_version); return TRUE; } @@ -1182,7 +1182,7 @@ t_CKUINT Chuck_DLL::versionMajor() // probe dll if( !this->probe() ) return 0; // return - return m_versionMajor; + return m_apiVersionMajor; } @@ -1197,7 +1197,7 @@ t_CKUINT Chuck_DLL::versionMinor() // probe dll if( !this->probe() ) return 0; // return - return m_versionMinor; + return m_apiVersionMinor; } @@ -1213,10 +1213,11 @@ t_CKBOOL Chuck_DLL::compatible() if( !this->probe() ) return FALSE; // major version must be same between chugin and host // chugin minor version must less than or equal host minor version - if( m_versionMajor == CK_DLL_VERSION_MAJOR && m_versionMinor <= CK_DLL_VERSION_MINOR ) + if( m_apiVersionMajor == CK_DLL_VERSION_MAJOR && m_apiVersionMinor <= CK_DLL_VERSION_MINOR ) { return TRUE; } else { - m_last_error = string("incompatible API version: chugin (") + ck_itoa(m_versionMajor) + "." + ck_itoa(m_versionMinor) + m_last_error = string("incompatible API version: chugin (") + + ck_itoa(m_apiVersionMajor) + "." + ck_itoa(m_apiVersionMinor) + string(") vs. host (") + ck_itoa(CK_DLL_VERSION_MAJOR) + "." + ck_itoa(CK_DLL_VERSION_MINOR) + ")"; diff --git a/src/core/chuck_dl.h b/src/core/chuck_dl.h index e047e3171..750d393fe 100644 --- a/src/core/chuck_dl.h +++ b/src/core/chuck_dl.h @@ -766,7 +766,7 @@ struct Chuck_DLL : public Chuck_VM_Object Chuck_DLL( Chuck_Carrier * carrier, const char * xid = NULL ) : m_handle(NULL), m_id(xid ? xid : ""), m_done_query(FALSE), m_api_version_func(NULL), m_info_func(NULL), m_query_func(NULL), - m_query( carrier, this ), m_versionMajor(0), m_versionMinor(0) + m_query( carrier, this ), m_apiVersionMajor(0), m_apiVersionMinor(0) { } // destructor ~Chuck_DLL() { this->unload(); } @@ -790,8 +790,8 @@ struct Chuck_DLL : public Chuck_VM_Object Chuck_DL_Query m_query; protected: // addition info 1.5.0.4 (ge) added - t_CKUINT m_versionMajor; - t_CKUINT m_versionMinor; + t_CKUINT m_apiVersionMajor; + t_CKUINT m_apiVersionMinor; };