MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / gen_trees_header

Function gen_trees_header

zlib/trees.c:330–376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

tr_static_initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected