Beispiel #1
0
void main (int argc, char *argv[])
{
	SE p;
	IMAGE im;
	int k;

	if (argc < 4)
	{
	  printf ("BinDil <input> <Structuring element> <output>\n");
	  exit(1);
	}

/* Read the structuring element */
	k = get_se (argv[2], &p);
	if (!k)
	{
	  printf ("Bad structuring element, file name '%s'.\n", argv[2]);
	  exit (2);
	}
	printf ("BinDil: Perform a binary dilation on image '%s'.\n", 
		argv[1]);
	printf ("Structuring element is:\n");
	print_se (p);

/* Read the input image */
	if (read_pbm (argv[1], &im) == 0) exit(3);

/* Perform the dilation */
	bin_dilate (im, p);

/* Write the result to the specified file */
	write_pbm (argv[3], im);
}
Beispiel #2
0
static void print_function(syntaxelem_t *elt)
{
    syntaxelem_t *e;

    if (find_skeleton(elt)) {
      log_printf("find_skeleton() returned true for this elt:\n");
      print_se(elt);
      return;
    }

    new_functions++;
    if (!fileOpened) {
	fileOpened = 1;

	if (using_stdio) {
	  fileExisted = 0;
	} else {
	  /* test for existence */
	  outfile = fopen(outPath, "r");
	  if (outfile != NULL) {
	    fileExisted = 1;
	    fclose(outfile);
	  }

	  /* do the fopen */
	  log_printf("writing to %s\n", outPath);
	  outfile = fopen(outPath, "a");
	  if (outfile == NULL) {
	    /* open failed */
	    fatal(1, "%s: cannot open %s\n", progname, outPath);
	  }
	}
  
	if (!fileExisted) file_hdr();
    }

    inform_user("%*s%s\n", inform_indent, "", elt->name);
    function_hdr(elt);
    for (e = elt->parent; e != NULL; e = e->parent) {
      if (e->templ) {
	fprintf(outfile, "%s\n", e->templ);
	break;
      }
    }

    {  /* scope for local vars */
	char *arg_str;

	fprintf(outfile, "%s%s%s::%s(",
		elt->ret_type, (strcmp(elt->ret_type, "") ? "\n" : ""),
		elt->parent->name, elt->name);

	arg_str = args_to_string(
	    elt->args, 
	    opt_a ? strlen(elt->parent->name) + strlen(elt->name) + 3 : 0);
	
	fprintf(outfile, "%s)", arg_str);
	free(arg_str);

	if (elt->throw_decl)
	    fprintf(outfile, " %s", elt->throw_decl);

	if (elt->const_flag)
	    fprintf(outfile, " const");

	fprintf(outfile, "\n{\n");
    }

    debug_printf(elt);
    fprintf(outfile, "}\n\n\n");
}