本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例12: setstringsize
void lunascan::setstringsize(int size)
{
if (STRING!=NULL) ERRORMSG();
if (size<1) ERRORMSG();
STRINGSIZE=size;
}
示例13: setscopestacksize
void lunascan::setscopestacksize(int size)
{
if (SCOPESTACK!=NULL) ERRORMSG();
if (size<1) ERRORMSG();
SCOPESTACKSIZE=size;
}
示例14: sethashsize
void lunascan::sethashsize(int size)
{
if (HASH!=NULL) ERRORMSG();
if (size<1) ERRORMSG();
HASHSIZE=size;
}
示例15: setcodestacksize
void lunascan::setcodestacksize(int size)
{
if (CODE!=NULL) ERRORMSG();
if (size<1) ERRORMSG();
CODESTACKMAX=size;
}