Skip to content

Commit

Permalink
Tc571-10 loaduに対応
Browse files Browse the repository at this point in the history
  • Loading branch information
ponapalt committed Jan 15, 2025
1 parent fc1dd49 commit 78c55b9
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 17 deletions.
58 changes: 52 additions & 6 deletions aya5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class CAyaVMWrapper {
CAyaVM *vm;

public:
CAyaVMWrapper(const yaya::string_t &path, yaya::global_t h, long len) {
CAyaVMWrapper(const yaya::string_t &path, yaya::global_t h, long len, bool is_utf8) {
vm = new CAyaVM();

if (logsend_hwnd != 0) {
Expand All @@ -65,7 +65,7 @@ class CAyaVMWrapper {

vm->load();

vm->basis().SetPath(h, len);
vm->basis().SetPath(h, len, is_utf8);
vm->basis().Configure();

if ( vm->basis().IsSuppress() ) {
Expand All @@ -79,7 +79,7 @@ class CAyaVMWrapper {

vme->load();

vme->basis().SetPath(h, len);
vme->basis().SetPath(h, len, is_utf8);
vme->basis().Configure();

vme->logger().Message(11,E_E);
Expand Down Expand Up @@ -225,13 +225,30 @@ inline void enlarge_loghandler_list(size_t size){
* load
* -----------------------------------------------------------------------
*/
extern "C" DLLEXPORT BOOL_TYPE FUNCATTRIB load(yaya::global_t h, long len)
extern "C" DLLEXPORT BOOL_TYPE FUNCATTRIB loadu(yaya::global_t h, long len)
{
if ( vm[0] ) { delete vm[0]; }

id_now=0;
enlarge_loghandler_list(1);
vm[0] = new CAyaVMWrapper(modulename,h,len);
vm[0] = new CAyaVMWrapper(modulename,h,len,true);

#if defined(WIN32) || defined(_WIN32_WCE)
::GlobalFree(h);
#elif defined(POSIX)
free(h);
#endif

return 1;
}

extern "C" DLLEXPORT BOOL_TYPE FUNCATTRIB load(yaya::global_t h, long len)
{
if ( vm[0] ) { return 1; } //loaduで読み込まれた後再度呼び出されたと仮定

id_now=0;
enlarge_loghandler_list(1);
vm[0] = new CAyaVMWrapper(modulename,h,len,false);

#if defined(WIN32) || defined(_WIN32_WCE)
::GlobalFree(h);
Expand All @@ -242,6 +259,35 @@ extern "C" DLLEXPORT BOOL_TYPE FUNCATTRIB load(yaya::global_t h, long len)
return 1;
}

extern "C" DLLEXPORT long FUNCATTRIB multi_loadu(yaya::global_t h, long len)
{
long id = 0;

long n = (long)vm.size();
for ( long i = 1 ; i < n ; ++i ) { //1から 0番は従来用
if ( vm[i] == NULL ) {
id = i;
}
}

if ( id <= 0 ) {
vm.emplace_back(nullptr);
id = (long)vm.size() - 1;
}

enlarge_loghandler_list(id+1);
id_now=id;
vm[id] = new CAyaVMWrapper(modulename,h,len,true);

#if defined(WIN32) || defined(_WIN32_WCE)
::GlobalFree(h);
#elif defined(POSIX)
free(h);
#endif

return id;
}

extern "C" DLLEXPORT long FUNCATTRIB multi_load(yaya::global_t h, long len)
{
long id = 0;
Expand All @@ -260,7 +306,7 @@ extern "C" DLLEXPORT long FUNCATTRIB multi_load(yaya::global_t h, long len)

enlarge_loghandler_list(id+1);
id_now=id;
vm[id] = new CAyaVMWrapper(modulename,h,len);
vm[id] = new CAyaVMWrapper(modulename,h,len,false);

#if defined(WIN32) || defined(_WIN32_WCE)
::GlobalFree(h);
Expand Down
8 changes: 4 additions & 4 deletions aya5.rc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// ���{�� resources
// ���{�� resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN)
#ifdef _WIN32
Expand All @@ -28,7 +28,7 @@ LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 5,71,9,0
FILEVERSION 5,71,10,0
PRODUCTVERSION 5,0,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
Expand All @@ -47,7 +47,7 @@ BEGIN
VALUE "Comments", "YAYA\0"
VALUE "CompanyName", "YAYA Development Team\0"
VALUE "FileDescription", "yaya\0"
VALUE "FileVersion", "5, 71, 9, 0\0"
VALUE "FileVersion", "5, 71, 10, 0\0"
VALUE "InternalName", "Yet Another AYA5\0"
VALUE "LegalCopyright", " \0"
VALUE "LegalTrademarks", " \0"
Expand Down Expand Up @@ -108,7 +108,7 @@ TRADITIONAL-CHINESE MESSAGETXT MOVEABLE PURE "messagetxt\\traditional-chines

#endif //AYA_RES_NO_LANG

#endif // ���{�� resources
#endif // ���{�� resources
/////////////////////////////////////////////////////////////////////////////


Expand Down
22 changes: 17 additions & 5 deletions basis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,21 @@ void CBasis::SetModuleName(const yaya::string_t &s,const yaya::char_t *trailer,c
* -----------------------------------------------------------------------
*/
#if defined(WIN32) || defined(_WIN32_WCE)
void CBasis::SetPath(yaya::global_t h, int len)
void CBasis::SetPath(yaya::global_t h, int len, bool is_utf8)
{
// 取得と領域開放
std::string mbpath;
mbpath.assign((char *)h, 0, len);
//GlobalFree(h); //load側で開放
h = NULL;

// 文字コードをUCS-2へ変換(ここでのマルチバイト文字コードはOSデフォルト)
Ccct::MbcsToUcs2Buf(base_path, mbpath, CHARSET_DEFAULT);
// 文字コードをUCS-2へ変換
if ( is_utf8 ) {
Ccct::MbcsToUcs2Buf(base_path, mbpath, CHARSET_UTF8);
}
else {
Ccct::MbcsToUcs2Buf(base_path, mbpath, CHARSET_DEFAULT);
}

//最後が\でも/でもなければ足す
if (base_path.length() == 0 || ( (base_path[base_path.length()-1] != L'/') && (base_path[base_path.length()-1] != L'\\') ) ) {
Expand All @@ -138,10 +143,17 @@ void CBasis::SetPath(yaya::global_t h, int len)
load_path = base_path;
}
#elif defined(POSIX)
void CBasis::SetPath(yaya::global_t h, int len)
void CBasis::SetPath(yaya::global_t h, int len, bool is_utf8)
{
// 取得と領域開放
base_path = widen(std::string(h, static_cast<std::string::size_type>(len)));
if ( is_utf8 ) {
std::string mbpath;
mbpath.assign((char *)h, 0, len);
Ccct::MbcsToUcs2Buf(base_path, mbpath, CHARSET_UTF8);
}
else {
base_path = widen(std::string(h, static_cast<std::string::size_type>(len)));
}
//free(h); //load側で開放
h = NULL;
// スラッシュで終わってなければ付ける。
Expand Down
2 changes: 1 addition & 1 deletion basis.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class CBasis
#if defined(WIN32) || defined(_WIN32_WCE)
void SetLogRcvWnd(long hwnd);
#endif
void SetPath(yaya::global_t h, int len);
void SetPath(yaya::global_t h, int len, bool is_utf8);

void Configure(void);
void Termination(void);
Expand Down
2 changes: 1 addition & 1 deletion manifest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "manifest.h"

const yaya::char_t *aya_name = L"YAYA";
const yaya::char_t *aya_version = L"Tc571-9";
const yaya::char_t *aya_version = L"Tc571-10";
const yaya::char_t *aya_author = L"umeici/The Maintenance Shop";


Expand Down

0 comments on commit 78c55b9

Please sign in to comment.