]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/HelpGen/src/cjparser.cpp
compilation fix for VC6, it doesn't support partial template specialization
[wxWidgets.git] / utils / HelpGen / src / cjparser.cpp
index db12882ae2d8d32a415fae512daae5f3e71d4703..46824e382a3b04b36bb6b93de6488bc2566b3807 100644 (file)
@@ -9,10 +9,6 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
-#  pragma implementation "acell.h"
-#endif
-
 // For compilers that support precompilation, includes "wx/wx.h".
 #include "wx/wxprec.h"
 
@@ -42,7 +38,7 @@
 // statics used by inline'ed C helper-functions
 static char* _gSrcStart = 0;
 static char* _gSrcEnd   = 0;
-static wxChar* _gLastSuppresedComment = 0;
+static char* _gLastSuppresedComment = 0;
 static int   _gLineNo      = 0;
 
 // FOR NOW:: comments queue is static
@@ -386,13 +382,13 @@ static inline bool get_next_token( char*& cur )
         return true;
 }
 
-static inline void skip_preprocessor_dir( wxChar*& cur )
+static inline void skip_preprocessor_dir( char*& cur )
 {
     do
     {
         skip_to_eol(cur);
 
-        if ( *(cur-1) != _T('\\') )
+        if ( *(cur-1) != '\\' )
             break;
 
         if ( cur < _gSrcEnd )
@@ -644,9 +640,9 @@ static inline void skip_next_token_back( char*& cur )
     ++cur; // position after the trailing charcter of the prev token
 }
 
-static string get_token_str( char* cur )
+static wxString get_token_str( char* cur )
 {
-    return string( cur, get_token_len( cur ) );
+    return wxString( cur, get_token_len( cur ) );
 }
 
 // skips token or whole expression which may have
@@ -903,8 +899,8 @@ static void arrange_indirection_tokens_between( wxString& type,
 {
     // TBD:: FIXME:: return value of operators !
 
-    while ( identifier[0u] == _T('*') ||
-            identifier[0u] == _T('&')
+    while ( identifier[0u] == '*' ||
+            identifier[0u] == '&'
           )
     {
         type += identifier[0u];
@@ -935,33 +931,33 @@ static bool is_keyword( char* cur )
     return i == __gMultiLangMap.end() ? false : true;
 }
 
-static inline void get_string_between( wxChar* start, wxChar* end,
+static inline void get_string_between( char* start, char* end,
                                        wxString* pStr )
 {
     char saved = *end;
 
-    *end  = _T('\0');
+    *end  = '\0';
     *pStr = start;
     *end  = saved;
 }
 
-static wxChar* set_comment_text( wxString& text, wxChar* start )
+static char* set_comment_text( wxString& text, char* start )
 {
-    wxChar* end = start;
+    char* end = start;
 
     // to avoid poluting the queue with this comment
     _gLastSuppresedComment = start;
 
     skip_comments( end );
 
-    if ( *(end-1) == _T('/') )
+    if ( *(end-1) == '/' )
         end -= 2;
 
     start += 2;
 
     // skip multiple leading '/''s or '*''s
-    while( *start == _T('/') && start < end ) ++start;
-    while( *start == _T('*') && start < end ) ++start;
+    while( *start == '/' && start < end ) ++start;
+    while( *start == '*' && start < end ) ++start;
 
     get_string_between( start, end, &text );
 
@@ -1068,13 +1064,13 @@ spFile* CJSourceParser::Parse( char* start, char* end )
             continue;
         }
 
-        if ( *m_cur >= _T('0') && *m_cur <= _T('9') )
+        if ( *m_cur >= '0' && *m_cur <= '9' )
         {
             skip_token( m_cur );
             continue;
         }
 
-        if ( *m_cur == _T('}') )
+        if ( *m_cur == '}' )
         {
             if ( mCurCtxType != SP_CTX_CLASS )
             {
@@ -1190,13 +1186,13 @@ spFile* CJSourceParser::Parse( char* start, char* end )
     } while( 1 );
 }
 
-void CJSourceParser::AttachComments( spContext& ctx, wxChar* cur )
+void CJSourceParser::AttachComments( spContext& ctx, char* cur )
 {
     if ( !mCommentsOn ) return;
 
     MCommentListT& lst = ctx.GetCommentList();
 
-    wxChar* prevComEnd = 0;
+    char* prevComEnd = 0;
 
     int tmpLnNo;
     store_line_no( tmpLnNo );
@@ -1209,9 +1205,9 @@ void CJSourceParser::AttachComments( spContext& ctx, wxChar* cur )
         lst.push_back( pComment );
 
         // find the end of comment
-        wxChar* start = _gCommentsQueue[i];
+        char* start = _gCommentsQueue[i];
 
-        pComment->mIsMultiline = ( *(start+1) == _T('*') );
+        pComment->mIsMultiline = ( *(start+1) == '*' );
 
         // first comment in the queue and multiline
         // comments are always treated as a begining
@@ -1230,7 +1226,7 @@ void CJSourceParser::AttachComments( spContext& ctx, wxChar* cur )
             // find out wheather there is a new-line
             // between to adjecent comments
 
-            wxChar* prevLine = start;
+            char* prevLine = start;
             skip_to_prev_line(prevLine);
 
             if ( prevLine >= prevComEnd )
@@ -1253,7 +1249,7 @@ void CJSourceParser::AttachComments( spContext& ctx, wxChar* cur )
         set_comment_text( pComment->m_Text, cur );
 
         pComment->mStartsPar = 1;
-        pComment->mIsMultiline = ( *(cur+1) == _T('*') );
+        pComment->mIsMultiline = ( *(cur+1) == '*' );
 
         // mark this comment, so that it would not
         // get in the comments list of the next context
@@ -1265,9 +1261,9 @@ void CJSourceParser::AttachComments( spContext& ctx, wxChar* cur )
     clear_commets_queue();
 }
 
-void CJSourceParser::AddMacroNode( wxChar*& cur )
+void CJSourceParser::AddMacroNode( char*& cur )
 {
-    wxChar* start = cur;
+    char* start = cur;
 
     int lineNo = get_line_no();
 
@@ -1294,9 +1290,9 @@ void CJSourceParser::AddMacroNode( wxChar*& cur )
     // determine the type exactly and assign
     // a name to the context
 
-    if ( *start == _T('d') )
+    if ( *start == 'd' )
     {
-        if ( cmp_tokens_fast( start, _T("define"), 6 ) )
+        if ( cmp_tokens_fast( start, "define", 6 ) )
         {
             char* tok = start+6;
 
@@ -1314,30 +1310,30 @@ void CJSourceParser::AddMacroNode( wxChar*& cur )
                 pPL->mDefType = SP_PREP_DEF_REDEFINE_SYMBOL;
         }
     }
-    else if ( *start == _T('i') )
+    else if ( *start == 'i' )
     {
-        if ( cmp_tokens_fast( start, _T("include"), 7 ) )
+        if ( cmp_tokens_fast( start, "include", 7 ) )
         {
             pPL->mDefType = SP_PREP_DEF_INCLUDE_FILE;
         }
-        else if ( *++start == _T('f') )
+        else if ( *++start == 'f' )
         {
             // either "#if" or "#ifdef"
             cur = start;
             skip_token( cur );
             get_next_token( cur );
 
-            string condition = get_token_str( cur );
+            wxString condition = get_token_str( cur );
 
             // currently, everything except '0' is true
-            if ( condition == _T("0") ) {
+            if ( condition == "0" ) {
                 // skip until the following else or enif
                 while ( cur < _gSrcEnd ) {
                     skip_to_eol( cur );
                     skip_eol( cur );
 
                     get_next_token( cur );
-                    if ( *cur++ == _T('#') && *cur == _T('e') )
+                    if ( *cur++ == '#' && *cur == 'e' )
                         break;
                 }
             }
@@ -1345,7 +1341,7 @@ void CJSourceParser::AddMacroNode( wxChar*& cur )
             // TODO parse the condition...
         }
     }
-    else if ( cmp_tokens_fast( start, _T("else"), 4 ) )
+    else if ( cmp_tokens_fast( start, "else", 4 ) )
     {
         // skip until "#endif"
         while ( cur < _gSrcEnd ) {
@@ -1353,7 +1349,7 @@ void CJSourceParser::AddMacroNode( wxChar*& cur )
             skip_eol( cur );
 
             get_next_token( cur );
-            if ( *cur++ == _T('#') && cmp_tokens_fast( cur, "endif", 5 ) )
+            if ( *cur++ == '#' && cmp_tokens_fast( cur, "endif", 5 ) )
                 break;
         }
     }
@@ -1595,7 +1591,7 @@ bool CJSourceParser::ParseNameAndRetVal( char*& cur, bool& isAMacro )
         skip_next_token_back( cur );
         skip_token_back( cur );
 
-        string lastToken = get_token_str( cur );
+        wxString lastToken = get_token_str( cur );
         if ( lastToken == "operator" ) {
             lastToken += pOp->m_Name;
             pOp->m_Name = lastToken;
@@ -1608,7 +1604,7 @@ bool CJSourceParser::ParseNameAndRetVal( char*& cur, bool& isAMacro )
     else if ( pOp->m_Name == "operator" ) {
         skip_token( cur );
         get_next_token( cur );
-        string oper = get_token_str( cur );
+        wxString oper = get_token_str( cur );
 
         pOp->m_Name += oper;
     }
@@ -1618,11 +1614,11 @@ bool CJSourceParser::ParseNameAndRetVal( char*& cur, bool& isAMacro )
 
     if ( cur >= start )
     {
-        string rettype = string( start, size_t( cur-start ) );
+        wxString rettype = wxString( start, size_t( cur-start ) );
         // FIXME just for now...
-        string::size_type pos = 0;
-        string toerase("WXDLLEXPORT ");
-        while((pos = rettype.find(toerase, pos)) != string::npos)
+        wxString::size_type pos = 0;
+        wxString toerase("WXDLLEXPORT ");
+        while((pos = rettype.find(toerase, pos)) != wxString::npos)
             rettype.erase(pos, toerase.length());
         pOp->m_RetType = rettype;
     }
@@ -1744,14 +1740,14 @@ bool CJSourceParser::ParseArguments( char*& cur )
         AttachComments( *pPar, blocks[nameBlock] );
 
         // retrieve argument name
-        pPar->m_Name = string( blocks[nameBlock], blockSizes[nameBlock] );
+        pPar->m_Name = wxString( blocks[nameBlock], blockSizes[nameBlock] );
 
         // retreive argument type
 
         size_t len = blockSizes[ typeBlock ];
         len = size_t ( (blocks[ typeBlock ] + len) - blocks[ 0 ] );
 
-        pPar->m_Type = string( blocks[0], len );
+        pPar->m_Type = wxString( blocks[0], len );
 
         arrange_indirection_tokens_between( pPar->m_Type, pPar->m_Name );
 
@@ -1834,7 +1830,7 @@ void CJSourceParser::ParseMemberVar( char*& cur )
 
     bool firstMember = true;
 
-    string type;
+    wxString type;
 
     // jump to the end of statement
     // and start collecting same-type varibles
@@ -1880,7 +1876,7 @@ void CJSourceParser::ParseMemberVar( char*& cur )
         // if comma, than variable list continues
         // otherwise the variable type reached - stop
 
-        if ( *cur == _T('=') )
+        if ( *cur == '=' )
         {
             // yes, we've mistaken, it was not a identifier,
             // but it's default value
@@ -2026,7 +2022,7 @@ void CJSourceParser::AddClassNode( char*& cur )
 {
     char* ctxStart = cur;
 
-    string classkeyword = get_token_str( cur );
+    wxString classkeyword = get_token_str( cur );
 
     skip_token( cur ); // skip 'class' keyword
     if ( !get_next_token( cur ) ) return;
@@ -2156,7 +2152,7 @@ void CJSourceParser::AddClassNode( char*& cur )
 
         if ( *tok != ':' && *cur != ':' )
 
-            pClass->mSuperClassNames.push_back( string( cur, len ) );
+            pClass->m_SuperClassNames.push_back( wxString( cur, len ) );
 
     } while(1);
 
@@ -2165,9 +2161,9 @@ void CJSourceParser::AddClassNode( char*& cur )
         int tmpLn;
         store_line_no( tmpLn );
 
-        while ( pClass->mSuperClassNames.size() )
+        while ( pClass->m_SuperClassNames.size() )
 
-            pClass->mSuperClassNames.erase( &pClass->mSuperClassNames[0] );
+            pClass->m_SuperClassNames.erase( &pClass->m_SuperClassNames[0] );
 
         char* tok = cur;
 
@@ -2193,10 +2189,10 @@ void CJSourceParser::AddClassNode( char*& cur )
     clear_commets_queue();
 }
 
-void CJSourceParser::AddEnumNode( wxChar*& cur )
+void CJSourceParser::AddEnumNode( char*& cur )
 {
     // now the cursor is at "enum" keyword
-    wxChar* start = cur;
+    char* start = cur;
 
     spEnumeration* pEnum = new spEnumeration();
     mpCurCtx->AddMember( pEnum );
@@ -2230,13 +2226,13 @@ void CJSourceParser::AddEnumNode( wxChar*& cur )
     clear_commets_queue();
 }
 
-void CJSourceParser::AddTypeDefNode( wxChar*& cur )
+void CJSourceParser::AddTypeDefNode( char*& cur )
 {
     // now the cursor at the token next to "typedef" keyword
 
     if ( !get_next_token(cur) ) return;
 
-    wxChar* start = cur;
+    char* start = cur;
 
     spTypeDef* pTDef = new spTypeDef();
     mpCurCtx->AddMember( pTDef );
@@ -2250,18 +2246,18 @@ void CJSourceParser::AddTypeDefNode( wxChar*& cur )
     int tmpLnNo;
     store_line_no( tmpLnNo );
 
-    wxChar* tok = cur-1;
+    char* tok = cur-1;
     skip_next_token_back( tok );
 
-    wxChar* nameEnd = tok;
+    char* nameEnd = tok;
 
     skip_token_back( tok );
 
-    wxChar* nameStart = tok;
+    char* nameStart = tok;
 
     skip_next_token_back( tok );
 
-    wxChar* typeEnd = tok;
+    char* typeEnd = tok;
 
     // check if it's function prototype
     if ( *nameStart == ')' )