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


C++ PASSERT函数代码示例

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


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

示例1: unionfs_mmap

/* FIST-LITE special version of mmap */
static int unionfs_mmap(struct file *file, struct vm_area_struct *vma)
{
	int err = 0;
	struct file *hidden_file = NULL;
	int willwrite;

	print_entry_location();

	/* This might could be deferred to mmap's writepage. */
	willwrite = ((vma->vm_flags | VM_SHARED | VM_WRITE) == vma->vm_flags);
	if ((err = unionfs_file_revalidate(file, willwrite)))
		goto out;

	PASSERT(ftopd(file));
	hidden_file = ftohf(file);

	err = -ENODEV;
	if (!hidden_file->f_op || !hidden_file->f_op->mmap)
		goto out;

	PASSERT(hidden_file);
	PASSERT(hidden_file->f_op);
	PASSERT(hidden_file->f_op->mmap);

	vma->vm_file = hidden_file;
	err = hidden_file->f_op->mmap(hidden_file, vma);
	get_file(hidden_file);	/* make sure it doesn't get freed on us */
	fput(file);		/* no need to keep extra ref on ours */

      out:
	print_exit_status(err);
	return err;
}
开发者ID:BackupTheBerlios,项目名称:dss-svn,代码行数:34,代码来源:file.c

示例2: unionfs_read

ssize_t unionfs_read(struct file * file, char *buf, size_t count, loff_t * ppos)
{
	int err = -EINVAL;
	struct file *hidden_file = NULL;
	loff_t pos = *ppos;

	print_entry_location();

	if ((err = unionfs_file_revalidate(file, 0)))
		goto out;

	fist_print_file("entering read()", file);

	PASSERT(ftopd(file));
	hidden_file = ftohf(file);
	PASSERT(hidden_file);

	if (!hidden_file->f_op || !hidden_file->f_op->read)
		goto out;

	err = hidden_file->f_op->read(hidden_file, buf, count, &pos);
	*ppos = pos;
	if (err >= 0) {
		/* atime should also be updated for reads of size zero or more */
		fist_copy_attr_atime(file->f_dentry->d_inode,
				     hidden_file->f_dentry->d_inode);
	}
	memcpy(&(file->f_ra), &(hidden_file->f_ra),
	       sizeof(struct file_ra_state));

      out:
	fist_print_file("leaving read()", file);
	print_exit_status(err);
	return err;
}
开发者ID:BackupTheBerlios,项目名称:dss-svn,代码行数:35,代码来源:file.c

示例3: PASSERT

PRenderTransform::PRenderTransform(PDrawable *drawable, PCamera *camera)
{
    PASSERT(drawable != P_NULL);
    PASSERT(camera != P_NULL);

    m_drawable = drawable;
    m_camera   = camera;
}
开发者ID:alonecat06,项目名称:FutureInterface,代码行数:8,代码来源:prendertransform.cpp

示例4: PASSERT

void PPropertyInt::setRange(const pint32 *range)
{
    PASSERT(range != P_NULL);
    PASSERT(range[0] < range[1]);

    m_range[0] = range[0];
    m_range[1] = range[1];

    operator=(m_value);
}
开发者ID:Freedom000,项目名称:FutureInterface,代码行数:10,代码来源:ppropertyint.cpp

示例5: PASSERT

void PBackground::setSize(pfloat32 width, pfloat32 height)
{
    PASSERT(width > 0 && width <= 1.0f);
    PASSERT(height > 0 && height <= 1.0f);

    m_sizeInfo[0] = width;
    m_sizeInfo[1] = height;

    m_dirty = true;
}
开发者ID:alonecat06,项目名称:FutureInterface,代码行数:10,代码来源:pbackground.cpp

示例6: unionfs_write

/* this unionfs_write() does not modify data pages! */
ssize_t unionfs_write(struct file * file, const char *buf, size_t count,
		      loff_t * ppos)
{
	int err = -EINVAL;
	struct file *hidden_file = NULL;
	struct inode *inode;
	struct inode *hidden_inode;
	loff_t pos = *ppos;
	int bstart, bend;

	print_entry_location();

	if ((err = unionfs_file_revalidate(file, 1)))
		goto out;

	inode = file->f_dentry->d_inode;

	bstart = fbstart(file);
	bend = fbend(file);

	ASSERT(bstart != -1);
	PASSERT(ftopd(file));
	PASSERT(ftohf(file));

	hidden_file = ftohf(file);
	hidden_inode = hidden_file->f_dentry->d_inode;

	if (!hidden_file->f_op || !hidden_file->f_op->write)
		goto out;

	/* adjust for append -- seek to the end of the file */
	if (file->f_flags & O_APPEND)
		pos = inode->i_size;

	err = hidden_file->f_op->write(hidden_file, buf, count, &pos);

	/*
	 * copy ctime and mtime from lower layer attributes
	 * atime is unchanged for both layers
	 */
	if (err >= 0)
		fist_copy_attr_times(inode, hidden_inode);

	*ppos = pos;

	/* update this inode's size */
	if (pos > inode->i_size)
		inode->i_size = pos;

      out:
	print_exit_status(err);
	return err;
}
开发者ID:BackupTheBerlios,项目名称:dss-svn,代码行数:54,代码来源:file.c

示例7: PASSERT

void PGlTexture::copyTexture(PGlTextureFormatEnum format, 
        puint32 x, puint32 y, puint32 width, puint32 height, puint32 border)
{
    PASSERT(m_target == GL_TEXTURE_2D);
    PASSERT(m_enabled);

    puint32 internalFormat;
    puint32 dataFormat;
    interpretFormat(format, internalFormat, dataFormat);
    glCopyTexImage2D(GL_TEXTURE_2D, 0, internalFormat, x, y, width, height, border);

    pGlErrorCheckError();
}
开发者ID:alonecat06,项目名称:FutureInterface,代码行数:13,代码来源:pgltexture_es20.cpp

示例8: pAssetRead

pint32 P_APIENTRY pAssetRead(PAsset *asset, void *buffer, puint32 count)
{
    PASSERT(asset != P_NULL);
    if (asset != P_NULL)
    {
        PFile *fp = (PFile *)asset->pHandle;
        
        puint32 readLen = pfread(buffer, sizeof(puint8), count, fp);
        PASSERT(readLen == count);
        
        return readLen;
    }

    return 0;
}
开发者ID:Freedom000,项目名称:FutureInterface,代码行数:15,代码来源:pwin32asset.cpp

示例9: PASSERT

void PPropertyColor::interpolate(pfloat32 t, PAbstractProperty *a, PAbstractProperty *b)
{
    PASSERT(t >= 0 && t <= 1);

    PASSERT(a->type() != P_PROPERTY_COLOR);
    PASSERT(b->type() != P_PROPERTY_COLOR);

    PPropertyColor *v1 = (PPropertyColor*)a;
    PPropertyColor *v2 = (PPropertyColor*)b;

    m_r.interpolate(t, &(v1->m_r), &(v2->m_r));
    m_g.interpolate(t, &(v1->m_g), &(v2->m_g));
    m_b.interpolate(t, &(v1->m_b), &(v2->m_b));
    m_a.interpolate(t, &(v1->m_a), &(v2->m_a));
}
开发者ID:Freedom000,项目名称:FutureInterface,代码行数:15,代码来源:ppropertycolor.cpp

示例10: switch

void PGlState::setBlend(PGlStateEnum mode)
{
    if (m_blend == mode)
    {
        return ;
    }

    m_blend = mode;

    switch (mode)
    {
        case P_GLBLEND_OPAQUE:
            glDisable(GL_BLEND);
            break;
        case P_GLBLEND_ALPHA: 
            glEnable(GL_BLEND);
            glBlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD);
            glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
            break;
        case P_GLBLEND_DSTALPHA: 
            glEnable(GL_BLEND);
            glBlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD);
            glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_DST_ALPHA);
            break;
        case P_GLBLEND_ADDITIVE:
            glEnable(GL_BLEND);
            glBlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD);
            glBlendFunc(GL_SRC_ALPHA, GL_ONE);
            break;
        default:
            PLOG_WARNINGX(P_LOG_CHANNEL_OPENGLEGL, "unknown blend mode");
            PASSERT(0);
            break;
    }
}
开发者ID:Freedom000,项目名称:FutureInterface,代码行数:35,代码来源:pglstate_es20.cpp

示例11: PASSERT

void PGlState::setViewport(puint32 x, puint32 y, puint32 width, puint32 height)
{
    // FIXME: We are still at 4K age.
    PASSERT(x < 4096 &&
            y < 4096 &&
            x + width <= 4096 &&
            y + height <= 4096);
    if (x >= 4096 || y >= 4096 || x + width > 4096 || y + height > 4096)
    {
        PLOG_ERRORX(P_LOG_CHANNEL_OPENGLEGL, "invalid viewport values: (%d, %d, %d, %d)", x, y, width, height);

        // FIXME: it is good to let application crash at OpenGL so we don't return here.
    }

    // Cache the viewport value.
    if (m_viewport[0] == x && m_viewport[1] == y && 
        m_viewport[2] == width && m_viewport[3] == height)  
    {
        return ;
    }

    m_viewport[0] = x;
    m_viewport[1] = y;
    m_viewport[2] = width;
    m_viewport[3] = height;

    glViewport(x, y, width, height);
}
开发者ID:Freedom000,项目名称:FutureInterface,代码行数:28,代码来源:pglstate_es20.cpp

示例12: PScene

MyScene::MyScene(PContext *context)
    : PScene("my-scene", context)
{
    if (!load("scene.psc"))
    {
        PASSERT(!"Failed to load scene.psc");
        return ;
    }
    
    // Create the skybox in a manual way.
    /*
    PResourceManager *resMgr = context->module<PResourceManager>("resource-manager");

    // -------------------------------------------------------------- 
    // Add camera
    // -------------------------------------------------------------- 
    const puint32 *rect = context->rect();

    PCamera *camera = PNEW(PCamera("camera", this));
    camera->setFixed(true);
    camera->transform().setLookAt(0.0f, 0.0f, 10.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
    camera->projection().perspective(60.0f, 2.0f * (pfloat32)rect[2] / (pfloat32)rect[3], 0.1f, 100.0f);
    setMainCamera(camera);
    
    // -------------------------------------------------------------- 
    // Scene objects
    // -------------------------------------------------------------- 
    PSkyBox *skybox = PNEW(PSkyBox("skybox", this));
    skybox->setTexture(resMgr->getTexture("sky/*.tga"));
    */
}
开发者ID:Freedom000,项目名称:paper3d,代码行数:31,代码来源:myscene.cpp

示例13: DumpProfElems

static void DumpProfElems( void )
{
	track_p trk, trkN;
	EPINX_T ep, ep2;
	BOOL_T go;

	trk = pathStartTrk;
	ep = pathStartEp;

	if (pathStartTrk==NULL) lprintf( "s--:- e--:-" );
	else if (pathEndTrk == NULL) lprintf( "sT%d:%d e--:-", GetTrkIndex(pathStartTrk), pathStartEp );
	else lprintf( "sT%d:%d eT%d:%d", GetTrkIndex(pathStartTrk), pathStartEp, GetTrkIndex(pathEndTrk), pathEndEp );
	lprintf( " { " );
	go = TRUE;
	if (!PathListSingle())
	  while ( trk ) {
		if (trk==pathEndTrk) {
			ep2 = pathEndEp;
			go = FALSE;
		} else {
			ep2 = GetNextTrkOnPath( trk, ep );
			PASSERT( "computeProfElem", ep2 >= 0, NOP );
		}
		lprintf( "T%d:%d:%d ", GetTrkIndex(trk), ep, ep2 );
		if (!go)
			break;
		trkN = GetTrkEndTrk(trk,ep2);
		ep = GetEndPtConnectedToMe(trkN,trk);
		trk = trkN;
	}
	lprintf( "}" );
}
开发者ID:sharkcz,项目名称:xtrkcad,代码行数:32,代码来源:cprofile.c

示例14: pMain

void pMain(int argc, char* argv[])
{
    PASSERT(PActivity::s_activity != P_NULL);

    if (PActivity::s_activity != P_NULL)
    {
        PContextProperties contextProperties;
        contextProperties.m_contextName = PString("background");
        contextProperties.m_archiveName = PString("background.par");
        contextProperties.m_windowWidth = 640;
        contextProperties.m_windowHeight = 480;
#if defined P_WIN32
        contextProperties.m_multisamples = 2;
#endif

        PContext* context = PNEW(MyContext(contextProperties));
		context->addModule(PNEW(PResourceManager(context)));
		context->addModule(PNEW(PSceneManager(context)));
		// More modules
        PActivity::s_activity->addContext(context);
    }
    else
    {
        PLOG_ERROR("No running activity");
    }
}
开发者ID:Freedom000,项目名称:paper3d,代码行数:26,代码来源:pmain.cpp

示例15: mm_memory_init_file

void mm_memory_init_file(mm_memory_t* mem)
{
  memset(mem->buf, 255, mem->size);
  PASSERT((mem->file = fopen(mem->fname, "wb+")),
          "Error while opening(wb) file %s", mem->fname);
  fwrite(mem->buf, sizeof(*mem->buf), mem->size, mem->file);
}
开发者ID:cirocosta,项目名称:memman,代码行数:7,代码来源:memory.c


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