static char sccsid
[] = "@(#)specs.c 1.2 (CWI) 85/10/02";
* read table specification
* Must allow one extra for line at right.
* clear out and default every specification
for(icol
= 0; icol
< MAXCOL
; icol
++){
* ... and each specification "line".
for(i
= 0; i
< MAXHEAD
; i
++){
font
[i
][icol
][0] = lefline
[i
][icol
] = 0;
for(i
= 0; i
< ncol
; i
++)
printf(" %2s", reg(i
, CRIGHT
));
* Read specification part of table description
int icol
, c
, sawchar
, stopc
, i
;
char sn
[10], *snp
, *temp
;
error("bad table specification character");
* note this is also case tab
if(sawchar
== 0) /* empty line? (jna) */
* end of table specification
if(lefline
[nclin
][ncol
] > 0){
error("too many lines in specification");
if(ncol
== 0 || nclin
== 0)
error("no specification");
while((c
= get1char()) && c
!= '\n')
if(c
!= ' ' && c
!= '\t')
error("dot not last character on format line");
* fix up sep - default is 3 except
for(icol
= 0; icol
< ncol
; icol
++)
sep
[icol
] = icol
+ 1 < ncol
? 3 : 1;
error("tried to widen table in T&, not allowed");
if(c
== 's' && icol
<= 0)
error("first column can not be S-type");
if(c
== 's' && style
[nclin
][icol
- 1] == 'a'){
printf(".tm warning: can't span a-type cols, changed to l\n");
style
[nclin
][icol
- 1] = 'l';
if(c
== 's' && style
[nclin
][icol
- 1] == 'n'){
printf(".tm warning: can't span n-type cols, changed to c\n");
style
[nclin
][icol
- 1] = 'c';
if(c
== '^' && nclin
<= 0)
error("first row can not contain vertical span");
error("too many columns in table");
snp
= font
[nclin
][icol
- 1];
snp
[0] = (c
== 'I' ? '2' : '3');
ctop
[nclin
][icol
- 1] |= CTOP
;
ctop
[nclin
][icol
- 1] |= CDOWN
;
snp
= font
[nclin
][icol
- 1];
snp
[0] = snp
[1] = stopc
= 0;
error("Nonterminated font name");
temp
= snp
= csize
[nclin
][icol
- 1];
if(c
== ' ' || c
== tab
|| c
== '\n')
if(c
== '-' || c
== '+') {
error("point size too large");
error("point size unreasonable");
temp
= snp
= vsize
[nclin
][icol
- 1];
if(c
== ' ' || c
== tab
|| c
== '\n')
if(c
== '-' || c
== '+') {
error("vertical spacing value too large");
* Dale Smith didn't like this check - possible to
* have two text blocks of different widths now ....
printf("Ignored second width specification");
* end commented out code ...
if(snp
== cll
[icol
- 1] && c
== '('){
if(!stopc
&& (c
> '9' || c
< '0'))
if(snp
- cll
[icol
- 1] > CLLEN
)
error("column width too long");
* Zero width - ignore width this item
ctop
[nclin
][icol
- 1] |= ZEROW
;
ctop
[nclin
][icol
- 1] |= HALFUP
;
while(isdigit(*snp
++ = c
= get1char ()))
sep
[icol
- 1] = max(sep
[icol
- 1], atoi(sn
));
error("EOF reading table specification");
* findcol counts the number of columns and then puts the line back
char *s
, line
[FLNLIM
+ 2], *p
;
while((c
= get1char()) != EOF
&& c
== ' ')
for(s
= line
; *s
= c
= get1char(); s
++){
if(c
== '\n' || c
== EOF
|| c
== '.' || c
== ',')
else if(s
>= line
+ FLNLIM
)
error("too long spec line");
for(p
= line
; p
< s
; p
++){