--- win32/development/msvcee/Attic/eeparser3.cpp 2003/09/25 06:26:05 1.1 +++ win32/development/msvcee/Attic/eeparser3.cpp 2003/09/25 07:42:48 1.3 @@ -35,7 +35,7 @@ struct String { L_OPTIMIZE_BIT = 0x80 ///< flag, requiring cstr whitespace optimization }; - class Languages { + struct Languages { union { struct { Language lang:8; @@ -49,19 +49,39 @@ struct String { ADDIN_API HRESULT WINAPI AddIn_Parser3String( String* s, DEBUGHELPER *pHelper, int nBase, BOOL bUniStrings, char *pResult, size_t max, DWORD reserved ) { - /*String s; - HRESULT r=pHelper->ReadDebuggeeMemory( pHelper, dwAddress, - sizeof(s), &s, &nGot );*/ - + s=D(s); + if(!s) { + strncpy(pResult, "", max); + return 0; + } try { #if 0 - //MessageBox(0, "test", "stop", 0); + MessageBox(0, "test", "stop", 0); +#endif +#if 0 char buf[100]; _snprintf(buf, sizeof(buf), "=!0x%p!=", s->body); strncpy(pResult, buf, max); #else - strncpy(pResult, CORD_to_const_char_star(pHelper, D(D(s)->body)), max); + char buf[MAX_STRING*2]; +#define LIMIT_BODY 30 +#define LIMIT_LANGS 10 + const char* body_view=CORD_to_const_char_star(pHelper, D(s->body)); + const char* langs_view=s->langs.is_not_just_lang? + CORD_to_const_char_star(pHelper, D(s->langs.langs)) + : (const char*)&s->langs.langs; + size_t body_len=strlen(body_view); + size_t langs_len=strlen(langs_view); + _snprintf(buf, sizeof(buf), + "%.*s%s}" + "{%d:%.*s%s", + LIMIT_LANGS, langs_view, langs_len>LIMIT_LANGS?"...":"", + body_len, + LIMIT_BODY, body_view, body_len>LIMIT_BODY?"...":"" + ); + + strncpy(pResult, buf, max); #endif } catch(...) { strncpy(pResult, "!EE-ERROR!", max);