From: "Jeff Tranter" <[EMAIL PROTECTED]>
> - all APS specific code is conditionally compiled
I find the use of #ifdefs really ugly -- it makes
life so much harder later on. A lot of the #ifdefs
that you are using are not actually necessary. For
example:
> +#ifdef HAVE_SYSAPS
> +#include "wine/apsutil.h"
> +#endif
Hide the test inside wine/apsutil.h, away from the public eye :)
Moreover, if you do that, we have the flexibility to do some
more #ifdef-deleting tricks.
> +#ifdef HAVE_SYSAPS
> + /* Initialize registry printer information from APS library */
> + WINSPOOL_APSUpdateRegistry();
> +#endif
Simply define it as a no-op (in the hearder), if !HAVE_SYSAPS -- no
need to repeat the test every time -- the compiler will optimize it
away.
> +#ifdef HAVE_SYSAPS
> + LPSTR apsPort;
> +#endif
Simply loose the #ifdef -- the compiler will optimize the
apsPort away if it is not used.
> +#ifdef HAVE_SYSAPS
> + /* Setup port */
> + apsPort = WINSPOOL_APSGetPort(device);
> + if (apsPort != NULL) {
> + physDev->job.output = HEAP_strdupA( PSDRV_Heap, 0, apsPort );
> + HeapFree(GetProcessHeap(), 0, apsPort);
> + } else {
> physDev->job.output = output ?
> HEAP_strdupA( PSDRV_Heap, 0, output ) :
> HEAP_strdupA( PSDRV_Heap, 0, "LPT1:" ); /* HACK */
> + }
> +#else
> + physDev->job.output = output ?
> + HEAP_strdupA( PSDRV_Heap, 0, output ) :
> + HEAP_strdupA( PSDRV_Heap, 0, "LPT1:" ); /* HACK */
> +#endif
Same here -- just make sure you define WINSPOOL_APSGetPort(device)
to be equivalent to the constant NULL in the header file when
!HAVE_SYSAPS (either with a #define, or an inline).
> --- /dev/null Thu Jul 27 12:18:06 2000
> +++ dlls/gdi/apsutil.c Tue Aug 8 15:02:15 2000
> @@ -0,0 +1,539 @@
> +/*
> + * Support for printing though APS layer.
> + *
> + * Copyright 1999-2000 Corel Corporation
> + *
> + * Note: APS is Application Printing Services, a library which
> + * provides print services to applications and printer
> + * configuration/management tools, hiding the details of whichever
> + * underlying low-level printing system is being used. APS is an Open
> + * Source project spearheaded by Corel. For more information see
> + * http://opensource.corel.com and
> + * http://sourceforge.net/project/?group_id=2328
> + */
> +
> +#include "config.h"
> +#ifdef HAVE_SYSAPS
> +
[...]
> +#endif /* HAVE_SYSAPS */
Here, do the same trick in the Makefile that we do for the X11 (and OpenGL)
stuff -- simply do not try to compile the file if !HAVE_SYSAPS.
There are a few places left (such as struct definitions) where you can not
let the compiler decide. I am willing to live with the additional space
overhead (4-8 bytes...) just to get rid of the #ifdefs, but that's just me.
HTH,
Dimi.