uint P_STKSIZE = 0x800;

type
    Library_t = unknown 34,
    MsgPort_t = unknown 34,
    Segment_t = unknown 4,
    IOExtPar_t = unknown 62,
    IOExtSer_t = unknown 82,
    timerequest_t = unknown 40,
    Task_t = unknown 92,
    Preferences_t = unknown 224,
    Segment_t = unknown 4,

    DeviceData_t = struct {
	Library_t dd_Device;
	*byte dd_Segment;
	*byte dd_ExecBase;
	*byte dd_CmdVectors;
	*byte dd_CmdBytes;
	uint dd_NumCommands;
    },

    PrinterData_t = struct {
	DeviceData_t pd_Device;
	MsgPort_t pd_Unit;
	Segment_t pd_PrinterSegment;
	uint pd_PrinterType;
	*PrinterSegment_t pd_SegmentData;
	*byte pd_PrintBuf;
	proc()int pd_PWrite;
	proc()int pd_PBothReady;
	union {
	    IOExtPar_t pd_p0;
	    IOExtSer_t pd_s0;
	} pd_ior0;
	union {
	    IOExtPar_t pd_p1;
	    IOExtSer_t pd_s1;
	} pd_ior1;
	timerequest_t pd_TIOR;
	MsgPort_t pd_IORPort;
	Task_t pd_TC;
	[P_STKSIZE]byte pd_Stk;
	ushort pd_Flags;
	ushort pd_pad;
	Preferences_t pd_Preferences;
	ushort pd_PWaitEnabled;
    },

    PrinterExtendedData_t = struct {
	*char ped_PrinterName;
	proc()void ped_Init, ped_Expunge, ped_Open, ped_Close;
	ushort ped_PrinterClass, ped_ColorClass, ped_MaxColums,ped_NumCharSets;
	uint ped_NumRows;
	ulong ped_MaxXDots, ped_MaxYDots;
	uint ped_XDotsInch, ped_YDotsInch;
	***char ped_Commands;
	proc()int ped_DoSpecial, ped_Render;
	ulong ped_TimeoutSecs;
	**char ped_8BitChars;
    },

    PrinterSegment_t = struct {
	Segment_t ps_NextSegment;
	ulong ps_runAlert;
	uint ps_Version, ps_Revision;
	PrinterExtendedData_t ps_PED;
    };

ushort
    PPCB_GFX		= 0,
    PPCF_GFX		= 1 << PPCB_GFX,
    PPCB_COLOR		= 1,
    PPCF_COLOR		= 1 << PPCB_COLOR,

    PPC_BWALPHA 	= 0,
    PPC_BWGFX		= 1,
    PPC_COLORGFX	= 3,

    PCC_BW		= 1,
    PCC_YMC		= 2,
    PCC_YMC_BW		= 3,
    PCC_YMCB		= 4,

    PCC_4COLOR		= 0x4,
    PCC_ADDITIVE	= 0x8,

    PCC_WB		= 0x9,
    PCC_BGR		= 0xa,
    PCC_BGR_WB		= 0xb,
    PCC_BGRW		= 0xc;
