MCPcopy Create free account
hub / github.com/RsyncProject/rsync / gen_trees_header

Function gen_trees_header

zlib/trees.c:325–372  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

323 ((i) % (width) == (width)-1 ? ",\n" : ", "))
324
325void gen_trees_header(void)
326{
327 FILE *header = fopen("trees.h", "w");
328 int i;
329
330 Assert (header != NULL, "Can't open trees.h");
331 fprintf(header,
332 "/* header created automatically with -DGEN_TREES_H */\n\n");
333
334 fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n");
335 for (i = 0; i < L_CODES+2; i++) {
336 fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code,
337 static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5));
338 }
339
340 fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n");
341 for (i = 0; i < D_CODES; i++) {
342 fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code,
343 static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
344 }
345
346 fprintf(header, "const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n");
347 for (i = 0; i < DIST_CODE_LEN; i++) {
348 fprintf(header, "%2u%s", _dist_code[i],
349 SEPARATOR(i, DIST_CODE_LEN-1, 20));
350 }
351
352 fprintf(header,
353 "const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
354 for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) {
355 fprintf(header, "%2u%s", _length_code[i],
356 SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));
357 }
358
359 fprintf(header, "local const int base_length[LENGTH_CODES] = {\n");
360 for (i = 0; i < LENGTH_CODES; i++) {
361 fprintf(header, "%1u%s", base_length[i],
362 SEPARATOR(i, LENGTH_CODES-1, 20));
363 }
364
365 fprintf(header, "local const int base_dist[D_CODES] = {\n");
366 for (i = 0; i < D_CODES; i++) {
367 fprintf(header, "%5u%s", base_dist[i],
368 SEPARATOR(i, D_CODES-1, 10));
369 }
370
371 fclose(header);
372}
373#endif /* GEN_TREES_H */
374
375/* ===========================================================================

Callers 1

tr_static_initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected