ADC Home > Reference Library > Technical Notes > Legacy Documents > Printing >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

PrGeneral Bug

CONTENTS

This technical note documents a bug in the implementation of the PrGeneral procedure in the LaserWriter driver version 4.0. The bug has to do with the format of the information returned by the GetRslData opcode. This technical note will also describe a workaround for the problem.

[Nov 01 1987]






Introduction

One of the opcodes supported by the PrGeneral procedure (Technical Note #128) is named GetRslData. The GetRslData operation initializes a resolution record that is of the following form:

    TRslRg = RECORD {used in TGetRslBlk}
        iMin:    Integer;    {0 if printer only supports discrete resolutions}
        iMax:    Integer;    {0 if printer only supports discrete
                                     resolutions}
    END;

    TRslRec = RECORD    {used in TGetRslBlk}
        iXRsl:    Integer;    {a discrete, physical X resolution}
        iYRsl:    Integer;    {a discrete, physical Y resolution}
    END;

    TGetRslBlk = RECORD {data block for GetRslData call}
        iOpCode:    Integer;    {input; = getRslDataOp}
        iError:     Integer;    {output}
        lReserved:    LongInt;    {reserved for future use}
        iRgType:    Integer;    {output; this declaration is for RgType1}
        XRslRg:     TRslRg;     {output; range of X resolutions}
        YRslRg:     TRslRg;     {output; range of Y resolutions}
        iRslRecCnt: Integer;    {output; how many RslRecs follow}
        rgRslRec:    ARRAY[1..27]
                OF TRslRec; {output; number used depends on printer type}

The LaserWriter 4.0 implementation has a bug that affects the YRslRg and XRslRg fields of the TGetRslBlk record. The correct values for the fields are:

        TGetRslBlk.XRslRg.iMin := 25;
        TGetRslBlk.XRslRg.iMax := 1500;
        TGetRslBlk.YRslRg.iMin := 25;

Unfortunately, the information returned by the LaserWriter 4.0 version of PrGeneral is:

        TGetRslBlk.XRslRg.iMin := 25;
        TGetRslBlk.XRslRg.iMax := 25; 
        TGetRslBlk.YRslRg.iMin := 1500;

The recommended workaround for this problem is to use the PrDrvrVers function (Inside Macintosh II-163) to find out which version of the print driver you are using. If you are using 4.0, modify the resolution data before using it. The following code fragment illustrates this workaround:

    PROCEDURE CheckRslRecord(VAR theRslRecord: TGetRslBlk);
    CONST
        BogusDriver = 40;
    BEGIN
        IF PrDrvrVers = BogusDriver THEN BEGIN
            theRslRecord.XRslRg.iMax := theRslRecord.YRslRg.iMax;
            theRslRecord.YRslRg.iMin := theRslRecord.XRslRg.iMin;
        END;

When the bug is fixed in a future version of the driver, the CheckRslRecord procedure will no longer have any effect on the resolution record. This will make sure your application gets the correct resolution data no matter which version of the driver is being used.

Back to top

References

The Print Manager

Technical Note M.IM.PrGeneral-- PrGeneral

Back to top

Downloadables

Acrobat gif

Acrobat version of this Note (44K).

Download



Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.