• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ BLOCK函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: PROGRAM

void PROGRAM()
{
    GETTOKEN();
    BLOCK(0);
    if(TOKEN != periodsym)
    {
        ERROR("Error number 9, period expected.");
    }
    //the halt at the end of the program
    printToFile(9, 0, 2);
}
开发者ID:KevinDuarte,项目名称:Module4,代码行数:11,代码来源:parserwithcodegen.c


示例2: SWFMovie_importCharacter

/* 
 * Import a character to the movie
 * Imports characters from an other movie. filename (URL) points to a SWF 
 * file with exported characters. 
 *
 * returns a SWFCharacter object
 */
SWFCharacter
SWFMovie_importCharacter(SWFMovie movie, 
                         const char *filename /* URL to movie */, 
                         const char *name /* idetifier of character */)
{
	SWFCharacter res;
	SWFImportBlock importer;
	int id;

	res = (SWFCharacter) malloc(sizeof(struct SWFCharacter_s));
	SWFCharacterInit(res);
	CHARACTERID(res) = id = ++SWF_gNumCharacters;
	BLOCK(res)->type = SWF_DEFINESPRITE;
	BLOCK(res)->writeBlock = NULL;
	BLOCK(res)->complete = completeSWFImportCharacter;
	BLOCK(res)->dtor = (destroySWFBlockMethod) destroySWFCharacter;
	importer = SWFMovie_addImport(movie, filename, name, id);
	SWFCharacter_addDependency(res, (SWFCharacter) importer);
	return res;
}
开发者ID:cameronbracken,项目名称:swfDevice,代码行数:27,代码来源:movie.c


示例3: read_file

// Extracts a file (PRG, SEQ) byte-by-byte to stdout.
void read_file(char *d, int track, int sector) {
  char *b = BLOCK(d, track, sector);
  while (b) {
    if (b[0]) {
      write(1, &b[2], 254);
    } else {
      write(1, &b[2], (unsigned char)b[1]-1);
    }
    b = nextblock(d, b);    
  }
}
开发者ID:aaronsp777,项目名称:Default,代码行数:12,代码来源:read1541.c


示例4: bitmap_set

void bitmap_set(struct bitmap *self, size_t pos)
{
	size_t block = BLOCK(pos);

	if (block >= self->word_alloc) {
		self->word_alloc = block * 2;
		self->words = realloc(self->words, self->word_alloc);
	}

	self->words[block] |= MASK(pos);
}
开发者ID:blackball,项目名称:libewok,代码行数:11,代码来源:bitmap.c


示例5: init_matrix

/*
 * init_matrix - Fill in matrix M with random values.
 */
static void init_matrix(Matrix M, int nb)
{
     int I, J, K, i, j, k;

     /* Initialize random number generator. */
     srand(1);

     /* For each element of each block, fill in random value. */
     for (I = 0; I < nb; I++)
      for (J = 0; J < nb; J++)
           for (i = 0; i < BLOCK_SIZE; i++)
            for (j = 0; j < BLOCK_SIZE; j++)
             BLOCK(MATRIX(M, I, J), i, j) = 
                  ((double)rand()) / (double)RAND_MAX;

     /* Inflate diagonal entries. */
     for (K = 0; K < nb; K++)
      for (k = 0; k < BLOCK_SIZE; k++)
           BLOCK(MATRIX(M, K, K), k, k) *= 10.0;
}
开发者ID:Zhancc,项目名称:gregor,代码行数:23,代码来源:lu_serial.c


示例6: SWFShape_addStyleHeader

void
SWFShape_addStyleHeader(SWFShape shape)
{
	SWFOutput out = newSWFOutput();

	SWFOutput_writeUInt16(out, CHARACTERID(shape));
	SWFOutput_writeRect(out, SWFCharacter_getBounds(CHARACTER(shape)));

	if (shape->isUsingNewStyles) {
		shape->nFills2 = 0;
		shape->nLines2 = 0;
	}

	SWFOutput_writeFillStyles(out, shape->fills2, shape->nFills2, BLOCK(shape)->type);
	SWFOutput_writeLineStyles(out, shape->lines2, shape->nLines2, BLOCK(shape)->type);

	/* prepend shape->out w/ shape header */
	SWFOutput_setNext(out, shape->out);
	shape->out = out;
}
开发者ID:tkhaga,项目名称:MingHSP,代码行数:20,代码来源:shape.c


示例7: SWFShape_addStyleHeader

void
SWFShape_addStyleHeader(SWFShape shape)
{
    SWFOutput out = newSWFOutput();
    SWFOutput_writeUInt16(out, CHARACTERID(shape));
    SWFOutput_writeRect(out, SWFCharacter_getBounds(CHARACTER(shape)));
    if(shape->useVersion == SWF_SHAPE4)
    {
        SWFOutput_writeRect(out, shape->edgeBounds);
        SWFOutput_writeUInt8(out, shape->flags);
    }

    SWFOutput_writeFillStyles(out, shape->fills, shape->nFills,
                              BLOCK(shape)->type, shape->edgeBounds);
    SWFOutput_writeLineStyles(out, shape->lines, shape->nLines, BLOCK(shape)->type);

    /* prepend shape->out w/ shape header */
    SWFOutput_setNext(out, shape->out);
    shape->out = out;
}
开发者ID:cameronbracken,项目名称:swfDevice,代码行数:20,代码来源:shape.c


示例8: font

/* font machinery:
	if a regular font (outlines in fdb) is used, it is added to the textfield
	as type Font and later converted to a FontChar
	while a Font, characters can be added (embedded)
	an Imported font stays as is, so does a BrowserFont
 */
void
SWFTextField_setFont(SWFTextField field, SWFBlock font)
{
	if(font == NULL)
		return;
	if ( BLOCK(font)->type == SWF_BROWSERFONT )
	{
		field->fonttype = BrowserFont;
		field->font.browserFont = (SWFBrowserFont)font;
		SWFCharacter_addDependency((SWFCharacter)field, (SWFCharacter)font);
		field->flags |= SWFTEXTFIELD_HASFONT;
	}
	else if ( BLOCK(font)->type == SWF_DEFINEFONT 
		|| BLOCK(font)->type == SWF_DEFINEFONT2)
	{
		SWFFontCharacter fc = (SWFFontCharacter)font;
		if(checkSWFFontCharacter(fc))	
		{
			SWF_warn("font is empty or has no layout information\n");
			return;
		}
		field->fonttype = Imported;
		field->font.fontchar = fc;
		SWFCharacter_addDependency(
			(SWFCharacter)field, (SWFCharacter)font);
		field->flags |= SWFTEXTFIELD_HASFONT | SWFTEXTFIELD_USEFONT;
	}
	else if (BLOCK(font)->type == SWF_MINGFONT)
	{
		if(!(SWFFont_getFlags((SWFFont)font) & SWF_FONT_HASLAYOUT))
		{
			SWF_warn("font is empty or has no layout information\n");
			return;
		}
		field->fonttype = Font;
		field->font.font = (SWFFont)font;
		field->flags |= SWFTEXTFIELD_HASFONT | SWFTEXTFIELD_USEFONT;
	}
	else
		SWF_warn("SWFTextField_setFont: not a valid font object\n");
}
开发者ID:Reinis,项目名称:wxmacmolplt,代码行数:47,代码来源:textfield.c


示例9: newSWFText2

/* only dif is type 2 allows transparency.. */
SWFText
newSWFText2()
{
	SWFText text = newSWFText();

	/* If malloc failed, return NULL to signify this */
	if (NULL == text)
		return NULL;

	BLOCK(text)->type = SWF_DEFINETEXT2;
	return text;
}
开发者ID:akleine,项目名称:libming,代码行数:13,代码来源:text.c


示例10: BLOCK

// Parte da esquerda
void block::FIRELEFT() {
	e[0] = e[7] = true;

	BLOCK(NR, 12, 0);
	DOT(NR, 0, 0, 11, 31);
	DOT(DR, 12, 0, 12);
	DOT(UR, 12, 14, 14, 15);
	DOT(NR, 14, 0, 23, 24);
	DOT(NR, 15, 0, 25);
	DOT(UR, 12, 0, 32);
	DOT(DR, 12, 14, 34, 35);
}
开发者ID:hayatofujii,项目名称:bomball,代码行数:13,代码来源:block.cpp


示例11: morecore

/* Get neatly aligned memory, initializing or
growing the heap info table as necessary. */
static __ptr_t morecore (__malloc_size_t size)
{
	__ptr_t result;
	malloc_info *newinfo, *oldinfo;
	__malloc_size_t newsize;

	result = align (size);
	if (result == NULL)
		return NULL;

	/* Check if we need to grow the info table.  */
	if ((__malloc_size_t) BLOCK ((char *) result + size) > heapsize)
	{
		newsize = heapsize;
		while ((__malloc_size_t) BLOCK ((char *) result + size) > newsize)
			newsize *= 2;
		newinfo = (malloc_info *) align (newsize * sizeof (malloc_info));
		if (newinfo == NULL)
		{
			(*__morecore) (-size);
			return NULL;
		}
		MEMCPY (newinfo, _heapinfo, heapsize * sizeof (malloc_info));
		MEMSET (&newinfo[heapsize], 0,
				(newsize - heapsize) * sizeof (malloc_info));
		oldinfo = _heapinfo;
		newinfo[BLOCK (oldinfo)].busy.type = 0;
		newinfo[BLOCK (oldinfo)].busy.info.size
		= BLOCKIFY (heapsize * sizeof (malloc_info));
		_heapinfo = newinfo;
		/* Account for the _heapinfo block itself in the statistics.  */
		_bytes_used += newsize * sizeof (malloc_info);
		++_chunks_used;
		_free_internal (oldinfo);
		heapsize = newsize;
	}

	_heaplimit = BLOCK ((char *) result + size);
	return result;
}
开发者ID:Janesak1977,项目名称:ali3602,代码行数:42,代码来源:alloc.c


示例12: _fusion_shmalloc

/* Allocate memory from the heap.  */
void *
_fusion_shmalloc( shmalloc_heap *heap, size_t size )
{
     void *result;
     size_t block, blocks, lastblocks, start;
     register size_t i;
     struct list *next;

     D_DEBUG_AT( Fusion_SHMHeap, "%s( %p, %zu )\n", __FUNCTION__, heap, size );

     D_MAGIC_ASSERT( heap, shmalloc_heap );

     /* Some programs will call shmalloc (0). We let them pass. */
     if (size == 0)
          return NULL;

     if (size < sizeof (struct list))
          size = sizeof (struct list);

     /* Determine the allocation policy based on the request size.  */
     if (size <= BLOCKSIZE / 2) {
          /* Small allocation to receive a fragment of a block.
             Determine the logarithm to base two of the fragment size. */
          register size_t log = 1;
          --size;
          while ((size /= 2) != 0)
               ++log;

          /* Look in the fragment lists for a
             free fragment of the desired size. */
          next = heap->fraghead[log].next;
          if (next != NULL) {
               /* There are free fragments of this size.
                  Pop a fragment out of the fragment list and return it.
                  Update the block's nfree and first counters. */
               result = (void *) next;
               next->prev->next = next->next;
               if (next->next != NULL)
                    next->next->prev = next->prev;
               block = BLOCK (result);
               if (--(heap->heapinfo[block].busy.info.frag.nfree) != 0)
                    heap->heapinfo[block].busy.info.frag.first = (unsigned long int)
                                                                   ((unsigned long int) ((char *) next->next - (char *) NULL)
                                                                    % BLOCKSIZE) >> log;

               /* Update the statistics.  */
               heap->chunks_used++;
               heap->bytes_used += 1 << log;
               heap->chunks_free--;
               heap->bytes_free -= 1 << log;
          }
          else {
开发者ID:Distrotech,项目名称:DirectFB,代码行数:53,代码来源:heap.c


示例13: print_matrix

/*
 * print_matrix - Print matrix M.
 */
static void print_matrix(Matrix M, int nb)
{
     int i, j;

     /* Print out matrix. */
     for (i = 0; i < nb * BLOCK_SIZE; i++) {
      for (j = 0; j < nb * BLOCK_SIZE; j++)
           printf(" %6.4f",
              BLOCK(MATRIX(M, i / BLOCK_SIZE, j / BLOCK_SIZE),
                i % BLOCK_SIZE, j % BLOCK_SIZE));
      printf("\n");
     }
}
开发者ID:Zhancc,项目名称:gregor,代码行数:16,代码来源:lu_serial.c


示例14: block_graph

/* block_graph:
 * Add induced edges.
 */
static void block_graph(Agraph_t * g, block_t * sn)
{
    Agnode_t *n;
    Agedge_t *e;
    Agraph_t *subg = sn->sub_graph;

    for (n = agfstnode(subg); n; n = agnxtnode(subg, n)) {
	for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
	    if (BLOCK(e->head) == sn)
		aginsert(subg, e);
	}
    }
}
开发者ID:Goettsch,项目名称:game-editor,代码行数:16,代码来源:blockpath.c


示例15: file_size

// Calculate exact file size by reading entire file.
// Fast since its all in ram.
int file_size(char *d, int track, int sector) {
  int size = 0;
  char *b = BLOCK(d, track, sector);
  while (b) {
    if (b[0]) {
      size += 254;
    } else {
      size += (unsigned char)b[1]-1;
    }
    b = nextblock(d, b);
  }
  return size;
}
开发者ID:aaronsp777,项目名称:Default,代码行数:15,代码来源:read1541.c


示例16: rehashed

/*
  growMap: based on hash.c:hsplit() from Larry Wall's Perl.

  growMap doubles the size of the hash table.  It is called when FILL_PERCENT
  of the buckets in the hash table contain values.  This routine is
  efficient since the entries in the table don't need to be rehashed (even
  though the entries are redistributed across the both halves of the hash
  table).
*/
INLINE unsigned long sval_hash(svalue_t x) {
    switch(x.type)
    {
    case T_STRING:
        return HASH(BLOCK(x.u.string));
    case T_NUMBER:
        return (unsigned long)x.u.number;
    case T_OBJECT:
    //return HASH(BLOCK(x.u.ob->obname));
    default:
        return (unsigned long)(((POINTER_INT)((x).u.number)) >> 5);
    }
}
开发者ID:ViKingIX,项目名称:NtOS,代码行数:22,代码来源:mapping.c


示例17: ZERO

void block::MONSTER4() {
	ZERO();
	e[0] = e[5] = true;
	monster = '4';

	BLOCK(NR, 12, 0);
	DOT(NR, 0, 0, 11, 15);
	DOT(DR, 12, 0, 12, 14, 21, 25);
	DOT(E2, 0, 12, 22);
	DOT(E3, 0, 12, 24);
	DOT(UT, 0, 12, 32, 34);
	DOT(SQ, 0, 12, 33);
}
开发者ID:hayatofujii,项目名称:bomball,代码行数:13,代码来源:block.cpp


示例18: newSWFSceneData

SWFSceneData
newSWFSceneData()
{
	SWFSceneData sdata= (SWFSceneData)malloc(sizeof(struct SWFSceneData_s));

	SWFCharacterInit((SWFCharacter)sdata);
	BLOCK(sdata)->type = SWF_DEFINESCENEANDFRAMEDATA;
	BLOCK(sdata)->writeBlock = writeSWFSceneDataToMethod;
	BLOCK(sdata)->complete = completeSWFSceneData;
	BLOCK(sdata)->dtor = (destroySWFBlockMethod) destroySWFSceneData;
	
	sdata->sceneCount = 0;
	sdata->sceneOffset = NULL;
	sdata->sceneName = NULL;
	
	sdata->frameLabelCount = 0;
	sdata->frameNumber = NULL;
	sdata->frameLabel = NULL;

	sdata->out = NULL;
	return sdata;
}
开发者ID:cameronbracken,项目名称:swfDevice,代码行数:22,代码来源:scenedata.c


示例19: test_result

/*
 * test_result - Check that matrix LU contains LU decomposition of M.
 */
static int test_result(Matrix LU, Matrix M, int nb)
{
     int I, J, K, i, j, k;
     double diff, max_diff;
     double v;

     /* Initialize test. */
     max_diff = 0.0;

     /* Find maximum difference between any element of LU and M. */
     for (i = 0; i < nb * BLOCK_SIZE; i++)
      for (j = 0; j < nb * BLOCK_SIZE; j++) {
           I = i / BLOCK_SIZE;
           J = j / BLOCK_SIZE;
           v = 0.0;
           for (k = 0; k < i && k <= j; k++) {
            K = k / BLOCK_SIZE;
            v += BLOCK(MATRIX(LU, I, K), i % BLOCK_SIZE,
                   k % BLOCK_SIZE) *
            BLOCK(MATRIX(LU, K, J), k % BLOCK_SIZE,
                  j % BLOCK_SIZE);
           }
           if (k == i && k <= j) {
            K = k / BLOCK_SIZE;
            v += BLOCK(MATRIX(LU, K, J), k % BLOCK_SIZE,
                   j % BLOCK_SIZE);
           }
           diff = fabs(BLOCK(MATRIX(M, I, J), i % BLOCK_SIZE,
                 j % BLOCK_SIZE) - v);
           if (diff > max_diff)
            max_diff = diff;
      }

     /* Check maximum difference against threshold. */
     if (max_diff > 0.00001)
      return 0;
     else
      return 1;
}
开发者ID:Zhancc,项目名称:gregor,代码行数:42,代码来源:lu_serial.c


示例20: block_bind_referenced

block block_bind_referenced(block binder, block body, int bindflags) {
  assert(block_has_only_binders(binder, bindflags));
  bindflags |= OP_HAS_BINDING;
  block refd = gen_noop();
  for (inst* curr; (curr = block_take(&binder));) {
    block b = inst_block(curr);
    if (block_bind_subblock(b, body, bindflags)) {
      refd = BLOCK(refd, b);
    } else {
      block_free(b);
    }
  }
  return block_join(refd, body);
}
开发者ID:Abioy,项目名称:kythe,代码行数:14,代码来源:compile.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ BLOCKING_INIT_NOTIFIER_HEAD函数代码示例发布时间:2022-05-30
下一篇:
C++ BLK_SKIP函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap