texmacs-dev
[Top][All Lists]
Advanced

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

[Texmacs-dev] Table converision library


From: david
Subject: [Texmacs-dev] Table converision library
Date: Wed, 5 Feb 2003 14:54:34 +0100
User-agent: Mutt/1.4i

On Wed, Feb 05, 2003 at 01:34:03PM +0100, Joris van der Hoeven wrote:
> 
> 1048, 1051, [...] 1071:
>   Please explain the functionality of a scheme library
>   for table manipulation and conversions.

Patches 1048 and 1071 are just regression tests for tmtex. So they are
independant of the table manipulation library.

However I see a use for a library of tools for regression testing. In
that case, the functions used to produce tm-tables for testing the
converter are usable by any converter. It is important that the
regression testing tools do not overlap with tools which do actual
work, because it reduce the likelihood of common failure modes.

I think it is a bit early to set a definitive design for the table
conversion library but I will explain the general idea behind patch
1051.

The tm-table-parser (currently tmtex-table-parser) uses an
object-oriented approach to provide modular, thread-safe and
referentially transparent parsing of table formatting for use in
converters. It creates a table-parser closure given a table-default
list and a table-definition.

A table-default list is a list of 'twith' and 'cwith' elements, it is
meant to hold the default table settings which are set by the macro
expansion enclosing the table definition. For example 'block*' sets a
global border and centered horizontal alignement for all cells.

A table-definition is a Scheme tree whose root is a 'tformat' or a
'table'. It is meant to be the value of a table macro argument.

The table information is accessed by evaluating table-parser closure
with different arguments. The first argument is a symbol and denote
the scope of the property being accessed. Different scope require
different additional arguments. Currently existing scopes are:

Iterator scopes:

  rows: name -> list of values
    Values of the named property as it is defined for whole rows.

  cols: name -> list of values
    Values of the named property as it is defined for whole columns.

Synthetic scope:

  global: name -> value
    Synthetic properties, as a boolean 'border' value, the number of
    rows and columns.

Currently envisioned future scopes...

Physical scopes:

  row: number name -> value
    Value of the named property for a given numbered row.

  col: number name -> value
    Value of the named property for a given numbered column.

  cell: rownum colnum name -> value
    Value of the named property for a given cell.

  table: name -> value
    Value of a table property.

It must be noted that smaller scopes may provide information which is
not available to wider scopes. For example a column may define a
column-wide bottom border of "1ln", and one cell of this column may
define a bottom border of "0ln".

The 'rows' and 'cols' scopes are shorthand for mapping the access of
the property on all 'row' and 'col' scopes.

Properties are named by symbols. They match table properties used by
the typesetter. Rows, columns and cells also define the extra property
'content' which gives the table data. Rows content is the table data
as a list of lists in natural order, columns content is the table data
in transposed order, cell content is the actual content of the
designated TeXmacs cell element

Handling of subtables and decorations is not yet defined, but I
believe the current design to be generic enough.

There could also be some accessors for grouping scopes, which might be
useful to carry the meaning of cwith on ranges which are not simple
rows, columns. But maybe that would only be really meaningful when
TeXmacs has a real support for row groups and column groups.

Maybe that is all crap. If you think so, please propose another design
which provides the same level of encapsulation and extensibility.

-- 
David Allouche         | GNU TeXmacs -- Writing is a pleasure
Free software engineer |    http://www.texmacs.org
   http://ddaa.net     |    http://alqua.com/tmresources
   address@hidden  |    address@hidden
TeXmacs is NOT a LaTeX front-end and is unrelated to emacs.




reply via email to

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