lout-users
[Top][All Lists]
Advanced

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

Re: Can Lout Do This?


From: Valeriy E. Ushakov
Subject: Re: Can Lout Do This?
Date: Sat, 26 Apr 1997 04:15:22 +0400 (MSD)

Hi, Thomas. 

On Fri, 25 Apr 1997, you wrote:

> To: address@hidden

Please, note that the list address has changed.  The domain name is
"ptc.spbu.ru" now.  The old address still works though, but this may
change soon.

> 1. Be able to print a subset of the total
> pages in a document (with final page numbers).

This is actually not a Lout's job.  Lout produce documents that are
very very conformant to Adobe DSC (Document Structuring Conventions),
read the file `notes.dsc' in Lout distribution for the list of minor
deviations (caused mostly by standard being unclear or in
contradiction with itself).  Thus you can process Lout output with any
page utilities.  I for myself prefer PSUtils:

              ftp://ftp.dcs.ed.ac.uk/home/ftp/pub/ajcd/

> 2. Be able to have created automatically special
> page headers based on certain criteria on a final
> page. Specifically, classified documents typically
> have each object on a page (paragraphs, tables,
> and figures) marked with the lowest classification.
> The page itself is marked at top and bottom with
> the highest classification found on the page
> (including consideration of a continued object,
> such as a paragraph, from the previous page).

Yes, it's possible, if you're willing to spend some amount of time
experimenting.

[meanwhile, Ted Harding replies]  
 
| I don't know whether Lout can do it; but I can think of ways to
| approach this with troff (which may suggest approaches for Lout).

The problem is that Lout is very different from troff or TeX.  Troff
and TeX both use macro languages while Lout use functional language.
In Lout you don't have assignments and you can't generate new
definitions on the fly.  Still Lout has powerfull concepts ---
galleys, cross-references and tagging.

The following is a crude idea I can humbly suggest.  Package this
stuff in nice definitions according to taste.

    <code>

    # This symbol is marked and sent to the end of current page
    # at the begining and end of object
    export @Class
    def @Classified
      named @Tag {}                     # tell lout, we're going to use xrefs
      right @Class                      # store classification here
    { @Null }


    # This symbol is marked and kept at the beginning of object to
    # handle cross-overs
    export @Class
    def @ClassifiedBeginMark
      named @Tag {}                     # tell lout, we're going to use xrefs
      right @Class                      # store classification here
    { @Null }

    # IMPORTANT!!!  The whole trick depends on the next symbols being
    # placed in descending classification order at the end of each
    # page.  This will do the sort for you.

    # Targets to send @Classification into
    def @TopSecretP    { @Galley }
    def @ConfidentialP { @Galley }

    # Catch the classification of the current object in case it
    # neither begins nor ends on this page.  Put this one last.
    def @HandleCrossOver
    { @Classified { @ClassifiedBeginMark&&preceding @Open { @Class } } }

    # Use next four to mark your objects in your documents

    def @BeginConfidential 
    {
      def @SendConfidential
        into { @ConfidentialP&&following }
      { @Classified { Confidential } }
    
      @SendConfidential
      @ClassifiedBeginMark { Confidential }
    }
    
    def @BeginTopSecret 
    {
      def @SendTopSecret
        into { @TopSecretP&&following }
      { @Classified { Top Secret } }
    
      @SendTopSecret
      @ClassifiedBeginMark { Top Secret }
    }
    
    def @EndConfidential into { @ConfidentialP&&following }
    { @Classified { Confidential } }
    
    def @EndTopSecret into { @TopSecretP&&following }
    { @Classified { Top Secret } }

    # Use this one in your headers/footers.  It will retrieve the
    # classification of the most classified object on this page.
    def @Classification
    { @Classified&&following @Open { @Class } }
    
    </code>

Modify `dl' to have @TopSecretP @ConfidetialP and @HandleCrossOver at
the end of each page or place them in footers (hack hack):

    <example>
    # ...

    @OddTop        { address@hidden (@Classification) }
    @EvenTop       { address@hidden (@Classification) }
    @StartEvenTop  { address@hidden (@Classification) }
    @StartOddTop   { address@hidden (@Classification) }

    @OddFoot       { <@PageNum> (@Classification)
                     @TopSecretP @ConfidentialP @HandleCrossOver }
    @EvenFoot      { <@PageNum> (@Classification)
                     @TopSecretP @ConfidentialP @HandleCrossOver }
    @StartOddFoot  { <@PageNum> (@Classification)
                     @TopSecretP @ConfidentialP @HandleCrossOver }
    @StartEvenFoot { <@PageNum> (@Classification)
                     @TopSecretP @ConfidentialP @HandleCrossOver }
    # ...
    </example>

In your document:

    <example>
    
    @PP @BeginConfidential 
    Confidential material, eat as you read.
    @EndConfidential
    
    @PP @BeginTopSecret
    Top secret material, eat before read.
    @EndTopSecret
    
    </example>

Well, I'll try to explain it.  It's late night here and my reasoning
is somewhat obscure though, sorry for typos and bad grammar...

At the end of each page you have a sequence of receivers (@TopSecretP,
@ConfidentialP).

When you start an object you send appropriately marked @Classified
symbol to appropriate receiver at the end of page.  You also keep
another analogous symbol @ClassifiedBeginMark at the place your object
starts.  You will need it to handle cross overs.

Much the same way at the end of an object you again send appropriately
marked @Classified symbol to appropriate receiver at the end of page.

When page is over, receivers are filled with a bunch of @Classified
symbols, each appropriately marked.  To figure out what the most
secret object was you refer to the NEAREST @Classified symbol
(`following' keyword).  Since you have sorted receivers so that
receivers for more secret stuff comes first, the nearest @Classified
will be that of the most secret object on this page.  Since this
@Classified was appropriately marked you will retrive this mark.

Ok, but what if object spans multiple pages and there's a page on
which no object begins or ends.  Than our receivers on this page will
receive nothing!  But recall that when we started the last object
(that one that uses this page) we put @ClassifiedBeginMark with
appropriate mark.  So after our receivers we put @HandleCrossOver
symbol that queries the previous @ClassifiedBeginMark for its class
and put @Classified symbol with this mark.  Thus @Classification still
has correct @Classified&&following to refer to.

Bingo!

Hope it helps.

PS: A long day it was...

SY, Uwe
--
address@hidden                         |       Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/            |       Ist zu Grunde gehen


reply via email to

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