From dff2993f5fed402632a671fbfa5dab57791ac322 Mon Sep 17 00:00:00 2001 From: jmcmullan Date: Mon, 30 Jan 2012 13:24:58 +0000 Subject: [PATCH] printer: Move some files around, in preparation for more types of printer drivers Signed-off-by: Jason S. McMullan git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@43799 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- compiler/include/aros/printertag.h | 113 ++++++++++++++++++++++ compiler/include/devices/prtbase.h | 4 +- workbench/printers/{ => postscript}/mmakefile.src | 4 +- workbench/printers/{ => postscript}/postscript.c | 11 ++- workbench/printers/printers_intern.h | 94 ------------------ 5 files changed, 124 insertions(+), 102 deletions(-) create mode 100644 compiler/include/aros/printertag.h rename workbench/printers/{ => postscript}/mmakefile.src (58%) rename workbench/printers/{ => postscript}/postscript.c (99%) delete mode 100644 workbench/printers/printers_intern.h diff --git a/compiler/include/aros/printertag.h b/compiler/include/aros/printertag.h new file mode 100644 index 0000000000..ccbfe172fa --- /dev/null +++ b/compiler/include/aros/printertag.h @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2012, The AROS Development Team. All rights reserved. + * Author: Jason S. McMullan + * + * Licensed under the AROS PUBLIC LICENSE (APL) Version 1.1 + */ + +#ifndef AROS_PRINTERTAG_H +#define AROS_PRINTERTAG_H + +#include + +/* .text tag that helps identify this as a printer driver. + * by convention, this is a 'return' instruction + */ +#ifdef __mc68000 +#define AROS_PRINTER_MAGIC 0x70004e75 /* m68k's moveq #0,%d0, rts */ +#elif defined(__i386__) +#define AROS_PRINTER_MAGIC 0x90c3c031 /* xor %eax,%eax, ret, nop */ +#elif defined(__x86_64__) +#define AROS_PRINTER_MAGIC 0xccc3c031 /* xor %eax,%eax, retq, int3 */ +#elif defined(__arm__) +#define AROS_PRINTER_MAGIC 0xe12fff1e /* bx lr */ +#elif defined(__ppc__) +#define AROS_PRINTER_MAGIC 0x4e800020 /* blr */ +#else +#error AROS_PRINTER_MAGIC is not defined for your architecture +#endif + +#define AROS_PRINTER_TAG(PED, version, revision, ped...) \ + __section(".tag.printer") __used static struct { \ + ULONG pmh_Magic; \ + UWORD pmh_Version; \ + UWORD pmh_Revision; \ + struct PrinterExtendedData pmh_PED; \ + } __pmh = { \ + .pmh_Magic = AROS_PRINTER_MAGIC, \ + .pmh_Version = (version), \ + .pmh_Revision = (revision), \ + .pmh_PED = { ped } }; \ + struct PrinterExtendedData *PED = &__pmh.pmh_PED; + +/* 'status' codes sent to the ped_Render() routine + */ + +/* PRS_INIT - Initialize page for printing + * + * ct - pointer to IODRPReq + * x - width in pixels + * y - height in pixels + */ +#define PRS_INIT 0 + +/* PRS_TRANSFER - Render page row + * + * ct - pointer to PrtInfo + * x - 0 + * y - row # (0 to height-1) + */ +#define PRS_TRANSFER 1 + +/* PRS_FLUSH - Send data to the printer + * ct - 0 + * x - 0 + * y - # of rows to send (1 to NumRows) + */ +#define PRS_FLUSH 2 + +/* PRS_CLEAR - Clear and Init buffer + * ct - 0 + * x - 0 + * y - 0 + */ +#define PRS_CLEAR 3 + +/* PRS_CLOSE - Close down graphics operation, + * and go back to text mode + * ct - Error code + * x - io_Special flag from IODRPReq + * y - 0 + */ +#define PRS_CLOSE 4 + +/* PRS_PREINIT - Pre-Master initialization + * ct - NULL or pointer to IODRPReq + * x - io_Special flag from IODRPReq + * y - 0 + */ +#define PRS_PREINIT 5 + +/* PRS_UNKNOWN - Something that AOS 3.9 sends, unknown? + * ct - 0 + * x - 0 + * y - 0 + */ +#define PRS_UNKNOWN 7 + +/* PRS_CONVERT - Transfer colormap/BGR line to printer + * ct - UBYTE * to an array of entries + * x - # of entries in the array + * y - 0 if ct is a union colorEntry *, 1 if ct is a BGR pixel line + */ +#define PRS_CONVERT 8 + +/* PRS_CORRECT - Color correct a colormap/BGR line + * ct - UBYTE * to an array of entries + * x - # of entries in the array + * y - 0 if ct is a union colorEntry *, 1 if ct is a BGR pixel line + */ +#define PRS_CORRECT 9 + + +#endif /* AROS_PRINTERTAG_H */ diff --git a/compiler/include/devices/prtbase.h b/compiler/include/devices/prtbase.h index 3d42c48b01..0d841a3e97 100644 --- a/compiler/include/devices/prtbase.h +++ b/compiler/include/devices/prtbase.h @@ -164,9 +164,9 @@ struct PrinterData struct PrinterExtendedData { char *ped_PrinterName; - VOID (*ped_Init)(struct PrinterData *pd); + LONG (*ped_Init)(struct PrinterData *pd); /* return 0 for success */ VOID (*ped_Expunge)(VOID); - LONG (*ped_Open)(union printerIO *ior); + LONG (*ped_Open)(union printerIO *ior); /* return 0 for success */ VOID (*ped_Close)(union printerIO *ior); UBYTE ped_PrinterClass; UBYTE ped_ColorClass; diff --git a/workbench/printers/mmakefile.src b/workbench/printers/postscript/mmakefile.src similarity index 58% rename from workbench/printers/mmakefile.src rename to workbench/printers/postscript/mmakefile.src index c0524869cd..1060b54397 100644 --- a/workbench/printers/mmakefile.src +++ b/workbench/printers/postscript/mmakefile.src @@ -4,7 +4,9 @@ FILES := postscript USER_CFLAGS := -D__GRAPHICS_NOLIBBASE__ -%build_module_simple mmake=workbench-printers-ps modname=PostScript \ +#MM- workbench-printers: workbench-printers-postscript + +%build_module_simple mmake=workbench-printers-postscript modname=PostScript \ modtype=printer files="$(FILES)" \ uselibs=rom diff --git a/workbench/printers/postscript.c b/workbench/printers/postscript/postscript.c similarity index 99% rename from workbench/printers/postscript.c rename to workbench/printers/postscript/postscript.c index a893e6b7a3..af0adf260a 100644 --- a/workbench/printers/postscript.c +++ b/workbench/printers/postscript/postscript.c @@ -6,17 +6,17 @@ */ #include +#include + #include #include #include #include -#include "printers_intern.h" - static struct Library *GfxBase; -static VOID ps_Init(struct PrinterData *pd); +static LONG ps_Init(struct PrinterData *pd); static VOID ps_Expunge(VOID); static LONG ps_Open(union printerIO *ior); static VOID ps_Close(union printerIO *ior); @@ -221,7 +221,7 @@ static CONST_STRPTR PED_8BitChars[] = { "?", /* y: */ }; -PRINTER_TAG(PED, 44, 0, +AROS_PRINTER_TAG(PED, 44, 0, .ped_PrinterName = "PostScript", .ped_Init = ps_Init, .ped_Expunge = ps_Expunge, @@ -252,11 +252,12 @@ PRINTER_TAG(PED, 44, 0, struct PrinterData *PD; -static VOID ps_Init(struct PrinterData *pd) +static LONG ps_Init(struct PrinterData *pd) { D(bug("ps_Init: pd=%p\n", pd)); PD = pd; GfxBase = OpenLibrary("graphics.library", 0); + return 0; } static VOID ps_Expunge(VOID) diff --git a/workbench/printers/printers_intern.h b/workbench/printers/printers_intern.h deleted file mode 100644 index 245880d06a..0000000000 --- a/workbench/printers/printers_intern.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2012, The AROS Development Team. All rights reserved. - * Author: Jason S. McMullan - * - * Licensed under the AROS PUBLIC LICENSE (APL) Version 1.1 - */ - -#ifndef PRINTERS_INTERN_H -#define PRINTERS_INTERN_H - -#include - -/* .text tag that helps identify this as a printer drivers. - * The ELF header already told us the architecture - */ -#define PRINTER_MAGIC 0x70004e75 /* m68k's moveq #0,%d0, rts */ - -struct PrinterMagicHeader { - ULONG pmh_Magic; - UWORD pmh_Version; - UWORD pmh_Revision; - struct PrinterExtendedData pmh_PED; -}; - -#define PRINTER_TAG(PED, version, revision, ped...) \ - __section(".tag.printer") __used static struct PrinterMagicHeader pmh = { \ - .pmh_Magic = PRINTER_MAGIC, \ - .pmh_Version = (version), \ - .pmh_Revision = (revision), \ - .pmh_PED = { ped } }; \ - struct PrinterExtendedData *PED = &pmh.pmh_PED; - -/* 'status' codes sent to the ped_Render() routine - */ - -/* PRS_INIT - Initialize page for printing - * - * ct - pointer to IODRPReq - * x - width in pixels - * y - height in pixels - */ -#define PRS_INIT 0 -/* PRS_TRANSFER - Render page row - * - * ct - pointer to PrtInfo - * x - 0 - * y - row # (0 to height-1) - */ -#define PRS_TRANSFER 1 -/* PRS_FLUSH - Send data to the printer - * ct - 0 - * x - 0 - * y - # of rows to send (1 to NumRows) - */ -#define PRS_FLUSH 2 -/* PRS_CLEAR - Clear and Init buffer - * ct - 0 - * x - 0 - * y - 0 - */ -#define PRS_CLEAR 3 -/* PRS_CLOSE - Close down - * ct - Error code - * x - io_Special flag from IODRPReq - * y - 0 - */ -#define PRS_CLOSE 4 -/* PRS_PREINIT - Pre-Master initialization - * ct - NULL or pointer to IODRPReq - * x - io_Special flag from IODRPReq - * y - 0 - */ -#define PRS_PREINIT 5 -/* PRS_CONVERT - Transfer colormap/BGR line to printer - * ct - UBYTE * to an array of entries - * x - # of entries in the array - * y - 0 if ct is a union colorEntry *, 1 if ct is a BGR pixel line - */ -#define PRS_EJECT 7 -/* PRS_EJECT - Finish page, advance to next page - * ct - 0 - * x - 0 - * y - 0 - */ -#define PRS_CONVERT 8 -/* PRS_CORRECT - Color correct a colormap/BGR line - * ct - UBYTE * to an array of entries - * x - # of entries in the array - * y - 0 if ct is a union colorEntry *, 1 if ct is a BGR pixel line - */ -#define PRS_CORRECT 9 - - -#endif /* PRINTERS_INTERN_H */ -- 2.11.4.GIT