Example #1
0
// For critical erros
void PIRSession::exitWithErrorMessage(string funcName, string message) 
{
  writeErrorMessage(funcName, message);

  // This is used in the main function (start()) to skip costly operations if an error occurred
  handmadeExceptionRaised = true;	
}
Example #2
0
File: commons.c Project: hh/emacs
void internalCheckFail(char *expr, char *file, int line) {
	if (errOut == NULL) errOut = stderr;
	sprintf(tmpBuff,"'%s' is not valid in '%s:%d'",expr,file,line);
	writeErrorMessage(ERR_INTERNAL_CHECK,tmpBuff);
	if (s_opt.taskRegime == RegimeEditServer || s_opt.refactoringRegime == RegimeRefactory) {
		if (s_opt.xref2) {
			ppcGenRecord(PPC_INFORMATION,"Exiting","\n");
			mainCloseOutputFile();
			ppcGenSynchroRecord();
		} else {
			fprintf(errOut, "\t exiting!\n"); fflush(stderr);
		}
	}
#   ifdef CORE_DUMP
		emergencyExit(XREF_EXIT_ERR);
#   endif
	if (s_opt.taskRegime == RegimeEditServer 
		|| s_opt.refactoringRegime == RegimeRefactory
		|| s_fileAbortionEnabled == 0
		) {
		emergencyExit(XREF_EXIT_ERR);
	}
	fprintf(errOut, "\t file aborted!\n"); fflush(errOut);
	// longjump is causing problems with refactory, the longjmp
	// is missplaced
	longjmp(cxmemOverflow,MESS_FILE_ABORT); 
}
Example #3
0
void CGIOutput::displayIndexListingPage() {
  string genericPage=loadPageTemplate(GENERICPAGE_TEMPLATE_NAME);
  if (genericPage=="") {
    writeErrorMessage("Cannot load template.", "Cannot load template for index display.");
    return;
  }

  // build our LemurCGIItems string...
  stringstream lemurIndexItems;

  lemurIndexItems << "<PRE>\n";

  int nIndices=CGIConfiguration::getInstance().getNumIndices();

  lemurIndexItems << "IndexID " << setw(9) << "Index Description\n\n";

  for (int i=0; i < nIndices; i++) {
    lemurIndexItems << i << " " << setw(9) << CGIConfiguration::getInstance().getIndexDescription(i) << "\n";
  }

  lemurIndexItems << "</PRE>\n";

  substitutionValues.put("LemurCGIItems", lemurIndexItems.str().c_str());
  substitutionValues.put("LemurSubTitle", "Datasources");

  replaceResultsPageParameters(&genericPage);

  outputHTTPHeader("text/html");
  cout << genericPage << "\n";
}
Example #4
0
bool CGIOutput::resetResultsPage() {
  // reset any statistics
  setResultStatistics(0, 0, 0, 0);
  setResultQuery("");
  currentNumDisplayedResults=0;

  substitutionValues.clear();

  substitutionValues.put("LemurSearchTitle", DEFAULT_RESULTS_PAGE_TITLE);

  loadedPageTemplateStart="";
  loadedPageTemplateEnd="";

  // load in the template
  string templatePage=loadPageTemplate(RESULTSPAGE_TEMPLATE_NAME);

  if (templatePage=="") {
    // couldn't load it!
    writeErrorMessage("Cannot load results page template.", "Cannot load results page template. Template file could not be opened.");
    return false;
  }

  // split the template into [start] [results] [end]
  size_t resultsPosition=templatePage.find("{%LemurSearchResults%}");
  if (resultsPosition==std::string::npos) {
    // no results tag?
    writeErrorMessage("No LemurSearchResults tag found.", "Error in results page template. A {%LemurSearchResults%} tag could not be found.");
    return false;
  }

  loadedPageTemplateStart=templatePage.substr(0, resultsPosition);
  loadedPageTemplateEnd=templatePage.substr(resultsPosition + 22, templatePage.length());

  // ensure there is one and only one {%LemurSearchResults%} tag...
  if (loadedPageTemplateEnd.find("{%LemurSearchResults%}")!=std::string::npos) {
    writeErrorMessage("Multiple LemurSearchResults tags found.", "Error in results page template. Multiple {%LemurSearchResults%} tags were found. Only one is allowed.");
    return false;
  }

  // process any pre-processor tags (# results, etc.)

  // load in the result item template
  resultItemTemplate=loadPageTemplate(SINGLERESULT_TEMPLATE_NAME);

  return true;
}
Example #5
0
void CGIOutput::displayDefaultSearchPage() {
  string defaultPage=loadPageTemplate(DEFAULTSEARCHPAGE_TEMPLATE_NAME);
  if (defaultPage=="") {
    writeErrorMessage("Cannot load template.", "Cannot load default search template.");
    return;
  }

  replaceResultsPageParameters(&defaultPage);

  outputHTTPHeader("text/html");
  cout << defaultPage << "\n";
}
Example #6
0
void CGIOutput::displayDataPage(string stringOfData, string pageTitle, bool listData) {

  if (outputMode==CGI_OUTPUT_DIAGNOSTIC) {
    outputHTTPHeader("text/plain");
    cout << stringOfData << endl;
    return;
  }

  if (outputMode==CGI_OUTPUT_PROGRAM) {
    outputHTTPHeader("text/html");
    cout << "<html>\n<head>\n<title>" << pageTitle << "</title>\n</head>\n<body>\n" << stringOfData << "\n</body>\n</html>\n\n";
    return;
  }

  string genericPage=loadPageTemplate(GENERICPAGE_TEMPLATE_NAME);
  if (genericPage=="") {
    writeErrorMessage("Cannot load template.", "Cannot load template for index display.");
    return;
  }

  // build our LemurCGIItems string...
  stringstream outputString;

  if (listData) {
    outputString << "<PRE>\n" << stringOfData << "\n</PRE>\n";
  } else {
    outputString << stringOfData << "\n";
  }

  substitutionValues.put("LemurCGIItems", outputString.str().c_str());
  substitutionValues.put("LemurSubTitle", pageTitle.c_str());

  replaceResultsPageParameters(&genericPage);

  outputHTTPHeader("text/html");
  cout << genericPage << "\n";

}
Example #7
0
File: commons.c Project: hh/emacs
void error(int errCode, char *mess) {
	if ((! s_opt.noErrors) && (! s_javaPreScanOnly)) {
		writeErrorMessage(errCode, mess);
	}
}