Exemple #1
0
void save_files()
{
  char fn1[255], fn2[255];
  FILE *f1, *f2;
  gray **image1, **image2;
  
  image1 = pgm_allocarray(wid, hgt);
  image2 = pgm_allocarray(wid, hgt);
  

  for (int i=0; i<wid*hgt; i++)
    {
      image1[i/wid][i%wid] = (gray) data1[i];
      image2[i/wid][i%wid] = (gray) data2[i];
    }

  snprintf(fn1, 256, "%s_%+.1f_.pgm", fname1, angle_value->value());
  snprintf(fn2, 256, "%s_%+.1f_.pgm", fname2, angle_value->value());
  
  f1 = fopen(fn1, "w");
  f2 = fopen(fn2, "w");

  pgm_writepgm(f1, image1, wid, hgt, 65535, false);
  pgm_writepgm(f2, image2, wid, hgt, 65535, false);

  fclose(f1);
  fclose(f2);

  pgm_freearray(image1, hgt);
  pgm_freearray(image2, hgt);

  fl_beep(FL_BEEP_MESSAGE);
}
void ReportErrors(lua_State * L)
{
	fl_beep(FL_BEEP_ERROR);
	std::stringstream oss;
	oss << "Error: " << lua_tostring(L,-1);
	fl_alert(oss.str().c_str());
	lua_pop(L, 1);
}
Exemple #3
0
void Msg::PrintErrorCounter(const char *title)
{
  if(_commRank || _verbosity < 1) return;
  if(!_warningCount && !_errorCount) return;

  std::string prefix = _errorCount ? "Error   : " : "Warning : ";
  std::string help("Check the full log for details");
  std::string line(std::max(strlen(title), help.size()), '-');
  char warn[128], err[128];
  sprintf(warn, "%5d warning%s", _warningCount, _warningCount == 1 ? "" : "s");
  sprintf(err, "%5d error%s", _errorCount, _errorCount == 1 ? "" : "s");

#if defined(HAVE_FLTK)
  if(FlGui::available()){
    std::string col = _errorCount ? "@C1@." : "@C5@.";
    FlGui::instance()->addMessage((col + prefix + line).c_str());
    FlGui::instance()->addMessage((col + prefix + title).c_str());
    FlGui::instance()->addMessage((col + prefix + warn).c_str());
    FlGui::instance()->addMessage((col + prefix + err).c_str());
    FlGui::instance()->addMessage((col + prefix + help).c_str());
    FlGui::instance()->addMessage((col + prefix + line).c_str());
    if(_errorCount) fl_beep();
  }
#endif

  if(CTX::instance()->terminal){
    const char *c0 = "", *c1 = "";
    if(!streamIsFile(stderr) && streamIsVT100(stderr)){
      c0 = _errorCount ? "\33[1m\33[31m" : "\33[35m"; // bold red or magenta
      c1 = "\33[0m";
    }
    fprintf(stderr, "%s%s\n%s\n%s\n%s\n%s\n%s%s\n", c0, (prefix + line).c_str(),
            (prefix + title).c_str(), (prefix + warn).c_str(),
            (prefix + err).c_str(), (prefix + help).c_str(),
            (prefix + line).c_str(), c1);
    fflush(stderr);
  }
}