Fossil SCM

When compiling with FOSSIL_DEBUG (from the --fossil-debug configure option) do not attempt to "compress" built-in javascript by removing comments and surplus whitespace. This makes the javascript easier to read in a debugger.

drh 2020-08-16 14:08 UTC trunk
Commit 41b9873b4306723aea4c95083b7d7a9c7a9fd242b066dbb6b4c9dd8449ac3501
1 file changed +6
--- src/mkbuiltin.c
+++ src/mkbuiltin.c
@@ -62,10 +62,11 @@
6262
fclose(in);
6363
z[got] = 0;
6464
return z;
6565
}
6666
67
+#ifndef FOSSIL_DEBUG
6768
/*
6869
** Try to compress a javascript file by removing unnecessary whitespace.
6970
**
7071
** Warning: This compression routine does not necessarily work for any
7172
** arbitrary Javascript source file. But it should work ok for the
@@ -99,10 +100,11 @@
99100
z[j++] = c;
100101
}
101102
z[j] = 0;
102103
*pn = j;
103104
}
105
+#endif /* FOSSIL_DEBUG */
104106
105107
/*
106108
** There is an instance of the following for each file translated.
107109
*/
108110
typedef struct Resource Resource;
@@ -279,11 +281,13 @@
279281
int nRes;
280282
unsigned char *pData;
281283
int nErr = 0;
282284
int nSkip;
283285
int nPrefix = 0;
286
+#ifndef FOSSIL_DEBUG
284287
int nName;
288
+#endif
285289
286290
if( argc==1 ){
287291
fprintf(stderr, "usage\t:%s "
288292
"[--prefix path] [--reslist file] [resource-file1 ...]\n",
289293
argv[0]
@@ -350,19 +354,21 @@
350354
while( pData[nSkip]=='#' ){
351355
while( pData[nSkip]!=0 && pData[nSkip]!='\n' ){ nSkip++; }
352356
if( pData[nSkip]=='\n' ) nSkip++;
353357
}
354358
359
+#ifndef FOSSIL_DEBUG
355360
/* Compress javascript source files */
356361
nName = (int)strlen(aRes[i].zName);
357362
if( (nName>3 && strcmp(&aRes[i].zName[nName-3],".js")==0)
358363
|| (nName>7 && strcmp(&aRes[i].zName[nName-7], "/js.txt")==0)
359364
){
360365
int x = sz-nSkip;
361366
compressJavascript(pData+nSkip, &x);
362367
sz = x + nSkip;
363368
}
369
+#endif
364370
365371
aRes[i].nByte = sz - nSkip;
366372
aRes[i].idx = i;
367373
printf("/* Content of file %s */\n", aRes[i].zName);
368374
printf("static const unsigned char bidata%d[%d] = {\n ",
369375
--- src/mkbuiltin.c
+++ src/mkbuiltin.c
@@ -62,10 +62,11 @@
62 fclose(in);
63 z[got] = 0;
64 return z;
65 }
66
 
67 /*
68 ** Try to compress a javascript file by removing unnecessary whitespace.
69 **
70 ** Warning: This compression routine does not necessarily work for any
71 ** arbitrary Javascript source file. But it should work ok for the
@@ -99,10 +100,11 @@
99 z[j++] = c;
100 }
101 z[j] = 0;
102 *pn = j;
103 }
 
104
105 /*
106 ** There is an instance of the following for each file translated.
107 */
108 typedef struct Resource Resource;
@@ -279,11 +281,13 @@
279 int nRes;
280 unsigned char *pData;
281 int nErr = 0;
282 int nSkip;
283 int nPrefix = 0;
 
284 int nName;
 
285
286 if( argc==1 ){
287 fprintf(stderr, "usage\t:%s "
288 "[--prefix path] [--reslist file] [resource-file1 ...]\n",
289 argv[0]
@@ -350,19 +354,21 @@
350 while( pData[nSkip]=='#' ){
351 while( pData[nSkip]!=0 && pData[nSkip]!='\n' ){ nSkip++; }
352 if( pData[nSkip]=='\n' ) nSkip++;
353 }
354
 
355 /* Compress javascript source files */
356 nName = (int)strlen(aRes[i].zName);
357 if( (nName>3 && strcmp(&aRes[i].zName[nName-3],".js")==0)
358 || (nName>7 && strcmp(&aRes[i].zName[nName-7], "/js.txt")==0)
359 ){
360 int x = sz-nSkip;
361 compressJavascript(pData+nSkip, &x);
362 sz = x + nSkip;
363 }
 
364
365 aRes[i].nByte = sz - nSkip;
366 aRes[i].idx = i;
367 printf("/* Content of file %s */\n", aRes[i].zName);
368 printf("static const unsigned char bidata%d[%d] = {\n ",
369
--- src/mkbuiltin.c
+++ src/mkbuiltin.c
@@ -62,10 +62,11 @@
62 fclose(in);
63 z[got] = 0;
64 return z;
65 }
66
67 #ifndef FOSSIL_DEBUG
68 /*
69 ** Try to compress a javascript file by removing unnecessary whitespace.
70 **
71 ** Warning: This compression routine does not necessarily work for any
72 ** arbitrary Javascript source file. But it should work ok for the
@@ -99,10 +100,11 @@
100 z[j++] = c;
101 }
102 z[j] = 0;
103 *pn = j;
104 }
105 #endif /* FOSSIL_DEBUG */
106
107 /*
108 ** There is an instance of the following for each file translated.
109 */
110 typedef struct Resource Resource;
@@ -279,11 +281,13 @@
281 int nRes;
282 unsigned char *pData;
283 int nErr = 0;
284 int nSkip;
285 int nPrefix = 0;
286 #ifndef FOSSIL_DEBUG
287 int nName;
288 #endif
289
290 if( argc==1 ){
291 fprintf(stderr, "usage\t:%s "
292 "[--prefix path] [--reslist file] [resource-file1 ...]\n",
293 argv[0]
@@ -350,19 +354,21 @@
354 while( pData[nSkip]=='#' ){
355 while( pData[nSkip]!=0 && pData[nSkip]!='\n' ){ nSkip++; }
356 if( pData[nSkip]=='\n' ) nSkip++;
357 }
358
359 #ifndef FOSSIL_DEBUG
360 /* Compress javascript source files */
361 nName = (int)strlen(aRes[i].zName);
362 if( (nName>3 && strcmp(&aRes[i].zName[nName-3],".js")==0)
363 || (nName>7 && strcmp(&aRes[i].zName[nName-7], "/js.txt")==0)
364 ){
365 int x = sz-nSkip;
366 compressJavascript(pData+nSkip, &x);
367 sz = x + nSkip;
368 }
369 #endif
370
371 aRes[i].nByte = sz - nSkip;
372 aRes[i].idx = i;
373 printf("/* Content of file %s */\n", aRes[i].zName);
374 printf("static const unsigned char bidata%d[%d] = {\n ",
375

Keyboard Shortcuts

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