1 { 2 This file is part of the Free Pascal run time library. 3 4 A file in Amiga system run time library. 5 Copyright (c) 1998-2003 by Nils Sjoholm 6 member of the Amiga RTL development team. 7 8 See the file COPYING.FPC, included in this distribution, 9 for details about the copyright. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 15 **********************************************************************} 16 17 { 18 History: 19 20 Update for AmigaOS 3.0. 21 Some const and records added and changes 22 was made to a few records. 23 31 Jan 2003. 24 25 nils.sjoholm@mailbox.swipnet.se Nils Sjoholm 26 } 27 28 { 29 printer device data definition 30 } 31 32 unit prtbase; 33 34 INTERFACE 35 36 uses exec, parallel, serial, amigados, intuition, timer,utility; 37 38 39 Type 40 41 pDeviceData = ^tDeviceData; 42 tDeviceData = record 43 dd_Device : tLibrary; { standard library node } 44 dd_Segment : Pointer; { A0 when initialized } 45 dd_ExecBase : Pointer; { A6 for exec } 46 dd_CmdVectors : Pointer; { command table for device commands } 47 dd_CmdBytes : Pointer; { bytes describing which command queue } 48 dd_NumCommands : Word; { the number of commands supported } 49 end; 50 51 Const 52 IOB_QUEUED = 4; 53 IOB_CURRENT = 5; 54 IOB_SERVICING = 6; 55 IOB_DONE = 7; 56 IOF_QUEUED = 1 shl IOB_QUEUED; 57 IOF_CURRENT = 1 shl IOB_CURRENT; 58 IOF_SERVICING = 1 shl IOB_SERVICING; 59 IOF_DONE = 1 shl IOB_DONE; 60 { pd_Flags } 61 PB_IOR0 = 0; 62 PB_IOR1 = 1; 63 PB_IOOPENED = 2; 64 PB_EXPUNGED = 7; 65 PBF_IOR0 = 1 shl PB_IOR0; 66 PBF_IOR1 = 1 shl PB_IOR1; 67 PBF_IOOPENDED = 1 shl PB_IOOPENED; 68 PBF_EXPUNGED = 1 shl PB_EXPUNGED; 69 { du_Flags (actually placed in pd_Unit.mp_Node.ln_Pri) } 70 DUB_STOPPED = 0; 71 DUF_STOPPED = 1 shl DUB_STOPPED; 72 73 P_OLDSTKSIZE = $0800; { stack size for child task } 74 P_STKSIZE = $1000; 75 P_BUFSIZE = 256; { size of internal buffers for text i/o } 76 P_SAFESIZE = 128; { safety margin for text output buffer } 77 78 {**************************************************************************} 79 80 { 81 "struct PrinterData" was a very bad concept in the old V1.0 days 82 because it is both: the device and the unit. 83 84 Starting with V44 PrinterData may be duplicated for many Units. But all 85 new fields that are specific to the Unit are now part of the new 86 "struct PrinterUnit". Don't touch the private fields! 87 88 A note on the function pointers in these data structure definitions: 89 unless otherwise specified, all functions expect that their parameters 90 are passed on the *stack* rather than in CPU registers. Every parameter 91 must be passed a 32 bit long word, i.e. an "UWORD" will use the same 92 stack space as an "ULONG". 93 } 94 95 Type 96 pPrinterData = ^tPrinterData; 97 tPrinterData = record 98 pd_Device : tDeviceData; 99 pd_Unit : tMsgPort; 100 pd_PrinterSegment : BPTR; 101 pd_PrinterType : WORD; 102 pd_SegmentData : Pointer; 103 pd_PrintBuf : Pointer; 104 pd_PWrite : Pointer; 105 pd_PBothReady : Pointer; 106 pd_ior0 : record 107 case longint of 108 0 : ( pd_p0 : tIOExtPar ); 109 1 : ( pd_s0 : tIOExtSer ); 110 end; 111 pd_ior1 : record 112 case longint of 113 0 : ( pd_p1 : tIOExtPar ); 114 1 : ( pd_s1 : tIOExtSer ); 115 end; 116 pd_TIOR : tTimeRequest; 117 pd_IORPort : tMsgPort; 118 pd_TC : tTask; 119 pd_OldStk : array[0..(P_OLDSTKSIZE)-1] of BYTE; 120 pd_Flags : BYTE; 121 pd_pad : BYTE; 122 pd_Preferences : tPreferences; 123 pd_PWaitEnabled : BYTE; 124 pd_Flags1 : BYTE; 125 pd_Stk : array[0..(P_STKSIZE)-1] of BYTE; 126 end; 127 128 Const 129 130 { Printer Class } 131 132 PPCB_GFX = 0; { graphics (bit position) } 133 PPCF_GFX = 1; { graphics (and/or flag) } 134 PPCB_COLOR = 1; { color (bit position) } 135 PPCF_COLOR = 2; { color (and/or flag) } 136 137 PPC_BWALPHA = 0; { black&white alphanumerics } 138 PPC_BWGFX = 1; { black&white graphics } 139 PPC_COLORALPHA = 2; { color alphanumerics } 140 PPC_COLORGFX = 3; { color graphics } 141 142 143 { extended PED structure (V44) } 144 PPCB_EXTENDED = 2; 145 PPCF_EXTENDED = $4; 146 147 { 148 Some printer drivers (PrinterPS) do not support 149 strip printing. An application has to print a page 150 using a single print request or through clever use 151 of the PRD_DUMPRPORTTAGS printing callback hook. 152 } 153 154 { no strip printing, please } 155 PPCB_NOSTRIP = 3; 156 PPCF_NOSTRIP = $8; 157 158 { Color Class } 159 160 PCC_BW = 1; { black&white only } 161 PCC_YMC = 2; { yellow/magenta/cyan only } 162 PCC_YMC_BW = 3; { yellow/magenta/cyan or black&white } 163 PCC_YMCB = 4; { yellow/magenta/cyan/black } 164 PCC_4COLOR = 4; { a flag for YMCB and BGRW } 165 PCC_ADDITIVE = 8; { not ymcb but blue/green/red/white } 166 PCC_WB = 9; { black&white only, 0 == BLACK } 167 PCC_BGR = 10; { blue/green/red } 168 PCC_BGR_WB = 11; { blue/green/red or black&white } 169 PCC_BGRW = 12; { blue/green/red/white } 170 171 { 172 The picture must be scanned once for each color component, as the 173 printer can only define one color at a time. ie. If 'PCC_YMC' then 174 first pass sends all 'Y' info to printer, second pass sends all 'M' 175 info, and third pass sends all C info to printer. The CalComp 176 PlotMaster is an example of this type of printer. 177 } 178 179 PCC_MULTI_PASS = $10; { see explanation above } 180 181 Type 182 183 pPrinterExtendedData = ^tPrinterExtendedData; 184 tPrinterExtendedData = record 185 ped_PrinterName : STRPTR; { printer name, null terminated } 186 ped_Init : procedure; { called after LoadSeg } 187 ped_Expunge : procedure; { called before UnLoadSeg } LONGnull188 ped_Open : function:LONG; { called at OpenDevice } 189 ped_Close : procedure; { called at CloseDevice } 190 ped_PrinterClass : uByte; { printer class } 191 ped_ColorClass : uByte; { color class } 192 ped_MaxColumns : uByte; { number of print columns available } 193 ped_NumCharSets : uByte; { number of character sets } 194 ped_NumRows : uWord; { number of 'pins' in print head } 195 ped_MaxXDots : ULONG; { number of dots max in a raster dump } 196 ped_MaxYDots : ULONG; { number of dots max in a raster dump } 197 ped_XDotsInch : uWord; { horizontal dot density } 198 ped_YDotsInch : uWord; { vertical dot density } 199 ped_Commands : Pointer; { printer text command table } LONGnull200 ped_DoSpecial : function:LONG; { special command handler } LONGnull201 ped_Render : function:LONG; { raster render function } 202 ped_TimeoutSecs : Longint; { good write timeout } 203 204 { the following only exists if the segment version is >= 33 } 205 206 ped_8BitChars : Pointer; { conv. strings for the extended font } 207 ped_PrintMode : Longint; { set if text printed, otherwise 0 } 208 209 { the following only exists if the segment version is >= 34 } 210 { ptr to conversion function for all chars } 211 212 ped_ConvFunc : Pointer; 213 {************************************************************* 214 * 215 * The following only exists if the segment version is >= 44 216 * AND PPCB_EXTENDED is set in ped_PrinterClass: 217 * 218 ************************************************************} 219 220 { Attributes and features } 221 ped_TagList : PTagItem; 222 { driver specific preferences: 223 * 224 * LONG ped_DoPreferences(struct printerIO * ior, 225 * LONG command); 226 } 227 ped_DoPreferences : function :LONG; 228 { custom error handling: 229 * 230 * VOID ped_CallErrHook(struct printerIO * ior, 231 * struct Hook * hook); 232 } 233 ped_CallErrHook : procedure ; 234 end; 235 236 { The following tags are used to define more printer driver features } 237 238 const 239 PRTA_Dummy = TAG_USER + $50000; 240 { } 241 { V44 features } 242 { LBOOL } 243 PRTA_8BitGuns = PRTA_Dummy + 1; 244 { LBOOL } 245 PRTA_ConvertSource = PRTA_Dummy + 2; 246 { LBOOL } 247 PRTA_FloydDithering = PRTA_Dummy + 3; 248 { LBOOL } 249 PRTA_AntiAlias = PRTA_Dummy + 4; 250 { LBOOL } 251 PRTA_ColorCorrection = PRTA_Dummy + 5; 252 { LBOOL } 253 PRTA_NoIO = PRTA_Dummy + 6; 254 { LBOOL } 255 PRTA_NewColor = PRTA_Dummy + 7; 256 { LONG } 257 PRTA_ColorSize = PRTA_Dummy + 8; 258 { LBOOL } 259 PRTA_NoScaling = PRTA_Dummy + 9; 260 { User interface } 261 { STRPTR } 262 PRTA_DitherNames = PRTA_Dummy + 20; 263 { STRPTR } 264 PRTA_ShadingNames = PRTA_Dummy + 21; 265 { LBOOL } 266 PRTA_ColorCorrect = PRTA_Dummy + 22; 267 { STRPTR } 268 PRTA_DensityInfo = PRTA_Dummy + 23; 269 { Hardware page borders } 270 { LONG, inches/1000 } 271 PRTA_LeftBorder = PRTA_Dummy + 30; 272 { LONG, inches/1000 } 273 PRTA_TopBorder = PRTA_Dummy + 31; 274 { LBOOL } 275 PRTA_MixBWColor = PRTA_Dummy + 32; 276 { Driver Preferences } 277 { LBOOL } 278 PRTA_Preferences = PRTA_Dummy + 40; 279 type 280 pPrinterSegment = ^tprinterSegment; 281 tPrinterSegment = record 282 ps_NextSegment : ULONG; { (actually a BPTR) } 283 ps_runAlert : ULONG; { MOVEQ #0,D0 : RTS } 284 ps_Version : Word; { segment version } 285 ps_Revision : Word; { segment revision } 286 ps_PED : tPrinterExtendedData; { printer extended data } 287 end; 288 289 {**************************************************************************} 290 291 { 292 Driver specific preferences. This structure is device specific: every 293 driver must base its preferences structure on this to allow version 294 checking etc. 295 296 The application will read/write this structure as an I/O buffer. 297 } 298 PPrtDriverPreferences = ^tPrtDriverPreferences; 299 tPrtDriverPreferences = record 300 pdp_Version : UWORD; { PRIVATE! driver specific version } 301 { PRIVATE! driver specific id } 302 pdp_PrinterID : array[0..31] of UBYTE; 303 pdp_PrefName : array[0..(FILENAME_SIZE - 16)-1] of char; 304 { size of this structure } 305 pdp_Length : ULONG; 306 end; 307 308 IMPLEMENTATION 309 310 end. 311