summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/cmsys.h1
-rw-r--r--include/visio.h24
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