Changeset 4215 in vbox for trunk/src/VBox/Debugger
- Timestamp:
- Aug 18, 2007 7:00:34 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Debugger/DBGConsole.cpp
r4214 r4215 876 876 }; 877 877 878 /** Bitmap where set bits indicates the characters the may start an operator name. */ 879 static uint32_t g_bmOperatorChars[256 / (4*8)]; 880 878 881 /** Register symbol uUser value. 879 882 * @{ … … 3057 3060 if (pDbgc->cbDumpElement == 1) 3058 3061 { 3059 while (i < sizeof(achBuffer))3062 while (i++ < sizeof(achBuffer)) 3060 3063 pCmdHlp->pfnPrintf(pCmdHlp, NULL, " "); 3061 3064 pCmdHlp->pfnPrintf(pCmdHlp, NULL, " "); … … 5436 5439 */ 5437 5440 case DBGCVAR_TYPE_NUMBER: 5441 *pResult = *pArg1; 5438 5442 switch (pArg2->enmType) 5439 5443 { 5444 case DBGCVAR_TYPE_SYMBOL: 5440 5445 case DBGCVAR_TYPE_STRING: 5441 5446 rc = dbgcSymbolGet(pDbgc, pArg2->u.pszString, DBGCVAR_TYPE_NUMBER, &Var); … … 5692 5697 */ 5693 5698 case DBGCVAR_TYPE_NUMBER: 5699 *pResult = *pArg1; 5694 5700 switch (pArg2->enmType) 5695 5701 { 5702 case DBGCVAR_TYPE_SYMBOL: 5696 5703 case DBGCVAR_TYPE_STRING: 5697 5704 rc = dbgcSymbolGet(pDbgc, pArg2->u.pszString, DBGCVAR_TYPE_NUMBER, &Var); … … 7293 7300 } 7294 7301 7302 7303 /** 7304 * Initalizes g_bmOperatorChars. 7305 */ 7306 static void dbgcInitOpCharBitMap(void) 7307 { 7308 memset(g_bmOperatorChars, 0, sizeof(g_bmOperatorChars)); 7309 for (unsigned iOp = 0; iOp < RT_ELEMENTS(g_aOps); iOp++) 7310 ASMBitSet(&g_bmOperatorChars[0], (uint8_t)g_aOps[iOp].szName[0]); 7311 } 7312 7313 7314 /** 7315 * Checks whether the character may be the start of an operator. 7316 * 7317 * @returns true/false. 7318 * @param ch The character. 7319 */ 7320 DECLINLINE(bool) dbgcIsOpChar(char ch) 7321 { 7322 return ASMBitTest(&g_bmOperatorChars[0], (uint8_t)ch); 7323 } 7295 7324 7296 7325 … … 7933 7962 else if (cPar == 0 && !isblank(ch)) 7934 7963 { 7935 PCDBGCOP pOp = dbgcOperatorLookup(pDbgc, psz, fBinary, chPrev); 7964 PCDBGCOP pOp = dbgcIsOpChar(ch) 7965 ? dbgcOperatorLookup(pDbgc, psz, fBinary, chPrev) 7966 : NULL; 7936 7967 if (pOp) 7937 7968 { … … 8088 8119 char *psz = pszArgs; 8089 8120 char ch; 8121 bool fBinary = false; 8090 8122 for (;;) 8091 8123 { … … 8126 8158 */ 8127 8159 else if (ch == '(') 8160 { 8128 8161 cPar++; 8162 fBinary = false; 8163 } 8129 8164 else if (ch == ')') 8130 8165 { … … 8132 8167 return VERR_PARSE_UNBALANCED_PARENTHESIS; 8133 8168 cPar--; 8169 fBinary = true; 8134 8170 } 8135 /* 8136 * Encountering blanks may mean the end of it all. But of course not 8137 * while inside a quotation or paranthesis. A binary operator will 8138 * also force continued parsing. 8139 */ 8140 else if (isblank(ch) && !cPar && !chQuote) 8171 else if (!chQuote && !cPar) 8141 8172 { 8142 pszEnd = psz++; /* just in case. */ 8143 while (isblank(*psz)) 8144 psz++; 8145 PCDBGCOP pOp = dbgcOperatorLookup(pDbgc, psz, true, ' '); 8146 if (!pOp || !pOp->fBinary) 8147 break; /* the end. */ 8148 if (pOp) 8173 /* 8174 * Encountering blanks may mean the end of it all. A binary operator 8175 * will force continued parsing. 8176 */ 8177 if (isblank(*psz)) 8178 { 8179 pszEnd = psz++; /* just in case. */ 8180 while (isblank(*psz)) 8181 psz++; 8182 PCDBGCOP pOp = dbgcOperatorLookup(pDbgc, psz, fBinary, ' '); 8183 if (!pOp || pOp->fBinary != fBinary) 8184 break; /* the end. */ 8149 8185 psz += pOp->cchName; 8150 8151 while (isblank(*psz)) /* skip blanks so we don't get here again */ 8152 psz++; 8153 continue; 8186 while (isblank(*psz)) /* skip blanks so we don't get here again */ 8187 psz++; 8188 fBinary = false; 8189 continue; 8190 } 8191 8192 /* 8193 * Look for operators without a space up front. 8194 */ 8195 if (dbgcIsOpChar(*psz)) 8196 { 8197 PCDBGCOP pOp = dbgcOperatorLookup(pDbgc, psz, fBinary, ' '); 8198 if (pOp) 8199 { 8200 if (pOp->fBinary != fBinary) 8201 break; /* the end. */ 8202 psz += pOp->cchName; 8203 while (isblank(*psz)) /* skip blanks so we don't get here again */ 8204 psz++; 8205 fBinary = false; 8206 continue; 8207 } 8208 fBinary = true; 8209 } 8154 8210 } 8155 8211 … … 8698 8754 pDbgc->cInputLines = 0; 8699 8755 8756 dbgcInitOpCharBitMap(); 8757 8700 8758 /* 8701 8759 * Print welcome message.
Note:
See TracChangeset
for help on using the changeset viewer.