Fossil SCM

Add a few "const" qualifiers in appropriate places, and remove some unnecessary end-of-line spaces. No change in functionality.

jan.nijtmans 2015-01-22 12:37 trunk
Commit f6c285f88c9768d6c895c22b094db7ac0e865585
--- src/codecheck1.c
+++ src/codecheck1.c
@@ -276,11 +276,11 @@
276276
277277
/* Certain functions are guaranteed to return a string that is safe
278278
** for use with %s */
279279
z = next_non_whitespace(z, &len, &eType);
280280
for(i=0; i<sizeof(azSafeFunc)/sizeof(azSafeFunc[0]); i++){
281
- if( eType==TK_ID
281
+ if( eType==TK_ID
282282
&& strncmp(z, azSafeFunc[i], len)==0
283283
&& strlen(azSafeFunc[i])==len
284284
){
285285
return 1;
286286
}
@@ -291,11 +291,11 @@
291291
if( is_string_expr(z) ) return 1;
292292
293293
/* If the "safe-for-%s" comment appears in the argument, then
294294
** let it through */
295295
if( strstr(z, "/*safe-for-%s*/")!=0 ) return 1;
296
-
296
+
297297
return 0;
298298
}
299299
300300
/*
301301
** Processing flags
@@ -460,11 +460,11 @@
460460
for(i=len-1; i>0 && isspace(z[i]); i--){ z[i] = 0; }
461461
z += len + 1;
462462
}
463463
acType = (char*)&azArg[nArg];
464464
if( fmtArg>nArg ){
465
- printf("%s:%d: too few arguments to %.*s()\n",
465
+ printf("%s:%d: too few arguments to %.*s()\n",
466466
zFilename, lnFCall, szFName, zFCall);
467467
nErr++;
468468
}else{
469469
const char *zFmt = azArg[fmtArg-1];
470470
const char *zOverride = strstr(zFmt, "/*works-like:");
@@ -537,11 +537,11 @@
537537
nCurly--;
538538
}else if( nCurly>0 && z[0]=='(' && ePrev==TK_ID
539539
&& (x = isFormatFunc(zPrev,szPrev,&fmtFlags))>0 ){
540540
nErr += checkFormatFunc(zName, zPrev, lnPrev, x, fmtFlags);
541541
}
542
- }
542
+ }
543543
zPrev = z;
544544
ePrev = eToken;
545545
szPrev = szToken;
546546
lnPrev = ln;
547547
}
548548
--- src/codecheck1.c
+++ src/codecheck1.c
@@ -276,11 +276,11 @@
276
277 /* Certain functions are guaranteed to return a string that is safe
278 ** for use with %s */
279 z = next_non_whitespace(z, &len, &eType);
280 for(i=0; i<sizeof(azSafeFunc)/sizeof(azSafeFunc[0]); i++){
281 if( eType==TK_ID
282 && strncmp(z, azSafeFunc[i], len)==0
283 && strlen(azSafeFunc[i])==len
284 ){
285 return 1;
286 }
@@ -291,11 +291,11 @@
291 if( is_string_expr(z) ) return 1;
292
293 /* If the "safe-for-%s" comment appears in the argument, then
294 ** let it through */
295 if( strstr(z, "/*safe-for-%s*/")!=0 ) return 1;
296
297 return 0;
298 }
299
300 /*
301 ** Processing flags
@@ -460,11 +460,11 @@
460 for(i=len-1; i>0 && isspace(z[i]); i--){ z[i] = 0; }
461 z += len + 1;
462 }
463 acType = (char*)&azArg[nArg];
464 if( fmtArg>nArg ){
465 printf("%s:%d: too few arguments to %.*s()\n",
466 zFilename, lnFCall, szFName, zFCall);
467 nErr++;
468 }else{
469 const char *zFmt = azArg[fmtArg-1];
470 const char *zOverride = strstr(zFmt, "/*works-like:");
@@ -537,11 +537,11 @@
537 nCurly--;
538 }else if( nCurly>0 && z[0]=='(' && ePrev==TK_ID
539 && (x = isFormatFunc(zPrev,szPrev,&fmtFlags))>0 ){
540 nErr += checkFormatFunc(zName, zPrev, lnPrev, x, fmtFlags);
541 }
542 }
543 zPrev = z;
544 ePrev = eToken;
545 szPrev = szToken;
546 lnPrev = ln;
547 }
548
--- src/codecheck1.c
+++ src/codecheck1.c
@@ -276,11 +276,11 @@
276
277 /* Certain functions are guaranteed to return a string that is safe
278 ** for use with %s */
279 z = next_non_whitespace(z, &len, &eType);
280 for(i=0; i<sizeof(azSafeFunc)/sizeof(azSafeFunc[0]); i++){
281 if( eType==TK_ID
282 && strncmp(z, azSafeFunc[i], len)==0
283 && strlen(azSafeFunc[i])==len
284 ){
285 return 1;
286 }
@@ -291,11 +291,11 @@
291 if( is_string_expr(z) ) return 1;
292
293 /* If the "safe-for-%s" comment appears in the argument, then
294 ** let it through */
295 if( strstr(z, "/*safe-for-%s*/")!=0 ) return 1;
296
297 return 0;
298 }
299
300 /*
301 ** Processing flags
@@ -460,11 +460,11 @@
460 for(i=len-1; i>0 && isspace(z[i]); i--){ z[i] = 0; }
461 z += len + 1;
462 }
463 acType = (char*)&azArg[nArg];
464 if( fmtArg>nArg ){
465 printf("%s:%d: too few arguments to %.*s()\n",
466 zFilename, lnFCall, szFName, zFCall);
467 nErr++;
468 }else{
469 const char *zFmt = azArg[fmtArg-1];
470 const char *zOverride = strstr(zFmt, "/*works-like:");
@@ -537,11 +537,11 @@
537 nCurly--;
538 }else if( nCurly>0 && z[0]=='(' && ePrev==TK_ID
539 && (x = isFormatFunc(zPrev,szPrev,&fmtFlags))>0 ){
540 nErr += checkFormatFunc(zName, zPrev, lnPrev, x, fmtFlags);
541 }
542 }
543 zPrev = z;
544 ePrev = eToken;
545 szPrev = szToken;
546 lnPrev = ln;
547 }
548
+59 -59
--- src/makeheaders.c
+++ src/makeheaders.c
@@ -112,19 +112,19 @@
112112
**
113113
** struct Xyzzy;
114114
**
115115
** Not every object has a forward declaration. If it does, thought, the
116116
** 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.
119119
*/
120120
typedef struct Decl Decl;
121121
struct Decl {
122122
char *zName; /* Name of the object being declared. The appearance
123123
** of this name is a source file triggers the declaration
124124
** to be added to the header for that file. */
125
- char *zFile; /* File from which extracted. */
125
+ const char *zFile; /* File from which extracted. */
126126
char *zIf; /* Surround the declaration with this #if */
127127
char *zFwd; /* A forward declaration. NULL if there is none. */
128128
char *zFwdCpp; /* Use this forward declaration for C++. */
129129
char *zDecl; /* A full declaration of this object */
130130
char *zExtra; /* Extra declaration text inserted into class objects */
@@ -163,11 +163,11 @@
163163
** in the output when using the -H option.)
164164
**
165165
** EXPORT scope The object is visible and usable everywhere.
166166
**
167167
** 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.
169169
**
170170
** The DP_Cplusplus, DP_ExternCReqd and DP_ExternReqd flags are permanent
171171
** and are used to specify what type of declaration the object requires.
172172
*/
173173
#define DP_Forward 0x001 /* Has a forward declaration in this file */
@@ -201,11 +201,11 @@
201201
** Be careful not to confuse PS_Export with DP_Export or
202202
** PS_Local with DP_Local. Their names are similar, but the meanings
203203
** of these flags are very different.
204204
*/
205205
#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"
207207
** and "#endif" */
208208
#define PS_Export2 0x002000 /* If "EXPORT" seen */
209209
#define PS_Typedef 0x004000 /* If "typedef" has been seen */
210210
#define PS_Static 0x008000 /* If "static" has been seen */
211211
#define PS_Interface 0x010000 /* If within #if INTERFACE..#endif */
@@ -231,11 +231,11 @@
231231
#define TY_Union 0x04000000
232232
#define TY_Enumeration 0x08000000
233233
#define TY_Defunct 0x10000000 /* Used to erase a declaration */
234234
235235
/*
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
237237
** instances of the following structure.
238238
*/
239239
typedef struct Ifmacro Ifmacro;
240240
struct Ifmacro {
241241
int nLine; /* Line number where this macro occurs */
@@ -293,11 +293,11 @@
293293
int flags; /* One or more DP_, PS_ and/or TY_ flags */
294294
InFile *pNext; /* Next input file in the list of them all */
295295
IdentTable idTable; /* All identifiers in this input file */
296296
};
297297
298
-/*
298
+/*
299299
** An unbounded string is able to grow without limit. We use these
300300
** to construct large in-memory strings from lots of smaller components.
301301
*/
302302
typedef struct String String;
303303
struct String {
@@ -332,19 +332,19 @@
332332
** never to read a file that it generated itself.
333333
**
334334
** The "#undef INTERFACE" part is a hack to work around a name collision
335335
** in MSVC 2008.
336336
*/
337
-const char zTopLine[] =
337
+const char zTopLine[] =
338338
"/* \aThis file was automatically generated. Do not edit! */\n"
339339
"#undef INTERFACE\n";
340340
#define nTopLine (sizeof(zTopLine)-1)
341341
342342
/*
343343
** The name of the file currently being parsed.
344344
*/
345
-static char *zFilename;
345
+static const char *zFilename;
346346
347347
/*
348348
** The stack of #if macros for the file currently being parsed.
349349
*/
350350
static Ifmacro *ifStack = 0;
@@ -702,11 +702,11 @@
702702
struct stat sStat;
703703
FILE *pIn;
704704
char *zBuf;
705705
int n;
706706
707
- if( stat(zFilename,&sStat)!=0
707
+ if( stat(zFilename,&sStat)!=0
708708
#ifndef WIN32
709709
|| !S_ISREG(sStat.st_mode)
710710
#endif
711711
){
712712
return 0;
@@ -889,12 +889,12 @@
889889
}
890890
}
891891
}
892892
i++;
893893
}
894
- if( z[i] ){
895
- i += 2;
894
+ if( z[i] ){
895
+ i += 2;
896896
}else{
897897
isBlockComment = 0;
898898
fprintf(stderr,"%s:%d: Unterminated comment\n",
899899
zFilename, startLine);
900900
nErr++;
@@ -906,11 +906,11 @@
906906
pToken->eType = TT_Other;
907907
pToken->nText = 1 + (z[i+1]=='+');
908908
}
909909
break;
910910
911
- case '0':
911
+ case '0':
912912
if( z[i+1]=='x' || z[i+1]=='X' ){
913913
/* A hex constant */
914914
i += 2;
915915
while( isxdigit(z[i]) ){ i++; }
916916
}else{
@@ -963,11 +963,11 @@
963963
while( isalnum(z[i]) || z[i]=='_' ){ i++; };
964964
pToken->eType = TT_Id;
965965
pToken->nText = i - pIn->i;
966966
break;
967967
968
- case ':':
968
+ case ':':
969969
pToken->eType = TT_Other;
970970
pToken->nText = 1 + (z[i+1]==':');
971971
break;
972972
973973
case '=':
@@ -977,11 +977,11 @@
977977
case '-':
978978
case '*':
979979
case '%':
980980
case '^':
981981
case '&':
982
- case '|':
982
+ case '|':
983983
pToken->eType = TT_Other;
984984
pToken->nText = 1 + (z[i+1]=='=');
985985
break;
986986
987987
default:
@@ -1064,11 +1064,11 @@
10641064
}
10651065
}
10661066
/* NOT REACHED */
10671067
}
10681068
1069
-/*
1069
+/*
10701070
** This routine looks for identifiers (strings of contiguous alphanumeric
10711071
** characters) within a preprocessor directive and adds every such string
10721072
** found to the given identifier table
10731073
*/
10741074
static void FindIdentifiersInMacro(Token *pToken, IdentTable *pTable){
@@ -1157,11 +1157,11 @@
11571157
case TT_Id:
11581158
if( pTable ){
11591159
IdentTableInsert(pTable,pToken->zText,pToken->nText);
11601160
}
11611161
break;
1162
-
1162
+
11631163
case TT_Preprocessor:
11641164
if( pTable!=0 ){
11651165
FindIdentifiersInMacro(pToken,pTable);
11661166
}
11671167
break;
@@ -1263,11 +1263,11 @@
12631263
exit(1);
12641264
}
12651265
pList = TokenizeFile(zFile,&sTable);
12661266
for(p=pList; p; p=p->pNext){
12671267
int j;
1268
- switch( p->eType ){
1268
+ switch( p->eType ){
12691269
case TT_Space:
12701270
printf("%4d: Space\n",p->nLine);
12711271
break;
12721272
case TT_Id:
12731273
printf("%4d: Id %.*s\n",p->nLine,p->nText,p->zText);
@@ -1330,11 +1330,11 @@
13301330
needSpace = 1;
13311331
break;
13321332
13331333
default:
13341334
c = pFirst->zText[0];
1335
- printf("%s%.*s",
1335
+ printf("%s%.*s",
13361336
(needSpace && (c=='*' || c=='{')) ? " " : "",
13371337
pFirst->nText, pFirst->zText);
13381338
needSpace = pFirst->zText[0]==',';
13391339
break;
13401340
}
@@ -1371,13 +1371,13 @@
13711371
13721372
StringInit(&str);
13731373
pLast = pLast->pNext;
13741374
while( pFirst!=pLast ){
13751375
if( pFirst==pSkip ){ iSkip = nSkip; }
1376
- if( iSkip>0 ){
1376
+ if( iSkip>0 ){
13771377
iSkip--;
1378
- pFirst=pFirst->pNext;
1378
+ pFirst=pFirst->pNext;
13791379
continue;
13801380
}
13811381
switch( pFirst->eType ){
13821382
case TT_Preprocessor:
13831383
StringAppend(&str,"\n",1);
@@ -1384,13 +1384,13 @@
13841384
StringAppend(&str,pFirst->zText,pFirst->nText);
13851385
StringAppend(&str,"\n",1);
13861386
needSpace = 0;
13871387
break;
13881388
1389
- case TT_Id:
1389
+ case TT_Id:
13901390
switch( pFirst->zText[0] ){
1391
- case 'E':
1391
+ case 'E':
13921392
if( pFirst->nText==6 && strncmp(pFirst->zText,"EXPORT",6)==0 ){
13931393
skipOne = 1;
13941394
}
13951395
break;
13961396
case 'P':
@@ -1645,17 +1645,17 @@
16451645
pLast = pLast->pNext;
16461646
for(p=pFirst; p && p!=pLast; p=p->pNext){
16471647
if( p->eType==TT_Id ){
16481648
static IdentTable sReserved;
16491649
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",
16521652
"float", "int", "long",
16531653
"PRIVATE", "PROTECTED", "PUBLIC",
1654
- "register", "static", "struct", "sizeof", "signed", "typedef",
1654
+ "register", "static", "struct", "sizeof", "signed", "typedef",
16551655
"union", "volatile", "virtual", "void", };
1656
-
1656
+
16571657
if( !isInit ){
16581658
int i;
16591659
for(i=0; i<sizeof(aWords)/sizeof(aWords[0]); i++){
16601660
IdentTableInsert(&sReserved,aWords[i],0);
16611661
}
@@ -1768,11 +1768,11 @@
17681768
pCode = pLast;
17691769
while( pLast && pLast!=pFirst && pLast->zText[0]!=')' ){
17701770
pLast = pLast->pPrev;
17711771
}
17721772
if( pLast==0 || pLast==pFirst || pFirst->pNext==pLast ){
1773
- fprintf(stderr,"%s:%d: Unrecognized syntax.\n",
1773
+ fprintf(stderr,"%s:%d: Unrecognized syntax.\n",
17741774
zFilename, pFirst->nLine);
17751775
return 1;
17761776
}
17771777
if( flags & (PS_Interface|PS_Export|PS_Local) ){
17781778
fprintf(stderr,"%s:%d: Missing \"inline\" on function or procedure.\n",
@@ -1849,11 +1849,11 @@
18491849
return 1;
18501850
}
18511851
18521852
#ifdef DEBUG
18531853
if( debugMask & PARSER ){
1854
- printf("**** Found inline routine: %.*s on line %d...\n",
1854
+ printf("**** Found inline routine: %.*s on line %d...\n",
18551855
pName->nText, pName->zText, pFirst->nLine);
18561856
PrintTokens(pFirst,pEnd);
18571857
printf("\n");
18581858
}
18591859
#endif
@@ -1888,11 +1888,11 @@
18881888
** to search for an occurrence of an ID followed immediately by '('.
18891889
** If found, we have a prototype. Otherwise we are dealing with a
18901890
** variable definition.
18911891
*/
18921892
static int isVariableDef(Token *pFirst, Token *pEnd){
1893
- if( pEnd && pEnd->zText[0]=='=' &&
1893
+ if( pEnd && pEnd->zText[0]=='=' &&
18941894
(pEnd->pPrev->nText!=8 || strncmp(pEnd->pPrev->zText,"operator",8)!=0)
18951895
){
18961896
return 1;
18971897
}
18981898
while( pFirst && pFirst!=pEnd && pFirst->pNext && pFirst->pNext!=pEnd ){
@@ -1949,11 +1949,11 @@
19491949
}
19501950
while( pFirst!=0 && pFirst->pNext!=pEnd &&
19511951
((pFirst->nText==6 && strncmp(pFirst->zText,"static",6)==0)
19521952
|| (pFirst->nText==5 && strncmp(pFirst->zText,"LOCAL",6)==0))
19531953
){
1954
- /* Lose the initial "static" or local from local variables.
1954
+ /* Lose the initial "static" or local from local variables.
19551955
** We'll prepend "extern" later. */
19561956
pFirst = pFirst->pNext;
19571957
isLocal = 1;
19581958
}
19591959
if( pFirst==0 || !isLocal ){
@@ -1962,11 +1962,11 @@
19621962
}else if( flags & PS_Method ){
19631963
/* Methods are declared by their class. Don't declare separately. */
19641964
return nErr;
19651965
}
19661966
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
19681968
&& (flags & PS_Extern)==0 ){
19691969
fprintf(stderr,"%s:%d: Can't define a variable in this context\n",
19701970
zFilename, pFirst->nLine);
19711971
nErr++;
19721972
}
@@ -2095,11 +2095,11 @@
20952095
nCmd++;
20962096
}
20972097
20982098
if( nCmd==5 && strncmp(zCmd,"endif",5)==0 ){
20992099
/*
2100
- ** Pop the if stack
2100
+ ** Pop the if stack
21012101
*/
21022102
pIf = ifStack;
21032103
if( pIf==0 ){
21042104
fprintf(stderr,"%s:%d: extra '#endif'.\n",zFilename,pToken->nLine);
21052105
return 1;
@@ -2106,11 +2106,11 @@
21062106
}
21072107
ifStack = pIf->pNext;
21082108
SafeFree(pIf);
21092109
}else if( nCmd==6 && strncmp(zCmd,"define",6)==0 ){
21102110
/*
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
21122112
*/
21132113
Decl *pDecl;
21142114
if( !(flags & (PS_Local|PS_Interface|PS_Export)) ){ return 0; }
21152115
zArg = &zCmd[6];
21162116
while( *zArg && isspace(*zArg) && *zArg!='\n' ){
@@ -2129,11 +2129,11 @@
21292129
}else if( flags & PS_Local ){
21302130
DeclSetProperty(pDecl,DP_Local);
21312131
}
21322132
}else if( nCmd==7 && strncmp(zCmd,"include",7)==0 ){
21332133
/*
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
21352135
*/
21362136
Include *pInclude;
21372137
char *zIf;
21382138
21392139
if( !(flags & (PS_Interface|PS_Export)) ){ return 0; }
@@ -2184,11 +2184,11 @@
21842184
PushIfMacro(0,0,0,pToken->nLine,PS_Local);
21852185
}else{
21862186
PushIfMacro(0,zArg,nArg,pToken->nLine,0);
21872187
}
21882188
}else if( nCmd==5 && strncmp(zCmd,"ifdef",5)==0 ){
2189
- /*
2189
+ /*
21902190
** Push an #ifdef.
21912191
*/
21922192
zArg = &zCmd[5];
21932193
while( *zArg && isspace(*zArg) && *zArg!='\n' ){
21942194
zArg++;
@@ -2207,11 +2207,11 @@
22072207
if( *zArg==0 || *zArg=='\n' ){ return 0; }
22082208
nArg = pToken->nText + (int)(pToken->zText - zArg);
22092209
PushIfMacro("!defined",zArg,nArg,pToken->nLine,0);
22102210
}else if( nCmd==4 && strncmp(zCmd,"else",4)==0 ){
22112211
/*
2212
- ** Invert the #if on the top of the stack
2212
+ ** Invert the #if on the top of the stack
22132213
*/
22142214
if( ifStack==0 ){
22152215
fprintf(stderr,"%s:%d: '#else' without an '#if'\n",zFilename,
22162216
pToken->nLine);
22172217
return 1;
@@ -2224,33 +2224,33 @@
22242224
}else{
22252225
pIf->flags = 0;
22262226
}
22272227
}else{
22282228
/*
2229
- ** This directive can be safely ignored
2229
+ ** This directive can be safely ignored
22302230
*/
22312231
return 0;
22322232
}
22332233
2234
- /*
2235
- ** Recompute the preset flags
2234
+ /*
2235
+ ** Recompute the preset flags
22362236
*/
22372237
*pPresetFlags = 0;
22382238
for(pIf = ifStack; pIf; pIf=pIf->pNext){
22392239
*pPresetFlags |= pIf->flags;
22402240
}
2241
-
2241
+
22422242
return nErr;
22432243
}
22442244
22452245
/*
22462246
** Parse an entire file. Return the number of errors.
22472247
**
22482248
** pList is a list of tokens in the file. Whitespace tokens have been
22492249
** eliminated, and text with {...} has been collapsed into a
22502250
** single TT_Brace token.
2251
-**
2251
+**
22522252
** initFlags are a set of parse flags that should always be set for this
22532253
** file. For .c files this is normally 0. For .h files it is PS_Interface.
22542254
*/
22552255
static int ParseFile(Token *pList, int initFlags){
22562256
int nErr = 0;
@@ -2279,11 +2279,11 @@
22792279
pStart = 0;
22802280
flags = presetFlags;
22812281
break;
22822282
22832283
case '=':
2284
- if( pList->pPrev->nText==8
2284
+ if( pList->pPrev->nText==8
22852285
&& strncmp(pList->pPrev->zText,"operator",8)==0 ){
22862286
break;
22872287
}
22882288
nErr += ProcessDecl(pStart,pList,flags);
22892289
pStart = 0;
@@ -2471,11 +2471,11 @@
24712471
pDecl->zExtra = 0;
24722472
}
24732473
24742474
/*
24752475
** 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
24772477
** in the file zFilename so that it won't be printing in other files.
24782478
*/
24792479
static void ResetDeclFlags(char *zFilename){
24802480
Decl *pDecl;
24812481
@@ -2574,11 +2574,11 @@
25742574
int flag;
25752575
int isCpp; /* True if generating C++ */
25762576
int doneTypedef = 0; /* True if a typedef has been done for this object */
25772577
25782578
/* printf("BEGIN %s of %s\n",needFullDecl?"FULL":"PROTOTYPE",pDecl->zName);*/
2579
- /*
2579
+ /*
25802580
** For any object that has a forward declaration, go ahead and do the
25812581
** forward declaration first.
25822582
*/
25832583
isCpp = (pState->flags & DP_Cplusplus) != 0;
25842584
for(p=pDecl; p; p=p->pSameName){
@@ -2626,12 +2626,12 @@
26262626
** function on a recursive call with the same pDecl. Hence, recursive
26272627
** calls to this function (through ScanText()) can never change the
26282628
** value of DP_Flag out from under us.
26292629
*/
26302630
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)
26332633
&& p->zDecl!=0
26342634
){
26352635
DeclSetProperty(p,DP_Forward|DP_Declared|DP_Flag);
26362636
}else{
26372637
DeclClearProperty(p,DP_Flag);
@@ -2735,12 +2735,12 @@
27352735
** by sToken.
27362736
*/
27372737
pDecl = FindDecl(sToken.zText,sToken.nText);
27382738
if( pDecl==0 ) continue;
27392739
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
27422742
** declaration in the database. Now see if we the full declaration
27432743
** or just a forward declaration.
27442744
*/
27452745
GetNonspaceToken(&sIn,&sNext);
27462746
if( sNext.zText[0]=='*' ){
@@ -2770,12 +2770,12 @@
27702770
int progress;
27712771
27722772
do{
27732773
progress = 0;
27742774
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)
27772777
){
27782778
DeclareObject(pDecl,pState,1);
27792779
progress = 1;
27802780
assert( DeclHasProperty(pDecl,DP_Declared) );
27812781
}
@@ -2842,11 +2842,11 @@
28422842
nErr++;
28432843
}
28442844
}else if( report ){
28452845
fprintf(report,"unchanged\n");
28462846
}
2847
- SafeFree(zOldVersion);
2847
+ SafeFree(zOldVersion);
28482848
IdentTableReset(&includeTable);
28492849
StringReset(&outStr);
28502850
return nErr;
28512851
}
28522852
@@ -2878,11 +2878,11 @@
28782878
}
28792879
ChangeIfContext(0,&sState);
28802880
printf("%s",StringGet(&outStr));
28812881
IdentTableReset(&includeTable);
28822882
StringReset(&outStr);
2883
- return 0;
2883
+ return 0;
28842884
}
28852885
28862886
#ifdef DEBUG
28872887
/*
28882888
** Return the number of characters in the given string prior to the
@@ -3040,11 +3040,11 @@
30403040
int nSrc;
30413041
char *zSrc;
30423042
InFile *pFile;
30433043
int i;
30443044
3045
- /*
3045
+ /*
30463046
** Get the name of the input file to be scanned. The input file is
30473047
** everything before the first ':' or the whole file if no ':' is seen.
30483048
**
30493049
** Except, on windows, ignore any ':' that occurs as the second character
30503050
** since it might be part of the drive specifier. So really, the ":' has
@@ -3099,11 +3099,11 @@
30993099
}
31003100
}
31013101
31023102
/*
31033103
** 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
31053105
** PS_Interface flag.
31063106
*/
31073107
pFile->flags |= PS_Interface;
31083108
for(i=nSrc-1; i>0 && zSrc[i]!='.'; i--){
31093109
if( zSrc[i]=='c' || zSrc[i]=='C' ){
@@ -3110,11 +3110,11 @@
31103110
pFile->flags &= ~PS_Interface;
31113111
break;
31123112
}
31133113
}
31143114
3115
- /* Done!
3115
+ /* Done!
31163116
*/
31173117
return pFile;
31183118
}
31193119
31203120
/* MS-Windows and MS-DOS both have the following serious OS bug: the
@@ -3162,11 +3162,11 @@
31623162
while( c!=EOF ){
31633163
while( c!=EOF && isspace(c) ){
31643164
if( c=='\n' ){
31653165
startOfLine = 1;
31663166
}
3167
- c = getc(in);
3167
+ c = getc(in);
31683168
if( startOfLine && c=='#' ){
31693169
while( c!=EOF && c!='\n' ){
31703170
c = getc(in);
31713171
}
31723172
}
@@ -3184,11 +3184,11 @@
31843184
if( nAlloc==0 ){
31853185
nAlloc = 100 + argc;
31863186
zNew = malloc( sizeof(char*) * nAlloc );
31873187
}else{
31883188
nAlloc *= 2;
3189
- zNew = realloc( zNew, sizeof(char*) * nAlloc );
3189
+ zNew = realloc( zNew, sizeof(char*) * nAlloc );
31903190
}
31913191
}
31923192
if( zNew ){
31933193
int j = nNew + index;
31943194
zNew[j] = malloc( n + 1 );
@@ -3254,11 +3254,11 @@
32543254
32553255
/*
32563256
** The following text contains a few simple #defines that we want
32573257
** to be available to every file.
32583258
*/
3259
-static char zInit[] =
3259
+static const char zInit[] =
32603260
"#define INTERFACE 0\n"
32613261
"#define EXPORT_INTERFACE 0\n"
32623262
"#define LOCAL_INTERFACE 0\n"
32633263
"#define EXPORT\n"
32643264
"#define LOCAL static\n"
32653265
--- src/makeheaders.c
+++ src/makeheaders.c
@@ -112,19 +112,19 @@
112 **
113 ** struct Xyzzy;
114 **
115 ** Not every object has a forward declaration. If it does, thought, the
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.
119 */
120 typedef struct Decl Decl;
121 struct Decl {
122 char *zName; /* Name of the object being declared. The appearance
123 ** of this name is a source file triggers the declaration
124 ** to be added to the header for that file. */
125 char *zFile; /* File from which extracted. */
126 char *zIf; /* Surround the declaration with this #if */
127 char *zFwd; /* A forward declaration. NULL if there is none. */
128 char *zFwdCpp; /* Use this forward declaration for C++. */
129 char *zDecl; /* A full declaration of this object */
130 char *zExtra; /* Extra declaration text inserted into class objects */
@@ -163,11 +163,11 @@
163 ** in the output when using the -H option.)
164 **
165 ** EXPORT scope The object is visible and usable everywhere.
166 **
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.
169 **
170 ** The DP_Cplusplus, DP_ExternCReqd and DP_ExternReqd flags are permanent
171 ** and are used to specify what type of declaration the object requires.
172 */
173 #define DP_Forward 0x001 /* Has a forward declaration in this file */
@@ -201,11 +201,11 @@
201 ** Be careful not to confuse PS_Export with DP_Export or
202 ** PS_Local with DP_Local. Their names are similar, but the meanings
203 ** of these flags are very different.
204 */
205 #define PS_Extern 0x000800 /* "extern" has been seen */
206 #define PS_Export 0x001000 /* If between "#if EXPORT_INTERFACE"
207 ** and "#endif" */
208 #define PS_Export2 0x002000 /* If "EXPORT" seen */
209 #define PS_Typedef 0x004000 /* If "typedef" has been seen */
210 #define PS_Static 0x008000 /* If "static" has been seen */
211 #define PS_Interface 0x010000 /* If within #if INTERFACE..#endif */
@@ -231,11 +231,11 @@
231 #define TY_Union 0x04000000
232 #define TY_Enumeration 0x08000000
233 #define TY_Defunct 0x10000000 /* Used to erase a declaration */
234
235 /*
236 ** Each nested #if (or #ifdef or #ifndef) is stored in a stack of
237 ** instances of the following structure.
238 */
239 typedef struct Ifmacro Ifmacro;
240 struct Ifmacro {
241 int nLine; /* Line number where this macro occurs */
@@ -293,11 +293,11 @@
293 int flags; /* One or more DP_, PS_ and/or TY_ flags */
294 InFile *pNext; /* Next input file in the list of them all */
295 IdentTable idTable; /* All identifiers in this input file */
296 };
297
298 /*
299 ** An unbounded string is able to grow without limit. We use these
300 ** to construct large in-memory strings from lots of smaller components.
301 */
302 typedef struct String String;
303 struct String {
@@ -332,19 +332,19 @@
332 ** never to read a file that it generated itself.
333 **
334 ** The "#undef INTERFACE" part is a hack to work around a name collision
335 ** in MSVC 2008.
336 */
337 const char zTopLine[] =
338 "/* \aThis file was automatically generated. Do not edit! */\n"
339 "#undef INTERFACE\n";
340 #define nTopLine (sizeof(zTopLine)-1)
341
342 /*
343 ** The name of the file currently being parsed.
344 */
345 static char *zFilename;
346
347 /*
348 ** The stack of #if macros for the file currently being parsed.
349 */
350 static Ifmacro *ifStack = 0;
@@ -702,11 +702,11 @@
702 struct stat sStat;
703 FILE *pIn;
704 char *zBuf;
705 int n;
706
707 if( stat(zFilename,&sStat)!=0
708 #ifndef WIN32
709 || !S_ISREG(sStat.st_mode)
710 #endif
711 ){
712 return 0;
@@ -889,12 +889,12 @@
889 }
890 }
891 }
892 i++;
893 }
894 if( z[i] ){
895 i += 2;
896 }else{
897 isBlockComment = 0;
898 fprintf(stderr,"%s:%d: Unterminated comment\n",
899 zFilename, startLine);
900 nErr++;
@@ -906,11 +906,11 @@
906 pToken->eType = TT_Other;
907 pToken->nText = 1 + (z[i+1]=='+');
908 }
909 break;
910
911 case '0':
912 if( z[i+1]=='x' || z[i+1]=='X' ){
913 /* A hex constant */
914 i += 2;
915 while( isxdigit(z[i]) ){ i++; }
916 }else{
@@ -963,11 +963,11 @@
963 while( isalnum(z[i]) || z[i]=='_' ){ i++; };
964 pToken->eType = TT_Id;
965 pToken->nText = i - pIn->i;
966 break;
967
968 case ':':
969 pToken->eType = TT_Other;
970 pToken->nText = 1 + (z[i+1]==':');
971 break;
972
973 case '=':
@@ -977,11 +977,11 @@
977 case '-':
978 case '*':
979 case '%':
980 case '^':
981 case '&':
982 case '|':
983 pToken->eType = TT_Other;
984 pToken->nText = 1 + (z[i+1]=='=');
985 break;
986
987 default:
@@ -1064,11 +1064,11 @@
1064 }
1065 }
1066 /* NOT REACHED */
1067 }
1068
1069 /*
1070 ** This routine looks for identifiers (strings of contiguous alphanumeric
1071 ** characters) within a preprocessor directive and adds every such string
1072 ** found to the given identifier table
1073 */
1074 static void FindIdentifiersInMacro(Token *pToken, IdentTable *pTable){
@@ -1157,11 +1157,11 @@
1157 case TT_Id:
1158 if( pTable ){
1159 IdentTableInsert(pTable,pToken->zText,pToken->nText);
1160 }
1161 break;
1162
1163 case TT_Preprocessor:
1164 if( pTable!=0 ){
1165 FindIdentifiersInMacro(pToken,pTable);
1166 }
1167 break;
@@ -1263,11 +1263,11 @@
1263 exit(1);
1264 }
1265 pList = TokenizeFile(zFile,&sTable);
1266 for(p=pList; p; p=p->pNext){
1267 int j;
1268 switch( p->eType ){
1269 case TT_Space:
1270 printf("%4d: Space\n",p->nLine);
1271 break;
1272 case TT_Id:
1273 printf("%4d: Id %.*s\n",p->nLine,p->nText,p->zText);
@@ -1330,11 +1330,11 @@
1330 needSpace = 1;
1331 break;
1332
1333 default:
1334 c = pFirst->zText[0];
1335 printf("%s%.*s",
1336 (needSpace && (c=='*' || c=='{')) ? " " : "",
1337 pFirst->nText, pFirst->zText);
1338 needSpace = pFirst->zText[0]==',';
1339 break;
1340 }
@@ -1371,13 +1371,13 @@
1371
1372 StringInit(&str);
1373 pLast = pLast->pNext;
1374 while( pFirst!=pLast ){
1375 if( pFirst==pSkip ){ iSkip = nSkip; }
1376 if( iSkip>0 ){
1377 iSkip--;
1378 pFirst=pFirst->pNext;
1379 continue;
1380 }
1381 switch( pFirst->eType ){
1382 case TT_Preprocessor:
1383 StringAppend(&str,"\n",1);
@@ -1384,13 +1384,13 @@
1384 StringAppend(&str,pFirst->zText,pFirst->nText);
1385 StringAppend(&str,"\n",1);
1386 needSpace = 0;
1387 break;
1388
1389 case TT_Id:
1390 switch( pFirst->zText[0] ){
1391 case 'E':
1392 if( pFirst->nText==6 && strncmp(pFirst->zText,"EXPORT",6)==0 ){
1393 skipOne = 1;
1394 }
1395 break;
1396 case 'P':
@@ -1645,17 +1645,17 @@
1645 pLast = pLast->pNext;
1646 for(p=pFirst; p && p!=pLast; p=p->pNext){
1647 if( p->eType==TT_Id ){
1648 static IdentTable sReserved;
1649 static int isInit = 0;
1650 static char *aWords[] = { "char", "class",
1651 "const", "double", "enum", "extern", "EXPORT", "ET_PROC",
1652 "float", "int", "long",
1653 "PRIVATE", "PROTECTED", "PUBLIC",
1654 "register", "static", "struct", "sizeof", "signed", "typedef",
1655 "union", "volatile", "virtual", "void", };
1656
1657 if( !isInit ){
1658 int i;
1659 for(i=0; i<sizeof(aWords)/sizeof(aWords[0]); i++){
1660 IdentTableInsert(&sReserved,aWords[i],0);
1661 }
@@ -1768,11 +1768,11 @@
1768 pCode = pLast;
1769 while( pLast && pLast!=pFirst && pLast->zText[0]!=')' ){
1770 pLast = pLast->pPrev;
1771 }
1772 if( pLast==0 || pLast==pFirst || pFirst->pNext==pLast ){
1773 fprintf(stderr,"%s:%d: Unrecognized syntax.\n",
1774 zFilename, pFirst->nLine);
1775 return 1;
1776 }
1777 if( flags & (PS_Interface|PS_Export|PS_Local) ){
1778 fprintf(stderr,"%s:%d: Missing \"inline\" on function or procedure.\n",
@@ -1849,11 +1849,11 @@
1849 return 1;
1850 }
1851
1852 #ifdef DEBUG
1853 if( debugMask & PARSER ){
1854 printf("**** Found inline routine: %.*s on line %d...\n",
1855 pName->nText, pName->zText, pFirst->nLine);
1856 PrintTokens(pFirst,pEnd);
1857 printf("\n");
1858 }
1859 #endif
@@ -1888,11 +1888,11 @@
1888 ** to search for an occurrence of an ID followed immediately by '('.
1889 ** If found, we have a prototype. Otherwise we are dealing with a
1890 ** variable definition.
1891 */
1892 static int isVariableDef(Token *pFirst, Token *pEnd){
1893 if( pEnd && pEnd->zText[0]=='=' &&
1894 (pEnd->pPrev->nText!=8 || strncmp(pEnd->pPrev->zText,"operator",8)!=0)
1895 ){
1896 return 1;
1897 }
1898 while( pFirst && pFirst!=pEnd && pFirst->pNext && pFirst->pNext!=pEnd ){
@@ -1949,11 +1949,11 @@
1949 }
1950 while( pFirst!=0 && pFirst->pNext!=pEnd &&
1951 ((pFirst->nText==6 && strncmp(pFirst->zText,"static",6)==0)
1952 || (pFirst->nText==5 && strncmp(pFirst->zText,"LOCAL",6)==0))
1953 ){
1954 /* Lose the initial "static" or local from local variables.
1955 ** We'll prepend "extern" later. */
1956 pFirst = pFirst->pNext;
1957 isLocal = 1;
1958 }
1959 if( pFirst==0 || !isLocal ){
@@ -1962,11 +1962,11 @@
1962 }else if( flags & PS_Method ){
1963 /* Methods are declared by their class. Don't declare separately. */
1964 return nErr;
1965 }
1966 isVar = (flags & (PS_Typedef|PS_Method))==0 && isVariableDef(pFirst,pEnd);
1967 if( isVar && (flags & (PS_Interface|PS_Export|PS_Local))!=0
1968 && (flags & PS_Extern)==0 ){
1969 fprintf(stderr,"%s:%d: Can't define a variable in this context\n",
1970 zFilename, pFirst->nLine);
1971 nErr++;
1972 }
@@ -2095,11 +2095,11 @@
2095 nCmd++;
2096 }
2097
2098 if( nCmd==5 && strncmp(zCmd,"endif",5)==0 ){
2099 /*
2100 ** Pop the if stack
2101 */
2102 pIf = ifStack;
2103 if( pIf==0 ){
2104 fprintf(stderr,"%s:%d: extra '#endif'.\n",zFilename,pToken->nLine);
2105 return 1;
@@ -2106,11 +2106,11 @@
2106 }
2107 ifStack = pIf->pNext;
2108 SafeFree(pIf);
2109 }else if( nCmd==6 && strncmp(zCmd,"define",6)==0 ){
2110 /*
2111 ** Record a #define if we are in PS_Interface or PS_Export
2112 */
2113 Decl *pDecl;
2114 if( !(flags & (PS_Local|PS_Interface|PS_Export)) ){ return 0; }
2115 zArg = &zCmd[6];
2116 while( *zArg && isspace(*zArg) && *zArg!='\n' ){
@@ -2129,11 +2129,11 @@
2129 }else if( flags & PS_Local ){
2130 DeclSetProperty(pDecl,DP_Local);
2131 }
2132 }else if( nCmd==7 && strncmp(zCmd,"include",7)==0 ){
2133 /*
2134 ** Record an #include if we are in PS_Interface or PS_Export
2135 */
2136 Include *pInclude;
2137 char *zIf;
2138
2139 if( !(flags & (PS_Interface|PS_Export)) ){ return 0; }
@@ -2184,11 +2184,11 @@
2184 PushIfMacro(0,0,0,pToken->nLine,PS_Local);
2185 }else{
2186 PushIfMacro(0,zArg,nArg,pToken->nLine,0);
2187 }
2188 }else if( nCmd==5 && strncmp(zCmd,"ifdef",5)==0 ){
2189 /*
2190 ** Push an #ifdef.
2191 */
2192 zArg = &zCmd[5];
2193 while( *zArg && isspace(*zArg) && *zArg!='\n' ){
2194 zArg++;
@@ -2207,11 +2207,11 @@
2207 if( *zArg==0 || *zArg=='\n' ){ return 0; }
2208 nArg = pToken->nText + (int)(pToken->zText - zArg);
2209 PushIfMacro("!defined",zArg,nArg,pToken->nLine,0);
2210 }else if( nCmd==4 && strncmp(zCmd,"else",4)==0 ){
2211 /*
2212 ** Invert the #if on the top of the stack
2213 */
2214 if( ifStack==0 ){
2215 fprintf(stderr,"%s:%d: '#else' without an '#if'\n",zFilename,
2216 pToken->nLine);
2217 return 1;
@@ -2224,33 +2224,33 @@
2224 }else{
2225 pIf->flags = 0;
2226 }
2227 }else{
2228 /*
2229 ** This directive can be safely ignored
2230 */
2231 return 0;
2232 }
2233
2234 /*
2235 ** Recompute the preset flags
2236 */
2237 *pPresetFlags = 0;
2238 for(pIf = ifStack; pIf; pIf=pIf->pNext){
2239 *pPresetFlags |= pIf->flags;
2240 }
2241
2242 return nErr;
2243 }
2244
2245 /*
2246 ** Parse an entire file. Return the number of errors.
2247 **
2248 ** pList is a list of tokens in the file. Whitespace tokens have been
2249 ** eliminated, and text with {...} has been collapsed into a
2250 ** single TT_Brace token.
2251 **
2252 ** initFlags are a set of parse flags that should always be set for this
2253 ** file. For .c files this is normally 0. For .h files it is PS_Interface.
2254 */
2255 static int ParseFile(Token *pList, int initFlags){
2256 int nErr = 0;
@@ -2279,11 +2279,11 @@
2279 pStart = 0;
2280 flags = presetFlags;
2281 break;
2282
2283 case '=':
2284 if( pList->pPrev->nText==8
2285 && strncmp(pList->pPrev->zText,"operator",8)==0 ){
2286 break;
2287 }
2288 nErr += ProcessDecl(pStart,pList,flags);
2289 pStart = 0;
@@ -2471,11 +2471,11 @@
2471 pDecl->zExtra = 0;
2472 }
2473
2474 /*
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
2477 ** in the file zFilename so that it won't be printing in other files.
2478 */
2479 static void ResetDeclFlags(char *zFilename){
2480 Decl *pDecl;
2481
@@ -2574,11 +2574,11 @@
2574 int flag;
2575 int isCpp; /* True if generating C++ */
2576 int doneTypedef = 0; /* True if a typedef has been done for this object */
2577
2578 /* printf("BEGIN %s of %s\n",needFullDecl?"FULL":"PROTOTYPE",pDecl->zName);*/
2579 /*
2580 ** For any object that has a forward declaration, go ahead and do the
2581 ** forward declaration first.
2582 */
2583 isCpp = (pState->flags & DP_Cplusplus) != 0;
2584 for(p=pDecl; p; p=p->pSameName){
@@ -2626,12 +2626,12 @@
2626 ** function on a recursive call with the same pDecl. Hence, recursive
2627 ** calls to this function (through ScanText()) can never change the
2628 ** value of DP_Flag out from under us.
2629 */
2630 for(p=pDecl; p; p=p->pSameName){
2631 if( !DeclHasProperty(p,DP_Declared)
2632 && (p->zFwd==0 || needFullDecl)
2633 && p->zDecl!=0
2634 ){
2635 DeclSetProperty(p,DP_Forward|DP_Declared|DP_Flag);
2636 }else{
2637 DeclClearProperty(p,DP_Flag);
@@ -2735,12 +2735,12 @@
2735 ** by sToken.
2736 */
2737 pDecl = FindDecl(sToken.zText,sToken.nText);
2738 if( pDecl==0 ) continue;
2739
2740 /*
2741 ** If we get this far, we've found an identifier that has a
2742 ** declaration in the database. Now see if we the full declaration
2743 ** or just a forward declaration.
2744 */
2745 GetNonspaceToken(&sIn,&sNext);
2746 if( sNext.zText[0]=='*' ){
@@ -2770,12 +2770,12 @@
2770 int progress;
2771
2772 do{
2773 progress = 0;
2774 for(pDecl=pDeclFirst; pDecl; pDecl=pDecl->pNext){
2775 if( DeclHasProperty(pDecl,DP_Forward)
2776 && !DeclHasProperty(pDecl,DP_Declared)
2777 ){
2778 DeclareObject(pDecl,pState,1);
2779 progress = 1;
2780 assert( DeclHasProperty(pDecl,DP_Declared) );
2781 }
@@ -2842,11 +2842,11 @@
2842 nErr++;
2843 }
2844 }else if( report ){
2845 fprintf(report,"unchanged\n");
2846 }
2847 SafeFree(zOldVersion);
2848 IdentTableReset(&includeTable);
2849 StringReset(&outStr);
2850 return nErr;
2851 }
2852
@@ -2878,11 +2878,11 @@
2878 }
2879 ChangeIfContext(0,&sState);
2880 printf("%s",StringGet(&outStr));
2881 IdentTableReset(&includeTable);
2882 StringReset(&outStr);
2883 return 0;
2884 }
2885
2886 #ifdef DEBUG
2887 /*
2888 ** Return the number of characters in the given string prior to the
@@ -3040,11 +3040,11 @@
3040 int nSrc;
3041 char *zSrc;
3042 InFile *pFile;
3043 int i;
3044
3045 /*
3046 ** Get the name of the input file to be scanned. The input file is
3047 ** everything before the first ':' or the whole file if no ':' is seen.
3048 **
3049 ** Except, on windows, ignore any ':' that occurs as the second character
3050 ** since it might be part of the drive specifier. So really, the ":' has
@@ -3099,11 +3099,11 @@
3099 }
3100 }
3101
3102 /*
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
3105 ** PS_Interface flag.
3106 */
3107 pFile->flags |= PS_Interface;
3108 for(i=nSrc-1; i>0 && zSrc[i]!='.'; i--){
3109 if( zSrc[i]=='c' || zSrc[i]=='C' ){
@@ -3110,11 +3110,11 @@
3110 pFile->flags &= ~PS_Interface;
3111 break;
3112 }
3113 }
3114
3115 /* Done!
3116 */
3117 return pFile;
3118 }
3119
3120 /* MS-Windows and MS-DOS both have the following serious OS bug: the
@@ -3162,11 +3162,11 @@
3162 while( c!=EOF ){
3163 while( c!=EOF && isspace(c) ){
3164 if( c=='\n' ){
3165 startOfLine = 1;
3166 }
3167 c = getc(in);
3168 if( startOfLine && c=='#' ){
3169 while( c!=EOF && c!='\n' ){
3170 c = getc(in);
3171 }
3172 }
@@ -3184,11 +3184,11 @@
3184 if( nAlloc==0 ){
3185 nAlloc = 100 + argc;
3186 zNew = malloc( sizeof(char*) * nAlloc );
3187 }else{
3188 nAlloc *= 2;
3189 zNew = realloc( zNew, sizeof(char*) * nAlloc );
3190 }
3191 }
3192 if( zNew ){
3193 int j = nNew + index;
3194 zNew[j] = malloc( n + 1 );
@@ -3254,11 +3254,11 @@
3254
3255 /*
3256 ** The following text contains a few simple #defines that we want
3257 ** to be available to every file.
3258 */
3259 static char zInit[] =
3260 "#define INTERFACE 0\n"
3261 "#define EXPORT_INTERFACE 0\n"
3262 "#define LOCAL_INTERFACE 0\n"
3263 "#define EXPORT\n"
3264 "#define LOCAL static\n"
3265
--- src/makeheaders.c
+++ src/makeheaders.c
@@ -112,19 +112,19 @@
112 **
113 ** struct Xyzzy;
114 **
115 ** Not every object has a forward declaration. If it does, thought, the
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.
119 */
120 typedef struct Decl Decl;
121 struct Decl {
122 char *zName; /* Name of the object being declared. The appearance
123 ** of this name is a source file triggers the declaration
124 ** to be added to the header for that file. */
125 const char *zFile; /* File from which extracted. */
126 char *zIf; /* Surround the declaration with this #if */
127 char *zFwd; /* A forward declaration. NULL if there is none. */
128 char *zFwdCpp; /* Use this forward declaration for C++. */
129 char *zDecl; /* A full declaration of this object */
130 char *zExtra; /* Extra declaration text inserted into class objects */
@@ -163,11 +163,11 @@
163 ** in the output when using the -H option.)
164 **
165 ** EXPORT scope The object is visible and usable everywhere.
166 **
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.
169 **
170 ** The DP_Cplusplus, DP_ExternCReqd and DP_ExternReqd flags are permanent
171 ** and are used to specify what type of declaration the object requires.
172 */
173 #define DP_Forward 0x001 /* Has a forward declaration in this file */
@@ -201,11 +201,11 @@
201 ** Be careful not to confuse PS_Export with DP_Export or
202 ** PS_Local with DP_Local. Their names are similar, but the meanings
203 ** of these flags are very different.
204 */
205 #define PS_Extern 0x000800 /* "extern" has been seen */
206 #define PS_Export 0x001000 /* If between "#if EXPORT_INTERFACE"
207 ** and "#endif" */
208 #define PS_Export2 0x002000 /* If "EXPORT" seen */
209 #define PS_Typedef 0x004000 /* If "typedef" has been seen */
210 #define PS_Static 0x008000 /* If "static" has been seen */
211 #define PS_Interface 0x010000 /* If within #if INTERFACE..#endif */
@@ -231,11 +231,11 @@
231 #define TY_Union 0x04000000
232 #define TY_Enumeration 0x08000000
233 #define TY_Defunct 0x10000000 /* Used to erase a declaration */
234
235 /*
236 ** Each nested #if (or #ifdef or #ifndef) is stored in a stack of
237 ** instances of the following structure.
238 */
239 typedef struct Ifmacro Ifmacro;
240 struct Ifmacro {
241 int nLine; /* Line number where this macro occurs */
@@ -293,11 +293,11 @@
293 int flags; /* One or more DP_, PS_ and/or TY_ flags */
294 InFile *pNext; /* Next input file in the list of them all */
295 IdentTable idTable; /* All identifiers in this input file */
296 };
297
298 /*
299 ** An unbounded string is able to grow without limit. We use these
300 ** to construct large in-memory strings from lots of smaller components.
301 */
302 typedef struct String String;
303 struct String {
@@ -332,19 +332,19 @@
332 ** never to read a file that it generated itself.
333 **
334 ** The "#undef INTERFACE" part is a hack to work around a name collision
335 ** in MSVC 2008.
336 */
337 const char zTopLine[] =
338 "/* \aThis file was automatically generated. Do not edit! */\n"
339 "#undef INTERFACE\n";
340 #define nTopLine (sizeof(zTopLine)-1)
341
342 /*
343 ** The name of the file currently being parsed.
344 */
345 static const char *zFilename;
346
347 /*
348 ** The stack of #if macros for the file currently being parsed.
349 */
350 static Ifmacro *ifStack = 0;
@@ -702,11 +702,11 @@
702 struct stat sStat;
703 FILE *pIn;
704 char *zBuf;
705 int n;
706
707 if( stat(zFilename,&sStat)!=0
708 #ifndef WIN32
709 || !S_ISREG(sStat.st_mode)
710 #endif
711 ){
712 return 0;
@@ -889,12 +889,12 @@
889 }
890 }
891 }
892 i++;
893 }
894 if( z[i] ){
895 i += 2;
896 }else{
897 isBlockComment = 0;
898 fprintf(stderr,"%s:%d: Unterminated comment\n",
899 zFilename, startLine);
900 nErr++;
@@ -906,11 +906,11 @@
906 pToken->eType = TT_Other;
907 pToken->nText = 1 + (z[i+1]=='+');
908 }
909 break;
910
911 case '0':
912 if( z[i+1]=='x' || z[i+1]=='X' ){
913 /* A hex constant */
914 i += 2;
915 while( isxdigit(z[i]) ){ i++; }
916 }else{
@@ -963,11 +963,11 @@
963 while( isalnum(z[i]) || z[i]=='_' ){ i++; };
964 pToken->eType = TT_Id;
965 pToken->nText = i - pIn->i;
966 break;
967
968 case ':':
969 pToken->eType = TT_Other;
970 pToken->nText = 1 + (z[i+1]==':');
971 break;
972
973 case '=':
@@ -977,11 +977,11 @@
977 case '-':
978 case '*':
979 case '%':
980 case '^':
981 case '&':
982 case '|':
983 pToken->eType = TT_Other;
984 pToken->nText = 1 + (z[i+1]=='=');
985 break;
986
987 default:
@@ -1064,11 +1064,11 @@
1064 }
1065 }
1066 /* NOT REACHED */
1067 }
1068
1069 /*
1070 ** This routine looks for identifiers (strings of contiguous alphanumeric
1071 ** characters) within a preprocessor directive and adds every such string
1072 ** found to the given identifier table
1073 */
1074 static void FindIdentifiersInMacro(Token *pToken, IdentTable *pTable){
@@ -1157,11 +1157,11 @@
1157 case TT_Id:
1158 if( pTable ){
1159 IdentTableInsert(pTable,pToken->zText,pToken->nText);
1160 }
1161 break;
1162
1163 case TT_Preprocessor:
1164 if( pTable!=0 ){
1165 FindIdentifiersInMacro(pToken,pTable);
1166 }
1167 break;
@@ -1263,11 +1263,11 @@
1263 exit(1);
1264 }
1265 pList = TokenizeFile(zFile,&sTable);
1266 for(p=pList; p; p=p->pNext){
1267 int j;
1268 switch( p->eType ){
1269 case TT_Space:
1270 printf("%4d: Space\n",p->nLine);
1271 break;
1272 case TT_Id:
1273 printf("%4d: Id %.*s\n",p->nLine,p->nText,p->zText);
@@ -1330,11 +1330,11 @@
1330 needSpace = 1;
1331 break;
1332
1333 default:
1334 c = pFirst->zText[0];
1335 printf("%s%.*s",
1336 (needSpace && (c=='*' || c=='{')) ? " " : "",
1337 pFirst->nText, pFirst->zText);
1338 needSpace = pFirst->zText[0]==',';
1339 break;
1340 }
@@ -1371,13 +1371,13 @@
1371
1372 StringInit(&str);
1373 pLast = pLast->pNext;
1374 while( pFirst!=pLast ){
1375 if( pFirst==pSkip ){ iSkip = nSkip; }
1376 if( iSkip>0 ){
1377 iSkip--;
1378 pFirst=pFirst->pNext;
1379 continue;
1380 }
1381 switch( pFirst->eType ){
1382 case TT_Preprocessor:
1383 StringAppend(&str,"\n",1);
@@ -1384,13 +1384,13 @@
1384 StringAppend(&str,pFirst->zText,pFirst->nText);
1385 StringAppend(&str,"\n",1);
1386 needSpace = 0;
1387 break;
1388
1389 case TT_Id:
1390 switch( pFirst->zText[0] ){
1391 case 'E':
1392 if( pFirst->nText==6 && strncmp(pFirst->zText,"EXPORT",6)==0 ){
1393 skipOne = 1;
1394 }
1395 break;
1396 case 'P':
@@ -1645,17 +1645,17 @@
1645 pLast = pLast->pNext;
1646 for(p=pFirst; p && p!=pLast; p=p->pNext){
1647 if( p->eType==TT_Id ){
1648 static IdentTable sReserved;
1649 static int isInit = 0;
1650 static const char *aWords[] = { "char", "class",
1651 "const", "double", "enum", "extern", "EXPORT", "ET_PROC",
1652 "float", "int", "long",
1653 "PRIVATE", "PROTECTED", "PUBLIC",
1654 "register", "static", "struct", "sizeof", "signed", "typedef",
1655 "union", "volatile", "virtual", "void", };
1656
1657 if( !isInit ){
1658 int i;
1659 for(i=0; i<sizeof(aWords)/sizeof(aWords[0]); i++){
1660 IdentTableInsert(&sReserved,aWords[i],0);
1661 }
@@ -1768,11 +1768,11 @@
1768 pCode = pLast;
1769 while( pLast && pLast!=pFirst && pLast->zText[0]!=')' ){
1770 pLast = pLast->pPrev;
1771 }
1772 if( pLast==0 || pLast==pFirst || pFirst->pNext==pLast ){
1773 fprintf(stderr,"%s:%d: Unrecognized syntax.\n",
1774 zFilename, pFirst->nLine);
1775 return 1;
1776 }
1777 if( flags & (PS_Interface|PS_Export|PS_Local) ){
1778 fprintf(stderr,"%s:%d: Missing \"inline\" on function or procedure.\n",
@@ -1849,11 +1849,11 @@
1849 return 1;
1850 }
1851
1852 #ifdef DEBUG
1853 if( debugMask & PARSER ){
1854 printf("**** Found inline routine: %.*s on line %d...\n",
1855 pName->nText, pName->zText, pFirst->nLine);
1856 PrintTokens(pFirst,pEnd);
1857 printf("\n");
1858 }
1859 #endif
@@ -1888,11 +1888,11 @@
1888 ** to search for an occurrence of an ID followed immediately by '('.
1889 ** If found, we have a prototype. Otherwise we are dealing with a
1890 ** variable definition.
1891 */
1892 static int isVariableDef(Token *pFirst, Token *pEnd){
1893 if( pEnd && pEnd->zText[0]=='=' &&
1894 (pEnd->pPrev->nText!=8 || strncmp(pEnd->pPrev->zText,"operator",8)!=0)
1895 ){
1896 return 1;
1897 }
1898 while( pFirst && pFirst!=pEnd && pFirst->pNext && pFirst->pNext!=pEnd ){
@@ -1949,11 +1949,11 @@
1949 }
1950 while( pFirst!=0 && pFirst->pNext!=pEnd &&
1951 ((pFirst->nText==6 && strncmp(pFirst->zText,"static",6)==0)
1952 || (pFirst->nText==5 && strncmp(pFirst->zText,"LOCAL",6)==0))
1953 ){
1954 /* Lose the initial "static" or local from local variables.
1955 ** We'll prepend "extern" later. */
1956 pFirst = pFirst->pNext;
1957 isLocal = 1;
1958 }
1959 if( pFirst==0 || !isLocal ){
@@ -1962,11 +1962,11 @@
1962 }else if( flags & PS_Method ){
1963 /* Methods are declared by their class. Don't declare separately. */
1964 return nErr;
1965 }
1966 isVar = (flags & (PS_Typedef|PS_Method))==0 && isVariableDef(pFirst,pEnd);
1967 if( isVar && (flags & (PS_Interface|PS_Export|PS_Local))!=0
1968 && (flags & PS_Extern)==0 ){
1969 fprintf(stderr,"%s:%d: Can't define a variable in this context\n",
1970 zFilename, pFirst->nLine);
1971 nErr++;
1972 }
@@ -2095,11 +2095,11 @@
2095 nCmd++;
2096 }
2097
2098 if( nCmd==5 && strncmp(zCmd,"endif",5)==0 ){
2099 /*
2100 ** Pop the if stack
2101 */
2102 pIf = ifStack;
2103 if( pIf==0 ){
2104 fprintf(stderr,"%s:%d: extra '#endif'.\n",zFilename,pToken->nLine);
2105 return 1;
@@ -2106,11 +2106,11 @@
2106 }
2107 ifStack = pIf->pNext;
2108 SafeFree(pIf);
2109 }else if( nCmd==6 && strncmp(zCmd,"define",6)==0 ){
2110 /*
2111 ** Record a #define if we are in PS_Interface or PS_Export
2112 */
2113 Decl *pDecl;
2114 if( !(flags & (PS_Local|PS_Interface|PS_Export)) ){ return 0; }
2115 zArg = &zCmd[6];
2116 while( *zArg && isspace(*zArg) && *zArg!='\n' ){
@@ -2129,11 +2129,11 @@
2129 }else if( flags & PS_Local ){
2130 DeclSetProperty(pDecl,DP_Local);
2131 }
2132 }else if( nCmd==7 && strncmp(zCmd,"include",7)==0 ){
2133 /*
2134 ** Record an #include if we are in PS_Interface or PS_Export
2135 */
2136 Include *pInclude;
2137 char *zIf;
2138
2139 if( !(flags & (PS_Interface|PS_Export)) ){ return 0; }
@@ -2184,11 +2184,11 @@
2184 PushIfMacro(0,0,0,pToken->nLine,PS_Local);
2185 }else{
2186 PushIfMacro(0,zArg,nArg,pToken->nLine,0);
2187 }
2188 }else if( nCmd==5 && strncmp(zCmd,"ifdef",5)==0 ){
2189 /*
2190 ** Push an #ifdef.
2191 */
2192 zArg = &zCmd[5];
2193 while( *zArg && isspace(*zArg) && *zArg!='\n' ){
2194 zArg++;
@@ -2207,11 +2207,11 @@
2207 if( *zArg==0 || *zArg=='\n' ){ return 0; }
2208 nArg = pToken->nText + (int)(pToken->zText - zArg);
2209 PushIfMacro("!defined",zArg,nArg,pToken->nLine,0);
2210 }else if( nCmd==4 && strncmp(zCmd,"else",4)==0 ){
2211 /*
2212 ** Invert the #if on the top of the stack
2213 */
2214 if( ifStack==0 ){
2215 fprintf(stderr,"%s:%d: '#else' without an '#if'\n",zFilename,
2216 pToken->nLine);
2217 return 1;
@@ -2224,33 +2224,33 @@
2224 }else{
2225 pIf->flags = 0;
2226 }
2227 }else{
2228 /*
2229 ** This directive can be safely ignored
2230 */
2231 return 0;
2232 }
2233
2234 /*
2235 ** Recompute the preset flags
2236 */
2237 *pPresetFlags = 0;
2238 for(pIf = ifStack; pIf; pIf=pIf->pNext){
2239 *pPresetFlags |= pIf->flags;
2240 }
2241
2242 return nErr;
2243 }
2244
2245 /*
2246 ** Parse an entire file. Return the number of errors.
2247 **
2248 ** pList is a list of tokens in the file. Whitespace tokens have been
2249 ** eliminated, and text with {...} has been collapsed into a
2250 ** single TT_Brace token.
2251 **
2252 ** initFlags are a set of parse flags that should always be set for this
2253 ** file. For .c files this is normally 0. For .h files it is PS_Interface.
2254 */
2255 static int ParseFile(Token *pList, int initFlags){
2256 int nErr = 0;
@@ -2279,11 +2279,11 @@
2279 pStart = 0;
2280 flags = presetFlags;
2281 break;
2282
2283 case '=':
2284 if( pList->pPrev->nText==8
2285 && strncmp(pList->pPrev->zText,"operator",8)==0 ){
2286 break;
2287 }
2288 nErr += ProcessDecl(pStart,pList,flags);
2289 pStart = 0;
@@ -2471,11 +2471,11 @@
2471 pDecl->zExtra = 0;
2472 }
2473
2474 /*
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
2477 ** in the file zFilename so that it won't be printing in other files.
2478 */
2479 static void ResetDeclFlags(char *zFilename){
2480 Decl *pDecl;
2481
@@ -2574,11 +2574,11 @@
2574 int flag;
2575 int isCpp; /* True if generating C++ */
2576 int doneTypedef = 0; /* True if a typedef has been done for this object */
2577
2578 /* printf("BEGIN %s of %s\n",needFullDecl?"FULL":"PROTOTYPE",pDecl->zName);*/
2579 /*
2580 ** For any object that has a forward declaration, go ahead and do the
2581 ** forward declaration first.
2582 */
2583 isCpp = (pState->flags & DP_Cplusplus) != 0;
2584 for(p=pDecl; p; p=p->pSameName){
@@ -2626,12 +2626,12 @@
2626 ** function on a recursive call with the same pDecl. Hence, recursive
2627 ** calls to this function (through ScanText()) can never change the
2628 ** value of DP_Flag out from under us.
2629 */
2630 for(p=pDecl; p; p=p->pSameName){
2631 if( !DeclHasProperty(p,DP_Declared)
2632 && (p->zFwd==0 || needFullDecl)
2633 && p->zDecl!=0
2634 ){
2635 DeclSetProperty(p,DP_Forward|DP_Declared|DP_Flag);
2636 }else{
2637 DeclClearProperty(p,DP_Flag);
@@ -2735,12 +2735,12 @@
2735 ** by sToken.
2736 */
2737 pDecl = FindDecl(sToken.zText,sToken.nText);
2738 if( pDecl==0 ) continue;
2739
2740 /*
2741 ** If we get this far, we've found an identifier that has a
2742 ** declaration in the database. Now see if we the full declaration
2743 ** or just a forward declaration.
2744 */
2745 GetNonspaceToken(&sIn,&sNext);
2746 if( sNext.zText[0]=='*' ){
@@ -2770,12 +2770,12 @@
2770 int progress;
2771
2772 do{
2773 progress = 0;
2774 for(pDecl=pDeclFirst; pDecl; pDecl=pDecl->pNext){
2775 if( DeclHasProperty(pDecl,DP_Forward)
2776 && !DeclHasProperty(pDecl,DP_Declared)
2777 ){
2778 DeclareObject(pDecl,pState,1);
2779 progress = 1;
2780 assert( DeclHasProperty(pDecl,DP_Declared) );
2781 }
@@ -2842,11 +2842,11 @@
2842 nErr++;
2843 }
2844 }else if( report ){
2845 fprintf(report,"unchanged\n");
2846 }
2847 SafeFree(zOldVersion);
2848 IdentTableReset(&includeTable);
2849 StringReset(&outStr);
2850 return nErr;
2851 }
2852
@@ -2878,11 +2878,11 @@
2878 }
2879 ChangeIfContext(0,&sState);
2880 printf("%s",StringGet(&outStr));
2881 IdentTableReset(&includeTable);
2882 StringReset(&outStr);
2883 return 0;
2884 }
2885
2886 #ifdef DEBUG
2887 /*
2888 ** Return the number of characters in the given string prior to the
@@ -3040,11 +3040,11 @@
3040 int nSrc;
3041 char *zSrc;
3042 InFile *pFile;
3043 int i;
3044
3045 /*
3046 ** Get the name of the input file to be scanned. The input file is
3047 ** everything before the first ':' or the whole file if no ':' is seen.
3048 **
3049 ** Except, on windows, ignore any ':' that occurs as the second character
3050 ** since it might be part of the drive specifier. So really, the ":' has
@@ -3099,11 +3099,11 @@
3099 }
3100 }
3101
3102 /*
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
3105 ** PS_Interface flag.
3106 */
3107 pFile->flags |= PS_Interface;
3108 for(i=nSrc-1; i>0 && zSrc[i]!='.'; i--){
3109 if( zSrc[i]=='c' || zSrc[i]=='C' ){
@@ -3110,11 +3110,11 @@
3110 pFile->flags &= ~PS_Interface;
3111 break;
3112 }
3113 }
3114
3115 /* Done!
3116 */
3117 return pFile;
3118 }
3119
3120 /* MS-Windows and MS-DOS both have the following serious OS bug: the
@@ -3162,11 +3162,11 @@
3162 while( c!=EOF ){
3163 while( c!=EOF && isspace(c) ){
3164 if( c=='\n' ){
3165 startOfLine = 1;
3166 }
3167 c = getc(in);
3168 if( startOfLine && c=='#' ){
3169 while( c!=EOF && c!='\n' ){
3170 c = getc(in);
3171 }
3172 }
@@ -3184,11 +3184,11 @@
3184 if( nAlloc==0 ){
3185 nAlloc = 100 + argc;
3186 zNew = malloc( sizeof(char*) * nAlloc );
3187 }else{
3188 nAlloc *= 2;
3189 zNew = realloc( zNew, sizeof(char*) * nAlloc );
3190 }
3191 }
3192 if( zNew ){
3193 int j = nNew + index;
3194 zNew[j] = malloc( n + 1 );
@@ -3254,11 +3254,11 @@
3254
3255 /*
3256 ** The following text contains a few simple #defines that we want
3257 ** to be available to every file.
3258 */
3259 static const char zInit[] =
3260 "#define INTERFACE 0\n"
3261 "#define EXPORT_INTERFACE 0\n"
3262 "#define LOCAL_INTERFACE 0\n"
3263 "#define EXPORT\n"
3264 "#define LOCAL static\n"
3265
+3 -3
--- src/mkindex.c
+++ src/mkindex.c
@@ -217,11 +217,11 @@
217217
if( zLine[i]!='(' ) goto page_skip;
218218
nFixed = nUsed;
219219
nHelp = 0;
220220
return;
221221
222
-page_skip:
222
+page_skip:
223223
for(i=nFixed; i<nUsed; i++){
224224
fprintf(stderr,"%s:%d: skipping page \"%s\"\n",
225225
zFile, nLine, aEntry[i].zPath);
226226
}
227227
nUsed = nFixed;
@@ -327,11 +327,11 @@
327327
aEntry[i].zHelp[0] = 0;
328328
}
329329
}
330330
puts("struct CmdHelp {"
331331
"int eType; "
332
- "char const * zText;"
332
+ "const char *zText;"
333333
"};");
334334
puts("static struct CmdHelp aCmdHelp[] = {");
335335
for(i=0; i<nFixed; i++){
336336
if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
337337
if( aEntry[i].zHelp==0 ){
@@ -361,11 +361,11 @@
361361
scan_for_label("WEBPAGE:",zLine,0);
362362
scan_for_label("COMMAND:",zLine,1);
363363
scan_for_func(zLine);
364364
}
365365
fclose(in);
366
- nUsed = nFixed;
366
+ nUsed = nFixed;
367367
}
368368
369369
int main(int argc, char **argv){
370370
int i;
371371
for(i=1; i<argc; i++){
372372
--- src/mkindex.c
+++ src/mkindex.c
@@ -217,11 +217,11 @@
217 if( zLine[i]!='(' ) goto page_skip;
218 nFixed = nUsed;
219 nHelp = 0;
220 return;
221
222 page_skip:
223 for(i=nFixed; i<nUsed; i++){
224 fprintf(stderr,"%s:%d: skipping page \"%s\"\n",
225 zFile, nLine, aEntry[i].zPath);
226 }
227 nUsed = nFixed;
@@ -327,11 +327,11 @@
327 aEntry[i].zHelp[0] = 0;
328 }
329 }
330 puts("struct CmdHelp {"
331 "int eType; "
332 "char const * zText;"
333 "};");
334 puts("static struct CmdHelp aCmdHelp[] = {");
335 for(i=0; i<nFixed; i++){
336 if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
337 if( aEntry[i].zHelp==0 ){
@@ -361,11 +361,11 @@
361 scan_for_label("WEBPAGE:",zLine,0);
362 scan_for_label("COMMAND:",zLine,1);
363 scan_for_func(zLine);
364 }
365 fclose(in);
366 nUsed = nFixed;
367 }
368
369 int main(int argc, char **argv){
370 int i;
371 for(i=1; i<argc; i++){
372
--- src/mkindex.c
+++ src/mkindex.c
@@ -217,11 +217,11 @@
217 if( zLine[i]!='(' ) goto page_skip;
218 nFixed = nUsed;
219 nHelp = 0;
220 return;
221
222 page_skip:
223 for(i=nFixed; i<nUsed; i++){
224 fprintf(stderr,"%s:%d: skipping page \"%s\"\n",
225 zFile, nLine, aEntry[i].zPath);
226 }
227 nUsed = nFixed;
@@ -327,11 +327,11 @@
327 aEntry[i].zHelp[0] = 0;
328 }
329 }
330 puts("struct CmdHelp {"
331 "int eType; "
332 "const char *zText;"
333 "};");
334 puts("static struct CmdHelp aCmdHelp[] = {");
335 for(i=0; i<nFixed; i++){
336 if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
337 if( aEntry[i].zHelp==0 ){
@@ -361,11 +361,11 @@
361 scan_for_label("WEBPAGE:",zLine,0);
362 scan_for_label("COMMAND:",zLine,1);
363 scan_for_func(zLine);
364 }
365 fclose(in);
366 nUsed = nFixed;
367 }
368
369 int main(int argc, char **argv){
370 int i;
371 for(i=1; i<argc; i++){
372
+1 -1
--- src/mkversion.c
+++ src/mkversion.c
@@ -43,11 +43,11 @@
4343
exit(1);
4444
}
4545
fclose(v);
4646
for(z=b; z[0] && z[0]!='\r' && z[0]!='\n'; z++){}
4747
*z = 0;
48
- printf("#define RELEASE_VERSION \"%s\"\n", b);
48
+ printf("#define RELEASE_VERSION \"%s\"\n", b);
4949
x=0;
5050
i=0;
5151
z=b;
5252
while(1){
5353
if( z[0]>='0' && z[0]<='9' ){
5454
--- src/mkversion.c
+++ src/mkversion.c
@@ -43,11 +43,11 @@
43 exit(1);
44 }
45 fclose(v);
46 for(z=b; z[0] && z[0]!='\r' && z[0]!='\n'; z++){}
47 *z = 0;
48 printf("#define RELEASE_VERSION \"%s\"\n", b);
49 x=0;
50 i=0;
51 z=b;
52 while(1){
53 if( z[0]>='0' && z[0]<='9' ){
54
--- src/mkversion.c
+++ src/mkversion.c
@@ -43,11 +43,11 @@
43 exit(1);
44 }
45 fclose(v);
46 for(z=b; z[0] && z[0]!='\r' && z[0]!='\n'; z++){}
47 *z = 0;
48 printf("#define RELEASE_VERSION \"%s\"\n", b);
49 x=0;
50 i=0;
51 z=b;
52 while(1){
53 if( z[0]>='0' && z[0]<='9' ){
54
--- win/include/unistd.h
+++ win/include/unistd.h
@@ -1,11 +1,11 @@
11
#ifndef _UNISTD_H
22
#define _UNISTD_H 1
33
4
-/* This file intended to serve as a drop-in replacement for
4
+/* This file intended to serve as a drop-in replacement for
55
* unistd.h on Windows
6
- * Please add functionality as neeeded
6
+ * Please add functionality as neeeded
77
*/
88
99
#include <stdlib.h>
1010
#include <io.h>
1111
#define srandom srand
1212
--- win/include/unistd.h
+++ win/include/unistd.h
@@ -1,11 +1,11 @@
1 #ifndef _UNISTD_H
2 #define _UNISTD_H 1
3
4 /* This file intended to serve as a drop-in replacement for
5 * unistd.h on Windows
6 * Please add functionality as neeeded
7 */
8
9 #include <stdlib.h>
10 #include <io.h>
11 #define srandom srand
12
--- win/include/unistd.h
+++ win/include/unistd.h
@@ -1,11 +1,11 @@
1 #ifndef _UNISTD_H
2 #define _UNISTD_H 1
3
4 /* This file intended to serve as a drop-in replacement for
5 * unistd.h on Windows
6 * Please add functionality as neeeded
7 */
8
9 #include <stdlib.h>
10 #include <io.h>
11 #define srandom srand
12

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button