Example #1
0
int
main(int argc, char **argv) {
  int i, k;
  int use_all_page_sizes = 1;
  if (argc > 1 && !strcmp(argv[1], "-s"))
    use_all_page_sizes = 0;

  stp_init();
  for (i = 0; i < stp_printer_model_count(); i++) {
    const stp_printer_t *p = stp_get_printer_by_index(i);
    const char *driver = stp_printer_get_driver(p);
    const char *family = stp_printer_get_family(p);
    stp_vars_t *pv = 
      stp_vars_create_copy(stp_printer_get_defaults(p));
    stp_parameter_t desc;
    int num_opts;
    int printer_is_color = 0;
    const stp_param_string_t *opt;
    int width, height, bottom, left, top, right;
    if (strcmp(family, "ps") == 0 || strcmp(family, "raw") == 0)
      continue;
    stp_describe_parameter(pv, "PrintingMode", &desc);
    if (stp_string_list_is_present(desc.bounds.str, "Color"))
      printer_is_color = 1;
    stp_parameter_description_destroy(&desc);
    if (printer_is_color)
      stp_set_string_parameter(pv, "PrintingMode", "Color");
    else
      stp_set_string_parameter(pv, "PrintingMode", "BW");
    stp_set_string_parameter(pv, "ChannelBitDepth", "8");
    printf("# Printer model %s, long name `%s'\n", driver,
	   stp_printer_get_long_name(p));
    stp_describe_parameter(pv, "PageSize", &desc);
    printf("$defaults{'%s'}{'PageSize'} = '%s';\n",
	   driver, desc.deflt.str);
    num_opts = stp_string_list_count(desc.bounds.str);
    
    for (k = 0; k < num_opts; k++) {
      const stp_papersize_t *papersize;
      opt = stp_string_list_param(desc.bounds.str, k);
      papersize = stp_get_papersize_by_name(opt->name);
      
      if (!papersize) {
	printf("Unable to lookup size %s!\n", opt->name);
	continue;
      }
      if (!use_all_page_sizes && num_opts >= 10 &&
	  (papersize->paper_unit == PAPERSIZE_ENGLISH_EXTENDED ||
	   papersize->paper_unit == PAPERSIZE_METRIC_EXTENDED))
	continue;
      
      width  = papersize->width;
      height = papersize->height;
      
      stp_set_string_parameter(pv, "PageSize", opt->name);
      
      stp_get_media_size(pv, &width, &height);
      stp_get_maximum_imageable_area(pv, &left, &right, &bottom, &top);

      if (left < 0)
	left = 0;
      if (right > width)
	right = width;
      if (bottom > height)
	bottom = height;
      if (top < 0)
	top = 0;
      
      bottom = height - bottom;
      top    = height - top;

      if (strcmp(opt->name, "Custom") == 0) {
	/* Use relative values for the custom size */
	right = width - right;
	top = height - top;
	width = 0;
	height = 0;
      }

      printf("$stpdata{'%s'}{'PageSize'}{'%s'} = '%s';",
	     driver, opt->name, opt->text);
      printf("$imageableareas{'%s'}{'%s'} = {",
	     driver, opt->name);
      printf("'left'=>'%d',", left);
      printf("'right'=>'%d',", right);
      printf("'top'=>'%d',", top);
      printf("'bottom'=>'%d',", bottom);
      printf("'width'=>'%d',", width);
      printf("'height'=>'%d'", height);
      printf("};\n");
    }
    stp_parameter_description_destroy(&desc);
    stp_vars_destroy(pv);
  }
  return 0;
}
Example #2
0
GtkWidget*
stpui_slider_new (stp_vars_t *vars,const char *optname,GtkWidget *checkbutton)
{
	stp_parameter_t desc;
	double step=1.0;
	stpui_Slider *c=STPUI_SLIDER(g_object_new (stpui_slider_get_type (), NULL));
	gboolean active=FALSE;

	c->vars=vars;
	c->optionname=optname;
	c->checkbutton=NULL;
	c->label=NULL;
	if(GTK_IS_CHECK_BUTTON(checkbutton))
		c->checkbutton=GTK_CHECK_BUTTON(checkbutton);
	else
		c->label=checkbutton;

	stp_describe_parameter(c->vars,c->optionname,&desc);
	c->type=desc.p_type;

	switch(c->type)
	{
		case STP_PARAMETER_TYPE_DOUBLE:
			active=stp_check_float_parameter(c->vars,c->optionname,STP_PARAMETER_DEFAULTED);
			step=0.01;
			break;
		case STP_PARAMETER_TYPE_INT:
			active=stp_check_int_parameter(c->vars,c->optionname,STP_PARAMETER_DEFAULTED);
			step=1.0;
			break;
		case STP_PARAMETER_TYPE_DIMENSION:
			active=stp_check_dimension_parameter(c->vars,c->optionname,STP_PARAMETER_DEFAULTED);
			step=1.0;
			break;
		default:
			break;
	}
	stp_parameter_description_destroy(&desc);

	if(c->checkbutton)
	{
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(c->checkbutton),active);
		g_signal_connect(G_OBJECT(c->checkbutton),"toggled",G_CALLBACK(stpui_toggle_changed),c);
	}

	c->scale=gtk_hscale_new_with_range(0,1.0,step);
	gtk_scale_set_draw_value(GTK_SCALE(c->scale),FALSE);
	
	switch(desc.p_type)
	{
		case STP_PARAMETER_TYPE_DOUBLE:
		case STP_PARAMETER_TYPE_INT:
			c->spin=gtk_spin_button_new_with_range(0,1.0,step);
			break;
		case STP_PARAMETER_TYPE_DIMENSION:
			c->spin=dimension_new(0,1.0,UNIT_POINTS);
			dimension_show_unit(DIMENSION(c->spin));
			break;
		default:
			break;
	}
	
	g_signal_connect(GTK_WIDGET(c->scale),"button-release-event",G_CALLBACK(stpui_slider_released),c);
	g_signal_connect(GTK_WIDGET(c->spin),"button-release-event",G_CALLBACK(stpui_spin_released),c);
	g_signal_connect(GTK_WIDGET(c->scale),"value-changed",G_CALLBACK(stpui_slider_changed),c);
	g_signal_connect(GTK_WIDGET(c->spin),"value-changed",G_CALLBACK(stpui_spin_changed),c);

	stpui_slider_refresh(c);

	gtk_box_pack_start(GTK_BOX(c),GTK_WIDGET(c->scale),TRUE,TRUE,0);
	gtk_widget_show(c->scale);

	gtk_box_pack_start(GTK_BOX(c),GTK_WIDGET(c->spin),FALSE,TRUE,0);
	gtk_widget_show(c->spin);
	
	return(GTK_WIDGET(c));
}
int
main(int argc, char **argv)
{
  int i, j, k;
  int first_arg = 1;
  stp_string_list_t *printer_list = NULL;
  stp_parameter_level_t max_level = STP_PARAMETER_LEVEL_ADVANCED4;
  if (argc > 1 && !strcmp(argv[1], "-s"))
    {
      max_level = STP_PARAMETER_LEVEL_BASIC;
      first_arg++;
    }

  stp_init();
  
  if (argc > first_arg)
    {
      printer_list = stp_string_list_create();
      for (i = 1; i < argc; i++)
	stp_string_list_add_string(printer_list, argv[i], argv[i]);
    }
  for (i = 0; i < stp_printer_model_count(); i++)
    {
      stp_parameter_list_t params;
      int nparams;
      stp_parameter_t desc;
      const stp_printer_t *printer = stp_get_printer_by_index(i);
      const char *driver = stp_printer_get_driver(printer);
      const char *family = stp_printer_get_family(printer);
      stp_vars_t *pv = stp_vars_create_copy(stp_printer_get_defaults(printer));
      int tcount = 0;
      size_t count;
      int printer_is_color = 0;
      if (strcmp(family, "ps") == 0 || strcmp(family, "raw") == 0)
	continue;
      if (printer_list && !stp_string_list_is_present(printer_list, driver))
	continue;

      /* Set Job Mode to "Job" as this enables the Duplex option */
      stp_set_string_parameter(pv, "JobMode", "Job");

      stp_describe_parameter(pv, "PrintingMode", &desc);
      if (stp_string_list_is_present(desc.bounds.str, "Color"))
	printer_is_color = 1;
      stp_parameter_description_destroy(&desc);
      if (printer_is_color)
	stp_set_string_parameter(pv, "PrintingMode", "Color");
      else
	stp_set_string_parameter(pv, "PrintingMode", "BW");
      stp_set_string_parameter(pv, "ChannelBitDepth", "8");

      printf("# Printer model %s, long name `%s'\n", driver,
	     stp_printer_get_long_name(printer));

      printf("$families{'%s'} = '%s';\n", driver, family);
      printf("$models{'%s'} = '%d';\n", driver, stp_get_model_id(pv));

      params = stp_get_parameter_list(pv);
      nparams = stp_parameter_list_count(params);

      for (k = 0; k < nparams; k++)
	{
	  const stp_parameter_t *p = stp_parameter_list_param(params, k);
	  if (p->read_only ||
	      (p->p_level > max_level && strcmp(p->name, "Resolution") != 0) ||
	      (p->p_class != STP_PARAMETER_CLASS_OUTPUT &&
	       p->p_class != STP_PARAMETER_CLASS_CORE &&
	       p->p_class != STP_PARAMETER_CLASS_FEATURE))
	    continue;
	  count = 0;
	  stp_describe_parameter(pv, p->name, &desc);
	  if (desc.is_active)
	    {
	      printf("$longnames{'%s'}{'%s'} = '%s';\n",
		     driver, desc.name, desc.text);
	      printf("$param_classes{'%s'}{'%s'} = %d;\n",
		     driver, desc.name, desc.p_class);
	      printf("$param_types{'%s'}{'%s'} = %d;\n",
		     driver, desc.name, desc.p_type);
	      printf("$param_levels{'%s'}{'%s'} = %d;\n",
		     driver, desc.name, desc.p_level);
	      if (desc.p_type == STP_PARAMETER_TYPE_STRING_LIST)
		{
		  count = stp_string_list_count(desc.bounds.str);
		  if (count > 0)
		    {
		      if (desc.is_mandatory)
			{
			  printf("$defaults{'%s'}{'%s'} = '%s';\n",
				 driver, desc.name, desc.deflt.str);
			}
		      else
			{
			  printf("$defaults{'%s'}{'%s'} = '%s';\n",
				 driver, desc.name, "None");
			  printf("$stpdata{'%s'}{'%s'}{'%s'} = '%s';\n",
				 driver, desc.name, "None", "None");
			}
		      for (j = 0; j < count; j++)
			{
			  const stp_param_string_t *param =
			    stp_string_list_param(desc.bounds.str, j);
			  printf("$stpdata{'%s'}{'%s'}{'%s'} = '%s';\n",
				 driver, desc.name, param->name, param->text);
			  if (strcmp(desc.name, "Resolution") == 0)
			    {
			      int x, y;
			      stp_set_string_parameter(pv, "Resolution",
						       param->name);
			      stp_describe_resolution(pv, &x, &y);
			      if (x > 0 && y > 0)
				{
				  printf("$stpdata{'%s'}{'%s'}{'%s'} = '%d';\n",
					 driver, "x_resolution", param->name, x);
				  printf("$stpdata{'%s'}{'%s'}{'%s'} = '%d';\n",
					 driver, "y_resolution", param->name, y);
				}
			    }
			}
		    }
		}
	      else if (desc.p_type == STP_PARAMETER_TYPE_BOOLEAN)
		{
		  if (desc.is_mandatory)
		    {
		      printf("$defaults{'%s'}{'%s'} = '%d';\n",
			     driver, desc.name, desc.deflt.boolean);
		    }
		  else
		    {
		      printf("$defaults{'%s'}{'%s'} = '%s';\n",
			     driver, desc.name, "None");
		      printf("$stpdata{'%s'}{'%s'}{'%s'} = '%s';\n",
			     driver, desc.name, "None", "None");
		    }
		    
		  printf("$stpdata{'%s'}{'%s'}{'False'} = 'False';\n",
			 driver, desc.name);
		  printf("$stpdata{'%s'}{'%s'}{'True'} = 'True';\n",
			 driver, desc.name);
		}
	      else if (desc.p_type == STP_PARAMETER_TYPE_DOUBLE)
		{
		  if (desc.bounds.dbl.lower <= desc.deflt.dbl &&
		      desc.bounds.dbl.upper >= desc.deflt.dbl)
		    {
		      printf("$stp_float_values{'%s'}{'MINVAL'}{'%s'} = %.3f;\n",
			     driver, desc.name, desc.bounds.dbl.lower);
		      printf("$stp_float_values{'%s'}{'MAXVAL'}{'%s'} = %.3f;\n",
			     driver, desc.name, desc.bounds.dbl.upper);
		      printf("$stp_float_values{'%s'}{'DEFVAL'}{'%s'} = %.3f;\n",
			     driver, desc.name, desc.deflt.dbl);
		      /* printf("$stp_float_values{'%s'}{'LONG_NAME'}{'%s'} = '%s';\n",
			 driver, desc.name, gettext(desc.text)); */
		      printf("$stp_float_values{'%s'}{'CATEGORY'}{'%s'} = '%s';\n",
			     driver, desc.name, gettext(desc.category));
		      printf("$stp_float_values{'%s'}{'HELP'}{'%s'} = q(%s);\n",
			     driver, desc.name, (desc.help ? gettext(desc.help) : "''"));
		      printf("$stp_float_values{'%s'}{'MANDATORY'}{'%s'} = q(%d);\n",
			     driver, desc.name, desc.is_mandatory);
		    }
		}
	      else if (desc.p_type == STP_PARAMETER_TYPE_INT)
		{
		  if (desc.bounds.integer.lower <= desc.deflt.integer &&
		      desc.bounds.integer.upper >= desc.deflt.integer)
		    {
		      printf("$stp_int_values{'%s'}{'MINVAL'}{'%s'} = %d;\n",
			     driver, desc.name, desc.bounds.integer.lower);
		      printf("$stp_int_values{'%s'}{'MAXVAL'}{'%s'} = %d;\n",
			     driver, desc.name, desc.bounds.integer.upper);
		      printf("$stp_int_values{'%s'}{'DEFVAL'}{'%s'} = %d;\n",
			     driver, desc.name, desc.deflt.integer);
		      /* printf("$stp_int_values{'%s'}{'LONG_NAME'}{'%s'} = '%s';\n",
			 driver, desc.name, gettext(desc.text)); */
		      printf("$stp_int_values{'%s'}{'CATEGORY'}{'%s'} = '%s';\n",
			     driver, desc.name, gettext(desc.category));
		      printf("$stp_int_values{'%s'}{'HELP'}{'%s'} = q(%s);\n",
			     driver, desc.name, (desc.help ? gettext(desc.help) : "''"));
		      printf("$stp_int_values{'%s'}{'MANDATORY'}{'%s'} = q(%d);\n",
			     driver, desc.name, desc.is_mandatory);
		    }
		}
	      else if (desc.p_type == STP_PARAMETER_TYPE_DIMENSION)
		{
		  if (desc.bounds.dimension.lower <= desc.deflt.dimension &&
		      desc.bounds.dimension.upper >= desc.deflt.dimension)
		    {
		      printf("$stp_dimension_values{'%s'}{'MINVAL'}{'%s'} = %d;\n",
			     driver, desc.name, desc.bounds.dimension.lower);
		      printf("$stp_dimension_values{'%s'}{'MAXVAL'}{'%s'} = %d;\n",
			     driver, desc.name, desc.bounds.dimension.upper);
		      printf("$stp_dimension_values{'%s'}{'DEFVAL'}{'%s'} = %d;\n",
			     driver, desc.name, desc.deflt.dimension);
		      /* printf("$stp_dimension_values{'%s'}{'LONG_NAME'}{'%s'} = '%s';\n",
			 driver, desc.name, gettext(desc.text)); */
		      printf("$stp_dimension_values{'%s'}{'CATEGORY'}{'%s'} = '%s';\n",
			     driver, desc.name, gettext(desc.category));
		      printf("$stp_dimension_values{'%s'}{'HELP'}{'%s'} = q(%s);\n",
			     driver, desc.name, (desc.help ? gettext(desc.help) : "''"));
		      printf("$stp_dimension_values{'%s'}{'MANDATORY'}{'%s'} = q(%d);\n",
			     driver, desc.name, desc.is_mandatory);
		    }
		}
	      tcount += count;
	    }
	  stp_parameter_description_destroy(&desc);
	}
      stp_parameter_list_destroy(params);
      if (tcount > 0)
	{
	  if (printer_is_color)
	    {
	      printf("$defaults{'%s'}{'%s'} = '%s';\n",
		     driver, "Color", "Color");
	      printf("$stpdata{'%s'}{'%s'}{'%s'} = '%s';\n",
		     driver, "Color", "Color", "Color");
	      printf("$stpdata{'%s'}{'%s'}{'%s'} = '%s';\n",
		     driver, "Color", "RawCMYK", "Raw CMYK");
	    }
	  else
	    printf("$defaults{'%s'}{'%s'} = '%s';\n",
		   driver, "Color", "Grayscale");
	  printf("$stpdata{'%s'}{'%s'}{'%s'} = '%s';\n",
		 driver, "Color", "Grayscale", "Gray Scale");
	  printf("$stpdata{'%s'}{'%s'}{'%s'} = '%s';\n",
		 driver, "Color", "BlackAndWhite", "Black and White");
	}
      stp_vars_destroy(pv);
    }
  return 0;
}
Example #4
0
static int
do_print(void)
{
  int status = 0;
  stp_vars_t *v;
  const stp_printer_t *the_printer;
  int left, right, top, bottom;
  int x, y;
  int width, height;
  int retval;
  stp_parameter_list_t params;
  int count;
  int i;
  char tmp[32];

  initialize_global_parameters();
  global_vars = stp_vars_create();
  stp_set_outfunc(global_vars, writefunc);
  stp_set_errfunc(global_vars, writefunc);
  stp_set_outdata(global_vars, stdout);
  stp_set_errdata(global_vars, stderr);

  setlocale(LC_ALL, "C");
  retval = yyparse();
  setlocale(LC_ALL, "");
  if (retval)
    return retval + 1;

  if (!global_did_something)
    return 1;

  v = stp_vars_create();
  the_printer = stp_get_printer_by_driver(global_printer);
  if (!the_printer)
    {
      int j;
      fprintf(stderr, "Unknown printer %s\nValid printers are:\n",
	      global_printer);
      for (j = 0; j < stp_printer_model_count(); j++)
	{
	  the_printer = stp_get_printer_by_index(j);
	  fprintf(stderr, "%-16s%s\n", stp_printer_get_driver(the_printer),
		  stp_printer_get_long_name(the_printer));
	}
      return 2;
    }
  bytes_written = 0;
  if (global_output)
    {
      if (strcmp(global_output, "-") == 0)
	output = stdout;
      else if (strcmp(global_output, "") == 0)
	output = NULL;
      else if (global_output[0] == '|')
	{
	  close_output();
	  write_to_process = 1;
	  output = popen(global_output+1, "w");
	  if (! output)
	    {
	      fprintf(stderr, "popen '%s' failed: %s\n", global_output, strerror(errno));
	      output = NULL;
	    }
	  free(global_output);
	  global_output = NULL;
	}
      else
	{
	  close_output();
	  output = fopen(global_output, "wb");
	  if (! output)
	    {
	      fprintf(stderr, "Create %s failed: %s\n", global_output, strerror(errno));
	      output = NULL;
	    }
	  free(global_output);
	  global_output = NULL;
	}
    }
  stp_set_printer_defaults(v, the_printer);
  stp_set_outfunc(v, writefunc);
  stp_set_errfunc(v, writefunc);
  stp_set_outdata(v, output);
  stp_set_errdata(v, stderr);
  stp_set_string_parameter(v, "InputImageType", global_image_type);
  sprintf(tmp, "%d", global_bit_depth);
  stp_set_string_parameter(v, "ChannelBitDepth", tmp);
  if (strcmp(global_image_type, "Raw") == 0)
    {
      sprintf(tmp, "%d", global_channel_depth);
      stp_set_string_parameter(v, "RawChannels", tmp);
    }
  stp_set_float_parameter(v, "Density", global_density);
  stp_set_string_parameter(v, "Quality", "None");
  stp_set_string_parameter(v, "ImageType", "None");

  params = stp_get_parameter_list(v);
  count = stp_parameter_list_count(params);
  for (i = 0; i < count; i++)
    {
      const stp_parameter_t *p = stp_parameter_list_param(params, i);
      if (p->p_type == STP_PARAMETER_TYPE_STRING_LIST)
	{
	  const char *val = stp_get_string_parameter(global_vars, p->name);
	  if (val && strlen(val) > 0)
	    {
	      stp_set_string_parameter(v, p->name, val);
	    }
	}
      else if (p->p_type == STP_PARAMETER_TYPE_INT &&
	       stp_check_int_parameter(global_vars, p->name, STP_PARAMETER_ACTIVE))
	{
	  int val = stp_get_int_parameter(global_vars, p->name);
	  stp_set_int_parameter(v, p->name, val);
	}
      else if (p->p_type == STP_PARAMETER_TYPE_BOOLEAN &&
	       stp_check_boolean_parameter(global_vars, p->name, STP_PARAMETER_ACTIVE))
	{
	  int val = stp_get_boolean_parameter(global_vars, p->name);
	  stp_set_boolean_parameter(v, p->name, val);
	}
      else if (p->p_type == STP_PARAMETER_TYPE_CURVE &&
	       stp_check_curve_parameter(global_vars, p->name, STP_PARAMETER_ACTIVE))
	{
	  const stp_curve_t *val = stp_get_curve_parameter(global_vars, p->name);
	  stp_set_curve_parameter(v, p->name, val);
	}
      else if (p->p_type == STP_PARAMETER_TYPE_DOUBLE &&
	       stp_check_float_parameter(global_vars, p->name, STP_PARAMETER_ACTIVE))
	{
	  double val = stp_get_float_parameter(global_vars, p->name);
	  stp_set_float_parameter(v, p->name, val);
	}
    }
  stp_set_page_width(v, stp_get_page_width(global_vars));
  stp_set_page_height(v, stp_get_page_height(global_vars));
  stp_parameter_list_destroy(params);
  if (stp_check_string_parameter(v, "PageSize", STP_PARAMETER_ACTIVE) &&
      !strcmp(stp_get_string_parameter(v, "PageSize"), "Auto"))
    {
      stp_parameter_t desc;
      stp_describe_parameter(v, "PageSize", &desc);
      if (desc.p_type == STP_PARAMETER_TYPE_STRING_LIST)
	stp_set_string_parameter(v, "PageSize", desc.deflt.str);
      stp_parameter_description_destroy(&desc);
    }
  stp_set_printer_defaults_soft(v, the_printer);

  stp_get_imageable_area(v, &left, &right, &bottom, &top);
  stp_describe_resolution(v, &x, &y);
  if (x < 0)
    x = 300;
  if (y < 0)
    y = 300;

  width = right - left;
  height = bottom - top;

  switch (global_size_mode)
    {
    case SIZE_PT:
      top += (int) (global_xtop + .5);
      left += (int) (global_xleft + .5);
      width = (int) (global_hsize + .5);
      height = (int) (global_vsize + .5);
      break;
    case SIZE_IN:
      top += (int) ((global_xtop * 72) + .5);
      left += (int) ((global_xleft * 72) + .5);
      width = (int) ((global_hsize * 72) + .5);
      height = (int) ((global_vsize * 72) + .5);
      break;
    case SIZE_MM:
      top += (int) ((global_xtop * 72 / 25.4) + .5);
      left += (int) ((global_xleft * 72 / 25.4) + .5);
      width = (int) ((global_hsize * 72 / 25.4) + .5);
      height = (int) ((global_vsize * 72 / 25.4) + .5);
      break;
    case SIZE_RELATIVE:
    default:
      top += height * global_xtop;
      left += width * global_xleft;
      width *= global_hsize;
      height *= global_vsize;
      break;
    }
  stp_set_width(v, width);
  stp_set_height(v, height);
#if 0
  width = (width / global_steps) * global_steps;
  height = (height / global_n_testpatterns) * global_n_testpatterns;
#endif
  if (global_steps > width)
    global_steps = width;

  global_printer_width = width * x / 72;
  global_printer_height = height * y / 72;

  global_band_height = global_printer_height / global_n_testpatterns;
  if (global_band_height == 0)
    global_band_height = 1;
  stp_set_left(v, left);
  stp_set_top(v, top);

  stp_merge_printvars(v, stp_printer_get_defaults(the_printer));
  if (stp_verify(v))
    {
      bytes_written = 0;
      if (start_job)
	{
	  stp_start_job(v, &theImage);
	  start_job = 0;
	}
      if (stp_print(v, &theImage) != 1)
	{
	  if (!global_quiet)
	    fputs("FAILED", stderr);
	  failures++;
	  status = 2;
	  if (global_halt_on_error)
	    return status;
	}
      else if (bytes_written == 0)
	{
	  if (!global_quiet)
	    fputs("FAILED: No output", stderr);
	  failures++;
	  status = 2;
	  if (global_halt_on_error)
	    return status;
	}
      else
	passes++;
      if (end_job)
	{
	  stp_end_job(v, &theImage);
	  end_job = 0;
	}
    }
  else
    {
      if (! global_fail_verify_ok)
	{
	  if (!global_quiet)
	    fputs("FAILED", stderr);
	  failures++;
	  status = 2;
	  if (global_halt_on_error)
	    return status;
	}
      else
	{
	  if (!global_quiet)
	    fputs("(skipped)", stderr);
	  skipped++;
	}
    }
  if (!global_quiet)
    fputc('\n', stderr);
  stp_vars_destroy(v);
  stp_free(static_testpatterns);
  static_testpatterns = NULL;
  return status;
}