Annotation of win32/development/msvcee/eeparser3.cpp, revision 1.2

1.1       paf         1: #include <stdio.h>
                      2: #include <string.h>
                      3: #include <tchar.h>
                      4: 
                      5: #include "custview.h"
                      6: 
                      7: #include "eeparser3.h"
                      8: #include "cord/include/cord.h"
                      9: 
                     10: // Helper routine that converts a system time into ASCII
                     11: 
                     12: struct String {
                     13:        enum Language {
                     14:                L_UNSPECIFIED=0, ///< no real string has parts of this lange: it's just convinient to check when string's empty
                     15:                // these two must go before others, there are checks for >L_AS_IS
                     16:                L_CLEAN='1', ///< clean
                     17:                L_AS_IS,     ///< leave all characters intact
                     18: 
                     19:                L_PASS_APPENDED,
                     20:                        /**<
                     21:                                leave lang built into string being appended.
                     22:                                just a flag, that value not stored
                     23:                        */
                     24:                L_TAINTED,  ///< tainted, untaint lang as assigned later 
                     25:                // untaint langs. assigned by ^untaint[lang]{...}
                     26:                L_FILE_SPEC, ///< file specification
                     27:                L_HTTP_HEADER,    ///< text in HTTP response header
                     28:                L_MAIL_HEADER,    ///< text in mail header
                     29:                L_URI,       ///< text in uri
                     30:                L_TABLE,     ///< ^table:set body
                     31:                L_SQL,       ///< ^table:sql body
                     32:                L_JS,        ///< JavaScript code
                     33:                L_XML,          ///< ^dom:set xml
                     34:                L_HTML,      ///< HTML code (for editing)
                     35:                L_OPTIMIZE_BIT = 0x80  ///< flag, requiring cstr whitespace optimization
                     36:        };
                     37: 
                     38:        class Languages {
                     39:                union {
                     40:                        struct {
                     41:                                Language lang:8;
                     42:                                int is_not_just_lang:sizeof(CORD)*8-8;
                     43:                        };
                     44:                        CORD langs;
                     45:                };
                     46:        } langs;
                     47:        CORD body;
                     48: };
                     49: 
                     50: ADDIN_API HRESULT WINAPI AddIn_Parser3String( String* s, DEBUGHELPER *pHelper, int nBase, BOOL bUniStrings, char *pResult, size_t max, DWORD reserved )
                     51: {
1.2     ! paf        52:        s=D(s);
        !            53:        if(!s) {
        !            54:                strncpy(pResult, "<Empty>", max);
        !            55:                return;
        !            56:        }
1.1       paf        57: 
                     58:        try {
                     59: #if 0
1.2     ! paf        60:                MessageBox(0, "test", "stop", 0);
        !            61: #endif
        !            62: #if 0
1.1       paf        63:                char buf[100];
                     64:                _snprintf(buf, sizeof(buf), "=!0x%p!=", s->body);
                     65:                strncpy(pResult, buf, max);
                     66: #else
1.2     ! paf        67:                char buf[MAX_STRING*2];
        !            68:                _snprintf(buf, sizeof(buf), "\"%s\"", CORD_to_const_char_star(pHelper, D(s->body)), max);
        !            69:                strncpy(pResult, buf, max);
1.1       paf        70: #endif
                     71:        } catch(...) {
                     72:                strncpy(pResult, "!EE-ERROR!", max);
                     73:        }
                     74:        return 0;
                     75: }

E-mail: