本文整理汇总了C++中CheckInit函数的典型用法代码示例。如果您正苦于以下问题:C++ CheckInit函数的具体用法?C++ CheckInit怎么用?C++ CheckInit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CheckInit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: yflash_WriteChunkWithTagsToNAND
int yflash_WriteChunkWithTagsToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, yaffs_ExtendedTags *tags)
{
int blk;
int pg;
CheckInit(dev);
blk = chunkInNAND/32;
pg = chunkInNAND%32;
if(data)
{
memcpy(ramdisk.block[blk]->page[pg].data,data,512);
}
if(tags)
{
yaffs_PackedTags pt;
yaffs_PackTags(&pt,tags);
memcpy(&ramdisk.block[blk]->page[pg].data[512],&pt,sizeof(pt));
}
return YAFFS_OK;
}
示例2: yflash_ReadChunkWithTagsFromNAND
int yflash_ReadChunkWithTagsFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaffs_Tags *tags)
{
int blk;
int pg;
CheckInit(dev);
blk = chunkInNAND/32;
pg = chunkInNAND%32;
if(data)
{
memcpy(data,ramdisk.block[blk]->page[pg].data,512);
}
if(tags)
{
yaffs_PackedTags pt;
memcpy(&pt,&ramdisk.block[blk]->page[pg].data[512],sizeof(yaffs_PackedTags));
yaffs_UnpackTags(tags,&pt);
}
return YAFFS_OK;
}
示例3: camltk_add_file_output
CAMLprim value camltk_add_file_output(value fd, value cbid)
{
CheckInit();
Tcl_CreateFileHandler(tcl_filehandle(fd), TCL_WRITABLE,
FileProc, (ClientData) (Long_val(cbid)));
return Val_unit;
}
示例4: sync
void NetworkTable::Initialize() {
NTSynchronized sync(STATIC_LOCK);
CheckInit();
printf("[NT] NetworkTable::Initialize()...\n");
staticProvider = new NetworkTableProvider(*(staticNode = mode->CreateNode(ipAddress.c_str(), port, threadManager, streamFactory, streamDeleter, typeManager)));
printf("[NT] ...NetworkTable::Initialize().\n");
}
示例5: camltk_add_timer
CAMLprim value camltk_add_timer(value milli, value cbid)
{
CheckInit();
/* look at tkEvent.c , Tk_Token is an int */
return (Val_int(Tcl_CreateTimerHandler(Int_val(milli), TimerProc,
(ClientData) (Long_val(cbid)))));
}
示例6: SDL_CDOpen
SDL_CD *
SDL_CDOpen(int drive)
{
struct SDL_CD *cdrom;
if (!CheckInit(0, NULL)) {
return (NULL);
}
if (drive >= SDL_numcds) {
SDL_SetError("Invalid CD-ROM drive index");
return (NULL);
}
cdrom = (SDL_CD *) SDL_malloc(sizeof(*cdrom));
if (cdrom == NULL) {
SDL_OutOfMemory();
return (NULL);
}
SDL_memset(cdrom, 0, sizeof(*cdrom));
cdrom->id = SDL_CDcaps.Open(drive);
if (cdrom->id < 0) {
SDL_free(cdrom);
return (NULL);
}
default_cdrom = cdrom;
return (cdrom);
}
示例7: CheckInit
void
MinstrelWifiManager::DoReportDataOk (WifiRemoteStation *st,
double ackSnr, WifiMode ackMode, double dataSnr)
{
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st;
station->m_isSampling = false;
station->m_sampleRateSlower = false;
CheckInit (station);
if (!station->m_initialized)
{
return;
}
m_minstrelTable[station->m_txrate].numRateSuccess++;
m_minstrelTable[station->m_txrate].numRateAttempt++;
UpdateRetry (station);
m_minstrelTable[station->m_txrate].numRateAttempt += station->m_retry;
station->m_packetCount++;
if (m_nsupported >= 1)
{
station->m_txrate = FindRate (station);
}
}
示例8: camltk_return
/* Callbacks are always of type _ -> unit, to simplify storage
* But a callback can nevertheless return something (to Tcl) by
* using the following. TCL_VOLATILE ensures that Tcl will make
* a copy of the string
*/
CAMLprim value camltk_return (value v)
{
CheckInit();
Tcl_SetResult(cltclinterp, String_val(v), TCL_VOLATILE);
return Val_unit;
}
示例9: yflash_ReadChunkFromNAND
int yflash_ReadChunkFromNAND(yaffs_Device *dev,int chunkInNAND, __u8 *data, yaffs_Spare *spare)
{
int nread;
CheckInit(dev);
if(data)
{
lseek(filedisk.handle,chunkInNAND * 528,SEEK_SET);
nread = read(filedisk.handle,data,512);
if(nread != 512) return YAFFS_FAIL;
}
if(spare)
{
lseek(filedisk.handle,chunkInNAND * 528 + 512,SEEK_SET);
nread= read(filedisk.handle,spare,16);
if(nread != 16) return YAFFS_FAIL;
}
return YAFFS_OK;
}
示例10: yflash_WriteChunkToNAND
int yflash_WriteChunkToNAND(yaffs_Device *dev,int chunkInNAND,const __u8 *data, const yaffs_Spare *spare)
{
int written;
CheckInit(dev);
if(data)
{
lseek(filedisk.handle,chunkInNAND * 528,SEEK_SET);
written = write(filedisk.handle,data,512);
if(written != 512) return YAFFS_FAIL;
}
if(spare)
{
lseek(filedisk.handle,chunkInNAND * 528 + 512,SEEK_SET);
written = write(filedisk.handle,spare,16);
if(written != 16) return YAFFS_FAIL;
}
return YAFFS_OK;
}
示例11: yflash2_EraseBlock
static int yflash2_EraseBlock(struct yaffs_dev *dev, int block_no)
{
int i;
int h;
CheckInit();
if(block_no < 0 || block_no >= filedisk.nBlocks)
{
yaffs_trace(YAFFS_TRACE_ALWAYS,"Attempt to erase non-existant block %d",block_no);
return YAFFS_FAIL;
}
else
{
u8 pg[PAGE_SIZE];
int syz = PAGE_SIZE;
int pos;
memset(pg,0xff,syz);
h = filedisk.handle[(block_no / ( BLOCKS_PER_HANDLE))];
lseek(h,((block_no % BLOCKS_PER_HANDLE) * dev->param.chunks_per_block) * PAGE_SIZE,SEEK_SET);
for(i = 0; i < dev->param.chunks_per_block; i++)
{
write(h,pg,PAGE_SIZE);
}
pos = lseek(h, 0,SEEK_CUR);
return YAFFS_OK;
}
}
示例12: yflash_EraseBlockInNAND
int yflash_EraseBlockInNAND(yaffs_Device *dev, int blockNumber)
{
int i;
CheckInit(dev);
if(blockNumber < 0 || blockNumber >= filedisk.nBlocks)
{
T(YAFFS_TRACE_ALWAYS,("Attempt to erase non-existant block %d\n",blockNumber));
return YAFFS_FAIL;
}
else
{
yflash_Page pg;
memset(&pg,0xff,sizeof(yflash_Page));
lseek(filedisk.handle, blockNumber * 32 * 528, SEEK_SET);
for(i = 0; i < 32; i++)
{
write(filedisk.handle,&pg,528);
}
return YAFFS_OK;
}
}
示例13: camltk_setvar
CAMLprim value camltk_setvar(value var, value contents)
{
char *s;
char *stable_var = NULL;
char *utf_contents;
CheckInit();
/* SetVar makes a copy of the contents. */
/* In case we have write traces in OCaml, it's better to make sure that
var doesn't move... */
stable_var = string_to_c(var);
utf_contents = caml_string_to_tcl(contents);
s = (char *)Tcl_SetVar(cltclinterp,stable_var, utf_contents,
TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG);
stat_free(stable_var);
if( s == utf_contents ){
tk_error("camltk_setvar: Tcl_SetVar returned strange result. Call the author of mlTk!");
}
stat_free(utf_contents);
if (s == NULL)
tk_error(Tcl_GetStringResult(cltclinterp));
else
return(Val_unit);
}
示例14: SDL_CDNumDrives
int SDL_CDNumDrives(void)
{
if ( ! CheckInit(0, NULL) ) {
return(-1);
}
return(SDL_numcds);
}
示例15: camltk_tcl_eval
/*
* Calling Tcl from Caml
* this version works on an arbitrary Tcl command,
* and does parsing and substitution
*/
CAMLprim value camltk_tcl_eval(value str)
{
int code;
char *cmd = NULL;
CheckInit();
/* Tcl_Eval may write to its argument, so we take a copy
* If the evaluation raises a Caml exception, we have a space
* leak
*/
Tcl_ResetResult(cltclinterp);
cmd = caml_string_to_tcl(str);
code = Tcl_Eval(cltclinterp, cmd);
stat_free(cmd);
switch (code) {
case TCL_OK:
return tcl_string_to_caml(Tcl_GetStringResult(cltclinterp));
case TCL_ERROR:
tk_error(Tcl_GetStringResult(cltclinterp));
default: /* TCL_BREAK, TCL_CONTINUE, TCL_RETURN */
tk_error("bad tcl result");
}
}