本文整理汇总了C++中PASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ PASSERT函数的具体用法?C++ PASSERT怎么用?C++ PASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PASSERT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: PASSERT
void PRenderer::render(PRenderState *renderState)
{
PASSERT(m_scene->mainCamera() != P_NULL);
// Create a default render pass if none exists
if (m_renderPassArray.isEmpty())
{
PRenderPass *renderPass = PNEW(PRenderPass("default", m_scene));
renderPass->setCamera(m_scene->mainCamera());
renderPass->queue()->addNodes(m_scene->root());
renderPass->target()->setColorClearValue(m_backgroundColor);
PShadowPass *shadowPass = PNEW(PShadowPass("shadow", m_scene));
addRenderPass(shadowPass);
addRenderPass(renderPass);
}
if (m_renderPassArray.isEmpty())
{
PLOG_WARNING("There is no valid render pass existing.");
return ;
}
for (puint32 i = 0; i < m_renderPassArray.size(); ++i)
{
m_renderPassArray[i]->render(renderState);
}
}
开发者ID:Freedom000,项目名称:FutureInterface,代码行数:29,代码来源:prenderer.cpp
示例17: unionfs_fsync
static int unionfs_fsync(struct file *file, struct dentry *dentry, int datasync)
{
int err;
struct file *hidden_file = NULL;
print_entry_location();
if ((err = unionfs_file_revalidate(file, 1)))
goto out;
PASSERT(ftopd(file));
hidden_file = ftohf(file);
err = -EINVAL;
if (!hidden_file->f_op || !hidden_file->f_op->fsync)
goto out;
down(&hidden_file->f_dentry->d_inode->i_sem);
err = hidden_file->f_op->fsync(hidden_file, hidden_file->f_dentry,
datasync);
up(&hidden_file->f_dentry->d_inode->i_sem);
out:
print_exit_status(err);
return err;
}
开发者ID:BackupTheBerlios,项目名称:dss-svn,代码行数:26,代码来源:file.c
示例18: PASSERT
void PTimer::update(pfloat32 deltaTime)
{
PASSERT(m_manager != P_NULL);
m_elapsedMillis += deltaTime;
if (m_fireMillis < m_elapsedMillis)
{
m_repeatedTimes++;
PEvent* event = createEvent(P_EVENT__TIMER_EXPIRED);
event->setParameter(P_EVENTPARAMETER__TIMER_ID, m_id);
event->setParameter(P_EVENTPARAMETER__TIMER_REPEAT_TIMES, m_repeatedTimes - 1);
event->setParameter(P_EVENTPARAMETER__TIMER_ELAPSED_MILLIS, m_elapsedMillis);
event->queue(reinterpret_cast<PObject *>(P_NULL));
if (m_callback != P_NULL)
{
m_callback->onTimerOut(m_id, m_repeatedTimes, m_elapsedMillis);
}
if (m_repeatedTimes - 1 >= m_repeatCount)
{
kill();
}
else
{
m_fireMillis += m_repeatMillis;
}
}
}
开发者ID:Freedom000,项目名称:FutureInterface,代码行数:30,代码来源:ptimer.cpp
示例19: pMatrix4x4Multiply
pfloat32 * P_APIENTRY pMatrix4x4Multiply(const pfloat32 *a, const pfloat32 *b, pfloat32 *out)
{
PASSERT(a != out && b != out);
#if defined P_USE_SSE
#elif defined P_USE_NEON
#else
out[0] = a[0] * b[0] + a[4] * b[1] + a[8] * b[2] + a[12] * b[3];
out[1] = a[1] * b[0] + a[5] * b[1] + a[9] * b[2] + a[13] * b[3];
out[2] = a[2] * b[0] + a[6] * b[1] + a[10] * b[2] + a[14] * b[3];
out[3] = a[3] * b[0] + a[7] * b[1] + a[11] * b[2] + a[15] * b[3];
out[4] = a[0] * b[4] + a[4] * b[5] + a[8] * b[6] + a[12] * b[7];
out[5] = a[1] * b[4] + a[5] * b[5] + a[9] * b[6] + a[13] * b[7];
out[6] = a[2] * b[4] + a[6] * b[5] + a[10] * b[6] + a[14] * b[7];
out[7] = a[3] * b[4] + a[7] * b[5] + a[11] * b[6] + a[15] * b[7];
out[8] = a[0] * b[8] + a[4] * b[9] + a[8] * b[10] + a[12] * b[11];
out[9] = a[1] * b[8] + a[5] * b[9] + a[9] * b[10] + a[13] * b[11];
out[10] = a[2] * b[8] + a[6] * b[9] + a[10] * b[10] + a[14] * b[11];
out[11] = a[3] * b[8] + a[7] * b[9] + a[11] * b[10] + a[15] * b[11];
out[12] = a[0] * b[12] + a[4] * b[13] + a[8] * b[14] + a[12] * b[15];
out[13] = a[1] * b[12] + a[5] * b[13] + a[9] * b[14] + a[13] * b[15];
out[14] = a[2] * b[12] + a[6] * b[13] + a[10] * b[14] + a[14] * b[15];
out[15] = a[3] * b[12] + a[7] * b[13] + a[11] * b[14] + a[15] * b[15];
#endif
return out;
}
开发者ID:Freedom000,项目名称:FutureInterface,代码行数:31,代码来源:pmatrix4x4.cpp
示例20: ns_epoll_create
ns_epoll_t* ns_epoll_create(unsigned events_count)
{
ns_epoll_t* epoll = malloc(sizeof(*epoll));
PASSERT(epoll, NS_ERR_MALLOC);
epoll->n = 0;
epoll->events_count = events_count;
epoll->events = calloc(epoll->events_count, sizeof(*epoll->events));
PASSERT(epoll->events, NS_ERR_MALLOC);
epoll->evs = calloc(epoll->events_count, sizeof(*epoll->evs));
PASSERT(epoll->evs, NS_ERR_MALLOC);
PASSERT(~(epoll->fd = epoll_create1(0)), "epoll_create1: ");
return epoll;
}
开发者ID:cirocosta,项目名称:netsim,代码行数:16,代码来源:epoll.c
注:本文中的PASSERT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论