Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
259 | daniel-mar | 1 | /* |
2 | This file is part of a common library |
||
3 | Copyright (C) 1990-2009 Toby Thain, toby@telegraphics.com.au |
||
4 | |||
5 | This program is free software; you can redistribute it and/or modify |
||
6 | it under the terms of the GNU General Public License as published by |
||
7 | the Free Software Foundation; either version 2 of the License, or |
||
8 | (at your option) any later version. |
||
9 | |||
10 | This program is distributed in the hope that it will be useful, |
||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
13 | GNU General Public License for more details. |
||
14 | |||
15 | You should have received a copy of the GNU General Public License |
||
16 | along with this program; if not, write to the Free Software |
||
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
18 | */ |
||
19 | |||
20 | #include <files.h> |
||
21 | #include <memory.h> |
||
22 | #include <OSUtils.h> |
||
23 | #include <printing.h> |
||
24 | #include <resources.h> |
||
25 | #include <toolutils.h> |
||
26 | |||
27 | #pragma segment PAP |
||
28 | |||
29 | #include "pap.h" |
||
30 | |||
31 | Handle get_detach_lock(ResType t,short id){ Handle h; |
||
32 | if(h = Get1Resource(t,id)){ |
||
33 | DetachResource(h); |
||
34 | MoveHHi(h); |
||
35 | HLock(h); |
||
36 | } |
||
37 | return h; |
||
38 | } |
||
39 | |||
40 | OSErr PAPLoad(Handle *printer_name,Handle *PAP_code){ |
||
41 | Handle name,code; |
||
42 | OSErr e; |
||
43 | |||
44 | PrOpen(); // open current printer driver |
||
45 | if(!(e = PrError())) |
||
46 | if(name = get_detach_lock('PAPA',-8192)) |
||
47 | if(code = get_detach_lock('PDEF',10)){ |
||
48 | *printer_name = name; |
||
49 | *PAP_code = code; |
||
50 | }else{ |
||
51 | e = ResError(); |
||
52 | DisposHandle(name); |
||
53 | } |
||
54 | else e = ResError(); |
||
55 | PrClose(); |
||
56 | return e; |
||
57 | } |