[comp.sys.mac] Making sure PrGeneral exists

P.PRIAPUS@HAMLET.STANFORD.EDU (Bill Lipa) (10/30/87)

PrGeneral is a new feature of the ImageWriter (versions 2.5 and later) and the
LaserWriter (version 4.0) drivers which provides extensibility through a simple
procedure call. I need to determine inside my application whether the print
software the user has selected with the chooser has this feature implemented.
Is there a reliable way to get the version number of the driver in use? If not,
is the PrGeneral trap equal to the unimplemented trap in earlier software?
 
Bill Lipa
 
Bitnet: p.priapus%hamlet@stanford
-------

earleh@dartvax.UUCP (Earle R. Horton) (11/01/87)

In article <12346681477.300.P.PRIAPUS@HAMLET.STANFORD.EDU>, P.PRIAPUS@HAMLET.STANFORD.EDU (Bill Lipa) writes:
> PrGeneral is a new feature of the ImageWriter (versions 2.5 and later) and the
> LaserWriter (version 4.0) drivers which provides extensibility through a simple
> procedure call. I need to determine inside my application whether the print
> software the user has selected with the chooser has this feature implemented.
> Is there a reliable way to get the version number of the driver in use? If not,
> is the PrGeneral trap equal to the unimplemented trap in earlier software?

PrGeneral() is in a 'PDEF' resource containing 68000 code to implement the 
function.  I think its ID is 7.  You can check for the existence of this 
resource yourself at run time.  If you are using a high level language which
implements a PrGeneral() call, then you should be able to just call it and
let the development system library routine find out if it exists.  Either
PrError() or ResError() will return resNotFound if the resource does not
exist.

It's important to realize that the Printing Manager calls are not traps, but
are calls to code which is stored in the ImageWriter or LaserWriter file.
Your development system usually provides a library of functions to find and
call the routines for you, and should also tell you if this is not possible
(Printer Resource file not present, for example, or in this case no PrGeneral
code to be found.)
-- 
*********************************************************************
*Earle R. Horton, H.B. 8000, Dartmouth College, Hanover, NH 03755   *
*********************************************************************

jww@sdcsvax.UUCP (11/01/87)

If you consult Tech Note #128, about PrGeneral, it points
out how to go about this.

Call PrError.  As always, NoErr means it worked.  If
ResNotFound is returned, then the PDEF #7 is missing and
there's no PrGeneral implemented.  This is probably
why HyperCard complains with old printer drivers.
-- 
	Joel West  (c/o UCSD)
	Palomar Software, Inc., P.O. Box 2635, Vista, CA  92083
	{ucbvax,ihnp4}!sdcsvax!jww 	jww@sdcsvax.ucsd.edu

lsr@apple.UUCP (Larry Rosenstein) (11/04/87)

In article <12346681477.300.P.PRIAPUS@HAMLET.STANFORD.EDU> P.PRIAPUS@HAMLET.STANFORD.EDU (Bill Lipa) writes:
>
>Is there a reliable way to get the version number of the driver in use? 

You can get the driver version number with the call PrDrvrVers (see page
II-163 of Inside Mac).  

-- 
Larry Rosenstein

Object Specialist
Apple Computer

AppleLink: Rosenstein1
UUCP:  {sun, voder, nsc, mtxinu, dual}!apple!lsr
CSNET: lsr@Apple.com

lsr@apple.UUCP (Larry Rosenstein) (11/04/87)

In article <7532@dartvax.UUCP> earleh@dartvax.UUCP (Earle R. Horton) writes:
>
>let the development system library routine find out if it exists.  Either
>PrError() or ResError() will return resNotFound if the resource does not
>exist.

According to Inside Mac volume 5, you should call PrError.  I wouldn't
assume that ResError will have the same error.

>It's important to realize that the Printing Manager calls are not traps, but

Actually, starting with System 4.1, there is a Print Manager trap, which
replaces the glue that used to be linked with every application.  (The trap
is in the Mac SE and Mac II ROMs.)  You are right, however, in that the trap
ultimately calls code in the printer driver resource file.

-- 
Larry Rosenstein

Object Specialist
Apple Computer

AppleLink: Rosenstein1
UUCP:  {sun, voder, nsc, mtxinu, dual}!apple!lsr
CSNET: lsr@Apple.com