/* This is not a particularly great place for this ... */ #ifndef __CYGWIN__ #define DEFAULT_PAGER "more" #else #define DEFAULT_PAGER "less" #endif
enum printFormat
{
PRINT_NOTHING = 0, /* to make sure someone initializes this */
PRINT_ALIGNED,
PRINT_ASCIIDOC,
PRINT_CSV,
PRINT_HTML,
PRINT_LATEX,
PRINT_LATEX_LONGTABLE,
PRINT_TROFF_MS,
PRINT_UNALIGNED,
PRINT_WRAPPED, /* add your favourite output format here ... */
};
typedefstruct printTextLineFormat
{ /* Line drawing characters to be used in various contexts */
const char *hrule; /* horizontal line character */
const char *leftvrule; /* left vertical line (+horizontal) */
const char *midvrule; /* intra-column vertical line (+horizontal) */
const char *rightvrule; /* right vertical line (+horizontal) */
} printTextLineFormat;
typedefenum printTextRule
{ /* Additional context for selecting line drawing characters */
PRINT_RULE_TOP, /* top horizontal line */
PRINT_RULE_MIDDLE, /* intra-data horizontal line */
PRINT_RULE_BOTTOM, /* bottom horizontal line */
PRINT_RULE_DATA, /* data line (hrule is unused here) */
} printTextRule;
typedefenum printTextLineWrap
{ /* Line wrapping conditions */
PRINT_LINE_WRAP_NONE, /* No wrapping */
PRINT_LINE_WRAP_WRAP, /* Wraparound due to overlength line */
PRINT_LINE_WRAP_NEWLINE, /* Newline in data */
} printTextLineWrap;
typedefenum printXheaderWidthType
{ /* Expanded header line width variants */
PRINT_XHEADER_FULL, /* do not truncate header line (this is the
* default) */
PRINT_XHEADER_COLUMN, /* only print header line above the first
* column */
PRINT_XHEADER_PAGE, /* header line must not be longer than
* terminal width */
PRINT_XHEADER_EXACT_WIDTH, /* explicitly specified width */
} printXheaderWidthType;
typedefstruct printTextFormat
{ /* A complete line style */
const char *name; /* for display purposes */
printTextLineFormat lrule[4]; /* indexed by enum printTextRule */
const char *midvrule_nl; /* vertical line for continue after newline */
const char *midvrule_wrap; /* vertical line for wrapped data */
const char *midvrule_blank; /* vertical line for blank data */
const char *header_nl_left; /* left mark after newline */
const char *header_nl_right; /* right mark for newline */
const char *nl_left; /* left mark after newline */
const char *nl_right; /* right mark for newline */
const char *wrap_left; /* left mark after wrapped data */
const char *wrap_right; /* right mark for wrapped data */ bool wrap_right_border; /* use right-hand border for wrap marks
* when border=0? */
} printTextFormat;
typedefstruct printTableOpt
{ enum printFormat format; /* see enum above */ unsignedshortint expanded; /* expanded/vertical output (if supported
* by output format); 0=no, 1=yes, 2=auto */
printXheaderWidthType expanded_header_width_type; /* width type for header
* line in expanded mode */ int expanded_header_exact_width; /* explicit width for header
* line in expanded mode */ unsignedshortint border; /* Print a border around the table. 0=none,
* 1=dividing lines, 2=full */ unsignedshortint pager; /* use pager for output (if to stdout and
* stdout is a tty) 0=off 1=on 2=always */ int pager_min_lines; /* don't use pager unless there are at
* least this many lines */ bool tuples_only; /* don't output headers, row counts, etc. */ bool start_table; /* print start decoration, eg <table> */ bool stop_table; /* print stop decoration, eg </table> */ bool default_footer; /* allow "(xx rows)" default footer */ unsignedlong prior_records; /* start offset for record counters */
const printTextFormat *line_style; /* line style (NULL for default) */ struct separator fieldSep; /* field separator for unaligned text mode */ struct separator recordSep; /* record separator for unaligned text mode */
char csvFieldSep[2]; /* field separator for csv format */ bool numericLocale; /* locale-aware numeric units separator and
* decimal marker */
char *tableAttr; /* attributes for HTML <table ...> */ int encoding; /* character encoding */ int env_columns; /* $COLUMNS on psql start, 0 is unset */ int columns; /* target width for wrapped format */
unicode_linestyle unicode_border_linestyle;
unicode_linestyle unicode_column_linestyle;
unicode_linestyle unicode_header_linestyle;
} printTableOpt;
/* *Thetablecontentstructholdsalltheinformationwhichwillbedisplayed *byprintTable().
*/ typedefstruct printTableContent
{
const printTableOpt *opt;
const char *title; /* May be NULL */ int ncolumns; /* Specified in Init() */ int nrows; /* Specified in Init() */
const char **headers; /* NULL-terminated array of header strings */
const char **header; /* Pointer to the last added header */
const char **cells; /* NULL-terminated array of cell content
* strings */
const char **cell; /* Pointer to the last added cell */
uint64 cellsadded; /* Number of cells added this far */ bool *cellmustfree; /* true for cells that need to be free()d */
printTableFooter *footers; /* Pointer to the first footer */
printTableFooter *footer; /* Pointer to the last added footer */
char *aligns; /* Array of alignment specifiers; 'l' or 'r',
* one per column */
char *align; /* Pointer to the last added alignment */
} printTableContent;
typedefstruct printQueryOpt
{
printTableOpt topt; /* the options above */
char *nullPrint; /* how to print null entities */
char *title; /* override title */
char **footers; /* override footer (default is "(xx rows)") */ bool translate_header; /* do gettext on column headers */
const bool *translate_columns; /* translate_columns[i-1] => do gettext on
* col i */ int n_translate_columns; /* length of translate_columns[] */
} printQueryOpt;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.