groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] Meta-tbl: still shorter and faster !


From: baruchel
Subject: Re: [Groff] Meta-tbl: still shorter and faster !
Date: Mon, 7 Aug 2000 10:00:26 +0200
User-agent: Mutt/1.2.5i

Brest, le lundi 7 août

Hi

it's still me. If you're bored of reading me again, don't be afraid of telling
it, but it's really a great help for me to have your comments.

I removed some useless loops:

* I previously looked for the right border of last column and compared it with
  \n(TW (which is the extreme right border of the table). If it was not the
  same, I could know that there was a doublebox. My test now is: look at
  \n[3cd0] (left border of first column). If it is greater than 0 (extreme left
  border of the table), it means that there is a doublebox. So I don't have a
  loop AT EACH TIME I'm filling a cell of the bottom line. It's much faster.
  
* I previously filled the whole table with two loops and then filled the
  cells one by one. It's a big job, and a big job for 'grops' too. Now, which is
  more logical, I draw a big box.

* one line was useless in .de m4tshd

Next step:
==========
* removing the .M4Tinitc .M4Tlastc macros and M4TLC register
  (which are now used by the line-filling macro) by using
  \n(TW-2\n[3cd0] to have the length of the line to fill
* removing the loop in column-filling macro which is not really usefull now.

Further:
========
* add funny features like hachuring (is it the word) by an original way:
  the tmac.4t macros would determine the position and the postprocessor would
  do all the job by adding many lines of output code.
* any suggestion would interest me

Send your comments ;-)

================================================================================
.de M4T \" marks the beginning of the table
\\!# Here starts a new M4T table
\\!m4t: init
.M4Tinitc 1
.rr ZZ
..
.de M4Tinitc \" remove some registers in case of greater previous table
.if r 3cd\\$1 .if \\n[3cd\\$1] \{\
.                   rr 3cd\\$1
.                   nr ZZ \\$1+1
.                   M4Tinitc \\n(ZZ
.\}
..
.de M4Tlastc \" looks for the last column
.nr ZZ \\$1+1
.nr ZZ \\$1+1
.if r 3cd\\n(ZZ .if \\n[3cd\\n(ZZ] \{\
.                     M4Tlastc \\n(ZZ
.                     nr M4TLC +1
.\}
..
.de m4tfc
.nr m4ti \\$1-1
.nr m4tj \\$2-1
.nr m4tk \\n[3cd\\n[m4ti]]+\\n[3ind]+\\n(.o
.nr m4tl \\n[3cd\\$1]-\\n[3cd\\n[m4ti]]
.nr m4th \\n[3rt\\$2]-\\n[3rt\\n[m4tj]]
.\" Next lines seem to fix the bug for the last line of the table
.  if !\\n[m4th] \{\
.  nr m4th \\n[3rt0]+\\n[3bot]-\\n[3rt\\n[m4tj]]
.  \" Next lines is in case of doublebox:
.    nr m4th -\\n[3cd0]
.\}
\\!m4t: H\\n[m4tk]
\\!m4t: V\\n[3rt\\n[m4tj]]
.nr m4tk .25m
\\!m4t: v\\n[m4tk]
\\!m4t: Df \\$3 0
\\!m4t: DP \\n[m4tl] 0 0 \\n[m4th] -\\n[m4tl] 0 0 -\\n[m4th]
\\!m4t: Df 0 0
..
.de m4tlf
.nr M4TLC 0
.M4Tlastc 0 \" looks for the last column
.M4TfillL \\n[M4TLC] \\$1 \\$2
.rr ZZ
..
.de M4TfillL
.m4tfc \\$1 \\$2 \\$3
.nr ZZ \\$1-1
.if \\n(ZZ .M4TfillL \\n(ZZ \\$2 \\$3
..
.de m4tcf
.nr M4TLL \\n[3crow]+1
.M4TfillC \\n[M4TLL] \\$1 \\$2
.rr ZZ
..
.de M4TfillC
.m4tfc \\$2 \\$1 \\$3
.nr ZZ \\$1-1
.if \\n(ZZ .M4TfillC \\n(ZZ \\$2 \\$3
..
.de m4tfa
.nr M4TLC 0
.M4Tlastc 0
.nr m4tj \\n[3rt0]+.25m
\\!m4t: V\\n[m4tj]
.nr m4ti \\n[3ind]+\\n(.o+\\n[3cd0]
\\!m4t: H\\n[m4ti]
\\!m4t: Df \\$1 0
.nr m4tl \\n[3crow]+1 \" number of the last line
.nr m4th \\n[3rt\\n[m4tl]]-\\n[3rt0] \" height if no border around the table
.if !(\\n[3rt\\n[m4tl]]-\\n[3rt\\n[3crow]]) .nr m4th \\n[3bot] \" with border
.nr m4th -\\n[3cd0] \" in case of doublebox
.nr m4tk \\n[3cd\\n[M4TLC]]-\\n[3cd0]
\\!m4t: DP \\n[m4tk] 0 0 \\n[m4th] -\\n[m4tk] 0 0 -\\n[m4th]
\\!m4t: Df 0 0
..
.de m4tshd
.nr m4tk \\$2*1p
.if !\\n[m4tk] .nr m4tk 2p
.nr m4tj \\n[3rt0]+.25m
\\!m4t: V\\n[m4tj]
.nr m4ti \\n[3ind]+\\n(.o
\\!m4t: H\\n[m4ti]
\\!m4t: v\\n[m4tk]
\\!m4t: h\\n[m4tk]
\\!m4t: Df \\$1 0
.nr m4tl \\n[3crow]+1 \" number of the last line
.nr m4th \\n[3rt\\n[m4tl]]-\\n[3rt0] \" height if no border around the table
.if !(\\n[3rt\\n[m4tl]]-\\n[3rt\\n[3crow]]) .nr m4th \\n[3bot] \" with border
.nr m4th +2(\\n[3cd0]) \" in case of doublebox
\\!m4t: DP \\n(TW 0 0 \\n[m4th] -\\n(TW 0 0 -\\n[m4th]
\\!m4t: V\\n[m4tj]
\\!m4t: H\\n[m4ti]
\\!m4t: Df 0 0
\\!m4t: DP \\n(TW 0 0 \\n[m4th] -\\n(TW 0 0 -\\n[m4th]
..

reply via email to

[Prev in Thread] Current Thread [Next in Thread]