[gs-devel] Re: Merger of ESP and GPL GhostScript: Completed driver part

Till Kamppeter till.kamppeter at gmail.com
Fri Apr 27 03:06:14 PDT 2007


Unfortunately, the upstream GS developers have also worked in your 
direction and added tray selection to the pxlmono/pxlcolor driver, and 
have done it in a way different to you. So your patch does not work on 
the current SVN state of the driver. Can you get the 
duplex/tumble/notumble support into the current driver version, and also 
the corrections you did on color handling?

    Till

Michael Sweet wrote:
> Till Kamppeter wrote:
>> ...
>> Mike, another missing feature are your improvements on the 
>> pxlmono/pxlcolor drivers. Can you also here tell what you have changed 
>> exactly, or provide a patch for current GPL GS SVN or directly upload 
>> into the SVN? Thank you.
> 
> Since I haven't yet been granted write access, it is impossible for
> me to do so.  I've attached a diff of the main changes to support
> duplex and input slot selection...
> 
> 
> ------------------------------------------------------------------------
> 
> Index: gdevlj56.c
> ===================================================================
> --- gdevlj56.c	(revision 53)
> +++ gdevlj56.c	(revision 54)
> @@ -144,7 +144,7 @@
>  	};
>  
>  	px_write_page_header(s, (gx_device *)pdev);
> -	px_write_select_media(s, (gx_device *)pdev, NULL);
> +	px_write_select_media(s, (gx_device *)pdev, NULL, 0, false, false, 0);
>  	PX_PUT_LIT(s, page_header);
>  	if (pdev->color_info.depth == 1)
>  	    PX_PUT_LIT(s, mono_header);
> Index: gdevpx.c
> ===================================================================
> --- gdevpx.c	(revision 53)
> +++ gdevpx.c	(revision 54)
> @@ -1,12 +1,14 @@
>  /* Copyright (C) 1997, 2000 Aladdin Enterprises.  All rights reserved.
> -  
> +
> +  Duplex, media, and PJL enhancements copyright 2005 by Easy Software Products
> +
>    This software is provided AS-IS with no warranty, either express or
>    implied.
> -  
> +
>    This software is distributed under license and may not be copied,
>    modified or distributed except as expressly authorized under the terms
>    of the license contained in the file LICENSE in this distribution.
> -  
> +
>    For more information about licensing, please refer to
>    http://www.ghostscript.com/licensing/. For information on
>    commercial licensing, go to http://www.artifex.com/licensing/ or
> @@ -54,6 +56,11 @@
>  typedef struct gx_device_pclxl_s {
>      gx_device_vector_common;
>      /* Additional state information */
> +    int page;			/* Page number starting at 0 */
> +    int MediaPosition;		/* MediaPosition attribute */
> +    bool Duplex;		/* Duplex attribute */
> +    bool Tumble;		/* Tumble attribute */
> +    
>      pxeMediaSize_t media_size;
>      gx_path_type_t fill_rule;	/* ...winding_number or ...even_odd  */
>      gx_path_type_t clip_rule;	/* ditto */
> @@ -107,6 +114,8 @@
>  private dev_proc_copy_mono(pclxl_copy_mono);
>  private dev_proc_copy_color(pclxl_copy_color);
>  private dev_proc_fill_mask(pclxl_fill_mask);
> +private dev_proc_get_params(pclxl_get_params);
> +private dev_proc_put_params(pclxl_put_params);
>  
>  /*private dev_proc_draw_thin_line(pclxl_draw_thin_line); */
>  private dev_proc_begin_image(pclxl_begin_image);
> @@ -127,8 +136,8 @@
>  	pclxl_copy_color,\
>  	NULL,			/* draw_line */\
>  	NULL,			/* get_bits */\
> -	gdev_vector_get_params,\
> -	gdev_vector_put_params,\
> +	pclxl_get_params,\
> +	pclxl_put_params,\
>  	NULL,			/* map_cmyk_color */\
>  	NULL,			/* get_xfont_procs */\
>  	NULL,			/* get_xfont_device */\
> @@ -773,8 +782,16 @@
>       */
>      stream *s = vdev->strm;
>  
> +    xdev->page ++;
> +
> +    errprintf("PAGE: %d %d\n", xdev->page, xdev->NumCopies);
> +    errprintf("INFO: Printing page %d...\n", xdev->page);
> +    errflush();
> +
>      px_write_page_header(s, (const gx_device *)vdev);
> -    px_write_select_media(s, (const gx_device *)vdev, &xdev->media_size);
> +    px_write_select_media(s, (const gx_device *)vdev, &xdev->media_size,
> +                          xdev->page, xdev->Duplex, xdev->Tumble,
> +			  xdev->MediaPosition);
>      spputc(s, pxtBeginPage);
>      return 0;
>  }
> @@ -1112,6 +1129,12 @@
>  					 VECTOR_OPEN_FILE_SEQUENTIAL);
>      if (code < 0)
>  	return code;
> +
> +    xdev->page = 0;
> +    xdev->Duplex = false;
> +    xdev->MediaPosition = 0;
> +    xdev->Tumble = false;
> +
>      pclxl_page_init(xdev);
>      px_write_file_header(vdev->strm, dev);
>      xdev->media_size = pxeMediaSize_next;	/* no size selected */
> @@ -1595,3 +1618,102 @@
>      gs_free_object(pie->memory, pie, "pclxl_end_image");
>      return code;
>  }
> +
> +
> +/*
> + * 'pclxl_get_params()' - Get pagedevice parameters.
> + */
> +
> +private int				/* O - Error status */
> +pclxl_get_params(gx_device     *dev,	/* I - Device info */
> +                 gs_param_list *plist)	/* I - Parameter list */
> +{
> +  gx_device_pclxl	*xdev;		/* PCL XL device */
> +  int			code;		/* Return code */
> +
> +
> + /*
> +  * First process the "standard" page device parameters...
> +  */
> +
> +  if ((code = gdev_vector_get_params(dev, plist)) < 0)
> +    return (code);
> +
> + /*
> +  * Then write the PCL-XL parameters...
> +  */
> +
> +  xdev = (gx_device_pclxl *)dev;
> +
> +  if ((code = param_write_bool(plist, "Duplex", &(xdev->Duplex))) < 0)
> +    return (code);
> +
> +  if ((code = param_write_int(plist, "MediaPosition",
> +                              &(xdev->MediaPosition))) < 0)
> +    return (code);
> +
> +  if ((code = param_write_bool(plist, "Tumble", &(xdev->Tumble))) < 0)
> +    return (code);
> +
> +  return (0);
> +}
> +
> +
> +/*
> + * 'pclxl_put_params()' - Set pagedevice parameters.
> + */
> +
> +private int				/* O - Error status */
> +pclxl_put_params(gx_device     *dev,	/* I - Device info */
> +                 gs_param_list *plist)	/* I - Parameter list */
> +{
> +  gx_device_pclxl	*xdev;		/* PCL XL device */
> +  int			code;		/* Error code */
> +  int			intval;		/* Integer value */
> +  bool			boolval;	/* Boolean value */
> +
> +
> + /*
> +  * Process PCL-XL driver parameters...
> +  */
> +
> +  xdev = (gx_device_pclxl *)dev;
> +
> +#define intoption(name, sname, type) \
> +  if ((code = param_read_int(plist, sname, &intval)) < 0) \
> +  { \
> +    param_signal_error(plist, sname, code); \
> +    return (code); \
> +  } \
> +  else if (code == 0) \
> +  { \
> +    xdev->name = (type)intval; \
> +  }
> +
> +#define booloption(name, sname) \
> +  if ((code = param_read_bool(plist, sname, &boolval)) < 0) \
> +  { \
> +    if ((code = param_read_null(plist, sname)) < 0) \
> +    { \
> +      param_signal_error(plist, sname, code); \
> +      return (code); \
> +    } \
> +    if (code == 0) \
> +      xdev->name = false; \
> +  } \
> +  else if (code == 0) \
> +    xdev->name = (bool)boolval;
> +
> +  booloption(Duplex, "Duplex")
> +  intoption(MediaPosition, "MediaPosition", int)
> +  booloption(Tumble, "Tumble")
> +
> + /*
> +  * Then process standard page device parameters...
> +  */
> +
> +  if ((code = gdev_vector_put_params(dev, plist)) < 0)
> +    return (code);
> +
> +  return (0);
> +}
> Index: gdevpxut.c
> ===================================================================
> --- gdevpxut.c	(revision 53)
> +++ gdevpxut.c	(revision 54)
> @@ -1,5 +1,7 @@
>  /* Copyright (C) 1999 Aladdin Enterprises.  All rights reserved.
>    
> +  Duplex, media, and PJL enhancements copyright 2005 by Easy Software Products
> +
>    This software is provided AS-IS with no warranty, either express or
>    implied.
>    
> @@ -69,7 +71,8 @@
>  
>  /* Write the media selection command if needed, updating the media size. */
>  int
> -px_write_select_media(stream *s, const gx_device *dev, pxeMediaSize_t *pms)
> +px_write_select_media(stream *s, const gx_device *dev, pxeMediaSize_t *pms,
> +                      int page, bool Duplex, bool Tumble, int MediaPosition)
>  {
>  #define MSD(ms, res, w, h)\
>    { ms, (float)((w) * 1.0 / (res)), (float)((h) * 1.0 / res) },
> @@ -98,12 +101,24 @@
>       * be specified, but MediaSource is optional.
>       */
>      px_put_uba(s, (byte)size, pxaMediaSize);
> +    px_put_uba(s, (byte)MediaPosition, pxaMediaSource);
> +
> +    if (Duplex)
> +    {
> +      if (Tumble)
> +	px_put_uba(s, (byte)eDuplexVerticalBinding, pxaDuplexPageMode);
> +      else
> +	px_put_uba(s, (byte)eDuplexHorizontalBinding, pxaDuplexPageMode);
> +
> +      if (page & 1)
> +	px_put_uba(s, (byte)eFrontMediaSide, pxaDuplexPageSide);
> +      else
> +	px_put_uba(s, (byte)eBackMediaSide, pxaDuplexPageSide);
> +    }
> +    else
> +      px_put_uba(s, (byte)eSimplexFrontSide, pxaSimplexPageMode);
> +
>      if (!pms || size != *pms) {
> -	static const byte page_header_2[] = {
> -	    DUB(eAutoSelect), DA(pxaMediaSource)
> -	};
> -
> -	PX_PUT_LIT(s, page_header_2);
>  	if (pms)
>  	    *pms = size;
>      }
> Index: gdevpxut.h
> ===================================================================
> --- gdevpxut.h	(revision 53)
> +++ gdevpxut.h	(revision 54)
> @@ -31,7 +31,8 @@
>  
>  /* Write the media selection command if needed, updating the media size. */
>  int px_write_select_media(stream *s, const gx_device *dev,
> -			  pxeMediaSize_t *pms);
> +			  pxeMediaSize_t *pms, int page,
> +			  bool Duplex, bool Tumble, int MediaPosition);
>  
>  /*
>   * Write the file trailer.  Note that this takes a FILE *, not a stream *,




More information about the gs-devel mailing list