added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / compiler / include / devices / prtbase.h
blob854ac410b507b8c5090956a26d6a93b3b273b2e3
1 #ifndef DEVICES_PRTBASE_H
2 #define DEVICES_PRTBASE_H
4 /*
5 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
6 $Id$
8 Desc: printer driver structures and tags
9 Lang: english
13 #ifndef UTILITY_TAGITEM_H
14 # include <utility/tagitem.h>
15 #endif
17 #ifndef EXEC_DEVICES_H
18 # include <exec/devices.h>
19 #endif
21 #ifndef DEVICES_PARALLEL_H
22 # include <devices/parallel.h>
23 #endif
25 #ifndef DEVICES_SERIAL_H
26 # include <devices/serial.h>
27 #endif
29 #ifndef DEVICES_TIMER_H
30 # include <devices/timer.h>
31 #endif
33 #ifndef DOS_DOSEXTENS_H
34 # include <dos/dosextens.h>
35 #endif
37 #ifndef INTUITION_INTUITION_H
38 # include <intuition/intuition.h>
39 #endif
41 struct DeviceData
43 struct Library dd_Device;
44 APTR dd_Segment;
45 APTR dd_ExecBase;
46 APTR dd_CmdVectors;
47 APTR dd_CmdBytes;
48 UWORD dd_NumCommands;
51 /* IO Flags */
53 #define IOB_QUEUED 4
54 #define IOB_CURRENT 5
55 #define IOB_SERVICING 6
56 #define IOB_DONE 7
58 #define IOF_QUEUED (1L << IOB_QUEUED)
59 #define IOF_CURRENT (1L << IOB_CURRENT)
60 #define IOF_SERVICING (1L << IOB_SERVICING)
61 #define IOF_DONE (1L << IOB_DONE)
63 /* pd_Flags */
65 #define PB_IOR0 0
66 #define PB_IOR1 1
67 #define PB_IOOPENED 2
68 #define PB_EXPUNGED 7
70 #define PBF_IOR0 (1L << PB_IOR0)
71 #define PBF_IOR1 (1L << PB_IOR1)
72 #define PBF_IOOPENDED (1L << PB_IOOPENED)
73 #define PBF_EXPUNGED (1L << PB_EXPUNGED)
75 /* du_Flags (actually placed in pd_Unit.mp_Node.ln_Pri) */
77 #define DUB_STOPPED 0
79 #define DUF_STOPPED (1L << DUB_STOPPED)
81 #define P_OLDSTKSIZE 0x0800
82 #define P_STKSIZE AROS_STACKSIZE /* 0x1000 in AmigaOS */
83 #define P_BUFSIZE 256
84 #define P_SAFESIZE 128
86 union printerIO;
88 struct PrinterData
90 struct DeviceData pd_Device;
91 struct MsgPort pd_Unit;
92 BPTR pd_PrinterSegment;
93 UWORD pd_PrinterType;
94 struct PrinterSegment *pd_SegmentData;
95 UBYTE *pd_PrintBuf;
96 LONG (*pd_PWrite)(APTR data, LONG len);
97 LONG (*pd_PBothReady)(VOID);
98 union
100 struct IOExtPar pd_p0;
101 struct IOExtSer pd_s0;
102 } pd_ior0;
103 union
105 struct IOExtPar pd_p1;
106 struct IOExtSer pd_s1;
107 } pd_ior1;
108 struct timerequest pd_TIOR;
109 struct MsgPort pd_IORPort;
110 struct Task pd_TC;
111 UBYTE pd_OldStk[P_OLDSTKSIZE];
112 UBYTE pd_Flags;
113 UBYTE pd_pad;
114 struct Preferences pd_Preferences;
115 UBYTE pd_PWaitEnabled;
116 UBYTE pd_Flags1;
117 UBYTE pd_Stk[P_STKSIZE];
118 struct PrinterUnit *pd_PUnit;
119 LONG (*pd_PRead)(char * buffer, LONG *length, struct timeval *tv);
120 LONG (*pd_CallErrHook)(struct Hook *hook, union printerIO *ior, struct PrtErrMsg *pem);
121 ULONG pd_UnitNumber;
122 STRPTR pd_DriverName;
123 LONG (*pd_PQuery)(LONG *numofchars);
126 #define pd_PIOR0 pd_ior0.pd_p0
127 #define pd_SIOR0 pd_ior0.pd_s0
129 #define pd_PIOR1 pd_ior1.pd_p1
130 #define pd_SIOR1 pd_ior1.pd_s1
132 /* Printer Class */
134 #define PPCB_GFX 0
135 #define PPCF_GFX 0x1
136 #define PPCB_COLOR 1
137 #define PPCF_COLOR 0x2
139 #define PPC_BWALPHA 0x00
140 #define PPC_BWGFX 0x01
141 #define PPC_COLORALPHA 0x02
142 #define PPC_COLORGFX 0x03
144 #define PPCB_EXTENDED 2
145 #define PPCF_EXTENDED 0x4
147 #define PPCB_NOSTRIP 3
148 #define PPCF_NOSTRIP 0x8
150 /* Color Class */
152 #define PCC_BW 0x01
153 #define PCC_YMC 0x02
154 #define PCC_YMC_BW 0x03
155 #define PCC_YMCB 0x04
156 #define PCC_4COLOR 0x04
157 #define PCC_ADDITIVE 0x08
158 #define PCC_WB 0x09
159 #define PCC_BGR 0x0A
160 #define PCC_BGR_WB 0x0B
161 #define PCC_BGRW 0x0C
162 #define PCC_MULTI_PASS 0x10
164 struct PrinterExtendedData
166 char *ped_PrinterName;
167 VOID (*ped_Init)(struct PrinterData *pd);
168 VOID (*ped_Expunge)(VOID);
169 LONG (*ped_Open)(union printerIO *ior);
170 VOID (*ped_Close)(union printerIO *ior);
171 UBYTE ped_PrinterClass;
172 UBYTE ped_ColorClass;
173 UBYTE ped_MaxColumns;
174 UBYTE ped_NumCharSets;
175 UWORD ped_NumRows;
176 ULONG ped_MaxXDots;
177 ULONG ped_MaxYDots;
178 UWORD ped_XDotsInch;
179 UWORD ped_YDotsInch;
180 STRPTR **ped_Commands;
181 LONG (*ped_DoSpecial)(UWORD *command,
182 UBYTE output_buffer[],
183 BYTE *current_line_position,
184 BYTE *current_line_spacing,
185 BYTE *crlf_flag,
186 UBYTE params[]);
187 LONG (*ped_Render)(LONG ct, LONG x, LONG y, LONG status);
188 LONG ped_TimeoutSecs;
189 STRPTR *ped_8BitChars;
190 LONG ped_PrintMode;
191 LONG (*ped_ConvFunc)(UBYTE *buf, UBYTE c, LONG crlf_flag);
192 struct TagItem *ped_TagList;
193 LONG (*ped_DoPreferences)(union printerIO *ior, LONG command);
194 VOID (*ped_CallErrHook)(union printerIO *ior, struct Hook *hook);
197 /* Tags to define more printer driver features */
199 #define PRTA_Dummy (TAG_USER + 0x50000)
200 #define PRTA_8BitGuns (PRTA_Dummy + 1)
201 #define PRTA_ConvertSource (PRTA_Dummy + 2)
202 #define PRTA_FloydDithering (PRTA_Dummy + 3)
203 #define PRTA_AntiAlias (PRTA_Dummy + 4)
204 #define PRTA_ColorCorrection (PRTA_Dummy + 5)
205 #define PRTA_NoIO (PRTA_Dummy + 6)
206 #define PRTA_NewColor (PRTA_Dummy + 7)
207 #define PRTA_ColorSize (PRTA_Dummy + 8)
208 #define PRTA_NoScaling (PRTA_Dummy + 9)
210 /* User interface */
211 #define PRTA_DitherNames (PRTA_Dummy + 20)
212 #define PRTA_ShadingNames (PRTA_Dummy + 21)
213 #define PRTA_ColorCorrect (PRTA_Dummy + 22)
214 #define PRTA_DensityInfo (PRTA_Dummy + 23)
216 /* Hardware page borders */
217 #define PRTA_LeftBorder (PRTA_Dummy + 30)
218 #define PRTA_TopBorder (PRTA_Dummy + 31)
220 #define PRTA_MixBWColor (PRTA_Dummy + 32)
222 /* Driver Preferences */
223 #define PRTA_Preferences (PRTA_Dummy + 40)
225 /****************************************************************************/
227 struct PrinterSegment
229 BPTR ps_NextSegment;
230 ULONG ps_runAlert;
231 UWORD ps_Version;
232 UWORD ps_Revision;
233 struct PrinterExtendedData ps_PED;
236 /****************************************************************************/
238 struct PrtDriverPreferences
240 UWORD pdp_Version;
241 UBYTE pdp_PrinterID[32];
242 char pdp_PrefName[FILENAME_SIZE-16];
243 ULONG pdp_Length; /* size of this structure */
245 /* .. more driver private fields following .. */
248 #endif /* DEVICES_PRTBASE_H */