MCPcopy Create free account
hub / github.com/F-Stack/f-stack / gen_trees_header

Function gen_trees_header

freebsd/contrib/zlib/trees.c:326–373  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

tr_static_initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected