| | @@ -112,19 +112,19 @@ |
| 112 | 112 | ** |
| 113 | 113 | ** struct Xyzzy; |
| 114 | 114 | ** |
| 115 | 115 | ** Not every object has a forward declaration. If it does, thought, the |
| 116 | 116 | ** forward declaration will be contained in the zFwd field for C and |
| 117 | | -** the zFwdCpp for C++. The zDecl field contains the complete |
| 118 | | -** declaration text. |
| 117 | +** the zFwdCpp for C++. The zDecl field contains the complete |
| 118 | +** declaration text. |
| 119 | 119 | */ |
| 120 | 120 | typedef struct Decl Decl; |
| 121 | 121 | struct Decl { |
| 122 | 122 | char *zName; /* Name of the object being declared. The appearance |
| 123 | 123 | ** of this name is a source file triggers the declaration |
| 124 | 124 | ** to be added to the header for that file. */ |
| 125 | | - char *zFile; /* File from which extracted. */ |
| 125 | + const char *zFile; /* File from which extracted. */ |
| 126 | 126 | char *zIf; /* Surround the declaration with this #if */ |
| 127 | 127 | char *zFwd; /* A forward declaration. NULL if there is none. */ |
| 128 | 128 | char *zFwdCpp; /* Use this forward declaration for C++. */ |
| 129 | 129 | char *zDecl; /* A full declaration of this object */ |
| 130 | 130 | char *zExtra; /* Extra declaration text inserted into class objects */ |
| | @@ -163,11 +163,11 @@ |
| 163 | 163 | ** in the output when using the -H option.) |
| 164 | 164 | ** |
| 165 | 165 | ** EXPORT scope The object is visible and usable everywhere. |
| 166 | 166 | ** |
| 167 | 167 | ** The DP_Flag is a temporary use flag that is used during processing to |
| 168 | | -** prevent an infinite loop. It's use is localized. |
| 168 | +** prevent an infinite loop. It's use is localized. |
| 169 | 169 | ** |
| 170 | 170 | ** The DP_Cplusplus, DP_ExternCReqd and DP_ExternReqd flags are permanent |
| 171 | 171 | ** and are used to specify what type of declaration the object requires. |
| 172 | 172 | */ |
| 173 | 173 | #define DP_Forward 0x001 /* Has a forward declaration in this file */ |
| | @@ -201,11 +201,11 @@ |
| 201 | 201 | ** Be careful not to confuse PS_Export with DP_Export or |
| 202 | 202 | ** PS_Local with DP_Local. Their names are similar, but the meanings |
| 203 | 203 | ** of these flags are very different. |
| 204 | 204 | */ |
| 205 | 205 | #define PS_Extern 0x000800 /* "extern" has been seen */ |
| 206 | | -#define PS_Export 0x001000 /* If between "#if EXPORT_INTERFACE" |
| 206 | +#define PS_Export 0x001000 /* If between "#if EXPORT_INTERFACE" |
| 207 | 207 | ** and "#endif" */ |
| 208 | 208 | #define PS_Export2 0x002000 /* If "EXPORT" seen */ |
| 209 | 209 | #define PS_Typedef 0x004000 /* If "typedef" has been seen */ |
| 210 | 210 | #define PS_Static 0x008000 /* If "static" has been seen */ |
| 211 | 211 | #define PS_Interface 0x010000 /* If within #if INTERFACE..#endif */ |
| | @@ -231,11 +231,11 @@ |
| 231 | 231 | #define TY_Union 0x04000000 |
| 232 | 232 | #define TY_Enumeration 0x08000000 |
| 233 | 233 | #define TY_Defunct 0x10000000 /* Used to erase a declaration */ |
| 234 | 234 | |
| 235 | 235 | /* |
| 236 | | -** Each nested #if (or #ifdef or #ifndef) is stored in a stack of |
| 236 | +** Each nested #if (or #ifdef or #ifndef) is stored in a stack of |
| 237 | 237 | ** instances of the following structure. |
| 238 | 238 | */ |
| 239 | 239 | typedef struct Ifmacro Ifmacro; |
| 240 | 240 | struct Ifmacro { |
| 241 | 241 | int nLine; /* Line number where this macro occurs */ |
| | @@ -293,11 +293,11 @@ |
| 293 | 293 | int flags; /* One or more DP_, PS_ and/or TY_ flags */ |
| 294 | 294 | InFile *pNext; /* Next input file in the list of them all */ |
| 295 | 295 | IdentTable idTable; /* All identifiers in this input file */ |
| 296 | 296 | }; |
| 297 | 297 | |
| 298 | | -/* |
| 298 | +/* |
| 299 | 299 | ** An unbounded string is able to grow without limit. We use these |
| 300 | 300 | ** to construct large in-memory strings from lots of smaller components. |
| 301 | 301 | */ |
| 302 | 302 | typedef struct String String; |
| 303 | 303 | struct String { |
| | @@ -332,19 +332,19 @@ |
| 332 | 332 | ** never to read a file that it generated itself. |
| 333 | 333 | ** |
| 334 | 334 | ** The "#undef INTERFACE" part is a hack to work around a name collision |
| 335 | 335 | ** in MSVC 2008. |
| 336 | 336 | */ |
| 337 | | -const char zTopLine[] = |
| 337 | +const char zTopLine[] = |
| 338 | 338 | "/* \aThis file was automatically generated. Do not edit! */\n" |
| 339 | 339 | "#undef INTERFACE\n"; |
| 340 | 340 | #define nTopLine (sizeof(zTopLine)-1) |
| 341 | 341 | |
| 342 | 342 | /* |
| 343 | 343 | ** The name of the file currently being parsed. |
| 344 | 344 | */ |
| 345 | | -static char *zFilename; |
| 345 | +static const char *zFilename; |
| 346 | 346 | |
| 347 | 347 | /* |
| 348 | 348 | ** The stack of #if macros for the file currently being parsed. |
| 349 | 349 | */ |
| 350 | 350 | static Ifmacro *ifStack = 0; |
| | @@ -702,11 +702,11 @@ |
| 702 | 702 | struct stat sStat; |
| 703 | 703 | FILE *pIn; |
| 704 | 704 | char *zBuf; |
| 705 | 705 | int n; |
| 706 | 706 | |
| 707 | | - if( stat(zFilename,&sStat)!=0 |
| 707 | + if( stat(zFilename,&sStat)!=0 |
| 708 | 708 | #ifndef WIN32 |
| 709 | 709 | || !S_ISREG(sStat.st_mode) |
| 710 | 710 | #endif |
| 711 | 711 | ){ |
| 712 | 712 | return 0; |
| | @@ -889,12 +889,12 @@ |
| 889 | 889 | } |
| 890 | 890 | } |
| 891 | 891 | } |
| 892 | 892 | i++; |
| 893 | 893 | } |
| 894 | | - if( z[i] ){ |
| 895 | | - i += 2; |
| 894 | + if( z[i] ){ |
| 895 | + i += 2; |
| 896 | 896 | }else{ |
| 897 | 897 | isBlockComment = 0; |
| 898 | 898 | fprintf(stderr,"%s:%d: Unterminated comment\n", |
| 899 | 899 | zFilename, startLine); |
| 900 | 900 | nErr++; |
| | @@ -906,11 +906,11 @@ |
| 906 | 906 | pToken->eType = TT_Other; |
| 907 | 907 | pToken->nText = 1 + (z[i+1]=='+'); |
| 908 | 908 | } |
| 909 | 909 | break; |
| 910 | 910 | |
| 911 | | - case '0': |
| 911 | + case '0': |
| 912 | 912 | if( z[i+1]=='x' || z[i+1]=='X' ){ |
| 913 | 913 | /* A hex constant */ |
| 914 | 914 | i += 2; |
| 915 | 915 | while( isxdigit(z[i]) ){ i++; } |
| 916 | 916 | }else{ |
| | @@ -963,11 +963,11 @@ |
| 963 | 963 | while( isalnum(z[i]) || z[i]=='_' ){ i++; }; |
| 964 | 964 | pToken->eType = TT_Id; |
| 965 | 965 | pToken->nText = i - pIn->i; |
| 966 | 966 | break; |
| 967 | 967 | |
| 968 | | - case ':': |
| 968 | + case ':': |
| 969 | 969 | pToken->eType = TT_Other; |
| 970 | 970 | pToken->nText = 1 + (z[i+1]==':'); |
| 971 | 971 | break; |
| 972 | 972 | |
| 973 | 973 | case '=': |
| | @@ -977,11 +977,11 @@ |
| 977 | 977 | case '-': |
| 978 | 978 | case '*': |
| 979 | 979 | case '%': |
| 980 | 980 | case '^': |
| 981 | 981 | case '&': |
| 982 | | - case '|': |
| 982 | + case '|': |
| 983 | 983 | pToken->eType = TT_Other; |
| 984 | 984 | pToken->nText = 1 + (z[i+1]=='='); |
| 985 | 985 | break; |
| 986 | 986 | |
| 987 | 987 | default: |
| | @@ -1064,11 +1064,11 @@ |
| 1064 | 1064 | } |
| 1065 | 1065 | } |
| 1066 | 1066 | /* NOT REACHED */ |
| 1067 | 1067 | } |
| 1068 | 1068 | |
| 1069 | | -/* |
| 1069 | +/* |
| 1070 | 1070 | ** This routine looks for identifiers (strings of contiguous alphanumeric |
| 1071 | 1071 | ** characters) within a preprocessor directive and adds every such string |
| 1072 | 1072 | ** found to the given identifier table |
| 1073 | 1073 | */ |
| 1074 | 1074 | static void FindIdentifiersInMacro(Token *pToken, IdentTable *pTable){ |
| | @@ -1157,11 +1157,11 @@ |
| 1157 | 1157 | case TT_Id: |
| 1158 | 1158 | if( pTable ){ |
| 1159 | 1159 | IdentTableInsert(pTable,pToken->zText,pToken->nText); |
| 1160 | 1160 | } |
| 1161 | 1161 | break; |
| 1162 | | - |
| 1162 | + |
| 1163 | 1163 | case TT_Preprocessor: |
| 1164 | 1164 | if( pTable!=0 ){ |
| 1165 | 1165 | FindIdentifiersInMacro(pToken,pTable); |
| 1166 | 1166 | } |
| 1167 | 1167 | break; |
| | @@ -1263,11 +1263,11 @@ |
| 1263 | 1263 | exit(1); |
| 1264 | 1264 | } |
| 1265 | 1265 | pList = TokenizeFile(zFile,&sTable); |
| 1266 | 1266 | for(p=pList; p; p=p->pNext){ |
| 1267 | 1267 | int j; |
| 1268 | | - switch( p->eType ){ |
| 1268 | + switch( p->eType ){ |
| 1269 | 1269 | case TT_Space: |
| 1270 | 1270 | printf("%4d: Space\n",p->nLine); |
| 1271 | 1271 | break; |
| 1272 | 1272 | case TT_Id: |
| 1273 | 1273 | printf("%4d: Id %.*s\n",p->nLine,p->nText,p->zText); |
| | @@ -1330,11 +1330,11 @@ |
| 1330 | 1330 | needSpace = 1; |
| 1331 | 1331 | break; |
| 1332 | 1332 | |
| 1333 | 1333 | default: |
| 1334 | 1334 | c = pFirst->zText[0]; |
| 1335 | | - printf("%s%.*s", |
| 1335 | + printf("%s%.*s", |
| 1336 | 1336 | (needSpace && (c=='*' || c=='{')) ? " " : "", |
| 1337 | 1337 | pFirst->nText, pFirst->zText); |
| 1338 | 1338 | needSpace = pFirst->zText[0]==','; |
| 1339 | 1339 | break; |
| 1340 | 1340 | } |
| | @@ -1371,13 +1371,13 @@ |
| 1371 | 1371 | |
| 1372 | 1372 | StringInit(&str); |
| 1373 | 1373 | pLast = pLast->pNext; |
| 1374 | 1374 | while( pFirst!=pLast ){ |
| 1375 | 1375 | if( pFirst==pSkip ){ iSkip = nSkip; } |
| 1376 | | - if( iSkip>0 ){ |
| 1376 | + if( iSkip>0 ){ |
| 1377 | 1377 | iSkip--; |
| 1378 | | - pFirst=pFirst->pNext; |
| 1378 | + pFirst=pFirst->pNext; |
| 1379 | 1379 | continue; |
| 1380 | 1380 | } |
| 1381 | 1381 | switch( pFirst->eType ){ |
| 1382 | 1382 | case TT_Preprocessor: |
| 1383 | 1383 | StringAppend(&str,"\n",1); |
| | @@ -1384,13 +1384,13 @@ |
| 1384 | 1384 | StringAppend(&str,pFirst->zText,pFirst->nText); |
| 1385 | 1385 | StringAppend(&str,"\n",1); |
| 1386 | 1386 | needSpace = 0; |
| 1387 | 1387 | break; |
| 1388 | 1388 | |
| 1389 | | - case TT_Id: |
| 1389 | + case TT_Id: |
| 1390 | 1390 | switch( pFirst->zText[0] ){ |
| 1391 | | - case 'E': |
| 1391 | + case 'E': |
| 1392 | 1392 | if( pFirst->nText==6 && strncmp(pFirst->zText,"EXPORT",6)==0 ){ |
| 1393 | 1393 | skipOne = 1; |
| 1394 | 1394 | } |
| 1395 | 1395 | break; |
| 1396 | 1396 | case 'P': |
| | @@ -1645,17 +1645,17 @@ |
| 1645 | 1645 | pLast = pLast->pNext; |
| 1646 | 1646 | for(p=pFirst; p && p!=pLast; p=p->pNext){ |
| 1647 | 1647 | if( p->eType==TT_Id ){ |
| 1648 | 1648 | static IdentTable sReserved; |
| 1649 | 1649 | static int isInit = 0; |
| 1650 | | - static char *aWords[] = { "char", "class", |
| 1651 | | - "const", "double", "enum", "extern", "EXPORT", "ET_PROC", |
| 1650 | + static const char *aWords[] = { "char", "class", |
| 1651 | + "const", "double", "enum", "extern", "EXPORT", "ET_PROC", |
| 1652 | 1652 | "float", "int", "long", |
| 1653 | 1653 | "PRIVATE", "PROTECTED", "PUBLIC", |
| 1654 | | - "register", "static", "struct", "sizeof", "signed", "typedef", |
| 1654 | + "register", "static", "struct", "sizeof", "signed", "typedef", |
| 1655 | 1655 | "union", "volatile", "virtual", "void", }; |
| 1656 | | - |
| 1656 | + |
| 1657 | 1657 | if( !isInit ){ |
| 1658 | 1658 | int i; |
| 1659 | 1659 | for(i=0; i<sizeof(aWords)/sizeof(aWords[0]); i++){ |
| 1660 | 1660 | IdentTableInsert(&sReserved,aWords[i],0); |
| 1661 | 1661 | } |
| | @@ -1768,11 +1768,11 @@ |
| 1768 | 1768 | pCode = pLast; |
| 1769 | 1769 | while( pLast && pLast!=pFirst && pLast->zText[0]!=')' ){ |
| 1770 | 1770 | pLast = pLast->pPrev; |
| 1771 | 1771 | } |
| 1772 | 1772 | if( pLast==0 || pLast==pFirst || pFirst->pNext==pLast ){ |
| 1773 | | - fprintf(stderr,"%s:%d: Unrecognized syntax.\n", |
| 1773 | + fprintf(stderr,"%s:%d: Unrecognized syntax.\n", |
| 1774 | 1774 | zFilename, pFirst->nLine); |
| 1775 | 1775 | return 1; |
| 1776 | 1776 | } |
| 1777 | 1777 | if( flags & (PS_Interface|PS_Export|PS_Local) ){ |
| 1778 | 1778 | fprintf(stderr,"%s:%d: Missing \"inline\" on function or procedure.\n", |
| | @@ -1849,11 +1849,11 @@ |
| 1849 | 1849 | return 1; |
| 1850 | 1850 | } |
| 1851 | 1851 | |
| 1852 | 1852 | #ifdef DEBUG |
| 1853 | 1853 | if( debugMask & PARSER ){ |
| 1854 | | - printf("**** Found inline routine: %.*s on line %d...\n", |
| 1854 | + printf("**** Found inline routine: %.*s on line %d...\n", |
| 1855 | 1855 | pName->nText, pName->zText, pFirst->nLine); |
| 1856 | 1856 | PrintTokens(pFirst,pEnd); |
| 1857 | 1857 | printf("\n"); |
| 1858 | 1858 | } |
| 1859 | 1859 | #endif |
| | @@ -1888,11 +1888,11 @@ |
| 1888 | 1888 | ** to search for an occurrence of an ID followed immediately by '('. |
| 1889 | 1889 | ** If found, we have a prototype. Otherwise we are dealing with a |
| 1890 | 1890 | ** variable definition. |
| 1891 | 1891 | */ |
| 1892 | 1892 | static int isVariableDef(Token *pFirst, Token *pEnd){ |
| 1893 | | - if( pEnd && pEnd->zText[0]=='=' && |
| 1893 | + if( pEnd && pEnd->zText[0]=='=' && |
| 1894 | 1894 | (pEnd->pPrev->nText!=8 || strncmp(pEnd->pPrev->zText,"operator",8)!=0) |
| 1895 | 1895 | ){ |
| 1896 | 1896 | return 1; |
| 1897 | 1897 | } |
| 1898 | 1898 | while( pFirst && pFirst!=pEnd && pFirst->pNext && pFirst->pNext!=pEnd ){ |
| | @@ -1949,11 +1949,11 @@ |
| 1949 | 1949 | } |
| 1950 | 1950 | while( pFirst!=0 && pFirst->pNext!=pEnd && |
| 1951 | 1951 | ((pFirst->nText==6 && strncmp(pFirst->zText,"static",6)==0) |
| 1952 | 1952 | || (pFirst->nText==5 && strncmp(pFirst->zText,"LOCAL",6)==0)) |
| 1953 | 1953 | ){ |
| 1954 | | - /* Lose the initial "static" or local from local variables. |
| 1954 | + /* Lose the initial "static" or local from local variables. |
| 1955 | 1955 | ** We'll prepend "extern" later. */ |
| 1956 | 1956 | pFirst = pFirst->pNext; |
| 1957 | 1957 | isLocal = 1; |
| 1958 | 1958 | } |
| 1959 | 1959 | if( pFirst==0 || !isLocal ){ |
| | @@ -1962,11 +1962,11 @@ |
| 1962 | 1962 | }else if( flags & PS_Method ){ |
| 1963 | 1963 | /* Methods are declared by their class. Don't declare separately. */ |
| 1964 | 1964 | return nErr; |
| 1965 | 1965 | } |
| 1966 | 1966 | isVar = (flags & (PS_Typedef|PS_Method))==0 && isVariableDef(pFirst,pEnd); |
| 1967 | | - if( isVar && (flags & (PS_Interface|PS_Export|PS_Local))!=0 |
| 1967 | + if( isVar && (flags & (PS_Interface|PS_Export|PS_Local))!=0 |
| 1968 | 1968 | && (flags & PS_Extern)==0 ){ |
| 1969 | 1969 | fprintf(stderr,"%s:%d: Can't define a variable in this context\n", |
| 1970 | 1970 | zFilename, pFirst->nLine); |
| 1971 | 1971 | nErr++; |
| 1972 | 1972 | } |
| | @@ -2095,11 +2095,11 @@ |
| 2095 | 2095 | nCmd++; |
| 2096 | 2096 | } |
| 2097 | 2097 | |
| 2098 | 2098 | if( nCmd==5 && strncmp(zCmd,"endif",5)==0 ){ |
| 2099 | 2099 | /* |
| 2100 | | - ** Pop the if stack |
| 2100 | + ** Pop the if stack |
| 2101 | 2101 | */ |
| 2102 | 2102 | pIf = ifStack; |
| 2103 | 2103 | if( pIf==0 ){ |
| 2104 | 2104 | fprintf(stderr,"%s:%d: extra '#endif'.\n",zFilename,pToken->nLine); |
| 2105 | 2105 | return 1; |
| | @@ -2106,11 +2106,11 @@ |
| 2106 | 2106 | } |
| 2107 | 2107 | ifStack = pIf->pNext; |
| 2108 | 2108 | SafeFree(pIf); |
| 2109 | 2109 | }else if( nCmd==6 && strncmp(zCmd,"define",6)==0 ){ |
| 2110 | 2110 | /* |
| 2111 | | - ** Record a #define if we are in PS_Interface or PS_Export |
| 2111 | + ** Record a #define if we are in PS_Interface or PS_Export |
| 2112 | 2112 | */ |
| 2113 | 2113 | Decl *pDecl; |
| 2114 | 2114 | if( !(flags & (PS_Local|PS_Interface|PS_Export)) ){ return 0; } |
| 2115 | 2115 | zArg = &zCmd[6]; |
| 2116 | 2116 | while( *zArg && isspace(*zArg) && *zArg!='\n' ){ |
| | @@ -2129,11 +2129,11 @@ |
| 2129 | 2129 | }else if( flags & PS_Local ){ |
| 2130 | 2130 | DeclSetProperty(pDecl,DP_Local); |
| 2131 | 2131 | } |
| 2132 | 2132 | }else if( nCmd==7 && strncmp(zCmd,"include",7)==0 ){ |
| 2133 | 2133 | /* |
| 2134 | | - ** Record an #include if we are in PS_Interface or PS_Export |
| 2134 | + ** Record an #include if we are in PS_Interface or PS_Export |
| 2135 | 2135 | */ |
| 2136 | 2136 | Include *pInclude; |
| 2137 | 2137 | char *zIf; |
| 2138 | 2138 | |
| 2139 | 2139 | if( !(flags & (PS_Interface|PS_Export)) ){ return 0; } |
| | @@ -2184,11 +2184,11 @@ |
| 2184 | 2184 | PushIfMacro(0,0,0,pToken->nLine,PS_Local); |
| 2185 | 2185 | }else{ |
| 2186 | 2186 | PushIfMacro(0,zArg,nArg,pToken->nLine,0); |
| 2187 | 2187 | } |
| 2188 | 2188 | }else if( nCmd==5 && strncmp(zCmd,"ifdef",5)==0 ){ |
| 2189 | | - /* |
| 2189 | + /* |
| 2190 | 2190 | ** Push an #ifdef. |
| 2191 | 2191 | */ |
| 2192 | 2192 | zArg = &zCmd[5]; |
| 2193 | 2193 | while( *zArg && isspace(*zArg) && *zArg!='\n' ){ |
| 2194 | 2194 | zArg++; |
| | @@ -2207,11 +2207,11 @@ |
| 2207 | 2207 | if( *zArg==0 || *zArg=='\n' ){ return 0; } |
| 2208 | 2208 | nArg = pToken->nText + (int)(pToken->zText - zArg); |
| 2209 | 2209 | PushIfMacro("!defined",zArg,nArg,pToken->nLine,0); |
| 2210 | 2210 | }else if( nCmd==4 && strncmp(zCmd,"else",4)==0 ){ |
| 2211 | 2211 | /* |
| 2212 | | - ** Invert the #if on the top of the stack |
| 2212 | + ** Invert the #if on the top of the stack |
| 2213 | 2213 | */ |
| 2214 | 2214 | if( ifStack==0 ){ |
| 2215 | 2215 | fprintf(stderr,"%s:%d: '#else' without an '#if'\n",zFilename, |
| 2216 | 2216 | pToken->nLine); |
| 2217 | 2217 | return 1; |
| | @@ -2224,33 +2224,33 @@ |
| 2224 | 2224 | }else{ |
| 2225 | 2225 | pIf->flags = 0; |
| 2226 | 2226 | } |
| 2227 | 2227 | }else{ |
| 2228 | 2228 | /* |
| 2229 | | - ** This directive can be safely ignored |
| 2229 | + ** This directive can be safely ignored |
| 2230 | 2230 | */ |
| 2231 | 2231 | return 0; |
| 2232 | 2232 | } |
| 2233 | 2233 | |
| 2234 | | - /* |
| 2235 | | - ** Recompute the preset flags |
| 2234 | + /* |
| 2235 | + ** Recompute the preset flags |
| 2236 | 2236 | */ |
| 2237 | 2237 | *pPresetFlags = 0; |
| 2238 | 2238 | for(pIf = ifStack; pIf; pIf=pIf->pNext){ |
| 2239 | 2239 | *pPresetFlags |= pIf->flags; |
| 2240 | 2240 | } |
| 2241 | | - |
| 2241 | + |
| 2242 | 2242 | return nErr; |
| 2243 | 2243 | } |
| 2244 | 2244 | |
| 2245 | 2245 | /* |
| 2246 | 2246 | ** Parse an entire file. Return the number of errors. |
| 2247 | 2247 | ** |
| 2248 | 2248 | ** pList is a list of tokens in the file. Whitespace tokens have been |
| 2249 | 2249 | ** eliminated, and text with {...} has been collapsed into a |
| 2250 | 2250 | ** single TT_Brace token. |
| 2251 | | -** |
| 2251 | +** |
| 2252 | 2252 | ** initFlags are a set of parse flags that should always be set for this |
| 2253 | 2253 | ** file. For .c files this is normally 0. For .h files it is PS_Interface. |
| 2254 | 2254 | */ |
| 2255 | 2255 | static int ParseFile(Token *pList, int initFlags){ |
| 2256 | 2256 | int nErr = 0; |
| | @@ -2279,11 +2279,11 @@ |
| 2279 | 2279 | pStart = 0; |
| 2280 | 2280 | flags = presetFlags; |
| 2281 | 2281 | break; |
| 2282 | 2282 | |
| 2283 | 2283 | case '=': |
| 2284 | | - if( pList->pPrev->nText==8 |
| 2284 | + if( pList->pPrev->nText==8 |
| 2285 | 2285 | && strncmp(pList->pPrev->zText,"operator",8)==0 ){ |
| 2286 | 2286 | break; |
| 2287 | 2287 | } |
| 2288 | 2288 | nErr += ProcessDecl(pStart,pList,flags); |
| 2289 | 2289 | pStart = 0; |
| | @@ -2471,11 +2471,11 @@ |
| 2471 | 2471 | pDecl->zExtra = 0; |
| 2472 | 2472 | } |
| 2473 | 2473 | |
| 2474 | 2474 | /* |
| 2475 | 2475 | ** Reset the DP_Forward and DP_Declared flags on all Decl structures. |
| 2476 | | -** Set both flags for anything that is tagged as local and isn't |
| 2476 | +** Set both flags for anything that is tagged as local and isn't |
| 2477 | 2477 | ** in the file zFilename so that it won't be printing in other files. |
| 2478 | 2478 | */ |
| 2479 | 2479 | static void ResetDeclFlags(char *zFilename){ |
| 2480 | 2480 | Decl *pDecl; |
| 2481 | 2481 | |
| | @@ -2574,11 +2574,11 @@ |
| 2574 | 2574 | int flag; |
| 2575 | 2575 | int isCpp; /* True if generating C++ */ |
| 2576 | 2576 | int doneTypedef = 0; /* True if a typedef has been done for this object */ |
| 2577 | 2577 | |
| 2578 | 2578 | /* printf("BEGIN %s of %s\n",needFullDecl?"FULL":"PROTOTYPE",pDecl->zName);*/ |
| 2579 | | - /* |
| 2579 | + /* |
| 2580 | 2580 | ** For any object that has a forward declaration, go ahead and do the |
| 2581 | 2581 | ** forward declaration first. |
| 2582 | 2582 | */ |
| 2583 | 2583 | isCpp = (pState->flags & DP_Cplusplus) != 0; |
| 2584 | 2584 | for(p=pDecl; p; p=p->pSameName){ |
| | @@ -2626,12 +2626,12 @@ |
| 2626 | 2626 | ** function on a recursive call with the same pDecl. Hence, recursive |
| 2627 | 2627 | ** calls to this function (through ScanText()) can never change the |
| 2628 | 2628 | ** value of DP_Flag out from under us. |
| 2629 | 2629 | */ |
| 2630 | 2630 | for(p=pDecl; p; p=p->pSameName){ |
| 2631 | | - if( !DeclHasProperty(p,DP_Declared) |
| 2632 | | - && (p->zFwd==0 || needFullDecl) |
| 2631 | + if( !DeclHasProperty(p,DP_Declared) |
| 2632 | + && (p->zFwd==0 || needFullDecl) |
| 2633 | 2633 | && p->zDecl!=0 |
| 2634 | 2634 | ){ |
| 2635 | 2635 | DeclSetProperty(p,DP_Forward|DP_Declared|DP_Flag); |
| 2636 | 2636 | }else{ |
| 2637 | 2637 | DeclClearProperty(p,DP_Flag); |
| | @@ -2735,12 +2735,12 @@ |
| 2735 | 2735 | ** by sToken. |
| 2736 | 2736 | */ |
| 2737 | 2737 | pDecl = FindDecl(sToken.zText,sToken.nText); |
| 2738 | 2738 | if( pDecl==0 ) continue; |
| 2739 | 2739 | |
| 2740 | | - /* |
| 2741 | | - ** If we get this far, we've found an identifier that has a |
| 2740 | + /* |
| 2741 | + ** If we get this far, we've found an identifier that has a |
| 2742 | 2742 | ** declaration in the database. Now see if we the full declaration |
| 2743 | 2743 | ** or just a forward declaration. |
| 2744 | 2744 | */ |
| 2745 | 2745 | GetNonspaceToken(&sIn,&sNext); |
| 2746 | 2746 | if( sNext.zText[0]=='*' ){ |
| | @@ -2770,12 +2770,12 @@ |
| 2770 | 2770 | int progress; |
| 2771 | 2771 | |
| 2772 | 2772 | do{ |
| 2773 | 2773 | progress = 0; |
| 2774 | 2774 | for(pDecl=pDeclFirst; pDecl; pDecl=pDecl->pNext){ |
| 2775 | | - if( DeclHasProperty(pDecl,DP_Forward) |
| 2776 | | - && !DeclHasProperty(pDecl,DP_Declared) |
| 2775 | + if( DeclHasProperty(pDecl,DP_Forward) |
| 2776 | + && !DeclHasProperty(pDecl,DP_Declared) |
| 2777 | 2777 | ){ |
| 2778 | 2778 | DeclareObject(pDecl,pState,1); |
| 2779 | 2779 | progress = 1; |
| 2780 | 2780 | assert( DeclHasProperty(pDecl,DP_Declared) ); |
| 2781 | 2781 | } |
| | @@ -2842,11 +2842,11 @@ |
| 2842 | 2842 | nErr++; |
| 2843 | 2843 | } |
| 2844 | 2844 | }else if( report ){ |
| 2845 | 2845 | fprintf(report,"unchanged\n"); |
| 2846 | 2846 | } |
| 2847 | | - SafeFree(zOldVersion); |
| 2847 | + SafeFree(zOldVersion); |
| 2848 | 2848 | IdentTableReset(&includeTable); |
| 2849 | 2849 | StringReset(&outStr); |
| 2850 | 2850 | return nErr; |
| 2851 | 2851 | } |
| 2852 | 2852 | |
| | @@ -2878,11 +2878,11 @@ |
| 2878 | 2878 | } |
| 2879 | 2879 | ChangeIfContext(0,&sState); |
| 2880 | 2880 | printf("%s",StringGet(&outStr)); |
| 2881 | 2881 | IdentTableReset(&includeTable); |
| 2882 | 2882 | StringReset(&outStr); |
| 2883 | | - return 0; |
| 2883 | + return 0; |
| 2884 | 2884 | } |
| 2885 | 2885 | |
| 2886 | 2886 | #ifdef DEBUG |
| 2887 | 2887 | /* |
| 2888 | 2888 | ** Return the number of characters in the given string prior to the |
| | @@ -3040,11 +3040,11 @@ |
| 3040 | 3040 | int nSrc; |
| 3041 | 3041 | char *zSrc; |
| 3042 | 3042 | InFile *pFile; |
| 3043 | 3043 | int i; |
| 3044 | 3044 | |
| 3045 | | - /* |
| 3045 | + /* |
| 3046 | 3046 | ** Get the name of the input file to be scanned. The input file is |
| 3047 | 3047 | ** everything before the first ':' or the whole file if no ':' is seen. |
| 3048 | 3048 | ** |
| 3049 | 3049 | ** Except, on windows, ignore any ':' that occurs as the second character |
| 3050 | 3050 | ** since it might be part of the drive specifier. So really, the ":' has |
| | @@ -3099,11 +3099,11 @@ |
| 3099 | 3099 | } |
| 3100 | 3100 | } |
| 3101 | 3101 | |
| 3102 | 3102 | /* |
| 3103 | 3103 | ** If pFile->zSrc contains no 'c' or 'C' in its extension, it |
| 3104 | | - ** must be a header file. In that case, we need to set the |
| 3104 | + ** must be a header file. In that case, we need to set the |
| 3105 | 3105 | ** PS_Interface flag. |
| 3106 | 3106 | */ |
| 3107 | 3107 | pFile->flags |= PS_Interface; |
| 3108 | 3108 | for(i=nSrc-1; i>0 && zSrc[i]!='.'; i--){ |
| 3109 | 3109 | if( zSrc[i]=='c' || zSrc[i]=='C' ){ |
| | @@ -3110,11 +3110,11 @@ |
| 3110 | 3110 | pFile->flags &= ~PS_Interface; |
| 3111 | 3111 | break; |
| 3112 | 3112 | } |
| 3113 | 3113 | } |
| 3114 | 3114 | |
| 3115 | | - /* Done! |
| 3115 | + /* Done! |
| 3116 | 3116 | */ |
| 3117 | 3117 | return pFile; |
| 3118 | 3118 | } |
| 3119 | 3119 | |
| 3120 | 3120 | /* MS-Windows and MS-DOS both have the following serious OS bug: the |
| | @@ -3162,11 +3162,11 @@ |
| 3162 | 3162 | while( c!=EOF ){ |
| 3163 | 3163 | while( c!=EOF && isspace(c) ){ |
| 3164 | 3164 | if( c=='\n' ){ |
| 3165 | 3165 | startOfLine = 1; |
| 3166 | 3166 | } |
| 3167 | | - c = getc(in); |
| 3167 | + c = getc(in); |
| 3168 | 3168 | if( startOfLine && c=='#' ){ |
| 3169 | 3169 | while( c!=EOF && c!='\n' ){ |
| 3170 | 3170 | c = getc(in); |
| 3171 | 3171 | } |
| 3172 | 3172 | } |
| | @@ -3184,11 +3184,11 @@ |
| 3184 | 3184 | if( nAlloc==0 ){ |
| 3185 | 3185 | nAlloc = 100 + argc; |
| 3186 | 3186 | zNew = malloc( sizeof(char*) * nAlloc ); |
| 3187 | 3187 | }else{ |
| 3188 | 3188 | nAlloc *= 2; |
| 3189 | | - zNew = realloc( zNew, sizeof(char*) * nAlloc ); |
| 3189 | + zNew = realloc( zNew, sizeof(char*) * nAlloc ); |
| 3190 | 3190 | } |
| 3191 | 3191 | } |
| 3192 | 3192 | if( zNew ){ |
| 3193 | 3193 | int j = nNew + index; |
| 3194 | 3194 | zNew[j] = malloc( n + 1 ); |
| | @@ -3254,11 +3254,11 @@ |
| 3254 | 3254 | |
| 3255 | 3255 | /* |
| 3256 | 3256 | ** The following text contains a few simple #defines that we want |
| 3257 | 3257 | ** to be available to every file. |
| 3258 | 3258 | */ |
| 3259 | | -static char zInit[] = |
| 3259 | +static const char zInit[] = |
| 3260 | 3260 | "#define INTERFACE 0\n" |
| 3261 | 3261 | "#define EXPORT_INTERFACE 0\n" |
| 3262 | 3262 | "#define LOCAL_INTERFACE 0\n" |
| 3263 | 3263 | "#define EXPORT\n" |
| 3264 | 3264 | "#define LOCAL static\n" |
| 3265 | 3265 | |