EXPORT BOOL WINAPI debug_notice ( HSP3DEBUG *p1, int p2, int p3, int p4 ) { // // debug_notice ptr (type1) // p2: 0=stop event // 1=send message // int cur; HSPCTX *ctx; HSPAPICHAR *hactmp1; if ( p2 == 1 ) { ctx = (HSPCTX *)p1->hspctx; strcat( ctx->stmp, "\r\n" ); TabLogAdd( chartoapichar(ctx->stmp,&hactmp1) ); freehac(&hactmp1); return 0; } CurrnetUpdate(); cur = TabCtrl_GetCurSel(g_hTabCtrl); switch( cur ) { case 0: TabGeneralReset(); break; case 1: TabVarsUpdate(); break; } return 0; }
static void TabVarsReset( void ) { char *p0; LPTSTR p; TCHAR name[256]; int chk; int opt; opt = GetTabVarsOption(); /* long style; style = GetWindowLong( g_hVarList, GWL_STYLE ); if ( opt & 1 ) { style |= LBS_SORT; } else { style &= ~LBS_SORT; } SetWindowLong( g_hVarList, GWL_STYLE, style ); */ SendMessage( g_hVarList, LB_RESETCONTENT, 0, 0L ); p0 = g_debug->get_varinf( NULL, opt ); // HSP側に問い合わせ chartoapichar(p0, &p); if ( opt & 1 ) SortNote( p ); strsp_ini(); while(1) { chk = strsp_get( p, name, 0, 255 ); if ( chk == 0 ) break; SendMessage( g_hVarList, LB_INSERTSTRING, 0, (long)name ); } freehac(&p); g_debug->dbg_close( p0 ); }
static void CurrnetUpdate( void ) { TCHAR tmp[512]; LPTSTR fn; char *p0; HSPAPICHAR *hactmp1; g_debug->dbg_curinf(); fn = chartoapichar(g_debug->fname,&hactmp1); if ( fn == NULL ) fn = TEXT("???"); _stprintf( tmp,TEXT("%s\n( line:%d )"), fn, g_debug->line ); SetWindowText( g_hSttCtrl, tmp ); freehac(&hactmp1); p0 = g_debug->dbg_callstack(); SetWindowText( g_hCallstackEdit, chartoapichar(p0,&hactmp1) ); g_debug->dbg_close( p0 ); freehac(&hactmp1); }
static void TabVarsUpdate( void ) { TCHAR tmp[256]; char *p; int i; HSPCHAR *hctmp1; HSPAPICHAR *hactmp1; i = (int)SendMessage( g_hVarList, LB_GETCURSEL,0,0L ); if ( i < 0 ) return; SendMessage( g_hVarList, LB_GETTEXT, i, (LPARAM)tmp ); p = g_debug->get_varinf( apichartohspchar(tmp,&hctmp1), GetTabVarsOption() ); // HSP側に問い合わせ freehc(&hctmp1); SetWindowText( g_hVarEdit, chartoapichar(p,&hactmp1) ); freehac(&hactmp1); g_debug->dbg_close( p ); }
static int BindFUNC( STRUCTDAT *st, char *name ) { // ファンクションのバインドを行なう // (name:後から与える時のファンクション名) // int i; char *n; LIBDAT *lib; HINSTANCE hd; if (( st->subid != STRUCTPRM_SUBID_DLL )&&( st->subid != STRUCTPRM_SUBID_OLDDLL )) return 4; i = st->nameidx; if ( i < 0 ) { if ( name == NULL ) return 3; n = name; } else { n = strp(i); } lib = GetLIB( st->index ); if ( lib->flag != LIBDAT_FLAG_DLLINIT ) { BindLIB( lib, NULL ); if ( lib->flag != LIBDAT_FLAG_DLLINIT ) return 2; } hd = (HINSTANCE)(lib->hlib); if ( hd == NULL ) return 1; #ifdef HSPUTF8 HSPAPICHAR *hactmp1; char tmp1[512]; chartoapichar(n,&hactmp1); cnvsjis(tmp1,(char*)hactmp1,512); st->proc = (void *)GetProcAddress( hd, tmp1 ); freehac(&hactmp1); #else st->proc = (void *)GetProcAddress( hd, n ); #endif if ( st->proc == NULL ) return 1; st->subid--; return 0; }
HMODULE CDllManager::load_library( const char *lpFileName ) { mError = NULL; HMODULE h; #ifdef HSPUTF8 HSPAPICHAR *hactmp1; chartoapichar( lpFileName, &hactmp1); h = LoadLibrary(hactmp1); freehac(&hactmp1); #else h = LoadLibrary( lpFileName ); #endif try { if ( h != NULL ) mModules.push_front( h ); } catch ( ... ) { if ( !FreeLibrary( h ) ) mError = h; h = NULL; } return h; }
static void TabGeneralReset( void ) { LV_ITEM item; int chk, tgmax; char *p0; LPTSTR p; TCHAR name[256]; TCHAR val[512]; HSPAPICHAR *hactmp1; ListView_DeleteAllItems( g_hGenList ); tgmax = 0; p0 = g_debug->get_value(DEBUGINFO_GENERAL); p = chartoapichar(p0,&hactmp1); // HSP側に問い合わせ strsp_ini(); while(1) { chk = strsp_get( p, name, 0, 255 ); if ( chk == 0 ) break; chk = strsp_get( p, val, 0, 511 ); if ( chk == 0 ) break; item.mask = LVIF_TEXT; item.iItem = tgmax; item.iSubItem = 0; item.pszText = name; ListView_InsertItem( g_hGenList, &item ); item.iSubItem = 1; item.pszText = val; ListView_SetItem( g_hGenList, &item ); tgmax++; } g_debug->dbg_close( p0 ); freehac(&hactmp1); }
static int Hsp3ExtAddPlugin( void ) { // プラグインの登録 // int i; HSPHED *hed; char *ptr; char *libname; char *funcname; HPIDAT *org_hpi; MEM_HPIDAT *hpi; HSP3TYPEINFO *info; HINSTANCE hd; TCHAR tmp[512]; hed = hspctx->hsphed; ptr = (char *)hed; org_hpi = (HPIDAT *)(ptr + hed->pt_hpidat); hpimax = hed->max_hpi / sizeof(HPIDAT); if ( hpimax == 0 ) return 0; hpidat = (MEM_HPIDAT *)malloc(hpimax * sizeof(MEM_HPIDAT)); hpi = hpidat; for ( i=0;i<hpimax;i++ ) { hpi->flag = org_hpi->flag; hpi->option = org_hpi->option; hpi->libname = org_hpi->libname; hpi->funcname = org_hpi->funcname; hpi->libptr = NULL; libname = strp(hpi->libname); funcname = strp(hpi->funcname); info = code_gettypeinfo(-1); if ( hpi->flag == HPIDAT_FLAG_TYPEFUNC ) { hd = DllManager().load_library( libname ); if ( hd == NULL ) { #ifdef HSPUTF8 TCHAR tmp[512]; HSPAPICHAR *haclibname; chartoapichar(libname, &haclibname); _stprintf(tmp, TEXT("No DLL:%s"), haclibname); freehac(&haclibname); AlertW(tmp); #else Alertf( "No DLL:%s", libname ); #endif return 1; } hpi->libptr = (void *)hd; #ifdef HSPUTF8 HSPAPICHAR *hacfuncname; char tmp2[512]; chartoapichar(funcname,&hacfuncname); cnvsjis(tmp2,(char*)hacfuncname,512); func = (DLLFUNC)GetProcAddress( hd, tmp2 ); #else func = (DLLFUNC)GetProcAddress( hd, funcname ); #endif if ( func == NULL ) { #ifdef HSPUTF8 TCHAR tmp[512]; HSPAPICHAR *haclibname; chartoapichar(libname, &haclibname); _stprintf(tmp, TEXT("No DLL:%s:%s"), haclibname, hacfuncname); freehac(&haclibname); AlertW(tmp); freehac(&hacfuncname); #else Alertf("No DLL:%s:%s", libname, funcname); #endif return 1; } func( info ); code_enable_typeinfo( info ); //Alertf( "%d_%d [%s][%s]", i, info->type, libname, funcname ); #ifdef HSPUTF8 freehac(&hacfuncname); #endif } hpi++; org_hpi++; } return 0; }