MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / gen_trees_header

Function gen_trees_header

extern/zlib/src/trees.c:387–433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

385 ((i) % (width) == (width) - 1 ? ",\n" : ", "))
386
387void gen_trees_header(void) {
388 FILE *header = fopen("trees.h", "w");
389 int i;
390
391 Assert (header != NULL, "Can't open trees.h");
392 fprintf(header,
393 "/* header created automatically with -DGEN_TREES_H */\n\n");
394
395 fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n");
396 for (i = 0; i < L_CODES+2; i++) {
397 fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code,
398 static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5));
399 }
400
401 fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n");
402 for (i = 0; i < D_CODES; i++) {
403 fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code,
404 static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
405 }
406
407 fprintf(header, "const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n");
408 for (i = 0; i < DIST_CODE_LEN; i++) {
409 fprintf(header, "%2u%s", _dist_code[i],
410 SEPARATOR(i, DIST_CODE_LEN-1, 20));
411 }
412
413 fprintf(header,
414 "const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
415 for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) {
416 fprintf(header, "%2u%s", _length_code[i],
417 SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));
418 }
419
420 fprintf(header, "local const int base_length[LENGTH_CODES] = {\n");
421 for (i = 0; i < LENGTH_CODES; i++) {
422 fprintf(header, "%1u%s", base_length[i],
423 SEPARATOR(i, LENGTH_CODES-1, 20));
424 }
425
426 fprintf(header, "local const int base_dist[D_CODES] = {\n");
427 for (i = 0; i < D_CODES; i++) {
428 fprintf(header, "%5u%s", base_dist[i],
429 SEPARATOR(i, D_CODES-1, 10));
430 }
431
432 fclose(header);
433}
434#endif /* GEN_TREES_H */
435
436/* ===========================================================================

Callers 1

tr_static_initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected