MCPcopy Create free account
hub / github.com/apache/cloudberry / print_latex_longtable_text

Function print_latex_longtable_text

src/fe_utils/print.c:2447–2600  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2445
2446
2447static void
2448print_latex_longtable_text(const printTableContent *cont, FILE *fout)
2449{
2450 bool opt_tuples_only = cont->opt->tuples_only;
2451 unsigned short opt_border = cont->opt->border;
2452 unsigned int i;
2453 const char *opt_table_attr = cont->opt->tableAttr;
2454 const char *next_opt_table_attr_char = opt_table_attr;
2455 const char *last_opt_table_attr_char = NULL;
2456 const char *const *ptr;
2457
2458 if (cancel_pressed)
2459 return;
2460
2461 if (opt_border > 3)
2462 opt_border = 3;
2463
2464 if (cont->opt->start_table)
2465 {
2466 /* begin environment and set alignments and borders */
2467 fputs("\\begin{longtable}{", fout);
2468
2469 if (opt_border >= 2)
2470 fputs("| ", fout);
2471
2472 for (i = 0; i < cont->ncolumns; i++)
2473 {
2474 /* longtable supports either a width (p) or an alignment (l/r) */
2475 /* Are we left-justified and was a proportional width specified? */
2476 if (*(cont->aligns + i) == 'l' && opt_table_attr)
2477 {
2478#define LONGTABLE_WHITESPACE " \t\n"
2479
2480 /* advance over whitespace */
2481 next_opt_table_attr_char += strspn(next_opt_table_attr_char,
2482 LONGTABLE_WHITESPACE);
2483 /* We have a value? */
2484 if (next_opt_table_attr_char[0] != '\0')
2485 {
2486 fputs("p{", fout);
2487 fwrite(next_opt_table_attr_char, strcspn(next_opt_table_attr_char,
2488 LONGTABLE_WHITESPACE), 1, fout);
2489 last_opt_table_attr_char = next_opt_table_attr_char;
2490 next_opt_table_attr_char += strcspn(next_opt_table_attr_char,
2491 LONGTABLE_WHITESPACE);
2492 fputs("\\textwidth}", fout);
2493 }
2494 /* use previous value */
2495 else if (last_opt_table_attr_char != NULL)
2496 {
2497 fputs("p{", fout);
2498 fwrite(last_opt_table_attr_char, strcspn(last_opt_table_attr_char,
2499 LONGTABLE_WHITESPACE), 1, fout);
2500 fputs("\\textwidth}", fout);
2501 }
2502 else
2503 fputc('l', fout);
2504 }

Callers 1

printTableFunction · 0.85

Calls 1

latex_escaped_printFunction · 0.85

Tested by

no test coverage detected