Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PPAのコンテキストをクラス外から設定できる仕組みを作りたい #1820

Closed
berryzplus opened this issue Mar 19, 2022 · 2 comments

Comments

@berryzplus
Copy link
Contributor

やりたいこと

PPAのコンテキストをクラス外から設定できる仕組みを作りたい

経緯

CPPA::stdErrorはプライベートなグローバル変数CPPA::m_CurInstanceに依存します。

void __stdcall CPPA::stdError( int Err_CD, const char* Err_Mes )
{
if( false != m_CurInstance->m_bError ){
return;
}
m_CurInstance->m_bError = true; // 関数内で関数を呼ぶ場合等、2回表示されるのを防ぐ

CPPA::m_CurInstanceはCPPAの実行コンテキストを保持する構造体です。
プライベートなグローバル変数ですので、クラス外から値を変更することはできません。
CPPA::m_CurInstanceの初期値はnullptrなので、上記コードをテストコードから呼び出すとAV例外が発生します。

テストしたいコードは339行目以降なので、CPPA::stdErrorをテストするにはCPPA::m_CurInstanceに有効なPPAコンテキストを設定するために仕組みが必須になります。

Originally posted by @berryzplus in #1811 (comment)

@berryzplus
Copy link
Contributor Author

PPAの実行コンテキストを外から指定できる仕組みを作ったとして、
仕組みを活用するには CEditView を生成できる仕組みが必要。

struct PpaExecInfo {
CNativeA m_cMemRet; //!< コールバックからDLLに渡す文字列を保持
CEditView* m_pcEditView; // 2003.06.01 Moca
DLLSHAREDATA* m_pShareData; // 2003.06.01 Moca

現状、CEditViewをインスタンス化するにはCEditDoc をインスタンス化していることが必要で、
CEditDoc をインスタンス化するには共有メモリの初期化化が完了している必要がある。

@berryzplus
Copy link
Contributor Author

別な対応方法を検討しているので取り下げます。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant