File:  [parser3project] / win32 / development / msvcee / Attic / eeparser3.cpp
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Thu Sep 25 06:26:05 2003 UTC (22 years, 11 months ago) by paf
Branches: MAIN
CVS tags: HEAD
starting project, helping MSVC debugging of String class.
see readme

#include <stdio.h>
#include <string.h>
#include <tchar.h>

#include "custview.h"

#include "eeparser3.h"
#include "cord/include/cord.h"

// Helper routine that converts a system time into ASCII

struct String {
	enum Language {
		L_UNSPECIFIED=0, ///< no real string has parts of this lange: it's just convinient to check when string's empty
		// these two must go before others, there are checks for >L_AS_IS
		L_CLEAN='1', ///< clean
		L_AS_IS,     ///< leave all characters intact

		L_PASS_APPENDED,
			/**<
				leave lang built into string being appended.
				just a flag, that value not stored
			*/
		L_TAINTED,  ///< tainted, untaint lang as assigned later 
		// untaint langs. assigned by ^untaint[lang]{...}
		L_FILE_SPEC, ///< file specification
		L_HTTP_HEADER,    ///< text in HTTP response header
		L_MAIL_HEADER,    ///< text in mail header
		L_URI,       ///< text in uri
		L_TABLE,     ///< ^table:set body
		L_SQL,       ///< ^table:sql body
		L_JS,        ///< JavaScript code
		L_XML,		///< ^dom:set xml
		L_HTML,      ///< HTML code (for editing)
		L_OPTIMIZE_BIT = 0x80  ///< flag, requiring cstr whitespace optimization
	};

	class Languages {
		union {
			struct {
				Language lang:8;
				int is_not_just_lang:sizeof(CORD)*8-8;
			};
			CORD langs;
		};
	} langs;
	CORD body;
};

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 );*/


	try {
#if 0
		//MessageBox(0, "test", "stop", 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);
#endif
	} catch(...) {
		strncpy(pResult, "!EE-ERROR!", max);
	}
	return 0;
}

E-mail: