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


C++ Bug函数代码示例

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


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

示例1: PNMisNew

Bool PNMisNew(Int16 idx)
{  if(PNMok!=TRUE)Bug("PNMok");
   if(idx>=PNMtop)Bug("PnmIN>");
   /*check if patch was added after initial definition*/
   if(idx>=PNMknown) return TRUE;
   return FALSE;
}
开发者ID:AlexMax,项目名称:deutex,代码行数:7,代码来源:texture.c

示例2: ProtectMemory

int
ProtectMemory(LogicalAddress addr, natural nbytes)
{
#if DEBUG_MEMORY
  fprintf(dbgout, "Protecting memory at 0x" LISP ", size 0x" LISP "\n", addr, nbytes);
#endif
#ifdef WINDOWS
  DWORD oldProtect;
  BOOL status = VirtualProtect(addr, nbytes, MEMPROTECT_RX, &oldProtect);
  
  if(!status) {
    wperror("ProtectMemory VirtualProtect");
    Bug(NULL, "couldn't protect " DECIMAL " bytes at 0x" LISP ", errno = %d", nbytes, addr, status);
  }
  return status;
#else
  int status = mprotect(addr, nbytes, PROT_READ | PROT_EXEC);
  
  if (status) {
    status = errno;
    
    if (status == ENOMEM) {
      void *mapaddr = mmap(addr,nbytes, PROT_READ | PROT_EXEC, MAP_ANON|MAP_PRIVATE|MAP_FIXED,-1,0);
      if (mapaddr != MAP_FAILED) {
        return 0;
      }
    }
    Bug(NULL, "couldn't protect " DECIMAL " bytes at " LISP ", errno = %d", nbytes, addr, status);
  }
  return status;
#endif
}
开发者ID:factoryTrouble,项目名称:factoryTrouble,代码行数:32,代码来源:memory.c

示例3: TXUwriteTexFile

/*
** write texture as text file
*/
void TXUwriteTexFile(const char *file)
{  Int16 t,p,pat,top;
   char pname[8];
   FILE *out;

   if(TXUok!=TRUE)         Bug("TXUok");
   if(TXUtexTop<1)         Bug("TxunTx");

   out=fopen(file,FOPEN_WT);
   if(out==NULL)         ProgError("Can't write file %s\n",file);
   TXUrealTexture();
   fprintf(out,";Format of textures:\n");
   fprintf(out,";TextureName\tWidth\tHeight\n");
   fprintf(out,";*\tPatchName\tXoffset\tYoffset\n");
   for (pat=0, t= 0; t <TXUtexTop; t++)
   {  if(TXUtex[t].Name[0]!='\0') /*if tex was not redefined*/
      { fprintf(out,"%-8.8s    ",TXUtex[t].Name);
        fprintf(out,"\t\t%d\t%d\n",TXUtex[t].szX,TXUtex[t].szY);
        for (p = 0; p < TXUtex[t].Npatches; p++)
        { top=pat+p;
          if(top>=TXUpatTop) Bug("TxuP>D");
          PNMgetPatchName(pname,TXUpat[pat+p].Pindex);
          fprintf(out,"*\t%-8.8s    ",pname);
          fprintf(out,"\t%d\t%d\n",TXUpat[pat+p].ofsX,TXUpat[pat+p].ofsY);
        }
      }
      pat+=TXUtex[t].Npatches;
   }
   fprintf(out,";End\n");
   fclose(out);                                                
}
开发者ID:AlexMax,项目名称:deutex,代码行数:34,代码来源:texture.c

示例4: Bug

void Bug::move(){
    if(ground->canMove(pos_x+1, pos_y) == true)
        Bug(pos_x+1, pos_y, ground);
    if(ground->canMove(pos_x-1, pos_y) == true)
        Bug(pos_x-1, pos_y, ground);
    if(ground->canMove(pos_x, pos_y+1) == true)
        Bug(pos_x, pos_y+1, ground);
    if(ground->canMove(pos_x, pos_y-1) == true)
        Bug(pos_x, pos_y-1, ground);
}
开发者ID:dydgus2433,项目名称:Algorithm,代码行数:10,代码来源:Bug.cpp

示例5: lock

    void*
    Store::getVolatileArea ()
    {
        Lock lock(volatileAreasMutex);
        if (!volatileAreas.empty())
        {
            void* area = volatileAreas.front();
            volatileAreas.pop_front();
            Log_VolatileArea ( "Providing area=%p from volatileAreas cache, volatileAreas size=%lu.\n",
                    area, (unsigned long) volatileAreas.size() );
            stats.numberOfVolatileAreasProvided++;
            return area;
        }
#ifdef __XEM_STORE_VOLATILEAREAS_USE_MMAP
        if (volatileAreasFD == -1)
        {
            static const char* tempFile = "/dev/zero";
            volatileAreasFD = open(tempFile, O_RDWR);
            if (volatileAreasFD == -1)
            {
                Bug ( "Could not open volatileAreasFD ! error=%d:%s\n", errno, strerror(errno) );
            }
        }
        void* area = mmap(NULL, DocumentAllocator::getAreaSize(),
#ifdef XEM_MEM_PROTECT_SYS
                PROT_READ
#else
                PROT_READ | PROT_WRITE
#endif
                , MAP_PRIVATE, volatileAreasFD, 0);
        if (area == MAP_FAILED)
        {
            Bug ( "Could not map VolatileArea. error = %d:%s\n", errno, strerror(errno) );
        }
#else
        // void* area = malloc(DocumentAllocator::getAreaSize());
        void* area = NULL;
        int res = posix_memalign(&area, PageSize, DocumentAllocator::getAreaSize());
        if ( res != 0 )
        {
            Bug ("Could not posix_memalign (PagSize=%llx, getAreaSize()=%llx, res=%d\n", PageSize,  DocumentAllocator::getAreaSize(), res);
        }

#endif

#if 0 // INJECTING RANDOM STUFF HERE
        int randomFd = open ( "/dev/urandom", O_RDONLY );
        read ( randomFd, area, DocumentAllocator::getAreaSize() );
        ::close ( randomFd );
#endif
        stats.numberOfVolatileAreasCreated++;
        Log_VolatileArea ( "Providing area=%p, stats.numberOfVolatileAreasCreated=%llu, stats.numberOfVolatileAreasDeleted=%llu\n",
                area, stats.numberOfVolatileAreasCreated, stats.numberOfVolatileAreasDeleted );
        return area;
    }
开发者ID:Doloops,项目名称:Xemeiah,代码行数:55,代码来源:store-volatileareas.cpp

示例6: TXUwriteTEXTUREtoWAD

/********** TEXTURE entry in WAD ********/
Int32 TXUwriteTEXTUREtoWAD(struct WADINFO *info)
{  Int16 t,tt,p,pat;
   Int32 size,ofsTble;
   Int32 NbOfTex;

   if(TXUok!=TRUE) Bug("TXUok");
   if(TXUtexTop<1) Bug("TxuNTx");
   /*count real textures*/
   NbOfTex=TXUrealTexture();
   size=WADRwriteLong(info,NbOfTex);  /*number of entries*/
   ofsTble=WADRposition(info);
   for(tt=0;tt<NbOfTex;tt++)
   {  size+=WADRwriteLong(info,-1);     /*pointer, to be corrected later*/
   }
   for(pat=0,tt=0,t=0; t<TXUtexTop; t++)
   { if(TXUtex[t].Name[0]!='\0')
     {
       /*set texture direct pointer*/
       if(tt>=NbOfTex)Bug("TxuRT");
       WADRsetLong(info,ofsTble+tt*4,size);
       tt++;
       /*write the begining of texture definition*/
       fseek (info->fd, info->wposit, SEEK_SET);  /* Ugly */
       if (output_texture_format != TF_NAMELESS)
         wad_write_name (info->fd, TXUtex[t].Name); size += 8;
       wad_write_i16  (info->fd, 0);              size += 2;
       wad_write_i16  (info->fd, 0);              size += 2;
       wad_write_i16  (info->fd, TXUtex[t].szX);  size += 2;
       wad_write_i16  (info->fd, TXUtex[t].szY);  size += 2;
       if (output_texture_format != TF_STRIFE11)
       {
	 wad_write_i16 (info->fd, 0); size += 2;
	 wad_write_i16 (info->fd, 0); size += 2;
       }
       wad_write_i16  (info->fd, TXUtex[t].Npatches); size += 2;
       for(p=0; p<(TXUtex[t].Npatches); p++)
       { if(pat+p>=TXUpatTop)
	   Bug("TxuP>D");/*number of patches exceeds definitions*/
	 wad_write_i16 (info->fd, TXUpat[pat+p].ofsX);   size += 2;
	 wad_write_i16 (info->fd, TXUpat[pat+p].ofsY);   size += 2;
	 wad_write_i16 (info->fd, TXUpat[pat+p].Pindex); size += 2;
	 if (output_texture_format != TF_STRIFE11)
	 {
	   wad_write_i16 (info->fd, 0); size += 2;
	   wad_write_i16 (info->fd, 0); size += 2;
	 }
       }
       info->wposit = ftell (info->fd);  /* Ugly */
     }
     pat+=TXUtex[t].Npatches;
   }
   return size;
}
开发者ID:AlexMax,项目名称:deutex,代码行数:54,代码来源:texture.c

示例7: TXUaddPatchToCurTex

static void TXUaddPatchToCurTex(Int16 pindex,Int16 ofsX,Int16 ofsY)
{
   char pname[8];
   if(TXUok!=TRUE)                 Bug("TXUok");
   if(TXUpatTop>=TXUpatMax)
   {  TXUpatMax+=NEWPATCHESDEF;
      TXUpat=(struct PATCH *) Realloc(TXUpat,TXUpatMax*sizeof(struct PATCH));
   }
   if(TXUtexCur<0)                Bug("TXUTxC");
   PNMgetPatchName(pname,pindex);  /*check if index correct*/
   TXUtex[TXUtexCur].Npatches+=1;  /*increase texture's patch counter*/
   TXUpat[TXUpatTop].Pindex=pindex;/*declare patch*/
   TXUpat[TXUpatTop].ofsX=ofsX;
   TXUpat[TXUpatTop].ofsY=ofsY;
   TXUpatTop+=1;
}
开发者ID:AlexMax,项目名称:deutex,代码行数:16,代码来源:texture.c

示例8: TXUdefineCurTex

static void TXUdefineCurTex(char name[8],Int16 X,Int16 Y,Bool Redefn)
{  int t;
   if(TXUok!=TRUE) Bug("TXUok");
   TXUtexCur=TXUtexTop;             /*set current entry*/
   TXUtexTop+=1;                     /*find a free position*/
   if(TXUtexTop>=TXUtexMax)
   { TXUtexMax+=NEWTEXTURES;
         TXUtex=(struct TEXTUR *)Realloc(TXUtex,TXUtexMax*sizeof(struct TEXTUR));
   }
   Normalise(TXUtex[TXUtexCur].Name,name); /*declare texture*/
   TXUtex[TXUtexCur].szX=X;
   TXUtex[TXUtexCur].szY=Y;
   TXUtex[TXUtexCur].Npatches=0;
   /*check if we redefine other textures, and overide them.*/
   for(t=0;t<TXUtexCur;t++)
   { if(strncmp(TXUtex[t].Name,name,8)==0)
         { if(Redefn==TRUE)
           { TXUtex[t].Name[0]='\0';
             Detail("Warning: Texture %s is redefined\n", lump_name (name));
           }
           else /*don't redefine textures*/
           { TXUtex[TXUtexCur].Name[0]='\0';
             break;
           }
         }
   }
}
开发者ID:AlexMax,项目名称:deutex,代码行数:27,代码来源:texture.c

示例9: dump_field

/*
 *      dump_field - write a field of a page to file
 */
static void dump_field(FILE * fp, const unsigned char *buf,
                       unsigned long *ofs, enum field_type_t type,
                       const char *desc)
{
    fprintf(fp, "%-10s ", desc);
    if (type == FT_I32) {
        fprintf(fp, "%ld", (long) peek_i32_le(buf + *ofs));
        *ofs += 4;
    } else if (type == FT_NAME) {
        int n;
        putc('"', fp);
        for (n = 0; n < 8 && buf[*ofs + n] != '\0'; n++)
            putc(tolower(buf[*ofs + n]), fp);
        putc('"', fp);
        *ofs += 8;
    } else if (type == FT_S16) {
        fprintf(fp, "\"%.16s\"", buf + *ofs);
        *ofs += 16;
    } else if (type == FT_S32) {
        fprintf(fp, "\"%.32s\"", buf + *ofs);
        *ofs += 32;
    } else if (type == FT_S80) {
        fprintf(fp, "\"%.80s\"", buf + *ofs);
        *ofs += 80;
    } else if (type == FT_S320) {
        fprintf(fp, "\"%.320s\"", buf + *ofs);
        *ofs += 320;
    } else {
        Bug("SS25", "bad field type %d", (int) type);
    }
    fputs(";\n", fp);
}
开发者ID:Doom-Utils,项目名称:deutex,代码行数:35,代码来源:sscript.c

示例10: TXTaddComment

void TXTaddComment(struct TXTFILE *TXT,const char *text)
{ 
  if (TXT == &TXTdummy)
     return;
   if(TXTok!=TRUE) Bug("TW31", "TxtAdC");
  fprintf(TXT->fp,"# %.256s\n",text);
}
开发者ID:RomanHargrave,项目名称:xwadtools,代码行数:7,代码来源:text.c

示例11: switch

 void XemProcessor::xemFunctionTransmittable ( __XProcFunctionArgs__ )
 {
   NodeSet& res0 = *(args[0]);
   bool separator = false;
   String trans;
   for ( NodeSet::iterator iter0 ( res0 ) ; iter0 ; iter0++ )
   {
   	if ( separator ) trans += ";";
   	Item& item = *iter0;
   	switch ( item.getItemType() )
   	{
   	case Item::Type_Null:
   	  Bug ( "Null Item !\n" );
   	  break;
   	case Item::Type_Element:
   	case Item::Type_Attribute:
   	  trans += item.toNode().generateId ();
   	  break;
   	case Item::Type_Bool:
   	case Item::Type_Integer:
   	case Item::Type_Number:
   	case Item::Type_String:
   	  trans += item.toString();
   	  break;
   	
   	}
   }    
   result.setSingleton ( trans );
   Log_XemRoleBased ( "Transmittable : returned '%s'\n", trans.c_str() );
 }  
开发者ID:Doloops,项目名称:Xemeiah,代码行数:30,代码来源:xem-rolebased.cpp

示例12: CALLSTACKITEM_N

TInt CJuikIconManagerImpl::AddIconL(TInt aProviderId, CGulIcon* aIcon)
{
	CALLSTACKITEM_N(_CL("CJuikIconManagerImpl"), _CL("AddIconL"));
	auto_ptr<CGulIcon> icon( aIcon );
	CArrayFix<TInt>& map = ProviderIconIndexL(aProviderId);
	
	TInt ix = KErrNotFound;
	if ( iEmptySlotCount > 0 )
		ix = FindEmptySlotL();
	
	if ( ix == KErrNotFound )
		{
			iIconArray->AppendL( icon.release() );					   
			map.AppendL( LastIndex( *iIconArray ) );
		}
	else
		{
			iEmptySlotCount--;
			if ( iEmptySlotCount < 0 ) Bug( _L("Empty slot count underflow") ).Raise();
			
			(*iIconArray)[ix] = icon.release();
			map.AppendL( ix );
		}
	return LastIndex( map );
}
开发者ID:flaithbheartaigh,项目名称:jaikuengine-mobile-client,代码行数:25,代码来源:juik_iconmanager.cpp

示例13: Memset

/*
** Set memory
*/
void Memset(void  *dest,char car, long n)
{ if(n<0) Bug("MStInf"); /*set inf to zero*/
  if(n==0)return;
#if DT_OS == 'd'
#  if DT_CC == 'd'
  memset(dest,car,(size_t)n);
#  else
   if(n>0x10000L) Bug("MStSup"); /*DOS limit: not more than 0x10000*/
  _fmemset(dest,car,(size_t)n);
#  endif
#elif DT_OS == 'o'
  memset(dest,car,(size_t)n);
#else
  memset(dest,car,(size_t)n);
#endif
}
开发者ID:Doom-Utils,项目名称:xwadtools,代码行数:19,代码来源:tools.c

示例14: Bug

void TGSettingsGUI::on_reset_clicked()
{
    if(pthread_mutex_lock(&SimParams::Lock) != 0)
        Bug(true, "Failed to lock mutex");
    myParams.Reset = true;
    pthread_mutex_unlock(&SimParams::Lock);
}
开发者ID:ANerd,项目名称:TGWave,代码行数:7,代码来源:TGSettingsGUI.cpp

示例15: TXTcloseR

void TXTcloseR(struct TXTFILE *TXT)
{
    if (!TXTok)
        Bug("TR91", "TxtClo");
    fclose(TXT->fp);
    free(TXT);
}
开发者ID:Doom-Utils,项目名称:deutex,代码行数:7,代码来源:text.c


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