chiark / gitweb /
Initial revision
[ssr] / StraySrc / Libraries / Steel / c / print
1 /************************************************************************/
2 /* © Acorn Computers Ltd, 1992.                                         */
3 /*                                                                      */
4 /* This file forms part of an unsupported source release of RISC_OSLib. */
5 /*                                                                      */
6 /* It may be freely used to create executable images for saleable       */
7 /* products but cannot be sold in source form or as an object library   */
8 /* without the prior written consent of Acorn Computers Ltd.            */
9 /*                                                                      */
10 /* If this file is re-distributed (even if modified) it should retain   */
11 /* this copyright notice.                                               */
12 /*                                                                      */
13 /************************************************************************/
14
15 /*
16  * Title: print.c
17  * Purpose: provide printer driver access
18  * History: IDJ: 06-Feb-92: prepared for source release
19  *
20  */
21
22
23 #include "os.h"
24 #include "print.h"
25
26
27
28 /*                          Printer Driver SWI's                             */
29
30 #define Info          0x00080140
31 #define SetInfo       0x00080141
32 #define CheckFeatures 0x00080142
33 #define PageSize      0x00080143
34 #define SetPageSize   0x00080144
35 #define SelectJob     0x00080145
36 #define CurrentJob    0x00080146
37 /* FontSWI goes in here - only the font manager may use this */
38 #define EndJob        0x00080148
39 #define AbortJob      0x00080149
40 #define Reset         0x0008014A
41 #define GiveRectangle 0x0008014B
42 #define DrawPage      0x0008014C
43 #define GetRectangle  0x0008014D
44 #define CancelJob     0x0008014E
45 #define ScreenDump    0x0008014F
46 #define SelectIllus   0x00080153
47
48 #pragma no_check_stack
49
50
51 os_error * print_info(print_infostr *i)
52
53    os_regset r;
54    os_error *e;
55
56    e = os_swix(Info, &r);
57
58    i->version     = r.r[0] & 0xFFFF;
59    i->identity    = r.r[0] >> 16;
60    i->xres        = r.r[1];
61    i->yres        = r.r[2];
62    i->features    = r.r[3];
63    i->description = (char*)r.r[4];
64    i->xhalf       = r.r[5];
65    i->yhalf       = r.r[6];
66    i->number      = r.r[7];
67
68    return(e);
69 }
70
71
72 os_error * print_setinfo(print_infostr *i)
73
74    os_regset r;
75
76    r.r[1] = i->xres;
77    r.r[2] = i->yres;
78    r.r[3] = i->features;
79    r.r[5] = i->xhalf;
80    r.r[6] = i->yhalf;
81    r.r[7] = i->number;
82
83    return(os_swix(SetInfo, &r));
84 }
85
86
87 os_error * print_checkfeatures(int mask,int value)
88
89    os_regset r;
90
91    r.r[0] = mask;
92    r.r[1] = value;
93
94    return(os_swix(CheckFeatures, &r));
95 }
96
97
98 os_error * print_pagesize(print_pagesizestr *p)
99
100    os_regset r;
101    os_error *e;
102
103    e = os_swix(PageSize, &r);
104
105    p->xsize = r.r[1];
106    p->ysize = r.r[2];
107    p->bbox.x0 = r.r[3];
108    p->bbox.y0 = r.r[4];
109    p->bbox.x1 = r.r[5];
110    p->bbox.y1 = r.r[6];
111
112    return(e);
113 }
114
115
116 os_error * print_setpagesize(print_pagesizestr *p)
117
118    os_regset r;
119
120    r.r[1] = p->xsize;
121    r.r[2] = p->ysize;
122    r.r[3] = p->bbox.x0;
123    r.r[4] = p->bbox.y0;
124    r.r[5] = p->bbox.x1;
125    r.r[6] = p->bbox.y1;
126
127    return(os_swix(SetPageSize, &r));
128 }
129
130
131 os_error * print_selectjob(int job,char *title, int *oldjobp)
132
133    os_regset r;
134    os_error *e;
135
136    r.r[0] = job;
137    r.r[1] = (int)title;
138
139    e = os_swix(SelectJob,&r);
140
141    *oldjobp = r.r[0];
142
143    return(e);
144 }
145
146
147 os_error * print_currentjob(int *curjobp)
148
149    os_regset r;
150    os_error *e;
151
152    e = os_swix(CurrentJob,&r);
153
154    *curjobp = r.r[0];
155
156    return(e);
157 }
158
159
160 os_error * print_endjob(int job)
161
162    os_regset r;
163
164    r.r[0] = job;
165    return os_swix(EndJob,&r);
166 }
167
168
169 os_error * print_abortjob(int job)
170
171    os_regset r;
172
173    r.r[0] = job;
174    return os_swix(AbortJob,&r);
175 }
176
177
178 os_error * print_canceljob(int job)
179
180    os_regset r;
181
182    r.r[0] = job;
183    return os_swix(CancelJob,&r);
184 }
185
186
187 os_error * print_reset(void)
188
189    os_regset r;
190    return os_swix(Reset,&r);
191 }
192
193
194 os_error *print_giverectangle(int ident, print_box *area,
195                               print_transmatstr *trans,
196                               print_positionstr *posn, int bgcol)
197
198    os_regset r;
199
200    r.r[0] = ident;
201    r.r[1] = (int)area;
202    r.r[2] = (int)trans;
203    r.r[3] = (int)posn;
204    r.r[4] = bgcol;
205
206    return os_swix(GiveRectangle,&r);
207 }
208
209
210 os_error * print_drawpage(int copies,int sequ,char *page,
211                           print_box *clip,int *more, int *ident)
212
213    os_regset r;
214    os_error *e;
215
216    r.r[0] = copies;     /* number of copies                      */
217    r.r[1] = (int)clip;  /* where to return clip rectangle        */
218    r.r[2] = sequ;       /* pages sequence number within document */
219    r.r[3] = (int)page;  /* 'real' page number as a string        */
220
221    e = os_swix(DrawPage, &r);
222
223    *more = r.r[0];      /* number of copies left to do   */
224    *ident = r.r[2];     /* rectangle identification word */
225
226    return(e);
227 }
228
229
230 os_error * print_getrectangle(print_box *clip, int *more, int *ident)
231
232    os_regset r;
233    os_error *e;
234
235    r.r[1] = (int)clip;  /* where to return clip rectangle        */
236
237    e = os_swix(GetRectangle, &r);
238
239    *more = r.r[0];      /* number of copies left to do   */
240    *ident = r.r[2];     /* rectangle identification word */
241
242    return(e);
243 }
244
245
246 os_error * print_screendump(int job)
247
248    os_regset r;
249
250    r.r[0] = job;
251    return os_swix(ScreenDump,&r);
252 }
253
254
255 os_error * print_selectillustration(int job, char *title, int *oldjobp)
256
257    os_regset r;
258    os_error  *e;
259
260    r.r[0] = job;
261    r.r[1] = (int)title;
262    e = os_swix(SelectIllus, &r);
263
264    *oldjobp = r.r[0];
265    return (e);
266 }
267
268 #pragma check_stack
269