PROforma sessions

If you want to use PROforma, there are certain rules you have to follow to assure correct operation. The most important rules concern the order in which the operators have to be used. For instance, you should not change the transformation matrix during the building and drawing of a path. This is done because PROforma is built for efficiently. Everything has to be fast and flexible. This unfortunately means that robustness is not one of PROforma's strong points. Doing unexpected things may cause unexpected results.

To try to make things easier we will now give an outline of a common procedure for programs which generate their output using PROforma. That is for programs which are not interactive. A program which is interactive does not produce pages as suggested here. Generally speaking, the scheme will be very similar though.

The scheme listed here doesn't include two groups of operators. The operators which request information from the system, as these can be used between drawing commands, as they don't change anything in the system. Also some commands like PFPageScroll and PFWindowMove are not listed. These commands can also be used at about any moment.

There are some general notation used in the following scheme : command Execute the command. { command } The command can be repeated zero or more times. [ command ] The command can be executed at most once. command1 | command2 Either command1 or command2 will be executed. < command > Composite command, elaborated somewhere else in the scheme.
Of course these rules can be combined to form a more elaborate scheme.

< PROforma session > =
    PFInitGstate
    [ PFCopies ]
    /* FOR each page */
    {
        < Draw Page >
    }
    PFRemoveGstate

< Draw Page > =
    /* FOR each pass */
    {
        [ PFPaperColourGray | PFPaperColourRGB | PFPaperColourCMYK ]
        PFPageClear
        < Draw Pass >
        PFPageShow
    }

< Draw Pass > =
    /* FOR each object */
    {
        < Draw Object >
    }

< Draw Object > =
    [ PFPageScale ]
    [ PFPageBboxSet | PFPageOriginSet ]
    [ < Set Draw Parameters > ]
    [ PFSaveCTM ]
    {
        < Draw Path > | < Draw Text > | < Draw Picture >
    }
    [ PFRestoreCTM | PFResetCTM ]
    [ PFPageBboxReset | PFPageBboxRestore ]
    [ PFClearClip ]

< Set Draw Parameters > =
    [ < Change CTM > ]
    [ PFLineWidth ]
    [ PFColourGray | PFColourRGB | PFColourCMYK ]
    [ PFFlatness ]
    [ PFPathMethod | PFPathStroked | PFPathFilled | PFPathEOFilled ]

< Change CTM > =
    {
        PFCTMSet | PFCTMMove | PFCTMScale | PFCTMXScale | PFCTMYScale
    }

< Draw Path > =
    < Draw First Subpath >
    {
        [ < Draw Subpath > ]
    }
    PFPathDraw | PFPathClip | PFPathClear

< Draw First Subpath > =
    PFMoveTo
    {
        PFLineTo | PFLineR | PFCurveTo | PFCurveR
    }
    [ PFPathClose ]

< Draw Subpath > =
    [ PFMoveTo | PFMoveR ]
    {
        PFLineTo | PFLineR | PFCurveTo | PFCurveR
    }
    [ PFPathClose ]

< Draw Text > =
    [ PFFontLoad ]
    [ < Set Text Parameters > ]
    [ PFCacheUse ]
    [ PFPrintEscape ]
    [ PFExtraEOS ]
    PFMoveTo
    {
        PFShow         | PFStringShow
        PFShowKern     | PFStringShowKern
        PFShowX        | PFStringShowX
        PFShowXY       | PFStringShowXY
        PFShowTrack    | PFStringShowTrack
        PFShowJust     | PFStringShowJust
        PFShowKernJust | PFStringShowKernJust
    }
    [ PFFontUnLoad ]
    [ PFCacheUse ]

< Set Text Parameters > =
    [ PFFontSelect ]
    [ PFFontScale ]

< Draw Picture > =
    PFMoveTo
    .....

PROGS, Professional & Graphical Software
last edited February 13, 1996