Proposed fix for #687899 Input tray not retained

Raph Levien <[email protected]> Wed, 30 Mar 2005 13:50:37 -0800
Newsgroups gmane.comp.printing.ghostscript.patches
Message-ID <[email protected]>
Reviewers,

   This patch makes some subtle changes to the (rather delicate)
setpagedevice logic, so can stand some review.

   The changes are as follows:

1. The behavior of MediaPosition is changed significantly. Previously,
   it was ignored (i.e. omitted altogether from setpd merging). Just
   adding it to setpd merging would not be good - if set at the PS
   level, then it would get checked for equality at the C level (by
   zmatchmedia), and fail horribly if it didn't match. In accordance
   with the PLRM3 text (it will be honored provided it can satisfy the
   normal media matching), in the new version a mismatch simply adds a
   .001 penalty to the matching score.

2. The ljet4 device now contains ManualFeed and MediaPosition fields,
   with appropriate putparams logic to set them.

3. The MediaPosition and ManualFeed strings now create an ESC & l H
   init string, according to the following logic. ManualFeed sends
   ESC & l 2 H; if ManualFeed is false (or not set), then MediaPosition
   0 sends ESC & l 5 H, and MediaPosition1 sends ESC & l 1 H. If none
   of these are set, then no extra init string is generated.

   Obviously, for this feature to be useful, there needs to be an
InputAttributes dictionary in effect, for which the PageSize of
positions 0 and 1 match the PageSize of the setpagedevice request.
[Actually, if only ManualFeed is desired, then there is no need to
fiddle with InputAttributes].

   I think these changes bring our media selection more in line with
what Adobe intended, and could be useful for embedded PS projects as
well. I believe the risk of unwanted changes is small, but considering
the delicacy of the setpagedevice logic, review and testing is
warranted.

Raph

_______________________________________________
gs-code-review mailing list
[email protected]
http://www.ghostscript.com/mailman/listinfo/gs-code-review
mediapos_patch (text/plain, 17.3 KB)
Index: lib/gs_setpd.ps
===================================================================
RCS file: /cvs/ghostscript/gs/lib/gs_setpd.ps,v
retrieving revision 1.25
diff -C2 -r1.25 gs_setpd.ps
*** lib/gs_setpd.ps	13 Sep 2004 22:33:15 -0000	1.25
--- lib/gs_setpd.ps	30 Mar 2005 21:36:03 -0000
***************
*** 374,379 ****
        ifelse copy readonly
      } bind
-   % Ignore MediaPostition when merging (Adobe CPSI does).
-   /MediaPosition { dup //null ne { pop //null } if } bind
  .dicttomark readonly def
  
--- 374,377 ----
Index: src/gdevdjet.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevdjet.c,v
retrieving revision 1.11
diff -C2 -r1.11 gdevdjet.c
*** src/gdevdjet.c	29 Jan 2004 18:19:41 -0000	1.11
--- src/gdevdjet.c	30 Mar 2005 21:36:03 -0000
***************
*** 112,203 ****
  private dev_proc_print_page_copies(lp2563_print_page_copies);
  private dev_proc_print_page_copies(oce9050_print_page_copies);
  
  private const gx_device_procs prn_hp_procs =
  prn_params_procs(hpjet_open, gdev_prn_output_page, hpjet_close,
! 		 gdev_prn_get_params, gdev_prn_put_params);
  
! const gx_device_printer gs_deskjet_device =
! prn_device_copies(prn_hp_procs, "deskjet",
! 		  DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
! 		  X_DPI, Y_DPI,
! 		  0, 0, 0, 0,		/* margins filled in by hpjet_open */
! 		  1, djet_print_page_copies);
! 
! const gx_device_printer gs_djet500_device =
! prn_device_copies(prn_hp_procs, "djet500",
! 		  DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
! 		  X_DPI, Y_DPI,
! 		  0, 0, 0, 0,		/* margins filled in by hpjet_open */
! 		  1, djet500_print_page_copies);
! 
! const gx_device_printer gs_fs600_device =
! prn_device_copies(prn_hp_procs, "fs600",
! 		  DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
! 		  X_DPI2, Y_DPI2,
! 		  0.23, 0.0, 0.23, 0.04,      /* margins */
! 		  1, fs600_print_page_copies);
! 
! const gx_device_printer gs_laserjet_device =
! prn_device_copies(prn_hp_procs, "laserjet",
! 		  DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
! 		  X_DPI, Y_DPI,
! 		  0.05, 0.25, 0.55, 0.25,	/* margins */
! 		  1, ljet_print_page_copies);
! 
! const gx_device_printer gs_ljetplus_device =
! prn_device_copies(prn_hp_procs, "ljetplus",
! 		  DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
! 		  X_DPI, Y_DPI,
! 		  0.05, 0.25, 0.55, 0.25,	/* margins */
! 		  1, ljetplus_print_page_copies);
! 
! const gx_device_printer gs_ljet2p_device =
! prn_device_copies(prn_hp_procs, "ljet2p",
! 		  DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
! 		  X_DPI, Y_DPI,
! 		  0.20, 0.25, 0.25, 0.25,	/* margins */
! 		  1, ljet2p_print_page_copies);
! 
! const gx_device_printer gs_ljet3_device =
! prn_device_copies(prn_hp_procs, "ljet3",
! 		  DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
! 		  X_DPI, Y_DPI,
! 		  0.20, 0.25, 0.25, 0.25,	/* margins */
! 		  1, ljet3_print_page_copies);
! 
! const gx_device_printer gs_ljet3d_device =
! prn_device_copies(prn_hp_procs, "ljet3d",
! 		  DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
! 		  X_DPI, Y_DPI,
! 		  0.20, 0.25, 0.25, 0.25,	/* margins */
! 		  1, ljet3d_print_page_copies);
! 
! const gx_device_printer gs_ljet4_device =
! prn_device_copies(prn_hp_procs, "ljet4",
! 		  DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
! 		  X_DPI2, Y_DPI2,
! 		  0, 0, 0, 0,		/* margins */
! 		  1, ljet4_print_page_copies);
! 
! const gx_device_printer gs_ljet4d_device =
! prn_device_copies(prn_hp_procs, "ljet4d",
! 		  DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
! 		  X_DPI2, Y_DPI2,
! 		  0, 0, 0, 0,		/* margins */
! 		  1, ljet4d_print_page_copies);
! 
! const gx_device_printer gs_lp2563_device =
! prn_device_copies(prn_hp_procs, "lp2563",
! 		  DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
! 		  X_DPI, Y_DPI,
! 		  0, 0, 0, 0,		/* margins */
! 		  1, lp2563_print_page_copies);
! 
! const gx_device_printer gs_oce9050_device =
! prn_device_copies(prn_hp_procs, "oce9050",
! 		  24 * 10, 24 * 10,	/* 24 inch roll (can print 32" also) */
! 		  400, 400,		/* 400 dpi */
! 		  0, 0, 0, 0,		/* margins */
! 		  1, oce9050_print_page_copies);
  
  /* Open the printer, adjusting the margins if necessary. */
--- 112,222 ----
  private dev_proc_print_page_copies(lp2563_print_page_copies);
  private dev_proc_print_page_copies(oce9050_print_page_copies);
+ private dev_proc_get_params(hpjet_get_params);
+ private dev_proc_put_params(hpjet_put_params);
  
  private const gx_device_procs prn_hp_procs =
  prn_params_procs(hpjet_open, gdev_prn_output_page, hpjet_close,
! 		 hpjet_get_params, hpjet_put_params);
  
! typedef struct gx_device_hpjet_s gx_device_hpjet;
! 
! struct gx_device_hpjet_s {
!     gx_device_common;
!     gx_prn_device_common;
!     int MediaPosition;
!     bool MediaPosition_set;
!     bool ManualFeed;
!     bool ManualFeed_set;
! };
! 
! #define HPJET_DEVICE(procs, dname, w10, h10, xdpi, ydpi, lm, bm, rm, tm, color_bits, print_page_copies)\
!   { prn_device_std_margins_body_copies(gx_device_hpjet, procs, dname, \
!         w10, h10, xdpi, ydpi, lm, tm, lm, bm, rm, tm, color_bits, \
!         print_page_copies), \
!     0, false, false, false }
! 
! const gx_device_hpjet gs_deskjet_device =
! HPJET_DEVICE(prn_hp_procs, "deskjet",
! 	     DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
! 	     X_DPI, Y_DPI,
! 	     0, 0, 0, 0,		/* margins filled in by hpjet_open */
! 	     1, djet_print_page_copies);
! 
! const gx_device_hpjet gs_djet500_device =
! HPJET_DEVICE(prn_hp_procs, "djet500",
! 	     DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
! 	     X_DPI, Y_DPI,
! 	     0, 0, 0, 0,		/* margins filled in by hpjet_open */
! 	     1, djet500_print_page_copies);
! 
! const gx_device_hpjet gs_fs600_device =
! HPJET_DEVICE(prn_hp_procs, "fs600",
! 	     DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
! 	     X_DPI2, Y_DPI2,
! 	     0.23, 0.0, 0.23, 0.04,      /* margins */
! 	     1, fs600_print_page_copies);
! 
! const gx_device_hpjet gs_laserjet_device =
! HPJET_DEVICE(prn_hp_procs, "laserjet",
! 	     DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
! 	     X_DPI, Y_DPI,
! 	     0.05, 0.25, 0.55, 0.25,	/* margins */
! 	     1, ljet_print_page_copies);
! 
! const gx_device_hpjet gs_ljetplus_device =
! HPJET_DEVICE(prn_hp_procs, "ljetplus",
! 	     DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
! 	     X_DPI, Y_DPI,
! 	     0.05, 0.25, 0.55, 0.25,	/* margins */
! 	     1, ljetplus_print_page_copies);
! 
! const gx_device_hpjet gs_ljet2p_device =
! HPJET_DEVICE(prn_hp_procs, "ljet2p",
! 	     DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
! 	     X_DPI, Y_DPI,
! 	     0.20, 0.25, 0.25, 0.25,	/* margins */
! 	     1, ljet2p_print_page_copies);
! 
! const gx_device_hpjet gs_ljet3_device =
! HPJET_DEVICE(prn_hp_procs, "ljet3",
! 	     DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
! 	     X_DPI, Y_DPI,
! 	     0.20, 0.25, 0.25, 0.25,	/* margins */
! 	     1, ljet3_print_page_copies);
! 
! const gx_device_hpjet gs_ljet3d_device =
! HPJET_DEVICE(prn_hp_procs, "ljet3d",
! 	     DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
! 	     X_DPI, Y_DPI,
! 	     0.20, 0.25, 0.25, 0.25,	/* margins */
! 	     1, ljet3d_print_page_copies);
! 
! const gx_device_hpjet gs_ljet4_device =
! HPJET_DEVICE(prn_hp_procs, "ljet4",
! 	     DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
! 	     X_DPI2, Y_DPI2,
! 	     0, 0, 0, 0,		/* margins */
! 	     1, ljet4_print_page_copies);
! 
! const gx_device_hpjet gs_ljet4d_device =
! HPJET_DEVICE(prn_hp_procs, "ljet4d",
! 	     DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
! 	     X_DPI2, Y_DPI2,
! 	     0, 0, 0, 0,		/* margins */
! 	     1, ljet4d_print_page_copies);
! 
! const gx_device_hpjet gs_lp2563_device =
! HPJET_DEVICE(prn_hp_procs, "lp2563",
! 	     DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
! 	     X_DPI, Y_DPI,
! 	     0, 0, 0, 0,		/* margins */
! 	     1, lp2563_print_page_copies);
! 
! const gx_device_hpjet gs_oce9050_device =
! HPJET_DEVICE(prn_hp_procs, "oce9050",
! 	     24 * 10, 24 * 10,	/* 24 inch roll (can print 32" also) */
! 	     400, 400,		/* 400 dpi */
! 	     0, 0, 0, 0,		/* margins */
! 	     1, oce9050_print_page_copies);
  
  /* Open the printer, adjusting the margins if necessary. */
***************
*** 264,267 ****
--- 283,306 ----
  /* ------ Internal routines ------ */
  
+ /* Make an init string that contains paper tray selection. The resulting
+    init string is stored in buf, so make sure that buf is at least 5
+    bytes larger than str. */
+ private void
+ hpjet_make_init(gx_device_printer *pdev, char *buf, const char *str)
+ {
+     gx_device_hpjet *dev = (gx_device_hpjet *)pdev;
+     int paper_source = -1;
+     int paper_source_tab[] = { 5, 1 };
+ 
+     if (dev->ManualFeed_set && dev->ManualFeed) paper_source = 2;
+     else if (dev->MediaPosition_set && dev->MediaPosition >= 0 &&
+ 	     dev->MediaPosition < countof(paper_source_tab))
+ 	paper_source = paper_source_tab[dev->MediaPosition];
+     if (paper_source >= 0)
+ 	sprintf(buf, "%s\033&l%dH", str, paper_source);
+     else
+ 	sprintf(buf, "%s", str);
+ }
+ 
  /* The DeskJet can compress (mode 2) */
  private int
***************
*** 269,275 ****
  		       int num_copies)
  {
      return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
! 					300, PCL_DJ_FEATURES,
! 					"\033&k1W\033*b2M");
  }
  /* The DeskJet500 can compress (modes 2&3) */
--- 308,316 ----
  		       int num_copies)
  {
+     char init[80];
+ 
+     hpjet_make_init(pdev, init, "\033&k1W\033*b2M");
      return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
! 					300, PCL_DJ_FEATURES, init);
  }
  /* The DeskJet500 can compress (modes 2&3) */
***************
*** 278,284 ****
  			  int num_copies)
  {
      return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
! 					300, PCL_DJ500_FEATURES,
! 					"\033&k1W");
  }
  /* The Kyocera FS-600 laser printer (and perhaps other printers */
--- 319,327 ----
  			  int num_copies)
  {
+     char init[80];
+ 
+     hpjet_make_init(pdev, init, "\033&k1W");
      return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
! 					300, PCL_DJ500_FEATURES, init);
  }
  /* The Kyocera FS-600 laser printer (and perhaps other printers */
***************
*** 290,299 ****
  {
      int dots_per_inch = (int)pdev->y_pixels_per_inch;
!     char real_init[60];
  
!     sprintf(real_init, "\033*r0F\033&u%dD", dots_per_inch);
      return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
  					dots_per_inch, PCL_FS600_FEATURES,
! 					real_init);
  }
  /* The LaserJet series II can't compress */
--- 333,344 ----
  {
      int dots_per_inch = (int)pdev->y_pixels_per_inch;
!     char base_init[60];
!     char init[80];
  
!     sprintf(base_init, "\033*r0F\033&u%dD", dots_per_inch);
!     hpjet_make_init(pdev, init, base_init);
      return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
  					dots_per_inch, PCL_FS600_FEATURES,
! 					init);
  }
  /* The LaserJet series II can't compress */
***************
*** 302,308 ****
  		       int num_copies)
  {
      return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
! 					300, PCL_LJ_FEATURES,
! 					"\033*b0M");
  }
  /* The LaserJet Plus can't compress */
--- 347,355 ----
  		       int num_copies)
  {
+     char init[80];
+ 
+     hpjet_make_init(pdev, init, "\033*b0M");
      return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
! 					300, PCL_LJ_FEATURES, init);
  }
  /* The LaserJet Plus can't compress */
***************
*** 311,317 ****
  			   int num_copies)
  {
      return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
! 					300, PCL_LJplus_FEATURES,
! 					"\033*b0M");
  }
  /* LaserJet series IIp & IId compress (mode 2) */
--- 358,366 ----
  			   int num_copies)
  {
+     char init[80];
+ 
+     hpjet_make_init(pdev, init, "\033*b0M");
      return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
! 					300, PCL_LJplus_FEATURES, init);
  }
  /* LaserJet series IIp & IId compress (mode 2) */
***************
*** 321,327 ****
  			 int num_copies)
  {
      return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
! 					300, PCL_LJ2p_FEATURES,
! 					"\033*r0F\033*b2M");
  }
  /* All LaserJet series IIIs (III,IIId,IIIp,IIIsi) compress (modes 2&3) */
--- 370,378 ----
  			 int num_copies)
  {
+     char init[80];
+ 
+     hpjet_make_init(pdev, init, "\033*r0F\033*b2M");
      return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
! 					300, PCL_LJ2p_FEATURES, init);
  }
  /* All LaserJet series IIIs (III,IIId,IIIp,IIIsi) compress (modes 2&3) */
***************
*** 331,337 ****
  			int num_copies)
  {
      return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
! 					300, PCL_LJ3_FEATURES,
! 					"\033&l-180u36Z\033*r0F");
  }
  /* LaserJet IIId is same as LaserJet III, except for duplex */
--- 382,390 ----
  			int num_copies)
  {
+     char init[80];
+ 
+     hpjet_make_init(pdev, init, "\033&l-180u36Z\033*r0F");
      return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
! 					300, PCL_LJ3_FEATURES, init);
  }
  /* LaserJet IIId is same as LaserJet III, except for duplex */
***************
*** 340,346 ****
  			 int num_copies)
  {
      return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
! 					300, PCL_LJ3D_FEATURES,
! 					"\033&l-180u36Z\033*r0F");
  }
  /* LaserJet 4 series compresses, and it needs a special sequence to */
--- 393,401 ----
  			 int num_copies)
  {
+     char init[80];
+ 
+     hpjet_make_init(pdev, init, "\033&l-180u36Z\033*r0F");
      return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
! 					300, PCL_LJ3D_FEATURES, init);
  }
  /* LaserJet 4 series compresses, and it needs a special sequence to */
***************
*** 352,361 ****
  {
      int dots_per_inch = (int)pdev->y_pixels_per_inch;
!     char real_init[60];
  
!     sprintf(real_init, "\033&l-180u36Z\033*r0F\033&u%dD", dots_per_inch);
      return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
  					dots_per_inch, PCL_LJ4_FEATURES,
! 					real_init);
  }
  private int
--- 407,418 ----
  {
      int dots_per_inch = (int)pdev->y_pixels_per_inch;
!     char base_init[60];
!     char init[80];
  
!     sprintf(base_init, "\033&l-180u36Z\033*r0F\033&u%dD", dots_per_inch);
!     hpjet_make_init(pdev, init, base_init);
      return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
  					dots_per_inch, PCL_LJ4_FEATURES,
! 					init);
  }
  private int
***************
*** 364,373 ****
  {
      int dots_per_inch = (int)pdev->y_pixels_per_inch;
!     char real_init[60];
  
!     sprintf(real_init, "\033&l-180u36Z\033*r0F\033&u%dD", dots_per_inch);
      return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
  					dots_per_inch, PCL_LJ4D_FEATURES,
! 					real_init);
  }
  /* The 2563B line printer can't compress */
--- 421,432 ----
  {
      int dots_per_inch = (int)pdev->y_pixels_per_inch;
!     char base_init[60];
!     char init[80];
  
!     sprintf(base_init, "\033&l-180u36Z\033*r0F\033&u%dD", dots_per_inch);
!     hpjet_make_init(pdev, init, base_init);
      return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
  					dots_per_inch, PCL_LJ4D_FEATURES,
! 					init);
  }
  /* The 2563B line printer can't compress */
***************
*** 377,383 ****
  			 int num_copies)
  {
      return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
! 					300, PCL_LP2563B_FEATURES,
! 					"\033*b0M");
  }
  /* The Oce line printer has TIFF compression */
--- 436,444 ----
  			 int num_copies)
  {
+     char init[80];
+ 
+     hpjet_make_init(pdev, init, "\033*b0M");
      return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
! 					300, PCL_LP2563B_FEATURES, init);
  }
  /* The Oce line printer has TIFF compression */
***************
*** 388,391 ****
--- 449,453 ----
  {
      int code;
+     char init[80];
  
      /* Switch to HP_RTL. */
***************
*** 395,401 ****
      fputs("\033%1A", prn_stream);	/* Enter PCL mode */
  
      code = dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
! 					400, PCL_OCE9050_FEATURES,
! 					"\033*b3M");
  
      /* Return to HPGL/2 mode. */
--- 457,464 ----
      fputs("\033%1A", prn_stream);	/* Enter PCL mode */
  
+     hpjet_make_init(pdev, init, "\033*b0M");
+ 
      code = dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
! 					400, PCL_OCE9050_FEATURES, init);
  
      /* Return to HPGL/2 mode. */
***************
*** 409,410 ****
--- 472,523 ----
      return code;
  }
+ 
+ private int
+ hpjet_get_params(gx_device *pdev, gs_param_list *plist)
+ {
+     gx_device_hpjet *dev = (gx_device_hpjet *)pdev;
+     int code = gdev_prn_get_params(dev, plist);
+ 
+     if (code >= 0)
+ 	code = param_write_bool(plist, "ManualFeed", &dev->ManualFeed);
+     return code;
+ }
+ 
+ private int
+ hpjet_put_params(gx_device *pdev, gs_param_list *plist)
+ {
+     gx_device_hpjet *dev = (gx_device_hpjet *)pdev;
+     int code;
+     bool ManualFeed;
+     bool ManualFeed_set = false;
+     int MediaPosition;
+     bool MediaPosition_set = false;
+ 
+     code = param_read_bool(plist, "ManualFeed", &ManualFeed);
+     if (code == 0) ManualFeed_set = true;
+     if (code >= 0) {
+ 	code = param_read_int(plist, "%MediaSource", &MediaPosition);
+ 	if (code == 0) MediaPosition_set = true;
+ 	else if (code < 0) {
+ 	    if (param_read_null(plist, "%MediaSource") == 0) {
+ 		code = 0;
+ 	    }
+ 	}
+     }
+ 
+     if (code >= 0)
+ 	code = gdev_prn_put_params(pdev, plist);
+ 
+     if (code >= 0) {
+ 	if (ManualFeed_set) {
+ 	    dev->ManualFeed = ManualFeed;
+ 	    dev->ManualFeed_set = true;
+ 	}
+ 	if (MediaPosition_set) {
+ 	    dev->MediaPosition = MediaPosition;
+ 	    dev->MediaPosition_set = true;
+ 	}
+     }
+ 
+     return code;
+ }