当前位置: 首页>>代码示例>>C++>>正文


C++ ERRORMSG函数代码示例

本文整理汇总了C++中ERRORMSG函数的典型用法代码示例。如果您正苦于以下问题:C++ ERRORMSG函数的具体用法?C++ ERRORMSG怎么用?C++ ERRORMSG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ERRORMSG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: uninitializeCache

bool uninitializeCache()
{
    void *threadResult;
    bool res = true;

    // Stop the cache controller thread
    _stopCacheControllerThread = true;
    _work++;
    if (pthread_join(_cacheThread, &threadResult)) {
        ERRORMSG(_("An error occurred while waiting the end of the cache "
            "controller thread"));
        res = false;
    }
 
    // Check if all pages has been read. Otherwise free them
    for (unsigned long i=0; i < _maxPagesInTable; i++) {
        if (_pages[i]) {
            ERRORMSG(_("Cache: page %lu hasn't be used!"), i+1);
            delete _pages[i]->page();
            delete _pages[i];
        }
    }
    delete[] _pages;

    return res;
}
开发者ID:bendlas,项目名称:splix,代码行数:26,代码来源:cache.cpp

示例2: ERRORMSG

bool CacheEntry::restoreIntoMemory()
{
    int fd;

    if (!_tempFile) {
        ERRORMSG(_("Trying to restore a page instance into memory which is "
            "aready into memory"));
        return false;
    }

    // Open the swap file
    if ((fd = open(_tempFile, O_RDONLY)) == -1) {
        ERRORMSG(_("Cannot restore page into memory (%i)"), errno);
        return false;
    }

    // Restore the instance
    if (!(_page = Page::restoreIntoMemory(fd))) {
        ERRORMSG(_("Cannot restore page into memory"));
        return false;
    }

    // Destroy the swap file
    close(fd);
    unlink(_tempFile);
    delete[] _tempFile;
    _tempFile = NULL;

    DEBUGMSG(_("Page %lu restored into memory"), _page->pageNr());
    return true;
}
开发者ID:bendlas,项目名称:splix,代码行数:31,代码来源:cache.cpp

示例3: writebits

static void writebits(FILE *file,unsigned int value,int bits)
   {
   if (bits<0 || bits>32) ERRORMSG();

   if (bits==0) return;

   value&=DDS_shiftl(1,bits)-1;

   if (DDS_bufsize+bits<32)
      {
      DDS_buffer=DDS_shiftl(DDS_buffer,bits)|value;
      DDS_bufsize+=bits;
      }
   else
      {
      DDS_buffer=DDS_shiftl(DDS_buffer,32-DDS_bufsize);
      DDS_bufsize+=bits-32;
      DDS_buffer|=DDS_shiftr(value,DDS_bufsize);
      if (DDS_ISINTEL) DDS_swapuint(&DDS_buffer);
      if (fwrite(&DDS_buffer,4,1,file)!=1) ERRORMSG();
      DDS_buffer=value&(DDS_shiftl(1,DDS_bufsize)-1);
      }

   DDS_bitcnt+=bits;
   }
开发者ID:BillTheBest,项目名称:Equalizer,代码行数:25,代码来源:ddsbase.cpp

示例4: xmlParseFile

int GTO2Slater::parse(const char* fname) {

  // build an XML tree from a the file;
  xmlDocPtr m_doc = xmlParseFile(fname);
  if (m_doc == NULL) {
    ERRORMSG("File " << fname << " is invalid")
    xmlFreeDoc(m_doc);
    return 1;
  }    
  // Check the document is of the right kind
  xmlNodePtr cur = xmlDocGetRootElement(m_doc);
  if (cur == NULL) {
    ERRORMSG("Empty document");
    xmlFreeDoc(m_doc);
    return 1;
  }

  xmlXPathContextPtr m_context = xmlXPathNewContext(m_doc);
  xmlXPathObjectPtr result
    = xmlXPathEvalExpression((const xmlChar*)"//atomicBasisSet",m_context);
  if(!xmlXPathNodeSetIsEmpty(result->nodesetval)) {
    for(int ic=0; ic<result->nodesetval->nodeNr; ic++) {
        cout << "Going to optimize" << endl;
      if(put(result->nodesetval->nodeTab[ic])) {
        optimize();
      }
    }
  }

  xmlXPathFreeObject(result);

  return 1;
}
开发者ID:digideskio,项目名称:qmcpack,代码行数:33,代码来源:gto2slater.cpp

示例5: if

// swap byte ordering between MSB and LSB
void MiniDatabuf::swapbytes()
{
	unsigned int i,b;

	unsigned char *ptr,tmp;

	if (type==0 || (type>=3 && type<=6)) return;

	if (type==1) b=2;
	else if (type==2) b=4;
	else ERRORMSG();

	if (bytes==0 || bytes%b!=0) ERRORMSG();

	ptr=(unsigned char *)data+bytes;

	while (ptr!=data)
	{
		ptr-=b;

		for (i=0; i<(b>>1); i++)
		{
			tmp=ptr[i];
			ptr[i]=ptr[b-1-i];
			ptr[b-1-i]=tmp;
		}
	}
}
开发者ID:kalwalt,项目名称:ofxVTerrain,代码行数:29,代码来源:MiniDatabuf.cpp

示例6: writePNMimage

// write an optionally compressed PNM image
void writePNMimage(const char *filename,unsigned const char *image,unsigned int width,unsigned int height,unsigned int components,int dds)
   {
   char str[DDS_MAXSTR];

   unsigned char *data;

   if (width<1 || height<1) ERRORMSG();

   switch (components)
      {
      case 1: snprintf(str,DDS_MAXSTR,"P5\n%d %d\n255\n",width,height); break;
      case 2: snprintf(str,DDS_MAXSTR,"P5\n%d %d\n32767\n",width,height); break;
      case 3: snprintf(str,DDS_MAXSTR,"P6\n%d %d\n255\n",width,height); break;
      default: ERRORMSG();
      }

   if ((data=(unsigned char *)malloc(strlen(str)+width*height*components))==NULL) ERRORMSG();

   memcpy(data,str,strlen(str));
   memcpy(data+strlen(str),image,width*height*components);

   if (DDS_ISINTEL)
      if (components==2) swapshort(data+strlen(str),width*height);

   if (dds!=0) writeDDSfile(filename,data,strlen(str)+width*height*components,components,width);
   else writeRAWfile(filename,data,strlen(str)+width*height*components);
   }
开发者ID:BillTheBest,项目名称:Equalizer,代码行数:28,代码来源:ddsbase.cpp

示例7: CheckWork

bool CheckWork(CBlock* pblock, CWallet& wallet) {
//	uint256 hash = pblock->GetHash();
//	uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
//
//	if (hash > hashTarget)
//		return false;

	//// debug print
//	LogPrint("INFO","proof-of-work found  \n  hash: %s  \ntarget: %s\n", hash.GetHex(), hashTarget.GetHex());
	pblock->print(*pAccountViewTip);
	// LogPrint("INFO","generated %s\n", FormatMoney(pblock->vtx[0].vout[0].nValue));

	// Found a solution
	{
		LOCK(cs_main);
		if (pblock->GetHashPrevBlock() != chainActive.Tip()->GetBlockHash())
			return ERRORMSG("HonghuoMiner : generated block is stale");

		// Remove key from key pool
	//	reservekey.KeepKey();

		// Track how many getdata requests this block gets
//		{
//			LOCK(wallet.cs_wallet);
//			wallet.mapRequestCount[pblock->GetHash()] = 0;
//		}

		// Process this block the same as if we had received it from another node
		CValidationState state;
		if (!ProcessBlock(state, NULL, pblock))
			return ERRORMSG("HonghuoMiner : ProcessBlock, block not accepted");
	}

	return true;
}
开发者ID:huanghao2008,项目名称:honghuo,代码行数:35,代码来源:miner.cpp

示例8: main

/**file main.cpp
 *@brief a main function for QMC simulation. 
 *Actual works are done by QMCApps and its derived classe.
 *For other simulations, one can derive a class from QMCApps, similarly to MolecuApps.
 *
 *Only requirements are the constructor and init function to initialize.
 */
int main(int argc, char **argv) {

  OHMMS::Controller->initialize(argc,argv);

  OhmmsInfo welcome(argc,argv,OHMMS::Controller->mycontext());

  ohmmsqmc::MolecuApps qmc(argc,argv);

  if(argc>1) {
    // build an XML tree from a the file;
    xmlDocPtr m_doc = xmlParseFile(argv[1]);
    if (m_doc == NULL) {
      ERRORMSG("File " << argv[1] << " is invalid")
      xmlFreeDoc(m_doc);
      return 1;
    }    
    // Check the document is of the right kind
    xmlNodePtr cur = xmlDocGetRootElement(m_doc);
    if (cur == NULL) {
      ERRORMSG("Empty document");
      xmlFreeDoc(m_doc);
      return 1;
    }
    qmc.run(cur);
  } else {
    WARNMSG("No argument is given. Assume that  does not need an input file")
    qmc.run(NULL);
  }
  LOGMSG("Bye")
  OHMMS::Controller->finalize();
  return 0;
}
开发者ID:digideskio,项目名称:qmcpack,代码行数:39,代码来源:main.cpp

示例9: CCSer_InternalMapRegisterAddresses

// Miscellaneous internal routines.
PUCHAR
static
CCSer_InternalMapRegisterAddresses(
    ULONG   HWAddress,
    ULONG   Size
    )
{
	PUCHAR	ioPortBase; 

    DEBUGMSG(ZONE_FUNCTION, 
             (TEXT("+CCSer_InternalMapRegisterAddresses: adr=0x%x len=0x%x\r\n"),
			 HWAddress, Size));

	ioPortBase = VirtualAlloc(0, Size, MEM_RESERVE, PAGE_NOACCESS);
	if ( ioPortBase == NULL )
	{
		ERRORMSG(1, (TEXT("CCSer_InternalMapRegisterAddresses: VirtualAlloc failed!\r\n")));
	}
	else if ( !VirtualCopy((PVOID)ioPortBase, (PVOID)HWAddress, Size, PAGE_READWRITE|PAGE_NOCACHE) )
	{
		ERRORMSG(1, (TEXT("CCSer_InternalMapRegisterAddresses: VirtualCopy failed!\r\n")));
		VirtualFree( (PVOID)ioPortBase, 0, MEM_RELEASE );
		ioPortBase = 0;
	}

    DEBUGMSG(ZONE_FUNCTION, 
             (TEXT("-CCSer_InternalMapRegisterAddresses: mapped at 0x%x\r\n"),
              ioPortBase ));

    return ioPortBase;
}
开发者ID:zizilala,项目名称:projects_wince_new,代码行数:32,代码来源:ccser_pdd.c

示例10: read_gz

static void read_gz(int f, int fd, const char *arg)
{
    gzFile  g;
    int     nBuf;
    char    buf[BUFFER_SIZE];

    g=gzdopen(f, "rb");
    if (!g)
    {
        ERRORMSG(_("Invalid/corrupt .gz file.\n"));
        close(f);
        close(fd);
        return;
    }
    while ((nBuf=gzread(g, buf, BUFFER_SIZE))>0)
    {
        if (write(fd, buf, nBuf)!=nBuf)
        {
            gzclose(g);
            close(fd);
            return;
        }
    }
    if (nBuf)
    {
        ERRORMSG("\033[0m");
        ERRORMSG(_("gzip: Error during decompression.\n"));
    }
    gzclose(g);
    close(fd);
}
开发者ID:kilobyte,项目名称:termrec,代码行数:31,代码来源:compress.c

示例11: transfer_creature

void transfer_creature(struct Thing *boxtng, struct Thing *transftng, unsigned char plyr_idx)
{
    SYNCDBG(7,"Starting");
    struct CreatureControl *cctrl;
    if (!thing_exists(boxtng) || (box_thing_to_special(boxtng) != SpcKind_TrnsfrCrtr) ) {
        ERRORMSG("Invalid transfer box object!");
        return;
    }
    // Check if 'things' are correct
    if (!thing_exists(transftng) || !thing_is_creature(transftng) || (transftng->owner != plyr_idx)) {
        ERRORMSG("Invalid transfer creature thing!");
        return;
    }

    cctrl = creature_control_get_from_thing(transftng);
    set_transfered_creature(plyr_idx, transftng->model, cctrl->explevel);
    remove_thing_from_power_hand_list(transftng, plyr_idx);
    kill_creature(transftng, INVALID_THING, -1, CrDed_NoEffects|CrDed_NotReallyDying);
    create_special_used_effect(&boxtng->mappos, plyr_idx);
    remove_events_thing_is_attached_to(boxtng);
    force_any_creature_dragging_owned_thing_to_drop_it(boxtng);
    delete_thing_structure(boxtng, 0);
    if (is_my_player_number(plyr_idx))
      output_message(SMsg_CommonAcknowledge, 0, true);
}
开发者ID:dkfans,项目名称:keeperfx-stable,代码行数:25,代码来源:power_specials.c

示例12: setstringsize

void lunascan::setstringsize(int size)
   {
   if (STRING!=NULL) ERRORMSG();

   if (size<1) ERRORMSG();

   STRINGSIZE=size;
   }
开发者ID:mahdi12167,项目名称:libmini,代码行数:8,代码来源:lunascan.cpp

示例13: setscopestacksize

void lunascan::setscopestacksize(int size)
   {
   if (SCOPESTACK!=NULL) ERRORMSG();

   if (size<1) ERRORMSG();

   SCOPESTACKSIZE=size;
   }
开发者ID:mahdi12167,项目名称:libmini,代码行数:8,代码来源:lunascan.cpp

示例14: sethashsize

void lunascan::sethashsize(int size)
   {
   if (HASH!=NULL) ERRORMSG();

   if (size<1) ERRORMSG();

   HASHSIZE=size;
   }
开发者ID:mahdi12167,项目名称:libmini,代码行数:8,代码来源:lunascan.cpp

示例15: setcodestacksize

void lunascan::setcodestacksize(int size)
   {
   if (CODE!=NULL) ERRORMSG();

   if (size<1) ERRORMSG();

   CODESTACKMAX=size;
   }
开发者ID:mahdi12167,项目名称:libmini,代码行数:8,代码来源:lunascan.cpp


注:本文中的ERRORMSG函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。