Пример #1
0
static void
record_btrace_disable_callback (void *arg)
{
  struct thread_info *tp;

  tp = arg;

  btrace_disable (tp);
}
Пример #2
0
static void
record_btrace_stop_recording (void)
{
  struct thread_info *tp;

  DEBUG ("stop recording");

  record_btrace_auto_disable ();

  ALL_THREADS (tp)
    if (tp->btrace.target != NULL)
      btrace_disable (tp);
}
Пример #3
0
int main(int argc,char** argv)
{
  struct gengetopt_args_info info;
  cptcat_opt_t opt = {0};

  /* use gengetopt */

  if (options(argc, argv, &info) != 0)
    {
      fprintf(stderr,"failed to parse command line\n");
      return EXIT_FAILURE;
    }

  /* check arguments & transfer to opt structure */ 

  opt.verbose = info.verbose_given;

  opt.output = (info.output_given ? info.output_arg : NULL);

  if (!opt.output && opt.verbose)
    {
      fprintf(stderr,"verbosity suppressed (<stdout> for results)\n");
      opt.verbose = 0;
    }

  if (info.inputs_num < 2)
    {
      fprintf(stderr,"at least 2 input files required\n");
      return EXIT_FAILURE;
    }

  opt.input.n    = info.inputs_num; 
  opt.input.file = (const char**)info.inputs;
  
  if (opt.verbose)
    printf("This is cptcat (version %s)\n",VERSION);

  btrace_enable("cptcat");

  int err = cptcat(opt);

  if (err)
    {
      btrace("failed (error %i)", err);
      btrace_print_stream(stderr, BTRACE_PLAIN);

      if (info.backtrace_file_given)
        {
          int format = BTRACE_XML;
          if (info.backtrace_format_given)
            {
              format = btrace_format(info.backtrace_format_arg);
              if (format == BTRACE_ERROR)
                {
                  fprintf(stderr, "no such backtrace format %s\n", 
                          info.backtrace_format_arg);
                  return EXIT_FAILURE;
                }
            }     
          btrace_print(info.backtrace_file_arg, format);
        }
    }

  btrace_reset();
  btrace_disable();

  if (opt.verbose)
    printf("done.\n");

  options_free(&info);

  return (err ? EXIT_FAILURE : EXIT_SUCCESS);
}
Пример #4
0
int main(int argc, char** argv)
{
  struct gengetopt_args_info info;
  char   *infile = NULL, *outfile = NULL;
  glopt_t opt = {0};

  /* use gengetopt */

  if (options(argc, argv, &info) != 0)
    {
      fprintf(stderr, "failed to parse command line\n");
      return EXIT_FAILURE;
    }

  /* check arguments & transfer to opt structure */ 

  opt.verbose = info.verbose_given;

  opt.numsamp = info.samples_arg;

  if (opt.numsamp < 1)
    {
      fprintf(stderr,"bad number of samples %zu\n",opt.numsamp);
      return EXIT_FAILURE;
    }

  /* null outfile for stdout */

  outfile = (info.output_given ? info.output_arg : NULL);

  if (!outfile && opt.verbose)
    {
      fprintf(stderr,"verbosity suppressed (<stdout> for results)\n");
      opt.verbose = 0;
    }

  /* null infile for stdin */

  switch (info.inputs_num)
    {
    case 0:
      infile = NULL;
      break;
    case 1:
      infile = info.inputs[0];
      break;
    default:
      fprintf(stderr,"Sorry, only one file at a time\n");
      return EXIT_FAILURE;
    }
  
  if (opt.verbose)
    printf("This is gimplut (version %s)\n", VERSION);

  btrace_enable("gimplut");

  int err = gimplut(infile, outfile, opt);

  if (err)
    {
      btrace("failed (error %i)", err);
      btrace_print_stream(stderr, BTRACE_PLAIN);

      if (info.backtrace_file_given)
	{
	  int format = BTRACE_XML;
	  if (info.backtrace_format_given)
	    {
	      format = btrace_format(info.backtrace_format_arg);
	      if (format == BTRACE_ERROR)
		{
		  fprintf(stderr, "no such backtrace format %s\n", 
			  info.backtrace_format_arg);
		  return EXIT_FAILURE;
		}
	    }	  
	  btrace_print(info.backtrace_file_arg, format);
	}
    }
  else if (opt.verbose)
    printf("lookup table written to %s\n",(outfile ? outfile : "<stdin>"));

  btrace_reset();
  btrace_disable();

  if (opt.verbose)
    printf("done.\n");

  options_free(&info);

  return (err ? EXIT_FAILURE : EXIT_SUCCESS);
}
Пример #5
0
int main(int argc, char** argv)
{
  struct gengetopt_args_info info;
  char *infile = NULL, *outfile = NULL;
  gimpsvg_opt_t opt = {0};

  /* use gengetopt */

  if (options(argc, argv, &info) != 0)
    {
      fprintf(stderr, "failed to parse command line\n");
      return EXIT_FAILURE;
    }

  /* check arguments & transfer to opt structure */ 

  opt.verbose = info.verbose_given;
  opt.reverse = false;

  if ((opt.samples = info.samples_arg) < SAMPLES_MIN)
    {
      fprintf(stderr, "at least %i samples required\n", SAMPLES_MIN);
      opt.samples = SAMPLES_MIN;
    }

  /* handle preview */

  if (info.preview_flag || info.geometry_given)
    {
      opt.preview.use = true;
      if (svg_preview_geometry(info.geometry_arg, &(opt.preview)) != 0)
        {
          fprintf(stderr, "failed parse of geometry : %s\n", 
                  info.geometry_arg);
          return EXIT_FAILURE;
        }
    }
  else
    opt.preview.use = false;
  
  /* null outfile for stdout */

  outfile = (info.output_given ? info.output_arg : NULL);

  if (!outfile && opt.verbose)
    {
      fprintf(stderr, "verbosity suppressed (<stdout> for results)\n");
      opt.verbose = 0;
    }

  /* null infile for stdin */

  switch (info.inputs_num)
    {
    case 0:
      infile = NULL;
      break;
    case 1:
      infile = info.inputs[0];
      break;
    default:
      fprintf(stderr, "Sorry, only one file at a time\n");
      return EXIT_FAILURE;
    }
  
  if (opt.verbose)
    printf("This is gimpsvg (version %s)\n", VERSION);

  svg_srand();

  btrace_enable("gimpsvg");

  int err = gimpsvg(infile, outfile, opt);

  if (err)
    {
      btrace("failed (error %i)", err);
      btrace_print_stream(stderr, BTRACE_PLAIN);

      if (info.backtrace_file_given)
	{
	  int format = BTRACE_XML;
	  if (info.backtrace_format_given)
	    {
	      format = btrace_format(info.backtrace_format_arg);
	      if (format == BTRACE_ERROR)
		{
		  fprintf(stderr, "no such backtrace format %s\n", 
			  info.backtrace_format_arg);
		  return EXIT_FAILURE;
		}
	    }	  
	  btrace_print(info.backtrace_file_arg, format);
	}
    }
  else if (opt.verbose)
    {
      printf("palette written to %s\n", (outfile ? outfile : "<stdin>"));
      if (opt.preview.use)
	{
	  printf("with preview (%zu x %zu px)\n", 
		 opt.preview.width, 
		 opt.preview.height);
	}
    }

  btrace_reset();
  btrace_disable();

  if (opt.verbose)
    printf("done.\n");

  options_free(&info);

  return (err ? EXIT_FAILURE : EXIT_SUCCESS);
}