]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/HelpGen/src/cjparser.cpp
fix another minor bug in DLGC_WANTMESSAGE handling in MSWProcessMessage()
[wxWidgets.git] / utils / HelpGen / src / cjparser.cpp
index 62fbccad231b1024a26bc68746e260230f7819e9..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"
 
@@ -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
@@ -898,8 +894,8 @@ static inline void skip_scope_block( char*& cur )
 // moves tokens like '*' '**', '***', '&' from the name
 // to the type
 
-static void arrange_indirection_tokens_between( string& type,
-                                                string& identifier )
+static void arrange_indirection_tokens_between( wxString& type,
+                                                wxString& identifier )
 {
     // TBD:: FIXME:: return value of operators !
 
@@ -936,7 +932,7 @@ static bool is_keyword( char* cur )
 }
 
 static inline void get_string_between( char* start, char* end,
-                                       string* pStr )
+                                       wxString* pStr )
 {
     char saved = *end;
 
@@ -945,7 +941,7 @@ static inline void get_string_between( char* start, char* end,
     *end  = saved;
 }
 
-static char* set_comment_text( string& text, char* start )
+static char* set_comment_text( wxString& text, char* start )
 {
     char* end = start;
 
@@ -992,7 +988,7 @@ spFile* CJSourceParser::Parse( char* start, char* end )
     mIsTemplate   = 0;
     mNestingLevel = 0;
 
-    cur = start;
+    m_cur = start;
 
     mpStart = start;
     mpEnd   = end;
@@ -1008,11 +1004,11 @@ spFile* CJSourceParser::Parse( char* start, char* end )
 
     do
     {
-        if ( !get_next_token( cur ) )
+        if ( !get_next_token( m_cur ) )
             // end of source reached
             return pTopCtx;
 
-        if ( memcmp( cur, "ScriptSection( const string&",
+        if ( memcmp( m_cur, "ScriptSection( const string&",
                      strlen( "ScriptSection( const string&" )
                    ) == 0
             )
@@ -1021,35 +1017,35 @@ spFile* CJSourceParser::Parse( char* start, char* end )
             // ++o;
         }
 
-        switch (*cur)
+        switch (*m_cur)
         {
             case '#' :
                 {
-                    AddMacroNode( cur );
+                    AddMacroNode( m_cur );
                     continue;
                 }
 
             case ':' :
                 {
-                    skip_token( cur );
+                    skip_token( m_cur );
                     continue;
                 }
 
             case ';' :
                 {
-                    skip_token( cur );
+                    skip_token( m_cur );
                     continue;
                 }
 
             case ')' :
                 {
-                    skip_token( cur );
+                    skip_token( m_cur );
                     continue;
                 }
 
             case '=' :
                 {
-                    skip_token( cur );
+                    skip_token( m_cur );
                     continue;
                 }
 
@@ -1057,24 +1053,24 @@ spFile* CJSourceParser::Parse( char* start, char* end )
         }
 
         // 'const' is a part of the return type, not a keyword here
-        if ( strncmp(cur, "const", 5) != 0 && is_keyword( cur ) )
+        if ( strncmp(m_cur, "const", 5) != 0 && is_keyword( m_cur ) )
         {
             // parses, token, if token identifies
             // the container context (e.g. class/namespace)
             // the corresponding context object is created
             // and set as current context
 
-            ParseKeyword( cur );
+            ParseKeyword( m_cur );
             continue;
         }
 
-        if ( *cur >= '0' && *cur <= '9' )
+        if ( *m_cur >= '0' && *m_cur <= '9' )
         {
-            skip_token( cur );
+            skip_token( m_cur );
             continue;
         }
 
-        if ( *cur == '}' )
+        if ( *m_cur == '}' )
         {
             if ( mCurCtxType != SP_CTX_CLASS )
             {
@@ -1083,13 +1079,13 @@ spFile* CJSourceParser::Parse( char* start, char* end )
                 // DBG:: unexpected closing-bracket found
                 //ASSERT(0);
 
-                skip_token( cur ); // just skip it
+                skip_token( m_cur ); // just skip it
                 continue;
             }
 
             if ( mpCurCtx->GetType() == SP_CTX_CLASS )
             {
-                int curOfs = ( (cur+1) - _gSrcStart );
+                int curOfs = ( (m_cur+1) - _gSrcStart );
 
                 mpCurCtx->mContextLength = ( curOfs - mpCurCtx->mSrcOffset );
             }
@@ -1113,21 +1109,21 @@ spFile* CJSourceParser::Parse( char* start, char* end )
                 mIsTemplate = 0;
             }
 
-            skip_token( cur );
+            skip_token( m_cur );
             continue;
         }
 
         bool isAMacro = false;
 
-        if ( is_function( cur, isAMacro ) )
+        if ( is_function( m_cur, isAMacro ) )
         {
             if ( isAMacro )
             {
-                skip_token( cur );
+                skip_token( m_cur );
                 continue;
             }
 
-            char* savedPos = cur;
+            char* savedPos = m_cur;
 
             int tmpLnNo;
             store_line_no( tmpLnNo );
@@ -1135,17 +1131,17 @@ spFile* CJSourceParser::Parse( char* start, char* end )
 
             isAMacro = false;
 
-            if ( !ParseNameAndRetVal( cur, isAMacro ) )
+            if ( !ParseNameAndRetVal( m_cur, isAMacro ) )
             {
                 if ( !isAMacro )
                 {
-                    cur = savedPos;
-                    SkipFunction( cur );
+                    m_cur = savedPos;
+                    SkipFunction( m_cur );
                 }
                 continue;
             }
 
-            if ( !ParseArguments( cur ) )
+            if ( !ParseArguments( m_cur ) )
             {
                 // failure while parsing arguments,
                 // remove enclosing operation context
@@ -1154,8 +1150,8 @@ spFile* CJSourceParser::Parse( char* start, char* end )
                 mpCurCtx = mpCurCtx->GetOutterContext();
                 mpCurCtx->RemoveChild( pFailed );
 
-                skip_to_eol( cur );
-                //cur = savedPos;
+                skip_to_eol( m_cur );
+                //m_cur = savedPos;
             }
             else
             {
@@ -1163,7 +1159,7 @@ spFile* CJSourceParser::Parse( char* start, char* end )
 
                 clear_commets_queue();
 
-                SkipFunctionBody( cur );
+                SkipFunctionBody( m_cur );
 
                 mpCurCtx = mpCurCtx->GetOutterContext();
 
@@ -1180,11 +1176,11 @@ spFile* CJSourceParser::Parse( char* start, char* end )
             {
                 // non-class members are ignored
 
-                skip_token( cur ); // skip the end of statement
+                skip_token( m_cur ); // skip the end of statement
                 continue;
             }
 
-            ParseMemberVar( cur );
+            ParseMemberVar( m_cur );
         }
 
     } while( 1 );
@@ -1218,32 +1214,30 @@ void CJSourceParser::AttachComments( spContext& ctx, char* cur )
         // of the new paragraph in the comment text
 
         if ( i == 0 )
-
+        {
             pComment->mStartsPar = true;
-        else
-        if ( pComment->mIsMultiline )
-
+        }
+        else if ( pComment->mIsMultiline )
+        {
             pComment->mStartsPar = true;
+        }
         else
         {
             // find out wheather there is a new-line
             // between to adjecent comments
 
-
             char* prevLine = start;
             skip_to_prev_line(prevLine);
 
             if ( prevLine >= prevComEnd )
-
                 pComment->mStartsPar = true;
             else
                 pComment->mStartsPar = false;
         }
 
-        prevComEnd = set_comment_text( pComment->mText, start );
+        prevComEnd = set_comment_text( pComment->m_Text, start );
     }
 
-
     // attach comments which are at the end of the line
     // of the given context (if any)
 
@@ -1252,7 +1246,7 @@ void CJSourceParser::AttachComments( spContext& ctx, char* cur )
         spComment* pComment = new spComment();
         lst.push_back( pComment );
 
-        set_comment_text( pComment->mText, cur );
+        set_comment_text( pComment->m_Text, cur );
 
         pComment->mStartsPar = 1;
         pComment->mIsMultiline = ( *(cur+1) == '*' );
@@ -1285,7 +1279,7 @@ void CJSourceParser::AddMacroNode( char*& cur )
 
     AttachComments( *pPL, cur );
 
-    get_string_between( start, cur, &pPL->mLine );
+    get_string_between( start, cur, &pPL->m_Line );
 
     ++start; // skip '#'
     get_next_token( start );
@@ -1329,7 +1323,7 @@ void CJSourceParser::AddMacroNode( char*& cur )
             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 == "0" ) {
@@ -1597,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;
@@ -1610,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;
     }
@@ -1620,16 +1614,16 @@ 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->mRetType = rettype;
+        pOp->m_RetType = rettype;
     }
 
-    arrange_indirection_tokens_between( pOp->mRetType, pOp->m_Name );
+    arrange_indirection_tokens_between( pOp->m_RetType, pOp->m_Name );
 
     cur = savedPos;
     restore_line_no( tmpLnNo );
@@ -1736,7 +1730,7 @@ bool CJSourceParser::ParseArguments( char*& cur )
                 continue;
             }
 
-            pPar->mInitVal = string( blocks[nameBlock], blockSizes[nameBlock] );
+            pPar->m_InitVal = wxString( blocks[nameBlock], blockSizes[nameBlock] );
 
             nameBlock = nameBlock - 2; // skip '=' token and default value block
             typeBlock = nameBlock - 1;
@@ -1746,16 +1740,16 @@ 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->mType = string( blocks[0], len );
+        pPar->m_Type = wxString( blocks[0], len );
 
-        arrange_indirection_tokens_between( pPar->mType, pPar->m_Name );
+        arrange_indirection_tokens_between( pPar->m_Type, pPar->m_Name );
 
         if ( *cur == ')' )
         {
@@ -1836,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
@@ -1877,7 +1871,7 @@ void CJSourceParser::ParseMemberVar( char*& cur )
         skip_next_token_back( cur );
         skip_token_back( cur );
 
-        pAttr->mType = get_token_str( cur );
+        pAttr->m_Type = get_token_str( cur );
 
         // if comma, than variable list continues
         // otherwise the variable type reached - stop
@@ -1886,8 +1880,7 @@ void CJSourceParser::ParseMemberVar( char*& cur )
         {
             // yes, we've mistaken, it was not a identifier,
             // but it's default value
-            pAttr->mInitVal =
-                pAttr->m_Name;
+            pAttr->m_InitVal = pAttr->m_Name;
 
             // skip default value and '=' symbol
             skip_next_token_back( cur );
@@ -1916,12 +1909,12 @@ void CJSourceParser::ParseMemberVar( char*& cur )
         if ( !pAttr )
             continue;
 
-        if ( pAttr->mType.empty() )
-            pAttr->mType = type;
+        if ( pAttr->m_Type.empty() )
+            pAttr->m_Type = type;
         pAttr->mVisibility = mCurVis;
 
         if ( !pAttr->m_Name.empty() )
-            arrange_indirection_tokens_between( pAttr->mType, pAttr->m_Name );
+            arrange_indirection_tokens_between( pAttr->m_Type, pAttr->m_Name );
     }
 
     cur = savedPos;
@@ -1988,9 +1981,9 @@ void CJSourceParser::SkipFunctionBody( char*& cur )
         {
             if ( op.m_Name[i] == ':' && op.m_Name[i+1] == ':' )
             {
-                string unscoped( op.m_Name, i+2, op.m_Name.length() - ( i + 2 ) );
+                wxString unscoped( op.m_Name, i+2, op.m_Name.length() - ( i + 2 ) );
 
-                op.mScope = string( op.m_Name, 0, i );
+                op.mScope = wxString( op.m_Name, 0, i );
 
                 op.m_Name = unscoped;
 
@@ -2029,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;
@@ -2159,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);
 
@@ -2168,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;
 
@@ -2220,7 +2213,7 @@ void CJSourceParser::AddEnumNode( char*& cur )
 
     if ( !skip_imp_block( cur ) ) return;
 
-    get_string_between( start, cur, &pEnum->mEnumContent );
+    get_string_between( start, cur, &pEnum->m_EnumContent );
 
     if ( get_next_token(cur) )
     {
@@ -2286,7 +2279,7 @@ void CJSourceParser::AddTypeDefNode( char*& cur )
         if ( *nameStart == '*' ) ++nameStart;
     }
 
-    get_string_between( start, typeEnd, &pTDef->mOriginalType );
+    get_string_between( start, typeEnd, &pTDef->m_OriginalType );
 
     get_string_between( nameStart, nameEnd, &pTDef->m_Name );