diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-04-16 01:08:07 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-04-16 01:08:07 +0800 |
commit | a38ce8fbc7b7b18ad75f86278fe25fd85ba485d2 (patch) | |
tree | 5a227cdba379a203155bbaf91b8b2323a2130a3c /include | |
parent | db9187feb31e50ed2fbe78f7fd73bf8d37bf0edc (diff) | |
download | pttbbs-a38ce8fbc7b7b18ad75f86278fe25fd85ba485d2.tar pttbbs-a38ce8fbc7b7b18ad75f86278fe25fd85ba485d2.tar.gz pttbbs-a38ce8fbc7b7b18ad75f86278fe25fd85ba485d2.tar.bz2 pttbbs-a38ce8fbc7b7b18ad75f86278fe25fd85ba485d2.tar.lz pttbbs-a38ce8fbc7b7b18ad75f86278fe25fd85ba485d2.tar.xz pttbbs-a38ce8fbc7b7b18ad75f86278fe25fd85ba485d2.tar.zst pttbbs-a38ce8fbc7b7b18ad75f86278fe25fd85ba485d2.zip |
- (internal) visio: add columned output API.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4170 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'include')
-rw-r--r-- | include/cmsys.h | 1 | ||||
-rw-r--r-- | include/visio.h | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/include/cmsys.h b/include/cmsys.h index 14d3c1ba..0401da26 100644 --- a/include/cmsys.h +++ b/include/cmsys.h @@ -80,6 +80,7 @@ extern void str_lower(char *t, const char *s); extern void trim(char *buf); extern void chomp(char *src); extern int strlen_noansi(const char *s); +extern int strat_ansi(int count, const char *s); extern int strip_blank(char *cbuf, char *buf); extern int strip_ansi(char *buf, const char *str, enum STRIP_FLAG flag); extern void strip_nonebig5(unsigned char *str, int maxlen); diff --git a/include/visio.h b/include/visio.h index 986be0df..af8cf4dd 100644 --- a/include/visio.h +++ b/include/visio.h @@ -9,6 +9,7 @@ #include "bbs.h" #include "ansi.h" // we need it. +#include <limits.h> // THEME DEFINITION ---------------------------------------------------- #define VCLR_HEADER ANSI_COLOR(1;37;46) // was: TITLE_COLOR @@ -30,10 +31,28 @@ #define VMSG_HDR_PREFIX "Ħi " #define VMSG_HDR_POSTFIX " Ħj" +// CONSTANT DEFINITION ------------------------------------------------- +#define VCOL_ALIGN_LEFT (0) +#define VCOL_ALIGN_RIGHT (1) +// #define VCOL_ALIGN_MIDDLE (2) +#define VCOL_MAXW (INT16_MAX) + // DATATYPE DEFINITION ------------------------------------------------- typedef void * VREFSCR; typedef long VREFCUR; +typedef short VCOLW; +typedef struct { + char *caption; + char *attr; // default attribute + VCOLW minw; // minimal width + VCOLW maxw; // max width + char has_ansi; // support ANSI escape sequence + char align; // alignment + char usewhole; // draw entire column, not leaving borders + char flag; // reserved +} VCOL; + // API DEFINITION ---------------------------------------------------- // int vans(char *prompt); // prompt at bottom and return y/n in lower case. // void vs_bar(char *title); // like stand_title @@ -56,6 +75,11 @@ void vs_header (const char *title, const char *mid, const char *right); // vs_ void vs_hdr (const char *title); // vs_bar, stand_title void vs_footer (const char *caption, const char *prompt); +// columned output +void vs_cols_layout (const VCOL* cols, VCOLW *ws, int n); +void vs_cols_hdr (const VCOL* cols, const VCOLW *ws, int n); +void vs_cols (const VCOL* cols, const VCOLW *ws, int n, ...); + // compatible macros #define stand_title vs_hdr |