{ Umsetzung des Bsp.Programms Set_Prefs.c aus den RKRM_devices 3rd Ed. in KickPascal 2.12. © & P by PackMAN (Falk Zühlsdorff) Lindenberg 66, 98693 Ilmenau/Thür. Zum Laufen gebracht von Jens Gelhar am 20.07.94 Und compiliertbar mit OS3.0 Includes (sowie 2.0!) von J.Schmitz 23.07.94 FREEWARE {V0.01} IL/29/04/94 } Program Prtdevs; USES Intuition,GRAPHICS,EXECIO; {$incl "devices/printer.h","devices/prtbase.h"} TYPE PrinterIO=Record { Was in C eine "union" ist, modelliert man in Pascal als Record mit Variantenteil. JG } Case integer Of 0: ( ios : IOStdReq ); 1: ( iodrp : IODRPReq ); 2: ( iopc : IOPrtCmdReq ); End; VAR PrintMP : ^MsgPort; pio : ^PrinterIO; message : string[200]; PROCEDURE DoTest; VAR PD : ^PrinterData; prefs : ^Preferences; newpitch : word; newspacing : word; PrtReq : ^IOStdReq; len : cardinal; yho : byte; BEGIN pio^.ios.io_Command:=CMD_WRITE; pio^.ios.io_Data :=^message; pio^.ios.io_length :=-1; yho:=DoIO(ptr(pio)); { genau hier war der Fehler, denn früher stand hier "yho:=DoIO(^pio)", also ein Pointer auf einen Pointer als Parameter. Das war offensichtlich eine Referenzierungsstufe zuviel. JG } { Da DoIO laut RKM einen p_IORequest erwartet, muß hier noch ein ptr() eingefügt werden. JS } END; PROCEDURE DoPrinter; BEGIN message:="This is a test message to see how this looks when printed"\n"using various printer settings."\n\n; PrintMP:=CreatePort('Prtdevs',0); pio:=CreateExtIO(PrintMP,SizeOf(PrinterIO)); Open_Device('printer.device',0,pio,0); DoTest; Close_Device(pio); DeleteExtIO(pio); DeletePort(PrintMP); END; BEGIN doprinter; END.