这篇教程C++ BLOCK函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中BLOCK函数的典型用法代码示例。如果您正苦于以下问题:C++ BLOCK函数的具体用法?C++ BLOCK怎么用?C++ BLOCK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了BLOCK函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: PROGRAMvoid 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,
示例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 */SWFCharacterSWFMovie_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,
示例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,
示例4: bitmap_setvoid 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,
示例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,
示例6: SWFShape_addStyleHeadervoidSWFShape_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,
示例7: SWFShape_addStyleHeadervoidSWFShape_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,
示例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 */voidSWFTextField_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,
示例9: newSWFText2/* only dif is type 2 allows transparency.. */SWFTextnewSWFText2(){ 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,
示例10: BLOCK// Parte da esquerdavoid 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,
示例11: morecore/* Get neatly aligned memory, initializing orgrowing 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,
示例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,
示例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,
示例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,
示例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,
示例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,
示例17: ZEROvoid 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,
示例18: newSWFSceneDataSWFSceneDatanewSWFSceneData(){ 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,
示例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,
示例20: block_bind_referencedblock 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,
示例21: BLOCKPTRvoid LinnCreate::insertEntry(le32 dirInode, le32 entryInode, char *name, FileType type){ LinnGroup *group; LinnInode *inode; LinnDirectoryEntry *entry; le32 entryNum, blockNum; /* Point to the correct group. */ group = BLOCKPTR(LinnGroup, super->groupsTable); if (dirInode != ZERO) { group += (dirInode / super->inodesPerGroup); } /* Fetch inode. */ inode = BLOCKPTR(LinnInode, group->inodeTable) + (dirInode % super->inodesPerGroup); /* Calculate entry and block number. */ entryNum = inode->size / sizeof(LinnDirectoryEntry); blockNum = (entryNum * sizeof(LinnDirectoryEntry)) / super->blockSize; /* Direct block. */ if (blockNum < LINN_INODE_DIR_BLOCKS) { /* Allocate a new block, if needed. */ if (!inode->block[blockNum]) { inode->block[blockNum] = BLOCK(super); } /* Point to the fresh entry. */ entry = BLOCKPTR(LinnDirectoryEntry, inode->block[blockNum]) + (entryNum % super->blockSize); /* Fill it. */ entry->inode = entryInode; entry->type = type; strncpy(entry->name, name, LINN_DIRENT_NAME_LEN); entry->name[LINN_DIRENT_NAME_LEN - 1] = ZERO; } /* Indirect block. */ else { printf("%s: indirect blocks not (yet) supported for directories/n", prog); exit(EXIT_FAILURE); } /* Increment directory size. */ inode->size += sizeof(LinnDirectoryEntry);}
开发者ID:12234,项目名称:FreeNOS,代码行数:50,
示例22: SWFShape_endvoidSWFShape_end(SWFShape shape){ int i; byte* buffer; if ( shape->isEnded ) return; shape->isEnded = TRUE; buffer = SWFOutput_getBuffer(shape->out); if (shape->isUsingNewStyles == FALSE) { buffer[0] = (SWFOutput_numBits(shape->nFills2) << 4) + SWFOutput_numBits(shape->nLines2); } for ( i=0; i<shape->nRecords; ++i ) { if ( i < shape->nRecords-1 || shape->records[i].type != SHAPERECORD_STATECHANGE ) { SWFShape_writeShapeRecord(shape, shape->records[i]); } free(shape->records[i].record.stateChange); /* all in union are pointers */ } SWFOutput_writeBits(shape->out, 0, 6); /* end tag */ SWFOutput_byteAlign(shape->out); /* addStyleHeader creates a new output and adds the existing one after itself- so even though it's called afterwards it's written before, as it should be */ if ( BLOCK(shape)->type > 0 ) /* i.e., shape with style */ SWFShape_addStyleHeader(shape); free(shape->records); shape->records = NULL; shape->nRecords = 0; shape->lines = &shape->lines2; shape->fills = &shape->fills2; shape->nLines = &shape->nLines2; shape->nFills = &shape->nFills2;}
开发者ID:tkhaga,项目名称:MingHSP,代码行数:49,
示例23: exmask/* Worker: mask elements outside block */staticvoidexmask( int mask, int block, int el, int (*idx_fn)( int, int ) ){ int i, idx; rb->yield(); for( i = 0 ; i < 9 ; ++i ) { idx = (*idx_fn)( el, i ); if( block != BLOCK( idx ) && IS_EMPTY( idx ) ) board[ idx ] |= mask; }}
开发者ID:BurntBrunch,项目名称:rockbox-fft,代码行数:16,
示例24: mainint main(int argc, char* argv[]) { if (argc < 2) { fprintf(stdout, "Usage: %s <disk.d64> [track] [sector]/n", argv[0]); return 1; } char *d = load_disk(argv[1]); if (argc == 4) { read_file(d, atoi(argv[2]), atoi(argv[3])); return 0; } char label[19]; // Includes null & quotes // Read Disk header char *b = BLOCK(d, DIR_TRACK, 0); // Volume label#ifdef D1581 trim(&label[1], &b[4], sizeof(label)-2); label[0] = '"'; strcat(label, "/""); printf("0 %s %c %c/n", label, b[0x19], b[0x1a]);#else trim(&label[1], &b[0x90], sizeof(label)-2); label[0] = '"'; strcat(label, "/""); printf("0 %s %2.2s %2.2s/n", label, &b[0xa2], &b[0xa5]);#endif assert(b[0] == DIR_TRACK);#ifdef D1581 assert(b[1] == 3); assert(b[2] == 'D');#else assert(b[1] == 1); assert(b[2] == 'A');#endif //hexdump(b); //write(1, &b[0x90], 16); lsdir(d, nextblock(d, b)); printf("%d BLOCKS FREE./n", compute_blocks_free(&b[0]));}
开发者ID:aaronsp777,项目名称:Default,代码行数:48,
示例25: ref_stringconst char *ref_string (const char * str){ block_t *b; b = BLOCK(str);#ifdef DEBUG if (b != findblock(str)) { fatal("stralloc.c: called ref_string on non-shared string: %s./n", str); }#endif /* defined(DEBUG) */ if (REFS(b)) REFS(b)++; NDBG(b); ADD_STRING(SIZE(b)); return str;}
开发者ID:Yuffster,项目名称:fluffOS,代码行数:17,
示例26: newSWFDBLBitmapData_fromDataSWFDBLBitmapDatanewSWFDBLBitmapData_fromData(dblData data){ SWFDBLBitmapData dbl; dbl = (SWFDBLBitmapData)malloc(sizeof(struct SWFDBLBitmapData_s)); /* If malloc failed, return NULL to signify this */ if (NULL == dbl) return NULL; SWFCharacterInit((SWFCharacter)dbl); CHARACTERID(dbl) = ++SWF_gNumCharacters; BLOCK(dbl)->writeBlock = writeSWFDBLBitmapDataToMethod; BLOCK(dbl)->complete = completeSWFDBLBitmap; BLOCK(dbl)->dtor = (destroySWFBlockMethod) destroySWFDBLBitmapData; dbl->width = data->width; dbl->height = data->height; dbl->format = data->format; dbl->format2 = data->format2; dbl->data = data->data; if(data->hasalpha) BLOCK(dbl)->type = SWF_DEFINELOSSLESS2; else BLOCK(dbl)->type = SWF_DEFINELOSSLESS; BLOCK(dbl)->length = data->length; BLOCK(dbl)->length += 7; /* character id, format, width, height */ if(dbl->format == 3) BLOCK(dbl)->length++; CHARACTER(dbl)->bounds = newSWFRect(0, dbl->width, 0, dbl->height);#if TRACK_ALLOCS dbl->gcnode = ming_gc_add_node(dbl, (dtorfunctype)destroySWFDBLBitmapData);#endif return dbl;}
开发者ID:cran,项目名称:R2SWF,代码行数:43,
示例27: AquireSemaphore void AquireSemaphore(Semaphore* sem) { if(NumThreads <= 1) { return; } assert(sem); // check if we have zero shits left to give if(__sync_fetch_and_sub(&sem->value, 1) < 0) { // we do // queue up for the toilet. // add ourselves to the waiting list sem->contestants.push_back(GetCurrentThread()); } while(sem->value <= 0) BLOCK(); }
开发者ID:Wannabe66,项目名称:mx,代码行数:18,
注:本文中的BLOCK函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ BLOCKING_INIT_NOTIFIER_HEAD函数代码示例 C++ BLK_SKIP函数代码示例 |