1 /* $Id: table.h,v 1.12 2003/09/22 21:02:21 ukai Exp $ */
2 #if (defined(MESCHACH) && !defined(MATRIX))
3 #define MATRIX
4 #endif				/* (defined(MESCHACH) && !defined(MATRIX)) */
5 
6 #ifdef MATRIX
7 #ifdef MESCHACH
8 #include <matrix2.h>
9 #else				/* not MESCHACH */
10 #include "matrix.h"
11 #endif				/* not MESCHACH */
12 #endif				/* MATRIX */
13 
14 #include "Str.h"
15 
16 #define MAX_TABLE 20		/* maximum nest level of table */
17 #define MAX_TABLE_N_LIMIT 2000
18 #define MAX_TABLE_N 20		/* maximum number of table in same level */
19 
20 #define MAXROW_LIMIT 32767
21 #define MAXROW 50
22 #define MAXCOL 256
23 
24 #define MAX_WIDTH 80
25 
26 #define BORDER_NONE 0
27 #define BORDER_THIN 1
28 #define BORDER_THICK 2
29 #define BORDER_NOWIN 3
30 
31 typedef unsigned short table_attr;
32 
33 /* flag */
34 #define TBL_IN_ROW     1
35 #define TBL_EXPAND_OK  2
36 #define TBL_IN_COL     4
37 
38 #define MAXCELL 20
39 #define MAXROWCELL 1000
40 struct table_cell {
41     short col[MAXCELL];
42     short colspan[MAXCELL];
43     short index[MAXCELL];
44     short maxcell;
45     short icell;
46 #ifdef MATRIX
47     short eindex[MAXCELL];
48     short necell;
49 #endif				/* MATRIX */
50     short width[MAXCELL];
51     short minimum_width[MAXCELL];
52     short fixed_width[MAXCELL];
53 };
54 
55 struct table_in {
56     struct table *ptr;
57     short col;
58     short row;
59     short cell;
60     short indent;
61     TextLineList *buf;
62 };
63 
64 struct table_linfo {
65     Lineprop prev_ctype;
66     signed char prev_spaces;
67     Str prevchar;
68     short length;
69 };
70 
71 struct table {
72     int row;
73     int col;
74     int maxrow;
75     int maxcol;
76     int max_rowsize;
77     int border_mode;
78     int total_width;
79     int total_height;
80     int tabcontentssize;
81     int indent;
82     int cellspacing;
83     int cellpadding;
84     int vcellpadding;
85     int vspace;
86     int flag;
87 #ifdef TABLE_EXPAND
88     int real_width;
89 #endif				/* TABLE_EXPAND */
90     Str caption;
91 #ifdef ID_EXT
92     Str id;
93 #endif
94     GeneralList ***tabdata;
95     table_attr **tabattr;
96     table_attr trattr;
97 #ifdef ID_EXT
98     Str **tabidvalue;
99     Str *tridvalue;
100 #endif
101     short tabwidth[MAXCOL];
102     short minimum_width[MAXCOL];
103     short fixed_width[MAXCOL];
104     struct table_cell cell;
105     int *tabheight;
106     struct table_in *tables;
107     short ntable;
108     short tables_size;
109     TextList *suspended_data;
110     /* use for counting skipped spaces */
111     struct table_linfo linfo;
112 #ifdef MATRIX
113     MAT *matrix;
114     VEC *vector;
115 #endif				/* MATRIX */
116     int sloppy_width;
117 };
118 
119 #define TBLM_PRE	RB_PRE
120 #define TBLM_SCRIPT	RB_SCRIPT
121 #define TBLM_STYLE	RB_STYLE
122 #define TBLM_PLAIN	RB_PLAIN
123 #define TBLM_NOBR	RB_NOBR
124 #define TBLM_PRE_INT	RB_PRE_INT
125 #define TBLM_INTXTA	RB_INTXTA
126 #define TBLM_INSELECT	RB_INSELECT
127 #define TBLM_PREMODE	(TBLM_PRE | TBLM_PRE_INT | TBLM_SCRIPT | TBLM_STYLE | TBLM_PLAIN | TBLM_INTXTA)
128 #define TBLM_SPECIAL	(TBLM_PRE | TBLM_PRE_INT | TBLM_SCRIPT | TBLM_STYLE | TBLM_PLAIN | TBLM_NOBR)
129 #define TBLM_DEL	RB_DEL
130 #define TBLM_S		RB_S
131 #define TBLM_ANCHOR	0x1000000
132 
133 struct table_mode {
134     unsigned int pre_mode;
135     char indent_level;
136     char caption;
137     short nobr_offset;
138     char nobr_level;
139     short anchor_offset;
140     unsigned char end_tag;
141 };
142 
143 /* Local Variables:    */
144 /* c-basic-offset: 4   */
145 /* tab-width: 8        */
146 /* End:                */
147